Add option to disable the gesture controls of the player

This commit is contained in:
Mauricio Colli 2017-05-16 21:45:38 -03:00
parent f0761cc95e
commit c00e694d40
4 changed files with 14 additions and 0 deletions

View File

@ -449,6 +449,8 @@ public class MainVideoPlayer extends Activity {
return true; 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 final float stepsBrightness = 15, stepBrightness = (1f / stepsBrightness), minBrightness = .01f;
private float currentBrightness = .5f; private float currentBrightness = .5f;
@ -466,6 +468,8 @@ public class MainVideoPlayer extends Activity {
// TODO: Improve video gesture controls // TODO: Improve video gesture controls
@Override @Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (!isGestureControlsEnabled) return false;
//noinspection PointlessBooleanExpression //noinspection PointlessBooleanExpression
if (DEBUG && false) Log.d(TAG, "MainVideoPlayer.onScroll = " + if (DEBUG && false) Log.d(TAG, "MainVideoPlayer.onScroll = " +
", e1.getRaw = [" + e1.getRawX() + ", " + e1.getRawY() + "]" + ", e1.getRaw = [" + e1.getRawX() + ", " + e1.getRawY() + "]" +

View File

@ -13,6 +13,7 @@
<string name="use_external_audio_player_key" translatable="false">use_external_audio_player</string> <string name="use_external_audio_player_key" translatable="false">use_external_audio_player</string>
<string name="autoplay_through_intent_key" translatable="false">autoplay_through_intent</string> <string name="autoplay_through_intent_key" translatable="false">autoplay_through_intent</string>
<string name="use_old_player_key" translatable="false">use_oldplayer</string> <string name="use_old_player_key" translatable="false">use_oldplayer</string>
<string name="player_gesture_controls_key" translatable="false">player_gesture_controls</string>
<string name="default_resolution_key" translatable="false">default_resolution_preference</string> <string name="default_resolution_key" translatable="false">default_resolution_preference</string>
<string name="default_resolution_value" translatable="false">360p</string> <string name="default_resolution_value" translatable="false">360p</string>

View File

@ -62,6 +62,8 @@
<string name="black_theme_title">Black</string> <string name="black_theme_title">Black</string>
<string name="popup_remember_size_pos_title">Remember popup size and position</string> <string name="popup_remember_size_pos_title">Remember popup size and position</string>
<string name="popup_remember_size_pos_summary">Remember the last size and position set to the popup</string> <string name="popup_remember_size_pos_summary">Remember the last size and position set to the popup</string>
<string name="player_gesture_controls_title">Player gesture controls</string>
<string name="player_gesture_controls_summary">Use gestures to control the brightness and volume of the player</string>
<string name="download_dialog_title">Download</string> <string name="download_dialog_title">Download</string>
<string-array name="download_options"> <string-array name="download_options">

View File

@ -56,6 +56,13 @@
android:title="@string/use_old_player_title" android:title="@string/use_old_player_title"
android:summary="@string/use_old_player_summary" android:summary="@string/use_old_player_summary"
android:defaultValue="false"/> android:defaultValue="false"/>
<CheckBoxPreference
android:key="@string/player_gesture_controls_key"
android:title="@string/player_gesture_controls_title"
android:summary="@string/player_gesture_controls_summary"
android:defaultValue="true"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory