aboutsummaryrefslogtreecommitdiff
path: root/sample
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
parentfe4632c34a1d671503e0242a269865b884545e13 (diff)
downloadkau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.tar.gz
kau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.tar.bz2
kau-cf2a7fcd0880a8d276970124cdb5d5845d5631fe.zip
Separate core components in its own module
Diffstat (limited to 'sample')
-rw-r--r--sample/build.gradle3
-rw-r--r--sample/src/main/AndroidManifest.xml1
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt22
3 files changed, 19 insertions, 7 deletions
diff --git a/sample/build.gradle b/sample/build.gradle
index 3e107a7..66fc619 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -37,7 +37,8 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile project(':library')
+ compile project(':core')
+ compile project(':imagepicker')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index 44d9416..5a364b6 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
package="ca.allanwang.kau.sample">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".SampleApp"
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() {