[Android] Fix widget update

Geoffrey Métais git at videolan.org
Thu May 28 11:55:43 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May 28 11:48:21 2015 +0200| [dd5e7d360e7748c961899833578c172d01b04e21] | committer: Geoffrey Métais

Fix widget update

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

 vlc-android/src/org/videolan/vlc/PlaybackService.java |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 64b7761..30c80dc 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -70,6 +70,7 @@ import org.videolan.vlc.interfaces.IPlaybackServiceCallback;
 import org.videolan.vlc.util.Util;
 import org.videolan.vlc.util.VLCInstance;
 import org.videolan.vlc.util.WeakHandler;
+import org.videolan.vlc.widget.VLCAppWidgetProvider;
 
 import java.io.File;
 import java.net.URI;
@@ -103,9 +104,6 @@ public class PlaybackService extends Service {
     public static final String ACTION_WIDGET_UPDATE_COVER = "org.videolan.vlc.widget.UPDATE_COVER";
     public static final String ACTION_WIDGET_UPDATE_POSITION = "org.videolan.vlc.widget.UPDATE_POSITION";
 
-    public static final String WIDGET_PACKAGE = "org.videolan.vlc";
-    public static final String WIDGET_CLASS = "org.videolan.vlc.widget.VLCAppWidgetProvider";
-
     public static final int CURRENT_ITEM = 1;
     public static final int PREVIOUS_ITEM = 2;
     public static final int NEXT_ITEM = 3;
@@ -1051,8 +1049,7 @@ public class PlaybackService extends Service {
     }
 
     private void updateWidgetState(Context context) {
-        Intent i = new Intent();
-        i.setClassName(WIDGET_PACKAGE, WIDGET_CLASS);
+        Intent i = new Intent(this, VLCAppWidgetProvider.class);
         i.setAction(ACTION_WIDGET_UPDATE);
 
         if (hasCurrentMedia()) {
@@ -1071,10 +1068,9 @@ public class PlaybackService extends Service {
         sendBroadcast(i);
     }
 
-    private void updateWidgetCover(Context context)
-    {
-        Intent i = new Intent();
-        i.setClassName(WIDGET_PACKAGE, WIDGET_CLASS);
+    private void updateWidgetCover(Context context){
+        Log.d(TAG, "updateWidgetCover");
+        Intent i = new Intent(this, VLCAppWidgetProvider.class);
         i.setAction(ACTION_WIDGET_UPDATE_COVER);
 
         Bitmap cover = hasCurrentMedia() ? AudioUtil.getCover(this, getCurrentMedia(), 64) : null;
@@ -1094,8 +1090,7 @@ public class PlaybackService extends Service {
         updateWidgetState(context);
 
         mWidgetPositionTimestamp = timestamp;
-        Intent i = new Intent();
-        i.setClassName(WIDGET_PACKAGE, WIDGET_CLASS);
+        Intent i = new Intent(this, VLCAppWidgetProvider.class);
         i.setAction(ACTION_WIDGET_UPDATE_POSITION);
         i.putExtra("position", pos);
         sendBroadcast(i);



More information about the Android mailing list