detail: fix issues on small form factors

This commit is contained in:
Alexander Capehart 2024-07-20 16:28:36 -06:00
parent 106194fa52
commit af1ec40dbe
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
8 changed files with 266 additions and 62 deletions

View file

@ -137,10 +137,10 @@ class AlbumDetailFragment : DetailFragment<Album, Song>() {
text = context.getString(R.string.fmt_three, date, songCount, duration)
}
binding.detailPlayButton.setOnClickListener {
binding.detailPlayButton?.setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentAlbum.value))
}
binding.detailShuffleButton.setOnClickListener {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentAlbum.value))
}
}

View file

@ -149,22 +149,22 @@ class ArtistDetailFragment : DetailFragment<Artist, Music>() {
// In the case that this header used to he configured to have no songs,
// we want to reset the visibility of all information that was hidden.
binding.detailPlayButton.isVisible = true
binding.detailShuffleButton.isVisible = true
binding.detailPlayButton?.isVisible = true
binding.detailShuffleButton?.isVisible = true
} else {
// The artist does not have any songs, so hide functionality that makes no sense.
// ex. Play and Shuffle, Song Counts, and Genre Information.
// Artists are always guaranteed to have albums however, so continue to show those.
logD("Artist is empty, disabling genres and playback")
binding.detailSubhead.isVisible = false
binding.detailPlayButton.isEnabled = false
binding.detailShuffleButton.isEnabled = false
binding.detailPlayButton?.isEnabled = false
binding.detailShuffleButton?.isEnabled = false
}
binding.detailPlayButton.setOnClickListener {
binding.detailPlayButton?.setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentArtist.value))
}
binding.detailShuffleButton.setOnClickListener {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentArtist.value))
}
}

View file

@ -129,10 +129,10 @@ class GenreDetailFragment : DetailFragment<Genre, Music>() {
R.string.fmt_two,
context.getPlural(R.plurals.fmt_artist_count, genre.artists.size),
context.getPlural(R.plurals.fmt_song_count, genre.songs.size))
binding.detailPlayButton.setOnClickListener {
binding.detailPlayButton?.setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentGenre.value))
}
binding.detailShuffleButton.setOnClickListener {
binding.detailShuffleButton?.setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentGenre.value))
}
}

View file

