fix: sort order of playlists isn't shown properly

This commit is contained in:
Bnyro 2023-08-15 12:48:00 +02:00
parent 3fadb792bc
commit 4dd49946ad

View File

@ -98,10 +98,13 @@ class LibraryFragment : Fragment() {
}.show(childFragmentManager, CreatePlaylistDialog::class.java.name) }.show(childFragmentManager, CreatePlaylistDialog::class.java.name)
} }
binding.sortTV.setOnClickListener { val sortOptions = resources.getStringArray(R.array.playlistSortingOptions)
val sortOptions = resources.getStringArray(R.array.playlistSortingOptions) val sortOptionValues = resources.getStringArray(R.array.playlistSortingOptionsValues)
val sortOptionValues = resources.getStringArray(R.array.playlistSortingOptionsValues) val order = PreferenceHelper.getString(PreferenceKeys.PLAYLISTS_ORDER, sortOptionValues.first())
val orderIndex = sortOptionValues.indexOf(order)
binding.sortTV.text = sortOptions[orderIndex]
binding.sortTV.setOnClickListener {
BaseBottomSheet().apply { BaseBottomSheet().apply {
setSimpleItems(sortOptions.toList()) { index -> setSimpleItems(sortOptions.toList()) { index ->
binding.sortTV.text = sortOptions[index] binding.sortTV.text = sortOptions[index]