@capacitor/splash-screen 4.1.5-nightly-20230206T151046.0 → 4.1.5-nightly-20230208T150855.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -98,6 +98,7 @@ These config values are available:
98
98
  | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----- |
99
99
  | **`launchShowDuration`** | <code>number</code> | How long to show the launch splash screen when autoHide is enabled (in ms) | <code>500</code> | 1.0.0 |
100
100
  | **`launchAutoHide`** | <code>boolean</code> | Whether to auto hide the splash after launchShowDuration. | <code>true</code> | 1.0.0 |
101
+ | **`launchFadeOutDuration`** | <code>number</code> | Duration for the fade out animation of the launch splash screen (in ms) Only available for Android, when using the Android 12 Splash Screen API. | <code>200</code> | 4.2.0 |
101
102
  | **`backgroundColor`** | <code>string</code> | Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. | | 1.0.0 |
102
103
  | **`androidSplashResourceName`** | <code>string</code> | Name of the resource to be used as Splash Screen. Doesn't work on launch when using the Android 12 API. Only available on Android. | <code>splash</code> | 1.0.0 |
103
104
  | **`androidScaleType`** | <code>'CENTER' \| 'CENTER_CROP' \| 'CENTER_INSIDE' \| 'FIT_CENTER' \| 'FIT_END' \| 'FIT_START' \| 'FIT_XY' \| 'MATRIX'</code> | The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale the Splash Screen image. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. Only available on Android. | <code>FIT_XY</code> | 1.0.0 |
