From 48213d0b427c478865c75fee912ff1ae8bbaffb5 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 31 Jul 2017 23:02:01 -0700 Subject: Major update to core and kotterknife; create mediapicker (#15) * Readme * Fix kau direction bits * Truly support transparent ripples * Update changelog * Test rect as base * Replace fab transition with generic fade scale transition * Add scalexy func * Add scaleXY * Add arguments to fadeScaleTransition * Clean up ink indicator * Create setOnSingleTapListener * Fix lint and add rndColor * Create kotterknife resettables * Add readme and missing object * Create lazy resettable registered * Update core docs * Opt for separate class for resettable registry * Clean up resettable registry * Rename functions * Add ripple callback listener * Adjust kprefactivity desc color * Add more transitions * Add delete keys option * Add instrumentation tests * switch id * Revert automatic instrumental tests * Generify imagepickercore and prepare video alternative * Create working video picker * Address possible null issue * Update searchview * Make layouts public * Add changelog test * Update logo link * Add custom color gif --- .../main/kotlin/ca/allanwang/kau/sample/ImagePicker.kt | 13 +++++++++---- .../main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 17 ++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'sample/src/main/kotlin/ca') diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePicker.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePicker.kt index c7f28bc..eebc5ca 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePicker.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePicker.kt @@ -1,11 +1,16 @@ package ca.allanwang.kau.sample -import ca.allanwang.kau.imagepicker.ImagePickerActivityBase -import ca.allanwang.kau.imagepicker.ImagePickerActivityOverlayBase +import ca.allanwang.kau.imagepicker.MediaPickerActivityBase +import ca.allanwang.kau.imagepicker.MediaPickerActivityOverlayBase +import ca.allanwang.kau.imagepicker.MediaType /** * Created by Allan Wang on 2017-07-23. */ -class ImagePickerActivity : ImagePickerActivityBase() +class ImagePickerActivity : MediaPickerActivityBase(MediaType.IMAGE) -class ImagePickerActivityOverlay : ImagePickerActivityOverlayBase() \ No newline at end of file +class ImagePickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.IMAGE) + +class VideoPickerActivity : MediaPickerActivityBase(MediaType.VIDEO) + +class VideoPickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.VIDEO) \ No newline at end of file diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index 7ce10af..0cc41fb 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -2,13 +2,12 @@ package ca.allanwang.kau.sample import android.content.Intent import android.os.Bundle -import android.os.PersistableBundle import android.view.Menu import android.view.MenuItem import ca.allanwang.kau.about.kauLaunchAbout import ca.allanwang.kau.email.sendEmail -import ca.allanwang.kau.imagepicker.kauLaunchImagePicker -import ca.allanwang.kau.imagepicker.kauOnImagePickerResult +import ca.allanwang.kau.imagepicker.kauLaunchMediaPicker +import ca.allanwang.kau.imagepicker.kauOnMediaPickerResult import ca.allanwang.kau.kpref.activity.CoreAttributeContract import ca.allanwang.kau.kpref.activity.KPrefActivity import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder @@ -78,7 +77,7 @@ class MainActivity : KPrefActivity() { "fill", "table", "east", "travel", "weight", "less", "language", "morning", "among") } - const val REQUEST_IMAGE = 27 + const val REQUEST_MEDIA = 27 } override fun kPrefCoreAttributes(): CoreAttributeContract.() -> Unit = { @@ -164,12 +163,12 @@ class MainActivity : KPrefActivity() { descRes = R.string.sub_item_desc } - plainText(R.string.gallery_showcase) { - onClick = { _, _, _ -> kauLaunchImagePicker(ImagePickerActivity::class.java, REQUEST_IMAGE); false } + plainText(R.string.image_showcase) { + onClick = { _, _, _ -> kauLaunchMediaPicker(ImagePickerActivity::class.java, REQUEST_MEDIA); false } } - plainText(R.string.gallery_overlay_showcase) { - onClick = { _, _, _ -> kauLaunchImagePicker(ImagePickerActivityOverlay::class.java, REQUEST_IMAGE); false } + plainText(R.string.video_overlay_showcase) { + onClick = { _, _, _ -> kauLaunchMediaPicker(VideoPickerActivityOverlay::class.java, REQUEST_MEDIA); false } } plainText(R.string.adapter_showcase) { @@ -251,7 +250,7 @@ class MainActivity : KPrefActivity() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when (requestCode) { - REQUEST_IMAGE -> toast("${kauOnImagePickerResult(resultCode, data).size} images selected") + REQUEST_MEDIA -> toast("${kauOnMediaPickerResult(resultCode, data).size} items selected") } } } -- cgit v1.2.3