aboutsummaryrefslogtreecommitdiff
path: root/sample/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-04 16:08:03 -0700
committerAllan Wang <me@allanwang.ca>2017-07-04 16:08:03 -0700
commitcf2a7fcd0880a8d276970124cdb5d5845d5631fe (patch)
treecc38ead7853ddb85c9c988e94a4af605e1e676f8 /sample/src/main/kotlin
parentfe4632c34a1d671503e0242a269865b884545e13 (diff)
downloadkau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.tar.gz
kau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.tar.bz2
kau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.zip
Separate core components in its own module
Diffstat (limited to 'sample/src/main/kotlin')
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt22
1 files changed, 16 insertions, 6 deletions
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
index b793f40..2ba7731 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
@@ -1,12 +1,10 @@
package ca.allanwang.kau.sample
import android.os.Bundle
+import android.provider.MediaStore
import android.support.v7.app.AppCompatActivity
import ca.allanwang.kau.logging.KL
-import ca.allanwang.kau.permissions.PERMISSION_ACCESS_COARSE_LOCATION
-import ca.allanwang.kau.permissions.PERMISSION_ACCESS_FINE_LOCATION
-import ca.allanwang.kau.permissions.kauOnRequestPermissionsResult
-import ca.allanwang.kau.permissions.kauRequestPermissions
+import ca.allanwang.kau.permissions.*
import ca.allanwang.kau.utils.fullLinearRecycler
import ca.allanwang.kau.utils.startActivitySlideOut
import ca.allanwang.kau.utils.toast
@@ -27,8 +25,8 @@ class AnimActivity : AppCompatActivity() {
adapter.add(listOf(
PERMISSION_ACCESS_COARSE_LOCATION,
PERMISSION_ACCESS_FINE_LOCATION
- ).map{ PermissionCheckbox(it) })
- adapter.withOnClickListener { _, _, item, _ ->
+ ).map { PermissionCheckbox(it) })
+ val withOnClickListener = adapter.withOnClickListener { _, _, item, _ ->
KL.d("Perm Click")
kauRequestPermissions(item.permission) {
granted, deniedPerm ->
@@ -37,6 +35,18 @@ class AnimActivity : AppCompatActivity() {
}
true
}
+ kauRequestPermissions(PERMISSION_READ_EXTERNAL_STORAGE) {
+ granted, deniedPerm ->
+ if (!granted) return@kauRequestPermissions
+ val cursor = contentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+ arrayOf(MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATE_MODIFIED),
+ null, null, MediaStore.Images.Media.DEFAULT_SORT_ORDER, null)
+ while (!cursor.isLast) {
+ cursor.moveToNext()
+ KL.d(cursor.getString(1))
+ }
+ cursor.close()
+ }
}
override fun onBackPressed() {