Search in sources :

Example 1 with CoverLoader

use of de.danoeh.antennapod.adapter.CoverLoader in project AntennaPod by AntennaPod.

the class EpisodeItemViewHolder method bind.

public void bind(FeedItem item) {
    this.item = item;
    placeholder.setText(item.getFeed().getTitle());
    title.setText(item.getTitle());
    leftPadding.setContentDescription(item.getTitle());
    pubDate.setText(DateFormatter.formatAbbrev(activity, item.getPubDate()));
    pubDate.setContentDescription(DateFormatter.formatForAccessibility(activity, item.getPubDate()));
    isNew.setVisibility(item.isNew() ? View.VISIBLE : View.GONE);
    isFavorite.setVisibility(item.isTagged(FeedItem.TAG_FAVORITE) ? View.VISIBLE : View.GONE);
    isInQueue.setVisibility(item.isTagged(FeedItem.TAG_QUEUE) ? View.VISIBLE : View.GONE);
    container.setAlpha(item.isPlayed() ? 0.5f : 1.0f);
    ItemActionButton actionButton = ItemActionButton.forItem(item);
    actionButton.configure(secondaryActionButton, secondaryActionIcon, activity);
    secondaryActionButton.setFocusable(false);
    if (item.getMedia() != null) {
        bind(item.getMedia());
    } else {
        secondaryActionProgress.setPercentage(0, item);
        isVideo.setVisibility(View.GONE);
        progressBar.setVisibility(View.GONE);
        duration.setVisibility(View.GONE);
        position.setVisibility(View.GONE);
        itemView.setBackgroundResource(ThemeUtils.getDrawableFromAttr(activity, R.attr.selectableItemBackground));
    }
    if (coverHolder.getVisibility() == View.VISIBLE) {
        new CoverLoader(activity).withUri(ImageResourceUtils.getEpisodeListImageLocation(item)).withFallbackUri(item.getFeed().getImageUrl()).withPlaceholderView(placeholder).withCoverView(cover).load();
    }
}
Also used : ItemActionButton(de.danoeh.antennapod.adapter.actionbutton.ItemActionButton) CoverLoader(de.danoeh.antennapod.adapter.CoverLoader)

Aggregations

CoverLoader (de.danoeh.antennapod.adapter.CoverLoader)1 ItemActionButton (de.danoeh.antennapod.adapter.actionbutton.ItemActionButton)1