clean: cleaned up the podcast listening UI

This commit is contained in:
antonio 2023-10-12 22:36:48 +02:00
parent 0cc45b2b12
commit c20cadff94
4 changed files with 33 additions and 19 deletions

View file

@ -37,6 +37,7 @@ import com.google.android.material.elevation.SurfaceColors;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.Objects;
import java.util.stream.IntStream;
@OptIn(markerClass = UnstableApi.class)
@ -164,6 +165,9 @@ public class PlayerBottomSheetFragment extends Fragment {
.from(requireContext(), mediaMetadata.extras.getString("coverArtId"), CustomGlideRequest.ResourceType.Song)
.build()
.into(bind.playerHeaderLayout.playerHeaderMediaCoverImage);
bind.playerHeaderLayout.playerHeaderMediaTitleLabel.setVisibility(mediaMetadata.extras.getString("title") != null && !Objects.equals(mediaMetadata.extras.getString("title"), "") ? View.VISIBLE : View.GONE);
bind.playerHeaderLayout.playerHeaderMediaArtistLabel.setVisibility(mediaMetadata.extras.getString("artist") != null && !Objects.equals(mediaMetadata.extras.getString("artist"), "") ? View.VISIBLE : View.GONE);
}
}

View file

@ -40,6 +40,8 @@ import com.google.android.material.elevation.SurfaceColors;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.Objects;
@UnstableApi
public class PlayerControllerFragment extends Fragment {
private static final String TAG = "PlayerCoverFragment";
@ -164,6 +166,9 @@ public class PlayerControllerFragment extends Fragment {
playerMediaTitleLabel.setSelected(true);
playerArtistNameLabel.setSelected(true);
playerMediaTitleLabel.setVisibility(mediaMetadata.title != null && !Objects.equals(mediaMetadata.title, "") ? View.VISIBLE : View.GONE);
playerArtistNameLabel.setVisibility(mediaMetadata.artist != null && !Objects.equals(mediaMetadata.artist, "") ? View.VISIBLE : View.GONE);
}
private void setMediaInfo(MediaMetadata mediaMetadata) {
@ -201,6 +206,7 @@ public class PlayerControllerFragment extends Fragment {
bind.getRoot().setRepeatToggleModes(RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE);
bind.getRoot().findViewById(R.id.player_playback_speed_button).setVisibility(View.VISIBLE);
bind.getRoot().findViewById(R.id.player_skip_silence_toggle_button).setVisibility(View.VISIBLE);
bind.getRoot().findViewById(R.id.button_favorite).setVisibility(View.GONE);
setPlaybackParameters(mediaBrowser);
break;
case Constants.MEDIA_TYPE_RADIO:
@ -212,6 +218,7 @@ public class PlayerControllerFragment extends Fragment {
bind.getRoot().setRepeatToggleModes(RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE);
bind.getRoot().findViewById(R.id.player_playback_speed_button).setVisibility(View.GONE);
bind.getRoot().findViewById(R.id.player_skip_silence_toggle_button).setVisibility(View.GONE);
bind.getRoot().findViewById(R.id.button_favorite).setVisibility(View.GONE);
setPlaybackParameters(mediaBrowser);
break;
case Constants.MEDIA_TYPE_MUSIC:
@ -224,6 +231,7 @@ public class PlayerControllerFragment extends Fragment {
bind.getRoot().setRepeatToggleModes(RepeatModeUtil.REPEAT_TOGGLE_MODE_ALL | RepeatModeUtil.REPEAT_TOGGLE_MODE_ONE);
bind.getRoot().findViewById(R.id.player_playback_speed_button).setVisibility(View.GONE);
bind.getRoot().findViewById(R.id.player_skip_silence_toggle_button).setVisibility(View.GONE);
bind.getRoot().findViewById(R.id.button_favorite).setVisibility(View.VISIBLE);
resetPlaybackParameters(mediaBrowser);
break;
}

View file

@ -82,7 +82,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="12dp"
android:layout_marginEnd="24dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/label_placeholder"
@ -90,6 +90,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guideline" />
<TextView
android:id="@+id/player_artist_name_label"
style="@style/TitleMedium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/label_placeholder"
app:layout_constraintEnd_toStartOf="@+id/button_favorite"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player_media_title_label" />
<ToggleButton
android:id="@+id/button_favorite"
android:layout_width="26dp"
@ -104,20 +118,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/player_media_title_label" />
<TextView
android:id="@+id/player_artist_name_label"
style="@style/TitleMedium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="12dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="@string/label_placeholder"
app:layout_constraintEnd_toStartOf="@+id/button_favorite"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player_media_title_label" />
<TextView
android:id="@+id/exo_position"
android:layout_width="wrap_content"
@ -136,7 +136,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
app:bar_height="2dp"
app:buffered_color="?attr/colorOnSecondaryContainer"

View file

@ -21,14 +21,15 @@
style="@style/LabelMedium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="8dp"
android:paddingEnd="8dp"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintEnd_toStartOf="@+id/placeholder_left_view"
app:layout_constraintStart_toEndOf="@+id/player_header_media_cover_image"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="@+id/player_header_media_cover_image"
app:layout_constraintBottom_toTopOf="@+id/player_header_media_artist_label"/>
<TextView
android:id="@+id/player_header_media_artist_label"
@ -41,7 +42,8 @@
android:paddingEnd="8dp"
app:layout_constraintEnd_toStartOf="@+id/placeholder_left_view"
app:layout_constraintStart_toEndOf="@+id/player_header_media_cover_image"
app:layout_constraintTop_toBottomOf="@+id/player_header_media_title_label" />
app:layout_constraintTop_toBottomOf="@+id/player_header_media_title_label"
app:layout_constraintBottom_toBottomOf="@+id/player_header_media_cover_image"/>
<View
android:id="@+id/placeholder_left_view"