Add play button to AlbumDetailFragment
Add a play button to AlbumDetailFragment that shows the option to play the album, or pause/resume the playback if the album is already playing.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="@color/background">
|
||||
<group
|
||||
android:pivotX="12"
|
||||
android:pivotY="12"
|
||||
android:rotation="-90">
|
||||
|
||||
<path
|
||||
android:name="pause_upper"
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M6,7.5L6,10.5L18,10.5L18,7.5Z" />
|
||||
|
||||
<path
|
||||
android:name="pause_lower"
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M6,16.5L6,13.5L18,13.5L18,16.5Z" />
|
||||
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="@color/background">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M8.25,6L8.25,12L18.75,12L18.75,12ZM8.25,18L8.25,12L18.75,12L18.75,12Z" />
|
||||
</vector>
|
||||
@@ -6,13 +6,17 @@
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="album"
|
||||
type="org.oxycblt.auxio.music.Album" />
|
||||
|
||||
<variable
|
||||
name="detailModel"
|
||||
type="org.oxycblt.auxio.detail.DetailViewModel" />
|
||||
|
||||
<variable
|
||||
name="playbackModel"
|
||||
type="org.oxycblt.auxio.playback.PlaybackViewModel" />
|
||||
|
||||
<variable
|
||||
name="album"
|
||||
type="org.oxycblt.auxio.music.Album" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
@@ -98,6 +102,23 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_artist"
|
||||
tools:text="2020 / 10 Songs / 16:16" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/album_play"
|
||||
style="@style/Widget.AppCompat.Button.Borderless"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/margin_tiny"
|
||||
android:layout_marginEnd="@dimen/margin_medium"
|
||||
android:background="@drawable/ui_circular_button"
|
||||
android:backgroundTint="?android:attr/colorPrimary"
|
||||
android:contentDescription="@string/description_play"
|
||||
android:src="@drawable/ic_play"
|
||||
android:onClick="@{() -> playbackModel.play(album, false)}"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/album_details"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/album_artist" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/album_song_header"
|
||||
android:layout_width="match_parent"
|
||||
@@ -121,15 +142,15 @@
|
||||
android:layout_marginTop="@dimen/margin_medium"
|
||||
android:background="@drawable/ui_header_dividers"
|
||||
android:contentDescription="@string/description_sort_button"
|
||||
android:onClick="@{() -> detailModel.incrementAlbumSortMode()}"
|
||||
android:paddingStart="@dimen/padding_medium"
|
||||
android:paddingTop="@dimen/padding_small"
|
||||
android:paddingEnd="@dimen/margin_medium"
|
||||
android:paddingBottom="@dimen/padding_small"
|
||||
android:onClick="@{() -> detailModel.incrementAlbumSortMode()}"
|
||||
tools:src="@drawable/ic_sort_numeric_down"
|
||||
app:layout_constraintBottom_toTopOf="@+id/album_song_recycler"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_details" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_details"
|
||||
tools:src="@drawable/ic_sort_numeric_down" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/album_song_recycler"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<dimen name="padding_huge">64dp</dimen>
|
||||
|
||||
<!-- Margin namespace | Dimens for margin attributes -->
|
||||
<dimen name="margin_tiny">4dp</dimen>
|
||||
<dimen name="margin_small">8dp</dimen>
|
||||
<dimen name="margin_mid_small">10dp</dimen>
|
||||
<dimen name="margin_medium">16dp</dimen>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</style>
|
||||
|
||||
<style name="Toolbar.Style" parent="ThemeOverlay.MaterialComponents.ActionBar">
|
||||
<item name="android:searchViewStyle">@style/Toolbar.SearchViewStyle</item>
|
||||
<item name="android:searchViewStyle">@style/Widget.AppCompat.SearchView</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Toolbar.Header" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
|
||||
@@ -19,8 +19,6 @@
|
||||
<item name="android:textColor">?android:attr/colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="Toolbar.SearchViewStyle" parent="Widget.AppCompat.SearchView" />
|
||||
|
||||
<style name="DetailHeader">
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
|
||||
<item name="android:textColor">?android:attr/colorPrimary</item>
|
||||
|
||||
Reference in New Issue
Block a user