mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
feat: Replace play/pause button with an icon, allow tapping on full item to play/pause song in Queue
This commit is contained in:
parent
2e29e9537a
commit
14939d20fd
2 changed files with 14 additions and 24 deletions
|
|
@ -112,7 +112,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
|||
} else {
|
||||
holder.item.ratingIndicatorImageView.setVisibility(View.GONE);
|
||||
}
|
||||
holder.item.playPauseButton.setOnClickListener(v -> {
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
mediaBrowserListenableFuture.addListener(() -> {
|
||||
try {
|
||||
MediaBrowser mediaBrowser = mediaBrowserListenableFuture.get();
|
||||
|
|
@ -138,23 +138,19 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
|||
}
|
||||
|
||||
private void bindPlaybackState(@NonNull PlayerSongQueueAdapter.ViewHolder holder, @NonNull Child song) {
|
||||
boolean isCurrent = currentPlayingId != null && currentPlayingId.equals(song.getId()) && isPlaying;
|
||||
boolean isCurrent = currentPlayingId != null && currentPlayingId.equals(song.getId());
|
||||
|
||||
if (isCurrent) {
|
||||
holder.item.playPauseButton.setVisibility(View.VISIBLE);
|
||||
holder.item.playPauseButton.setChecked(true);
|
||||
holder.item.coverArtOverlay.setVisibility(View.VISIBLE);
|
||||
holder.item.playPauseIcon.setVisibility(View.VISIBLE);
|
||||
if (isPlaying) {
|
||||
holder.item.playPauseIcon.setImageResource(R.drawable.ic_pause);
|
||||
} else {
|
||||
boolean sameIdPaused = currentPlayingId != null && currentPlayingId.equals(song.getId()) && !isPlaying;
|
||||
if (sameIdPaused) {
|
||||
holder.item.playPauseButton.setVisibility(View.VISIBLE);
|
||||
holder.item.playPauseButton.setChecked(false);
|
||||
holder.item.coverArtOverlay.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.item.playPauseButton.setVisibility(View.GONE);
|
||||
holder.item.playPauseButton.setChecked(false);
|
||||
holder.item.coverArtOverlay.setVisibility(View.INVISIBLE);
|
||||
holder.item.playPauseIcon.setImageResource(R.drawable.ic_play);
|
||||
}
|
||||
holder.item.coverArtOverlay.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.item.playPauseIcon.setVisibility(View.GONE);
|
||||
holder.item.coverArtOverlay.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,18 +31,12 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/play_pause_button"
|
||||
<ImageView
|
||||
android:id="@+id/play_pause_icon"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginStart="14dp"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/button_play_pause_selector"
|
||||
android:checked="false"
|
||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:text=""
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="14dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue