[Android] Add seek buttons for video player accessibiliy

Alexandre Perraud git at videolan.org
Wed Oct 21 12:00:35 CEST 2015


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Wed Oct 21 11:58:48 2015 +0200| [5231bc2d20f138846b8068877a428bd69b6be80f] | committer: Alexandre Perraud

Add seek buttons for video player accessibiliy

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5231bc2d20f138846b8068877a428bd69b6be80f
---

 vlc-android/res/layout/player_hud.xml              |   30 +++++++++++++++++--
 vlc-android/res/values/strings.xml                 |    4 +--
 vlc-android/res/xml/preferences_ui.xml             |    5 ++++
 .../vlc/gui/video/VideoPlayerActivity.java         |   31 ++++++++++++++++++++
 4 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 62ca0e4..e4f9d99 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -61,8 +61,8 @@
         android:layout_height="wrap_content"
         android:layout_below="@id/player_overlay_length"
         android:layout_marginRight="@dimen/images_margin_sides"
-        android:layout_marginLeft="@dimen/images_margin_sides"
-        android:weightSum="5">
+        android:layout_marginLeft="@dimen/images_margin_sides">
+
         <ImageView
             android:id="@+id/lock_overlay_button"
             android:layout_width="0dp"
@@ -84,6 +84,19 @@
             android:focusable="true"/>
 
         <ImageView
+            android:id="@+id/player_overlay_rewind"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:focusable="true"
+            android:longClickable="true"
+            android:onClick="onRewindClick"
+            android:scaleType="center"
+            android:src="@drawable/ic_rewind_circle"
+            android:visibility="gone" />
+
+        <ImageView
             android:id="@+id/player_overlay_play"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
@@ -94,6 +107,19 @@
             android:focusable="true"/>
 
         <ImageView
+            android:id="@+id/player_overlay_forward"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:onClick="onForwardClick"
+            android:longClickable="true"
+            android:src="@drawable/ic_forward_circle"
+            android:scaleType="center"
+            android:focusable="true"
+            android:visibility="gone" />
+
+        <ImageView
             android:id="@+id/player_overlay_adv_function"
             android:layout_width="0dp"
             android:layout_height="match_parent"
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index a633930..20d1b08 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -249,8 +249,8 @@
     <string name="interface_other_category">Interface - Other</string>
     <string name="enable_brightness_gesture">Enable brightness gesture</string>
     <string name="enable_brightness_gesture_summary">Control brightness by gesture during video playback</string>
-    <string name="enable_jump_buttons">Enable jump buttons</string>
-    <string name="enable_jump_buttons_summary">Show backward and forward buttons on the video interface</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="force_list_portrait">No grid in portrait mode</string>
     <string name="force_list_portrait_summary">Show videos in list instead of grid in portrait mode</string>
     <string name="audio_title_alignment">Audio title alignment</string>
diff --git a/vlc-android/res/xml/preferences_ui.xml b/vlc-android/res/xml/preferences_ui.xml
index 4f1fcc3..0303b0c 100644
--- a/vlc-android/res/xml/preferences_ui.xml
+++ b/vlc-android/res/xml/preferences_ui.xml
@@ -20,6 +20,11 @@
             android:title="@string/confirm_resume_title" />
         <CheckBoxPreference
             android:defaultValue="false"
+            android:key="enable_seek_buttons"
+            android:summary="@string/enable_seek_buttons_summary"
+            android:title="@string/enable_seek_buttons" />
+        <CheckBoxPreference
+            android:defaultValue="false"
             android:key="force_list_portrait"
             android:summary="@string/force_list_portrait_summary"
             android:title="@string/force_list_portrait" />
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 0f48006..24c5a39 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -211,6 +211,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private ImageView mTipsBackground;
     private ImageView mPlayPause;
     private ImageView mTracks;
+    private ImageView mRewind;
+    private ImageView mForward;
     private ImageView mAdvOptions;
     private ImageView mDelayPlus;
     private ImageView mDelayMinus;
@@ -391,6 +393,9 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
         mSize = (ImageView) findViewById(R.id.player_overlay_size);
 
+        if (mSettings.getBoolean("enable_seek_buttons", false))
+            initSeekButton();
+
         mDelayPlus = (ImageView) findViewById(R.id.player_delay_plus);
         mDelayMinus = (ImageView) findViewById(R.id.player_delay_minus);
 
@@ -2158,6 +2163,32 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         showOverlay();
     }
 
+    private void initSeekButton() {
+        mRewind = (ImageView) findViewById(R.id.player_overlay_rewind);
+        mForward = (ImageView) findViewById(R.id.player_overlay_forward);
+        mRewind.setVisibility(View.VISIBLE);
+        mForward.setVisibility(View.VISIBLE);
+        mRewind.setOnClickListener(mRewindListener);
+        mForward.setOnClickListener(mForwardListener);
+        mRewind.setOnTouchListener(new OnRepeatListener(mRewindListener));
+        mForward.setOnTouchListener(new OnRepeatListener(mForwardListener));
+    }
+
+
+    private final OnClickListener mRewindListener = new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            seekDelta(-30000);
+        }
+    };
+
+    private final OnClickListener mForwardListener = new OnClickListener() {
+        @Override
+        public void onClick(View v) {
+            seekDelta(30000);
+        }
+    };
+
     /**
      *
      */



More information about the Android mailing list