[Android] Option to disable seek on double tap
Geoffrey Métais
git at videolan.org
Tue May 23 16:33:00 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 23 16:32:34 2017 +0200| [5eea8d8515a0f714dcb7e7c78a36ab7715873b34] | committer: Geoffrey Métais
Option to disable seek on double tap
> https://code.videolan.org/videolan/vlc-android/commit/5eea8d8515a0f714dcb7e7c78a36ab7715873b34
---
vlc-android/res/values/strings.xml | 2 ++
vlc-android/res/xml/preferences_video.xml | 5 +++++
.../vlc/gui/tv/preferences/PreferencesVideo.java | 1 +
.../org/videolan/vlc/gui/video/VideoPlayerActivity.java | 17 +++++++++++++----
4 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index a01558d5b..cf8b21f3f 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -299,6 +299,8 @@
<string name="enable_volume_gesture_summary">Control volume by gesture during video playback</string>
<string name="enable_seek_buttons">Enable seek buttons</string>
<string name="enable_seek_buttons_summary">Show rewind and forward buttons on the video interface</string>
+ <string name="enable_double_tap_seek_title">Double tap to seek</string>
+ <string name="enable_double_tap_seek_summary">Double tap on screen edges to seek by 10 seconds</string>
<string name="subtitles_prefs_category">Subtitles</string>
<string name="subtitles_size_title">Subtitles Size</string>
diff --git a/vlc-android/res/xml/preferences_video.xml b/vlc-android/res/xml/preferences_video.xml
index 389955da5..38a69d8a7 100644
--- a/vlc-android/res/xml/preferences_video.xml
+++ b/vlc-android/res/xml/preferences_video.xml
@@ -51,6 +51,11 @@
android:summary="@string/confirm_resume_summary"
android:title="@string/confirm_resume_title" />
<CheckBoxPreference
+ android:defaultValue="true"
+ android:key="enable_double_tap_seek"
+ android:summary="@string/enable_double_tap_seek_summary"
+ android:title="@string/enable_double_tap_seek_title" />
+ <CheckBoxPreference
android:defaultValue="false"
android:key="enable_seek_buttons"
android:summary="@string/enable_seek_buttons_summary"
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesVideo.java b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesVideo.java
index 4a2e0cb9a..913b943e7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesVideo.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesVideo.java
@@ -50,6 +50,7 @@ public class PreferencesVideo extends BasePreferenceFragment {
findPreference("force_list_portrait").setVisible(false);
findPreference("save_brightness").setVisible(false);
findPreference("video_min_group_length").setVisible(false);
+ findPreference("enable_double_tap_seek").setVisible(false);
findPreference("enable_volume_gesture").setVisible(AndroidDevices.hasTsp());
findPreference("enable_brightness_gesture").setVisible(AndroidDevices.hasTsp());
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 667583bf5..ae09caac4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -203,6 +203,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
private int mCurrentSize;
private SharedPreferences mSettings;
+
+ private static final int TOUCH_FLAG_AUDIO_VOLUME = 1;
+ private static final int TOUCH_FLAG_BRIGHTNESS = 1 << 1;
+ private static final int TOUCH_FLAG_SEEK = 1 << 2;
private int mTouchControls = 0;
/** Overlay */
@@ -387,8 +391,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
if (!VLCApplication.showTvUi()) {
- mTouchControls = (mSettings.getBoolean("enable_volume_gesture", true) ? 1 : 0)
- + (mSettings.getBoolean("enable_brightness_gesture", true) ? 2 : 0);
+ mTouchControls = (mSettings.getBoolean("enable_volume_gesture", true) ? TOUCH_FLAG_AUDIO_VOLUME : 0)
+ + (mSettings.getBoolean("enable_brightness_gesture", true) ? TOUCH_FLAG_BRIGHTNESS : 0)
+ + (mSettings.getBoolean("enable_double_tap_seek", true) ? TOUCH_FLAG_SEEK : 0);
}
/* Services and miscellaneous */
@@ -2140,12 +2145,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mTouchY = event.getRawY();
mTouchX = event.getRawX();
// Volume (Up or Down - Right side)
- if (mTouchControls == 1 || (mTouchControls == 3 && (int)mTouchX > (4 * mScreen.widthPixels / 7f))){
+ if ((mTouchControls & TOUCH_FLAG_AUDIO_VOLUME) != 0 && (int)mTouchX > (4 * mScreen.widthPixels / 7f)){
doVolumeTouch(y_changed);
hideOverlay(true);
}
// Brightness (Up or Down - Left side)
- if (mTouchControls == 2 || (mTouchControls == 3 && (int)mTouchX < (3 * mScreen.widthPixels / 7f))){
+ if ((mTouchControls & TOUCH_FLAG_BRIGHTNESS) != 0 && (int)mTouchX < (3 * mScreen.widthPixels / 7f)){
doBrightnessTouch(y_changed);
hideOverlay(true);
}
@@ -3607,6 +3612,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mService == null)
return false;
if (!mIsLocked) {
+ if ((mTouchControls & TOUCH_FLAG_SEEK) == 0) {
+ doPlayPause();
+ return true;
+ }
float x = e.getX();
if (x < range/4f)
seekDelta(-10000);
More information about the Android
mailing list