Commit 6d83d58d authored by Geoffrey Métais's avatar Geoffrey Métais

Bundle onItemAdded callbacks

Will help for large collections loading or folder expanding.
Otherwise, it starts hundreds of update callbacks.
parent d003f731
Pipeline #4545 passed with stage
in 3 minutes and 54 seconds
......@@ -10,6 +10,8 @@ import androidx.annotation.MainThread
import androidx.lifecycle.MutableLiveData
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import org.videolan.libvlc.Media
import org.videolan.libvlc.MediaPlayer
import org.videolan.libvlc.RendererItem
......@@ -375,7 +377,11 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
override fun onItemAdded(index: Int, mrl: String?) {
if (BuildConfig.DEBUG) Log.i(TAG, "CustomMediaListItemAdded")
if (currentIndex >= index && !expanding) ++currentIndex
launch {
private val addUpdateActor = actor<Unit>(capacity = Channel.CONFLATED) {
for (update in channel) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment