[Android] Fix play all ctx action on Video groups

Nicolas Pomepuy git at videolan.org
Thu Jul 2 11:51:03 CEST 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jul  2 08:51:25 2020 +0200| [5c27478d1cc47ee695ef2dc2c128ca4eb1cb097d] | committer: Nicolas Pomepuy

Fix play all ctx action on Video groups

Fixes #1390

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

 .../vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt    | 3 ++-
 .../src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt          | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index c3e6e7c42..870356d8d 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -437,6 +437,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
                 CTX_ADD_TO_PLAYLIST -> viewModel.addItemToPlaylist(requireActivity(), position)
             }
             is VideoGroup -> when (option) {
+                CTX_PLAY_ALL -> viewModel.play(position)
                 CTX_PLAY -> viewModel.play(position)
                 CTX_APPEND -> viewModel.append(position)
                 CTX_ADD_TO_PLAYLIST -> viewModel.addItemToPlaylist(requireActivity(), position)
@@ -488,7 +489,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
             is VideoCtxClick -> {
                 when (item) {
                     is Folder -> showContext(requireActivity(), this at VideoGridFragment, position, item.title, CTX_FOLDER_FLAGS)
-                    is VideoGroup -> showContext(requireActivity(), this at VideoGridFragment, position, item.title, CTX_FOLDER_FLAGS or CTX_RENAME_GROUP or CTX_UNGROUP)
+                    is VideoGroup -> showContext(requireActivity(), this at VideoGridFragment, position, item.title, CTX_FOLDER_FLAGS or CTX_RENAME_GROUP or CTX_UNGROUP or CTX_PLAY_ALL)
                     is MediaWrapper -> {
                         val group = item.type == MediaWrapper.TYPE_GROUP
                         var flags = if (group) CTX_VIDEO_GROUP_FLAGS else CTX_VIDEO_FLAGS
diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt
index 0a40b86ec..6ad6ba87e 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt
@@ -89,6 +89,7 @@ class VideosViewModel(context: Context, type: VideoGroupingType, val folder: Fol
             when (item) {
                 is Folder -> item.getAll()
                 is VideoGroup -> item.getAll()
+                is MediaWrapper -> listOf(item)
                 else -> null
             }
         }?.let { MediaUtils.openList(context, it, 0) }



More information about the Android mailing list