From ed6df50d31b6bb8228998878edbe9d8ddbc7751a Mon Sep 17 00:00:00 2001 From: crazycodeboy Date: Sun, 10 Sep 2017 21:21:35 +0800 Subject: [PATCH] Move from com.cboy to org.devio --- android/src/main/AndroidManifest.xml | 2 +- .../devio}/rn/splashscreen/SplashScreen.java | 19 ++++++++++++++----- .../rn/splashscreen/SplashScreenModule.java | 2 +- .../SplashScreenReactPackage.java | 2 +- package.json | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) rename android/src/main/java/{com/cboy => org/devio}/rn/splashscreen/SplashScreen.java (75%) rename android/src/main/java/{com/cboy => org/devio}/rn/splashscreen/SplashScreenModule.java (96%) rename android/src/main/java/{com/cboy => org/devio}/rn/splashscreen/SplashScreenReactPackage.java (96%) diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index d38d89a7..a2abaf6f 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="org.devio.rn.splashscreen"> (activity); activity.runOnUiThread(new Runnable() { @@ -26,7 +28,7 @@ public static void show(final Activity activity,final boolean fullScreen) { public void run() { if (!activity.isFinishing()) { - mSplashDialog = new Dialog(activity,fullScreen? R.style.SplashScreen_Fullscreen:R.style.SplashScreen_SplashTheme); + mSplashDialog = new Dialog(activity, fullScreen ? R.style.SplashScreen_Fullscreen : R.style.SplashScreen_SplashTheme); mSplashDialog.setContentView(R.layout.launch_screen); mSplashDialog.setCancelable(false); @@ -37,18 +39,24 @@ public void run() { } }); } + /** * 打开启动屏 */ public static void show(final Activity activity) { - show(activity,false); + show(activity, false); } /** * 关闭启动屏 */ public static void hide(Activity activity) { - if (activity == null) activity = mActivity.get(); + if (activity == null) { + if (mActivity == null) { + return; + } + activity = mActivity.get(); + } if (activity == null) return; activity.runOnUiThread(new Runnable() { @@ -56,6 +64,7 @@ public static void hide(Activity activity) { public void run() { if (mSplashDialog != null && mSplashDialog.isShowing()) { mSplashDialog.dismiss(); + mSplashDialog = null; } } }); diff --git a/android/src/main/java/com/cboy/rn/splashscreen/SplashScreenModule.java b/android/src/main/java/org/devio/rn/splashscreen/SplashScreenModule.java similarity index 96% rename from android/src/main/java/com/cboy/rn/splashscreen/SplashScreenModule.java rename to android/src/main/java/org/devio/rn/splashscreen/SplashScreenModule.java index e57197f9..e25c6b80 100644 --- a/android/src/main/java/com/cboy/rn/splashscreen/SplashScreenModule.java +++ b/android/src/main/java/org/devio/rn/splashscreen/SplashScreenModule.java @@ -1,4 +1,4 @@ -package com.cboy.rn.splashscreen; +package org.devio.rn.splashscreen; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; diff --git a/android/src/main/java/com/cboy/rn/splashscreen/SplashScreenReactPackage.java b/android/src/main/java/org/devio/rn/splashscreen/SplashScreenReactPackage.java similarity index 96% rename from android/src/main/java/com/cboy/rn/splashscreen/SplashScreenReactPackage.java rename to android/src/main/java/org/devio/rn/splashscreen/SplashScreenReactPackage.java index 5cb662f8..22cda5a7 100644 --- a/android/src/main/java/com/cboy/rn/splashscreen/SplashScreenReactPackage.java +++ b/android/src/main/java/org/devio/rn/splashscreen/SplashScreenReactPackage.java @@ -1,4 +1,4 @@ -package com.cboy.rn.splashscreen; +package org.devio.rn.splashscreen; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; diff --git a/package.json b/package.json index b42560c2..1cf3c784 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-splash-screen", - "version": "3.0.0", + "version": "3.0.1", "description": "A splash screen for react-native, hide when application loaded ,it works on iOS and Android.", "main": "index.js", "scripts": {