diff options
author | Allan Wang <me@allanwang.ca> | 2017-08-18 14:39:40 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-08-30 12:24:19 -0400 |
commit | a101b528efdee74fc1970b7f1fe68263f0b20269 (patch) | |
tree | 8fbd0fea544ec543cdf5ea2b74d81099d4ebd554 /sample/src/main/kotlin/ca/allanwang | |
parent | 9432652b03ae4d01e3dda4325984637d9523b9e2 (diff) | |
download | kau-a101b528efdee74fc1970b7f1fe68263f0b20269.tar.gz kau-a101b528efdee74fc1970b7f1fe68263f0b20269.tar.bz2 kau-a101b528efdee74fc1970b7f1fe68263f0b20269.zip |
Create media picker action items (#40)
* Create action items
* Increment version
* Update camera action
* Abstract camera action
* Add and test
* Refactor and add docs
Diffstat (limited to 'sample/src/main/kotlin/ca/allanwang')
-rw-r--r-- | sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 4 | ||||
-rw-r--r-- | sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt | 26 |
2 files changed, 23 insertions, 7 deletions
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 5d0bd36..09002d4 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -169,6 +169,10 @@ class MainActivity : KPrefActivity() { onClick = { _, _, _ -> startActivityWithEdge(SWIPE_EDGE_LEFT); false } } + plainText(R.string.image_showcase) { + onClick = { _, _, _ -> kauLaunchMediaPicker(ImagePickerActivity::class.java, REQUEST_MEDIA); false } + } + plainText(R.string.video_overlay_showcase) { onClick = { _, _, _ -> kauLaunchMediaPicker(VideoPickerActivityOverlay::class.java, REQUEST_MEDIA); false } } diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt index 7aac0ef..618ca07 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt @@ -1,16 +1,28 @@ package ca.allanwang.kau.sample -import ca.allanwang.kau.mediapicker.MediaPickerActivityBase -import ca.allanwang.kau.mediapicker.MediaPickerActivityOverlayBase -import ca.allanwang.kau.mediapicker.MediaType +import android.content.Context +import android.net.Uri +import android.support.v4.content.FileProvider +import ca.allanwang.kau.mediapicker.* +import java.io.File /** * Created by Allan Wang on 2017-07-23. */ -class ImagePickerActivity : MediaPickerActivityBase(MediaType.IMAGE) +private fun actions(multiple: Boolean) = listOf(object : MediaActionCamera() { -class ImagePickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.IMAGE) + override fun createFile(context: Context): File + = createMediaFile("KAU", ".jpg") -class VideoPickerActivity : MediaPickerActivityBase(MediaType.VIDEO) + override fun createUri(context: Context, file: File): Uri + = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file) -class VideoPickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.VIDEO)
\ No newline at end of file +}, MediaActionGallery(multiple)) + +class ImagePickerActivity : MediaPickerActivityBase(MediaType.IMAGE, actions(true)) + +class ImagePickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.IMAGE, actions(false)) + +class VideoPickerActivity : MediaPickerActivityBase(MediaType.VIDEO, actions(true)) + +class VideoPickerActivityOverlay : MediaPickerActivityOverlayBase(MediaType.VIDEO, actions(false))
\ No newline at end of file |