Added settings to enable/disable gestures.

This commit is contained in:
Koen 2024-01-08 12:30:04 +01:00
commit ba87261f9f
3 changed files with 31 additions and 4 deletions

View file

@ -809,7 +809,27 @@ class Settings : FragmentedStorageFileJson() {
var polycentricEnabled: Boolean = true; var polycentricEnabled: Boolean = true;
} }
@FormField(R.string.info, FieldForm.GROUP, -1, 19) @FormField(R.string.gesture_controls, FieldForm.GROUP, -1, 19)
var gestureControls = GestureControls();
@Serializable
class GestureControls {
@FormField(R.string.volume_slider, FieldForm.TOGGLE, -1, 1)
var volumeSlider: Boolean = true;
@FormField(R.string.brightness_slider, FieldForm.TOGGLE, -1, 2)
var brightnessSlider: Boolean = true;
@FormField(R.string.toggle_full_screen, FieldForm.TOGGLE, -1, 3)
var toggleFullscreen: Boolean = true;
@FormField(R.string.system_brightness, FieldForm.TOGGLE, -1, 4)
var useSystemBrightness: Boolean = false;
@FormField(R.string.system_brightness, FieldForm.TOGGLE, -1, 4)
var useSystemVolume: Boolean = false;
}
@FormField(R.string.info, FieldForm.GROUP, -1, 20)
var info = Info(); var info = Info();
@Serializable @Serializable
class Info { class Info {

View file

@ -19,6 +19,7 @@ import androidx.core.animation.doOnEnd
import androidx.core.animation.doOnStart import androidx.core.animation.doOnStart
import androidx.core.view.GestureDetectorCompat import androidx.core.view.GestureDetectorCompat
import com.futo.platformplayer.R import com.futo.platformplayer.R
import com.futo.platformplayer.Settings
import com.futo.platformplayer.constructs.Event0 import com.futo.platformplayer.constructs.Event0
import com.futo.platformplayer.constructs.Event1 import com.futo.platformplayer.constructs.Event1
import com.futo.platformplayer.logging.Logger import com.futo.platformplayer.logging.Logger
@ -126,11 +127,11 @@ class GestureControlView : LinearLayout {
val rx = (p0.x + p1.x) / (2 * width); val rx = (p0.x + p1.x) / (2 * width);
val ry = (p0.y + p1.y) / (2 * height); val ry = (p0.y + p1.y) / (2 * height);
if (ry > 0.1 && ry < 0.9) { if (ry > 0.1 && ry < 0.9) {
if (_isFullScreen && rx < 0.2) { if (Settings.instance.gestureControls.brightnessSlider && _isFullScreen && rx < 0.2) {
startAdjustingBrightness(); startAdjustingBrightness();
} else if (_isFullScreen && rx > 0.8) { } else if (Settings.instance.gestureControls.volumeSlider && _isFullScreen && rx > 0.8) {
startAdjustingSound(); startAdjustingSound();
} else if (fullScreenGestureEnabled && rx in 0.3..0.7) { } else if (Settings.instance.gestureControls.toggleFullscreen && fullScreenGestureEnabled && rx in 0.3..0.7) {
if (_isFullScreen) { if (_isFullScreen) {
startAdjustingFullscreenDown(); startAdjustingFullscreenDown();
} else { } else {

View file

@ -344,6 +344,12 @@
<string name="get_answers_to_common_questions">Get answers to common questions</string> <string name="get_answers_to_common_questions">Get answers to common questions</string>
<string name="give_feedback_on_the_application">Give feedback on the application</string> <string name="give_feedback_on_the_application">Give feedback on the application</string>
<string name="info">Info</string> <string name="info">Info</string>
<string name="gesture_controls">Gesture controls</string>
<string name="volume_slider">Volume slider</string>
<string name="brightness_slider">Brightness slider</string>
<string name="toggle_full_screen">Toogle full screen</string>
<string name="system_brightness">System brightness</string>
<string name="system_volume">System volume</string>
<string name="live_chat_webview">Live Chat Webview</string> <string name="live_chat_webview">Live Chat Webview</string>
<string name="full_screen_portrait">Fullscreen portrait</string> <string name="full_screen_portrait">Fullscreen portrait</string>
<string name="allow_full_screen_portrait">Allow fullscreen portrait</string> <string name="allow_full_screen_portrait">Allow fullscreen portrait</string>