diff options
Diffstat (limited to 'mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt')
-rw-r--r-- | mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt index 0cf6340..ca879ef 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2018 Allan Wang + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ca.allanwang.kau.mediapicker import android.app.Activity @@ -15,14 +30,17 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.typeface.IIcon import java.io.File - /** * Created by Allan Wang on 2017-08-17. */ class MediaActionItem( - val action: MediaAction, - val mediaType: MediaType -) : KauIItem<MediaActionItem, MediaItemBasic.ViewHolder>(R.layout.kau_iitem_image_basic, { MediaItemBasic.ViewHolder(it) }, R.id.kau_item_media_action) { + val action: MediaAction, + val mediaType: MediaType +) : KauIItem<MediaActionItem, MediaItemBasic.ViewHolder>( + R.layout.kau_iitem_image_basic, + { MediaItemBasic.ViewHolder(it) }, + R.id.kau_item_media_action +) { override fun isSelectable(): Boolean = false @@ -60,7 +78,7 @@ internal const val MEDIA_ACTION_REQUEST_PICKER = 101 * If you just wish to use videos, see [MediaActionCameraVideo] */ abstract class MediaActionCamera( - override var color: Int = MediaPickerCore.accentColor + override var color: Int = MediaPickerCore.accentColor ) : MediaAction { abstract fun createFile(context: Context): File @@ -105,7 +123,7 @@ abstract class MediaActionCamera( * Basic camera action just for videos */ class MediaActionCameraVideo( - override var color: Int = MediaPickerCore.accentColor + override var color: Int = MediaPickerCore.accentColor ) : MediaAction { override fun iicon(item: MediaActionItem) = GoogleMaterial.Icon.gmd_videocam override operator fun invoke(c: Context, item: MediaActionItem) { @@ -126,8 +144,8 @@ class MediaActionCameraVideo( * The type will be added programmatically */ class MediaActionGallery( - val multiple: Boolean = false, - override var color: Int = MediaPickerCore.accentColor + val multiple: Boolean = false, + override var color: Int = MediaPickerCore.accentColor ) : MediaAction { override fun iicon(item: MediaActionItem) = when (item.mediaType) { @@ -144,9 +162,10 @@ class MediaActionGallery( putExtra(Intent.EXTRA_ALLOW_MULTIPLE, multiple) } (c as Activity).startActivityForResult( - Intent.createChooser(intent, c.string(R.string.kau_select_media)), - MEDIA_ACTION_REQUEST_PICKER) + Intent.createChooser(intent, c.string(R.string.kau_select_media)), + MEDIA_ACTION_REQUEST_PICKER + ) } } } -}
\ No newline at end of file +} |