mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
feat: Mark currently playing song in PlayerSongQueueAdapter
This commit is contained in:
parent
52ba783a90
commit
d810010090
3 changed files with 38 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ import com.cappielloantonio.tempo.databinding.ItemPlayerQueueSongBinding;
|
||||||
import com.cappielloantonio.tempo.glide.CustomGlideRequest;
|
import com.cappielloantonio.tempo.glide.CustomGlideRequest;
|
||||||
import com.cappielloantonio.tempo.interfaces.ClickCallback;
|
import com.cappielloantonio.tempo.interfaces.ClickCallback;
|
||||||
import com.cappielloantonio.tempo.interfaces.MediaIndexCallback;
|
import com.cappielloantonio.tempo.interfaces.MediaIndexCallback;
|
||||||
|
import com.cappielloantonio.tempo.interfaces.MediaSongIdCallback;
|
||||||
import com.cappielloantonio.tempo.service.MediaManager;
|
import com.cappielloantonio.tempo.service.MediaManager;
|
||||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||||
import com.cappielloantonio.tempo.util.Constants;
|
import com.cappielloantonio.tempo.util.Constants;
|
||||||
|
|
@ -86,6 +87,19 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
MediaManager.getCurrentSongId(mediaBrowserListenableFuture, new MediaSongIdCallback() {
|
||||||
|
@Override
|
||||||
|
public void onRecovery(String id) {
|
||||||
|
if (song.getId().equals(id)) {
|
||||||
|
holder.item.playPauseIcon.setVisibility(View.VISIBLE);
|
||||||
|
holder.item.coverArtOverlay.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
holder.item.playPauseIcon.setVisibility(View.INVISIBLE);
|
||||||
|
holder.item.coverArtOverlay.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (Preferences.showItemRating()) {
|
if (Preferences.showItemRating()) {
|
||||||
if (song.getStarred() == null && song.getUserRating() == null) {
|
if (song.getStarred() == null && song.getUserRating() == null) {
|
||||||
holder.item.ratingIndicatorImageView.setVisibility(View.GONE);
|
holder.item.ratingIndicatorImageView.setVisibility(View.GONE);
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
||||||
|
|
||||||
playerSongQueueAdapter = new PlayerSongQueueAdapter(this);
|
playerSongQueueAdapter = new PlayerSongQueueAdapter(this);
|
||||||
bind.playerQueueRecyclerView.setAdapter(playerSongQueueAdapter);
|
bind.playerQueueRecyclerView.setAdapter(playerSongQueueAdapter);
|
||||||
|
setMediaBrowserListenableFuture();
|
||||||
playerBottomSheetViewModel.getQueueSong().observe(getViewLifecycleOwner(), queue -> {
|
playerBottomSheetViewModel.getQueueSong().observe(getViewLifecycleOwner(), queue -> {
|
||||||
if (queue != null) {
|
if (queue != null) {
|
||||||
playerSongQueueAdapter.setItems(queue.stream().map(item -> (Child) item).collect(Collectors.toList()));
|
playerSongQueueAdapter.setItems(queue.stream().map(item -> (Child) item).collect(Collectors.toList()));
|
||||||
|
|
@ -215,5 +216,6 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
||||||
@Override
|
@Override
|
||||||
public void onMediaClick(Bundle bundle) {
|
public void onMediaClick(Bundle bundle) {
|
||||||
MediaManager.startQueue(mediaBrowserListenableFuture, bundle.getParcelableArrayList(Constants.TRACKS_OBJECT), bundle.getInt(Constants.ITEM_POSITION));
|
MediaManager.startQueue(mediaBrowserListenableFuture, bundle.getParcelableArrayList(Constants.TRACKS_OBJECT), bundle.getInt(Constants.ITEM_POSITION));
|
||||||
|
updateNowPlayingItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,6 +20,28 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/cover_art_overlay"
|
||||||
|
android:layout_width="52dp"
|
||||||
|
android:layout_height="52dp"
|
||||||
|
android:layout_marginStart="2dp"
|
||||||
|
android:background="#80000000"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/play_pause_icon"
|
||||||
|
android:layout_width="28dp"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:layout_marginStart="14dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:src="@drawable/button_play_pause_selector" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/queue_song_title_text_view"
|
android:id="@+id/queue_song_title_text_view"
|
||||||
style="@style/LabelMedium"
|
style="@style/LabelMedium"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue