From acc1bc5cf1fb092d3d89f43d75267ebec9cf8bf1 Mon Sep 17 00:00:00 2001 From: houxg Date: Fri, 17 Feb 2017 20:10:47 +0800 Subject: [PATCH] monitoring null drawable issue --- app/src/main/java/org/houxg/leamonax/ui/Navigation.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/org/houxg/leamonax/ui/Navigation.java b/app/src/main/java/org/houxg/leamonax/ui/Navigation.java index 26e6b89..e26beef 100644 --- a/app/src/main/java/org/houxg/leamonax/ui/Navigation.java +++ b/app/src/main/java/org/houxg/leamonax/ui/Navigation.java @@ -26,6 +26,8 @@ import android.widget.TextView; import com.bumptech.glide.Glide; import com.elvishew.xlog.XLog; +import com.tencent.bugly.Bugly; +import com.tencent.bugly.crashreport.CrashReport; import org.houxg.leamonax.R; import org.houxg.leamonax.adapter.AccountAdapter; @@ -163,6 +165,11 @@ public class Navigation { private void animateChangeAccount(View v, final Account account) { ImageView itemAvatar = (ImageView) v.findViewById(R.id.iv_avatar); + if (itemAvatar.getDrawable() == null) { + CrashReport.postCatchedException(new IllegalStateException("account item's drawable is null")); + changeAccount(account); + return; + } final ViewGroup rootView = (ViewGroup) mActivity.getWindow().getDecorView().getRootView(); float preSize = DisplayUtils.dp2px(30); @@ -350,6 +357,7 @@ public class Navigation { Glide.with(mActivity) .load(account.getAvatar()) .centerCrop() + .placeholder(mAlphabetDrawable) .bitmapTransform(new CropCircleTransformation(mActivity)) .into(mAvatarIv); } else {