Skip to content
Snippets Groups Projects
Commit 4b8ff286 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Adapters: abort binding when job is cancelled

parent c5a45215
No related branches found
No related tags found
No related merge requests found
Pipeline #10664 passed with stage
in 3 minutes and 53 seconds
......@@ -58,6 +58,7 @@ internal class StorageBrowserAdapter(fragment: StorageBrowserFragment) : BaseBro
if (!storagePath.endsWith("/")) storagePath += "/"
vh.binding.item = storage
updateJob?.join()
if (updateJob?.isCancelled == true) return@launch
val hasContextMenu = customDirsLocation.contains(storagePath)
val checked = (fragment as StorageBrowserFragment).scannedDirectory || mediaDirsLocation.containsPath(storagePath)
vh.binding.hasContextMenu = hasContextMenu
......@@ -87,7 +88,7 @@ internal class StorageBrowserAdapter(fragment: StorageBrowserFragment) : BaseBro
suspend fun updateListState(context: Context) {
updateMediaDirs(context)
updateJob?.join()
notifyItemRangeChanged(0, itemCount)
if (updateJob?.isCancelled == false) notifyItemRangeChanged(0, itemCount)
}
fun updateMediaDirs(context: Context) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment