mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-26 22:20:24 +00:00
SeekDataProvider: add yields to make thumbnail-generation cancelable
This commit is contained in:
parent
50815021a5
commit
f677668746
1 changed files with 3 additions and 0 deletions
|
@ -19,6 +19,7 @@ import kotlinx.coroutines.cancel
|
|||
import kotlinx.coroutines.cancelAndJoin
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.yield
|
||||
|
||||
class ChaosflixSeekDataProvider(
|
||||
val context: Context,
|
||||
|
@ -71,11 +72,13 @@ class ChaosflixSeekDataProvider(
|
|||
dummyThumbnails[positions[i]] = dummyThumbnail
|
||||
}
|
||||
}
|
||||
yield()
|
||||
Log.d(TAG, "Added Dummy-Thumbs")
|
||||
for (i in positions.indices) {
|
||||
if (!thumbnails.containsKey(positions[i])) {
|
||||
val bitmap = createBitmapForIndex(i)
|
||||
thumbnails[positions[i]] = bitmap
|
||||
yield()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue