fix [头像问题]

This commit is contained in:
zlzw 2024-03-28 14:47:50 +08:00
parent d8e002a8bd
commit 2ab97cb0f6
3 changed files with 14 additions and 3 deletions

View File

@ -12,10 +12,15 @@ import androidx.annotation.Nullable;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder; 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.RequestOptions;
import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition; import com.bumptech.glide.request.transition.Transition;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.utils.StringUtil;
import java.io.File; import java.io.File;
@ -152,7 +157,13 @@ public class ImgLoader {
if (!contextIsExist(context) || imageView == null) { if (!contextIsExist(context) || imageView == null) {
return; return;
} }
if(StringUtil.isEmpty(url)){
return;
}
if (!url.startsWith("http")) {
imageView.setImageResource(R.mipmap.chat_head_mo);
return;
}
RequestBuilder<Drawable> builder = Glide.with(context) RequestBuilder<Drawable> builder = Glide.with(context)
.load(url) .load(url)
.thumbnail(thumbnail) .thumbnail(thumbnail)

View File

@ -128,7 +128,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
@SuppressLint("WrongViewCast") @SuppressLint("WrongViewCast")
@Override @Override
public void init() { public void init() {
mAvatar = (ImageView) findViewById(R.id.avatar); mAvatar = (ImageView) findViewById(R.id.edit_me_avatar);
redPoint = findViewById(R.id.red_point); redPoint = findViewById(R.id.red_point);
ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override

View File

@ -212,7 +212,7 @@
android:gravity="center|right"> android:gravity="center|right">
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar" android:id="@+id/edit_me_avatar"
android:layout_width="86dp" android:layout_width="86dp"
android:layout_height="86dp" android:layout_height="86dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"