aboutsummaryrefslogtreecommitdiff
path: root/mediapicker
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-12-31 15:07:05 -0500
committerGitHub <noreply@github.com>2017-12-31 15:07:05 -0500
commite2009a3e33a58bab37f433845f6d105cb7821da1 (patch)
treeb23f3587db872be7b7ac6a4885862c7d56e35be3 /mediapicker
parent2718156fe63304ffb792cc3cb8592ad6e494a8b0 (diff)
downloadkau-e2009a3e33a58bab37f433845f6d105cb7821da1.tar.gz
kau-e2009a3e33a58bab37f433845f6d105cb7821da1.tar.bz2
kau-e2009a3e33a58bab37f433845f6d105cb7821da1.zip
Enhancement/logger (#120)
* Rewrite logger to use lazy loading * Clean up and add to changelog
Diffstat (limited to 'mediapicker')
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt17
1 files changed, 8 insertions, 9 deletions
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 af90fdc..b5fe11f 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
@@ -31,7 +31,6 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.RequestManager
import com.mikepenz.fastadapter.IItem
import com.mikepenz.fastadapter.adapters.ItemAdapter
-import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
@@ -240,7 +239,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
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}")
+ if (!valid) KL.d { "Non document uri: ${it.encodedPath}" }
valid
}.mapNotNull {
DocumentsContract.getDocumentId(it).split(":").getOrNull(1)
@@ -261,7 +260,7 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
}
return super.onActivityResult(requestCode, resultCode, data)
}
- KL.d("Media result received")
+ KL.d { "Media result received" }
when (requestCode) {
MEDIA_ACTION_REQUEST_CAMERA -> onCameraResult(data)
MEDIA_ACTION_REQUEST_PICKER -> onPickerResult(data)
@@ -277,34 +276,34 @@ abstract class MediaPickerCore<T : IItem<*, *>>(
} else if (data?.data != null) {
f = File(data.data.path)
} else {
- KL.d("Media camera no file found")
+ KL.d { "Media camera no file found" }
return
}
if (f.exists()) {
- KL.v("Media camera path found", f.absolutePath)
+ KL.v { "Media camera path found: ${f.absolutePath}" }
scanMedia(f)
finish(arrayListOf(MediaModel(f)))
} else {
- KL.d("Media camera file not found")
+ KL.d { "Media camera file not found" }
}
}
private fun onPickerResult(data: Intent?) {
val items = mutableListOf<Uri>()
if (data?.data != null) {
- KL.v("Media picker data uri", data.data.path)
+ KL.v { "Media picker data uri: ${data.data.path}" }
items.add(data.data)
} else if (data != null) {
val clip = data.clipData
if (clip != null) {
items.addAll((0 until clip.itemCount).map {
clip.getItemAt(it).uri.apply {
- KL.v("Media picker clip uri", path)
+ KL.v { "Media picker clip uri $path" }
}
})
}
}
- if (items.isEmpty()) return KL.d("Media picker empty intent")
+ if (items.isEmpty()) return KL.d { "Media picker empty intent" }
contentResolver.query(mediaType.contentUri, items) {
if (it.moveToFirst()) {
val models = arrayListOf<MediaModel>()