[Android] Video player : Show seek bar during lock screen mode

Alexandre Perraud git at videolan.org
Thu Mar 14 19:41:47 CET 2013


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu Mar 14 18:30:23 2013 +0100| [f7b5290d5246eb5662fac42cef6d39264462a242] | committer: Jean-Baptiste Kempf

Video player : Show seek bar during lock screen mode

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 vlc-android/res/layout/player.xml                  |   69 ++++++++++++--------
 .../vlc/gui/video/VideoPlayerActivity.java         |   21 ++++--
 2 files changed, 57 insertions(+), 33 deletions(-)

diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index d4f3408..b862563 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -27,7 +27,7 @@
         android:background="@drawable/video_list_length_bg"
         android:padding="5dp"
         android:textColor="#ffffff"
-        android:textSize="36dp"
+        android:textSize="36sp"
         android:visibility="invisible" />
 
     <LinearLayout
@@ -49,7 +49,7 @@
             android:gravity="left|center_vertical"
             android:text="@string/title"
             android:textColor="#ffffff"
-            android:textSize="15dip" />
+            android:textSize="15sp" />
 
         <TextView
             android:id="@+id/player_overlay_battery"
@@ -58,7 +58,7 @@
             android:layout_gravity="right|center_vertical"
             android:layout_marginRight="5dp"
             android:textColor="#ffffff"
-            android:textSize="15dip" />
+            android:textSize="15sp" />
 
         <TextView
             android:id="@+id/player_overlay_systime"
@@ -66,14 +66,14 @@
             android:layout_height="wrap_content"
             android:layout_gravity="right|center_vertical"
             android:textColor="#ffffff"
-            android:textSize="15dip" />
+            android:textSize="15sp" />
     </LinearLayout>
 
     <LinearLayout
         android:id="@+id/option_overlay"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_above="@+id/player_overlay"
+        android:layout_above="@+id/progress_overlay"
         android:layout_alignParentRight="true"
         android:layout_below="@+id/player_overlay_header"
         android:gravity="bottom|right"
@@ -107,25 +107,41 @@
             android:background="@drawable/header_icon_subtitle" />
     </LinearLayout>
 
-    <LinearLayout
-        android:id="@+id/lock_overlay"
-        android:layout_width="wrap_content"
+    <RelativeLayout
+        android:id="@+id/interface_overlay"
+        android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:layout_above="@+id/player_overlay" >
+        android:layout_alignParentBottom="true"
+        android:layout_gravity="bottom"
+        android:background="@color/transparent_gray"
+        android:paddingLeft="5dp"
+        android:paddingRight="5dp"
+        android:visibility="invisible" >
+
+        <FrameLayout
+            android:id="@+id/player_control"
+            android:layout_width="fill_parent"
+            android:layout_height="40dip"
+            android:layout_below="@+id/player_overlay_seekbar"
+            android:layout_centerHorizontal="true"
+            android:layout_marginLeft="60dp"
+            android:layout_marginRight="60dp" />
 
         <ImageButton
-            android:id="@+id/lock_overlay_button"
+            android:id="@+id/player_overlay_size"
             android:layout_width="40dip"
             android:layout_height="40dip"
-            android:background="@drawable/ic_lock" />
-    </LinearLayout>
+            android:layout_alignParentRight="true"
+            android:layout_below="@+id/player_overlay_seekbar"
+            android:background="@drawable/ic_size" />
+    </RelativeLayout>
 
     <RelativeLayout
-        android:id="@+id/player_overlay"
+        android:id="@+id/progress_overlay"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_gravity="bottom"
+        android:layout_above="@+id/interface_overlay"
+        android:layout_alignParentLeft="true"
         android:background="@color/transparent_gray"
         android:paddingLeft="5dp"
         android:paddingRight="5dp"
@@ -171,23 +187,20 @@
             android:text="@string/time_0"
             android:textColor="#ffffff"
             android:textSize="15sp" />
+    </RelativeLayout>
 
