use of de.danoeh.antennapod.adapter.actionbutton.PauseActionButton in project AntennaPod by AntennaPod.
the class ItemFragment method updateButtons.
private void updateButtons() {
progbarDownload.setVisibility(View.GONE);
if (item.hasMedia() && downloaderList != null) {
for (Downloader downloader : downloaderList) {
if (downloader.getDownloadRequest().getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA && downloader.getDownloadRequest().getFeedfileId() == item.getMedia().getId()) {
progbarDownload.setVisibility(View.VISIBLE);
progbarDownload.setProgress(downloader.getDownloadRequest().getProgressPercent());
}
}
}
FeedMedia media = item.getMedia();
if (media == null) {
actionButton1 = new MarkAsPlayedActionButton(item);
actionButton2 = new VisitWebsiteActionButton(item);
noMediaLabel.setVisibility(View.VISIBLE);
} else {
noMediaLabel.setVisibility(View.GONE);
if (media.getDuration() > 0) {
txtvDuration.setText(Converter.getDurationStringLong(media.getDuration()));
txtvDuration.setContentDescription(Converter.getDurationStringLocalized(getContext(), media.getDuration()));
}
if (FeedItemUtil.isCurrentlyPlaying(media)) {
actionButton1 = new PauseActionButton(item);
} else if (item.getFeed().isLocalFeed()) {
actionButton1 = new PlayLocalActionButton(item);
} else if (media.isDownloaded()) {
actionButton1 = new PlayActionButton(item);
} else {
actionButton1 = new StreamActionButton(item);
}
if (DownloadService.isDownloadingFile(media.getDownload_url())) {
actionButton2 = new CancelDownloadActionButton(item);
} else if (!media.isDownloaded()) {
actionButton2 = new DownloadActionButton(item);
} else {
actionButton2 = new DeleteActionButton(item);
}
}
butAction1Text.setText(actionButton1.getLabel());
butAction1Text.setTransformationMethod(null);
butAction1Icon.setImageResource(actionButton1.getDrawable());
butAction1.setVisibility(actionButton1.getVisibility());
butAction2Text.setText(actionButton2.getLabel());
butAction2Text.setTransformationMethod(null);
butAction2Icon.setImageResource(actionButton2.getDrawable());
butAction2.setVisibility(actionButton2.getVisibility());
}
Aggregations