From 84b9d3b40e342dc7715c5af13d102bb98529b0fb Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 2 Aug 2017 16:42:06 -0700 Subject: Internalize prefetching and update changelog (#18) --- .../src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'mediapicker/src/main/kotlin/ca') diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt index ee3481d..71449d3 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt @@ -35,9 +35,7 @@ import java.util.concurrent.Future * * Container for the main logic behind the both pickers */ -abstract class MediaPickerCore>( - val mediaType: MediaType, val preload: Boolean = mediaType == MediaType.VIDEO -) : KauBaseActivity(), LoaderManager.LoaderCallbacks { +abstract class MediaPickerCore>(val mediaType: MediaType) : KauBaseActivity(), LoaderManager.LoaderCallbacks { companion object { val viewSize = lazyContext { computeViewSize(it) } @@ -158,7 +156,7 @@ abstract class MediaPickerCore>( models.add(model) } while (data.moveToNext()) addItems(models.map { converter(it) }) - if (!hasPreloaded && preload) { + if (!hasPreloaded && mediaType == MediaType.VIDEO) { hasPreloaded = true prefetcher = doAsync { models.subList(0, Math.min(models.size, 50)).map { it.data }.forEach { -- cgit v1.2.3