diff options
author | William Seemann <seemann@AITSUL3SEEMANN.(none)> | 2013-04-08 11:29:27 -0500 |
---|---|---|
committer | William Seemann <seemann@AITSUL3SEEMANN.(none)> | 2013-04-08 11:29:27 -0500 |
commit | 09e37010c31dbf739a0937fa522c842628548c63 (patch) | |
tree | c63c175292e581e122344c6de501195683ced0b9 /src/de/danoeh/antennapod | |
parent | 09191d734e2eb7cfcd338057266ec150063287b6 (diff) | |
download | AntennaPod-09e37010c31dbf739a0937fa522c842628548c63.zip |
Issue #109 (feature request) - Display metadata on bluetooth devices that support AVRCP 1.3 and higher
Diffstat (limited to 'src/de/danoeh/antennapod')
-rw-r--r-- | src/de/danoeh/antennapod/service/PlaybackService.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java index 441a57baa..11da79015 100644 --- a/src/de/danoeh/antennapod/service/PlaybackService.java +++ b/src/de/danoeh/antennapod/service/PlaybackService.java @@ -73,7 +73,8 @@ public class PlaybackService extends Service { public static final String EXTRA_PREPARE_IMMEDIATELY = "extra.de.danoeh.antennapod.service.prepareImmediately"; public static final String ACTION_PLAYER_STATUS_CHANGED = "action.de.danoeh.antennapod.service.playerStatusChanged"; - + private static final String AVRCP_ACTION_PLAYER_STATUS_CHANGED= "com.android.music.playstatechanged"; + public static final String ACTION_PLAYER_NOTIFICATION = "action.de.danoeh.antennapod.service.playerNotification"; public static final String EXTRA_NOTIFICATION_CODE = "extra.de.danoeh.antennapod.service.notificationCode"; public static final String EXTRA_NOTIFICATION_TYPE = "extra.de.danoeh.antennapod.service.notificationType"; @@ -962,6 +963,7 @@ public class PlaybackService extends Service { sendBroadcast(new Intent(ACTION_PLAYER_STATUS_CHANGED)); updateWidget(); refreshRemoteControlClientState(); + bluetoothNotifyChange(); } /** Send ACTION_PLAYER_STATUS_CHANGED without changing the status attribute. */ @@ -1222,6 +1224,25 @@ public class PlaybackService extends Service { } } + private void bluetoothNotifyChange() { + boolean isPlaying = false; + + if (status == PlayerStatus.PLAYING) { + isPlaying = true; + } + + Intent i = new Intent(AVRCP_ACTION_PLAYER_STATUS_CHANGED); + i.putExtra("id", 1); + i.putExtra("artist", ""); + i.putExtra("album", media.getFeedTitle()); + i.putExtra("track", media.getEpisodeTitle()); + i.putExtra("playing", isPlaying); + i.putExtra("ListSize", manager.getQueueSize(false)); + i.putExtra("duration", media.getDuration()); + i.putExtra("position", media.getPosition()); + sendBroadcast(i); + } + /** * Pauses playback when the headset is disconnected and the preference is * set |