Add DetailFragment for genres

Add a DetailFragment for genres.
This commit is contained in:
OxygenCobalt
2020-09-27 09:47:53 -06:00
parent 21626d8d74
commit 9ffc194c4d
16 changed files with 497 additions and 16 deletions
@@ -71,7 +71,7 @@
tools:text="Artist Name" />
<TextView
android:id="@+id/artist_genre"
android:id="@+id/genre_counts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
@@ -83,7 +83,7 @@
tools:text="Genre Name" />
<TextView
android:id="@+id/artist_counts"
android:id="@+id/song_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
@@ -91,7 +91,7 @@
android:layout_marginStart="@dimen/margin_medium"
app:artistCounts="@{artist}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_genre"
app:layout_constraintTop_toBottomOf="@+id/genre_counts"
tools:text="2 Albums, 20 Songs" />
<TextView
@@ -109,7 +109,7 @@
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_counts" />
app:layout_constraintTop_toBottomOf="@+id/song_count" />
<ImageButton
android:id="@+id/sort_button"
@@ -126,7 +126,7 @@
tools:src="@drawable/ic_sort_numeric_down"
app:layout_constraintBottom_toTopOf="@+id/album_recycler"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_counts" />
app:layout_constraintTop_toBottomOf="@+id/song_count" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/album_recycler"
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="genre"
type="org.oxycblt.auxio.music.models.Genre" />
<variable
name="detailModel"
type="org.oxycblt.auxio.detail.DetailViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/windowBackground"
android:elevation="@dimen/elevation_normal"
app:titleTextAppearance="@style/TextAppearance.Toolbar.Bold"
app:navigationIcon="@drawable/ic_back"
app:title="@string/title_library_fragment" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical">
<ImageView
android:id="@+id/artist_image"
android:layout_width="@dimen/cover_size_huge"
android:layout_height="@dimen/cover_size_huge"
android:layout_marginTop="@dimen/margin_medium"
android:contentDescription="@{@string/description_genre_image(genre.name)}"
app:genreImage="@{genre}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_genre" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/artist_name"
style="@style/DetailHeader"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_medium"
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
android:text="@{genre.name}"
app:autoSizeMaxTextSize="@dimen/detail_header_size_max"
app:autoSizeMinTextSize="@dimen/generic_size_min"
app:autoSizeStepGranularity="@dimen/generic_size_increment"
app:autoSizeTextType="uniform"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_image"
tools:text="Genre Name" />
<TextView
android:id="@+id/genre_counts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorSecondary"
android:layout_marginStart="@dimen/margin_medium"
app:genreCounts="@{genre}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/artist_name"
tools:text="2 Artists, 4 Ablums" />
<TextView
android:id="@+id/song_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorSecondary"
android:layout_marginStart="@dimen/margin_medium"
android:text="@{@plurals/format_song_count(genre.numSongs, genre.numSongs)}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/genre_counts"
tools:text="80 Songs" />
<TextView
android:id="@+id/header_title"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_medium"
android:background="@drawable/header_dividers"
android:fontFamily="@font/inter_bold"
android:paddingStart="@dimen/padding_medium"
android:paddingTop="@dimen/padding_small"
android:paddingEnd="@dimen/padding_small"
android:paddingBottom="@dimen/padding_small"
android:text="@string/label_artists"
android:textAppearance="@style/TextAppearance.MaterialComponents.Overline"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/song_count" />
<ImageButton
android:id="@+id/sort_button"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="@dimen/margin_medium"
android:background="@drawable/header_dividers"
android:contentDescription="@string/description_sort_button"
android:paddingStart="@dimen/padding_medium"
android:paddingTop="@dimen/padding_small"
android:paddingEnd="@dimen/margin_medium"
android:paddingBottom="@dimen/padding_small"
android:onClick="@{() -> detailModel.incrementGenreSortMode()}"
tools:src="@drawable/ic_sort_numeric_down"
app:layout_constraintBottom_toTopOf="@+id/album_recycler"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/song_count" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/album_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header_title"
tools:itemCount="4"
tools:listitem="@layout/item_genre_artist" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</layout>
@@ -20,8 +20,8 @@
<ImageView
android:id="@+id/cover"
android:layout_width="@dimen/cover_size_normal"
android:layout_height="@dimen/cover_size_normal"
android:layout_width="@dimen/cover_size_large"
android:layout_height="@dimen/cover_size_large"
android:contentDescription="@{@string/description_album_cover(album.name)}"
app:coverArt="@{album}"
app:layout_constraintBottom_toBottomOf="parent"
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="artist"
type="org.oxycblt.auxio.music.models.Artist" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/padding_medium">
<ImageView
android:id="@+id/artist_image"
android:layout_width="@dimen/cover_size_large"
android:layout_height="@dimen/cover_size_large"
android:contentDescription="@{@string/description_artist_image(artist.name)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:artistImage="@{artist}"
tools:src="@drawable/ic_artist" />
<TextView
android:id="@+id/artist_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@{artist.name}"
android:layout_marginStart="@dimen/margin_medium"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toTopOf="@+id/album_song_count"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Artist Name" />
<TextView
android:id="@+id/album_song_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:layout_marginStart="@dimen/margin_medium"
android:textColor="?android:attr/textColorSecondary"
android:text="@{@plurals/format_album_count(artist.numAlbums, artist.numAlbums)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/artist_image"
app:layout_constraintTop_toBottomOf="@+id/artist_name"
tools:text="2 Albums" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
+26
View File
@@ -35,7 +35,18 @@
app:launchSingleTop="true" />
<action
android:id="@+id/action_show_album"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:destination="@id/album_detail_fragment" />
<action
android:id="@+id/action_show_genre"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:destination="@id/genreDetailFragment" />
</fragment>
<fragment
android:id="@+id/artist_detail_fragment"
@@ -69,4 +80,19 @@
app:popExitAnim="@anim/fragment_fade_exit"
app:destination="@id/artist_detail_fragment" />
</fragment>
<fragment
android:id="@+id/genreDetailFragment"
android:name="org.oxycblt.auxio.detail.GenreDetailFragment"
android:label="GenreDetailFragment" >
<action
android:id="@+id/action_show_artist"
app:enterAnim="@anim/fragment_fade_enter"
app:exitAnim="@anim/fragment_fade_exit"
app:popEnterAnim="@anim/fragment_fade_enter"
app:popExitAnim="@anim/fragment_fade_exit"
app:destination="@id/artist_detail_fragment" />
<argument
android:name="genreId"
app:argType="long" />
</fragment>
</navigation>
+1
View File
@@ -11,6 +11,7 @@
<string name="label_retry">Retry</string>
<string name="label_grant">Grant</string>
<string name="label_artists">Artists</string>
<string name="label_albums">Albums</string>
<string name="label_songs">Songs</string>