Merge pull request #151 from PhotonQyv/GlideCrashFix

Added code to fix a crash.
This commit is contained in:
Thomas 2017-12-17 13:49:18 +01:00 committed by GitHub
commit d7b52db060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import android.graphics.Rect;
import android.graphics.RectF; import android.graphics.RectF;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.app.DownloadManager; import android.app.DownloadManager;
@ -1743,6 +1744,14 @@ public class Helper {
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false); boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false);
if (context instanceof FragmentActivity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ((FragmentActivity) context).isDestroyed())
{
return;
}
}
if( !disableGif) if( !disableGif)
Glide.with(imageView.getContext()) Glide.with(imageView.getContext())
.load(url) .load(url)