[Android] UI: improve sliding panel layout

Sébastien Toque git at videolan.org
Sat Aug 18 09:51:15 CEST 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat Aug 18 09:47:18 2012 +0200| [26e9bd473d3c3f0d80954068f39dbd9d6a30987d] | committer: Sébastien Toque

UI: improve sliding panel layout

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

 vlc-android/res/layout/player.xml                  |   68 ++++++++++++++------
 vlc-android/res/values-fr/strings.xml              |    1 +
 vlc-android/res/values/colors.xml                  |    1 +
 vlc-android/res/values/strings.xml                 |    1 +
 .../src/org/videolan/vlc/widget/SlidingPanel.java  |    8 +++
 5 files changed, 58 insertions(+), 21 deletions(-)

diff --git a/vlc-android/res/layout/player.xml b/vlc-android/res/layout/player.xml
index 0c0dd16..bc45ab8 100644
--- a/vlc-android/res/layout/player.xml
+++ b/vlc-android/res/layout/player.xml
@@ -26,7 +26,7 @@
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="top"
-        android:background="#AA000000"
+        android:background="@color/transparent_gray"
         android:paddingLeft="5dp"
         android:paddingRight="5dp"
         android:visibility="invisible" >
@@ -55,7 +55,7 @@
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="bottom"
-        android:background="#AA000000"
+        android:background="@color/transparent_gray"
         android:paddingLeft="5dp"
         android:paddingRight="5dp"
         android:visibility="invisible" >
@@ -122,19 +122,30 @@
         android:handle="@+id/slider_handle"
         android:visibility="invisible" >
 
-        <ImageView
+        <LinearLayout
             android:id="@+id/slider_handle"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:paddingBottom="5dp"
-            android:paddingLeft="7dp"
-            android:src="@drawable/ic_seekbar_thumb" />
+            android:layout_height="wrap_content" >
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:paddingBottom="5dp"
+                android:paddingLeft="7dp"
+                android:src="@drawable/ic_seekbar_thumb" />
+
+            <View
+                android:id="@+id/slider_handle_filler"
+                android:layout_width="match_parent"
+                android:layout_height="0dp"
+                android:visibility="gone" />
+        </LinearLayout>
 
         <LinearLayout
             android:id="@+id/slider_content"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:background="#AA000000"
+            android:background="@color/transparent_gray"
             android:orientation="vertical" >
 
             <TextView
@@ -149,11 +160,12 @@
             <LinearLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:gravity="center_vertical"
                 android:orientation="horizontal" >
 
                 <ImageButton
-                    android:layout_width="40dp"
-                    android:layout_height="40dp"
+                    android:layout_width="30dp"
+                    android:layout_height="30dp"
                     android:layout_marginLeft="10dp"
                     android:layout_marginRight="10dp"
                     android:background="@drawable/header_icon_audio" />
@@ -161,18 +173,18 @@
                 <Spinner
                     android:id="@+id/player_overlay_audio"
                     android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_vertical" />
+                    android:layout_height="wrap_content" />
             </LinearLayout>
 
             <LinearLayout
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:gravity="center_vertical"
                 android:orientation="horizontal" >
 
                 <ImageButton
-                    android:layout_width="40dp"
-                    android:layout_height="40dp"
+                    android:layout_width="30dp"
+                    android:layout_height="30dp"
                     android:layout_marginLeft="10dp"
                     android:layout_marginRight="10dp"
                     android:background="@drawable/header_icon_subtitle" />
@@ -180,15 +192,29 @@
                 <Spinner
                     android:id="@+id/player_overlay_subtitle"
                     android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_vertical" />
+                    android:layout_height="wrap_content" />
             </LinearLayout>
 
