diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt index 3d3254b3..08b4fb1a 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/PlayerFragment.kt @@ -914,11 +914,10 @@ class PlayerFragment : } ) - dragTouchHelper = ItemTouchHelper(object : ItemTouchHelper.SimpleCallback( + val callback = object : ItemTouchHelper.SimpleCallback( ItemTouchHelper.UP or ItemTouchHelper.DOWN, ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT ) { - override fun onMove( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, @@ -972,7 +971,8 @@ class PlayerFragment : return false } } - ) + + dragTouchHelper = ItemTouchHelper(callback) dragTouchHelper.attachToRecyclerView(playlistView) } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/playback/AutoMediaBrowserCallback.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/playback/AutoMediaBrowserCallback.kt index 2dc81682..e2abb257 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/playback/AutoMediaBrowserCallback.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/playback/AutoMediaBrowserCallback.kt @@ -87,7 +87,7 @@ private const val SEARCH_QUERY_PREFIX = "androidx://media3-session/setMediaUri" /** * MediaBrowserService implementation for e.g. Android Auto */ -@Suppress("TooManyFunctions", "LargeClass") +@Suppress("TooManyFunctions", "LargeClass", "UnusedPrivateMember") class AutoMediaBrowserCallback(var player: Player) : MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback, KoinComponent { @@ -161,7 +161,7 @@ class AutoMediaBrowserCallback(var player: Player) : ): ListenableFuture> { playFromMediaId(mediaId) - // FIXME: + // TODO: // Create LRU Cache of MediaItems, fill it in the other calls // and retrieve it here. return Futures.immediateFuture( diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerController.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerController.kt index 8a863ff6..ec866abb 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerController.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/service/MediaPlayerController.kt @@ -100,7 +100,7 @@ class MediaPlayerController( } override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) { - onTrackCompleted(mediaItem) + onTrackCompleted() legacyPlaylistManager.updateCurrentPlaying(mediaItem) publishPlaybackState() } @@ -167,7 +167,7 @@ class MediaPlayerController( Timber.d("Processed player state change") } - private fun onTrackCompleted(mediaItem: MediaItem?) { + private fun onTrackCompleted() { // This method is called before we update the currentPlaying, // so in fact currentPlaying will refer to the track that has just finished. if (legacyPlaylistManager.currentPlaying != null) { @@ -196,10 +196,10 @@ class MediaPlayerController( val started = playerState === PlayerState.STARTED val context = UApp.applicationContext() - UltrasonicAppWidgetProvider4X1.getInstance().notifyChange(context, song, started, false) - UltrasonicAppWidgetProvider4X2.getInstance().notifyChange(context, song, started, true) - UltrasonicAppWidgetProvider4X3.getInstance().notifyChange(context, song, started, false) - UltrasonicAppWidgetProvider4X4.getInstance().notifyChange(context, song, started, false) + UltrasonicAppWidgetProvider4X1.instance?.notifyChange(context, song, started, false) + UltrasonicAppWidgetProvider4X2.instance?.notifyChange(context, song, started, true) + UltrasonicAppWidgetProvider4X3.instance?.notifyChange(context, song, started, false) + UltrasonicAppWidgetProvider4X4.instance?.notifyChange(context, song, started, false) } fun onDestroy() {