|
|
|
|
@ -17,6 +17,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; |
|
|
|
|
import com.bumptech.glide.load.engine.GlideException; |
|
|
|
|
import com.bumptech.glide.load.model.GlideUrl; |
|
|
|
|
import com.bumptech.glide.load.model.LazyHeaders; |
|
|
|
|
import com.bumptech.glide.load.resource.gif.GifDrawable; |
|
|
|
|
import com.bumptech.glide.request.RequestListener; |
|
|
|
|
import com.bumptech.glide.request.target.Target; |
|
|
|
|
import com.bumptech.glide.request.transition.Transition; |
|
|
|
|
@ -47,13 +48,14 @@ public class ImgUtil { |
|
|
|
|
public static void load(String text, String url, ImageView view, boolean vod) { |
|
|
|
|
if (!vod) view.setVisibility(TextUtils.isEmpty(url) ? View.GONE : View.VISIBLE); |
|
|
|
|
if (TextUtils.isEmpty(url) || failed.contains(url)) view.setImageDrawable(getTextDrawable(text, vod)); |
|
|
|
|
else view.post(() -> Glide.with(view).load(getUrl(url)).override(view.getWidth(), view.getHeight()).dontAnimate().listener(getListener(text, url, view, vod)).into(view)); |
|
|
|
|
else view.post(() -> Glide.with(view).load(getUrl(url)).override(view.getWidth(), view.getHeight()).listener(getListener(text, url, view, vod)).into(view)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void load(File file, ImageView view) { |
|
|
|
|
Glide.with(view).load(file).dontAnimate().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(new CustomTarget<Drawable>() { |
|
|
|
|
Glide.with(view).load(file).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(new CustomTarget<Drawable>() { |
|
|
|
|
@Override |
|
|
|
|
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { |
|
|
|
|
if (resource instanceof GifDrawable) ((GifDrawable) resource).start(); |
|
|
|
|
view.setImageDrawable(resource); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|