From 637851b6ddc4a22583797a45bdbb72eb9c6dac23 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 9 Nov 2017 01:54:02 -0500 Subject: misc (#97) * Update translators * Increase debounce test interval * Clean unnecessary adapter files * Update fastadapter * Add fastadapter helper method * Remove external method * Add better wrap * Add more helpers --- .../kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'mediapicker/src/main/kotlin/ca/allanwang') 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>( private var hasPreloaded = false private var prefetcher: Future<*>? = null - val adapter: FastItemAdapter = FastItemAdapter() + val adapter = FastItemAdapter() /** * Further improve preloading by extending the layout space @@ -121,9 +122,9 @@ abstract class MediaPickerCore>( } fun initializeRecycler(recycler: RecyclerView) { - val adapterWrapper = HeaderAdapter() - adapterWrapper.wrap(adapter) - adapterWrapper.add(mediaActions.map { MediaActionItem(it, mediaType) }) + val adapterHeader = ItemAdapter() + 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>( setItemViewCacheSize(CACHE_SIZE) isDrawingCacheEnabled = true layoutManager = manager - adapter = adapterWrapper + adapter = fulladapter setHasFixedSize(true) itemAnimator = KauAnimator(FadeScaleAnimatorAdd(0.8f)) } -- cgit v1.2.3