From bd3a37cf9967a816457e179b8e313985bee07181 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Mon, 4 Nov 2013 16:52:12 -0800 Subject: Remove JB specific code from ICS client --- .../dsub/util/compat/RemoteControlClientICS.java | 36 ++-------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java b/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java index 8707ecb5..14c6e0b4 100644 --- a/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java +++ b/src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java @@ -10,7 +10,6 @@ import android.content.Intent; import android.media.AudioManager; import android.media.MediaMetadataRetriever; import android.media.RemoteControlClient; -import android.os.Build; import github.daneren2005.dsub.activity.SubsonicActivity; import github.daneren2005.dsub.service.DownloadService; @@ -37,21 +36,6 @@ public class RemoteControlClientICS extends RemoteControlClientHelper { mRemoteControl.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED); mRemoteControl.setTransportControlFlags(getTransportFlags()); imageLoader = SubsonicActivity.getStaticImageLoader(context); - - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - mRemoteControl.setOnGetPlaybackPositionListener(new RemoteControlClient.OnGetPlaybackPositionListener() { - @Override - public long onGetPlaybackPosition() { - return downloadService.getPlayerPosition(); - } - }); - mRemoteControl.setPlaybackPositionUpdateListener(new RemoteControlClient.OnPlaybackPositionUpdateListener() { - @Override - public void onPlaybackPositionUpdate(long newPosition) { - downloadService.seekTo((int) newPosition); - } - }); - } } public void unregister(final Context context) { @@ -62,15 +46,7 @@ public class RemoteControlClientICS extends RemoteControlClientHelper { } public void setPlaybackState(final int state) { - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - long position = -1; - if(state == RemoteControlClient.PLAYSTATE_PLAYING || state == RemoteControlClient.PLAYSTATE_PAUSED) { - position = downloadService.getPlayerPosition(); - } - mRemoteControl.setPlaybackState(state, position, 1.0f); - } else { - mRemoteControl.setPlaybackState(state); - } + mRemoteControl.setPlaybackState(state); } public void updateMetadata(final Context context, final MusicDirectory.Entry currentSong) { @@ -99,19 +75,13 @@ public class RemoteControlClientICS extends RemoteControlClientHelper { } } - private int getTransportFlags() { - int flags = RemoteControlClient.FLAG_KEY_MEDIA_PLAY | + protected int getTransportFlags() { + return RemoteControlClient.FLAG_KEY_MEDIA_PLAY | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE | RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS | RemoteControlClient.FLAG_KEY_MEDIA_NEXT | RemoteControlClient.FLAG_KEY_MEDIA_STOP; - - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - flags = flags | RemoteControlClient.FLAG_KEY_MEDIA_POSITION_UPDATE; - } - - return flags; } } -- cgit v1.2.3