Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycodeboy committed Jul 10, 2018
2 parents e088a4a + c8bb8d4 commit 2b96a49
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Activity;
import android.app.Dialog;
import android.os.Build;

import java.lang.ref.WeakReference;

Expand Down Expand Up @@ -65,13 +66,24 @@ public static void hide(Activity activity) {
}
activity = mActivity.get();
}

if (activity == null) return;

activity.runOnUiThread(new Runnable() {
final Activity _activity = activity;

_activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mSplashDialog != null && mSplashDialog.isShowing()) {
mSplashDialog.dismiss();
boolean isDestroyed = false;

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
isDestroyed = _activity.isDestroyed();
}

if (!_activity.isFinishing() && !isDestroyed) {
mSplashDialog.dismiss();
}
mSplashDialog = null;
}
}
Expand Down

0 comments on commit 2b96a49

Please sign in to comment.