diff --git a/.idea/misc.xml b/.idea/misc.xml index fbb6828..5d19981 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + diff --git a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/ui_about/GlideMaster.java b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/ui_about/GlideMaster.java index 18c67c3..2f91995 100644 --- a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/ui_about/GlideMaster.java +++ b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/ui_about/GlideMaster.java @@ -4,13 +4,17 @@ import android.widget.ImageView; import com.bumptech.glide.Glide; +import com.bumptech.glide.load.resource.drawable.GlideDrawable; import com.bumptech.glide.request.RequestListener; +import com.bumptech.glide.request.animation.GlideAnimation; +import com.bumptech.glide.request.target.SimpleTarget; import com.xinyi.czbasedevtool.base.R; /** * 图片加载Main类 * author:Created by ChenZhang on 2016/6/24 0024. * function: + * 1)Glide加载圆形图片第一次只显示默认图片:http://blog.csdn.net/qq_26413249/article/details/52217322 */ public class GlideMaster { private static int placeHolderRes = R.mipmap.ic_launcher; @@ -22,20 +26,32 @@ public static void init(int placeHolderRes2,int errorHolderRes2){ } - public static void display(Context mContext,String url, ImageView img){ + public static void display(Context mContext, String url, final ImageView img){ Glide.with(mContext) .load(url) .placeholder(placeHolderRes) .error(errorHolderRes) - .into(img); + .into(new SimpleTarget() { + @Override + public void onResourceReady(GlideDrawable resource, + GlideAnimation glideAnimation) { + img.setImageDrawable(resource); + } + }); } - public static void display(Context mContext, String url, ImageView img, RequestListener listener){ + public static void display(Context mContext, String url, final ImageView img, RequestListener listener){ Glide.with(mContext) .load(url) .listener(listener) .placeholder(placeHolderRes) .error(errorHolderRes) - .into(img); + .into(new SimpleTarget() { + @Override + public void onResourceReady(GlideDrawable resource, + GlideAnimation glideAnimation) { + img.setImageDrawable(resource); + } + }); } }