Пример #1
0
  private void displayPodcastInfo(final PodcastChannel channel) {
    List<Integer> headers = new ArrayList<>();
    List<String> details = new ArrayList<>();

    if (channel.getName() != null) {
      headers.add(R.string.details_title);
      details.add(channel.getName());
    }

    headers.add(R.string.details_url);
    details.add(channel.getUrl());
    headers.add(R.string.details_status);
    details.add(channel.getStatus());

    if (channel.getErrorMessage() != null) {
      headers.add(R.string.details_error);
      details.add(channel.getErrorMessage());
    }
    if (channel.getDescription() != null) {
      headers.add(R.string.details_description);
      details.add(channel.getDescription());
    }

    Util.showDetailsDialog(context, R.string.details_title_podcast, headers, details);
  }
Пример #2
0
  @Override
  public void onItemClicked(UpdateView<Serializable> updateView, Serializable item) {
    if (item instanceof PodcastChannel) {
      PodcastChannel channel = (PodcastChannel) item;
      if ("error".equals(channel.getStatus())) {
        Util.toast(
            context,
            context
                .getResources()
                .getString(
                    R.string.select_podcasts_invalid_podcast_channel,
                    channel.getErrorMessage() == null ? "error" : channel.getErrorMessage()));
      } else if ("downloading".equals(channel.getStatus())) {
        Util.toast(context, R.string.select_podcasts_initializing);
      } else {
        SubsonicFragment fragment = new SelectDirectoryFragment();
        Bundle args = new Bundle();
        args.putString(Constants.INTENT_EXTRA_NAME_PODCAST_ID, channel.getId());
        args.putString(Constants.INTENT_EXTRA_NAME_PODCAST_NAME, channel.getName());
        args.putString(Constants.INTENT_EXTRA_NAME_PODCAST_DESCRIPTION, channel.getDescription());
        fragment.setArguments(args);

        replaceFragment(fragment);
      }
    } else {
      PodcastEpisode episode = (PodcastEpisode) item;

      String status = episode.getStatus();
      if ("error".equals(status)) {
        Util.toast(context, R.string.select_podcasts_error);
        return;
      } else if (!"completed".equals(status)) {
        Util.toast(context, R.string.select_podcasts_skipped);
        return;
      }

      playNow(Arrays.asList((MusicDirectory.Entry) episode));
    }
  }