Skip to content

Fixes Android crash #49 #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ protected static Activity getActivity() {
return wr_activity.get();
}

protected static boolean hasActivity() {
return (wr_activity != null);
}

public static void openSplashScreen(Activity activity) {
openSplashScreen(activity, false);
}
Expand All @@ -49,7 +53,7 @@ public static void openSplashScreen(final Activity activity, final boolean isFul
activity.runOnUiThread(new Runnable() {
public void run() {

if(!getActivity().isFinishing()) {
if(hasActivity() && !getActivity().isFinishing()) {
Context context = getActivity();
imageView = new ImageView(context);

Expand Down Expand Up @@ -78,9 +82,10 @@ public void run() {
}

public static void removeSplashScreen(Activity activity, final int animationType,final int duration) {
if (activity == null) {
if (hasActivity()) {
activity = getActivity();
if(activity == null) return;
} else {
return;
}
activity.runOnUiThread(new Runnable() {
public void run() {
Expand Down