aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main/kotlin/ca
diff options
context:
space:
mode:
Diffstat (limited to 'sample/src/main/kotlin/ca')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/ImagePicker.kt13
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt17
2 files changed, 17 insertions, 13 deletions
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")
}
}
}