Merge pull request #3894 from ByteHamster/no-media-items

Fixed items without media showing video icon
This commit is contained in:
H. Lehmann 2020-03-01 00:04:23 +01:00 committed by GitHub
commit d360ab2925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -119,6 +119,10 @@ public class EpisodeItemViewHolder extends FeedComponentViewHolder
bind(item.getMedia()); bind(item.getMedia());
} else { } else {
secondaryActionProgress.setPercentage(0, item); secondaryActionProgress.setPercentage(0, item);
isVideo.setVisibility(View.GONE);
progressBar.setVisibility(View.GONE);
duration.setVisibility(View.GONE);
position.setVisibility(View.GONE);
} }
if (coverHolder.getVisibility() == View.VISIBLE) { if (coverHolder.getVisibility() == View.VISIBLE) {
@ -133,6 +137,7 @@ public class EpisodeItemViewHolder extends FeedComponentViewHolder
private void bind(FeedMedia media) { private void bind(FeedMedia media) {
isVideo.setVisibility(media.getMediaType() == MediaType.VIDEO ? View.VISIBLE : View.GONE); isVideo.setVisibility(media.getMediaType() == MediaType.VIDEO ? View.VISIBLE : View.GONE);
duration.setVisibility(media.getDuration() > 0 ? View.VISIBLE : View.GONE);
duration.setText(Converter.getDurationStringLong(media.getDuration())); duration.setText(Converter.getDurationStringLong(media.getDuration()));
if (media.isCurrentlyPlaying()) { if (media.isCurrentlyPlaying()) {
@ -151,12 +156,10 @@ public class EpisodeItemViewHolder extends FeedComponentViewHolder
secondaryActionProgress.setPercentage(0, item); // Animate X% -> 0% secondaryActionProgress.setPercentage(0, item); // Animate X% -> 0%
} }
if (media.getDuration() > 0 if (item.getState() == FeedItem.State.PLAYING || item.getState() == FeedItem.State.IN_PROGRESS) {
&& (item.getState() == FeedItem.State.PLAYING || item.getState() == FeedItem.State.IN_PROGRESS)) {
int progress = (int) (100.0 * media.getPosition() / media.getDuration()); int progress = (int) (100.0 * media.getPosition() / media.getDuration());
progressBar.setProgress(progress); progressBar.setProgress(progress);
position.setText(Converter.getDurationStringLong(media.getPosition())); position.setText(Converter.getDurationStringLong(media.getPosition()));
duration.setText(Converter.getDurationStringLong(media.getDuration()));
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
position.setVisibility(View.VISIBLE); position.setVisibility(View.VISIBLE);
} else { } else {