aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-02 16:42:06 -0700
committerGitHub <noreply@github.com>2017-08-02 16:42:06 -0700
commit84b9d3b40e342dc7715c5af13d102bb98529b0fb (patch)
tree2b753b693407f338db5f4647b3b60e591630a963
parent53382b44bb7ab7ccb559e96fd1f93c47020878ee (diff)
downloadkau-84b9d3b40e342dc7715c5af13d102bb98529b0fb.tar.gz
kau-84b9d3b40e342dc7715c5af13d102bb98529b0fb.tar.bz2
kau-84b9d3b40e342dc7715c5af13d102bb98529b0fb.zip
Internalize prefetching and update changelog (#18)3.2.2
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt6
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml2
2 files changed, 4 insertions, 4 deletions
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<T : IItem<*, *>>(
- val mediaType: MediaType, val preload: Boolean = mediaType == MediaType.VIDEO
-) : KauBaseActivity(), LoaderManager.LoaderCallbacks<Cursor> {
+abstract class MediaPickerCore<T : IItem<*, *>>(val mediaType: MediaType) : KauBaseActivity(), LoaderManager.LoaderCallbacks<Cursor> {
companion object {
val viewSize = lazyContext { computeViewSize(it) }
@@ -158,7 +156,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
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 {
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index 615f467..db6a504 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -10,8 +10,10 @@
<item text=":core: Add simple KauBaseActivity so that activities extending AppCompatActivity can have some default kau helpers implemented" />
<item text=":core: The permission manager will now notify you if you try to request a permission that isn\'t added to your manifest" />
<item text=":core: Create faq parser" />
+ <item text=":mediapicker: Allow for prefetching by default for videos" />
<item text="Begin writing android tests" />
<item text="" />
+ <item text="" />
<version title="v3.2.1"/>
<item text=":core: Remove requestLayout call from setMargin and setPadding" />