[Android] PlaylistManager: Use service to get preferences

Geoffrey Métais git at videolan.org
Thu Feb 22 15:29:57 CET 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 22 13:50:13 2018 +0100| [4d514eb727c6be06799bf929d032804cab565d61] | committer: Geoffrey Métais

PlaylistManager: Use service to get preferences

(cherry picked from commit 8ebdc390636ae6bf57bb728f230ed5bed7b3e8c2)

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

 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index 01453401c..9afd481e8 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -4,6 +4,7 @@ import android.content.Intent
 import android.net.Uri
 import android.support.annotation.MainThread
 import android.support.v4.content.LocalBroadcastManager
+import android.support.v7.preference.PreferenceManager
 import android.text.TextUtils
 import android.util.Log
 import android.widget.Toast
@@ -34,7 +35,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
 
     private val medialibrary by lazy(LazyThreadSafetyMode.NONE) { Medialibrary.getInstance() }
     val player by lazy(LazyThreadSafetyMode.NONE) { PlayerController() }
-    private val settings by lazy(LazyThreadSafetyMode.NONE) { VLCApplication.getSettings() }
+    private val settings by lazy(LazyThreadSafetyMode.NONE) { PreferenceManager.getDefaultSharedPreferences(service) }
     private val ctx by lazy(LazyThreadSafetyMode.NONE) { VLCApplication.getAppContext() }
     private val mediaList = MediaWrapperList()
     var currentIndex = -1
@@ -51,7 +52,8 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
     var savedTime = 0L
     private var random = Random(System.currentTimeMillis())
     private var newMedia = false
-    @Volatile var expanding = false
+    @Volatile
+    private var expanding = false
 
     fun hasMedia() = mediaList.size() != 0
     fun hasCurrentMedia() = isValidPosition(currentIndex)



More information about the Android mailing list