Commit 41043f41 authored by Geoffrey Métais's avatar Geoffrey Métais

Widget loads last playlist if service is stopped

parent 0c911397
......@@ -391,6 +391,7 @@
<receiver android:name=".RemoteControlClientReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
<action android:name="org.videolan.vlc.remote.PlayPause" />
</intent-filter>
</receiver>
</application>
......
......@@ -123,6 +123,10 @@ public class RemoteControlClientReceiver extends BroadcastReceiver {
abortBroadcast();
if(i != null)
context.sendBroadcast(i);
} else if (action.equals(AudioService.ACTION_REMOTE_PLAYPAUSE)){
intent = new Intent(context, AudioService.class);
intent.setAction(AudioService.ACTION_REMOTE_PLAYPAUSE);
context.startService(intent);
}
}
}
......@@ -205,7 +205,6 @@ public class AudioService extends Service {
}
}
/**
* Set up the remote control and tell the system we want to be the default receiver for the MEDIA buttons
* @see http://android-developers.blogspot.fr/2010/06/allowing-applications-to-play-nicer.html
......@@ -267,6 +266,11 @@ public class AudioService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent == null)
return START_STICKY;
if(ACTION_REMOTE_PLAYPAUSE.equals(intent.getAction())){
if (hasCurrentMedia())
return START_STICKY;
else loadLastPlaylist();
}
updateWidget(this);
return super.onStartCommand(intent, flags, startId);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment