aboutsummaryrefslogtreecommitdiff
path: root/mediapicker/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <allanwang@google.com>2019-07-27 17:46:04 -0700
committerAllan Wang <allanwang@google.com>2019-07-27 17:46:04 -0700
commit50c8012e2fe88d6b275d1a3269033590962caa7f (patch)
tree65ebb32525be83441e6caac8362e3e9ae022bfd1 /mediapicker/src/main/kotlin
parent01058912580a3ecfe77eaf6af209e1c46a97f2d7 (diff)
parentd94017e6f6df67e80604111028ea16f6c7f4e077 (diff)
downloadkau-50c8012e2fe88d6b275d1a3269033590962caa7f.tar.gz
kau-50c8012e2fe88d6b275d1a3269033590962caa7f.tar.bz2
kau-50c8012e2fe88d6b275d1a3269033590962caa7f.zip
Fix initial conflicts
Diffstat (limited to 'mediapicker/src/main/kotlin')
-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
4 files changed, 28 insertions, 11 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 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