Migrate add to playlist dialog to MD3 dropdown menu

This commit is contained in:
Bnyro 2023-03-22 12:09:53 +01:00
parent 7700bb7cba
commit d1cc16c6fb
2 changed files with 7 additions and 10 deletions

View File

@ -55,12 +55,9 @@ class AddToPlaylistDialog(
return@launchWhenCreated return@launchWhenCreated
} }
if (response.isEmpty()) return@launchWhenCreated if (response.isEmpty()) return@launchWhenCreated
val names = response.map { it.name } val names = response.mapNotNull { it.name }
val arrayAdapter = val arrayAdapter =
ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, names) ArrayAdapter(requireContext(), R.layout.dropdown_item, names)
arrayAdapter.setDropDownViewResource(
android.R.layout.simple_spinner_dropdown_item
)
binding.playlistsSpinner.adapter = arrayAdapter binding.playlistsSpinner.adapter = arrayAdapter
// select the last used playlist // select the last used playlist

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -11,14 +12,13 @@
android:layout_margin="10dp" android:layout_margin="10dp"
android:gravity="center" /> android:gravity="center" />
<Spinner <com.github.libretube.ui.views.DropdownMenu
android:id="@+id/playlists_spinner" android:id="@+id/playlists_spinner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_marginHorizontal="24dp"
android:paddingVertical="8dp" android:layout_marginBottom="16dp"
android:paddingStart="8dp" app:icon="@drawable/ic_playlist_add"
android:paddingEnd="40dp"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
<LinearLayout <LinearLayout