-        <FrameLayout
-            android:id="@+id/player_control"
-            android:layout_width="fill_parent"
-            android:layout_height="40dip"
-            android:layout_below="@+id/player_overlay_seekbar"
-            android:layout_centerHorizontal="true"
-            android:layout_marginLeft="60dp"
-            android:layout_marginRight="60dp" />
+    <LinearLayout
+        android:id="@+id/lock_overlay"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_above="@+id/progress_overlay"
+        android:layout_alignParentLeft="true" >
 
         <ImageButton
-            android:id="@+id/player_overlay_size"
+            android:id="@+id/lock_overlay_button"
             android:layout_width="40dip"
             android:layout_height="40dip"
-            android:layout_alignParentRight="true"
-            android:layout_below="@+id/player_overlay_seekbar"
-            android:background="@drawable/ic_size" />
-    </RelativeLayout>
+            android:background="@drawable/ic_lock" />
+    </LinearLayout>
 
 </RelativeLayout>
\ 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 24041a4..91df1b9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -113,7 +113,8 @@ public class VideoPlayerActivity extends Activity {
     private View mOverlayHeader;
     private View mOverlayLock;
     private View mOverlayOption;
-    private View mOverlay;
+    private View mOverlayProgress;
+    private View mOverlayInterface;
     private static final int OVERLAY_TIMEOUT = 4000;
     private static final int OVERLAY_INFINITE = 3600000;
     private static final int FADE_OUT = 1;
@@ -204,7 +205,8 @@ public class VideoPlayerActivity extends Activity {
         mOverlayHeader = findViewById(R.id.player_overlay_header);
         mOverlayLock = findViewById(R.id.lock_overlay);
         mOverlayOption = findViewById(R.id.option_overlay);
-        mOverlay = findViewById(R.id.player_overlay);
+        mOverlayProgress = findViewById(R.id.progress_overlay);
+        mOverlayInterface = findViewById(R.id.interface_overlay);
 
         /* header */
         mTitle = (TextView) findViewById(R.id.player_overlay_title);
@@ -512,6 +514,9 @@ public class VideoPlayerActivity extends Activity {
             setRequestedOrientation(getScreenOrientation());
         showInfo(R.string.locked, 1000);
         mLock.setBackgroundResource(R.drawable.ic_lock_glow);
+        mTime.setEnabled(false);
+        mSeekbar.setEnabled(false);
+        mLength.setEnabled(false);
         hideOverlay(true);
     }
 
@@ -523,6 +528,9 @@ public class VideoPlayerActivity extends Activity {
             setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
         showInfo(R.string.unlocked, 1000);
         mLock.setBackgroundResource(R.drawable.ic_lock);
+        mTime.setEnabled(true);
+        mSeekbar.setEnabled(true);
+        mLength.setEnabled(true);
         mShowing = false;
         showOverlay();
     }
@@ -1198,9 +1206,10 @@ public class VideoPlayerActivity extends Activity {
             if (!mIsLocked) {
                 mOverlayHeader.setVisibility(View.VISIBLE);
                 mOverlayOption.setVisibility(View.VISIBLE);
-                mOverlay.setVisibility(View.VISIBLE);
+                mOverlayInterface.setVisibility(View.VISIBLE);
                 dimStatusBar(false);
             }
+            mOverlayProgress.setVisibility(View.VISIBLE);
         }
         Message msg = mHandler.obtainMessage(FADE_OUT);
         if (timeout != 0) {
@@ -1222,12 +1231,14 @@ public class VideoPlayerActivity extends Activity {
                 mOverlayLock.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
                 mOverlayHeader.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
                 mOverlayOption.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
-                mOverlay.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
+                mOverlayProgress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
+                mOverlayInterface.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
             }
             mOverlayLock.setVisibility(View.INVISIBLE);
             mOverlayHeader.setVisibility(View.INVISIBLE);
             mOverlayOption.setVisibility(View.INVISIBLE);
-            mOverlay.setVisibility(View.INVISIBLE);
+            mOverlayProgress.setVisibility(View.INVISIBLE);
+            mOverlayInterface.setVisibility(View.INVISIBLE);
             mShowing = false;
             dimStatusBar(true);
         }



More information about the Android mailing list