From 4bf13eaf0f4bd3e6779a8d95995a49d08f0a71ae Mon Sep 17 00:00:00 2001 From: luncang Date: Fri, 9 Nov 2018 15:47:57 +0800 Subject: [PATCH] =?UTF-8?q?1,=E6=B7=BB=E5=8A=A0=E8=B7=B3=E8=BF=87=E5=86=85?= =?UTF-8?q?=E5=AD=98=E7=BC=93=E5=AD=98=EF=BC=9B2=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9B=BE=E7=89=87=E7=AD=BE=E5=90=8D=EF=BC=8C=E9=98=B2?= =?UTF-8?q?=E6=AD=A2URL=E4=B8=8D=E5=8F=98=EF=BC=8C=E4=BD=86=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=B7=B2=E6=94=B9=E5=8F=98=EF=BC=8C=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E6=B2=A1=E6=9C=89=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/caches/build_file_checksums.ser | Bin 0 -> 636 bytes ImageLoaderDemo/.idea/codeStyles/Project.xml | 29 ++++++++++++ ImageLoaderDemo/.idea/misc.xml | 15 +----- ImageLoaderDemo/.idea/modules.xml | 3 ++ .../libin/com/images/config/SingleConfig.java | 43 ++++++++++++++++++ .../libin/com/images/loader/GlideLoader.java | 10 ++++ .../activity/SimpleActivity.java | 4 ++ 7 files changed, 90 insertions(+), 14 deletions(-) create mode 100644 ImageLoaderDemo/.idea/caches/build_file_checksums.ser create mode 100644 ImageLoaderDemo/.idea/codeStyles/Project.xml diff --git a/ImageLoaderDemo/.idea/caches/build_file_checksums.ser b/ImageLoaderDemo/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000000000000000000000000000000000000..9b03369ee107805f76e3175f82b1be5ef27d06f1 GIT binary patch literal 636 zcmZ4UmVvdnh`~NNKUXg?FQq6yGexf?KR>5fFEb@IQ7^qHF(oHeub?PDD>b=9F91S2 zm1gFoxMk*~I%lLNXBU^|7Q2L-Ts|(GuF1r}Q#7BMhIJFWRF{)3Gpdsa%p~b01#W5v7f5bqw#~=cyAhoC@Gqt$1kfDx&4P?fhUyOP?Us|7FGu2h(`S+y^ z=*{BPl9J54^kSIhaJ6@RBy;~UEfdTT6zQM8Iq^^l0}qNT;R<;yj<5XDa$@c56up-h zIBx|3y_A!moR|ZO9t;<7tMj+dmrDEPx$5i7glT$bN*E+Oa}(23eSjgBT7()7a2p=Z z+mpIvhUS(=fwc0dmdjI07zFWna-YDT110_$wccAZItv>Y0o@}63Swv9#Ozd`%;J(_ dy^@L&M3}HGZe6=Dxc1MD7avqMC2X*+007+*;@SWJ literal 0 HcmV?d00001 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)