Merge branch 'master' of git://github.com/wseemann/AntennaPod into wseemann-master

This commit is contained in:
daniel oeh 2013-04-11 10:56:58 +02:00
commit 565ff19510
1 changed files with 22 additions and 1 deletions

View File

@ -73,6 +73,7 @@ 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";
@ -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