forked from eden-emu/eden
adapt auto hide setting for spinbox
This commit is contained in:
parent
dfdc44ff4f
commit
cc56cc5511
6 changed files with 32 additions and 17 deletions
|
@ -55,6 +55,8 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
|
||||||
FRAME_INTERPOLATION("frame_interpolation"),
|
FRAME_INTERPOLATION("frame_interpolation"),
|
||||||
// FRAME_SKIPPING("frame_skipping"),
|
// FRAME_SKIPPING("frame_skipping"),
|
||||||
|
|
||||||
|
ENABLE_INPUT_OVERLAY_AUTO_HIDE("enable_input_overlay_auto_hide"),
|
||||||
|
|
||||||
PERF_OVERLAY_BACKGROUND("perf_overlay_background"),
|
PERF_OVERLAY_BACKGROUND("perf_overlay_background"),
|
||||||
SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"),
|
SHOW_PERFORMANCE_OVERLAY("show_performance_overlay"),
|
||||||
|
|
||||||
|
|
|
@ -387,12 +387,18 @@ abstract class SettingsItem(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
put(
|
put(
|
||||||
SingleChoiceSetting(
|
SwitchSetting(
|
||||||
|
BooleanSetting.ENABLE_INPUT_OVERLAY_AUTO_HIDE,
|
||||||
|
titleId = R.string.enable_input_overlay_auto_hide,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
put(
|
||||||
|
SpinBoxSetting(
|
||||||
IntSetting.INPUT_OVERLAY_AUTO_HIDE,
|
IntSetting.INPUT_OVERLAY_AUTO_HIDE,
|
||||||
titleId = R.string.overlay_auto_hide,
|
titleId = R.string.overlay_auto_hide,
|
||||||
descriptionId = R.string.overlay_auto_hide_description,
|
descriptionId = R.string.overlay_auto_hide_description,
|
||||||
choicesId = R.array.overlayAutoHideEntries,
|
min = 1,
|
||||||
valuesId = R.array.overlayAutoHideValues,
|
max = 999
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -275,6 +275,7 @@ class SettingsFragmentPresenter(
|
||||||
|
|
||||||
private fun addInputOverlaySettings(sl: ArrayList<SettingsItem>) {
|
private fun addInputOverlaySettings(sl: ArrayList<SettingsItem>) {
|
||||||
sl.apply {
|
sl.apply {
|
||||||
|
add(BooleanSetting.ENABLE_INPUT_OVERLAY_AUTO_HIDE.key)
|
||||||
add(IntSetting.INPUT_OVERLAY_AUTO_HIDE.key)
|
add(IntSetting.INPUT_OVERLAY_AUTO_HIDE.key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1750,20 +1750,20 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
}, seconds * 1000L)
|
}, seconds * 1000L)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun handleScreenTap(isLongTap: Boolean) {
|
fun handleScreenTap(isLongTap: Boolean) {
|
||||||
val autoHideSeconds = IntSetting.INPUT_OVERLAY_AUTO_HIDE.getInt()
|
val autoHideSeconds = IntSetting.INPUT_OVERLAY_AUTO_HIDE.getInt()
|
||||||
|
val shouldProceed = BooleanSetting.SHOW_INPUT_OVERLAY.getBoolean() && BooleanSetting.ENABLE_INPUT_OVERLAY_AUTO_HIDE.getBoolean()
|
||||||
|
|
||||||
if (!BooleanSetting.SHOW_INPUT_OVERLAY.getBoolean()) {
|
if (!shouldProceed) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// failsafe
|
||||||
if (autoHideSeconds == 0) {
|
if (autoHideSeconds == 0) {
|
||||||
showOverlay()
|
showOverlay()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show overlay for quick taps when it's hidden
|
|
||||||
if (!isOverlayVisible && !isLongTap) {
|
if (!isOverlayVisible && !isLongTap) {
|
||||||
showOverlay()
|
showOverlay()
|
||||||
}
|
}
|
||||||
|
@ -1772,14 +1772,15 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initializeOverlayAutoHide() {
|
private fun initializeOverlayAutoHide() {
|
||||||
val autoHideSeconds = IntSetting.INPUT_OVERLAY_AUTO_HIDE.getInt()
|
val autoHideSeconds = IntSetting.INPUT_OVERLAY_AUTO_HIDE.getInt()
|
||||||
if (autoHideSeconds > 0) {
|
val autoHideEnabled = BooleanSetting.ENABLE_INPUT_OVERLAY_AUTO_HIDE.getBoolean()
|
||||||
handler.postDelayed({
|
val showOverlay = BooleanSetting.SHOW_INPUT_OVERLAY.getBoolean()
|
||||||
// since the timer starts only after touch input, we need to always force hide it
|
|
||||||
hideOverlay()
|
if (autoHideEnabled && showOverlay) {
|
||||||
}, autoHideSeconds * 1000L)
|
showOverlay()
|
||||||
}
|
startOverlayAutoHideTimer(autoHideSeconds)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun showOverlay() {
|
fun showOverlay() {
|
||||||
|
|
|
@ -79,10 +79,15 @@ namespace AndroidSettings {
|
||||||
Settings::Category::Overlay,
|
Settings::Category::Overlay,
|
||||||
Settings::Specialization::Paired, true,
|
Settings::Specialization::Paired, true,
|
||||||
true};
|
true};
|
||||||
|
Settings::Setting<bool> enable_input_overlay_auto_hide{linkage, false,
|
||||||
|
"enable_input_overlay_auto_hide",
|
||||||
|
Settings::Category::Overlay,
|
||||||
|
Settings::Specialization::Default, true,
|
||||||
|
true,};
|
||||||
|
|
||||||
Settings::Setting<u32> input_overlay_auto_hide{linkage, 0, "input_overlay_auto_hide",
|
Settings::Setting<u32> input_overlay_auto_hide{linkage, 5, "input_overlay_auto_hide",
|
||||||
Settings::Category::Overlay,
|
Settings::Category::Overlay,
|
||||||
Settings::Specialization::Default, true, true,};
|
Settings::Specialization::Default, true, true, &enable_input_overlay_auto_hide};
|
||||||
Settings::Setting<bool> perf_overlay_background{linkage, false, "perf_overlay_background",
|
Settings::Setting<bool> perf_overlay_background{linkage, false, "perf_overlay_background",
|
||||||
Settings::Category::Overlay,
|
Settings::Category::Overlay,
|
||||||
Settings::Specialization::Default, true,
|
Settings::Specialization::Default, true,
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
<!-- Input Overlay -->
|
<!-- Input Overlay -->
|
||||||
<string name="overlay_auto_hide">Overlay Auto Hide</string>
|
<string name="overlay_auto_hide">Overlay Auto Hide</string>
|
||||||
<string name="overlay_auto_hide_description">Automatically hide the touch controls overlay after the specified time of inactivity. Select "Never" to keep the overlay always visible.</string>
|
<string name="overlay_auto_hide_description">Automatically hide the touch controls overlay after the specified time of inactivity.</string>
|
||||||
|
<string name="enable_input_overlay_auto_hide">Enable Overlay Auto Hide</string>
|
||||||
<string name="overlay_auto_hide_never">Never</string>
|
<string name="overlay_auto_hide_never">Never</string>
|
||||||
<string name="overlay_auto_hide_instant">Instantly</string>
|
<string name="overlay_auto_hide_instant">Instantly</string>
|
||||||
<string name="overlay_auto_hide_5s">5 seconds</string>
|
<string name="overlay_auto_hide_5s">5 seconds</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue