mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
android: Add black backgrounds toggle
This commit is contained in:
parent
d9684a2010
commit
d7178ed16e
6 changed files with 42 additions and 1 deletions
|
@ -137,6 +137,7 @@ class Settings {
|
|||
const val PREF_FIRST_APP_LAUNCH = "FirstApplicationLaunch"
|
||||
const val PREF_THEME = "Theme"
|
||||
const val PREF_THEME_MODE = "ThemeMode"
|
||||
const val PREF_BLACK_BACKGROUNDS = "BlackBackgrounds"
|
||||
|
||||
private val configFileSectionsMap: MutableMap<String, List<String>> = HashMap()
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|||
import androidx.preference.PreferenceManager
|
||||
import org.yuzu.yuzu_emu.R
|
||||
import org.yuzu.yuzu_emu.YuzuApplication
|
||||
import org.yuzu.yuzu_emu.features.settings.model.AbstractBooleanSetting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.AbstractIntSetting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.AbstractSetting
|
||||
import org.yuzu.yuzu_emu.features.settings.model.IntSetting
|
||||
|
@ -380,6 +381,28 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
|||
R.array.themeModeValues
|
||||
)
|
||||
)
|
||||
|
||||
val blackBackgrounds: AbstractBooleanSetting = object : AbstractBooleanSetting {
|
||||
override var boolean: Boolean
|
||||
get() = preferences.getBoolean(Settings.PREF_BLACK_BACKGROUNDS, false)
|
||||
set(value) {
|
||||
preferences.edit().putBoolean(Settings.PREF_BLACK_BACKGROUNDS, value).apply()
|
||||
settingsActivity.recreate()
|
||||
}
|
||||
override val key: String? = null
|
||||
override val section: String? = null
|
||||
override val isRuntimeEditable: Boolean = true
|
||||
override val valueAsString: String
|
||||
get() = preferences.getBoolean(Settings.PREF_BLACK_BACKGROUNDS, false).toString()
|
||||
}
|
||||
|
||||
add(
|
||||
SwitchSetting(
|
||||
blackBackgrounds,
|
||||
R.string.use_black_backgrounds,
|
||||
R.string.use_black_backgrounds_description
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ object ThemeHelper {
|
|||
DEFAULT -> activity.setTheme(R.style.Theme_Yuzu_Main)
|
||||
MATERIAL_YOU -> activity.setTheme(R.style.Theme_Yuzu_Main_MaterialYou)
|
||||
}
|
||||
if (preferences.getBoolean(Settings.PREF_BLACK_BACKGROUNDS, false)) {
|
||||
activity.setTheme(R.style.ThemeOverlay_Yuzu_Dark)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_settings"
|
||||
|
|
9
src/android/app/src/main/res/values-night/themes.xml
Normal file
9
src/android/app/src/main/res/values-night/themes.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="ThemeOverlay.Yuzu.Dark" parent="">
|
||||
<item name="colorSurface">@android:color/black</item>
|
||||
<item name="android:colorBackground">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -241,4 +241,8 @@
|
|||
<string name="theme_mode_light">Light</string>
|
||||
<string name="theme_mode_dark">Dark</string>
|
||||
|
||||
<!-- Black backgrounds theme -->
|
||||
<string name="use_black_backgrounds">Use Black Backgrounds</string>
|
||||
<string name="use_black_backgrounds_description">When using the dark theme, apply black backgrounds.</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue