Fix thumb blinking

This commit is contained in:
NekoInverter committed 2021-01-24 20:34:08 +08:00
1 parent 3631734c95
commit 37dcf125e0
1 file changed
+11 -11
@@ -65,7 +65,7 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Image
private int mClipHeight = Integer.MIN_VALUE;
private int mRetryType;
private boolean mFailed;
private boolean mLoadFromDrawable;
private boolean mLoadFromDrawable = false;
public LoadImageView(Context context) {
super(context);
@@ -109,7 +109,7 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Image
if (!mLoadFromDrawable) {
if (mFailed) {
onFailure();
} else if (mTaskId == Unikery.INVALID_ID) /* if (!mConaco.isLoading(mTaskId)) TODO Update Conaco */ {
} else if (mConaco.isLoading(this)) {
load(mKey, mUrl, mContainer, mUseNetwork);
}
}
@@ -120,14 +120,16 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Image
super.onDetachedFromWindow();
if (!mLoadFromDrawable) {
try {
// Cancel
mConaco.cancel(this);
} catch (Exception e) {
// Ignore
if (mConaco.isLoading(this)) {
try {
// Cancel
mConaco.cancel(this);
} catch (Exception e) {
// Ignore
}
// Clear drawable
clearDrawable();
}
// Clear drawable
clearDrawable();
}
}
@@ -220,7 +222,6 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Image
return;
}
mLoadFromDrawable = false;
mFailed = false;
clearRetry();
@@ -240,7 +241,6 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Image
public void load(Drawable drawable) {
unload();
mLoadFromDrawable = true;
onPreSetImageDrawable(drawable, true);
setImageDrawable(drawable);
}