[Android] widget: embed the timeline in a container and show/ hide the container instead

Sébastien Toque git at videolan.org
Mon Feb 18 21:13:26 CET 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Mon Feb 18 20:22:15 2013 +0100| [9a04936a0f236d4b936a57edc6a9a04f8be49783] | committer: Sébastien Toque

widget: embed the timeline in a container and show/hide the container instead

On android 2.2 devices, setVisibility is not available on progressbars with RemoteViews.

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

 vlc-android/res/layout/vlcwidget.xml               |   30 ++++++++++++--------
 .../videolan/vlc/widget/VLCAppWidgetProvider.java  |    2 +-
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/vlc-android/res/layout/vlcwidget.xml b/vlc-android/res/layout/vlcwidget.xml
index d5fe985..529d1e1 100644
--- a/vlc-android/res/layout/vlcwidget.xml
+++ b/vlc-android/res/layout/vlcwidget.xml
@@ -101,18 +101,24 @@
         </LinearLayout>
     </LinearLayout>
 
-    <ProgressBar
-        android:id="@+id/timeline"
-        style="@android:style/Widget.ProgressBar.Horizontal"
+    <LinearLayout
+        android:id="@+id/timeline_parent"
         android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginBottom="2dip"
-        android:focusable="false"
-        android:indeterminate="false"
-        android:maxHeight="2dip"
-        android:minHeight="2dip"
-        android:paddingLeft="0px"
-        android:paddingRight="0px"
-        android:progressDrawable="@drawable/po_seekbar" />
+        android:layout_height="wrap_content" >
+
+        <ProgressBar
+            android:id="@+id/timeline"
+            style="@android:style/Widget.ProgressBar.Horizontal"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="2dip"
+            android:focusable="false"
+            android:indeterminate="false"
+            android:maxHeight="2dip"
+            android:minHeight="2dip"
+            android:paddingLeft="0px"
+            android:paddingRight="0px"
+            android:progressDrawable="@drawable/po_seekbar" />
+    </LinearLayout>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java b/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java
index b977198..c93450e 100644
--- a/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java
+++ b/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java
@@ -76,7 +76,7 @@ public class VLCAppWidgetProvider extends AppWidgetProvider {
             else
                 views.setImageViewResource(R.id.cover, R.drawable.cone);
 
-            views.setViewVisibility(R.id.timeline, artist.length() > 0 ? View.VISIBLE : View.INVISIBLE);
+            views.setViewVisibility(R.id.timeline_parent, artist.length() > 0 ? View.VISIBLE : View.INVISIBLE);
 
             /* commands */
             Intent iBackward = new Intent(ACTION_REMOTE_BACKWARD);



More information about the Android mailing list