Skip to content

Commit

Permalink
Move from com.cboy to org.devio
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycodeboy committed Sep 10, 2017
1 parent 9153625 commit ed6df50
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cboy.rn.splashscreen">
package="org.devio.rn.splashscreen">

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.cboy.rn.splashscreen;
package org.devio.rn.splashscreen;

import android.app.Activity;
import android.app.Dialog;

import java.lang.ref.WeakReference;

/**
* SplashScreen
* 启动屏
Expand All @@ -18,15 +20,15 @@ public class SplashScreen {
/**
* 打开启动屏
*/
public static void show(final Activity activity,final boolean fullScreen) {
public static void show(final Activity activity, final boolean fullScreen) {
if (activity == null) return;
mActivity = new WeakReference<Activity>(activity);
activity.runOnUiThread(new Runnable() {
@Override
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);

Expand All @@ -37,25 +39,32 @@ 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() {
@Override
public void run() {
if (mSplashDialog != null && mSplashDialog.isShowing()) {
mSplashDialog.dismiss();
mSplashDialog = null;
}
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit ed6df50

Please sign in to comment.