Пример #1
0
  @Override
  public SectionAdapter getAdapter(List<Serializable> channels) {
    if (newestEpisodes == null || newestEpisodes.getChildrenSize() == 0) {
      return new PodcastChannelAdapter(
          context, channels, hasCoverArt ? getImageLoader() : null, this, largeAlbums);
    } else {
      List<String> headers =
          Arrays.asList(PodcastChannelAdapter.EPISODE_HEADER, PodcastChannelAdapter.CHANNEL_HEADER);

      List<MusicDirectory.Entry> episodes = newestEpisodes.getChildren(false, true);
      List<Serializable> serializableEpisodes = new ArrayList<>();

      // Put 3 in current list
      while (serializableEpisodes.size() < 3 && !episodes.isEmpty()) {
        serializableEpisodes.add(episodes.remove(0));
      }

      // Put rest in extra set
      List<Serializable> extraEpisodes = new ArrayList<>();
      extraEpisodes.addAll(episodes);

      List<List<Serializable>> sections = new ArrayList<>();
      sections.add(serializableEpisodes);
      sections.add(channels);

      return new PodcastChannelAdapter(
          context,
          headers,
          sections,
          extraEpisodes,
          ServerInfo.checkServerVersion(context, "1.13") ? getImageLoader() : null,
          this,
          largeAlbums);
    }
  }
Пример #2
0
  @Override
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    hasCoverArt = ServerInfo.checkServerVersion(context, "1.13") || Util.isOffline(context);
    if (Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_LARGE_ALBUM_ART, true)
        && hasCoverArt) {
      largeAlbums = true;
    }

    if (bundle != null && serialize) {
      newestEpisodes = (MusicDirectory) bundle.getSerializable(Constants.FRAGMENT_LIST2);
    }
  }