[android] add toggle for quick settings to hide it and fix setting names (#3435)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3435 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: nekle <nekle@protonmail.com> Co-committed-by: nekle <nekle@protonmail.com>
This commit is contained in:
parent
cd9527072d
commit
d76b2b5d26
|
|
@ -22,14 +22,6 @@ import org.yuzu.yuzu_emu.features.settings.model.AbstractShortSetting
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.AbstractIntSetting
|
import org.yuzu.yuzu_emu.features.settings.model.AbstractIntSetting
|
||||||
|
|
||||||
class QuickSettings(val emulationFragment: EmulationFragment) {
|
class QuickSettings(val emulationFragment: EmulationFragment) {
|
||||||
// Kinda a crappy workaround to get a title from setting keys
|
|
||||||
// Idk how to do this witthout hardcoding every single one
|
|
||||||
private fun getSettingTitle(settingKey: String): String {
|
|
||||||
return settingKey.replace("_", " ").split(" ")
|
|
||||||
.joinToString(" ") { it.replaceFirstChar { c -> c.uppercase() } }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun saveSettings() {
|
private fun saveSettings() {
|
||||||
if (emulationFragment.shouldUseCustom) {
|
if (emulationFragment.shouldUseCustom) {
|
||||||
NativeConfig.savePerGameConfig()
|
NativeConfig.savePerGameConfig()
|
||||||
|
|
@ -60,6 +52,7 @@ class QuickSettings(val emulationFragment: EmulationFragment) {
|
||||||
// settings
|
// settings
|
||||||
|
|
||||||
fun addIntSetting(
|
fun addIntSetting(
|
||||||
|
name: Int,
|
||||||
container: ViewGroup,
|
container: ViewGroup,
|
||||||
setting: IntSetting,
|
setting: IntSetting,
|
||||||
namesArrayId: Int,
|
namesArrayId: Int,
|
||||||
|
|
@ -73,7 +66,7 @@ class QuickSettings(val emulationFragment: EmulationFragment) {
|
||||||
val expandIcon = itemView.findViewById<android.widget.ImageView>(R.id.expand_icon)
|
val expandIcon = itemView.findViewById<android.widget.ImageView>(R.id.expand_icon)
|
||||||
val radioGroup = itemView.findViewById<RadioGroup>(R.id.radio_group)
|
val radioGroup = itemView.findViewById<RadioGroup>(R.id.radio_group)
|
||||||
|
|
||||||
titleView.text = getSettingTitle(setting.key)
|
titleView.text = YuzuApplication.appContext.getString(name)
|
||||||
|
|
||||||
val names = emulationFragment.resources.getStringArray(namesArrayId)
|
val names = emulationFragment.resources.getStringArray(namesArrayId)
|
||||||
val values = emulationFragment.resources.getIntArray(valuesArrayId)
|
val values = emulationFragment.resources.getIntArray(valuesArrayId)
|
||||||
|
|
@ -115,6 +108,8 @@ class QuickSettings(val emulationFragment: EmulationFragment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addBooleanSetting(
|
fun addBooleanSetting(
|
||||||
|
name: Int,
|
||||||
|
|
||||||
container: ViewGroup,
|
container: ViewGroup,
|
||||||
setting: BooleanSetting
|
setting: BooleanSetting
|
||||||
) {
|
) {
|
||||||
|
|
@ -125,7 +120,7 @@ class QuickSettings(val emulationFragment: EmulationFragment) {
|
||||||
val titleView = itemView.findViewById<TextView>(R.id.switch_title)
|
val titleView = itemView.findViewById<TextView>(R.id.switch_title)
|
||||||
val switchView = itemView.findViewById<com.google.android.material.materialswitch.MaterialSwitch>(R.id.setting_switch)
|
val switchView = itemView.findViewById<com.google.android.material.materialswitch.MaterialSwitch>(R.id.setting_switch)
|
||||||
|
|
||||||
titleView.text = getSettingTitle(setting.key)
|
titleView.text = YuzuApplication.appContext.getString(name)
|
||||||
switchContainer.visibility = View.VISIBLE
|
switchContainer.visibility = View.VISIBLE
|
||||||
switchView.isChecked = setting.getBoolean()
|
switchView.isChecked = setting.getBoolean()
|
||||||
|
|
||||||
|
|
@ -141,6 +136,7 @@ class QuickSettings(val emulationFragment: EmulationFragment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addSliderSetting(
|
fun addSliderSetting(
|
||||||
|
name: Int,
|
||||||
container: ViewGroup,
|
container: ViewGroup,
|
||||||
setting: AbstractSetting,
|
setting: AbstractSetting,
|
||||||
minValue: Int = 0,
|
minValue: Int = 0,
|
||||||
|
|
@ -156,7 +152,7 @@ class QuickSettings(val emulationFragment: EmulationFragment) {
|
||||||
val slider = itemView.findViewById<com.google.android.material.slider.Slider>(R.id.setting_slider)
|
val slider = itemView.findViewById<com.google.android.material.slider.Slider>(R.id.setting_slider)
|
||||||
|
|
||||||
|
|
||||||
titleView.text = getSettingTitle(setting.key)
|
titleView.text = YuzuApplication.appContext.getString(name)
|
||||||
sliderContainer.visibility = View.VISIBLE
|
sliderContainer.visibility = View.VISIBLE
|
||||||
|
|
||||||
slider.valueFrom = minValue.toFloat()
|
slider.valueFrom = minValue.toFloat()
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,9 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
|
||||||
GPU_LOG_VULKAN_CALLS("gpu_log_vulkan_calls"),
|
GPU_LOG_VULKAN_CALLS("gpu_log_vulkan_calls"),
|
||||||
GPU_LOG_SHADER_DUMPS("gpu_log_shader_dumps"),
|
GPU_LOG_SHADER_DUMPS("gpu_log_shader_dumps"),
|
||||||
GPU_LOG_MEMORY_TRACKING("gpu_log_memory_tracking"),
|
GPU_LOG_MEMORY_TRACKING("gpu_log_memory_tracking"),
|
||||||
GPU_LOG_DRIVER_DEBUG("gpu_log_driver_debug");
|
GPU_LOG_DRIVER_DEBUG("gpu_log_driver_debug"),
|
||||||
|
|
||||||
|
ENABLE_QUICK_SETTINGS("enable_quick_settings");
|
||||||
|
|
||||||
// external fun isFrameSkippingEnabled(): Boolean
|
// external fun isFrameSkippingEnabled(): Boolean
|
||||||
external fun isFrameInterpolationEnabled(): Boolean
|
external fun isFrameInterpolationEnabled(): Boolean
|
||||||
|
|
|
||||||
|
|
@ -799,6 +799,13 @@ abstract class SettingsItem(
|
||||||
descriptionId = R.string.enable_update_checks_description,
|
descriptionId = R.string.enable_update_checks_description,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
put(
|
||||||
|
SwitchSetting(
|
||||||
|
BooleanSetting.ENABLE_QUICK_SETTINGS,
|
||||||
|
titleId = R.string.enable_quick_settings,
|
||||||
|
descriptionId = R.string.enable_quick_settings_description,
|
||||||
|
)
|
||||||
|
)
|
||||||
put(
|
put(
|
||||||
SwitchSetting(
|
SwitchSetting(
|
||||||
BooleanSetting.ENABLE_FOLDER_BUTTON,
|
BooleanSetting.ENABLE_FOLDER_BUTTON,
|
||||||
|
|
|
||||||
|
|
@ -1074,6 +1074,8 @@ class SettingsFragmentPresenter(
|
||||||
add(BooleanSetting.ENABLE_UPDATE_CHECKS.key)
|
add(BooleanSetting.ENABLE_UPDATE_CHECKS.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add(BooleanSetting.ENABLE_QUICK_SETTINGS.key)
|
||||||
|
|
||||||
add(HeaderSetting(R.string.theme_and_color))
|
add(HeaderSetting(R.string.theme_and_color))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -690,8 +690,18 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
})
|
})
|
||||||
binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
|
||||||
|
|
||||||
|
if (!BooleanSetting.ENABLE_QUICK_SETTINGS.getBoolean()) {
|
||||||
|
binding.drawerLayout.setDrawerLockMode(
|
||||||
|
DrawerLayout.LOCK_MODE_LOCKED_CLOSED,
|
||||||
|
binding.quickSettingsSheet
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
updateGameTitle()
|
updateGameTitle()
|
||||||
|
|
||||||
|
binding.inGameMenu.menu.findItem(R.id.menu_quick_settings)?.isVisible =
|
||||||
|
BooleanSetting.ENABLE_QUICK_SETTINGS.getBoolean()
|
||||||
|
|
||||||
binding.inGameMenu.menu.findItem(R.id.menu_lock_drawer).apply {
|
binding.inGameMenu.menu.findItem(R.id.menu_lock_drawer).apply {
|
||||||
val lockMode = IntSetting.LOCK_DRAWER.getInt()
|
val lockMode = IntSetting.LOCK_DRAWER.getInt()
|
||||||
val titleId = if (lockMode == DrawerLayout.LOCK_MODE_LOCKED_CLOSED) {
|
val titleId = if (lockMode == DrawerLayout.LOCK_MODE_LOCKED_CLOSED) {
|
||||||
|
|
@ -749,7 +759,8 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.menu_quick_settings -> {
|
if (BooleanSetting.ENABLE_QUICK_SETTINGS.getBoolean())
|
||||||
|
R.id.menu_quick_settings else 0 -> {
|
||||||
openQuickSettingsMenu()
|
openQuickSettingsMenu()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
@ -1045,11 +1056,13 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
}
|
}
|
||||||
|
|
||||||
quickSettings.addBooleanSetting(
|
quickSettings.addBooleanSetting(
|
||||||
|
R.string.frame_limit_enable,
|
||||||
container,
|
container,
|
||||||
BooleanSetting.RENDERER_USE_SPEED_LIMIT,
|
BooleanSetting.RENDERER_USE_SPEED_LIMIT,
|
||||||
)
|
)
|
||||||
|
|
||||||
quickSettings.addSliderSetting(
|
quickSettings.addSliderSetting(
|
||||||
|
R.string.frame_limit_slider,
|
||||||
container,
|
container,
|
||||||
ShortSetting.RENDERER_SPEED_LIMIT,
|
ShortSetting.RENDERER_SPEED_LIMIT,
|
||||||
minValue = 0,
|
minValue = 0,
|
||||||
|
|
@ -1058,6 +1071,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
)
|
)
|
||||||
|
|
||||||
quickSettings.addBooleanSetting(
|
quickSettings.addBooleanSetting(
|
||||||
|
R.string.use_docked_mode,
|
||||||
container,
|
container,
|
||||||
BooleanSetting.USE_DOCKED_MODE,
|
BooleanSetting.USE_DOCKED_MODE,
|
||||||
)
|
)
|
||||||
|
|
@ -1065,6 +1079,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
quickSettings.addDivider(container)
|
quickSettings.addDivider(container)
|
||||||
|
|
||||||
quickSettings.addIntSetting(
|
quickSettings.addIntSetting(
|
||||||
|
R.string.renderer_accuracy,
|
||||||
container,
|
container,
|
||||||
IntSetting.RENDERER_ACCURACY,
|
IntSetting.RENDERER_ACCURACY,
|
||||||
R.array.rendererAccuracyNames,
|
R.array.rendererAccuracyNames,
|
||||||
|
|
@ -1073,6 +1088,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
|
|
||||||
|
|
||||||
quickSettings.addIntSetting(
|
quickSettings.addIntSetting(
|
||||||
|
R.string.renderer_scaling_filter,
|
||||||
container,
|
container,
|
||||||
IntSetting.RENDERER_SCALING_FILTER,
|
IntSetting.RENDERER_SCALING_FILTER,
|
||||||
R.array.rendererScalingFilterNames,
|
R.array.rendererScalingFilterNames,
|
||||||
|
|
@ -1080,6 +1096,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
)
|
)
|
||||||
|
|
||||||
quickSettings.addSliderSetting(
|
quickSettings.addSliderSetting(
|
||||||
|
R.string.fsr_sharpness,
|
||||||
container,
|
container,
|
||||||
IntSetting.FSR_SHARPENING_SLIDER,
|
IntSetting.FSR_SHARPENING_SLIDER,
|
||||||
minValue = 0,
|
minValue = 0,
|
||||||
|
|
@ -1088,6 +1105,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
)
|
)
|
||||||
|
|
||||||
quickSettings.addIntSetting(
|
quickSettings.addIntSetting(
|
||||||
|
R.string.renderer_anti_aliasing,
|
||||||
container,
|
container,
|
||||||
IntSetting.RENDERER_ANTI_ALIASING,
|
IntSetting.RENDERER_ANTI_ALIASING,
|
||||||
R.array.rendererAntiAliasingNames,
|
R.array.rendererAntiAliasingNames,
|
||||||
|
|
|
||||||
|
|
@ -202,9 +202,14 @@ namespace AndroidSettings {
|
||||||
Settings::Specialization::Default, true, true,
|
Settings::Specialization::Default, true, true,
|
||||||
&show_soc_overlay};
|
&show_soc_overlay};
|
||||||
|
|
||||||
|
// MISC
|
||||||
Settings::Setting<bool> dont_show_driver_shader_warning{linkage, false,
|
Settings::Setting<bool> dont_show_driver_shader_warning{linkage, false,
|
||||||
"dont_show_driver_shader_warning",
|
"dont_show_driver_shader_warning",
|
||||||
Settings::Category::Android, Settings::Specialization::Default, true, true};
|
Settings::Category::Android, Settings::Specialization::Default, true, true};
|
||||||
|
Settings::Setting<bool> enable_quick_settings{linkage, true,
|
||||||
|
"enable_quick_settings",
|
||||||
|
Settings::Category::Android, Settings::Specialization::Default, true,
|
||||||
|
false};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Values values;
|
extern Values values;
|
||||||
|
|
|
||||||
|
|
@ -738,6 +738,8 @@
|
||||||
<string name="preferences_graphics">Graphics</string>
|
<string name="preferences_graphics">Graphics</string>
|
||||||
<string name="preferences_graphics_description">Accuracy level, resolution, shader cache</string>
|
<string name="preferences_graphics_description">Accuracy level, resolution, shader cache</string>
|
||||||
<string name="quick_settings">Quick Settings</string>
|
<string name="quick_settings">Quick Settings</string>
|
||||||
|
<string name="enable_quick_settings">Enable Quick Settings</string>
|
||||||
|
<string name="enable_quick_settings_description">Allow access to quick settings menu via swipe and menu button</string>
|
||||||
<string name="preferences_audio">Audio</string>
|
<string name="preferences_audio">Audio</string>
|
||||||
<string name="preferences_audio_description">Output engine, volume</string>
|
<string name="preferences_audio_description">Output engine, volume</string>
|
||||||
<string name="preferences_controls">Controls</string>
|
<string name="preferences_controls">Controls</string>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue