Merge pull request #3550 from ByteHamster/remove-resume-intent
Removed resume intent
This commit is contained in:
commit
385bd3597b
@ -12,7 +12,6 @@ import de.danoeh.antennapod.core.util.IntentUtils;
|
|||||||
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
|
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
|
||||||
|
|
||||||
import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE;
|
import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE;
|
||||||
import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_RESUME_PLAY_CURRENT_EPISODE;
|
|
||||||
|
|
||||||
class PlayActionButton extends ItemActionButton {
|
class PlayActionButton extends ItemActionButton {
|
||||||
|
|
||||||
@ -52,12 +51,14 @@ class PlayActionButton extends ItemActionButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void togglePlayPause(Context context, FeedMedia media) {
|
private void togglePlayPause(Context context, FeedMedia media) {
|
||||||
new PlaybackServiceStarter(context, media)
|
if (media.isCurrentlyPlaying()) {
|
||||||
.startWhenPrepared(true)
|
IntentUtils.sendLocalBroadcast(context, ACTION_PAUSE_PLAY_CURRENT_EPISODE);
|
||||||
.shouldStream(false)
|
} else {
|
||||||
.start();
|
new PlaybackServiceStarter(context, media)
|
||||||
|
.callEvenIfRunning(true)
|
||||||
String pauseOrResume = media.isCurrentlyPlaying() ? ACTION_PAUSE_PLAY_CURRENT_EPISODE : ACTION_RESUME_PLAY_CURRENT_EPISODE;
|
.startWhenPrepared(true)
|
||||||
IntentUtils.sendLocalBroadcast(context, pauseOrResume);
|
.shouldStream(false)
|
||||||
|
.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import de.danoeh.antennapod.core.util.IntentUtils;
|
|||||||
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
|
import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter;
|
||||||
|
|
||||||
import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE;
|
import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_PAUSE_PLAY_CURRENT_EPISODE;
|
||||||
import static de.danoeh.antennapod.core.service.playback.PlaybackService.ACTION_RESUME_PLAY_CURRENT_EPISODE;
|
|
||||||
|
|
||||||
public class StreamActionButton extends ItemActionButton {
|
public class StreamActionButton extends ItemActionButton {
|
||||||
|
|
||||||
@ -52,13 +51,14 @@ public class StreamActionButton extends ItemActionButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void togglePlayPause(Context context, FeedMedia media) {
|
private void togglePlayPause(Context context, FeedMedia media) {
|
||||||
new PlaybackServiceStarter(context, media)
|
if (media.isCurrentlyPlaying()) {
|
||||||
.startWhenPrepared(true)
|
IntentUtils.sendLocalBroadcast(context, ACTION_PAUSE_PLAY_CURRENT_EPISODE);
|
||||||
.shouldStream(true)
|
} else {
|
||||||
.start();
|
new PlaybackServiceStarter(context, media)
|
||||||
|
.callEvenIfRunning(true)
|
||||||
String pauseOrResume = media.isCurrentlyPlaying()
|
.startWhenPrepared(true)
|
||||||
? ACTION_PAUSE_PLAY_CURRENT_EPISODE : ACTION_RESUME_PLAY_CURRENT_EPISODE;
|
.shouldStream(true)
|
||||||
IntentUtils.sendLocalBroadcast(context, pauseOrResume);
|
.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,12 +136,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
*/
|
*/
|
||||||
public static final String ACTION_PAUSE_PLAY_CURRENT_EPISODE = "action.de.danoeh.antennapod.core.service.pausePlayCurrentEpisode";
|
public static final String ACTION_PAUSE_PLAY_CURRENT_EPISODE = "action.de.danoeh.antennapod.core.service.pausePlayCurrentEpisode";
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the PlaybackService receives this action, it will resume playback.
|
|
||||||
*/
|
|
||||||
public static final String ACTION_RESUME_PLAY_CURRENT_EPISODE = "action.de.danoeh.antennapod.core.service.resumePlayCurrentEpisode";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom action used by Android Wear
|
* Custom action used by Android Wear
|
||||||
*/
|
*/
|
||||||
@ -283,7 +277,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
registerReceiver(audioBecomingNoisy, new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY));
|
registerReceiver(audioBecomingNoisy, new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY));
|
||||||
registerReceiver(skipCurrentEpisodeReceiver, new IntentFilter(ACTION_SKIP_CURRENT_EPISODE));
|
registerReceiver(skipCurrentEpisodeReceiver, new IntentFilter(ACTION_SKIP_CURRENT_EPISODE));
|
||||||
registerReceiver(pausePlayCurrentEpisodeReceiver, new IntentFilter(ACTION_PAUSE_PLAY_CURRENT_EPISODE));
|
registerReceiver(pausePlayCurrentEpisodeReceiver, new IntentFilter(ACTION_PAUSE_PLAY_CURRENT_EPISODE));
|
||||||
registerReceiver(pauseResumeCurrentEpisodeReceiver, new IntentFilter(ACTION_RESUME_PLAY_CURRENT_EPISODE));
|
|
||||||
taskManager = new PlaybackServiceTaskManager(this, taskManagerCallback);
|
taskManager = new PlaybackServiceTaskManager(this, taskManagerCallback);
|
||||||
|
|
||||||
flavorHelper = new PlaybackServiceFlavorHelper(PlaybackService.this, flavorHelperCallback);
|
flavorHelper = new PlaybackServiceFlavorHelper(PlaybackService.this, flavorHelperCallback);
|
||||||
@ -349,7 +342,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
unregisterReceiver(audioBecomingNoisy);
|
unregisterReceiver(audioBecomingNoisy);
|
||||||
unregisterReceiver(skipCurrentEpisodeReceiver);
|
unregisterReceiver(skipCurrentEpisodeReceiver);
|
||||||
unregisterReceiver(pausePlayCurrentEpisodeReceiver);
|
unregisterReceiver(pausePlayCurrentEpisodeReceiver);
|
||||||
unregisterReceiver(pauseResumeCurrentEpisodeReceiver);
|
|
||||||
flavorHelper.removeCastConsumer();
|
flavorHelper.removeCastConsumer();
|
||||||
flavorHelper.unregisterWifiBroadcastReceiver();
|
flavorHelper.unregisterWifiBroadcastReceiver();
|
||||||
mediaPlayer.shutdown();
|
mediaPlayer.shutdown();
|
||||||
@ -1431,16 +1423,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final BroadcastReceiver pauseResumeCurrentEpisodeReceiver = new BroadcastReceiver() {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (TextUtils.equals(intent.getAction(), ACTION_RESUME_PLAY_CURRENT_EPISODE)) {
|
|
||||||
Log.d(TAG, "Received RESUME_PLAY_CURRENT_EPISODE intent");
|
|
||||||
mediaPlayer.resume();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private final BroadcastReceiver pausePlayCurrentEpisodeReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver pausePlayCurrentEpisodeReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user