implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
public class GlideUtils {
private GlideUtils(){};
private static GlideUtils glideUtils = new GlideUtils();
public static GlideUtils getInstance(){
return glideUtils;
}
public void showPic(Context context, String url , ImageView iv){
Glide.with(context)
.load(url)
.skipMemoryCache(false)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.ic_launcher_background)
.error(R.drawable.ic_launcher_foreground)
.thumbnail(0.1f)
.into(iv);
}
public void showCirclePic(Context context, int url , ImageView iv){
Glide.with(context)
.load(url)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.placeholder(R.drawable.ic_launcher_background)
.error(R.drawable.ic_launcher_foreground)
.circleCrop()
.thumbnail(0.1f)
.into(iv);
}
public void showCirclePic(Context context, Uri url , ImageView iv){
Glide.with(context)
.load(url)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.placeholder(R.drawable.ic_launcher_background)
.error(R.drawable.ic_launcher_foreground)
.circleCrop()
.thumbnail(0.1f)
.into(iv);
}
public void showCirclePic(Context context, String url , ImageView iv){
Glide.with(context)
.load(url)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.placeholder(R.drawable.ic_launcher_background)
.error(R.drawable.ic_launcher_foreground)
.circleCrop()
.thumbnail(0.1f)
.into(iv);
}
public void showRoundedPic(Context context, String url , ImageView iv,int r){
Glide.with(context)
.load(url)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.placeholder(R.drawable.ic_launcher_background)
.error(R.drawable.ic_launcher_foreground)
.transform(new CenterCrop(),new RoundedCorners(r))
.thumbnail(0.1f)
.into(iv);
}
}