diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-18 14:45:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 14:45:22 -0800 |
commit | 4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d (patch) | |
tree | 859d3dc7021d31f807c5ad90ddea31f711fa793d /mediapicker/src/main | |
parent | e2ac8e3e82b842ea05c8c7a2c92d566553d8ea91 (diff) | |
parent | a9b8b69ab5e053e9106a98564e3a4047628387d6 (diff) | |
download | kau-4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d.tar.gz kau-4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d.tar.bz2 kau-4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d.zip |
Merge pull request #270 from AllanWang/versions6.4.0
Diffstat (limited to 'mediapicker/src/main')
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" } |