diff options
Diffstat (limited to 'mediapicker/src')
3 files changed, 25 insertions, 20 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 fe25d97..0bd240b 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt @@ -54,10 +54,10 @@ abstract class MediaPickerActivityBase( private fun KauActivityImagePickerBinding.init() { kauSelectionCount.setCompoundDrawables( - null, - null, - GoogleMaterial.Icon.gmd_image.toDrawable(this@MediaPickerActivityBase, 18), - null + null, + null, + GoogleMaterial.Icon.gmd_image.toDrawable(this@MediaPickerActivityBase, 18), + null ) setSupportActionBar(kauToolbar) @@ -65,10 +65,10 @@ abstract class MediaPickerActivityBase( setDisplayHomeAsUpEnabled(true) setDisplayShowHomeEnabled(true) setHomeAsUpIndicator( - GoogleMaterial.Icon.gmd_close.toDrawable( - this@MediaPickerActivityBase, - 18 - ) + GoogleMaterial.Icon.gmd_close.toDrawable( + this@MediaPickerActivityBase, + 18 + ) ) } kauToolbar.setNavigationOnClickListener { onBackPressed() } @@ -117,7 +117,7 @@ abstract class MediaPickerActivityBase( val params = kauToolbar.layoutParams as AppBarLayout.LayoutParams if (scrollable) { params.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS or - AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL + AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL } else { params.scrollFlags = 0 } @@ -126,8 +126,8 @@ abstract class MediaPickerActivityBase( override fun onLoadFinished(loader: Loader<Cursor>, data: Cursor?) { super.onLoadFinished(loader, data) binding.setToolbarScrollable( - (binding.kauRecyclerview.layoutManager as LinearLayoutManager) - .findLastCompletelyVisibleItemPosition() < adapter.adapterItemCount - 1 + (binding.kauRecyclerview.layoutManager as LinearLayoutManager) + .findLastCompletelyVisibleItemPosition() < adapter.adapterItemCount - 1 ) } diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt index ac43f9f..ca6122b 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt @@ -35,10 +35,13 @@ import com.bumptech.glide.request.RequestOptions * Image picker launchers */ inline fun <reified T : MediaPickerCore<*>> Activity.kauLaunchMediaPicker(requestCode: Int) { - startActivityForResult<T>(requestCode, bundleBuilder = { - if (MediaPickerActivityOverlayBase::class.java.isAssignableFrom(T::class.java)) - withSceneTransitionAnimation(this@kauLaunchMediaPicker) - }) + startActivityForResult<T>( + requestCode, + bundleBuilder = { + if (MediaPickerActivityOverlayBase::class.java.isAssignableFrom(T::class.java)) + withSceneTransitionAnimation(this@kauLaunchMediaPicker) + } + ) } /** 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 e65cab2..4b0e9d6 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt @@ -50,9 +50,9 @@ import com.mikepenz.fastadapter.adapters.ItemAdapter import com.mikepenz.iconics.dsl.iconicsDrawable import com.mikepenz.iconics.typeface.IIcon import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import kotlinx.coroutines.CancellationException import java.io.File import kotlin.math.min -import kotlinx.coroutines.CancellationException /** * Created by Allan Wang on 2017-07-23. @@ -324,11 +324,13 @@ abstract class MediaPickerCore<T : GenericItem>( } else if (data != null) { val clip = data.clipData if (clip != null) { - items.addAll((0 until clip.itemCount).map { - clip.getItemAt(it).uri.apply { - KL.v { "Media picker clip uri $path" } + items.addAll( + (0 until clip.itemCount).map { + clip.getItemAt(it).uri.apply { + KL.v { "Media picker clip uri $path" } + } } - }) + ) } } if (items.isEmpty()) return KL.d { "Media picker empty intent" } |