[Android] Improve the playlist addition UI

Yashraj Singh Jadon git at videolan.org
Tue Feb 13 10:36:01 UTC 2024


vlc-android | branch: master | Yashraj Singh Jadon <yashr7651 at gmail.com> | Thu Feb  1 03:35:59 2024 +0530| [e1325d25e5a75dd30e8d6a7f3be07ea3855bebea] | committer: Nicolas Pomepuy

Improve the playlist addition UI

> https://code.videolan.org/videolan/vlc-android/commit/e1325d25e5a75dd30e8d6a7f3be07ea3855bebea
---

 application/resources/src/main/res/values/strings.xml             | 1 +
 application/vlc-android/res/layout/dialog_playlist.xml            | 2 +-
 .../src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt        | 8 ++++----
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 38bdaf0f65..53f3ab301d 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -1026,6 +1026,7 @@
     <string name="stop_unpaubale">This media cannot be paused. Stop it instead?</string>
     <string name="delete_forever">Delete forever</string>
     <string name="add_to_existing_playlist">Add to existing playlist</string>
+    <string name="select_existing_playlist">Select existing playlist</string>
     <string name="bookmarks_title">Bookmarks</string>
     <string name="no_bookmark">No bookmark set</string>
     <string name="bookmark_default_name">Bookmark at %s</string>
diff --git a/application/vlc-android/res/layout/dialog_playlist.xml b/application/vlc-android/res/layout/dialog_playlist.xml
index 20cf922d62..c67291f36a 100644
--- a/application/vlc-android/res/layout/dialog_playlist.xml
+++ b/application/vlc-android/res/layout/dialog_playlist.xml
@@ -79,7 +79,7 @@
                     android:layout_marginStart="8dp"
                     android:layout_marginTop="24dp"
                     android:minHeight="0dp"
-                    android:text="0 selected"
+                    android:text="@string/select_existing_playlist"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toBottomOf="@+id/dialog_playlist_name" />
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
index cf8531ad7d..fa1b32dc63 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
@@ -193,20 +193,20 @@ class SavePlaylistDialog : VLCBottomSheetDialogFragment(), View.OnClickListener,
     }
 
     override fun onClick(v: View) {
-        if(adapter.multiSelectHelper.getSelection().isEmpty()) addToNewPlaylist()
-        else {
+        addToNewPlaylist()
+        if(adapter.multiSelectHelper.getSelection().isNotEmpty()) {
             val selectedItems = adapter.multiSelectHelper.getSelection()
             playlistIterator = selectedItems.iterator()
             processNextItem()
         }
     }
+
     private fun processNextItem() {
         if (playlistIterator != null && playlistIterator!!.hasNext()) {
             val item = playlistIterator!!.next()
             currentItem = item
             saveToExistingPlaylists(item)
         } else {
-            // No more items to process
             playlistIterator = null
             currentItem = null
             dismiss()
@@ -227,8 +227,8 @@ class SavePlaylistDialog : VLCBottomSheetDialogFragment(), View.OnClickListener,
                 alreadyAdding.set(false)
                 return at launch
             }
-            dismiss()
             savePlaylist(medialibrary.createPlaylist(name, Settings.includeMissing, false) ?: return at launch, newTracks)
+            if(adapter.multiSelectHelper.getSelection().isEmpty()) dismiss()
         }
     }
 



More information about the Android mailing list