From a9532cf248438a16eb23db0275a8832e8a0d58c6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 15 Feb 2020 20:20:22 +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 --- .../app/ui/widget/text/AccentBgTextView.kt | 19 ++++++++++++++----- .../main/res/layout/activity_book_info.xml | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt index b5114cd4a..6f48e81af 100644 --- a/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt @@ -9,6 +9,7 @@ import io.legado.app.lib.theme.ColorUtils import io.legado.app.lib.theme.Selector import io.legado.app.lib.theme.ThemeStore import io.legado.app.utils.dp +import io.legado.app.utils.getCompatColor class AccentBgTextView(context: Context, attrs: AttributeSet?) : AppCompatTextView(context, attrs) { @@ -29,10 +30,18 @@ class AccentBgTextView(context: Context, attrs: AttributeSet?) : } private fun upBackground() { - background = Selector.shapeBuild() - .setCornerRadius(radios) - .setDefaultBgColor(ThemeStore.accentColor(context)) - .setPressedBgColor(ColorUtils.darkenColor(ThemeStore.accentColor(context))) - .create() + background = if (isInEditMode) { + Selector.shapeBuild() + .setCornerRadius(radios) + .setDefaultBgColor(context.getCompatColor(R.color.colorAccent)) + .setPressedBgColor(ColorUtils.darkenColor(context.getCompatColor(R.color.colorAccent))) + .create() + } else { + Selector.shapeBuild() + .setCornerRadius(radios) + .setDefaultBgColor(ThemeStore.accentColor(context)) + .setPressedBgColor(ColorUtils.darkenColor(ThemeStore.accentColor(context))) + .create() + } } } diff --git a/app/src/main/res/layout/activity_book_info.xml b/app/src/main/res/layout/activity_book_info.xml index 20fc5e56e..493ce446b 100644 --- a/app/src/main/res/layout/activity_book_info.xml +++ b/app/src/main/res/layout/activity_book_info.xml @@ -177,7 +177,7 @@ android:layout_height="wrap_content" android:padding="12dp" android:singleLine="true" - android:text="@string/group" + android:text="@string/group_s" android:textColor="@color/tv_text_default" android:textSize="16sp" />