From f24fefad59e3499c6bd79752c46e26d26bb12155 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 1 Feb 2020 02:47:25 -0800 Subject: [PATCH] Added white theme to pref --- .../ui/base/activity/BaseActivity.kt | 3 ++- .../kanade/tachiyomi/ui/main/MainActivity.kt | 26 +++++++++++-------- .../tachiyomi/ui/manga/MangaController.kt | 2 +- .../ui/setting/SettingsGeneralController.kt | 7 ++--- .../tachiyomi/ui/webview/WebViewActivity.kt | 6 +++++ app/src/main/res/layout/main_activity.xml | 3 ++- app/src/main/res/values/strings.xml | 8 +++--- app/src/main/res/values/styles.xml | 2 -- app/src/main/res/values/themes.xml | 1 - 9 files changed, 35 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt index 24d66258ad..7ce33c448a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt @@ -20,7 +20,7 @@ abstract class BaseActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { AppCompatDelegate.setDefaultNightMode( when (preferences.theme()) { - 1 -> AppCompatDelegate.MODE_NIGHT_NO + 1, 8 -> AppCompatDelegate.MODE_NIGHT_NO 2, 3, 4 -> AppCompatDelegate.MODE_NIGHT_YES else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM } @@ -28,6 +28,7 @@ abstract class BaseActivity : AppCompatActivity() { setTheme(when (preferences.theme()) { 3, 6 -> R.style.Theme_Tachiyomi_Amoled 4, 7 -> R.style.Theme_Tachiyomi_DarkBlue + 8, 9 -> R.style.Theme_Tachiyomi_MatWhite else -> R.style.Theme_Tachiyomi }) super.onCreate(savedInstanceState) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index e90bfb4095..964b84a8f9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -215,25 +215,29 @@ open class MainActivity : BaseActivity() { getColor(android.R.color.transparent) } // if in landscape with 2/3 button mode, fully opaque nav bar - else if (v.rootWindowInsets.systemWindowInsetLeft > 0 - || v.rootWindowInsets.systemWindowInsetRight > 0) { - getResourceColor(android.R.attr.colorBackground) + else {/*if (v.rootWindowInsets.systemWindowInsetLeft > 0 + || v.rootWindowInsets.systemWindowInsetRight > 0) {*/ + getResourceColor(android.R.attr.colorPrimary) } // if in portrait with 2/3 button mode, translucent nav bar - else { + /* else { ColorUtils.setAlphaComponent( - getResourceColor(android.R.attr.colorBackground), 179) - } + getResourceColor(android.R.attr.colorPrimary), 179) + }*/ v.setPadding(insets.systemWindowInsetLeft, insets.systemWindowInsetTop, insets.systemWindowInsetRight, 0) insets } val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK - if (Build.VERSION.SDK_INT >= 26 && currentNightMode == Configuration.UI_MODE_NIGHT_NO) { - content.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + if (Build.VERSION.SDK_INT >= 26 && currentNightMode == Configuration.UI_MODE_NIGHT_NO && + preferences.theme() >= 8) { + content.systemUiVisibility = content.systemUiVisibility.or(View + .SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) } -// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && currentNightMode == Configuration.UI_MODE_NIGHT_NO) { -// content.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && currentNightMode == Configuration + .UI_MODE_NIGHT_NO && preferences.theme() >= 8) + content.systemUiVisibility = content.systemUiVisibility.or(View + .SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) val drawerContainer: FrameLayout = findViewById(R.id.drawer_container) drawerContainer.setOnApplyWindowInsetsListener { v, insets -> @@ -330,7 +334,7 @@ open class MainActivity : BaseActivity() { else { extUpdateText.text = null extUpdateText.gone() - navigationView.getOrCreateBadge(R.id.nav_drawer_settings).clearNumber() + navigationView.removeBadge(R.id.nav_drawer_settings) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index d695df62e0..766128365f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -200,7 +200,7 @@ class MangaController : RxController, TabbedController { VectorDrawableCompat.create(resources!!, R.drawable.ic_done_white_18dp, null) else null - tab.icon = drawable + //tab.icon = drawable } private inner class MangaDetailAdapter : RouterPagerAdapter(this@MangaController) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt index 25929b4901..06e6b38e2b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralController.kt @@ -44,10 +44,11 @@ class SettingsGeneralController : SettingsController() { intListPreference(activity) { key = Keys.theme titleRes = R.string.pref_theme - entriesRes = arrayOf(R.string.light_theme, R.string.dark_theme, + entriesRes = arrayOf(R.string.light_theme, R.string.white_theme, R.string.dark_theme, R.string.amoled_theme, R.string.darkblue_theme, - R.string.system_theme, R.string.system_amoled_theme, R.string.system_darkblue_theme) - entryRange = 1..7 + R.string.system_theme, R.string.sysyem_white_theme, R.string.system_amoled_theme, R.string + .system_darkblue_theme) + entryValues = listOf(1, 8, 2, 3, 4, 5, 9, 6, 7) defaultValue = 5 onChange { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt index 78050d4bee..d78609b60c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt @@ -122,6 +122,9 @@ class WebViewActivity : BaseActivity() { if (Build.VERSION.SDK_INT >= 26 && currentNightMode == Configuration.UI_MODE_NIGHT_NO) { content.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && currentNightMode == Configuration + .UI_MODE_NIGHT_NO && preferences.theme() >= 8) + content.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR insets } @@ -206,6 +209,9 @@ class WebViewActivity : BaseActivity() { View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION } } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && currentNightMode == Configuration + .UI_MODE_NIGHT_NO && preferences.theme() >= 8) + web_linear_layout.systemUiVisibility.or(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) } /** diff --git a/app/src/main/res/layout/main_activity.xml b/app/src/main/res/layout/main_activity.xml index 868dfb7e58..5e6270e9f0 100644 --- a/app/src/main/res/layout/main_activity.xml +++ b/app/src/main/res/layout/main_activity.xml @@ -41,7 +41,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/Theme.ActionBar.Tab" - app:tabBackground="?colorPrimary" + android:background="?colorPrimary" + app:tabRippleColor="@color/rippleColor" app:tabIndicatorColor="?attr/tabBarIconColor" app:tabTextColor="?attr/tabBarIconColor" app:tabInlineLabel="true" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 45b7d04ebc..dd3843432a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -134,9 +134,11 @@ Dark AMOLED dark Dark blue - System default - System default (AMOLED dark) - System default (Dark blue) + System default (Light + Dark) + Pure White + System default (White + Dark) + System default (Light + AMOLED dark) + System default (Light + Dark blue) Start screen Language System default diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 1fb8df510d..6139b3bf3d 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -16,8 +16,6 @@ diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index bffdee2160..6850e06f68 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -25,7 +25,6 @@ @style/CustomActionModeStyle @color/md_white_1000 @color/md_white_1000_76 - @color/rippleColor