From e7c67fcc9d7765b243f50c0f8ca6793be14e658c Mon Sep 17 00:00:00 2001 From: Modificator Date: Sun, 26 Jan 2020 14:45:22 +0800 Subject: [PATCH] =?UTF-8?q?add=20theme.=20=E9=BB=91=E7=99=BD=E3=80=81A?= =?UTF-8?q?=E5=B1=8F=E9=BB=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/lib/theme/ATH.kt | 6 ++++-- .../io/legado/app/ui/config/ThemeConfigFragment.kt | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/lib/theme/ATH.kt b/app/src/main/java/io/legado/app/lib/theme/ATH.kt index 57c7c8403..46622b869 100644 --- a/app/src/main/java/io/legado/app/lib/theme/ATH.kt +++ b/app/src/main/java/io/legado/app/lib/theme/ATH.kt @@ -5,6 +5,7 @@ import android.app.Activity import android.app.ActivityManager import android.content.Context import android.graphics.Color +import android.graphics.drawable.ColorDrawable import android.os.Build import android.view.View import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR @@ -206,10 +207,11 @@ object ATH { .setSelectedColor(ThemeStore.accentColor(bottom_navigation_view.context)).create() itemIconTintList = colorStateList itemTextColor = colorStateList - itemBackgroundResource = when(context.isNightTheme) { + itemBackground = ColorDrawable(ThemeStore.primaryColor(bottomBar.context)) + /*itemBackgroundResource = when(context.isNightTheme) { true -> R.drawable.item_bg_dark false -> R.drawable.item_bg_light - } + }*/ } } diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt index 6c87ff0af..4dff95998 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt @@ -20,7 +20,7 @@ import io.legado.app.utils.* class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener { - val items = arrayOf("极简","曜夜","经典") + val items = arrayOf("极简","曜夜","经典","黑白","A屏黑") override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { addPreferencesFromResource(R.xml.pref_config_theme) @@ -124,6 +124,18 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar putPrefInt("colorBackground", getCompatColor(R.color.md_grey_100)) putPrefBoolean("isNightTheme", false) } + 3 -> { + putPrefInt("colorPrimary", getCompatColor(R.color.white)) + putPrefInt("colorAccent", getCompatColor(R.color.black)) + putPrefInt("colorBackground", getCompatColor(R.color.white)) + putPrefBoolean("isNightTheme", false) + } + 4 -> { + putPrefInt("colorPrimaryNight", getCompatColor(R.color.black)) + putPrefInt("colorAccentNight", getCompatColor(R.color.md_grey_600)) + putPrefInt("colorBackgroundNight", getCompatColor(R.color.black)) + putPrefBoolean("isNightTheme", true) + } } App.INSTANCE.applyDayNight() recreateActivities()