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;
}

View file

@ -6,21 +6,9 @@
android:foreground="?attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingEnd="24dp"
android:paddingHorizontal="24dp"
android:paddingBottom="3dp">
<ImageView
android:id="@+id/queue_song_play_image_view"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center"
android:layout_margin="4dp"
android:src="@drawable/ic_play"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/queue_song_cover_image_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/queue_song_cover_image_view" />
<ImageView
android:id="@+id/queue_song_cover_image_view"
android:layout_width="52dp"
@ -28,7 +16,7 @@
android:layout_gravity="center"
android:layout_margin="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/queue_song_play_image_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView