fix:修复飘屏findViewById导致偶发异常问题
This commit is contained in:
@@ -26,7 +26,7 @@ class FindLoveImageNotify(context: Context, val isHeightLevel: Boolean) : BaseFl
|
|||||||
requestRemoveSelf()
|
requestRemoveSelf()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val textView = rootView.findViewById<TextView>(R.id.tv_text)
|
val textView = findViewById<TextView>(R.id.tv_text)
|
||||||
textView.textSize = 12f
|
textView.textSize = 12f
|
||||||
textView.setTextColor(Color.WHITE)
|
textView.setTextColor(Color.WHITE)
|
||||||
val text = SpannableBuilder()
|
val text = SpannableBuilder()
|
||||||
@@ -50,7 +50,7 @@ class FindLoveImageNotify(context: Context, val isHeightLevel: Boolean) : BaseFl
|
|||||||
}
|
}
|
||||||
textView.text = text.build()
|
textView.text = text.build()
|
||||||
textView.setPadding(0, UiUtils.dip2px(2f), 0, 0)
|
textView.setPadding(0, UiUtils.dip2px(2f), 0, 0)
|
||||||
val bgView = rootView.findViewById<ImageView>(R.id.iv_bg)
|
val bgView = findViewById<ImageView>(R.id.iv_bg)
|
||||||
if (isHeightLevel) {
|
if (isHeightLevel) {
|
||||||
bgView.setImageResource(R.drawable.smash_eggs_notity_bg_5)
|
bgView.setImageResource(R.drawable.smash_eggs_notity_bg_5)
|
||||||
} else {
|
} else {
|
||||||
|
@@ -45,14 +45,14 @@ class TemplateImageNotify(context: Context) : BaseFloatView(context),
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val textView = rootView.findViewById<TextView>(R.id.tv_text)
|
val textView = findViewById<TextView>(R.id.tv_text)
|
||||||
val textSize = data.fontSize?.toFloat() ?: 12f
|
val textSize = data.fontSize?.toFloat() ?: 12f
|
||||||
val textColor =
|
val textColor =
|
||||||
templateMessageAdapter.parseColor(data.textColor) ?: Color.WHITE
|
templateMessageAdapter.parseColor(data.textColor) ?: Color.WHITE
|
||||||
textView.textSize = textSize
|
textView.textSize = textSize
|
||||||
textView.setTextColor(textColor)
|
textView.setTextColor(textColor)
|
||||||
|
|
||||||
val bgView = rootView.findViewById<ImageView>(R.id.iv_bg)
|
val bgView = findViewById<ImageView>(R.id.iv_bg)
|
||||||
GlideApp.with(bgView)
|
GlideApp.with(bgView)
|
||||||
.load(resourceContent).into(object : CustomTarget<Drawable>() {
|
.load(resourceContent).into(object : CustomTarget<Drawable>() {
|
||||||
override fun onResourceReady(
|
override fun onResourceReady(
|
||||||
@@ -71,7 +71,7 @@ class TemplateImageNotify(context: Context) : BaseFloatView(context),
|
|||||||
CommonJumpHelper.bannerJump(context, skipType, data.skipContent)
|
CommonJumpHelper.bannerJump(context, skipType, data.skipContent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootView.setOnClickListener(clickAction)
|
setOnClickListener(clickAction)
|
||||||
textView.setOnClickListener(clickAction)
|
textView.setOnClickListener(clickAction)
|
||||||
}
|
}
|
||||||
startDelayRemove()
|
startDelayRemove()
|
||||||
|
@@ -46,14 +46,14 @@ class TemplateSvgaNotify(context: Context) : BaseFloatView(context),
|
|||||||
requestRemoveSelf()
|
requestRemoveSelf()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val textView = rootView.findViewById<TextView>(R.id.tv_text)
|
val textView = findViewById<TextView>(R.id.tv_text)
|
||||||
val textSize = data.fontSize?.toFloat() ?: 12f
|
val textSize = data.fontSize?.toFloat() ?: 12f
|
||||||
val textColor =
|
val textColor =
|
||||||
templateMessageAdapter.parseColor(data.textColor) ?: Color.WHITE
|
templateMessageAdapter.parseColor(data.textColor) ?: Color.WHITE
|
||||||
textView.textSize = textSize
|
textView.textSize = textSize
|
||||||
textView.setTextColor(textColor)
|
textView.setTextColor(textColor)
|
||||||
|
|
||||||
val svgaView = rootView.findViewById<SVGAImageView>(R.id.iv_bg)
|
val svgaView = findViewById<SVGAImageView>(R.id.iv_bg)
|
||||||
SVGAParser.shareParser().decodeFromURL(
|
SVGAParser.shareParser().decodeFromURL(
|
||||||
URL(resourceContent),
|
URL(resourceContent),
|
||||||
object : SVGAParser.ParseCompletion {
|
object : SVGAParser.ParseCompletion {
|
||||||
@@ -78,7 +78,7 @@ class TemplateSvgaNotify(context: Context) : BaseFloatView(context),
|
|||||||
CommonJumpHelper.bannerJump(context, skipType, data.skipContent)
|
CommonJumpHelper.bannerJump(context, skipType, data.skipContent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootView.setOnClickListener(clickAction)
|
setOnClickListener(clickAction)
|
||||||
textView.setOnClickListener(clickAction)
|
textView.setOnClickListener(clickAction)
|
||||||
}
|
}
|
||||||
val drawable = SVGADrawable(videoItem)
|
val drawable = SVGADrawable(videoItem)
|
||||||
|
Reference in New Issue
Block a user