Esempio n. 1
0
  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());
    }
  }
Esempio n. 2
0
 private void prepareNextPodcast() {
   PlayerStatus currentState = PlayerStatus.getCurrentState(this);
   if (!currentState.hasActivePodcast()) {
     _player.stop();
   } else {
     _player.prepare(currentState.getFilename(), currentState.getPosition());
     _currentPodcastId = currentState.getPodcastId();
   }
 }