[Android] Merge gesture & brightness control options
Geoffrey Métais
git at videolan.org
Fri Jan 8 15:57:07 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 8 15:56:35 2016 +0100| [f35c2110d5e6f5ec705acfebbd22c1edc4e48aaf] | committer: Geoffrey Métais
Merge gesture & brightness control options
> https://code.videolan.org/videolan/vlc-android/commit/f35c2110d5e6f5ec705acfebbd22c1edc4e48aaf
---
vlc-android/res/values/strings.xml | 15 ++++++++++++++-
vlc-android/res/xml/preferences_ui.xml | 14 +++++---------
.../org/videolan/vlc/gui/video/VideoPlayerActivity.java | 13 +++++--------
3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 72c3aff..1ba6fbe 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -351,8 +351,10 @@
<string name="directory_empty">Directory is empty</string>
<string name="save_brightness_summary">Remember brightness level in video player</string>
<string name="save_brightness_title">Save brightness level for video</string>
- <string name="player_touch_summary">Enable swipe gestures and double tap in video player</string>
<string name="player_touch_title">Touch controls for Video</string>
+ <string name="player_touch_enable_all">Enable Touch controls</string>
+ <string name="player_touch_disable_brightness">Disable brightness control</string>
+ <string name="player_touch_disable_all">Disable all Touch controls</string>
<!--Accessibility-->
<string name="more_actions">More Actions</string>
@@ -542,6 +544,17 @@
<item>Windows-1258</item>
</string-array>
+ <string-array name="touch_entries">
+ <item>@string/player_touch_enable_all</item>
+ <item>@string/player_touch_disable_brightness</item>
+ <item>@string/player_touch_disable_all</item>
+ </string-array>
+ <string-array name="touch_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ </string-array>
+
<string-array name="aouts">
<item>@string/aout_audiotrack</item>
<item>@string/aout_opensles</item>
diff --git a/vlc-android/res/xml/preferences_ui.xml b/vlc-android/res/xml/preferences_ui.xml
index 7874679..cb972c2 100644
--- a/vlc-android/res/xml/preferences_ui.xml
+++ b/vlc-android/res/xml/preferences_ui.xml
@@ -18,11 +18,12 @@
android:key="save_brightness"
android:summary="@string/save_brightness_summary"
android:title="@string/save_brightness_title" />
- <CheckBoxPreference
- android:defaultValue="true"
+ <ListPreference
+ android:defaultValue="0"
android:key="enable_touch_player"
- android:summary="@string/player_touch_summary"
- android:title="@string/player_touch_title" />
+ android:title="@string/player_touch_title"
+ android:entries="@array/touch_entries"
+ android:entryValues="@array/touch_values"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="dialog_confirm_resume"
@@ -40,11 +41,6 @@
android:title="@string/force_list_portrait" />
<CheckBoxPreference
android:defaultValue="true"
- android:key="enable_brightness_gesture"
- android:summary="@string/enable_brightness_gesture_summary"
- android:title="@string/enable_brightness_gesture" />
- <CheckBoxPreference
- android:defaultValue="true"
android:key="enable_headset_detection"
android:summary="@string/enable_headset_detection_summary"
android:title="@string/enable_headset_detection" />
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 def5f40..c21cc5f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -194,7 +194,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
private int mCurrentSize = SURFACE_BEST_FIT;
private SharedPreferences mSettings;
- private boolean mTouchControls = true;
+ private int mTouchControls = 0;
/** Overlay */
private ActionBar mActionBar;
@@ -359,7 +359,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mSettings = PreferenceManager.getDefaultSharedPreferences(this);
- mTouchControls = mSettings.getBoolean(PreferencesUi.KEY_ENABLE_TOUCH_PLAYER, true);
+ mTouchControls = Integer.valueOf(mSettings.getString(PreferencesUi.KEY_ENABLE_TOUCH_PLAYER, "0")).intValue();
/* Services and miscellaneous */
mAudioManager = (AudioManager) VLCApplication.getAppContext().getSystemService(AUDIO_SERVICE);
@@ -408,9 +408,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mVerticalBar = findViewById(R.id.verticalbar);
mVerticalBarProgress = findViewById(R.id.verticalbar_progress);
- mEnableBrightnessGesture = !TextUtils.equals(BuildConfig.FLAVOR_target, "chrome") &&
- mSettings.getBoolean("enable_brightness_gesture", true);
-
mScreenOrientation = Integer.valueOf(
mSettings.getString("screen_orientation_value", "4" /*SCREEN_ORIENTATION_SENSOR*/));
@@ -1782,7 +1779,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
togglePlaylist();
return true;
}
- if (!mTouchControls || mIsLocked) {
+ if (mTouchControls == 2 || mIsLocked) {
// locked or swipe disabled, only handle show/hide & ignore all actions
if (event.getAction() == MotionEvent.ACTION_UP) {
if (!mShowing) {
@@ -1848,12 +1845,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mTouchY = event.getRawY();
mTouchX = event.getRawX();
// Volume (Up or Down - Right side)
- if (!mEnableBrightnessGesture || (int)mTouchX > (3 * screen.widthPixels / 5)){
+ if (mTouchControls == 1 || (int)mTouchX > (3 * screen.widthPixels / 5)){
doVolumeTouch(y_changed);
hideOverlay(true);
}
// Brightness (Up or Down - Left side)
- if (mEnableBrightnessGesture && (int)mTouchX < (2 * screen.widthPixels / 5)){
+ else if ((int)mTouchX < (2 * screen.widthPixels / 5)){
doBrightnessTouch(y_changed);
hideOverlay(true);
}
More information about the Android
mailing list