-            <ImageButton
-                android:id="@+id/player_overlay_lock"
-                android:layout_width="40dip"
-                android:layout_height="40dip"
-                android:background="@drawable/ic_lock" />
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:orientation="horizontal" >
+
+                <ImageButton
+                    android:id="@+id/player_overlay_lock"
+                    android:layout_width="40dip"
+                    android:layout_height="40dip"
+                    android:layout_marginLeft="5dp"
+                    android:layout_marginRight="5dp"
+                    android:background="@drawable/ic_lock" />
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/lock_rotation"
+                    android:textSize="18dip" />
+            </LinearLayout>
         </LinearLayout>
     </org.videolan.vlc.widget.SlidingPanel>
 
diff --git a/vlc-android/res/values-fr/strings.xml b/vlc-android/res/values-fr/strings.xml
index a0f55e5..50e35b2 100644
--- a/vlc-android/res/values-fr/strings.xml
+++ b/vlc-android/res/values-fr/strings.xml
@@ -66,6 +66,7 @@
     <string name="notavailable">Non disponible</string>
     <string name="nosubdirectory">Pas de sous-répertoires</string>
     <string name="validation">Etes-vous sûr ?</string>
+    <string name="lock_rotation">Verrouiller la rotation de l\'écran</string>
     <string name="locked">Verrouillé</string>
     <string name="unlocked">Déverrouillé</string>
     <string name="surface_best_fit">Ajuster au mieux</string>
diff --git a/vlc-android/res/values/colors.xml b/vlc-android/res/values/colors.xml
index ce2e044..d8a624b 100644
--- a/vlc-android/res/values/colors.xml
+++ b/vlc-android/res/values/colors.xml
@@ -5,5 +5,6 @@
     <color name="item_1">#F222</color>
     <color name="item_2">#F000</color>
     <color name="orange">#FFF48B00</color>
+    <color name="transparent_gray">#A000</color>
 
 </resources>
\ No newline at end of file
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 9fe52f3..e04402b 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -67,6 +67,7 @@
     <string name="notavailable">not available</string>
     <string name="nosubdirectory">No subdirectories.</string>
     <string name="validation">Are you sure?</string>
+    <string name="lock_rotation">Lock screen rotation</string>
     <string name="locked">Locked</string>
     <string name="unlocked">Unlocked</string>
     <string name="surface_best_fit">Best fit</string>
diff --git a/vlc-android/src/org/videolan/vlc/widget/SlidingPanel.java b/vlc-android/src/org/videolan/vlc/widget/SlidingPanel.java
index e856739..8b68a2f 100644
--- a/vlc-android/src/org/videolan/vlc/widget/SlidingPanel.java
+++ b/vlc-android/src/org/videolan/vlc/widget/SlidingPanel.java
@@ -20,6 +20,8 @@
 
 package org.videolan.vlc.widget;
 
+import org.videolan.vlc.R;
+
 import android.content.Context;
 import android.util.AttributeSet;
 import android.view.View;
@@ -41,19 +43,25 @@ public class SlidingPanel extends SlidingDrawer {
 
     public void CollapseHandle() {
         View handle = getHandle();
+        View filler = handle.findViewById(R.id.slider_handle_filler);
         LayoutParams lp = handle.getLayoutParams();
         if (lp.width == LayoutParams.WRAP_CONTENT)
             return;
         lp.width = LayoutParams.WRAP_CONTENT;
         handle.setLayoutParams(lp);
+        handle.setBackgroundResource(android.R.color.transparent);
+        filler.setVisibility(View.GONE);
     }
 
     public void ExpandHandle() {
         View handle = getHandle();
+        View filler = handle.findViewById(R.id.slider_handle_filler);
         LayoutParams lp = handle.getLayoutParams();
         if (lp.width == LayoutParams.MATCH_PARENT)
             return;
         lp.width = LayoutParams.MATCH_PARENT;
         handle.setLayoutParams(lp);
+        handle.setBackgroundResource(R.color.transparent_gray);
+        filler.setVisibility(View.VISIBLE);
     }
 }



More information about the Android mailing list