@@ -120,6 +121,7 @@ In `capacitor.config.json`:
120
121
  "SplashScreen": {
121
122
  "launchShowDuration": 3000,
122
123
  "launchAutoHide": true,
124
+ "launchFadeOutDuration": 3000,
123
125
  "backgroundColor": "#ffffffff",
124
126
  "androidSplashResourceName": "splash",
125
127
  "androidScaleType": "CENTER_CROP",
@@ -148,6 +150,7 @@ const config: CapacitorConfig = {
148
150
  SplashScreen: {
149
151
  launchShowDuration: 3000,
150
152
  launchAutoHide: true,
153
+ launchFadeOutDuration: 3000,
151
154
  backgroundColor: "#ffffffff",
152
155
  androidSplashResourceName: "splash",
153
156
  androidScaleType: "CENTER_CROP",
@@ -252,8 +255,8 @@ Hide the splash screen
252
255
 
253
256
  #### HideOptions
254
257
 
255
- | Prop | Type | Description | Default | Since |
256
- | --------------------- | ------------------- | ----------------------------- | ---------------- | ----- |
257
- | **`fadeOutDuration`** | <code>number</code> | How long (in ms) to fade out. | <code>200</code> | 1.0.0 |
258
+ | Prop | Type | Description | Default | Since |
259
+ | --------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ----- |
260
+ | **`fadeOutDuration`** | <code>number</code> | How long (in ms) to fade out. On Android, if using the Android 12 Splash Screen API, it's not being used. Use launchFadeOutDuration configuration option instead. | <code>200</code> | 1.0.0 |
258
261
 
259
262
  </docgen-api>
@@ -102,29 +102,44 @@ public class SplashScreen {
102
102
  );
103
103
  windowSplashScreen.setKeepOnScreenCondition(() -> isVisible || isHiding);
104
104
 
105
- // Set Fade Out Animation
106
- windowSplashScreen.setOnExitAnimationListener(
107
- windowSplashScreenView -> {
108
- final ObjectAnimator fadeAnimator = ObjectAnimator.ofFloat(windowSplashScreenView.getView(), View.ALPHA, 1f, 0f);
109
- fadeAnimator.setInterpolator(new LinearInterpolator());
110
- fadeAnimator.setDuration(settings.getFadeOutDuration());
111
-
112
- fadeAnimator.addListener(
113
- new AnimatorListenerAdapter() {
114
- @Override
115
- public void onAnimationEnd(Animator animation) {
116
- isHiding = false;
117
- windowSplashScreenView.remove();
105
+ if (config.getLaunchFadeOutDuration() > 0) {
106
+ // Set Fade Out Animation
107
+ windowSplashScreen.setOnExitAnimationListener(
108
+ windowSplashScreenView -> {
109
+ final ObjectAnimator fadeAnimator = ObjectAnimator.ofFloat(
110
+ windowSplashScreenView.getView(),
111
+ View.ALPHA,
112
+ 1f,
113
+ 0f
114
+ );
115
+ fadeAnimator.setInterpolator(new LinearInterpolator());
116
+ fadeAnimator.setDuration(config.getLaunchFadeOutDuration());
117
+
118
+ fadeAnimator.addListener(
119
+ new AnimatorListenerAdapter() {
120
+ @Override
121
+ public void onAnimationEnd(Animator animation) {
122
+ isHiding = false;
123
+ windowSplashScreenView.remove();
124
+ }
118
125
  }
119
- }
120
- );
126
+ );
121
127
 
122
- fadeAnimator.start();
128
+ fadeAnimator.start();
123
129
 
124
- isHiding = true;
125
- isVisible = false;
126
- }
127
- );
130
+ isHiding = true;
131
+ isVisible = false;
132
+ }
133
+ );
134
+ } else {
135
+ windowSplashScreen.setOnExitAnimationListener(
136
+ windowSplashScreenView -> {
137
+ isHiding = false;
138
+ isVisible = false;
139
+ windowSplashScreenView.remove();
140
+ }
141
+ );
142
+ }
128
143
 
129
144
  // Set Pre Draw Listener & Delay Drawing Until Duration Elapses
130
145
  content = activity.findViewById(android.R.id.content);
@@ -550,6 +565,11 @@ public class SplashScreen {
550
565
 
551
566
  // Hide with Android 12 API
552
567
  if (null != this.onPreDrawListener) {
568
+ if (fadeOutDuration != 200) {
569
+ Logger.warn(
570
+ "fadeOutDuration parameter doesn't work on initial splash screen, use launchFadeOutDuration configuration option"
571
+ );
572
+ }
553
573
  this.isVisible = false;
554
574
  if (null != content) {
555
575
  content.getViewTreeObserver().removeOnPreDrawListener(this.onPreDrawListener);
@@ -11,6 +11,7 @@ public class SplashScreenConfig {
11
11
  private Integer launchShowDuration = 500;
12
12
  private boolean launchAutoHide = true;
13
13
  private Integer launchFadeInDuration = 0;
14
+ private Integer launchFadeOutDuration = 200;
14
15
  private String resourceName = "splash";
15
16
  private boolean immersive = false;
16
17
  private boolean fullScreen = false;
@@ -117,4 +118,12 @@ public class SplashScreenConfig {
117
118
  public void setLayoutName(String layoutName) {
118
119
  this.layoutName = layoutName;
119
120
  }
121
+
122
+ public Integer getLaunchFadeOutDuration() {
123
+ return launchFadeOutDuration;
124
+ }
125
+
126
+ public void setLaunchFadeOutDuration(Integer launchFadeOutDuration) {
127
+ this.launchFadeOutDuration = launchFadeOutDuration;
128
+ }
120
129
  }
@@ -93,6 +93,8 @@ public class SplashScreenPlugin extends Plugin {
93
93
  }
94
94
  Integer duration = getConfig().getInt("launchShowDuration", config.getLaunchShowDuration());
95
95
  config.setLaunchShowDuration(duration);
96
+ Integer fadeOutDuration = getConfig().getInt("launchFadeOutDuration", config.getLaunchFadeOutDuration());
97
+ config.setLaunchFadeOutDuration(fadeOutDuration);
96
98
  Boolean autohide = getConfig().getBoolean("launchAutoHide", config.isLaunchAutoHide());
97
99
  config.setLaunchAutoHide(autohide);
98
100
  if (getConfig().getString("androidSplashResourceName") != null) {
package/dist/docs.json CHANGED
@@ -143,7 +143,7 @@
143
143
  "name": "default"
144
144
  }
145
145
  ],
146
- "docs": "How long (in ms) to fade out.",
146
+ "docs": "How long (in ms) to fade out.\n\nOn Android, if using the Android 12 Splash Screen API, it's not being used.\nUse launchFadeOutDuration configuration option instead.",
147
147
  "complexTypes": [],
148
148
  "type": "number | undefined"
149
149
  }
@@ -197,6 +197,26 @@
197
197
  "complexTypes": [],
198
198
  "type": "boolean | undefined"
199
199
  },
200
+ {
201
+ "name": "launchFadeOutDuration",
202
+ "tags": [
203
+ {
204
+ "text": "4.2.0",
205
+ "name": "since"
206
+ },
207
+ {
208
+ "text": "200",
209
+ "name": "default"
210
+ },
211
+ {
212
+ "text": "3000",
213
+ "name": "example"
214
+ }
215
+ ],
216
+ "docs": "Duration for the fade out animation of the launch splash screen (in ms)\n\nOnly available for Android, when using the Android 12 Splash Screen API.",
217
+ "complexTypes": [],
218
+ "type": "number | undefined"
219
+ },
200
220
  {
201
221
  "name": "backgroundColor",
202
222
  "tags": [
@@ -20,6 +20,16 @@ declare module '@capacitor/cli' {
20
20
  * @example true
21
21
  */
22
22
  launchAutoHide?: boolean;
23
+ /**
24
+ * Duration for the fade out animation of the launch splash screen (in ms)
25
+ *
26
+ * Only available for Android, when using the Android 12 Splash Screen API.
27
+ *
28
+ * @since 4.2.0
29
+ * @default 200
30
+ * @example 3000
31
+ */
32
+ launchFadeOutDuration?: number;
23
33
  /**
24
34
  * Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.
25
35
  * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
@@ -171,6 +181,9 @@ export interface HideOptions {
171
181
  /**
172
182
  * How long (in ms) to fade out.
173
183
  *
184
+ * On Android, if using the Android 12 Splash Screen API, it's not being used.
185
+ * Use launchFadeOutDuration configuration option instead.
186
+ *
174
187
  * @since 1.0.0
175
188
  * @default 200
176
189
  */
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * These config values are available:\n */\n SplashScreen?: {\n /**\n * How long to show the launch splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 500\n * @example 3000\n */\n launchShowDuration?: number;\n\n /**\n * Whether to auto hide the splash after launchShowDuration.\n *\n * @since 1.0.0\n * @default true\n * @example true\n */\n launchAutoHide?: boolean;\n\n /**\n * Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example \"#ffffffff\"\n */\n backgroundColor?: string;\n\n /**\n * Name of the resource to be used as Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default splash\n * @example \"splash\"\n */\n androidSplashResourceName?: string;\n\n /**\n * The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale\n * the Splash Screen image.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default FIT_XY\n * @example \"CENTER_CROP\"\n */\n androidScaleType?:\n | 'CENTER'\n | 'CENTER_CROP'\n | 'CENTER_INSIDE'\n | 'FIT_CENTER'\n | 'FIT_END'\n | 'FIT_START'\n | 'FIT_XY'\n | 'MATRIX';\n\n /**\n * Show a loading spinner on the Splash Screen.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example true\n */\n showSpinner?: boolean;\n\n /**\n * Style of the Android spinner.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @default large\n * @example \"large\"\n */\n androidSpinnerStyle?:\n | 'horizontal'\n | 'small'\n | 'large'\n | 'inverse'\n | 'smallInverse'\n | 'largeInverse';\n\n /**\n * Style of the iOS spinner.\n * Doesn't work if `useDialog` is true.\n *\n * Only available on iOS.\n *\n * @since 1.0.0\n * @default large\n * @example \"small\"\n */\n iosSpinnerStyle?: 'large' | 'small';\n\n /**\n * Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example \"#999999\"\n */\n spinnerColor?: string;\n\n /**\n * Hide the status bar on the Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashFullScreen?: boolean;\n\n /**\n * Hide the status bar and the software navigation buttons on the Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashImmersive?: boolean;\n\n /**\n * If `useDialog` is set to true, configure the Dialog layout.\n * If `useDialog` is not set or false, use a layout instead of the ImageView.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example \"launch_screen\"\n */\n layoutName?: string;\n\n /**\n * Use a Dialog instead of an ImageView.\n * If `layoutName` is not configured, it will use\n * a layout that uses the splash image as background.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example true\n */\n useDialog?: boolean;\n };\n }\n}\n\nexport interface ShowOptions {\n /**\n * Whether to auto hide the splash after showDuration\n *\n * @since 1.0.0\n */\n autoHide?: boolean;\n /**\n * How long (in ms) to fade in.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeInDuration?: number;\n /**\n * How long (in ms) to fade out.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n /**\n * How long to show the splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 3000\n */\n showDuration?: number;\n}\n\nexport interface HideOptions {\n /**\n * How long (in ms) to fade out.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n}\n\nexport interface SplashScreenPlugin {\n /**\n * Show the splash screen\n *\n * @since 1.0.0\n */\n show(options?: ShowOptions): Promise<void>;\n /**\n * Hide the splash screen\n *\n * @since 1.0.0\n */\n hide(options?: HideOptions): Promise<void>;\n}\n\n/**\n * @deprecated Use `ShowOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenShowOptions = ShowOptions;\n\n/**\n * @deprecated Use `HideOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenHideOptions = HideOptions;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * These config values are available:\n */\n SplashScreen?: {\n /**\n * How long to show the launch splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 500\n * @example 3000\n */\n launchShowDuration?: number;\n\n /**\n * Whether to auto hide the splash after launchShowDuration.\n *\n * @since 1.0.0\n * @default true\n * @example true\n */\n launchAutoHide?: boolean;\n\n /**\n * Duration for the fade out animation of the launch splash screen (in ms)\n *\n * Only available for Android, when using the Android 12 Splash Screen API.\n *\n * @since 4.2.0\n * @default 200\n * @example 3000\n */\n launchFadeOutDuration?: number;\n\n /**\n * Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example \"#ffffffff\"\n */\n backgroundColor?: string;\n\n /**\n * Name of the resource to be used as Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default splash\n * @example \"splash\"\n */\n androidSplashResourceName?: string;\n\n /**\n * The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale\n * the Splash Screen image.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default FIT_XY\n * @example \"CENTER_CROP\"\n */\n androidScaleType?:\n | 'CENTER'\n | 'CENTER_CROP'\n | 'CENTER_INSIDE'\n | 'FIT_CENTER'\n | 'FIT_END'\n | 'FIT_START'\n | 'FIT_XY'\n | 'MATRIX';\n\n /**\n * Show a loading spinner on the Splash Screen.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example true\n */\n showSpinner?: boolean;\n\n /**\n * Style of the Android spinner.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @default large\n * @example \"large\"\n */\n androidSpinnerStyle?:\n | 'horizontal'\n | 'small'\n | 'large'\n | 'inverse'\n | 'smallInverse'\n | 'largeInverse';\n\n /**\n * Style of the iOS spinner.\n * Doesn't work if `useDialog` is true.\n *\n * Only available on iOS.\n *\n * @since 1.0.0\n * @default large\n * @example \"small\"\n */\n iosSpinnerStyle?: 'large' | 'small';\n\n /**\n * Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example \"#999999\"\n */\n spinnerColor?: string;\n\n /**\n * Hide the status bar on the Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashFullScreen?: boolean;\n\n /**\n * Hide the status bar and the software navigation buttons on the Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashImmersive?: boolean;\n\n /**\n * If `useDialog` is set to true, configure the Dialog layout.\n * If `useDialog` is not set or false, use a layout instead of the ImageView.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example \"launch_screen\"\n */\n layoutName?: string;\n\n /**\n * Use a Dialog instead of an ImageView.\n * If `layoutName` is not configured, it will use\n * a layout that uses the splash image as background.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example true\n */\n useDialog?: boolean;\n };\n }\n}\n\nexport interface ShowOptions {\n /**\n * Whether to auto hide the splash after showDuration\n *\n * @since 1.0.0\n */\n autoHide?: boolean;\n /**\n * How long (in ms) to fade in.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeInDuration?: number;\n /**\n * How long (in ms) to fade out.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n /**\n * How long to show the splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 3000\n */\n showDuration?: number;\n}\n\nexport interface HideOptions {\n /**\n * How long (in ms) to fade out.\n *\n * On Android, if using the Android 12 Splash Screen API, it's not being used.\n * Use launchFadeOutDuration configuration option instead.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n}\n\nexport interface SplashScreenPlugin {\n /**\n * Show the splash screen\n *\n * @since 1.0.0\n */\n show(options?: ShowOptions): Promise<void>;\n /**\n * Hide the splash screen\n *\n * @since 1.0.0\n */\n hide(options?: HideOptions): Promise<void>;\n}\n\n/**\n * @deprecated Use `ShowOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenShowOptions = ShowOptions;\n\n/**\n * @deprecated Use `HideOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenHideOptions = HideOptions;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/splash-screen",
3
- "version": "4.1.5-nightly-20230206T151046.0",
3
+ "version": "4.1.5-nightly-20230208T150855.0",
4
4
  "description": "The Splash Screen API provides methods for showing or hiding a Splash image.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "2a61881bef130df4ecb9bbf9479337488e499f68"
83
+ "gitHead": "66929c2177009f65758ccbacdc166ae95294ef37"
84
84
  }