[Android] PlaybackService code cleaning

Geoffrey Métais git at videolan.org
Thu May 24 11:02:55 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May 24 11:01:00 2018 +0200| [91f32c833f83b2a99cffdad2a920bfa2de2d18b9] | committer: Geoffrey Métais

PlaybackService code cleaning

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

 vlc-android/src/org/videolan/vlc/PlaybackService.kt       | 14 ++++++--------
 vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt |  2 +-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.kt b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
index 8aed94425..18ef40d0d 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.kt
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.kt
@@ -690,9 +690,7 @@ class PlaybackService : MediaBrowserServiceCompat() {
         NotificationManagerCompat.from(this at PlaybackService).cancel(3)
     }
 
-    fun onNewPlayback(mw: MediaWrapper) {
-        mediaSession.setSessionActivity(sessionPendingIntent)
-    }
+    fun onNewPlayback() = mediaSession.setSessionActivity(sessionPendingIntent)
 
     fun onPlaylistLoaded() {
         notifyTrackChanged()
@@ -1327,10 +1325,10 @@ class PlaybackService : MediaBrowserServiceCompat() {
 // Actor actions sealed classes
 private sealed class CbAction
 private object CbUpdate : CbAction()
-private data class CbMediaEvent(val event : Media.Event) : CbAction()
-private data class CbMediaPlayerEvent(val event : MediaPlayer.Event) : CbAction()
-private data class CbAdd(val cb : PlaybackService.Callback) : CbAction()
-private data class CbRemove(val cb : PlaybackService.Callback) : CbAction()
+private class CbMediaEvent(val event : Media.Event) : CbAction()
+private class CbMediaPlayerEvent(val event : MediaPlayer.Event) : CbAction()
+private class CbAdd(val cb : PlaybackService.Callback) : CbAction()
+private class CbRemove(val cb : PlaybackService.Callback) : CbAction()
 private object ShowNotification : CbAction()
-private data class HideNotification(val remove: Boolean) : CbAction()
+private class HideNotification(val remove: Boolean) : CbAction()
 private object UpdateMeta : CbAction()
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
index f702dc845..7b62c0632 100644
--- a/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+++ b/vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
@@ -288,7 +288,7 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
                 player.startPlayback(media, mediaplayerEventListener)
                 media.release()
                 determinePrevAndNextIndices()
-                service.onNewPlayback(mw)
+                service.onNewPlayback()
                 if (settings.getBoolean(PreferencesFragment.PLAYBACK_HISTORY, true)) launch {
                     var id = mw.id
                     if (id == 0L) {



More information about the Android mailing list