mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
[android] add IntSetting for static theme and set green as default (#3655)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3655 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: PavelBARABANOV <pavelbarabanov94@gmail.com> Co-committed-by: PavelBARABANOV <pavelbarabanov94@gmail.com>
This commit is contained in:
parent
7de5eb6884
commit
12f89745be
6 changed files with 22 additions and 13 deletions
|
|
@ -34,6 +34,7 @@ enum class IntSetting(override val key: String) : AbstractIntSetting {
|
||||||
MAX_ANISOTROPY("max_anisotropy"),
|
MAX_ANISOTROPY("max_anisotropy"),
|
||||||
THEME("theme"),
|
THEME("theme"),
|
||||||
THEME_MODE("theme_mode"),
|
THEME_MODE("theme_mode"),
|
||||||
|
STATIC_THEME_COLOR("static_theme_color"),
|
||||||
APP_LANGUAGE("app_language"),
|
APP_LANGUAGE("app_language"),
|
||||||
OVERLAY_SCALE("control_scale"),
|
OVERLAY_SCALE("control_scale"),
|
||||||
OVERLAY_OPACITY("control_opacity"),
|
OVERLAY_OPACITY("control_opacity"),
|
||||||
|
|
|
||||||
|
|
@ -1124,23 +1124,24 @@ class SettingsFragmentPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
val staticThemeColor: AbstractIntSetting = object : AbstractIntSetting {
|
val staticThemeColor: AbstractIntSetting = object : AbstractIntSetting {
|
||||||
val preferences = PreferenceManager.getDefaultSharedPreferences(
|
|
||||||
YuzuApplication.appContext
|
|
||||||
)
|
|
||||||
override fun getInt(needsGlobal: Boolean): Int =
|
override fun getInt(needsGlobal: Boolean): Int =
|
||||||
preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0)
|
IntSetting.STATIC_THEME_COLOR.getInt(needsGlobal)
|
||||||
|
|
||||||
override fun setInt(value: Int) {
|
override fun setInt(value: Int) {
|
||||||
preferences.edit() { putInt(Settings.PREF_STATIC_THEME_COLOR, value) }
|
IntSetting.STATIC_THEME_COLOR.setInt(value)
|
||||||
settingsViewModel.setShouldRecreate(true)
|
settingsViewModel.setShouldRecreate(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val key: String = Settings.PREF_STATIC_THEME_COLOR
|
override val key: String = IntSetting.STATIC_THEME_COLOR.key
|
||||||
override val isRuntimeModifiable: Boolean = true
|
override val isRuntimeModifiable: Boolean = true
|
||||||
|
|
||||||
override fun getValueAsString(needsGlobal: Boolean): String =
|
override fun getValueAsString(needsGlobal: Boolean): String =
|
||||||
preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0).toString()
|
IntSetting.STATIC_THEME_COLOR.getValueAsString(needsGlobal)
|
||||||
override val defaultValue: Any = 0
|
|
||||||
|
override val defaultValue: Any = IntSetting.STATIC_THEME_COLOR.defaultValue
|
||||||
|
|
||||||
override fun reset() {
|
override fun reset() {
|
||||||
preferences.edit() { putInt(Settings.PREF_STATIC_THEME_COLOR, 0) }
|
IntSetting.STATIC_THEME_COLOR.reset()
|
||||||
settingsViewModel.setShouldRecreate(true)
|
settingsViewModel.setShouldRecreate(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,12 @@ object DirectoryInitialization {
|
||||||
saveConfig = true
|
saveConfig = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val staticThemeColor = preferences.migratePreference<Int>(Settings.PREF_STATIC_THEME_COLOR)
|
||||||
|
if (staticThemeColor != null) {
|
||||||
|
IntSetting.STATIC_THEME_COLOR.setInt(staticThemeColor)
|
||||||
|
saveConfig = true
|
||||||
|
}
|
||||||
|
|
||||||
val blackBackgrounds =
|
val blackBackgrounds =
|
||||||
preferences.migratePreference<Boolean>(Settings.PREF_BLACK_BACKGROUNDS)
|
preferences.migratePreference<Boolean>(Settings.PREF_BLACK_BACKGROUNDS)
|
||||||
if (blackBackgrounds != null) {
|
if (blackBackgrounds != null) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
package org.yuzu.yuzu_emu.utils
|
package org.yuzu.yuzu_emu.utils
|
||||||
|
|
@ -52,7 +52,7 @@ object ThemeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSelectedStaticThemeColor(): Int {
|
private fun getSelectedStaticThemeColor(): Int {
|
||||||
val themeIndex = preferences.getInt(Settings.PREF_STATIC_THEME_COLOR, 0)
|
val themeIndex = IntSetting.STATIC_THEME_COLOR.getInt(false)
|
||||||
val themes = arrayOf(
|
val themes = arrayOf(
|
||||||
R.style.Theme_Eden_Main,
|
R.style.Theme_Eden_Main,
|
||||||
R.style.Theme_Yuzu_Main_Violet,
|
R.style.Theme_Yuzu_Main_Violet,
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ namespace AndroidSettings {
|
||||||
|
|
||||||
Settings::Setting<s32> theme{linkage, 0, "theme", Settings::Category::Android};
|
Settings::Setting<s32> theme{linkage, 0, "theme", Settings::Category::Android};
|
||||||
Settings::Setting<s32> theme_mode{linkage, -1, "theme_mode", Settings::Category::Android};
|
Settings::Setting<s32> theme_mode{linkage, -1, "theme_mode", Settings::Category::Android};
|
||||||
|
Settings::Setting<s32> static_theme_color{linkage, 5, "static_theme_color", Settings::Category::Android};
|
||||||
Settings::Setting<bool> black_backgrounds{linkage, false, "black_backgrounds",
|
Settings::Setting<bool> black_backgrounds{linkage, false, "black_backgrounds",
|
||||||
Settings::Category::Android};
|
Settings::Category::Android};
|
||||||
Settings::Setting<s32> app_language{linkage, 0, "app_language", Settings::Category::Android};
|
Settings::Setting<s32> app_language{linkage, 0, "app_language", Settings::Category::Android};
|
||||||
|
|
|
||||||
|
|
@ -1222,12 +1222,12 @@
|
||||||
|
|
||||||
<!-- Static Themes -->
|
<!-- Static Themes -->
|
||||||
<string name="static_theme_color">Theme Color</string>
|
<string name="static_theme_color">Theme Color</string>
|
||||||
<string name="eden_theme">Eden (Default)</string>
|
<string name="eden_theme">Eden</string>
|
||||||
<string name="violet">Violet</string>
|
<string name="violet">Violet</string>
|
||||||
<string name="blue">Blue</string>
|
<string name="blue">Blue</string>
|
||||||
<string name="cyan">Cyan</string>
|
<string name="cyan">Cyan</string>
|
||||||
<string name="red">Red</string>
|
<string name="red">Red</string>
|
||||||
<string name="green">Green</string>
|
<string name="green">Green (Default)</string>
|
||||||
<string name="yellow">Yellow</string>
|
<string name="yellow">Yellow</string>
|
||||||
<string name="orange">Orange</string>
|
<string name="orange">Orange</string>
|
||||||
<string name="pink">Pink</string>
|
<string name="pink">Pink</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue