From 2ab97cb0f670c74eafba460b30db4ea6a92729cd Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 28 Mar 2024 14:47:50 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E5=A4=B4=E5=83=8F=E9=97=AE=E9=A2=98]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/common/glide/ImgLoader.java | 13 ++++++++++++- .../com/yunbao/main/views/MainMeViewHolder.java | 2 +- main/src/main/res/layout/view_main_me.xml | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java index bb5fbc53c..fdbe5d2b4 100644 --- a/common/src/main/java/com/yunbao/common/glide/ImgLoader.java +++ b/common/src/main/java/com/yunbao/common/glide/ImgLoader.java @@ -12,10 +12,15 @@ import androidx.annotation.Nullable; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestBuilder; +import com.bumptech.glide.load.DataSource; +import com.bumptech.glide.load.engine.GlideException; +import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.CustomTarget; +import com.bumptech.glide.request.target.Target; import com.bumptech.glide.request.transition.Transition; import com.yunbao.common.R; +import com.yunbao.common.utils.StringUtil; import java.io.File; @@ -152,7 +157,13 @@ public class ImgLoader { if (!contextIsExist(context) || imageView == null) { return; } - + if(StringUtil.isEmpty(url)){ + return; + } + if (!url.startsWith("http")) { + imageView.setImageResource(R.mipmap.chat_head_mo); + return; + } RequestBuilder builder = Glide.with(context) .load(url) .thumbnail(thumbnail) diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index b2ce2fc78..fea3d1712 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -128,7 +128,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi @SuppressLint("WrongViewCast") @Override public void init() { - mAvatar = (ImageView) findViewById(R.id.avatar); + mAvatar = (ImageView) findViewById(R.id.edit_me_avatar); redPoint = findViewById(R.id.red_point); ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() { @Override diff --git a/main/src/main/res/layout/view_main_me.xml b/main/src/main/res/layout/view_main_me.xml index 033f99346..e862b751c 100644 --- a/main/src/main/res/layout/view_main_me.xml +++ b/main/src/main/res/layout/view_main_me.xml @@ -212,7 +212,7 @@ android:gravity="center|right">