[Android] Fix the video playlist mode on TV

Nicolas Pomepuy git at videolan.org
Wed Oct 12 12:01:06 UTC 2022


vlc-android | branch: 3.5.x | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Oct 10 07:37:56 2022 +0200| [44c5453542202269c25128bc7e0acb0fc6c1ab39] | committer: Duncan McNamara

Fix the video playlist mode on TV

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

 .../television/src/main/java/org/videolan/television/ui/TvUtil.kt       | 2 +-
 .../java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt   | 2 +-
 .../vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt | 2 +-
 .../src/org/videolan/vlc/viewmodels/mobile/VideosViewModel.kt           | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
index d0a37689e..771619cce 100644
--- a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
@@ -204,7 +204,7 @@ object TvUtil {
                 }
                 else -> {
                     model.run {
-                        if (!Settings.getInstance(activity).getBoolean(FORCE_PLAY_ALL_VIDEO, false)) {
+                        if (!Settings.getInstance(activity).getBoolean(FORCE_PLAY_ALL_VIDEO, Settings.tvUI)) {
                             MediaUtils.openMedia(activity, item)
                         } else {
                             val list = (dataset.getList().filterIsInstance<MediaWrapper>()).filter { it.type != MediaWrapper.TYPE_DIR }
diff --git a/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt b/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt
index bb86a12ca..e803120d7 100644
--- a/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/browser/MediaBrowserTvFragment.kt
@@ -97,7 +97,7 @@ class MediaBrowserTvFragment : BaseBrowserTvFragment<MediaLibraryItem>() {
 
     override fun onClick(v: View, position: Int, item: MediaLibraryItem) {
         lifecycleScope.launchWhenStarted {
-            if ((viewModel as MediaBrowserViewModel).category == CATEGORY_VIDEOS && !Settings.getInstance(requireContext()).getBoolean(FORCE_PLAY_ALL_VIDEO, true)) {
+            if ((viewModel as MediaBrowserViewModel).category == CATEGORY_VIDEOS && !Settings.getInstance(requireContext()).getBoolean(FORCE_PLAY_ALL_VIDEO, Settings.tvUI)) {
                 TvUtil.playMedia(requireActivity(), item as MediaWrapper)
             } else {
                 TvUtil.openMediaFromPaged(requireActivity(), item, viewModel.provider as MedialibraryProvider<out MediaLibraryItem>)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index df02f8346..a93b2f75a 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -528,7 +528,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
             if (mediaWrapper.type == MediaWrapper.TYPE_DIR) browse(mediaWrapper, true)
             else {
                 val forcePlayType = if (mediaWrapper.type == MediaWrapper.TYPE_VIDEO) FORCE_PLAY_ALL_VIDEO else FORCE_PLAY_ALL_AUDIO
-                if (!Settings.getInstance(requireContext()).getBoolean(forcePlayType, false)) {
+                if (!Settings.getInstance(requireContext()).getBoolean(forcePlayType, forcePlayType == FORCE_PLAY_ALL_VIDEO && Settings.tvUI)) {
                     lifecycleScope.launch {
                         MediaUtils.openMedia(requireContext(), getMediaWithMeta(item))
                     }
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 1760b8f60..2f05a0c62 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
@@ -134,7 +134,7 @@ class VideosViewModel(context: Context, type: VideoGroupingType, val folder: Fol
         }
         mw.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO)
         val settings = Settings.getInstance(context)
-        if (!fromStart && (settings.getBoolean(FORCE_PLAY_ALL_VIDEO, false) || forceAll)) {
+        if (!fromStart && (settings.getBoolean(FORCE_PLAY_ALL_VIDEO, Settings.tvUI) || forceAll)) {
             when(val prov = provider) {
                 is VideosProvider -> MediaUtils.playAll(context, prov, position, false)
                 is FoldersProvider -> MediaUtils.playAllTracks(context, prov, position, false)



More information about the Android mailing list