[Android] Fix save playlist

Nicolas Pomepuy git at videolan.org
Mon Jul 1 16:00:51 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Jul  1 08:38:52 2019 +0200| [c69ee40914d18c6c248cdc97ead3cba220582078] | committer: Geoffrey Métais

Fix save playlist

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

 .../src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt     | 10 +++++++++-
 .../src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt  |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
index 4509ae1fe..d4e8bbf3c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.kt
@@ -100,7 +100,8 @@ class SavePlaylistDialog : VLCBottomSheetDialogFragment(), View.OnClickListener,
         editText!!.setOnEditorActionListener(this)
         listView.layoutManager = LinearLayoutManager(view.context)
         listView.adapter = adapter
-        adapter.submitList(Arrays.asList<MediaLibraryItem>(*medialibrary.playlists))
+        adapter.submitList(listOf<MediaLibraryItem>(*medialibrary.playlists))
+        if (!Tools.isArrayEmpty(newTrack)) saveButton.setText(R.string.save)
         updateEmptyView()
 
     }
@@ -151,6 +152,13 @@ class SavePlaylistDialog : VLCBottomSheetDialogFragment(), View.OnClickListener,
                 } else
                     ids.add(id)
             }
+
+            if (!addTracks) {
+                for (i in 0 until playlist.tracks.size) {
+                    playlist.remove(0)
+                }
+            }
+
             playlist.append(ids)
         })
         dismiss()
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
index 53819e993..d25a7ea0e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -410,7 +410,7 @@ class PlayerOptionsDelegate(val activity: AppCompatActivity, val service: Playba
 
             init {
                 itemView.setOnClickListener { onClick(dataset[layoutPosition]) }
-                itemView.setOnFocusChangeListener { _, hasFocus ->
+                itemView.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
                     binding.optionTitle.setTextColor(if (hasFocus) ContextCompat.getColor(itemView.context, R.color.orange500transparent) else textColor)
                 }
             }



More information about the Android mailing list