aboutsummaryrefslogtreecommitdiff
path: root/mediapicker
diff options
context:
space:
mode:
Diffstat (limited to 'mediapicker')
-rw-r--r--mediapicker/build.gradle2
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.kt2
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt1
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt2
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt34
-rw-r--r--mediapicker/src/main/res/values-ar-rSA/strings_mediapicker.xml11
6 files changed, 40 insertions, 12 deletions
diff --git a/mediapicker/build.gradle b/mediapicker/build.gradle
index b3a4153..06a18d0 100644
--- a/mediapicker/build.gradle
+++ b/mediapicker/build.gradle
@@ -5,7 +5,7 @@ apply plugin: 'kotlin-kapt'
dependencies {
implementation project(':core-ui')
- implementation project(':adapter')
+ implementation project(':fastadapter')
api kau.Dependencies.glide
api kau.Dependencies.blurry
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 4342229..739bf47 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/BlurredImageView.kt
@@ -28,7 +28,7 @@ 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.iconics.typeface.library.googlematerial.GoogleMaterial
+import com.mikepenz.google_material_typeface_library.GoogleMaterial
import jp.wasabeef.blurry.internal.BlurFactor
import jp.wasabeef.blurry.internal.BlurTask
import kotlinx.android.synthetic.main.kau_blurred_imageview.view.*
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 8d2dab9..a365e13 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt
@@ -26,6 +26,7 @@ import ca.allanwang.kau.permissions.PERMISSION_WRITE_EXTERNAL_STORAGE
import ca.allanwang.kau.permissions.kauRequestPermissions
import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.string
+import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import java.io.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 fa161c7..5e5d1ed 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
@@ -26,7 +26,7 @@ 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.iconics.typeface.library.googlematerial.GoogleMaterial
+import com.mikepenz.google_material_typeface_library.GoogleMaterial
import kotlinx.android.synthetic.main.kau_activity_image_picker.*
/**
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 bf681eb..c928e04 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
@@ -46,16 +46,13 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.RequestManager
import com.mikepenz.fastadapter.IItem
import com.mikepenz.fastadapter.adapters.ItemAdapter
-import com.mikepenz.iconics.IconicsColor
import com.mikepenz.iconics.IconicsDrawable
-import com.mikepenz.iconics.IconicsSize
import com.mikepenz.iconics.colorInt
import com.mikepenz.iconics.paddingPx
import com.mikepenz.iconics.sizePx
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.iconics.utils.toIconicsColor
-import com.mikepenz.iconics.utils.toIconicsSizePx
import kotlinx.coroutines.CancellationException
import java.io.File
@@ -94,7 +91,8 @@ abstract class MediaPickerCore<T : IItem<*>>(
/**
* Create error tile for a given item
*/
- fun getErrorDrawable(context: Context) = getIconDrawable(context, GoogleMaterial.Icon.gmd_error, accentColor)
+ fun getErrorDrawable(context: Context) =
+ getIconDrawable(context, GoogleMaterial.Icon.gmd_error, accentColor)
fun getIconDrawable(context: Context, iicon: IIcon, color: Int): Drawable {
val sizePx = MediaPickerCore.computeViewSize(context)
@@ -112,7 +110,10 @@ abstract class MediaPickerCore<T : IItem<*>>(
* This is used for both single and multiple photo picks
*/
fun onMediaPickerResult(resultCode: Int, data: Intent?): List<MediaModel> {
- if (resultCode != Activity.RESULT_OK || data == null || !data.hasExtra(MEDIA_PICKER_RESULT))
+ if (resultCode != Activity.RESULT_OK || data == null || !data.hasExtra(
+ MEDIA_PICKER_RESULT
+ )
+ )
return emptyList()
return data.getParcelableArrayListExtra(MEDIA_PICKER_RESULT)
}
@@ -146,7 +147,9 @@ abstract class MediaPickerCore<T : IItem<*>>(
recycler.apply {
val manager = object : GridLayoutManager(context, computeColumnCount(context)) {
override fun getExtraLayoutSpace(state: RecyclerView.State?): Int {
- return if (mediaType != MediaType.VIDEO) extraSpace else super.getExtraLayoutSpace(state)
+ return if (mediaType != MediaType.VIDEO) extraSpace else super.getExtraLayoutSpace(
+ state
+ )
}
}
setItemViewCacheSize(CACHE_SIZE)
@@ -161,7 +164,14 @@ abstract class MediaPickerCore<T : IItem<*>>(
var sortQuery = MediaStore.MediaColumns.DATE_MODIFIED + " DESC"
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Cursor> {
- return CursorLoader(this, mediaType.contentUri, MediaModel.projection, null, null, sortQuery)
+ return CursorLoader(
+ this,
+ mediaType.contentUri,
+ MediaModel.projection,
+ null,
+ null,
+ sortQuery
+ )
}
/**
@@ -245,7 +255,11 @@ abstract class MediaPickerCore<T : IItem<*>>(
* Method used to retrieve uri data for API 19+
* See <a href="http://hmkcode.com/android-display-selected-image-and-its-real-path/"></a>
*/
- private fun <R> ContentResolver.query(baseUri: Uri, uris: List<Uri>, block: (cursor: Cursor) -> R) {
+ private fun <R> ContentResolver.query(
+ baseUri: Uri,
+ uris: List<Uri>,
+ block: (cursor: Cursor) -> R
+ ) {
val ids = uris.filter {
val valid = DocumentsContract.isDocumentUri(this@MediaPickerCore, it)
if (!valid) KL.d { "Non document uri: ${it.encodedPath}" }
@@ -255,7 +269,9 @@ abstract class MediaPickerCore<T : IItem<*>>(
}.joinToString(prefix = "(", separator = ",", postfix = ")")
//? query replacements are done for one arg at a time
//since we potentially have a list of ids, we'll just format the WHERE clause ourself
- query(baseUri, MediaModel.projection, "${BaseColumns._ID} IN $ids", null, sortQuery)?.use(block)
+ query(baseUri, MediaModel.projection, "${BaseColumns._ID} IN $ids", null, sortQuery)?.use(
+ block
+ )
}
internal var tempPath: String? = null
diff --git a/mediapicker/src/main/res/values-ar-rSA/strings_mediapicker.xml b/mediapicker/src/main/res/values-ar-rSA/strings_mediapicker.xml
new file mode 100644
index 0000000..c05d161
--- /dev/null
+++ b/mediapicker/src/main/res/values-ar-rSA/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>