[Android] Spread viewstubs in remote control view too

Geoffrey Métais git at videolan.org
Mon Jan 16 17:19:20 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jan 16 16:19:53 2017 +0100| [395ae82e98712483a1db6fe04bdaede1733f7210] | committer: Geoffrey Métais

Spread viewstubs in remote control view too

> https://code.videolan.org/videolan/vlc-android/commit/395ae82e98712483a1db6fe04bdaede1733f7210
---

 vlc-android/res/layout/player_remote_control.xml   | 42 +++++++++++-----------
 .../vlc/gui/video/VideoPlayerActivity.java         | 40 ++++++---------------
 2 files changed, 31 insertions(+), 51 deletions(-)

diff --git a/vlc-android/res/layout/player_remote_control.xml b/vlc-android/res/layout/player_remote_control.xml
index 300e731..bd94f68 100644
--- a/vlc-android/res/layout/player_remote_control.xml
+++ b/vlc-android/res/layout/player_remote_control.xml
@@ -39,16 +39,14 @@
         android:background="@color/grey850"
         android:fitsSystemWindows="true" >
 
-        <TextView
-            android:id="@+id/player_overlay_textinfo"
+        <android.support.v7.widget.ViewStubCompat
+            android:id="@+id/player_info_stub"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
+            android:layout_above="@+id/progress_overlay"
             android:layout_centerHorizontal="true"
-            android:padding="5dp"
-            android:textColor="#ffffff"
-            android:textSize="36sp"
-            android:visibility="invisible" />
+            android:layout_marginBottom="@dimen/default_margin"
+            android:layout="@layout/player_overlay_info"/>
 
         <ImageView
             android:id="@+id/player_remote_tips_background"
@@ -74,27 +72,27 @@
 
         </RelativeLayout>
 
-        <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_marginRight="5dp"
             android:layout_above="@+id/progress_overlay"
             android:layout_alignParentRight="true"
-            android:src="@drawable/ic_minus_circle"
-            android:visibility="invisible"/>
-        <ImageView
-            android:id="@+id/player_delay_plus"
+            android:layout_alignParentEnd="true"
+            android:layout_marginRight="@dimen/default_margin"
+            android:layout_marginEnd="@dimen/default_margin"
+            android:layout_marginBottom="@dimen/default_margin"/>
+
+        <android.support.v7.widget.ViewStubCompat
+            android:id="@+id/player_hud_stub"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginBottom="10dp"
-            android:layout_marginRight="5dp"
-            android:layout_above="@+id/player_delay_minus"
-            android:layout_alignParentRight="true"
-            android:src="@drawable/ic_plus_circle"
-            android:visibility="invisible"/>
-
-        <include layout="@layout/player_hud" />
+            android:layout="@layout/player_hud"
+            android:layout_marginBottom="@dimen/overlay_margin"
+            android:layout_marginRight="@dimen/overlay_margin"
+            android:layout_marginLeft="@dimen/overlay_margin"
+            android:layout_alignParentBottom="true" />
 
     </RelativeLayout>
 
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 fb1532a..ced654d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1342,11 +1342,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
     private void initPlaybackSettingInfo() {
         initInfoOverlay();
-        if (mPresentation == null) {
-            UiTools.setViewVisibility(mVerticalBar, View.GONE);
-            UiTools.setViewVisibility(mOverlayInfo, View.VISIBLE);
-        } else
-            UiTools.setViewVisibility(mInfo, View.VISIBLE);
+        UiTools.setViewVisibility(mVerticalBar, View.GONE);
+        UiTools.setViewVisibility(mOverlayInfo, View.VISIBLE);
         String text = "";
         if (mPlaybackSetting == DelayState.AUDIO) {
             text += getString(R.string.audio_delay)+"\n";
@@ -1382,10 +1379,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mPlaybackSettingPlus.setOnClickListener(null);
         mPlaybackSettingMinus.setVisibility(View.INVISIBLE);
         mPlaybackSettingPlus.setVisibility(View.INVISIBLE);
-        if (mPresentation == null)
-            UiTools.setViewVisibility(mOverlayInfo, View.INVISIBLE);
-        else
-            UiTools.setViewVisibility(mInfo, View.INVISIBLE);
+        UiTools.setViewVisibility(mOverlayInfo, View.INVISIBLE);
         mInfo.setText("");
         mPlayPause.requestFocus();
     }
@@ -1428,7 +1422,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      * Lock screen rotation
      */
     private void lockScreen() {
-        if(mScreenOrientation != 100) {
+        if (mScreenOrientation != 100) {
             mScreenOrientationLock = getRequestedOrientation();
             if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
                 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
@@ -1495,11 +1489,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      */
     private void showInfo(String text, int duration) {
         initInfoOverlay();
-        if (mPresentation == null) {
-            UiTools.setViewVisibility(mVerticalBar, View.GONE);
-            UiTools.setViewVisibility(mOverlayInfo, View.VISIBLE);
-        } else
-            mInfo.setVisibility(View.VISIBLE);
+        UiTools.setViewVisibility(mVerticalBar, View.GONE);
+        UiTools.setViewVisibility(mOverlayInfo, View.VISIBLE);
         mInfo.setText(text);
         mHandler.removeMessages(FADE_OUT_INFO);
         mHandler.sendEmptyMessageDelayed(FADE_OUT_INFO, duration);
@@ -1519,11 +1510,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
     private void showInfo(int textid, int duration) {
         initInfoOverlay();
-        if (mPresentation == null) {
-            UiTools.setViewVisibility(mVerticalBar, View.GONE);
-            UiTools.setViewVisibility(mOverlayInfo, View.VISIBLE);
-        } else
-            mInfo.setVisibility(View.VISIBLE);
+        UiTools.setViewVisibility(mVerticalBar, View.GONE);
+        UiTools.setViewVisibility(mOverlayInfo, View.VISIBLE);
         mInfo.setText(textid);
         mHandler.removeMessages(FADE_OUT_INFO);
         mHandler.sendEmptyMessageDelayed(FADE_OUT_INFO, duration);
@@ -1545,16 +1533,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
 
     private void fadeOutInfo() {
-        if (mPresentation == null) {
-            if (mOverlayInfo != null && mOverlayInfo.getVisibility() == View.VISIBLE) {
-                mOverlayInfo.startAnimation(AnimationUtils.loadAnimation(
-                        VideoPlayerActivity.this, android.R.anim.fade_out));
-                UiTools.setViewVisibility(mOverlayInfo, View.INVISIBLE);
-            }
-        } else if (mInfo != null && mInfo.getVisibility() == View.VISIBLE) {
-            mInfo.startAnimation(AnimationUtils.loadAnimation(
+        if (mOverlayInfo != null && mOverlayInfo.getVisibility() == View.VISIBLE) {
+            mOverlayInfo.startAnimation(AnimationUtils.loadAnimation(
                     VideoPlayerActivity.this, android.R.anim.fade_out));
-            mInfo.setVisibility(View.INVISIBLE);
+            UiTools.setViewVisibility(mOverlayInfo, View.INVISIBLE);
         }
     }
 



More information about the Android mailing list