settings: make tab dialog use checkboxes
Make the tab selection dialog use checkboxes instead of icons to make it more user-friendly.
This commit is contained in:
@@ -194,14 +194,7 @@ class HomeFragment : Fragment() {
|
||||
}
|
||||
|
||||
TabLayoutMediator(binding.homeTabs, binding.homePager) { tab, pos ->
|
||||
val labelRes = when (homeModel.tabs[pos]) {
|
||||
DisplayMode.SHOW_SONGS -> R.string.lbl_songs
|
||||
DisplayMode.SHOW_ALBUMS -> R.string.lbl_albums
|
||||
DisplayMode.SHOW_ARTISTS -> R.string.lbl_artists
|
||||
DisplayMode.SHOW_GENRES -> R.string.lbl_genres
|
||||
}
|
||||
|
||||
tab.setText(labelRes)
|
||||
tab.setText(homeModel.tabs[pos].string)
|
||||
}.attach()
|
||||
|
||||
// --- VIEWMODEL SETUP ---
|
||||
@@ -219,7 +212,7 @@ class HomeFragment : Fragment() {
|
||||
homeModel.curTab.observe(viewLifecycleOwner) { tab ->
|
||||
// Make sure that we update the scrolling view and allowed menu items before whenever
|
||||
// the tab changes.
|
||||
binding.homeAppbar.liftOnScrollTargetViewId = when (requireNotNull(tab)) {
|
||||
val targetView = when (requireNotNull(tab)) {
|
||||
DisplayMode.SHOW_SONGS -> {
|
||||
updateSortMenu(sortItem, tab)
|
||||
R.id.home_song_list
|
||||
@@ -246,6 +239,8 @@ class HomeFragment : Fragment() {
|
||||
R.id.home_genre_list
|
||||
}
|
||||
}
|
||||
|
||||
binding.homeAppbar.liftOnScrollTargetViewId = targetView
|
||||
}
|
||||
|
||||
detailModel.navToItem.observe(viewLifecycleOwner) { item ->
|
||||
|
||||
@@ -119,6 +119,12 @@ class SongListFragment : HomeListFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The viewholder for the play/shuffle header on the song header.
|
||||
* Using a FAB would have been more conventional here, but it's so difficult to get a FAB
|
||||
* to play along with edge-to-edge and nested RecyclerView instances to the point where I
|
||||
* may as well not bother.
|
||||
*/
|
||||
private inner class PlayViewHolder(
|
||||
binding: ItemPlayShuffleBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
@@ -87,10 +87,7 @@ class PlaybackFragment : Fragment() {
|
||||
|
||||
// Make marquee of song title work
|
||||
binding.playbackSong.isSelected = true
|
||||
|
||||
binding.playbackSeekBar.onConfirmListener = { pos ->
|
||||
playbackModel.setPosition(pos)
|
||||
}
|
||||
binding.playbackSeekBar.onConfirmListener = playbackModel::setPosition
|
||||
|
||||
// --- VIEWMODEL SETUP --
|
||||
|
||||
|
||||
@@ -60,20 +60,14 @@ class TabAdapter(
|
||||
// A. We don't have a real ViewModel state since this is a dialog
|
||||
// B. Doing so would cause a relayout and the ripple effect to disappear
|
||||
// Instead, simply notify a tab change and let TabCustomizeDialog handle it.
|
||||
binding.tabIcon.isEnabled = !binding.tabIcon.isEnabled
|
||||
binding.tabName.isEnabled = !binding.tabName.isEnabled
|
||||
binding.tabIcon.isChecked = !binding.tabIcon.isChecked
|
||||
onTabSwitch(tab)
|
||||
}
|
||||
}
|
||||
binding.tabIcon.apply {
|
||||
setImageResource(tab.mode.icon)
|
||||
contentDescription = context.getString(tab.mode.string)
|
||||
isEnabled = tab is Tab.Visible
|
||||
}
|
||||
|
||||
binding.tabName.apply {
|
||||
binding.tabIcon.apply {
|
||||
setText(tab.mode.string)
|
||||
isEnabled = tab is Tab.Visible
|
||||
isChecked = tab is Tab.Visible
|
||||
}
|
||||
|
||||
binding.tabDragHandle.setOnTouchListener { _, motionEvent ->
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package org.oxycblt.auxio.ui
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import org.oxycblt.auxio.R
|
||||
|
||||
@@ -28,11 +27,11 @@ import org.oxycblt.auxio.R
|
||||
* changing them would also change the meaning.
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
enum class DisplayMode(@DrawableRes val icon: Int, @StringRes val string: Int) {
|
||||
SHOW_SONGS(R.drawable.ic_song, R.string.lbl_songs),
|
||||
SHOW_ALBUMS(R.drawable.ic_album, R.string.lbl_albums),
|
||||
SHOW_ARTISTS(R.drawable.ic_artist, R.string.lbl_artists),
|
||||
SHOW_GENRES(R.drawable.ic_genre, R.string.lbl_genres);
|
||||
enum class DisplayMode(@StringRes val string: Int) {
|
||||
SHOW_SONGS(R.string.lbl_songs),
|
||||
SHOW_ALBUMS(R.string.lbl_albums),
|
||||
SHOW_ARTISTS(R.string.lbl_artists),
|
||||
SHOW_GENRES(R.string.lbl_genres);
|
||||
|
||||
companion object {
|
||||
private const val CONST_NULL = 0xA107
|
||||
|
||||
Reference in New Issue
Block a user