aboutsummaryrefslogtreecommitdiff
path: root/mediapicker/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'mediapicker/src/main/kotlin')
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt11
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt2
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt2
3 files changed, 9 insertions, 6 deletions
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
index c3b6396..464c85e 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
@@ -48,14 +48,16 @@ abstract class MediaPickerActivityBase(
initializeRecycler(recycler)
- MediaItem.bindEvents(adapter)
- adapter.withSelectionListener({ _, _ -> selectionCount.text = adapter.selections.size.toString() })
+ MediaItem.bindEvents(adapter.fastAdapter)
+ adapter.fastAdapter.withSelectionListener { _, _ ->
+ selectionCount.text = adapter.fastAdapter.selections.size.toString()
+ }
fab.apply {
show()
setIcon(GoogleMaterial.Icon.gmd_send)
setOnClickListener {
- val selection = adapter.selectedItems
+ val selection = adapter.fastAdapter.selectedItems
if (selection.isEmpty()) {
toast(R.string.kau_no_items_selected)
} else {
@@ -88,7 +90,8 @@ abstract class MediaPickerActivityBase(
override fun onLoadFinished(loader: Loader<Cursor>?, data: Cursor?) {
super.onLoadFinished(loader, data)
- setToolbarScrollable((recycler.layoutManager as LinearLayoutManager).findLastCompletelyVisibleItemPosition() < adapter.getItemCount() - 1)
+ setToolbarScrollable((recycler.layoutManager as LinearLayoutManager)
+ .findLastCompletelyVisibleItemPosition() < adapter.adapterItemCount - 1)
}
override fun onStatusChange(loaded: Boolean) {
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt
index 67f9577..9516eab 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt
@@ -29,7 +29,7 @@ abstract class MediaPickerActivityOverlayBase(
super.onCreate(savedInstanceState)
setContentView(R.layout.kau_activity_image_picker_overlay)
initializeRecycler(recycler)
- MediaItemBasic.bindEvents(this, adapter)
+ MediaItemBasic.bindEvents(this, adapter.fastAdapter)
draggable.addExitListener(this, R.transition.kau_image_exit_bottom, R.transition.kau_image_exit_top)
draggable.setOnClickListener { finishAfterTransition() }
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 9bab4c4..af90fdc 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
@@ -109,7 +109,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
private var hasPreloaded = false
private var prefetcher: Future<*>? = null
- val adapter = FastItemAdapter<T>()
+ val adapter = ItemAdapter<T>()
/**
* Further improve preloading by extending the layout space