[Android] [PATCH] Widget loads last playlist if service is stopped
Jean-Baptiste Kempf
jb at videolan.org
Tue Oct 14 18:58:14 CEST 2014
LGTM
On 14 Oct, Geoffrey Métais wrote :
> ---
> vlc-android/AndroidManifest.xml | 1 +
> .../src/org/videolan/vlc/RemoteControlClientReceiver.java | 4 ++++
> vlc-android/src/org/videolan/vlc/audio/AudioService.java | 9 ++++++++-
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/vlc-android/AndroidManifest.xml b/vlc-android/AndroidManifest.xml
> index da51abb..350180c 100644
> --- a/vlc-android/AndroidManifest.xml
> +++ b/vlc-android/AndroidManifest.xml
> @@ -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>
> diff --git a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
> index 6c389ca..fe43fd9 100644
> --- a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
> +++ b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
> @@ -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);
> }
> }
> }
> diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
> index 6da9fc0..4a32dfc 100644
> --- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
> +++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
> @@ -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,12 @@ 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);
> }
> @@ -381,6 +386,8 @@ public class AudioService extends Service {
> pause();
> else if (!mLibVLC.isPlaying() && hasCurrentMedia())
> play();
> + else
> + loadLastPlaylist();
> } else if (action.equalsIgnoreCase(ACTION_REMOTE_PLAY)) {
> if (!mLibVLC.isPlaying() && hasCurrentMedia())
> play();
> --
> 1.9.1
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the Android
mailing list