Remove unnecessary lazy delegations
This commit is contained in:
@@ -64,15 +64,11 @@ class PlayerService : MediaSessionService(), MediaSession.MediaItemFiller,
|
|||||||
private const val NotificationChannelId = "default_channel_id"
|
private const val NotificationChannelId = "default_channel_id"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val cache: SimpleCache by lazy(LazyThreadSafetyMode.NONE) {
|
private lateinit var cache: SimpleCache
|
||||||
SimpleCache(cacheDir, NoOpCacheEvictor(), StandaloneDatabaseProvider(this))
|
|
||||||
}
|
|
||||||
|
|
||||||
private lateinit var mediaSession: MediaSession
|
private lateinit var mediaSession: MediaSession
|
||||||
|
|
||||||
private val notificationManager by lazy(LazyThreadSafetyMode.NONE) {
|
private lateinit var notificationManager: NotificationManager
|
||||||
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
||||||
}
|
|
||||||
|
|
||||||
private var lastArtworkUri: Uri? = null
|
private var lastArtworkUri: Uri? = null
|
||||||
private var lastBitmap: Bitmap? = null
|
private var lastBitmap: Bitmap? = null
|
||||||
@@ -87,6 +83,8 @@ class PlayerService : MediaSessionService(), MediaSession.MediaItemFiller,
|
|||||||
createNotificationChannel()
|
createNotificationChannel()
|
||||||
setMediaNotificationProvider(this)
|
setMediaNotificationProvider(this)
|
||||||
|
|
||||||
|
cache = SimpleCache(cacheDir, NoOpCacheEvictor(), StandaloneDatabaseProvider(this))
|
||||||
|
|
||||||
val player = ExoPlayer.Builder(this)
|
val player = ExoPlayer.Builder(this)
|
||||||
.setHandleAudioBecomingNoisy(true)
|
.setHandleAudioBecomingNoisy(true)
|
||||||
.setWakeMode(C.WAKE_MODE_LOCAL)
|
.setWakeMode(C.WAKE_MODE_LOCAL)
|
||||||
@@ -351,6 +349,7 @@ class PlayerService : MediaSessionService(), MediaSession.MediaItemFiller,
|
|||||||
) = Unit
|
) = Unit
|
||||||
|
|
||||||
private fun createNotificationChannel() {
|
private fun createNotificationChannel() {
|
||||||
|
notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
if (Util.SDK_INT >= 26 && notificationManager.getNotificationChannel(NotificationChannelId) == null) {
|
if (Util.SDK_INT >= 26 && notificationManager.getNotificationChannel(NotificationChannelId) == null) {
|
||||||
notificationManager.createNotificationChannel(
|
notificationManager.createNotificationChannel(
|
||||||
NotificationChannel(
|
NotificationChannel(
|
||||||
|
|||||||
Reference in New Issue
Block a user