直播间聊天列表展示不全问题修复

This commit is contained in:
18401019693 2022-09-17 14:33:55 +08:00
parent fc0c734261
commit c95fd2d49c

View File

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.TextUtils;
import android.widget.ImageView;
import androidx.annotation.NonNull;
@ -12,7 +13,6 @@ import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.yunbao.common.R;
@ -127,23 +127,32 @@ public class ImgLoader {
public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
if (!contextIsExist(context)) {
return;
}
Glide.with(context).asDrawable().load(url).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
if (TextUtils.isEmpty(url)) {
if (callback != null)
callback.onLoadFailed();
} else {
Glide.with(context).asDrawable().load(url).skipMemoryCache(SKIP_MEMORY_CACHE).into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
if (callback != null) {
callback.onLoadSuccess(resource);
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
if (callback != null) {
callback.onLoadSuccess(resource);
}
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
}
});
}
public static void displayFileDrawable(Context context, File file, final DrawableCallback callback) {
if (!contextIsExist(context)) {
return;