fix: Check if color is not empty before parsing it.

This commit is contained in:
aminecmi 2023-05-27 21:02:25 +02:00
parent 495591159f
commit 6e5704a45b

View File

@ -149,21 +149,23 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
c.ellipsize = TextUtils.TruncateAt.END c.ellipsize = TextUtils.TruncateAt.END
c.text = tag.tag c.text = tag.tag
try { if (tag.color.isNotEmpty()) {
val gd = GradientDrawable() try {
val gdColor = try { val gd = GradientDrawable()
Color.parseColor(tag.color) val gdColor = try {
} catch (e: IllegalArgumentException) { Color.parseColor(tag.color)
e.sendSilentlyWithAcraWithName("color issue " + tag.color) } catch (e: IllegalArgumentException) {
resources.getColor(R.color.colorPrimary) e.sendSilentlyWithAcraWithName("color issue " + tag.color)
resources.getColor(R.color.colorPrimary)
}
gd.setColor(gdColor)
gd.shape = GradientDrawable.RECTANGLE
gd.setSize(30, 30)
gd.cornerRadius = 30F
c.chipIcon = gd
} catch (e: Exception) {
e.sendSilentlyWithAcraWithName("tags > GradientDrawable")
} }
gd.setColor(gdColor)
gd.shape = GradientDrawable.RECTANGLE
gd.setSize(30, 30)
gd.cornerRadius = 30F
c.chipIcon = gd
} catch (e: Exception) {
e.sendSilentlyWithAcraWithName("tags > GradientDrawable")
} }
c.setOnCloseIconClickListener { c.setOnCloseIconClickListener {