[Android] UI : Make the widget resizable in 3x1

Alexandre Perraud git at videolan.org
Thu Jun 11 18:37:48 CEST 2015


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu Jun 11 18:36:12 2015 +0200| [473abdec23b273310275bab8c142f5daa3aef8a7] | committer: Alexandre Perraud

UI : Make the widget resizable in 3x1

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

 vlc-android/AndroidManifest.xml      |    2 +-
 vlc-android/res/layout/vlcwidget.xml |   52 +++++++++++++++++++---------------
 vlc-android/res/values/dimens.xml    |    1 +
 vlc-android/res/xml/vlcwidget.xml    |    4 ++-
 4 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/vlc-android/AndroidManifest.xml b/vlc-android/AndroidManifest.xml
index fe0d0f5..5eba396 100644
--- a/vlc-android/AndroidManifest.xml
+++ b/vlc-android/AndroidManifest.xml
@@ -426,7 +426,7 @@
         <receiver
             android:name=".widget.VLCAppWidgetProvider"
             android:exported="false"
-            android:label="VLC mini player" >
+            android:label="VLC resizable widget" >
             <intent-filter>
                 <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
             </intent-filter>
diff --git a/vlc-android/res/layout/vlcwidget.xml b/vlc-android/res/layout/vlcwidget.xml
index 19664d9..01e7b91 100644
--- a/vlc-android/res/layout/vlcwidget.xml
+++ b/vlc-android/res/layout/vlcwidget.xml
@@ -1,26 +1,25 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
     android:layout_margin="@dimen/widget_margin"
     android:background="@color/grey50"
     android:clickable="true"
-    android:clipChildren="true"
     android:gravity="center"
     android:orientation="vertical" >
 
     <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:layout_gravity="center"
         android:gravity="center"
         android:orientation="horizontal" >
 
         <ImageView
             android:id="@+id/cover"
-            android:layout_width="84dp"
-            android:layout_height="84dp"
+            android:layout_width="82dp"
+            android:layout_height="82dp"
             android:background="@color/orange100"
             android:src="@drawable/icon" />
 
@@ -28,17 +27,18 @@
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:orientation="vertical" >
+            android:orientation="vertical"
+            android:paddingLeft="@dimen/half_default_margin"
+            android:paddingRight="@dimen/half_default_margin">
 
             <TextView
                 android:id="@+id/artist"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center|left"
-                android:layout_marginLeft="@dimen/default_margin"
+                android:layout_marginLeft="@dimen/half_default_margin"
                 android:ellipsize="end"
                 android:singleLine="true"
-                android:text=""
                 android:textColor="@color/grey600"
                 android:textSize="14sp" />
 
@@ -47,7 +47,7 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center|left"
-                android:layout_marginLeft="@dimen/default_margin"
+                android:layout_marginLeft="@dimen/half_default_margin"
                 android:ellipsize="end"
                 android:singleLine="true"
                 android:text="@string/widget_name"
@@ -55,9 +55,9 @@
                 android:textSize="16sp" />
 
             <LinearLayout
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:weightSum="4"
+                android:weightSum="3"
                 android:orientation="horizontal" >
 
                 <ImageButton
@@ -66,11 +66,13 @@
                     android:layout_height="wrap_content"
                     android:background="#00ffffff"
                     android:clickable="true"
-                    android:layout_gravity="left"
                     android:scaleType="centerInside"
-                    android:layout_weight="1"
                     android:src="@drawable/ic_widget_previous" />
-
+                <RelativeLayout
+                    android:layout_width="0dp"
+                    android:layout_height="1dp"
+                    android:layout_weight="1" >
+                </RelativeLayout>
                 <ImageButton
                     android:id="@+id/play_pause"
                     android:layout_width="wrap_content"
@@ -78,9 +80,12 @@
                     android:background="#00ffffff"
                     android:clickable="true"
                     android:scaleType="centerInside"
-                    android:layout_weight="1"
                     android:src="@drawable/ic_widget_play" />
-
+                <RelativeLayout
+                    android:layout_width="0dp"
+                    android:layout_height="1dp"
+                    android:layout_weight="1" >
+                </RelativeLayout>
                 <ImageButton
                     android:id="@+id/forward"
                     android:layout_width="wrap_content"
@@ -88,16 +93,17 @@
                     android:background="#00ffffff"
                     android:clickable="true"
                     android:scaleType="centerInside"
-                    android:layout_weight="1"
                     android:src="@drawable/ic_widget_next" />
-
+                <RelativeLayout
+                    android:layout_width="0dp"
+                    android:layout_height="1dp"
+                    android:layout_weight="1" >
+                </RelativeLayout>
                 <ImageButton
                     android:id="@+id/stop"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="right"
                     android:background="#00ffffff"
-                    android:layout_weight="1"
                     android:clickable="true"
                     android:scaleType="centerInside"
                     android:src="@drawable/ic_widget_close" />
@@ -105,14 +111,14 @@
 
             <LinearLayout
                 android:id="@+id/timeline_parent"
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:visibility="invisible">
 
                 <ProgressBar
                     android:id="@+id/timeline"
                     style="@android:style/Widget.ProgressBar.Horizontal"
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginBottom="2dip"
                     android:focusable="false"
diff --git a/vlc-android/res/values/dimens.xml b/vlc-android/res/values/dimens.xml
index 34b4804..029b292 100644
--- a/vlc-android/res/values/dimens.xml
+++ b/vlc-android/res/values/dimens.xml
@@ -31,6 +31,7 @@
 
     <!-- Default -->
     <dimen name="default_margin">16dp</dimen>
+    <dimen name="half_default_margin">8dp</dimen>
     <dimen name="actionBarSize">56dp</dimen>
 
 </resources>
\ No newline at end of file
diff --git a/vlc-android/res/xml/vlcwidget.xml b/vlc-android/res/xml/vlcwidget.xml
index 2637c33..b741d2b 100644
--- a/vlc-android/res/xml/vlcwidget.xml
+++ b/vlc-android/res/xml/vlcwidget.xml
@@ -1,6 +1,8 @@
 <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
-    android:minWidth="294dp"
+    android:minWidth="250dp"
     android:minHeight="40dp"
+    android:resizeMode="horizontal"
+    android:minResizeWidth="180dp"
     android:updatePeriodMillis="86400000"
     android:initialLayout="@layout/vlcwidget"
     android:previewImage="@drawable/widget_preview_01">



More information about the Android mailing list