diff --git a/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/model/Settings.kt b/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/model/Settings.kt index f0106d21c..fca956267 100644 --- a/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/model/Settings.kt +++ b/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/model/Settings.kt @@ -214,6 +214,7 @@ class Settings { const val PREF_THEME_MODE = "ThemeMode" const val PREF_BLACK_BACKGROUNDS = "BlackBackgrounds" const val PREF_SHOW_HOME_APPS = "ShowHomeApps" + const val PREF_STATIC_THEME_COLOR = "StaticThemeColor" private val configFileSectionsMap: MutableMap> = HashMap() @@ -232,4 +233,4 @@ class Settings { ) } } -} +} \ No newline at end of file diff --git a/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/ui/SettingsFragmentPresenter.kt b/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/ui/SettingsFragmentPresenter.kt index 68a1cab0f..74de045b8 100644 --- a/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/ui/SettingsFragmentPresenter.kt +++ b/src/android/app/src/main/java/io/github/lime3ds/android/features/settings/ui/SettingsFragmentPresenter.kt @@ -1330,6 +1330,33 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView) ) } + val staticThemeColor: AbstractIntSetting = object : AbstractIntSetting { + override var int: Int + get() = preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0) + set(value) { + preferences.edit() + .putInt(Settings.PREF_STATIC_THEME_COLOR, value) + .apply() + settingsActivity.recreate() + } + override val key: String? = null + override val section: String? = null + override val isRuntimeEditable: Boolean = false + override val valueAsString: String + get() = preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0).toString() + override val defaultValue: Any = 0 + } + + add( + SingleChoiceSetting( + staticThemeColor, + R.string.static_theme_color, + R.string.static_theme_color_description, + R.array.staticThemeNames, + R.array.staticThemeValues + ) + ) + val themeMode: AbstractIntSetting = object : AbstractIntSetting { override var int: Int get() = preferences.getInt(Settings.PREF_THEME_MODE, -1) diff --git a/src/android/app/src/main/java/io/github/lime3ds/android/ui/main/MainActivity.kt b/src/android/app/src/main/java/io/github/lime3ds/android/ui/main/MainActivity.kt index 2669b5cbd..da88b7e25 100644 --- a/src/android/app/src/main/java/io/github/lime3ds/android/ui/main/MainActivity.kt +++ b/src/android/app/src/main/java/io/github/lime3ds/android/ui/main/MainActivity.kt @@ -1,4 +1,4 @@ -// Copyright 2023 Citra Emulator Project +// Copyright Citra Emulator Project / Lime3DS Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -76,6 +76,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider { settingsViewModel.settings.loadSettings() } + ThemeUtil.ThemeChangeListener(this) ThemeUtil.setTheme(this) super.onCreate(savedInstanceState) @@ -336,4 +337,4 @@ class MainActivity : AppCompatActivity(), ThemeProvider { .build() ) } -} +} \ No newline at end of file diff --git a/src/android/app/src/main/java/io/github/lime3ds/android/utils/ThemeUtil.kt b/src/android/app/src/main/java/io/github/lime3ds/android/utils/ThemeUtil.kt index d696ec1b6..de87f21ac 100644 --- a/src/android/app/src/main/java/io/github/lime3ds/android/utils/ThemeUtil.kt +++ b/src/android/app/src/main/java/io/github/lime3ds/android/utils/ThemeUtil.kt @@ -1,4 +1,4 @@ -// Copyright 2023 Citra Emulator Project +// Copyright Citra Emulator Project / Lime3DS Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. @@ -12,6 +12,9 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsControllerCompat +import androidx.lifecycle.DefaultLifecycleObserver +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.LifecycleOwner import androidx.preference.PreferenceManager import io.github.lime3ds.android.LimeApplication import io.github.lime3ds.android.R @@ -25,12 +28,29 @@ object ThemeUtil { private val preferences: SharedPreferences get() = PreferenceManager.getDefaultSharedPreferences(LimeApplication.appContext) + private fun getSelectedStaticThemeColor(): Int { + val themeIndex = preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0) + val themes = arrayOf( + R.style.Theme_Citra_Blue, + R.style.Theme_Citra_Cyan, + R.style.Theme_Citra_Red, + R.style.Theme_Citra_Green, + R.style.Theme_Citra_Lime, + R.style.Theme_Citra_Yellow, + R.style.Theme_Citra_Orange, + R.style.Theme_Citra_Violet, + R.style.Theme_Citra_Pink, + R.style.Theme_Citra_Gray + ) + return themes[themeIndex] + } + fun setTheme(activity: AppCompatActivity) { setThemeMode(activity) if (preferences.getBoolean(Settings.PREF_MATERIAL_YOU, false)) { activity.setTheme(R.style.Theme_Lime_Main_MaterialYou) } else { - activity.setTheme(R.style.Theme_Lime_Main) + activity.setTheme(getSelectedStaticThemeColor()) } // Using a specific night mode check because this could apply incorrectly when using the @@ -96,4 +116,17 @@ object ThemeUtil { Color.blue(color) ) } + + // Listener that detects if the theme keys are being changed from the setting menu and recreates the activity + private var listener: SharedPreferences.OnSharedPreferenceChangeListener? = null + + fun ThemeChangeListener(activity: AppCompatActivity) { + listener = SharedPreferences.OnSharedPreferenceChangeListener { _, key -> + val relevantKeys = listOf(Settings.PREF_STATIC_THEME_COLOR, Settings.PREF_MATERIAL_YOU, Settings.PREF_BLACK_BACKGROUNDS) + if (key in relevantKeys) { + activity.recreate() + } + } + preferences.registerOnSharedPreferenceChangeListener(listener) + } } diff --git a/src/android/app/src/main/res/values-night/citra_colors.xml b/src/android/app/src/main/res/values-night/citra_colors.xml index 98e9d50c3..735dc65e6 100644 --- a/src/android/app/src/main/res/values-night/citra_colors.xml +++ b/src/android/app/src/main/res/values-night/citra_colors.xml @@ -1,35 +1,262 @@ - #B7C4FF - #002681 - #0039B5 - #DCE1FF - #C2C5DD - #2B3042 - #424659 - #DEE1F9 - #E4BADA - #43273F - #5C3D56 - #FFD7F5 + + #B7C4FF + #002681 + #0039B5 + #DCE1FF + #C2C5DD + #2B3042 + #424659 + #DEE1F9 + #E4BADA + #43273F + #5C3D56 + #FFD7F5 + #1B1B1F + #E4E1E6 + #1B1B1F + #E4E1E6 + #45464F + #C6C5D0 + #90909A + #1B1B1F + #E4E1E6 + #154FE2 + #B7C4FF + + + #B7FFF7 + #007D81 + #00A0B5 + #DCFFFB + #C2DDDB + #2B3F42 + #425659 + #DEF9F7 + #BAE1E4 + #274341 + #3D5C5C + #D7FFFE + #1B1F1E + #E1E6E5 + #1B1F1F + #E1E6E5 + #454F4D + #C5D0CF + #909A98 + #1B1F1F + #E1E6E5 + #15E2D1 + #B7C4FF + + + #FFB7B7 + #810000 + #B50000 + #FFDCDC + #DDC2C2 + #422B2B + #594242 + #F9DEDE + #E4BABA + #432727 + #5C3D3D + #FFD7D7 + #1F1B1B + #E6E1E1 + #1F1B1B + #E6E1E1 + #4F4545 + #D0C5C5 + #9A9090 + #1F1B1B + #E6E1E1 + #E21515 + #FFB7B7 + + + #B7FFBE + #00811C + #06B500 + #DCFFE0 + #C2DDC8 + #2B422E + #425946 + #DEF9E5 + #BAE4BC + #284327 + #3D5C47 + #1B1F1B + #E1E6E1 + #1B1F1B + #E1E6E1 + #454F45 + #C6D0C5 + #909A90 + #1B1F1B + #E1E6E2 + #15E218 + #B7FFC7 + + + #D0FFB7 + #368100 + #1BB500 + #E5FFDC + #CDDDC2 + #32422B + #4B5942 + #E9F9DE + #CAE4BA + #2F4327 + #455C3D + #E8FFD7 + #1C1F1B + #E2E6E1 + #1C1F1B + #E2E6E1 + #494F45 + #C9D0C5 + #959A90 + #1D1F1B + #E2E6E1 + #82E215 + #CDFFB7 + + + #FFEDB7 + #817F00 + #B5A300 + #FFFDDC + #DDDDC2 + #42422B + #595942 + #F7F9DE + #E0E4BA + #424327 + #5C583D + #FFFBD7 + #1F1F1B + #E6E6E1 + #1F1F1B + #E6E5E1 + #4F4E45 + #D0D0C5 + #9A9990 + #1B1B1F + #E6E6E1 + #DBE215 + #FFFBB7 + + + #FFCBB7 + #812500 + #B55400 + #FFEBDC + #DDCDC2 + #42342B + #594A42 + #F9E6DE + #E4CCBA + #433127 + #5C463D + #FFEFD7 + #1F1D1B + #E6E3E1 + #1F1D1B + #E6E3E1 + #4F4A45 + #D0CAC5 + #9A9490 + #1F1D1B + #E6E3E1 + #E26E15 + #FFD4B7 + + + #DAB7FF + #350068 + #5A00B5 + #F4DCFF + #D2C2DD + #342B42 + #594265 + #E9DEF9 + #DACCE4 + #402743 + #5C4E5C + #FFD7FF + #1F1B1F + #E6E4E6 + #1F1B1F + #E6E4E6 + #4F454F + #D0C6D0 + #9A909A + #1F1B1F + #E6E4E6 + #B154E2 + #DAB7FF + + + #FFB7C5 + #81001E + #B50033 + #FFDCE6 + #DDC2C7 + #422B34 + #594249 + #FCF9DEE6 + #E4BAC4 + #432730 + #5C3D49 + #FFD7DF + #1F1B1C + #E6E1E2 + #1F1B1C + #E6E1E2 + #4F4547 + #D0C5C8 + #9A9093 + #1F1B1C + #E6E1E2 + #E21556 + #FFB7D6 + + + #B7B7B7 + #2B2B2B + #424242 + #E1E1E1 + #C2C2C2 + #424242 + #656565 + #EDEDED + #DADADA + #3F3F3F + #565656 + #F5F5F5 + #1B1B1B + #E4E4E4 + #1B1B1B + #E4E4E4 + #454545 + #C6C6C6 + #909090 + #1B1B1B + #E4E4E4 + #B7B7B7 + #B7B7B7 + + + #C6C5D0 #FFB4AB #93000A #690005 #FFDAD6 - #1B1B1F - #E4E1E6 - #1B1B1F - #E4E1E6 - #45464F - #C6C5D0 - #90909A - #1B1B1F - #E4E1E6 - #154FE2 #000000 - #B7C4FF - #45464F #000000 - + \ No newline at end of file diff --git a/src/android/app/src/main/res/values/arrays.xml b/src/android/app/src/main/res/values/arrays.xml index 3439f727b..cb0d5ad02 100644 --- a/src/android/app/src/main/res/values/arrays.xml +++ b/src/android/app/src/main/res/values/arrays.xml @@ -212,6 +212,31 @@ 5 + + Blue (Default) + Cyan + Red + Green + Lime + Yellow + Orange + Violet + Pink + Gray + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + @string/theme_mode_follow_system @string/theme_mode_light diff --git a/src/android/app/src/main/res/values/citra_colors.xml b/src/android/app/src/main/res/values/citra_colors.xml index 4d47dcfec..e87a2a75b 100644 --- a/src/android/app/src/main/res/values/citra_colors.xml +++ b/src/android/app/src/main/res/values/citra_colors.xml @@ -1,35 +1,264 @@ - #154FE2 - #FFFFFF - #DCE1FF - #001551 - #595D72 - #FFFFFF - #DEE1F9 - #161B2C - #75546F - #FFFFFF - #FFD7F5 - #2C1229 + + #154FE2 + #DCE1FF + #001551 + #595D72 + #DEE1F9 + #161B2C + #75546F + #FFD7F5 + #2C1229 + #FEFBFF + #1B1B1F + #FEFBFF + #1B1B1F + #E2E1EC + #45464F + #767680 + #F2F0F4 + #303034 + #B7C4FF + #154FE2 + + + #E21515 + #FFDCDC + #510000 + #725959 + #F9DEDE + #2C1616 + #755454 + #FFD7D7 + #2C1212 + #FFFBFB + #1F1B1B + #FFFBFB + #1F1B1B + #ECE1E1 + #4F4545 + #807676 + #F4F0F0 + #343030 + #FFB7B7 + #E21515 + + + #1FAA59 + #C6F6D5 + #012D12 + #4D8066 + #D4EDE1 + #1A3328 + #3D7267 + #BCECE0 + #1C4039 + #FBFFFC + #1B1F1B + #FBFFFC + #1B1F1B + #E1ECE1 + #454F46 + #768077 + #F0F4F0 + #303430 + #B7FFB8 + #1FAA59 + + + #15E2D1 + #DCFFFE + #005148 + #595D72 + #DEF8F9 + #162C2C + #75546F + #D7FCFF + #122C2C + #FBFFFF + #1B1F1F + #FBFFFF + #1B1F1F + #E1ECEB + #454F4F + #76807F + #F0F4F4 + #303434 + #B7FFF7 + #15E2C3 + + + #5DE215 + #E9FFDC + #185100 + #595D72 + #E9F9DE + #1F2C16 + #547564 + #D7FFEA + #122C20 + #FBFFFB + #1C1F1B + #FBFFFB + #1B1F1B + #E2ECE1 + #464F45 + #778076 + #F0F4F0 + #313430 + #BCFFB7 + #41E215 + + + #CDE2C015 + #FEFFDC + #4C5100 + #717259 + #F8F9DE + #2C2C16 + #757254 + #FFFDD7 + #2C2B12 + #FFFFFB + #1F1F1B + #FFFFFB + #1F1F1B + #ECEBE1 + #4E4F45 + #7F8076 + #F4F4F0 + #343430 + #FFFEB7 + #E2CE15 + + + #E26E15 + #FFECDC + #512600 + #726759 + #F9EADE + #2C1E16 + #756354 + #FFF0D7 + #2C2012 + #FFFDFB + #1F1D1B + #FFFDFB + #1F1D1B + #ECE6E1 + #4F4A45 + #807B76 + #F4F2F0 + #343230 + #FFD9B7 + #E27F15 + + + #DB15E2 + #FDDCFF + #4E0051 + #6B5972 + #F6DEF9 + #26162C + #6E5475 + #F6D7FF + #29122C + #FEFBFF + #1E1B1F + #FEFBFF + #1D1B1F + #E7E1EC + #4B454F + #7A7680 + #F2F0F4 + #323034 + #E3B7FF + #8215E2 + + + #E21556 + #FF73A4 + #510023 + #725962 + #F9DEE9 + #2C1620 + #755463 + #FFD7E7 + #2C121A + #FF9CB5 + #1F1B1C + #FFFBFC + #1F1B1C + #ECE1E4 + #4F4547 + #807679 + #F4F0F1 + #343031 + #FFB7D0 + #E21545 + + + #9E9E9E + #F5F5F5 + #1E1E1E + #BDBDBD + #E0E0E0 + #424242 + #757575 + #BDBDBD + #1E1E1E + #FAFAFA + #1E1E1E + #FAFAFA + #1E1E1E + #E0E0E0 + #424242 + #424242 + #FAFAFA + #1E1E1E + #BDBDBD + #9E9E9E + + + #C6C5D0 #BA1A1A #FFDAD6 #FFFFFF #410002 - #FEFBFF - #1B1B1F - #FEFBFF - #1B1B1F - #E2E1EC - #45464F - #767680 - #F2F0F4 - #303034 - #B7C4FF #000000 - #154FE2 - #C6C5D0 #000000 + + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF + #FFFFFF - + \ No newline at end of file diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index 21a39d58e..69dcc82d7 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -93,6 +93,9 @@ You can\'t skip this step This step is required to allow Lime3DS to work. Please select a directory and then you can continue. https://web.archive.org/web/20240304193549/https://github.com/citra-emu/citra/wiki/Citra-Android-user-data-and-storage + Theme Settings + Configure your theme preferences for Lime3DS. + Set Theme Search and Filter Games @@ -494,13 +497,19 @@ PB EB - - Change Theme Mode + + Theme Mode Follow System Light Dark + + Material You - Use system colors across the app + Use the operating system\'s color theme across the app (Overrides the "Theme Color" setting when enabled) + + + Theme Color + Change the color theme of the app\'s menus Black Backgrounds @@ -734,4 +743,4 @@ Use Artic Controller when connected to Artic Base Server Use the controls provided by Artic Base Server when connected to it instead of the configured input device. - \ No newline at end of file + diff --git a/src/android/app/src/main/res/values/themes.xml b/src/android/app/src/main/res/values/themes.xml index bfb14a2a3..b8a7f489a 100644 --- a/src/android/app/src/main/res/values/themes.xml +++ b/src/android/app/src/main/res/values/themes.xml @@ -2,49 +2,280 @@ - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file