直播间聊天列表展示不全问题修复
This commit is contained in:
parent
fc0c734261
commit
c95fd2d49c
@ -4,6 +4,7 @@ import android.app.Activity;
|
|||||||
import android.content.Context;
|
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.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -12,7 +13,6 @@ import androidx.annotation.Nullable;
|
|||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.target.SimpleTarget;
|
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
|
|
||||||
@ -127,23 +127,32 @@ public class ImgLoader {
|
|||||||
|
|
||||||
public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
|
public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
|
||||||
if (!contextIsExist(context)) {
|
if (!contextIsExist(context)) {
|
||||||
|
|
||||||
return;
|
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
|
@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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void displayFileDrawable(Context context, File file, final DrawableCallback callback) {
|
public static void displayFileDrawable(Context context, File file, final DrawableCallback callback) {
|
||||||
if (!contextIsExist(context)) {
|
if (!contextIsExist(context)) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user