all: move menus to more button [#93]

Move all menu functionality from long-click to a menu button.

This is in preparation for #93, as I need to free up the long-click
for a selection option. The spacing isn't really consistent at all,
but that's because I wanted to make something that looks right
depending on the context.
This commit is contained in:
OxygenCobalt 2022-08-11 15:13:05 -06:00
parent fc94bb1369
commit 2c5a1a0567
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
17 changed files with 143 additions and 104 deletions

View file

@ -3,9 +3,11 @@
## dev
#### What's Improved
- Playback bar now has a marquee effect
- Added a way to access the system equalizer from the playback menu.
#### What's Changed
- Menus are now opened using a new button to the side of all items
- ReplayGain can now no longer be disabled. Remove ReplayGain tags from
files if such functionality is not desired.

View file

@ -209,13 +209,8 @@ private class AlbumSongViewHolder private constructor(private val binding: ItemA
binding.songName.text = item.resolveName(binding.context)
binding.songDuration.text = item.durationSecs.formatDuration(false)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.songMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {

View file

@ -168,14 +168,8 @@ private constructor(
binding.parentImage.bind(item)
binding.parentName.text = item.resolveName(binding.context)
binding.parentInfo.text = item.date.resolveYear(binding.context)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.parentMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {
@ -204,14 +198,8 @@ private constructor(
binding.songAlbumCover.bind(item)
binding.songName.text = item.resolveName(binding.context)
binding.songInfo.text = item.album.resolveName(binding.context)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.songMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {

View file

@ -139,13 +139,8 @@ class GenreSongViewHolder private constructor(private val binding: ItemSongBindi
binding.songAlbumCover.bind(item)
binding.songName.text = item.resolveName(binding.context)
binding.songInfo.text = item.resolveIndividualArtistName(binding.context)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.songMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {

View file

@ -89,11 +89,6 @@ class TabViewHolder private constructor(private val binding: ItemTabBinding) :
true
} else false
}
binding.root.setOnLongClickListener {
listener.onPickUpTab(this)
true
}
}
companion object {

View file

@ -61,6 +61,8 @@ class PlaybackBarFragment : ViewBindingFragment<FragmentPlaybackBarBinding>() {
}
}
binding.playbackSong.isSelected = true
// Load the track color in manually as it's unclear whether the track actually supports
// using a ColorStateList in the resources
binding.playbackProgressBar.trackColor =
@ -105,6 +107,11 @@ class PlaybackBarFragment : ViewBindingFragment<FragmentPlaybackBarBinding>() {
collectImmediately(playbackModel.positionSecs, ::updatePosition)
}
override fun onDestroyBinding(binding: FragmentPlaybackBarBinding) {
super.onDestroyBinding(binding)
binding.playbackSong.isSelected = false
}
private fun updateSong(song: Song?) {
if (song != null) {
val context = requireContext()

View file

@ -92,7 +92,7 @@ class PlaybackPanelFragment :
playbackModel.song.value?.let { navModel.exploreNavigateTo(it.album) }
}
binding.playbackSongMenu?.setOnClickListener { view ->
binding.playbackSongMenu.setOnClickListener { view ->
playbackModel.song.value?.let { song ->
musicMenu(view, R.menu.menu_playback_song_actions, song)
}

View file

@ -41,13 +41,8 @@ class SongViewHolder private constructor(private val binding: ItemSongBinding) :
binding.songAlbumCover.bind(item)
binding.songName.text = item.resolveName(binding.context)
binding.songInfo.text = item.resolveIndividualArtistName(binding.context)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.songMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {
@ -82,13 +77,8 @@ private constructor(
binding.parentImage.bind(item)
binding.parentName.text = item.resolveName(binding.context)
binding.parentInfo.text = item.artist.resolveName(binding.context)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.parentMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {
@ -126,13 +116,8 @@ class ArtistViewHolder private constructor(private val binding: ItemParentBindin
R.string.fmt_two,
binding.context.getPlural(R.plurals.fmt_album_count, item.albums.size),
binding.context.getPlural(R.plurals.fmt_song_count, item.songs.size))
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.parentMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {
@ -169,13 +154,8 @@ private constructor(
binding.parentName.text = item.resolveName(binding.context)
binding.parentInfo.text =
binding.context.getPlural(R.plurals.fmt_song_count, item.songs.size)
binding.root.apply {
setOnClickListener { listener.onItemClick(item) }
setOnLongClickListener { view ->
listener.onOpenMenu(item, view)
true
}
}
binding.parentMenu.setOnClickListener { listener.onOpenMenu(item, it) }
binding.root.setOnClickListener { listener.onItemClick(item) }
}
companion object {

View file

@ -68,13 +68,12 @@
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/ic_more_24"
android:layout_marginEnd="@dimen/spacing_mid_medium"
app:icon="@drawable/ic_more_24"
app:layout_constraintBottom_toBottomOf="@+id/playback_album"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/playback_song" />
<org.oxycblt.auxio.playback.StyledSeekBar
android:id="@+id/playback_seek_bar"
android:layout_width="match_parent"

View file

@ -19,7 +19,7 @@
<org.oxycblt.auxio.image.StyledImageView
android:id="@+id/playback_cover"
style="@style/Widget.Auxio.Image.Full"
android:layout_margin="@dimen/spacing_large"
android:layout_margin="@dimen/spacing_medium"
app:layout_constraintBottom_toTopOf="@+id/playback_song"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -31,10 +31,10 @@
style="@style/Widget.Auxio.TextView.Primary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_mid_medium"
app:layout_constraintBottom_toTopOf="@+id/playback_artist"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/playback_song_menu"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Song Name" />
@ -44,10 +44,10 @@
style="@style/Widget.Auxio.TextView.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_mid_medium"
app:layout_constraintBottom_toTopOf="@+id/playback_album"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/playback_song_menu"
app:layout_constraintStart_toStartOf="parent"
tools:text="Artist Name" />
@ -56,13 +56,24 @@
style="@style/Widget.Auxio.TextView.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_mid_medium"
app:layout_constraintBottom_toTopOf="@+id/playback_seek_bar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/playback_song_menu"
app:layout_constraintStart_toStartOf="parent"
tools:text="Album Name" />
<Button
android:id="@+id/playback_song_menu"
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
app:icon="@drawable/ic_more_24"
app:layout_constraintBottom_toBottomOf="@+id/playback_album"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/playback_song" />
<org.oxycblt.auxio.playback.StyledSeekBar
android:id="@+id/playback_seek_bar"
android:layout_width="match_parent"
@ -80,7 +91,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_medium"
android:layout_marginBottom="@dimen/spacing_large"
android:layout_marginBottom="@dimen/spacing_medium"
app:layout_constraintBottom_toBottomOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout

View file

@ -27,6 +27,17 @@
app:layout_constraintVertical_chainStyle="packed"
tools:staticIcon="@drawable/ic_song_24" />
<Button
android:id="@+id/playback_song_menu"
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
app:icon="@drawable/ic_more_24"
app:layout_constraintBottom_toBottomOf="@+id/playback_album"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/playback_song_container" />
<!-- TextView is wrapped in a container so that marquee doesn't break -->
<FrameLayout
@ -34,9 +45,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_mid_medium"
app:layout_constraintBottom_toTopOf="@+id/playback_artist"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/playback_song_menu"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/playback_cover"
app:layout_constraintTop_toTopOf="@+id/playback_cover"
@ -56,10 +67,10 @@
style="@style/Widget.Auxio.TextView.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_medium"
app:layout_constraintBottom_toTopOf="@+id/playback_album"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/playback_song_menu"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/playback_cover"
app:layout_constraintTop_toBottomOf="@+id/playback_song_container"
@ -70,10 +81,10 @@
style="@style/Widget.Auxio.TextView.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginEnd="@dimen/spacing_medium"
app:layout_constraintBottom_toBottomOf="@+id/playback_cover"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/playback_song_menu"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/playback_cover"
app:layout_constraintTop_toBottomOf="@+id/playback_artist"

View file

@ -3,7 +3,13 @@
<androidx.constraintlayout.widget.ConstraintLayout 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"
style="@style/Widget.Auxio.ItemLayout">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_medium"
android:paddingEnd="@dimen/spacing_small"
android:paddingStart="@dimen/spacing_medium">
<!--
We don't want to show an album cover, but we still want the spacing of this song
@ -48,8 +54,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/sel_accented_primary"
android:layout_marginEnd="@dimen/spacing_small"
app:layout_constraintBottom_toTopOf="@+id/song_duration"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/song_menu"
app:layout_constraintStart_toEndOf="@+id/song_track_bg"
app:layout_constraintTop_toTopOf="@+id/song_track_bg"
app:layout_constraintVertical_chainStyle="packed"
@ -60,11 +67,22 @@
style="@style/Widget.Auxio.TextView.Item.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_small"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="@+id/song_track_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/song_menu"
app:layout_constraintStart_toEndOf="@+id/song_track_bg"
app:layout_constraintTop_toBottomOf="@+id/song_name"
tools:text="16:16" />
<Button
android:id="@+id/song_menu"
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/ic_more_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -2,7 +2,13 @@
<androidx.constraintlayout.widget.ConstraintLayout 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"
style="@style/Widget.Auxio.ItemLayout">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_medium"
android:paddingEnd="@dimen/spacing_small"
android:paddingStart="@dimen/spacing_medium">
<org.oxycblt.auxio.image.ImageGroup
android:id="@+id/parent_image"
@ -10,7 +16,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:staticIcon="@drawable/ic_artist" />
tools:staticIcon="@drawable/ic_artist_24" />
<TextView
android:id="@+id/parent_name"
@ -18,8 +24,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/sel_accented_primary"
android:layout_marginEnd="@dimen/spacing_small"
app:layout_constraintBottom_toTopOf="@+id/parent_info"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/parent_menu"
app:layout_constraintStart_toEndOf="@+id/parent_image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
@ -30,9 +37,21 @@
style="@style/Widget.Auxio.TextView.Item.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/parent_menu"
app:layout_constraintStart_toEndOf="@+id/parent_image"
app:layout_constraintTop_toBottomOf="@+id/parent_name"
tools:text="Info" />
<Button
android:id="@+id/parent_menu"
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/ic_more_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -61,7 +61,7 @@
style="@style/Widget.Auxio.TextView.Item.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
android:layout_marginEnd="@dimen/spacing_small"
android:textColor="@color/sel_toggleable_secondary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/song_drag_handle"
@ -74,7 +74,7 @@
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
android:layout_marginEnd="@dimen/spacing_small"
android:contentDescription="@string/desc_queue_handle"
app:icon="@drawable/ic_handle_24"
app:layout_constraintBottom_toBottomOf="@+id/song_album_cover"

View file

@ -2,7 +2,13 @@
<androidx.constraintlayout.widget.ConstraintLayout 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"
style="@style/Widget.Auxio.ItemLayout">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/spacing_medium"
android:paddingBottom="@dimen/spacing_medium"
android:paddingEnd="@dimen/spacing_small"
android:paddingStart="@dimen/spacing_medium">
<org.oxycblt.auxio.image.ImageGroup
android:id="@+id/song_album_cover"
@ -18,8 +24,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/sel_accented_primary"
android:layout_marginEnd="@dimen/spacing_small"
app:layout_constraintBottom_toTopOf="@+id/song_info"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/song_menu"
app:layout_constraintStart_toEndOf="@+id/song_album_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
@ -30,10 +37,21 @@
style="@style/Widget.Auxio.TextView.Item.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/song_menu"
app:layout_constraintStart_toEndOf="@+id/song_album_cover"
app:layout_constraintTop_toBottomOf="@+id/song_name"
tools:text="Info" />
<Button
android:id="@+id/song_menu"
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:icon="@drawable/ic_more_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -21,7 +21,7 @@
style="@style/Widget.Auxio.Button.Icon.Small"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/spacing_mid_medium"
android:layout_marginEnd="@dimen/spacing_small"
android:contentDescription="@string/lbl_sort"
app:icon="@drawable/ic_sort_24"
app:layout_constraintBottom_toTopOf="@id/header_divider"

View file

@ -141,8 +141,9 @@
</style>
<style name="Widget.Auxio.TextView.Primary.Compact" parent="Widget.Auxio.TextView.Base">
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">marquee</item>
<item name="android:singleLine">true</item>
<item name="android:marqueeRepeatLimit">marquee_forever</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textAppearance">@style/TextAppearance.Auxio.LabelLarge</item>
</style>
@ -212,16 +213,16 @@
<style name="Widget.Auxio.Button.Icon.Large" parent="Widget.Auxio.Button.Icon.Base">
<item name="iconSize">@dimen/size_icon_large</item>
<item name="android:minWidth">@dimen/size_btn</item>
<item name="android:minHeight">@dimen/size_btn</item>
<item name="android:minWidth">56dp</item>
<item name="android:minHeight">56dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="android:insetLeft">0dp</item>
<item name="android:insetRight">0dp</item>
<item name="android:paddingStart">@dimen/spacing_small</item>
<item name="android:paddingEnd">@dimen/spacing_small</item>
<item name="android:paddingTop">@dimen/spacing_small</item>
<item name="android:paddingBottom">@dimen/spacing_small</item>
<item name="android:paddingStart">@dimen/spacing_mid_medium</item>
<item name="android:paddingEnd">@dimen/spacing_mid_medium</item>
<item name="android:paddingTop">@dimen/spacing_mid_medium</item>
<item name="android:paddingBottom">@dimen/spacing_mid_medium</item>
</style>
<style name="Widget.Auxio.Button.PlayPause" parent="Widget.Material3.Button.IconButton.Filled.Tonal">