方法 |
注释 |
with |
with |
init |
初始化方法 |
cloneImageOptions |
克隆图片加载配置 |
defaultOptions |
获取默认加载配置 |
emptyOptions |
获取空白加载配置 |
skipCacheOptions |
获取跳过缓存 ( 每次都从服务端获取最新 ) 加载配置 |
getLoadResOptions |
获取自定义图片加载配置 |
transformationOptions |
获取图片处理效果加载配置 |
clearDiskCache |
清除磁盘缓存 |
clearMemoryCache |
清除内存缓存 |
onLowMemory |
低内存通知 |
getDiskCache |
获取 SDCard 缓存空间 |
preload |
预加载图片 |
displayImage |
图片显示 |
displayImageToGif |
图片显示 |
loadImageBitmap |
图片加载 |
loadImageDrawable |
图片加载 |
loadImageFile |
图片加载 |
loadImageGif |
图片加载 |
cancelDisplayTask |
取消图片显示任务 |
destroy |
销毁操作 |
pause |
暂停图片加载 |
resume |
恢复图片加载 |
stop |
停止图片加载 |
start |
开始图片加载 |
package dev.other;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import java.io.File;
import dev.utils.LogPrintUtils;
public final class GlideUtils {
private GlideUtils() {
}
private static final String TAG = GlideUtils.class.getSimpleName();
private static GlideLoader sGlideLoader;
private static RequestOptions DF_OPTIONS = defaultOptions();
private static Context sContext;
private static int sImageLoadingRes = 0;
private static int sImageUriErrorRes = 0;
private static int sImageFailRes = 0;
@NonNull
public static GlideLoader with(@NonNull Context context) {
return new GlideLoader(Glide.with(context));
}
@NonNull
public static GlideLoader with(@NonNull Activity activity) {
return new GlideLoader(Glide.with(activity));
}
@NonNull
public static GlideLoader with(@NonNull FragmentActivity activity) {
return new GlideLoader(Glide.with(activity));
}
@NonNull
public static GlideLoader with(@NonNull android.app.Fragment fragment) {
return new GlideLoader(Glide.with(fragment));
}
@NonNull
public static GlideLoader with(@NonNull Fragment fragment) {
return new GlideLoader(Glide.with(fragment));
}
@NonNull
public static GlideLoader with(@NonNull View view) {