diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index 82476eba2..e902dd53e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -290,8 +290,12 @@ class MainPlayerGestureListener( override fun getDisplayPortion(e: MotionEvent): DisplayPortion { return when { - e.x < binding.root.width * 0.3 -> DisplayPortion.LEFT - e.x > binding.root.width * 0.7 -> DisplayPortion.RIGHT + e.x < binding.root.width * + (0.5 - PlayerHelper.getMiddleGestureWidth(player.context) / 2.0) + -> DisplayPortion.LEFT + e.x > binding.root.width * + (0.5 + PlayerHelper.getMiddleGestureWidth(player.context) / 2.0) + -> DisplayPortion.RIGHT else -> DisplayPortion.MIDDLE } } diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java index 6a51bdbea..1e9b1d2c7 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java @@ -246,6 +246,12 @@ public static String getActionForLeftGestureSide(@NonNull final Context context) context.getString(R.string.default_left_gesture_control_value)); } + public static double getMiddleGestureWidth(@NonNull final Context context) { + return Float.parseFloat(getPreferences(context).getString( + context.getString(R.string.middle_gesture_area_width_key), + context.getString(R.string.default_middle_gesture_area_width_value))); + } + public static boolean isStartMainPlayerFullscreenEnabled(@NonNull final Context context) { return getPreferences(context) .getBoolean(context.getString(R.string.start_main_player_fullscreen_key), false); diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 96fbdd197..8fdc0299d 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -264,6 +264,21 @@ 5 10 + + middle_gesture_area_width + .3333 + + 15% + 25% + 33% + 40% + + + .15 + .25 + .3333 + .4 + prefer_original_audio prefer_descriptive_audio diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 122a899f5..5e93cf77d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -113,6 +113,8 @@ Middle gesture action Choose gesture for right part of player screen Right gesture action + Choose area width for middle part of player screen + Middle gesture area width Brightness Volume None diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml index 587501a19..46f292d10 100644 --- a/app/src/main/res/xml/video_audio_settings.xml +++ b/app/src/main/res/xml/video_audio_settings.xml @@ -227,6 +227,16 @@ android:title="@string/max_playback_speed_title" app:singleLineTitle="false" app:iconSpaceReserved="false" /> + +