[Android] Fix the play queue view not displayed in the video player

Nicolas Pomepuy git at videolan.org
Mon Feb 28 06:24:16 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Feb 25 10:25:47 2022 +0100| [dc908b6095f6e2cdb88b8133565fa66a9b5dac77] | committer: Nicolas Pomepuy

Fix the play queue view not displayed in the video player

Fixes #2409

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

 .../vlc/gui/video/VideoPlayerOverlayDelegate.kt    | 42 +++++++++++-----------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
index 65da4307e..df28c1a1a 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
@@ -640,30 +640,28 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
     }
 
     private fun initPlaylistUi() {
-        if (player.service?.hasPlaylist() == true) {
-            if (!::playlistAdapter.isInitialized) {
-                playlistAdapter = PlaylistAdapter(player)
-                val layoutManager = LinearLayoutManager(player, RecyclerView.VERTICAL, false)
-                playlist.layoutManager = layoutManager
-            }
-            if (player.playlistModel == null) {
-                player.playlistModel = ViewModelProvider(player).get(PlaylistModel::class.java).apply {
-                    playlistAdapter.setModel(this)
-                    dataset.observe(player, player.playlistObserver)
-                }
-            }
-            hudRightBinding.playlistToggle.setVisible()
-            if (::hudBinding.isInitialized) {
-                hudBinding.playlistPrevious.setVisible()
-                hudBinding.playlistNext.setVisible()
+        if (!::playlistAdapter.isInitialized) {
+            playlistAdapter = PlaylistAdapter(player)
+            val layoutManager = LinearLayoutManager(player, RecyclerView.VERTICAL, false)
+            playlist.layoutManager = layoutManager
+        }
+        if (player.playlistModel == null) {
+            player.playlistModel = ViewModelProvider(player).get(PlaylistModel::class.java).apply {
+                playlistAdapter.setModel(this)
+                dataset.observe(player, player.playlistObserver)
             }
-            hudRightBinding.playlistToggle.setOnClickListener(player)
-            closeButton.setOnClickListener { togglePlaylist() }
-
-            val callback = SwipeDragItemTouchHelperCallback(playlistAdapter, true)
-            val touchHelper = ItemTouchHelper(callback)
-            touchHelper.attachToRecyclerView(playlist)
         }
+        if (player.service?.hasPlaylist() == true) hudRightBinding.playlistToggle.setVisible() else hudRightBinding.playlistToggle.setGone()
+        if (::hudBinding.isInitialized) {
+            hudBinding.playlistPrevious.setVisible()
+            hudBinding.playlistNext.setVisible()
+        }
+        hudRightBinding.playlistToggle.setOnClickListener(player)
+        closeButton.setOnClickListener { togglePlaylist() }
+
+        val callback = SwipeDragItemTouchHelperCallback(playlistAdapter, true)
+        val touchHelper = ItemTouchHelper(callback)
+        touchHelper.attachToRecyclerView(playlist)
     }
 
     fun togglePlaylist() {



More information about the Android mailing list