From 7abbf43c720aa5e700422336bbe22d0d421bc16b Mon Sep 17 00:00:00 2001 From: klaviartur <_github@fambit.de> Date: Sat, 26 Jul 2025 00:17:16 +0200 Subject: [PATCH 1/2] Added setting for middle gesture area width --- app/src/main/res/values/settings_keys.xml | 15 +++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/video_audio_settings.xml | 10 ++++++++++ 3 files changed, 27 insertions(+) diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 41de40e20..e9a92e13d 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -249,6 +249,21 @@ @string/none_control_key + middle_gesture_area_width + .3333 + + 15% + 25% + 33% + 40% + + + .15 + .25 + .3333 + .4 + + prefer_original_audio prefer_descriptive_audio last_resize_mode diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c1944dda1..185c9b04e 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 3d13e0b71..057d8c021 100644 --- a/app/src/main/res/xml/video_audio_settings.xml +++ b/app/src/main/res/xml/video_audio_settings.xml @@ -218,6 +218,16 @@ app:singleLineTitle="false" app:iconSpaceReserved="false" /> + + Date: Sat, 26 Jul 2025 00:18:16 +0200 Subject: [PATCH 2/2] Make MainPlayer respect middle gesture area width setting --- .../newpipe/player/gesture/MainPlayerGestureListener.kt | 8 ++++++-- .../org/schabi/newpipe/player/helper/PlayerHelper.java | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) 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 f96713633..2542d8f49 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 @@ -275,8 +275,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);