aboutsummaryrefslogtreecommitdiff
path: root/mediapicker
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-06-07 12:41:00 -0400
committerAllan Wang <me@allanwang.ca>2019-06-07 12:41:00 -0400
commit5d86d9089697b152192b2786fbe0c708dd8b5e2b (patch)
tree99b563b8c234330d2bbbc0145f086d8691ee9376 /mediapicker
parent572d470a2677eec0405a7b16ab9a2cfb954d6832 (diff)
parent879ac366074697dd0a7fbb2c3d99a48d7aeeb22d (diff)
downloadkau-5d86d9089697b152192b2786fbe0c708dd8b5e2b.tar.gz
kau-5d86d9089697b152192b2786fbe0c708dd8b5e2b.tar.bz2
kau-5d86d9089697b152192b2786fbe0c708dd8b5e2b.zip
Merge dev
Diffstat (limited to 'mediapicker')
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.kt29
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/GlideHelper.kt17
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt47
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt81
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt71
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt68
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt37
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt23
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt25
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt80
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaType.kt47
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt33
-rw-r--r--mediapicker/src/main/res/layout-v21/kau_activity_image_picker_overlay.xml2
-rw-r--r--mediapicker/src/main/res/layout/kau_activity_image_picker.xml16
-rw-r--r--mediapicker/src/main/res/values-da-rDK/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-de-rDE/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-es-rES/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-fr-rFR/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-gl-rES/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-hu-rHU/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-in-rID/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-it-rIT/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-ko-rKR/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-nl-rNL/strings_mediapicker.xml11
-rw-r--r--mediapicker/src/main/res/values-no-rNO/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-pl-rPL/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-pt-rBR/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-pt-rPT/strings_mediapicker.xml11
-rw-r--r--mediapicker/src/main/res/values-sr-rSP/strings_mediapicker.xml11
-rw-r--r--mediapicker/src/main/res/values-sv-rSE/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-th-rTH/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-tr-rTR/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-uk-rUA/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-vi-rVN/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-zh-rCN/strings_mediapicker.xml3
-rw-r--r--mediapicker/src/main/res/values-zh-rTW/strings_mediapicker.xml11
36 files changed, 477 insertions, 197 deletions
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.kt
index f1e32d1..739bf47 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.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.content.Context
@@ -8,7 +23,11 @@ import android.widget.FrameLayout
import android.widget.ImageView
import ca.allanwang.kau.ui.views.MeasureSpecContract
import ca.allanwang.kau.ui.views.MeasureSpecDelegate
-import ca.allanwang.kau.utils.*
+import ca.allanwang.kau.utils.inflate
+import ca.allanwang.kau.utils.scaleXY
+import ca.allanwang.kau.utils.setBackgroundColorRes
+import ca.allanwang.kau.utils.setIcon
+import ca.allanwang.kau.utils.visible
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import jp.wasabeef.blurry.internal.BlurFactor
import jp.wasabeef.blurry.internal.BlurTask
@@ -24,7 +43,9 @@ import kotlinx.android.synthetic.main.kau_blurred_imageview.view.*
* The foreground by default contains a white checkmark, but can be customized or hidden depending on the situation
*/
class BlurredImageView @JvmOverloads constructor(
- context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr), MeasureSpecContract by MeasureSpecDelegate() {
private var blurred = false
@@ -51,7 +72,6 @@ class BlurredImageView @JvmOverloads constructor(
private fun View.scaleAnimate(scale: Float) = animate().scaleXY(scale).setDuration(ANIMATION_DURATION)
private fun View.alphaAnimate(alpha: Float) = animate().alpha(alpha).setDuration(ANIMATION_DURATION)
-
fun isBlurred(): Boolean {
return blurred
}
@@ -104,7 +124,6 @@ class BlurredImageView @JvmOverloads constructor(
image_foreground.alphaAnimate(0f).start()
}
-
/**
* Clear all animations and unblur the image
*/
@@ -154,4 +173,4 @@ class BlurredImageView @JvmOverloads constructor(
action(image_blur)
action(image_foreground)
}
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/GlideHelper.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/GlideHelper.kt
index 8bb341c..21a1e9d 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/GlideHelper.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/GlideHelper.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.view.View
@@ -15,4 +30,4 @@ internal interface GlideContract {
internal class GlideDelegate : GlideContract {
override fun glide(v: View) = ((v.context as? MediaPickerCore<*>)?.glide ?: Glide.with(v))!!
-} \ No newline at end of file
+}
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..1941ec0 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
@@ -78,7 +96,7 @@ abstract class MediaActionCamera(
if (intent.resolveActivity(c.packageManager) == null) {
c.materialDialog {
title(R.string.kau_no_camera_found)
- content(R.string.kau_no_camera_found_content)
+ message(R.string.kau_no_camera_found_content)
}
return@kauRequestPermissions
}
@@ -88,7 +106,7 @@ abstract class MediaActionCamera(
} catch (e: java.io.IOException) {
c.materialDialog {
title(R.string.kau_error)
- content(R.string.kau_temp_file_creation_failed)
+ message(R.string.kau_temp_file_creation_failed)
}
return@kauRequestPermissions
}
@@ -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) {
@@ -113,7 +131,7 @@ class MediaActionCameraVideo(
if (intent.resolveActivity(c.packageManager) == null) {
c.materialDialog {
title(R.string.kau_no_camera_found)
- content(R.string.kau_no_camera_found_content)
+ message(R.string.kau_no_camera_found_content)
}
return
}
@@ -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
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt
index c0b7e2d..5d3e7b9 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt
@@ -1,8 +1,23 @@
+/*
+ * 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.graphics.drawable.Drawable
-import android.support.v7.widget.RecyclerView
import android.view.View
+import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.iitems.KauIItem
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
@@ -13,22 +28,23 @@ import com.mikepenz.fastadapter.FastAdapter
/**
* Created by Allan Wang on 2017-07-04.
*/
-class MediaItem(val data: MediaModel)
- : KauIItem<MediaItem, MediaItem.ViewHolder>(R.layout.kau_iitem_image, { ViewHolder(it) }), GlideContract by GlideDelegate() {
+class MediaItem(val data: MediaModel) :
+ KauIItem<MediaItem, MediaItem.ViewHolder>(R.layout.kau_iitem_image, { ViewHolder(it) }),
+ GlideContract by GlideDelegate() {
private var failedToLoad = false
companion object {
fun bindEvents(fastAdapter: FastAdapter<MediaItem>) {
fastAdapter.withMultiSelect(true)
- .withSelectable(true)
- //adapter selector occurs before the on click event
- .withOnClickListener { v, _, item, _ ->
- val image = v as BlurredImageView
- if (item.isSelected) image.blur()
- else image.removeBlur()
- true
- }
+ .withSelectable(true)
+ //adapter selector occurs before the on click event
+ .withOnClickListener { v, _, item, _ ->
+ val image = v as BlurredImageView
+ if (item.isSelected) image.blur()
+ else image.removeBlur()
+ true
+ }
}
}
@@ -37,22 +53,33 @@ class MediaItem(val data: MediaModel)
override fun bindView(holder: ViewHolder, payloads: List<Any>) {
super.bindView(holder, payloads)
glide(holder.itemView)
- .load(data.data)
- .applyMediaOptions(holder.itemView.context)
- .listener(object : RequestListener<Drawable> {
- override fun onLoadFailed(e: GlideException?, model: Any, target: Target<Drawable>, isFirstResource: Boolean): Boolean {
- failedToLoad = true
- holder.container.imageBase.setImageDrawable(MediaPickerCore.getErrorDrawable(holder.itemView.context))
- return true
- }
+ .load(data.data)
+ .applyMediaOptions(holder.itemView.context)
+ .listener(object : RequestListener<Drawable> {
+ override fun onLoadFailed(
+ e: GlideException?,
+ model: Any,
+ target: Target<Drawable>,
+ isFirstResource: Boolean
+ ): Boolean {
+ failedToLoad = true
+ holder.container.imageBase.setImageDrawable(MediaPickerCore.getErrorDrawable(holder.itemView.context))
+ return true
+ }
- override fun onResourceReady(resource: Drawable, model: Any, target: Target<Drawable>, dataSource: DataSource, isFirstResource: Boolean): Boolean {
- holder.container.imageBase.setImageDrawable(resource)
- if (isSelected) holder.container.blurInstantly()
- return true
- }
- })
- .into(holder.container.imageBase)
+ override fun onResourceReady(
+ resource: Drawable,
+ model: Any,
+ target: Target<Drawable>,
+ dataSource: DataSource,
+ isFirstResource: Boolean
+ ): Boolean {
+ holder.container.imageBase.setImageDrawable(resource)
+ if (isSelected) holder.container.blurInstantly()
+ return true
+ }
+ })
+ .into(holder.container.imageBase)
}
override fun unbindView(holder: ViewHolder) {
@@ -65,4 +92,4 @@ class MediaItem(val data: MediaModel)
class ViewHolder(v: View) : RecyclerView.ViewHolder(v) {
val container: BlurredImageView = v.findViewById(R.id.kau_image)
}
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt
index 59202c0..73647b8 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt
@@ -1,10 +1,25 @@
+/*
+ * 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.annotation.SuppressLint
import android.app.Activity
import android.graphics.drawable.Drawable
-import android.support.v7.widget.RecyclerView
import android.view.View
+import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.iitems.KauIItem
import ca.allanwang.kau.ui.views.MeasuredImageView
import com.bumptech.glide.load.DataSource
@@ -16,18 +31,19 @@ import com.mikepenz.fastadapter.FastAdapter
/**
* Created by Allan Wang on 2017-07-04.
*/
-class MediaItemBasic(val data: MediaModel)
- : KauIItem<MediaItem, MediaItemBasic.ViewHolder>(R.layout.kau_iitem_image_basic, { ViewHolder(it) }), GlideContract by GlideDelegate() {
+class MediaItemBasic(val data: MediaModel) :
+ KauIItem<MediaItem, MediaItemBasic.ViewHolder>(R.layout.kau_iitem_image_basic, { ViewHolder(it) }),
+ GlideContract by GlideDelegate() {
companion object {
@SuppressLint("NewApi")
fun bindEvents(activity: Activity, fastAdapter: FastAdapter<MediaItemBasic>) {
fastAdapter.withSelectable(false)
- //add image data and return right away
- .withOnClickListener { _, _, item, _ ->
- activity.finish(arrayListOf(item.data))
- true
- }
+ //add image data and return right away
+ .withOnClickListener { _, _, item, _ ->
+ activity.finish(arrayListOf(item.data))
+ true
+ }
}
}
@@ -36,19 +52,30 @@ class MediaItemBasic(val data: MediaModel)
override fun bindView(holder: ViewHolder, payloads: List<Any>) {
super.bindView(holder, payloads)
glide(holder.itemView)
- .load(data.data)
- .applyMediaOptions(holder.itemView.context)
- .listener(object : RequestListener<Drawable> {
- override fun onLoadFailed(e: GlideException?, model: Any, target: Target<Drawable>, isFirstResource: Boolean): Boolean {
- holder.image.setImageDrawable(MediaPickerCore.getErrorDrawable(holder.itemView.context))
- return true
- }
-
- override fun onResourceReady(resource: Drawable, model: Any, target: Target<Drawable>, dataSource: DataSource, isFirstResource: Boolean): Boolean {
- return false
- }
- })
- .into(holder.image)
+ .load(data.data)
+ .applyMediaOptions(holder.itemView.context)
+ .listener(object : RequestListener<Drawable> {
+ override fun onLoadFailed(
+ e: GlideException?,
+ model: Any,
+ target: Target<Drawable>,
+ isFirstResource: Boolean
+ ): Boolean {
+ holder.image.setImageDrawable(MediaPickerCore.getErrorDrawable(holder.itemView.context))
+ return true
+ }
+
+ override fun onResourceReady(
+ resource: Drawable,
+ model: Any,
+ target: Target<Drawable>,
+ dataSource: DataSource,
+ isFirstResource: Boolean
+ ): Boolean {
+ return false
+ }
+ })
+ .into(holder.image)
}
override fun unbindView(holder: ViewHolder) {
@@ -59,4 +86,4 @@ class MediaItemBasic(val data: MediaModel)
class ViewHolder(v: View) : RecyclerView.ViewHolder(v) {
val image: MeasuredImageView = v.findViewById(R.id.kau_image)
}
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt
index 26736d4..edd6199 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaModel.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.database.Cursor
@@ -6,41 +21,45 @@ import android.net.Uri
import android.os.Parcel
import android.os.Parcelable
import android.provider.MediaStore
-import android.support.annotation.NonNull
+import androidx.annotation.NonNull
import java.io.File
-
/**
* Created by Allan Wang on 2017-07-14.
*/
data class MediaModel(
- val data: String, val mimeType: String, val size: Long, val dateModified: Long, val displayName: String?
+ val data: String,
+ val mimeType: String,
+ val size: Long,
+ val dateModified: Long,
+ val displayName: String?
) : Parcelable {
@Throws(SQLException::class)
constructor(@NonNull cursor: Cursor) : this(
- cursor.getString(0),
- cursor.getString(1) ?: "",
- cursor.getLong(2),
- cursor.getLong(3),
- cursor.getString(4)
+ cursor.getString(0),
+ cursor.getString(1) ?: "",
+ cursor.getLong(2),
+ cursor.getLong(3),
+ cursor.getString(4)
)
constructor(f: File) : this(
- f.absolutePath,
- f.extension, // this isn't a mime type, but it does give some info
- f.length(),
- f.lastModified(),
- f.nameWithoutExtension
+ f.absolutePath,
+ f.extension, // this isn't a mime type, but it does give some info
+ f.length(),
+ f.lastModified(),
+ f.nameWithoutExtension
)
constructor(parcel: Parcel) : this(
- parcel.readString(),
- parcel.readString(),
- parcel.readLong(),
- parcel.readLong(),
- parcel.readString())
+ parcel.readString()!!,
+ parcel.readString()!!,
+ parcel.readLong(),
+ parcel.readLong(),
+ parcel.readString()
+ )
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(this.data)
@@ -67,11 +86,11 @@ data class MediaModel(
companion object CREATOR : Parcelable.Creator<MediaModel> {
val projection = arrayOf(
- MediaStore.MediaColumns.DATA,
- MediaStore.MediaColumns.MIME_TYPE,
- MediaStore.MediaColumns.SIZE,
- MediaStore.MediaColumns.DATE_MODIFIED,
- MediaStore.MediaColumns.DISPLAY_NAME
+ MediaStore.MediaColumns.DATA,
+ MediaStore.MediaColumns.MIME_TYPE,
+ MediaStore.MediaColumns.SIZE,
+ MediaStore.MediaColumns.DATE_MODIFIED,
+ MediaStore.MediaColumns.DISPLAY_NAME
)
override fun createFromParcel(parcel: Parcel): MediaModel {
@@ -82,5 +101,4 @@ data class MediaModel(
return arrayOfNulls(size)
}
}
-
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
index 37f2373..5e5d1ed 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
@@ -1,16 +1,31 @@
+/*
+ * 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.database.Cursor
import android.os.Bundle
-import android.support.design.widget.AppBarLayout
-import android.support.v4.content.Loader
-import android.support.v7.widget.LinearLayoutManager
+import androidx.loader.content.Loader
+import androidx.recyclerview.widget.LinearLayoutManager
import ca.allanwang.kau.adapters.selectedItems
import ca.allanwang.kau.adapters.selectionSize
import ca.allanwang.kau.utils.hideOnDownwardsScroll
import ca.allanwang.kau.utils.setIcon
import ca.allanwang.kau.utils.toDrawable
import ca.allanwang.kau.utils.toast
+import com.google.android.material.appbar.AppBarLayout
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import kotlinx.android.synthetic.main.kau_activity_image_picker.*
@@ -22,8 +37,8 @@ import kotlinx.android.synthetic.main.kau_activity_image_picker.*
* Having three layered images makes this slightly slower than [MediaPickerActivityOverlayBase]
*/
abstract class MediaPickerActivityBase(
- mediaType: MediaType,
- mediaActions: List<MediaAction> = emptyList()
+ mediaType: MediaType,
+ mediaActions: List<MediaAction> = emptyList()
) : MediaPickerCore<MediaItem>(mediaType, mediaActions) {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -78,19 +93,21 @@ abstract class MediaPickerActivityBase(
private fun setToolbarScrollable(scrollable: Boolean) {
val params = kau_toolbar.layoutParams as AppBarLayout.LayoutParams
if (scrollable)
- params.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS or AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
+ params.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS or
+ AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
else
params.scrollFlags = 0
}
override fun onLoadFinished(loader: Loader<Cursor>, data: Cursor?) {
super.onLoadFinished(loader, data)
- setToolbarScrollable((kau_recyclerview.layoutManager as LinearLayoutManager)
- .findLastCompletelyVisibleItemPosition() < adapter.adapterItemCount - 1)
+ setToolbarScrollable(
+ (kau_recyclerview.layoutManager as LinearLayoutManager)
+ .findLastCompletelyVisibleItemPosition() < adapter.adapterItemCount - 1
+ )
}
override fun onStatusChange(loaded: Boolean) {
setToolbarScrollable(loaded)
}
-
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt
index 122838b..a7ee63d 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityOverlayBase.kt
@@ -1,8 +1,23 @@
+/*
+ * 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.os.Build
import android.os.Bundle
-import android.support.annotation.RequiresApi
+import androidx.annotation.RequiresApi
import ca.allanwang.kau.utils.toast
import kotlinx.android.synthetic.main.kau_activity_image_picker_overlay.*
@@ -16,8 +31,8 @@ import kotlinx.android.synthetic.main.kau_activity_image_picker_overlay.*
*/
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
abstract class MediaPickerActivityOverlayBase(
- mediaType: MediaType,
- mediaActions: List<MediaAction> = emptyList()
+ mediaType: MediaType,
+ mediaActions: List<MediaAction> = emptyList()
) : MediaPickerCore<MediaItemBasic>(mediaType, mediaActions) {
override fun onCreate(savedInstanceState: Bundle?) {
@@ -46,4 +61,4 @@ abstract class MediaPickerActivityOverlayBase(
override fun onBackPressed() {
finishAfterTransition()
}
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt
index 50fe7ae..ac43f9f 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.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
@@ -31,7 +46,8 @@ inline fun <reified T : MediaPickerCore<*>> Activity.kauLaunchMediaPicker(reques
* call under [Activity.onActivityResult]
* and make sure that the requestCode matches first
*/
-fun Activity.kauOnMediaPickerResult(resultCode: Int, data: Intent?) = MediaPickerCore.onMediaPickerResult(resultCode, data)
+fun Activity.kauOnMediaPickerResult(resultCode: Int, data: Intent?) =
+ MediaPickerCore.onMediaPickerResult(resultCode, data)
internal const val LOADER_ID = 42
internal const val MEDIA_PICKER_RESULT = "media_picker_result"
@@ -39,5 +55,8 @@ internal const val MEDIA_PICKER_RESULT = "media_picker_result"
internal const val ANIMATION_DURATION = 200L
internal const val ANIMATION_SCALE = 0.95f
-internal fun <T> RequestBuilder<T>.applyMediaOptions(context: Context) = apply(RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE).centerCrop().override(MediaPickerCore.viewSize(context)))
-
+internal fun <T> RequestBuilder<T>.applyMediaOptions(context: Context) = apply(
+ RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE).centerCrop().override(
+ MediaPickerCore.viewSize(context)
+ )
+)
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
index 6e38d14..e6556ab 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.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.Manifest
@@ -13,11 +28,11 @@ import android.os.Bundle
import android.provider.BaseColumns
import android.provider.DocumentsContract
import android.provider.MediaStore
-import android.support.v4.app.LoaderManager
-import android.support.v4.content.CursorLoader
-import android.support.v4.content.Loader
-import android.support.v7.widget.GridLayoutManager
-import android.support.v7.widget.RecyclerView
+import androidx.loader.app.LoaderManager
+import androidx.loader.content.CursorLoader
+import androidx.loader.content.Loader
+import androidx.recyclerview.widget.GridLayoutManager
+import androidx.recyclerview.widget.RecyclerView
import ca.allanwang.kau.adapters.fastAdapter
import ca.allanwang.kau.animators.FadeScaleAnimatorAdd
import ca.allanwang.kau.animators.KauAnimator
@@ -34,10 +49,8 @@ import com.mikepenz.fastadapter.adapters.ItemAdapter
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
-import org.jetbrains.anko.doAsync
+import kotlinx.coroutines.CancellationException
import java.io.File
-import java.util.concurrent.ExecutionException
-import java.util.concurrent.Future
/**
* Created by Allan Wang on 2017-07-23.
@@ -45,8 +58,8 @@ import java.util.concurrent.Future
* Container for the main logic behind the both pickers
*/
abstract class MediaPickerCore<T : IItem<*, *>>(
- val mediaType: MediaType,
- val mediaActions: List<MediaAction>
+ val mediaType: MediaType,
+ val mediaActions: List<MediaAction>
) : KauBaseActivity(), LoaderManager.LoaderCallbacks<Cursor> {
companion object {
@@ -79,10 +92,10 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
fun getIconDrawable(context: Context, iicon: IIcon, color: Int): Drawable {
val sizePx = MediaPickerCore.computeViewSize(context)
return IconicsDrawable(context, iicon)
- .sizePx(sizePx)
- .backgroundColor(color)
- .paddingPx(sizePx / 3)
- .color(Color.WHITE)
+ .sizePx(sizePx)
+ .backgroundColor(color)
+ .paddingPx(sizePx / 3)
+ .color(Color.WHITE)
}
var accentColor: Int = 0xff666666.toInt()
@@ -106,7 +119,6 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
lateinit var glide: RequestManager
private var hasPreloaded = false
- private var prefetcher: Future<*>? = null
val adapter = ItemAdapter<T>()
@@ -122,7 +134,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
fun initializeRecycler(recycler: RecyclerView) {
val adapterHeader = ItemAdapter<MediaActionItem>()
- val fulladapter = fastAdapter(adapterHeader, adapter)
+ val fulladapter = fastAdapter<IItem<*, *>>(adapterHeader, adapter)
adapterHeader.add(mediaActions.map { MediaActionItem(it, mediaType) })
recycler.apply {
val manager = object : GridLayoutManager(context, computeColumnCount(context)) {
@@ -131,7 +143,6 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
}
}
setItemViewCacheSize(CACHE_SIZE)
- isDrawingCacheEnabled = true
layoutManager = manager
adapter = fulladapter
setHasFixedSize(true)
@@ -155,7 +166,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
open fun loadItems() {
kauRequestPermissions(Manifest.permission.READ_EXTERNAL_STORAGE) { granted, _ ->
if (granted) {
- supportLoaderManager.initLoader(LOADER_ID, null, this)
+ LoaderManager.getInstance(this).initLoader(LOADER_ID, null, this)
onStatusChange(true)
} else {
toast(R.string.kau_permission_denied)
@@ -180,18 +191,14 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
addItems(models.map { converter(it) })
if (!hasPreloaded && mediaType == MediaType.VIDEO) {
hasPreloaded = true
- prefetcher = doAsync {
- models.subList(0, Math.min(models.size, 50)).map { it.data }.forEach {
- val target = glide.load(it)
- .applyMediaOptions(this@MediaPickerCore)
- .submit()
- try {
- target.get()
- } catch (ignored: InterruptedException) {
- } catch (ignored: ExecutionException) {
- } finally {
- glide.clear(target)
- }
+ val preloads = models.subList(0, Math.min(models.size, 50)).map {
+ glide.load(it.data)
+ .applyMediaOptions(this@MediaPickerCore)
+ .preload()
+ }
+ job.invokeOnCompletion {
+ if (it is CancellationException) {
+ preloads.forEach(glide::clear)
}
}
}
@@ -227,11 +234,6 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
open fun onStatusChange(loaded: Boolean) {}
- override fun onDestroy() {
- prefetcher?.cancel(true)
- super.onDestroy()
- }
-
/**
* Method used to retrieve uri data for API 19+
* See <a href="http://hmkcode.com/android-display-selected-image-and-its-real-path/"></a>
@@ -274,7 +276,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
f = File(tempPath)
tempPath = null
} else if (data?.data != null) {
- f = File(data.data.path)
+ f = File(data.data!!.path)
} else {
KL.d { "Media camera no file found" }
return
@@ -291,8 +293,8 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
private fun onPickerResult(data: Intent?) {
val items = mutableListOf<Uri>()
if (data?.data != null) {
- KL.v { "Media picker data uri: ${data.data.path}" }
- items.add(data.data)
+ KL.v { "Media picker data uri: ${data.data!!.path}" }
+ items.add(data.data!!)
} else if (data != null) {
val clip = data.clipData
if (clip != null) {
@@ -314,4 +316,4 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
}
}
}
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaType.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaType.kt
index 0af4c2e..a42095f 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaType.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaType.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.net.Uri
@@ -7,17 +22,23 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
/**
* Created by Allan Wang on 2017-07-30.
*/
-enum class MediaType(val cacheStrategy: DiskCacheStrategy,
- val mimeType: String,
- val captureType: String,
- val contentUri: Uri) {
- IMAGE(DiskCacheStrategy.AUTOMATIC,
- "image/*",
- MediaStore.ACTION_IMAGE_CAPTURE,
- MediaStore.Images.Media.EXTERNAL_CONTENT_URI),
+enum class MediaType(
+ val cacheStrategy: DiskCacheStrategy,
+ val mimeType: String,
+ val captureType: String,
+ val contentUri: Uri
+) {
+ IMAGE(
+ DiskCacheStrategy.AUTOMATIC,
+ "image/*",
+ MediaStore.ACTION_IMAGE_CAPTURE,
+ MediaStore.Images.Media.EXTERNAL_CONTENT_URI
+ ),
- VIDEO(DiskCacheStrategy.AUTOMATIC,
- "video/*",
- MediaStore.ACTION_VIDEO_CAPTURE,
- MediaStore.Video.Media.EXTERNAL_CONTENT_URI)
-} \ No newline at end of file
+ VIDEO(
+ DiskCacheStrategy.AUTOMATIC,
+ "video/*",
+ MediaStore.ACTION_VIDEO_CAPTURE,
+ MediaStore.Video.Media.EXTERNAL_CONTENT_URI
+ )
+}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt
index f37be75..ff6784b 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaUtils.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.annotation.SuppressLint
@@ -6,13 +21,14 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Environment
-import android.support.v7.app.AppCompatActivity
+import androidx.appcompat.app.AppCompatActivity
import ca.allanwang.kau.utils.buildIsLollipopAndUp
import java.io.File
import java.io.IOException
import java.text.SimpleDateFormat
-import java.util.*
-
+import java.util.ArrayList
+import java.util.Date
+import java.util.Locale
/**
* Created by Allan Wang on 2017-08-17.
@@ -26,14 +42,17 @@ internal fun Activity.finish(data: ArrayList<MediaModel>) {
else finish()
}
+/**
+ * Creates a folder named [prefix] as well as a new file with the prefix, current time, and extension.
+ */
@Throws(IOException::class)
fun createMediaFile(prefix: String, extension: String): File {
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date())
val imageFileName = "${prefix}_${timeStamp}_"
val storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
- val frostDir = File(storageDir, prefix)
- if (!frostDir.exists()) frostDir.mkdirs()
- return File.createTempFile(imageFileName, extension, frostDir)
+ val prefixDir = File(storageDir, prefix)
+ if (!prefixDir.exists()) prefixDir.mkdirs()
+ return File.createTempFile(imageFileName, extension, prefixDir)
}
@Throws(IOException::class)
@@ -55,4 +74,4 @@ fun Context.scanMedia(f: File) {
val contentUri = Uri.fromFile(f)
mediaScanIntent.data = contentUri
sendBroadcast(mediaScanIntent)
-} \ No newline at end of file
+}
diff --git a/mediapicker/src/main/res/layout-v21/kau_activity_image_picker_overlay.xml b/mediapicker/src/main/res/layout-v21/kau_activity_image_picker_overlay.xml
index a0ce301..d7447b0 100644
--- a/mediapicker/src/main/res/layout-v21/kau_activity_image_picker_overlay.xml
+++ b/mediapicker/src/main/res/layout-v21/kau_activity_image_picker_overlay.xml
@@ -7,7 +7,7 @@
app:dragDismissDistance="@dimen/kau_drag_dismiss_distance_large"
app:dragDismissScale="0.95">
- <android.support.v7.widget.RecyclerView
+ <androidx.recyclerview.widget.RecyclerView
android:id="@+id/kau_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/mediapicker/src/main/res/layout/kau_activity_image_picker.xml b/mediapicker/src/main/res/layout/kau_activity_image_picker.xml
index 1b46097..c3458cf 100644
--- a/mediapicker/src/main/res/layout/kau_activity_image_picker.xml
+++ b/mediapicker/src/main/res/layout/kau_activity_image_picker.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/kau_coordinator"
android:layout_width="match_parent"
@@ -7,13 +7,13 @@
android:background="?android:colorBackground"
android:fitsSystemWindows="true">
- <android.support.design.widget.AppBarLayout
+ <com.google.android.material.appbar.AppBarLayout
android:id="@+id/kau_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
- <android.support.v7.widget.Toolbar
+ <androidx.appcompat.widget.Toolbar
android:id="@+id/kau_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
@@ -31,17 +31,17 @@
android:paddingStart="@dimen/kau_padding_normal"
android:text="@string/kau_0" />
- </android.support.v7.widget.Toolbar>
+ </androidx.appcompat.widget.Toolbar>
- </android.support.design.widget.AppBarLayout>
+ </com.google.android.material.appbar.AppBarLayout>
- <android.support.v7.widget.RecyclerView
+ <androidx.recyclerview.widget.RecyclerView
android:id="@+id/kau_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
- <android.support.design.widget.FloatingActionButton
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/kau_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -53,4 +53,4 @@
app:layout_anchorGravity="bottom|right|end" />
-</android.support.design.widget.CoordinatorLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/mediapicker/src/main/res/values-da-rDK/strings_mediapicker.xml b/mediapicker/src/main/res/values-da-rDK/strings_mediapicker.xml
index d3636d3..6f37f28 100644
--- a/mediapicker/src/main/res/values-da-rDK/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-da-rDK/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Ingen elementer fundet</string>
<string name="kau_no_items_selected">Ingen elementer er valgt</string>
diff --git a/mediapicker/src/main/res/values-de-rDE/strings_mediapicker.xml b/mediapicker/src/main/res/values-de-rDE/strings_mediapicker.xml
index ae441cc..ff49433 100644
--- a/mediapicker/src/main/res/values-de-rDE/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-de-rDE/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Keine Elemente gefunden</string>
<string name="kau_no_items_selected">Keine Datei ausgewählt</string>
diff --git a/mediapicker/src/main/res/values-es-rES/strings_mediapicker.xml b/mediapicker/src/main/res/values-es-rES/strings_mediapicker.xml
index 21da558..72b8903 100644
--- a/mediapicker/src/main/res/values-es-rES/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-es-rES/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">No se encontraron elementos</string>
<string name="kau_no_items_selected">No se han seleccionado elementos</string>
diff --git a/mediapicker/src/main/res/values-fr-rFR/strings_mediapicker.xml b/mediapicker/src/main/res/values-fr-rFR/strings_mediapicker.xml
index 1705e9e..99a68d4 100644
--- a/mediapicker/src/main/res/values-fr-rFR/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-fr-rFR/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Aucun élément trouvé</string>
<string name="kau_no_items_selected">Aucun élément n\'a été sélectionné</string>
diff --git a/mediapicker/src/main/res/values-gl-rES/strings_mediapicker.xml b/mediapicker/src/main/res/values-gl-rES/strings_mediapicker.xml
index 1ad6650..831c96b 100644
--- a/mediapicker/src/main/res/values-gl-rES/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-gl-rES/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Ningún elemento atopado</string>
<string name="kau_no_items_selected">Ningún elemento seleccionado</string>
diff --git a/mediapicker/src/main/res/values-hu-rHU/strings_mediapicker.xml b/mediapicker/src/main/res/values-hu-rHU/strings_mediapicker.xml
index b191d61..30b6a1b 100644
--- a/mediapicker/src/main/res/values-hu-rHU/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-hu-rHU/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Nem található elem</string>
<string name="kau_no_items_selected">Nincs kijelölt elem</string>
diff --git a/mediapicker/src/main/res/values-in-rID/strings_mediapicker.xml b/mediapicker/src/main/res/values-in-rID/strings_mediapicker.xml
index 8f64d74..3980589 100644
--- a/mediapicker/src/main/res/values-in-rID/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-in-rID/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Item tidak ditemukan</string>
<string name="kau_no_items_selected">Tidak ada item yang dipilih</string>
diff --git a/mediapicker/src/main/res/values-it-rIT/strings_mediapicker.xml b/mediapicker/src/main/res/values-it-rIT/strings_mediapicker.xml
index 4b795b1..f712b12 100644
--- a/mediapicker/src/main/res/values-it-rIT/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-it-rIT/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Nessun elemento trovato</string>
<string name="kau_no_items_selected">Non è stato selezionato alcun elemento</string>
diff --git a/mediapicker/src/main/res/values-ko-rKR/strings_mediapicker.xml b/mediapicker/src/main/res/values-ko-rKR/strings_mediapicker.xml
index aab5e63..26793bc 100644
--- a/mediapicker/src/main/res/values-ko-rKR/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-ko-rKR/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">항목이 없습니다.</string>
<string name="kau_no_items_selected">선택된 항목이 없습니다.</string>
diff --git a/mediapicker/src/main/res/values-nl-rNL/strings_mediapicker.xml b/mediapicker/src/main/res/values-nl-rNL/strings_mediapicker.xml
new file mode 100644
index 0000000..daaad70
--- /dev/null
+++ b/mediapicker/src/main/res/values-nl-rNL/strings_mediapicker.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
+<resources>
+ <string name="kau_no_items_found">Geen items gevonden</string>
+ <string name="kau_no_items_selected">Er zijn geen items geselecteerd</string>
+ <string name="kau_no_items_loaded">Er zijn geen items ingeladen</string>
+ <string name="kau_no_camera_found">Geen camera gevonden</string>
+ <string name="kau_no_camera_found_content">Installeer een camera-app en probeer het opnieuw.</string>
+ <string name="kau_temp_file_creation_failed">Kan tijdelijk bestand niet aanmaken.</string>
+ <string name="kau_select_media">Kies een afbeelding of video</string>
+</resources>
diff --git a/mediapicker/src/main/res/values-no-rNO/strings_mediapicker.xml b/mediapicker/src/main/res/values-no-rNO/strings_mediapicker.xml
index 7b251bc..9ee6501 100644
--- a/mediapicker/src/main/res/values-no-rNO/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-no-rNO/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Ingen elementer funnet</string>
<string name="kau_no_items_selected">Ingen elementer har blitt valgt</string>
diff --git a/mediapicker/src/main/res/values-pl-rPL/strings_mediapicker.xml b/mediapicker/src/main/res/values-pl-rPL/strings_mediapicker.xml
index 5aaaae1..7db61f8 100644
--- a/mediapicker/src/main/res/values-pl-rPL/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-pl-rPL/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Brak pozycji</string>
<string name="kau_no_items_selected">Brak wybranych pozycji</string>
diff --git a/mediapicker/src/main/res/values-pt-rBR/strings_mediapicker.xml b/mediapicker/src/main/res/values-pt-rBR/strings_mediapicker.xml
index bac9913..62abec1 100644
--- a/mediapicker/src/main/res/values-pt-rBR/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-pt-rBR/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Nenhum item encontrado</string>
<string name="kau_no_items_selected">Nenhum item foi selecionado</string>
diff --git a/mediapicker/src/main/res/values-pt-rPT/strings_mediapicker.xml b/mediapicker/src/main/res/values-pt-rPT/strings_mediapicker.xml
new file mode 100644
index 0000000..25b8c46
--- /dev/null
+++ b/mediapicker/src/main/res/values-pt-rPT/strings_mediapicker.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
+<resources>
+ <string name="kau_no_items_found">Nenhum item encontrado</string>
+ <string name="kau_no_items_selected">Não foi selecionado nenhum item</string>
+ <string name="kau_no_items_loaded">Nenhum item carregado</string>
+ <string name="kau_no_camera_found">Nenhuma câmara encontrada</string>
+ <string name="kau_no_camera_found_content">Por favor instale um aplicação de câmara e tente novamente.</string>
+ <string name="kau_temp_file_creation_failed">Falha ao criar um ficheiro temporário.</string>
+ <string name="kau_select_media">Selecionar multimédia</string>
+</resources>
diff --git a/mediapicker/src/main/res/values-sr-rSP/strings_mediapicker.xml b/mediapicker/src/main/res/values-sr-rSP/strings_mediapicker.xml
new file mode 100644
index 0000000..abc3933
--- /dev/null
+++ b/mediapicker/src/main/res/values-sr-rSP/strings_mediapicker.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
+<resources>
+ <string name="kau_no_items_found">Није пронађена ниједна ставка</string>
+ <string name="kau_no_items_selected">Ниједна ставка није одабрана</string>
+ <string name="kau_no_items_loaded">Нема учитаних ставки</string>
+ <string name="kau_no_camera_found">Камера није пронађена</string>
+ <string name="kau_no_camera_found_content">Инсталирајте апликацију за камеру и покушајте поново.</string>
+ <string name="kau_temp_file_creation_failed">Креирање привремене датотеке није успело.</string>
+ <string name="kau_select_media">Одаберите мултимедију</string>
+</resources>
diff --git a/mediapicker/src/main/res/values-sv-rSE/strings_mediapicker.xml b/mediapicker/src/main/res/values-sv-rSE/strings_mediapicker.xml
index 15f991f..0909d2f 100644
--- a/mediapicker/src/main/res/values-sv-rSE/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-sv-rSE/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Inga objekt hittades</string>
<string name="kau_no_items_selected">Inga objekt har valts</string>
diff --git a/mediapicker/src/main/res/values-th-rTH/strings_mediapicker.xml b/mediapicker/src/main/res/values-th-rTH/strings_mediapicker.xml
index 3e97c66..83bd30c 100644
--- a/mediapicker/src/main/res/values-th-rTH/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-th-rTH/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">ไม่พบรายการ</string>
<string name="kau_no_items_selected">ยังไม่ได้เลือกรายการ</string>
diff --git a/mediapicker/src/main/res/values-tr-rTR/strings_mediapicker.xml b/mediapicker/src/main/res/values-tr-rTR/strings_mediapicker.xml
index 55e90b4..601432f 100644
--- a/mediapicker/src/main/res/values-tr-rTR/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-tr-rTR/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Hiç bir öge bulunamadı</string>
<string name="kau_no_items_selected">Hiç bir öge seçilmemişti</string>
diff --git a/mediapicker/src/main/res/values-uk-rUA/strings_mediapicker.xml b/mediapicker/src/main/res/values-uk-rUA/strings_mediapicker.xml
index 6dc767e..f8a9725 100644
--- a/mediapicker/src/main/res/values-uk-rUA/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-uk-rUA/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Нічого не знайдено</string>
<string name="kau_no_items_selected">Жодного елементу не обрано</string>
diff --git a/mediapicker/src/main/res/values-vi-rVN/strings_mediapicker.xml b/mediapicker/src/main/res/values-vi-rVN/strings_mediapicker.xml
index dae9f41..9d5fe5d 100644
--- a/mediapicker/src/main/res/values-vi-rVN/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-vi-rVN/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">Không tìm thấy mục nào</string>
<string name="kau_no_items_selected">Chưa chọn mục nào</string>
diff --git a/mediapicker/src/main/res/values-zh-rCN/strings_mediapicker.xml b/mediapicker/src/main/res/values-zh-rCN/strings_mediapicker.xml
index 2be3fc0..b05f922 100644
--- a/mediapicker/src/main/res/values-zh-rCN/strings_mediapicker.xml
+++ b/mediapicker/src/main/res/values-zh-rCN/strings_mediapicker.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--Generated by crowdin.com-->
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
<resources>
<string name="kau_no_items_found">未找到项目</string>
<string name="kau_no_items_selected">没有选择任何项目</string>
diff --git a/mediapicker/src/main/res/values-zh-rTW/strings_mediapicker.xml b/mediapicker/src/main/res/values-zh-rTW/strings_mediapicker.xml
new file mode 100644
index 0000000..1ecb9e0
--- /dev/null
+++ b/mediapicker/src/main/res/values-zh-rTW/strings_mediapicker.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--Generated by crowdin.com-->
+<resources>
+ <string name="kau_no_items_found">什麼也沒有</string>
+ <string name="kau_no_items_selected">什麼也沒選到</string>
+ <string name="kau_no_items_loaded">什麼也沒載入</string>
+ <string name="kau_no_camera_found">找不到相機</string>
+ <string name="kau_no_camera_found_content">請安裝相機應用程式然後重試</string>
+ <string name="kau_temp_file_creation_failed">無法建立暫存檔</string>
+ <string name="kau_select_media">選取媒體</string>
+</resources>