[Android] Video groups: directly play media for singletons

Geoffrey Métais git at videolan.org
Thu Oct 3 14:21:31 CEST 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Oct  3 14:20:46 2019 +0200| [ff253ddf11058d96105df5c3d28f50d3a814e09a] | committer: Geoffrey Métais

Video groups: directly play media for singletons

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

 .../org/videolan/vlc/gui/videogroups/VideoGroupsFragment.kt   | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/videogroups/VideoGroupsFragment.kt b/vlc-android/src/org/videolan/vlc/gui/videogroups/VideoGroupsFragment.kt
index af141c89d..006518a9f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/videogroups/VideoGroupsFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/videogroups/VideoGroupsFragment.kt
@@ -43,10 +43,13 @@ class VideoGroupsFragment : MediaBrowserFragment<VideogroupsViewModel>(), CtxAct
                     adapter.multiSelectHelper.toggleSelection(action.position)
                     invalidateActionMode()
                 } else {
-                    val i = Intent(activity, SecondaryActivity::class.java)
-                    i.putExtra("fragment", SecondaryActivity.VIDEO_GROUP_LIST)
-                    i.putExtra(KEY_GROUP, action.group)
-                    activity?.startActivityForResult(i, SecondaryActivity.ACTIVITY_RESULT_SECONDARY)
+                    if (action.group.mediaCount() == 1) viewModel.play(action.position)
+                    else {
+                        val i = Intent(activity, SecondaryActivity::class.java)
+                        i.putExtra("fragment", SecondaryActivity.VIDEO_GROUP_LIST)
+                        i.putExtra(KEY_GROUP, action.group)
+                        activity?.startActivityForResult(i, SecondaryActivity.ACTIVITY_RESULT_SECONDARY)
+                    }
                 }
             }
             is VideoGroupLongClick -> {



More information about the Android mailing list