private void refreshPodcast() { if (_player == null) return; PlayerStatus status = PlayerStatus.getCurrentState(this); if (!status.hasActivePodcast()) { _player.stop(); return; } if (status.getPodcastId() != _currentPodcastId) { _currentPodcastId = status.getPodcastId(); if (!_player.prepare(status.getFilename(), status.getPosition())) { _player.stop(); String toastMessage = getResources().getString(R.string.cannot_play_podcast, status.getTitle()); Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show(); } else { QueueManager.changeActivePodcast(this, status.getPodcastId()); _lockscreenManager.setupLockscreenControls(this, status); showNotification(); } } else { _player.seekTo(status.getPosition()); } }
public static void play(Context context, long podcastId) { QueueManager.changeActivePodcast(context, podcastId); PlayerService.sendCommand(context, Constants.PLAYER_COMMAND_REFRESHPODCAST); }