summaryrefslogtreecommitdiff
path: root/src/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/de')
-rw-r--r--src/de/danoeh/antennapod/activity/MediaplayerActivity.java29
-rw-r--r--src/de/danoeh/antennapod/service/PlaybackService.java16
2 files changed, 40 insertions, 5 deletions
diff --git a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
index c55b06855..771450cbf 100644
--- a/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/MediaplayerActivity.java
@@ -90,13 +90,25 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
protected OnClickListener playbuttonListener = new OnClickListener() {
@Override
public void onClick(View v) {
- if (status == PlayerStatus.PLAYING) {
- playbackService.pause(true);
- } else if (status == PlayerStatus.PAUSED
- || status == PlayerStatus.PREPARED) {
- playbackService.play();
+ if (playbackService != null) {
+ switch (status) {
+ case PLAYING:
+ playbackService.pause(true);
+ break;
+ case PAUSED:
+ case PREPARED:
+ playbackService.play();
+ break;
+ case PREPARING:
+ playbackService.setStartWhenPrepared(!playbackService
+ .isStartWhenPrepared());
+ }
+ } else {
+ Log.w(TAG,
+ "Play/Pause button was pressed, but playbackservice was null!");
}
}
+
};
protected ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
@@ -410,6 +422,13 @@ public abstract class MediaplayerActivity extends SherlockFragmentActivity
case PREPARING:
postStatusMsg(R.string.player_preparing_msg);
loadMediaInfo();
+ if (playbackService != null) {
+ if (playbackService.isStartWhenPrepared()) {
+ butPlay.setImageResource(R.drawable.av_pause);
+ } else {
+ butPlay.setImageResource(R.drawable.av_play);
+ }
+ }
break;
case STOPPED:
postStatusMsg(R.string.player_stopped_msg);
diff --git a/src/de/danoeh/antennapod/service/PlaybackService.java b/src/de/danoeh/antennapod/service/PlaybackService.java
index a83e0e2d6..b278012e5 100644
--- a/src/de/danoeh/antennapod/service/PlaybackService.java
+++ b/src/de/danoeh/antennapod/service/PlaybackService.java
@@ -658,6 +658,11 @@ public class PlaybackService extends Service {
updateWidget();
refreshRemoteControlClientState();
}
+
+ /** Send ACTION_PLAYER_STATUS_CHANGED without changing the status attribute. */
+ private void postStatusUpdateIntent() {
+ setStatus(status);
+ }
private void sendNotificationBroadcast(int type, int code) {
Intent intent = new Intent(ACTION_PLAYER_NOTIFICATION);
@@ -992,4 +997,15 @@ public class PlaybackService extends Service {
return player;
}
+ public boolean isStartWhenPrepared() {
+ return startWhenPrepared;
+ }
+
+ public void setStartWhenPrepared(boolean startWhenPrepared) {
+ this.startWhenPrepared = startWhenPrepared;
+ postStatusUpdateIntent();
+ }
+
+
+
}