Queued songs that have already been played now have different graphics

This commit is contained in:
antonio 2023-03-14 12:06:19 +01:00
parent a130fb38cc
commit 632c1cd2c0
2 changed files with 24 additions and 21 deletions

View file

@ -2,7 +2,6 @@ package com.cappielloantonio.play.ui.adapter;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
@ -59,15 +58,13 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
.into(holder.item.queueSongCoverImageView);
MediaManager.getCurrentIndex(mediaBrowserListenableFuture, index -> {
holder.item.queueSongPlayImageView.setVisibility(position == index ? View.VISIBLE : View.INVISIBLE);
if (position < index) {
holder.item.queueSongTitleTextView.setAlpha(0.2f);
holder.item.queueSongSubtitleTextView.setAlpha(0.2f);
}
});
}
@Override
public int getItemCount() {
return songs.size();
}
public List<Child> getItems() {
return this.songs;
}
@ -77,6 +74,24 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
notifyDataSetChanged();
}
@Override
public int getItemCount() {
if (songs == null) {
return 0;
}
return songs.size();
}
@Override
public int getItemViewType(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
public void setMediaBrowserListenableFuture(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture) {
this.mediaBrowserListenableFuture = mediaBrowserListenableFuture;
}