@ -225,13 +225,13 @@ class PlaylistDetailFragment :
logD("Playlist is being edited or is empty, disabling playback options")
}
binding.detailPlayButton.apply {
binding.detailPlayButton?.apply {
isEnabled = playable
setOnClickListener {
playbackModel.play(unlikelyToBeNull(detailModel.currentPlaylist.value))
}
}
binding.detailShuffleButton.apply {
binding.detailShuffleButton?.apply {
isEnabled = playable
setOnClickListener {
playbackModel.shuffle(unlikelyToBeNull(detailModel.currentPlaylist.value))

View file

@ -18,6 +18,8 @@
android:id="@+id/detail_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:expandedTitleMargin="0dp"
app:forceApplySystemWindowInsetTop="false"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleEnabled="false"
app:toolbarId="@+id/detail_toolbar">
@ -25,12 +27,11 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/detail_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingStart="@dimen/spacing_medium"
android:paddingTop="86dp"
android:paddingTop="?attr/actionBarSize"
android:paddingEnd="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_mid_medium"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.85">
@ -39,6 +40,7 @@
style="@style/Widget.Auxio.Image.Large"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
android:layout_marginTop="@dimen/spacing_medium"
app:layout_constraintBottom_toTopOf="@+id/detail_play_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -108,6 +110,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_mid_medium"
android:layout_marginEnd="@dimen/spacing_small"
android:layout_marginBottom="@dimen/spacing_mid_medium"
android:text="@string/lbl_play"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/detail_shuffle_button"

View file

@ -25,9 +25,9 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/detail_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/spacing_medium"
android:paddingTop="86dp"
android:paddingTop="?attr/actionBarSize"
android:paddingEnd="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_mid_medium"
app:layout_collapseMode="parallax"
@ -39,6 +39,7 @@
style="@style/Widget.Auxio.Image.Huge"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
android:layout_marginTop="@dimen/spacing_medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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"
android:id="@+id/detail_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface"
android:transitionGroup="true">
<org.oxycblt.auxio.ui.CoordinatorAppBarLayout
android:id="@+id/detail_appbar"
style="@style/Widget.Auxio.AppBarLayout"
app:liftOnScroll="true"
app:liftOnScrollTargetViewId="@id/detail_recycler">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/detail_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:expandedTitleMargin="0dp"
app:forceApplySystemWindowInsetTop="false"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleEnabled="false"
app:toolbarId="@+id/detail_toolbar">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/detail_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingStart="@dimen/spacing_medium"
android:paddingTop="?attr/actionBarSize"
android:paddingEnd="@dimen/spacing_medium"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.85">
<org.oxycblt.auxio.image.CoverView
android:id="@+id/detail_cover"
style="@style/Widget.Auxio.Image.Large"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
android:layout_marginTop="@dimen/spacing_medium"
app:layout_constraintBottom_toTopOf="@+id/detail_play_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/detail_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:textAppearance="@style/TextAppearance.Auxio.LabelMedium"
android:textColor="?attr/colorSecondary"
app:layout_constraintBottom_toTopOf="@+id/detail_name"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toTopOf="@+id/detail_cover"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Type" />
<TextView
android:id="@+id/detail_name"
style="@style/Widget.Auxio.TextView.Detail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toTopOf="@+id/detail_subhead"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toBottomOf="@+id/detail_type"
tools:text="Name" />
<TextView
android:id="@+id/detail_subhead"
style="@style/Widget.Auxio.TextView.Secondary.Ellipsize"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:clickable="true"
android:focusable="true"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toTopOf="@+id/detail_info"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toBottomOf="@+id/detail_name"
tools:text="Info A" />
<TextView
android:id="@+id/detail_info"
style="@style/Widget.Auxio.TextView.Secondary.Base"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="@+id/detail_cover"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toBottomOf="@+id/detail_subhead"
tools:text="Info B" />
<org.oxycblt.auxio.ui.RippleFixMaterialButton
android:id="@+id/detail_play_button"
style="@style/Widget.Auxio.Button.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_mid_medium"
android:layout_marginEnd="@dimen/spacing_small"
android:layout_marginBottom="@dimen/spacing_mid_medium"
android:text="@string/lbl_play"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/detail_shuffle_button"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detail_cover" />
<org.oxycblt.auxio.ui.RippleFixMaterialButton
android:id="@+id/detail_shuffle_button"
style="@style/Widget.Auxio.Button.Primary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_small"
android:text="@string/lbl_shuffle"
app:layout_constraintBottom_toBottomOf="@+id/detail_play_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/detail_play_button"
app:layout_constraintTop_toTopOf="@+id/detail_play_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:layout_collapseMode="pin" />
<org.oxycblt.auxio.ui.MultiToolbar
android:id="@+id/detail_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/detail_normal_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
app:menu="@menu/toolbar_detail"
app:navigationIcon="@drawable/ic_back_24">
<LinearLayout
android:id="@+id/detail_toolbar_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/detail_toolbar_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_tiny"
android:textAppearance="@style/TextAppearance.Auxio.TitleLarge"
android:textColor="?attr/colorOnSurface"
tools:text="Name" />
</LinearLayout>
</com.google.android.material.appbar.MaterialToolbar>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/detail_selection_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
app:menu="@menu/toolbar_selection"
app:navigationIcon="@drawable/ic_close_24" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/detail_edit_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
app:menu="@menu/toolbar_edit"
app:navigationIcon="@drawable/ic_close_24" />
</org.oxycblt.auxio.ui.MultiToolbar>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</org.oxycblt.auxio.ui.CoordinatorAppBarLayout>
<org.oxycblt.auxio.list.recycler.AuxioRecyclerView
android:id="@+id/detail_recycler"
style="@style/Widget.Auxio.RecyclerView.Grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
tools:listitem="@layout/item_song" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -18,6 +18,8 @@
android:id="@+id/detail_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:expandedTitleMargin="0dp"
app:forceApplySystemWindowInsetTop="false"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleEnabled="false"
app:toolbarId="@+id/detail_toolbar">
@ -25,91 +27,83 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/detail_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/spacing_medium"
android:paddingTop="86dp"
android:paddingEnd="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_mid_medium"
app:layout_collapseMode="parallax"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingStart="@dimen/spacing_medium"
android:paddingTop="?attr/actionBarSize"
android:paddingEnd="@dimen/spacing_medium"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.85">
<org.oxycblt.auxio.image.CoverView
android:id="@+id/detail_cover"
style="@style/Widget.Auxio.Image.MidHuge"
style="@style/Widget.Auxio.Image.MidFull"
app:enablePlaybackIndicator="false"
app:enableSelectionBadge="false"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/spacing_medium"
android:layout_marginBottom="@dimen/spacing_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/detail_type"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_medium"
android:layout_marginStart="@dimen/spacing_medium"
android:textAppearance="@style/TextAppearance.Auxio.LabelMedium"
android:textColor="?attr/colorSecondary"
app:layout_constraintBottom_toTopOf="@+id/detail_name"
app:layout_constraintTop_toBottomOf="@+id/detail_cover"
tools:layout_editor_absoluteX="16dp"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toTopOf="@+id/detail_cover"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Type" />
<TextView
android:id="@+id/detail_name"
style="@style/Widget.Auxio.TextView.Detail"
android:layout_width="match_parent"
style="@style/Widget.Auxio.TextView.Primary.Compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:ellipsize="end"
android:maxLines="1"
app:layout_constraintBottom_toTopOf="@+id/detail_subhead"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toBottomOf="@+id/detail_type"
tools:text="Name" />
<TextView
android:id="@+id/detail_subhead"
style="@style/Widget.Auxio.TextView.Secondary.Ellipsize"
android:layout_width="match_parent"
style="@style/Widget.Auxio.TextView.Secondary.Compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:clickable="true"
android:focusable="true"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@+id/detail_info"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toBottomOf="@+id/detail_name"
tools:text="Info A" />
<TextView
android:id="@+id/detail_info"
style="@style/Widget.Auxio.TextView.Secondary.Ellipsize"
android:layout_width="match_parent"
style="@style/Widget.Auxio.TextView.Secondary.Compact"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/detail_cover"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/detail_cover"
app:layout_constraintTop_toBottomOf="@+id/detail_subhead"
tools:text="Info B" />
<org.oxycblt.auxio.ui.RippleFixMaterialButton
android:id="@+id/detail_play_button"
style="@style/Widget.Auxio.Button.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_mid_medium"
android:layout_marginEnd="@dimen/spacing_small"
android:text="@string/lbl_play"
app:layout_constraintEnd_toStartOf="@+id/detail_shuffle_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detail_info" />
<org.oxycblt.auxio.ui.RippleFixMaterialButton
android:id="@+id/detail_shuffle_button"
style="@style/Widget.Auxio.Button.Primary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_small"
android:text="@string/lbl_shuffle"
app:layout_constraintBottom_toBottomOf="@+id/detail_play_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/detail_play_button"
app:layout_constraintTop_toTopOf="@+id/detail_play_button" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.divider.MaterialDivider
@ -122,7 +116,7 @@
android:id="@+id/detail_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin" >
app:layout_collapseMode="pin">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/detail_normal_toolbar"