From 46081225e93de05e7114e8b0e48ea5a0d9529e4c Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 28 Feb 2020 17:10:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/widget/prefs/IconListPreference.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt index ff3fa801c..b295e5ad3 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/IconListPreference.kt @@ -167,8 +167,14 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference dialogIconNames?.let { val resId = context.resources .getIdentifier(it[index].toString(), "mipmap", context.packageName) - val d = context.getCompatDrawable(resId) - icon.setImageDrawable(d) + val d = try { + context.getCompatDrawable(resId) + } catch (e: Exception) { + null + } + d?.let { + icon.setImageDrawable(d) + } } label.isChecked = item.toString() == dialogValue onClick {