Skip to content

Commit

Permalink
Internalize prefetching and update changelog (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanWang authored Aug 2, 2017
1 parent 53382b4 commit 84b9d3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions sample/src/main/res/xml/kau_changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<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"/>
Expand Down

0 comments on commit 84b9d3b

Please sign in to comment.