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 --- sample/src/main/AndroidManifest.xml | 10 ++++++++-- .../main/kotlin/ca/allanwang/kau/sample/ImagePicker.kt | 13 +++++++++---- .../kotlin/ca/allanwang/kau/sample/MainActivity.kt | 17 ++++++++--------- sample/src/main/res/values/strings.xml | 4 ++-- sample/src/main/res/xml/kau_changelog.xml | 18 ++++++++++++++++++ 5 files changed, 45 insertions(+), 17 deletions(-) (limited to 'sample/src') diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 85fb199..a3bbf45 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -30,10 +30,16 @@ android:theme="@style/Kau.About" /> + android:theme="@style/Kau.MediaPicker" /> + android:theme="@style/Kau.MediaPicker.Overlay" /> + + 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") } } } diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml index c64b623..11a897a 100644 --- a/sample/src/main/res/values/strings.xml +++ b/sample/src/main/res/values/strings.xml @@ -19,8 +19,8 @@ Press this to view the next subset of preferences your.email@here.com Your subject - Gallery Showcase - Gallery Overlay Showcase + Image Showcase + Video Overlay Showcase Adapter Showcase KAU (Kotlin Android Utils) is a collection of common extension functions and complex UIs that can be used in almost all apps. It is meant to implement the shared components, so you can focus on what makes your app unique. diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index cfb8bd1..b7bb8e4 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -6,6 +6,24 @@ --> + + + + + + + + + + + + + + + + + + -- cgit v1.2.3