Merge pull request #6109 from ByteHamster/home-only-greater-zero
Tweak Queue section on home screen
This commit is contained in:
commit
504002c48f
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -828,6 +828,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
break;
|
||||
case PLAYING:
|
||||
PlaybackPreferences.writePlayerStatus(mediaPlayer.getPlayerStatus());
|
||||
saveCurrentPosition(true, null, INVALID_TIME);
|
||||
updateNotificationAndMediaSession(newInfo.playable);
|
||||
setupPositionObserver();
|
||||
stateManager.validStartCommandWasReceived();
|
||||
|
|
|
@ -1005,7 +1005,10 @@ public class PodDBAdapter {
|
|||
+ " INNER JOIN " + TABLE_NAME_FEED_ITEMS
|
||||
+ " ON " + SELECT_KEY_ITEM_ID + " = " + TABLE_NAME_QUEUE + "." + KEY_FEEDITEM
|
||||
+ JOIN_FEED_ITEM_AND_MEDIA
|
||||
+ " ORDER BY " + TABLE_NAME_FEED_MEDIA + "." + KEY_POSITION + ">0 DESC , "
|
||||
// In the front: Episodes that have a position >1sec, but also the episode that was just started
|
||||
+ " ORDER BY (" + TABLE_NAME_FEED_MEDIA + "." + KEY_POSITION + " >= 1000"
|
||||
+ " OR " + TABLE_NAME_FEED_MEDIA + "." + KEY_LAST_PLAYED_TIME
|
||||
+ " >= " + (System.currentTimeMillis() - 30000) + ") DESC , "
|
||||
+ TABLE_NAME_FEED_MEDIA + "." + KEY_LAST_PLAYED_TIME + " DESC , " + TABLE_NAME_QUEUE + "." + KEY_ID
|
||||
+ " LIMIT " + limit;
|
||||
return db.rawQuery(query, null);
|
||||
|
|
Loading…
Reference in New Issue