Added code to hopefully fix a crash caused by passing a destroyed context into the Glide library.
This commit is contained in:
parent
5c8f10f806
commit
6aecf9e3c2
|
@ -28,6 +28,7 @@ import android.graphics.Rect;
|
|||
import android.graphics.RectF;
|
||||
import android.os.CountDownTimer;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.app.DownloadManager;
|
||||
|
@ -1743,6 +1744,14 @@ public class Helper {
|
|||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
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)
|
||||
Glide.with(imageView.getContext())
|
||||
.load(url)
|
||||
|
|
Loading…
Reference in New Issue