[Android] Improve video player info layout

Geoffrey Métais git at videolan.org
Mon May 23 12:20:05 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 23 12:19:22 2016 +0200| [1891bbe457706d6856434943b535f1be201fc248] | committer: Geoffrey Métais

Improve video player info layout

> https://code.videolan.org/videolan/vlc-android/commit/1891bbe457706d6856434943b535f1be201fc248
---

 vlc-android/res/layout/player.xml                  | 17 +++++++-------
 .../vlc/gui/video/VideoPlayerActivity.java         | 26 +++++++++-------------
 2 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index c2c114c..5edbf35 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -59,17 +59,17 @@
         <LinearLayout
             android:id="@+id/player_overlay_info"
             android:layout_width="wrap_content"
-            android:layout_height="100dp"
+            android:layout_height="wrap_content"
             android:orientation="horizontal"
             android:layout_above="@+id/progress_overlay"
             android:layout_centerHorizontal="true"
-            android:layout_marginBottom="@dimen/default_margin">
+                android:background="@drawable/video_list_length_bg"
+            android:layout_marginBottom="@dimen/default_margin"
+            android:visibility="invisible">
             <FrameLayout
                 android:id="@+id/verticalbar"
                 android:layout_width="20dp"
-                android:layout_height="match_parent"
-                android:background="@drawable/video_list_length_bg"
-                android:visibility="gone">
+                android:layout_height="100dp">
 
                 <LinearLayout
                     android:layout_width="match_parent"
@@ -89,12 +89,11 @@
                 android:id="@+id/player_overlay_textinfo"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
-                android:background="@drawable/video_list_length_bg"
-                android:layout_marginLeft="@dimen/half_default_margin"
+                android:paddingLeft="10dp"
+                android:paddingRight="10dp"
                 android:gravity="center"
                 android:textColor="@color/white"
-                android:textSize="36sp"
-                android:visibility="gone" />
+                android:textSize="36sp" />
         </LinearLayout>
 
         <ImageView
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 58d7c8b..d24b05d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -218,6 +218,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private TextView mTime;
     private TextView mLength;
     private TextView mInfo;
+    private View mOverlayInfo;
     private View mVerticalBar;
     private View mVerticalBarProgress;
     private boolean mIsLoading;
@@ -400,6 +401,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
         // the info textView is not on the overlay
         mInfo = (TextView) findViewById(R.id.player_overlay_textinfo);
+        mOverlayInfo = findViewById(R.id.player_overlay_info);
         mVerticalBar = findViewById(R.id.verticalbar);
         mVerticalBarProgress = findViewById(R.id.verticalbar_progress);
 
@@ -1287,7 +1289,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private void initPlaybackSettingInfo() {
         if (mPresentation == null)
             mVerticalBar.setVisibility(View.GONE);
-        mInfo.setVisibility(View.VISIBLE);
+        mOverlayInfo.setVisibility(View.VISIBLE);
         String text = "";
         if (mPlaybackSetting == DelayState.AUDIO) {
             text += getString(R.string.audio_delay)+"\n";
@@ -1314,7 +1316,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mPlaybackSettingPlus.setOnClickListener(null);
         mPlaybackSettingMinus.setVisibility(View.INVISIBLE);
         mPlaybackSettingPlus.setVisibility(View.INVISIBLE);
-        mInfo.setVisibility(View.INVISIBLE);
+        mOverlayInfo.setVisibility(View.INVISIBLE);
         mInfo.setText("");
         mPlayPause.requestFocus();
     }
@@ -1421,7 +1423,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private void showInfo(String text, int duration) {
         if (mPresentation == null && mVerticalBar != null)
             mVerticalBar.setVisibility(View.GONE);
-        mInfo.setVisibility(View.VISIBLE);
+        mOverlayInfo.setVisibility(View.VISIBLE);
         mInfo.setText(text);
         mHandler.removeMessages(FADE_OUT_INFO);
         mHandler.sendEmptyMessageDelayed(FADE_OUT_INFO, duration);
@@ -1430,7 +1432,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private void showInfo(int textid, int duration) {
         if (mPresentation == null && mVerticalBar != null)
             mVerticalBar.setVisibility(View.GONE);
-        mInfo.setVisibility(View.VISIBLE);
+        mOverlayInfo.setVisibility(View.VISIBLE);
         mInfo.setText(textid);
         mHandler.removeMessages(FADE_OUT_INFO);
         mHandler.sendEmptyMessageDelayed(FADE_OUT_INFO, duration);
@@ -1452,18 +1454,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
 
     private void fadeOutInfo() {
-        if (mInfo.getVisibility() == View.VISIBLE)
-            mInfo.startAnimation(AnimationUtils.loadAnimation(
+        if (mOverlayInfo.getVisibility() == View.VISIBLE)
+            mOverlayInfo.startAnimation(AnimationUtils.loadAnimation(
                     VideoPlayerActivity.this, android.R.anim.fade_out));
-        mInfo.setVisibility(View.INVISIBLE);
-
-        if (mPresentation == null && mVerticalBar != null) {
-            if (mVerticalBar.getVisibility() == View.VISIBLE) {
-                mVerticalBar.startAnimation(AnimationUtils.loadAnimation(
-                        VideoPlayerActivity.this, android.R.anim.fade_out));
-                mVerticalBar.setVisibility(View.INVISIBLE);
-            }
-        }
+        mOverlayInfo.setVisibility(View.INVISIBLE);
     }
 
     @Override
@@ -1998,7 +1992,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                     jump >= 0 ? "+" : "",
                     Strings.millisToString(jump),
                     Strings.millisToString(time + jump),
-                    coef > 1 ? String.format(" x%.1g", 1.0/coef) : ""), 1000);
+                    coef > 1 ? String.format(" x%.1g", 1.0/coef) : ""), 50);
         else
             showInfo(R.string.unseekable_stream, 1000);
     }



More information about the Android mailing list