diff options
author | ByteHamster <info@bytehamster.com> | 2022-09-30 17:46:13 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-10-04 19:48:47 +0200 |
commit | b0b95f0a05c216e8af62b21433658e2cc0c55441 (patch) | |
tree | 54068739d18f0f01a3b93eae030d517b75e9ceb9 /app | |
parent | b605901c52bffd7b274a0718840acd189b3717e4 (diff) | |
download | AntennaPod-b0b95f0a05c216e8af62b21433658e2cc0c55441.zip |
Reorder queue section when pressing play, not when pausing
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/ui/home/sections/QueueSection.java | 12 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/home/sections/QueueSection.java b/app/src/main/java/de/danoeh/antennapod/ui/home/sections/QueueSection.java index efff7927e..57fc85192 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/home/sections/QueueSection.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/home/sections/QueueSection.java @@ -113,14 +113,24 @@ public class QueueSection extends HomeSection { if (listAdapter == null) { return; } + boolean foundCurrentlyPlayingItem = false; + boolean currentlyPlayingItemIsFirst = true; for (int i = 0; i < listAdapter.getItemCount(); i++) { HorizontalItemViewHolder holder = (HorizontalItemViewHolder) viewBinding.recyclerView.findViewHolderForAdapterPosition(i); - if (holder != null && holder.isCurrentlyPlayingItem()) { + if (holder == null) { + continue; + } + if (holder.isCurrentlyPlayingItem()) { holder.notifyPlaybackPositionUpdated(event); + foundCurrentlyPlayingItem = true; + currentlyPlayingItemIsFirst = (i == 0); break; } } + if (!foundCurrentlyPlayingItem || !currentlyPlayingItemIsFirst) { + loadItems(); + } } @Override diff --git a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java index 9723417ce..f2d8e628c 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/view/viewholder/HorizontalItemViewHolder.java @@ -96,7 +96,7 @@ public class HorizontalItemViewHolder extends RecyclerView.ViewHolder { } public boolean isCurrentlyPlayingItem() { - return item.getMedia() != null && FeedItemUtil.isCurrentlyPlaying(item.getMedia()); + return item != null && item.getMedia() != null && FeedItemUtil.isCurrentlyPlaying(item.getMedia()); } public void notifyPlaybackPositionUpdated(PlaybackPositionEvent event) { |