aboutsummaryrefslogtreecommitdiff
path: root/mediapicker/src/main/kotlin/ca
diff options
context:
space:
mode:
Diffstat (limited to 'mediapicker/src/main/kotlin/ca')
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt13
1 files changed, 7 insertions, 6 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 ec5d2f0..9bab4c4 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
@@ -18,6 +18,7 @@ import android.support.v4.content.CursorLoader
import android.support.v4.content.Loader
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.RecyclerView
+import ca.allanwang.kau.adapters.fastAdapter
import ca.allanwang.kau.animators.FadeScaleAnimatorAdd
import ca.allanwang.kau.animators.KauAnimator
import ca.allanwang.kau.internal.KauBaseActivity
@@ -29,7 +30,7 @@ import ca.allanwang.kau.utils.toast
import com.bumptech.glide.Glide
import com.bumptech.glide.RequestManager
import com.mikepenz.fastadapter.IItem
-import com.mikepenz.fastadapter.adapters.HeaderAdapter
+import com.mikepenz.fastadapter.adapters.ItemAdapter
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.mikepenz.iconics.IconicsDrawable
@@ -108,7 +109,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
private var hasPreloaded = false
private var prefetcher: Future<*>? = null
- val adapter: FastItemAdapter<T> = FastItemAdapter()
+ val adapter = FastItemAdapter<T>()
/**
* Further improve preloading by extending the layout space
@@ -121,9 +122,9 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
}
fun initializeRecycler(recycler: RecyclerView) {
- val adapterWrapper = HeaderAdapter<MediaActionItem>()
- adapterWrapper.wrap(adapter)
- adapterWrapper.add(mediaActions.map { MediaActionItem(it, mediaType) })
+ val adapterHeader = ItemAdapter<MediaActionItem>()
+ val fulladapter = fastAdapter(adapterHeader, adapter)
+ adapterHeader.add(mediaActions.map { MediaActionItem(it, mediaType) })
recycler.apply {
val manager = object : GridLayoutManager(context, computeColumnCount(context)) {
override fun getExtraLayoutSpace(state: RecyclerView.State?): Int {
@@ -133,7 +134,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
setItemViewCacheSize(CACHE_SIZE)
isDrawingCacheEnabled = true
layoutManager = manager
- adapter = adapterWrapper
+ adapter = fulladapter
setHasFixedSize(true)
itemAnimator = KauAnimator(FadeScaleAnimatorAdd(0.8f))
}