删除将网络图片转为Drawable时候的先加载缩略图,因为缩略图和主图加载完都回调,会导致计算换行的代码和之后转Drawable的代码重复多次调用

This commit is contained in:
老皮 2024-10-15 15:51:20 +08:00
parent e526964b11
commit 8d0cf94d46

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -240,13 +241,12 @@ public class ImgLoader {
if (width != -1 && height != -1) { if (width != -1 && height != -1) {
builder = builder.override(width, height); builder = builder.override(width, height);
} }
builder.thumbnail(thumbnail).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() { builder.skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
@Override @Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
if (callback != null) { if (callback != null) {
callback.onLoadSuccess(resource); callback.onLoadSuccess(resource);
} }
} }