[Android] Use the right enum for the playlists

Nicolas Pomepuy git at videolan.org
Tue Nov 22 14:05:53 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Nov 21 08:54:06 2022 +0100| [ee9b362f3a4f7040097fa49bffa1011c5f8dc81d] | committer: Duncan McNamara

Use the right enum for the playlists

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

 .../src/org/videolan/vlc/gui/video/VideoBrowserFragment.kt            | 2 +-
 .../vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt     | 4 +---
 application/vlc-android/src/org/videolan/vlc/util/VersionMigration.kt | 4 ++--
 .../src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt   | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserFragment.kt
index e8780243e4..2b1f26b249 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoBrowserFragment.kt
@@ -173,7 +173,7 @@ class VideoBrowserFragment : BaseFragment(), TabLayout.OnTabSelectedListener, Vi
         override fun getItem(position: Int): Fragment {
             return when (position) {
                 0 -> VideoGridFragment.newInstance()
-                1 -> PlaylistFragment.newInstance(Playlist.Type.VideoOnly)
+                1 -> PlaylistFragment.newInstance(Playlist.Type.Video)
                 else -> throw IllegalStateException("Invalid fragment index")
             }
         }
diff --git a/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt b/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt
index 2512d90af0..1a39aa6cd8 100644
--- a/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt
+++ b/application/vlc-android/src/org/videolan/vlc/media/MediaSessionBrowser.kt
@@ -26,7 +26,6 @@ package org.videolan.vlc.media
 import android.content.ContentResolver
 import android.content.ContentUris
 import android.content.Context
-import android.content.ServiceConnection
 import android.net.Uri
 import android.os.Bundle
 import android.support.v4.media.MediaBrowserCompat
@@ -53,7 +52,6 @@ import org.videolan.vlc.media.MediaUtils.getMediaSubtitle
 import org.videolan.vlc.util.TextUtils
 import org.videolan.vlc.util.ThumbnailsProvider
 import org.videolan.vlc.util.isSchemeStreaming
-import java.util.concurrent.Semaphore
 
 /**
  * The mediaId used in the media session browser is defined as an opaque string token which is left
@@ -294,7 +292,7 @@ class MediaSessionBrowser {
                     list = genres.copyOfRange(pageOffset.coerceAtMost(genres.size), (pageOffset + MAX_RESULT_SIZE).coerceAtMost(genres.size))
                 }
                 ID_PLAYLIST -> {
-                        list = ml.getPlaylists(Playlist.Type.AudioOnly)
+                        list = ml.getPlaylists(Playlist.Type.Audio)
                     list.sortWith(MediaComparators.ANDROID_AUTO)
                 }
                 ID_STREAM -> {
diff --git a/application/vlc-android/src/org/videolan/vlc/util/VersionMigration.kt b/application/vlc-android/src/org/videolan/vlc/util/VersionMigration.kt
index b8a9385fbe..d4e4dbe018 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/VersionMigration.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/VersionMigration.kt
@@ -270,8 +270,8 @@ object VersionMigration {
                         putInt("subtitles_color", newColor)
                     } catch (e: Exception) {
                     }
-                    putBoolean("display_mode_playlists_${Playlist.Type.AudioOnly}", oldSetting)
-                    putBoolean("display_mode_playlists_${Playlist.Type.VideoOnly}", oldSetting)
+                    putBoolean("display_mode_playlists_${Playlist.Type.Audio}", oldSetting)
+                    putBoolean("display_mode_playlists_${Playlist.Type.Video}", oldSetting)
                     remove("display_mode_playlists")
                 }
             }
diff --git a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt
index 42d6cafa02..1e2e4ad44c 100644
--- a/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt
+++ b/application/vlc-android/src/org/videolan/vlc/viewmodels/mobile/AudioBrowserViewModel.kt
@@ -41,7 +41,7 @@ class AudioBrowserViewModel(context: Context) : MedialibraryViewModel(context) {
     val albumsProvider = AlbumsProvider(null, context, this)
     val tracksProvider = TracksProvider(null, context, this)
     val genresProvider = GenresProvider(context, this)
-    private val playlistsProvider = PlaylistsProvider(context, this, Playlist.Type.AudioOnly)
+    private val playlistsProvider = PlaylistsProvider(context, this, Playlist.Type.Audio)
     override val providers = arrayOf(artistsProvider, albumsProvider, tracksProvider, genresProvider, playlistsProvider)
     val providersInCard = arrayOf(true, true, false, false, true)
 



More information about the Android mailing list