@capacitor/splash-screen 4.1.2-nightly-20221108T150804.0 → 4.1.2-nightly-20221110T150813.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.
@@ -1,4 +1,5 @@
1
1
  ext {
2
+ capacitorVersion = System.getenv('CAPACITOR_VERSION')
2
3
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
4
  androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
5
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
@@ -10,13 +11,24 @@ buildscript {
10
11
  repositories {
11
12
  google()
12
13
  mavenCentral()
14
+ maven {
15
+ url "https://plugins.gradle.org/m2/"
16
+ }
13
17
  }
14
18
  dependencies {
15
19
  classpath 'com.android.tools.build:gradle:7.2.1'
20
+ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
21
+ classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
22
+ }
16
23
  }
17
24
  }
18
25
 
19
26
  apply plugin: 'com.android.library'
27
+ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
28
+ apply plugin: 'io.github.gradle-nexus.publish-plugin'
29
+ apply from: file('../../scripts/android/publish-root.gradle')
30
+ apply from: file('../../scripts/android/publish-module.gradle')
31
+ }
20
32
 
21
33
  android {
22
34
  compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
@@ -50,7 +62,13 @@ repositories {
50
62
 
51
63
  dependencies {
52
64
  implementation fileTree(dir: 'libs', include: ['*.jar'])
53
- implementation project(':capacitor-android')
65
+
66
+ if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") {
67
+ implementation "com.capacitorjs:core:$capacitorVersion"
68
+ } else {
69
+ implementation project(':capacitor-android')
70
+ }
71
+
54
72
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
73
  testImplementation "junit:junit:$junitVersion"
56
74
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -12,6 +12,7 @@ import android.graphics.PixelFormat;
12
12
  import android.graphics.drawable.Animatable;
13
13
  import android.graphics.drawable.Drawable;
14
14
  import android.graphics.drawable.LayerDrawable;
15
+ import android.os.Build;
15
16
  import android.os.Handler;
16
17
  import android.view.Gravity;
17
18
  import android.view.LayoutInflater;
@@ -19,6 +20,8 @@ import android.view.View;
19
20
  import android.view.ViewGroup;
20
21
  import android.view.ViewTreeObserver;
21
22
  import android.view.ViewTreeObserver.OnPreDrawListener;
23
+ import android.view.Window;
24
+ import android.view.WindowInsetsController;
22
25
  import android.view.WindowManager;
23
26
  import android.view.animation.LinearInterpolator;
24
27
  import android.widget.FrameLayout;
@@ -26,6 +29,8 @@ import android.widget.ImageView;
26
29
  import android.widget.LinearLayout;
27
30
  import android.widget.ProgressBar;
28
31
  import androidx.appcompat.app.AppCompatActivity;
32
+ import androidx.core.view.WindowCompat;
33
+ import androidx.core.view.WindowInsetsCompat;
29
34
  import com.getcapacitor.Logger;
30
35
 
31
36
  /**
@@ -222,7 +227,7 @@ public class SplashScreen {
222
227
  isVisible = true;
223
228
 
224
229
  if (settings.isAutoHide()) {
225
- new Handler()
230
+ new Handler(context.getMainLooper())
226
231
  .postDelayed(
227
232
  () -> {
228
233
  hideDialog(activity, isLaunchSplash);
@@ -312,7 +317,11 @@ public class SplashScreen {
312
317
  // Stops flickers dead in their tracks
313
318
  // https://stackoverflow.com/a/21847579/32140
314
319
  ImageView imageView = (ImageView) splashImage;
315
- imageView.setDrawingCacheEnabled(true);
320
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
321
+ imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
322
+ } else {
323
+ legacyStopFlickers(imageView);
324
+ }
316
325
  imageView.setScaleType(config.getScaleType());
317
326
  imageView.setImageDrawable(splash);
318
327
  }
@@ -320,19 +329,6 @@ public class SplashScreen {
320
329
 
321
330
  splashImage.setFitsSystemWindows(true);
322
331
 
323
- if (config.isImmersive()) {
324
- final int flags =
325
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
326
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
327
- View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
328
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
329
- View.SYSTEM_UI_FLAG_FULLSCREEN |
330
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
331
- splashImage.setSystemUiVisibility(flags);
332
- } else if (config.isFullScreen()) {
333
- splashImage.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
334
- }
335
-
336
332
  if (config.getBackgroundColor() != null) {
337
333
  splashImage.setBackgroundColor(config.getBackgroundColor());
338
334
  }
@@ -362,6 +358,11 @@ public class SplashScreen {
362
358
  }
363
359
  }
364
360
 
361
+ @SuppressWarnings("deprecation")
362
+ private void legacyStopFlickers(ImageView imageView) {
363
+ imageView.setDrawingCacheEnabled(true);
364
+ }
365
+
365
366
  private Drawable getSplashDrawable() {
366
367
  int splashId = context.getResources().getIdentifier(config.getResourceName(), "drawable", context.getPackageName());
367
368
  try {
@@ -398,7 +399,7 @@ public class SplashScreen {
398
399
  isVisible = true;
399
400
 
400
401
  if (settings.isAutoHide()) {
401
- new Handler()
402
+ new Handler(context.getMainLooper())
402
403
  .postDelayed(
403
404
  () -> {
404
405
  hide(settings.getFadeOutDuration(), isLaunchSplash);
@@ -445,6 +446,35 @@ public class SplashScreen {
445
446
  return;
446
447
  }
447
448
 
449
+ if (config.isImmersive()) {
450
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
451
+ activity.runOnUiThread(
452
+ () -> {
453
+ Window window = activity.getWindow();
454
+ WindowCompat.setDecorFitsSystemWindows(window, false);
455
+ WindowInsetsController controller = splashImage.getWindowInsetsController();
456
+ controller.hide(WindowInsetsCompat.Type.systemBars());
457
+ controller.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
458
+ }
459
+ );
460
+ } else {
461
+ legacyImmersive();
462
+ }
463
+ } else if (config.isFullScreen()) {
464
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
465
+ activity.runOnUiThread(
466
+ () -> {
467
+ Window window = activity.getWindow();
468
+ WindowCompat.setDecorFitsSystemWindows(window, false);
469
+ WindowInsetsController controller = splashImage.getWindowInsetsController();
470
+ controller.hide(WindowInsetsCompat.Type.statusBars());
471
+ }
472
+ );
473
+ } else {
474
+ legacyFullscreen();
475
+ }
476
+ }
477
+
448
478
  splashImage.setAlpha(0f);
449
479
 
450
480
  splashImage
@@ -486,6 +516,23 @@ public class SplashScreen {
486
516
  );
487
517
  }
488
518
 
519
+ @SuppressWarnings("deprecation")
520
+ private void legacyImmersive() {
521
+ final int flags =
522
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
523
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
524
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
525
+ View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
526
+ View.SYSTEM_UI_FLAG_FULLSCREEN |
527
+ View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
528
+ splashImage.setSystemUiVisibility(flags);
529
+ }
530
+
531
+ @SuppressWarnings("deprecation")
532
+ private void legacyFullscreen() {
533
+ splashImage.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
534
+ }
535
+
489
536
  private void hide(final int fadeOutDuration, boolean isLaunchSplash) {
490
537
  // Warn the user if the splash was hidden automatically, which means they could be experiencing an app
491
538
  // that feels slower than it actually is.
@@ -614,6 +661,11 @@ public class SplashScreen {
614
661
  windowManager.removeView(splashImage);
615
662
  }
616
663
 
664
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && config.isFullScreen() || config.isImmersive()) {
665
+ // Exit fullscreen mode
666
+ Window window = ((Activity) context).getWindow();
667
+ WindowCompat.setDecorFitsSystemWindows(window, true);
668
+ }
617
669
  isHiding = false;
618
670
  isVisible = false;
619
671
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/splash-screen",
3
- "version": "4.1.2-nightly-20221108T150804.0",
3
+ "version": "4.1.2-nightly-20221110T150813.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": "f24a16b1f74f6e11b2f22646faa329e11618f03f"
83
+ "gitHead": "5fa87ea03d7a24297a98cc74be391b6b66db9e21"
84
84
  }