diff --git a/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashDialog.java b/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashDialog.java
index 374b2625..179a54cb 100644
--- a/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashDialog.java
+++ b/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashDialog.java
@@ -24,10 +24,6 @@ public RNBootSplashDialog(@NonNull Activity activity, @StyleRes int themeResId,
setCanceledOnTouchOutside(false);
}
- public boolean getFade() {
- return mFade;
- }
-
@Override
public void onBackPressed() {
Activity activity = getOwnerActivity();
diff --git a/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModuleImpl.java b/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModuleImpl.java
index bf543375..3c78cd7e 100644
--- a/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModuleImpl.java
+++ b/android/src/main/java/com/zoontek/rnbootsplash/RNBootSplashModuleImpl.java
@@ -39,7 +39,9 @@ public class RNBootSplashModuleImpl {
private static int mThemeResId = -1;
@Nullable
- private static RNBootSplashDialog mDialog = null;
+ private static RNBootSplashDialog mInitialDialog = null;
+ @Nullable
+ private static RNBootSplashDialog mFadeOutDialog = null;
protected static void init(
@Nullable final Activity activity,
@@ -110,12 +112,12 @@ public void onSplashScreenExit(@NonNull SplashScreenView view) {
.setOnExitAnimationListener(listener);
}
- mDialog = new RNBootSplashDialog(activity, mThemeResId, false);
+ mInitialDialog = new RNBootSplashDialog(activity, mThemeResId, false);
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
- mDialog.show(new Runnable() {
+ mInitialDialog.show(new Runnable() {
@Override
public void run() {
mShouldKeepOnScreen = false;
@@ -126,14 +128,20 @@ public void run() {
}
public static void onHostResume() {
- if (mDialog != null) {
- mDialog.show();
+ if (mInitialDialog != null) {
+ mInitialDialog.show();
+ }
+ if (mFadeOutDialog != null) {
+ mFadeOutDialog.show();
}
}
public static void onHostPause() {
- if (mDialog != null) {
- mDialog.dismiss();
+ if (mInitialDialog != null) {
+ mInitialDialog.dismiss();
+ }
+ if (mFadeOutDialog != null) {
+ mFadeOutDialog.dismiss();
}
}
@@ -174,53 +182,51 @@ public void run() {
return;
}
- if (mDialog != null && mDialog.getFade()) {
+ if (mFadeOutDialog != null) {
return; // wait until fade out end for clearPromiseQueue
}
- if (mDialog == null) {
+ if (mInitialDialog == null) {
clearPromiseQueue();
return; // both initial and fade out dialog are hidden
}
- final RNBootSplashDialog[] tmp = {mDialog};
-
- if (fade) {
- // Create a new Dialog instance with fade out animation
- mDialog = new RNBootSplashDialog(activity, mThemeResId, true);
-
- mDialog.show(new Runnable() {
-
- @Override
- public void run() {
- tmp[0].dismiss(new Runnable() {
-
- @Override
- public void run() {
- tmp[0] = null;
-
- mDialog.dismiss(new Runnable() {
- @Override
- public void run() {
- mDialog = null;
- clearPromiseQueue();
- }
- });
- }
- });
- }
- });
- } else {
- mDialog = null;
-
- tmp[0].dismiss(new Runnable() {
+ if (!fade) {
+ mInitialDialog.dismiss(new Runnable() {
@Override
public void run() {
- tmp[0] = null;
+ mInitialDialog = null;
clearPromiseQueue();
}
});
+
+ return;
}
+
+ // Create a new Dialog instance with fade out animation
+ mFadeOutDialog = new RNBootSplashDialog(activity, mThemeResId, true);
+
+ mFadeOutDialog.show(new Runnable() {
+
+ @Override
+ public void run() {
+ mInitialDialog.dismiss(new Runnable() {
+
+ @Override
+ public void run() {
+ mInitialDialog = null;
+
+ mFadeOutDialog.dismiss(new Runnable() {
+ @Override
+ public void run() {
+ mFadeOutDialog = null;
+ clearPromiseQueue();
+ }
+ });
+ }
+ });
+ }
+ });
}
});
}
@@ -274,6 +280,6 @@ public static void hide(
}
public static void isVisible(final Promise promise) {
- promise.resolve(mShouldKeepOnScreen || mDialog != null);
+ promise.resolve(mShouldKeepOnScreen || mInitialDialog != null || mFadeOutDialog != null);
}
}
diff --git a/android/src/main/res/drawable-v23/compat_splash_screen.xml b/android/src/main/res/drawable-v23/compat_splash_screen.xml
new file mode 100644
index 00000000..d8eb7db9
--- /dev/null
+++ b/android/src/main/res/drawable-v23/compat_splash_screen.xml
@@ -0,0 +1,20 @@
+
+
+
+ -
+
+
+
+
+
+
+
diff --git a/android/src/main/res/drawable-v23/compat_splash_screen_oneui_4.xml b/android/src/main/res/drawable-v23/compat_splash_screen_oneui_4.xml
index 95e0779a..8463898f 100644
--- a/android/src/main/res/drawable-v23/compat_splash_screen_oneui_4.xml
+++ b/android/src/main/res/drawable-v23/compat_splash_screen_oneui_4.xml
@@ -13,7 +13,10 @@
android:width="144dp"
android:height="144dp" />
- -
-
-
+
diff --git a/android/src/main/res/values-v23/styles.xml b/android/src/main/res/values-v23/styles.xml
index 8eae61e3..738332ae 100644
--- a/android/src/main/res/values-v23/styles.xml
+++ b/android/src/main/res/values-v23/styles.xml
@@ -1,10 +1,6 @@
-
-
-
-
-