From c00e694d40e4d5ddf156a0e2f2d9ab8c5b416cf7 Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Tue, 16 May 2017 21:45:38 -0300 Subject: [PATCH] Add option to disable the gesture controls of the player --- .../java/org/schabi/newpipe/player/MainVideoPlayer.java | 4 ++++ app/src/main/res/values/settings_keys.xml | 1 + app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/settings.xml | 7 +++++++ 4 files changed, 14 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index 7af2c20a1..7e20d4940 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -449,6 +449,8 @@ public class MainVideoPlayer extends Activity { return true; } + private final boolean isGestureControlsEnabled = playerImpl.getSharedPreferences().getBoolean(getString(R.string.player_gesture_controls_key), true); + private final float stepsBrightness = 15, stepBrightness = (1f / stepsBrightness), minBrightness = .01f; private float currentBrightness = .5f; @@ -466,6 +468,8 @@ public class MainVideoPlayer extends Activity { // TODO: Improve video gesture controls @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + if (!isGestureControlsEnabled) return false; + //noinspection PointlessBooleanExpression if (DEBUG && false) Log.d(TAG, "MainVideoPlayer.onScroll = " + ", e1.getRaw = [" + e1.getRawX() + ", " + e1.getRawY() + "]" + diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index ac5647aee..2c9362c93 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -13,6 +13,7 @@ use_external_audio_player autoplay_through_intent use_oldplayer + player_gesture_controls default_resolution_preference 360p diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4afab9443..180bb0ef7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -62,6 +62,8 @@ Black Remember popup size and position Remember the last size and position set to the popup + Player gesture controls + Use gestures to control the brightness and volume of the player Download diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index aa6e2a0db..34a9eed0d 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -56,6 +56,13 @@ android:title="@string/use_old_player_title" android:summary="@string/use_old_player_summary" android:defaultValue="false"/> + + +