Merge pull request #3907 from Bnyro/master

Show currently applied playlist sort order
This commit is contained in:
Bnyro 2023-06-03 11:50:55 +02:00 committed by GitHub
commit cc430d9507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 12 deletions

View File

@ -67,6 +67,7 @@ class PlaylistFragment : Fragment() {
PreferenceHelper.putInt(PreferenceKeys.PLAYLIST_SORT_ORDER, value)
field = value
}
private val sortOptions by lazy { resources.getStringArray(R.array.playlistSortOptions) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -215,13 +216,13 @@ class PlaylistFragment : Fragment() {
keepQueue = true,
)
}
binding.sortMenu.isGone = false
binding.sortMenu.setOnClickListener {
val sortOptions = resources.getStringArray(R.array.playlistSortOptions)
binding.sortContainer.isGone = false
binding.sortTV.text = sortOptions[selectedSortOrder]
binding.sortContainer.setOnClickListener {
BaseBottomSheet().apply {
setSimpleItems(sortOptions.toList()) { index ->
selectedSortOrder = index
binding.sortTV.text = sortOptions[index]
showPlaylistVideos(response)
}
}.show(childFragmentManager)

View File

@ -55,15 +55,31 @@
android:textSize="20sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/sortMenu"
android:layout_width="20dp"
android:layout_height="20dp"
<LinearLayout
android:id="@+id/sortContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="10dp"
android:background="?selectableItemBackgroundBorderless"
android:src="@drawable/ic_sort"
android:visibility="gone" />
android:layout_marginEnd="8dp"
android:padding="5dp"
android:background="@drawable/rounded_ripple"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/sortTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
tools:text="@string/most_recent" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:src="@drawable/ic_sort" />
</LinearLayout>
<ImageView
android:id="@+id/optionsMenu"