playback: rework view implementations

Rework the playback views to follow the new idioms I want to use for
Auxio.

This change mostly consists of flattening away some of the custom
views, removing databinding, and using a general viewbinding
fragment that I hope to extend to the entire app.
This commit is contained in:
OxygenCobalt
2022-03-21 20:15:42 -06:00
parent e4d4266e35
commit 8f38ed6ee5
18 changed files with 394 additions and 360 deletions
@@ -4,22 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".playback.PlaybackPanelFragment">
<data>
<variable
name="song"
type="org.oxycblt.auxio.music.Song" />
<variable
name="playbackModel"
type="org.oxycblt.auxio.playback.PlaybackViewModel" />
<variable
name="detailModel"
type="org.oxycblt.auxio.detail.DetailViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/playback_layout"
android:layout_width="match_parent"
@@ -38,8 +22,6 @@
android:id="@+id/playback_cover"
style="@style/Widget.Auxio.Image.Full"
android:layout_margin="@dimen/spacing_large"
android:contentDescription="@{@string/desc_album_cover(song.resolvedName)}"
app:albumArt="@{song}"
app:layout_constraintBottom_toTopOf="@+id/playback_song"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -53,8 +35,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:onClick="@{() -> detailModel.navToItem(playbackModel.song)}"
android:text="@{song.resolvedName}"
app:layout_constraintBottom_toTopOf="@+id/playback_artist"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -68,8 +48,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:onClick="@{() -> detailModel.navToItem(playbackModel.song.album.artist)}"
android:text="@{song.resolvedArtistName}"
app:layout_constraintBottom_toTopOf="@+id/playback_album"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -82,22 +60,52 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:onClick="@{() -> detailModel.navToItem(playbackModel.song.album)}"
android:text="@{song.resolvedAlbumName}"
app:layout_constraintBottom_toTopOf="@+id/playback_seek_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="Album Name" />
<org.oxycblt.auxio.playback.PlaybackSeekBar
<com.google.android.material.slider.Slider
android:id="@+id/playback_seek_bar"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:valueFrom="0"
android:valueTo="1"
app:haloRadius="@dimen/slider_halo_radius"
app:labelBehavior="gone"
app:labelStyle="@style/TextAppearance.Auxio.BodySmall"
android:layout_marginBottom="@dimen/spacing_medium"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_medium"
app:layout_constraintBottom_toTopOf="@+id/playback_play_pause"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:thumbRadius="@dimen/slider_thumb_radius" />
<TextView
android:id="@+id/playback_seconds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginTop="@dimen/spacing_small_inv"
android:textAppearance="@style/TextAppearance.Auxio.BodyMedium"
android:textColor="@color/sel_accented_secondary"
app:layout_constraintStart_toStartOf="@+id/playback_seek_bar"
app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar"
tools:text="11:38" />
<TextView
android:id="@+id/playback_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_medium"
android:layout_marginTop="@dimen/spacing_small_inv"
android:textAppearance="@style/TextAppearance.Auxio.BodyMedium"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintEnd_toEndOf="@+id/playback_seek_bar"
app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar"
tools:text="16:16" />
<org.oxycblt.auxio.playback.PlaybackButton
android:id="@+id/playback_loop"
@@ -105,7 +113,6 @@
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_large"
android:contentDescription="@string/desc_change_loop"
android:onClick="@{() -> playbackModel.incrementLoopStatus()}"
android:src="@drawable/ic_loop"
app:hasIndicator="true"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_prev"
@@ -119,7 +126,6 @@
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_large"
android:contentDescription="@string/desc_skip_prev"
android:onClick="@{() -> playbackModel.skipPrev()}"
android:src="@drawable/ic_skip_prev"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
@@ -132,7 +138,6 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_large"
android:contentDescription="@string/desc_play_pause"
android:onClick="@{() -> playbackModel.invertPlayingStatus()}"
android:src="@drawable/sel_playing_state"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/playback_seek_bar"
@@ -145,7 +150,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:contentDescription="@string/desc_skip_next"
android:onClick="@{() -> playbackModel.skipNext()}"
android:src="@drawable/ic_skip_next"
app:layout_constraintBottom_toBottomOf="@+id/playback_play_pause"
app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
@@ -157,7 +161,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:contentDescription="@string/desc_shuffle"
android:onClick="@{() -> playbackModel.invertShuffleStatus()}"
android:src="@drawable/ic_shuffle"
app:hasIndicator="true"
app:layout_constraintBottom_toBottomOf="@+id/playback_skip_next"