aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-11-04 16:52:12 -0800
committerdaneren2005 <daneren2005@gmail.com>2013-11-04 16:52:12 -0800
commitbd3a37cf9967a816457e179b8e313985bee07181 (patch)
tree267c8c6688ac6edfdf27f8deeefe8d65999b1b6d
parent99142c7c2a3984015238db0f9ac52af51f9f7769 (diff)
downloaddsub-bd3a37cf9967a816457e179b8e313985bee07181.tar.gz
dsub-bd3a37cf9967a816457e179b8e313985bee07181.tar.bz2
dsub-bd3a37cf9967a816457e179b8e313985bee07181.zip
Remove JB specific code from ICS client
-rw-r--r--src/github/daneren2005/dsub/util/compat/RemoteControlClientICS.java36
1 files changed, 3 insertions, 33 deletions
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;
}
}