From 4dd49946ad57368ce7991007ea599c1e5e18767f Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 15 Aug 2023 12:48:00 +0200 Subject: [PATCH] fix: sort order of playlists isn't shown properly --- .../com/github/libretube/ui/fragments/LibraryFragment.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt index a350adb89..f4b341831 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt @@ -98,10 +98,13 @@ class LibraryFragment : Fragment() { }.show(childFragmentManager, CreatePlaylistDialog::class.java.name) } - binding.sortTV.setOnClickListener { - val sortOptions = resources.getStringArray(R.array.playlistSortingOptions) - val sortOptionValues = resources.getStringArray(R.array.playlistSortingOptionsValues) + val sortOptions = resources.getStringArray(R.array.playlistSortingOptions) + 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 { setSimpleItems(sortOptions.toList()) { index -> binding.sortTV.text = sortOptions[index]