Glide源码分析
GlideApp.with(this)
.load(url)
.into(imageView);with()
//Glide.java
public static RequestManager with(@NonNull Activity activity) {
//先获取RequestManagerRetriever对象
//调用RequestManagerRetriever的get方法获取RequestManager
return getRetriever(activity).get(activity);
}
private static RequestManagerRetriever getRetriever(@Nullable Context context) {
// Context could be null for other reasons (ie the user passes in null), but in practice it will
// only occur due to errors with the Fragment lifecycle.
Preconditions.checkNotNull(
context,
"You cannot start a load on a not yet attached View or a Fragment where getActivity() "
+ "returns null (which usually occurs when getActivity() is called before the Fragment "
+ "is attached or after the Fragment is destroyed).");
return Glide.get(context).getRequestManagerRetriever();
}
get()
ApiGlideModule

checkAndInitializeGlide()
initializeGlide()
GlideBuilder
GlideExecutor
MemorySizeCalculator
磁盘缓存

get()
Lifecycle

LifecycleListener

RequestManager
load()
RequestBuilder

into()
obtainRequest()
Request



缓存过程
getModelLoaders()
加载到内存的图片大小
参考
最后更新于