[Android] ViewStub for delay controls

Geoffrey Métais git at videolan.org
Tue Jan 10 10:51:12 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 10 09:27:17 2017 +0100| [6de75990c1323833dcfdabc665ffe193eaca878f] | committer: Geoffrey Métais

ViewStub for delay controls

> https://code.videolan.org/videolan/vlc-android/commit/6de75990c1323833dcfdabc665ffe193eaca878f
---

 .../org.videolan.vlc.debug_2017.01.09_18.08.li     | Bin 0 -> 620215 bytes
 vlc-android/res/layout/player.xml                  |  20 ++++----------------
 vlc-android/res/layout/player_overlay_settings.xml |  21 +++++++++++++++++++++
 .../vlc/gui/video/VideoPlayerActivity.java         |  10 +++++++---
 4 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/captures/org.videolan.vlc.debug_2017.01.09_18.08.li b/captures/org.videolan.vlc.debug_2017.01.09_18.08.li
new file mode 100644
index 0000000..84d54f9
Binary files /dev/null and b/captures/org.videolan.vlc.debug_2017.01.09_18.08.li differ
diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index 1452289..ac34127 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -66,26 +66,14 @@
             android:layout_marginBottom="@dimen/default_margin"
             android:layout="@layout/player_overlay_info"/>
 
-        <ImageView
-            android:id="@+id/player_delay_minus"
+        <android.support.v7.widget.ViewStubCompat
+            android:id="@+id/player_overlay_settings_stub"
+            android:layout="@layout/player_overlay_settings"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_above="@+id/progress_overlay"
             android:layout_alignParentRight="true"
-            android:layout_margin="@dimen/default_margin"
-            android:src="@drawable/ic_minus_circle"
-            android:focusable="true"
-            android:visibility="invisible"/>
-        <ImageView
-            android:id="@+id/player_delay_plus"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginRight="@dimen/default_margin"
-            android:layout_above="@+id/player_delay_minus"
-            android:layout_alignParentRight="true"
-            android:src="@drawable/ic_plus_circle"
-            android:focusable="true"
-            android:visibility="invisible"/>
+            android:layout_marginRight="@dimen/default_margin" />
 
         <include layout="@layout/player_hud"/>
 
diff --git a/vlc-android/res/layout/player_overlay_settings.xml b/vlc-android/res/layout/player_overlay_settings.xml
new file mode 100644
index 0000000..39343b3
--- /dev/null
+++ b/vlc-android/res/layout/player_overlay_settings.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <ImageView
+        android:id="@+id/player_delay_plus"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/ic_plus_circle"
+        android:focusable="true"
+        android:visibility="invisible"/>
+    <ImageView
+        android:id="@+id/player_delay_minus"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/default_margin"
+        android:src="@drawable/ic_minus_circle"
+        android:focusable="true"
+        android:visibility="invisible"/>
+</LinearLayout>
\ No newline at end of file
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 9c5b889..a3659b6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -442,9 +442,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         if (mSettings.getBoolean("enable_seek_buttons", false))
             initSeekButton();
 
-        mPlaybackSettingPlus = (ImageView) findViewById(R.id.player_delay_plus);
-        mPlaybackSettingMinus = (ImageView) findViewById(R.id.player_delay_minus);
-
         mSurfaceView = (SurfaceView) findViewById(R.id.player_surface);
         mSubtitlesSurfaceView = (SurfaceView) findViewById(R.id.subtitles_surface);
 
@@ -1332,6 +1329,13 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mTouchAction = TOUCH_NONE;
         if (mPresentation != null)
             showOverlayTimeout(OVERLAY_INFINITE);
+        ViewStubCompat vsc = (ViewStubCompat) findViewById(R.id.player_overlay_settings_stub);
+        if (vsc != null) {
+            vsc.inflate();
+            mPlaybackSettingPlus = (ImageView) findViewById(R.id.player_delay_plus);
+            mPlaybackSettingMinus = (ImageView) findViewById(R.id.player_delay_minus);
+
+        }
         mPlaybackSettingMinus.setOnClickListener(this);
         mPlaybackSettingPlus.setOnClickListener(this);
         mPlaybackSettingMinus.setOnTouchListener(new OnRepeatListener(this));



More information about the Android mailing list