问题遇到的现象和发生背景
java.lang.IllegalStateException: Already released
问题相关代码,请勿粘贴截图
if (CommonUserUtil.isForeverVip(nimUser.account) && !isBlurry) {
holder.mRlStoke.visibility = View.VISIBLE
holder.mIconAvatarLayout.visibility = View.GONE
Glide.with(mContext).load(R.drawable.image_forever_storke).centerInside()
.into(holder.mRlAvatarStroke)
var params = holder.mNameLayout.layoutParams as RelativeLayout.LayoutParams
params.topMargin = ScreenUtil.getDimension(R.dimen.dp_10)
holder.mNameLayout.layoutParams = params
contentparams.marginStart = ScreenUtil.getDimension(R.dimen.dp_0)
if (isTeam) {
contentparams.topMargin = ScreenUtil.getDimension(R.dimen.dp_0)
} else {
contentparams.topMargin = ScreenUtil.getDimension(R.dimen.dp_5)
}
holder.mContentTextView2.layoutParams = contentparams
if (nimUser != null) {
GlideUtil.loadCircleImage(mContext, nimUser.avatar.toString(), holder.mIconImageView)
} else {
holder.mIconAvatarLayout.getAvatarImageView()?.setImageResource(R.drawable.user_load_default_image)
holder.mIconAvatarLayout.visibility = View.VISIBLE
holder.mRlStoke.visibility = View.GONE
}
} else {
holder.mIconAvatarLayout.loadImage(nimUser, isBlurry = mBlurry)
}
} else {
holder.mIconAvatarLayout.getAvatarImageView()?.setImageResource(R.drawable.user_load_default_image)
}
Glide.with(mContext).asBitmap().load(icon).centerCrop()
.into(object : CustomTarget<Bitmap?>(ScreenUtil.getDimension(R.dimen.dp_60), ScreenUtil.getDimension(R.dimen.dp_53)) {
@SuppressLint("Range")
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap?>?) {
try {
textView.text = SmileUtils.getSmiledText(mContext, textView, body)
if (isleft) {
var resoureHorizontal = ImageUtils.toHorizontalMirror(resource)
var ninePatchBuilder = NinePatchBuilder(mContext.resources, resoureHorizontal)
textView.background = ninePatchBuilder.addXCenteredRegion(2).addYCenteredRegion(2).build();
textView.visibility = View.VISIBLE
textView.setTextColor(Color.parseColor(textColor))
} else {
var ninePatchBuilder = NinePatchBuilder(mContext.resources, resource)
textView.background = ninePatchBuilder.addXCenteredRegion(2).addYCenteredRegion(2).build();
textView.visibility = View.VISIBLE
textView.setTextColor(Color.parseColor(textColor))
}
}catch (e:Exception){
}
}
override fun onLoadCleared(placeholder: Drawable?) {
}
})
运行结果及报错内容
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:628)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at com.innovation.driftbottle.base.AppBaseActivity.onStart(AppBaseActivity.kt:111)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1436)
at android.app.Activity.performStart(Activity.java:8170)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3741)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:232)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:212)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:184)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:102)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2312)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:257)
at android.app.ActivityThread.main(ActivityThread.java:8259)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)