diff --git a/ImageLoaderDemo/.idea/caches/build_file_checksums.ser b/ImageLoaderDemo/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000..9b03369 Binary files /dev/null and b/ImageLoaderDemo/.idea/caches/build_file_checksums.ser differ diff --git a/ImageLoaderDemo/.idea/codeStyles/Project.xml b/ImageLoaderDemo/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..30aa626 --- /dev/null +++ b/ImageLoaderDemo/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ImageLoaderDemo/.idea/misc.xml b/ImageLoaderDemo/.idea/misc.xml index a2cfde1..1ca9c5e 100644 --- a/ImageLoaderDemo/.idea/misc.xml +++ b/ImageLoaderDemo/.idea/misc.xml @@ -1,8 +1,5 @@ - - - @@ -100,17 +97,7 @@ - - - - - - - - - - - + diff --git a/ImageLoaderDemo/.idea/modules.xml b/ImageLoaderDemo/.idea/modules.xml index 3d85d43..4a09edc 100644 --- a/ImageLoaderDemo/.idea/modules.xml +++ b/ImageLoaderDemo/.idea/modules.xml @@ -3,8 +3,11 @@ + + + \ No newline at end of file diff --git a/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/SingleConfig.java b/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/SingleConfig.java index 84820f7..3eed172 100644 --- a/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/SingleConfig.java +++ b/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/config/SingleConfig.java @@ -6,6 +6,7 @@ import android.view.View; import android.view.animation.Animation; +import com.bumptech.glide.load.Key; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.request.animation.ViewPropertyAnimation; @@ -70,6 +71,8 @@ public class SingleConfig { private int shapeMode;//默认矩形,可选直角矩形,圆形/椭圆 private int rectRoundRadius;//圆角矩形时圆角的半径 private DiskCacheStrategy diskCacheStrategy;//是否跳过磁盘存储 + private boolean isSkipMemoryCache;//是否跳过内存缓存 + private Key signature; private int scaleMode;//填充模式,默认centercrop,可选fitXY,centerInside... private BitmapListener bitmapListener; @@ -101,6 +104,8 @@ public SingleConfig(ConfigBuilder builder) { this.scaleMode = builder.scaleMode; this.diskCacheStrategy = builder.diskCacheStrategy; + this.isSkipMemoryCache = builder.skipMemoryCache; + this.signature = builder.signature; this.animationId = builder.animationId; this.animationType = builder.animationType; @@ -351,6 +356,22 @@ public boolean isNeedVignette() { return isNeedVignette; } + public boolean isSkipMemoryCache() { + return isSkipMemoryCache; + } + + public void setSkipMemoryCache(boolean skipMemoryCache) { + isSkipMemoryCache = skipMemoryCache; + } + + public Key getSignature() { + return signature; + } + + public void setSignature(Key signature) { + this.signature = signature; + } + public interface BitmapListener { void onSuccess(Bitmap bitmap); @@ -423,6 +444,8 @@ public static class ConfigBuilder { private int rectRoundRadius;//圆角矩形时圆角的半径 private DiskCacheStrategy diskCacheStrategy; + private boolean skipMemoryCache; + private Key signature; private int scaleMode;//填充模式,默认centercrop,可选fitXY,centerInside... @@ -669,6 +692,26 @@ public ConfigBuilder diskCacheStrategy(DiskCacheStrategy diskCacheStrategy) { return this; } + /** + * 内存缓存 + * @param isSkipMemoryCache + * @return + */ + public ConfigBuilder skipMemoryCache(boolean isSkipMemoryCache){ + this.skipMemoryCache = isSkipMemoryCache; + return this; + } + + /** + * 图片签名 + * @param signature + * @return + */ + public ConfigBuilder signature(Key signature){ + this.signature = signature; + return this; + } + /** * 拉伸/裁剪模式 * diff --git a/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/loader/GlideLoader.java b/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/loader/GlideLoader.java index 8e7954a..5e1dde4 100644 --- a/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/loader/GlideLoader.java +++ b/ImageLoaderDemo/ImageLoader/src/main/java/imageloader/libin/com/images/loader/GlideLoader.java @@ -134,6 +134,16 @@ public void onResourceReady(Bitmap bitmap, GlideAnimation glideAnimation) { request.diskCacheStrategy(config.getDiskCacheStrategy()); } + //是否跳过内存缓存 + if(config.isSkipMemoryCache()){ + request.skipMemoryCache(config.isSkipMemoryCache()); + } + + //添加图片签名 + if(config.getSignature()!=null){ + request.signature(config.getSignature()); + } + //设置图片加载动画 setAnimator(config, request); diff --git a/ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/SimpleActivity.java b/ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/SimpleActivity.java index 9380220..fb42a18 100644 --- a/ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/SimpleActivity.java +++ b/ImageLoaderDemo/app/src/main/java/imageloader/libin/com/imageloaderdemo/activity/SimpleActivity.java @@ -15,6 +15,7 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.request.animation.ViewPropertyAnimation; +import com.bumptech.glide.signature.StringSignature; import java.io.File; @@ -96,8 +97,11 @@ public void animate(View view) { } }; + //TODO--修改图片签名,和跳过内存缓存 ImageLoader.with(this) .url(URL1) + .signature(new StringSignature(System.currentTimeMillis()+"")) + .skipMemoryCache(true) .animate(animationObject) .placeHolder(R.mipmap.ic_launcher) .scale(ScaleMode.CENTER_CROP)