diff --git a/README.md b/README.md index f3059d98..74385066 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ Create a style definition for this in `android/app/src/main/res/values/colors.xm Change your `show` method to include your custom style: ```java -SplashScreen.show(this, false, R.style.SplashScreenTheme); +SplashScreen.show(this, R.style.SplashScreenTheme); ``` ### iOS diff --git a/android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java b/android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java index 575d3f8e..59780ca8 100644 --- a/android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java +++ b/android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java @@ -14,27 +14,20 @@ * Email:crazycodeboy@gmail.com */ public class SplashScreen { - private static int NULL_ID = 0; private static Dialog mSplashDialog; private static WeakReference mActivity; /** * 打开启动屏 */ - public static void show(final Activity activity, final boolean fullScreen, final int themeResId) { + public static void show(final Activity activity, final int themeResId) { if (activity == null) return; mActivity = new WeakReference(activity); activity.runOnUiThread(new Runnable() { @Override public void run() { if (!activity.isFinishing()) { - - mSplashDialog = new Dialog( - activity, - themeResId != NULL_ID ? themeResId - : fullScreen ? R.style.SplashScreen_Fullscreen - : R.style.SplashScreen_SplashTheme - ); + mSplashDialog = new Dialog(activity, themeResId); mSplashDialog.setContentView(R.layout.launch_screen); mSplashDialog.setCancelable(false); @@ -50,7 +43,9 @@ public void run() { * 打开启动屏 */ public static void show(final Activity activity, final boolean fullScreen) { - show(activity, fullScreen, 0); + int resourceId = fullScreen ? R.style.SplashScreen_Fullscreen : R.style.SplashScreen_SplashTheme; + + show(activity, resourceId); } /**