|
@@ -10,6 +10,7 @@ import androidx.annotation.DrawableRes;
|
|
|
|
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.request.BaseRequestOptions;
|
|
import com.bumptech.glide.request.BaseRequestOptions;
|
|
|
|
+import com.bumptech.glide.request.RequestOptions;
|
|
import com.hanghui.senic.R;
|
|
import com.hanghui.senic.R;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -45,6 +46,7 @@ public class ImageLoaderUtils {
|
|
loadNetworkPic(imageView.getContext(), imageUrl, imageView);
|
|
loadNetworkPic(imageView.getContext(), imageUrl, imageView);
|
|
} else {
|
|
} else {
|
|
Glide.with(imageView.getContext()).asBitmap().load(imageUrl).dontAnimate().apply(requestOptions)
|
|
Glide.with(imageView.getContext()).asBitmap().load(imageUrl).dontAnimate().apply(requestOptions)
|
|
|
|
+ .apply(new RequestOptions().skipMemoryCache(true)) // 跳过内存缓存
|
|
.into(imageView);
|
|
.into(imageView);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -56,7 +58,9 @@ public class ImageLoaderUtils {
|
|
if(context instanceof Activity && ((Activity) context).isFinishing()) {
|
|
if(context instanceof Activity && ((Activity) context).isFinishing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- Glide.with(context).asBitmap().load(pic).dontAnimate().centerCrop().into(iv);
|
|
|
|
|
|
+ Glide.with(context).asBitmap().load(pic).dontAnimate().centerCrop()
|
|
|
|
+ .apply(new RequestOptions().skipMemoryCache(true)) // 跳过内存缓存
|
|
|
|
+ .into(iv);
|
|
}
|
|
}
|
|
|
|
|
|
public static void loadRes(@DrawableRes int res, ImageView imageView ){
|
|
public static void loadRes(@DrawableRes int res, ImageView imageView ){
|
|
@@ -66,7 +70,9 @@ public class ImageLoaderUtils {
|
|
if(imageView.getContext() instanceof Activity && ((Activity) imageView.getContext()).isFinishing()){
|
|
if(imageView.getContext() instanceof Activity && ((Activity) imageView.getContext()).isFinishing()){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- Glide.with(imageView.getContext()).asBitmap().load(res).dontAnimate().centerCrop().placeholder(res).into(imageView);
|
|
|
|
|
|
+ Glide.with(imageView.getContext()).asBitmap().load(res).dontAnimate().centerCrop()
|
|
|
|
+ .apply(new RequestOptions().skipMemoryCache(true)) // 跳过内存缓存
|
|
|
|
+ .placeholder(res).into(imageView);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|