[Android] Streams: Add 'append' option in context menu

Geoffrey Métais git at videolan.org
Wed Mar 13 11:11:34 CET 2019


vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar  8 16:41:09 2019 +0100| [d9f9182c110bedde3b34904c57b69b3e7d651d02] | committer: Geoffrey Métais

Streams: Add 'append' option in context menu

Fix #762

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

 vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
index 63357dd1f..82336d42d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
@@ -50,6 +50,7 @@ import org.videolan.vlc.gui.dialogs.showContext
 import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.media.MediaUtils
 import org.videolan.vlc.util.CTX_ADD_TO_PLAYLIST
+import org.videolan.vlc.util.CTX_APPEND
 import org.videolan.vlc.util.CTX_RENAME
 import org.videolan.vlc.viewmodels.StreamsModel
 
@@ -132,7 +133,7 @@ class MRLPanelFragment : DialogFragment(), View.OnKeyListener, TextView.OnEditor
     }
 
     private fun showContext(position: Int) {
-        val flags = CTX_RENAME or CTX_ADD_TO_PLAYLIST
+        val flags = CTX_RENAME or CTX_APPEND or CTX_ADD_TO_PLAYLIST
         val media = viewModel.observableHistory.value?.get(position) ?: return
         showContext(requireActivity(), this, position, media.title, flags)
     }
@@ -140,6 +141,10 @@ class MRLPanelFragment : DialogFragment(), View.OnKeyListener, TextView.OnEditor
     override fun onCtxAction(position: Int, option: Int) {
         when (option) {
             CTX_RENAME -> renameStream(position)
+            CTX_APPEND -> {
+                val media = viewModel.observableHistory.value?.get(position) ?: return
+                MediaUtils.appendMedia(requireContext(), media)
+            }
             CTX_ADD_TO_PLAYLIST -> {
                 val media = viewModel.observableHistory.value?.get(position) ?: return
                 UiTools.addToPlaylist(requireActivity(), media.tracks, SavePlaylistDialog.KEY_NEW_TRACKS)



More information about the Android mailing list