aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-04 13:18:14 -0700
committerAllan Wang <me@allanwang.ca>2017-07-04 13:18:14 -0700
commitfe4632c34a1d671503e0242a269865b884545e13 (patch)
tree790ef495b03529f6769732de36f4c09bd526394e
parentd024e8db464e8b0ba0133feed67896b854fd8b25 (diff)
downloadkau-fe4632c34a1d671503e0242a269865b884545e13.tar.gz
kau-fe4632c34a1d671503e0242a269865b884545e13.tar.bz2
kau-fe4632c34a1d671503e0242a269865b884545e13.zip
Rename permission request
-rw-r--r--.idea/misc.xml2
-rw-r--r--docs/Changelog.md1
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt28
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt4
4 files changed, 5 insertions, 30 deletions
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 085136f..7319f02 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -53,7 +53,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
diff --git a/docs/Changelog.md b/docs/Changelog.md
index fa9dda0..08b6529 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -4,6 +4,7 @@
* Change snackbar builder
* Change addBundle to withArguments to match ANKO
* Created KauIItem to replace AbstractItem
+* Created permission manager and permission constants
## v1.4
* Added about activities
diff --git a/library/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt b/library/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
index 5d52ecb..fd43102 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/permissions/Permissions.kt
@@ -3,32 +3,6 @@ package ca.allanwang.kau.permissions
import android.Manifest
import android.app.Activity
import android.content.Context
-import android.Manifest.permission
-import android.Manifest.permission.SYSTEM_ALERT_WINDOW
-import android.Manifest.permission.WRITE_EXTERNAL_STORAGE
-import android.Manifest.permission.READ_EXTERNAL_STORAGE
-import android.Manifest.permission.RECEIVE_MMS
-import android.Manifest.permission.RECEIVE_WAP_PUSH
-import android.Manifest.permission.READ_SMS
-import android.Manifest.permission.RECEIVE_SMS
-import android.Manifest.permission.SEND_SMS
-import android.Manifest.permission.BODY_SENSORS
-import android.Manifest.permission.PROCESS_OUTGOING_CALLS
-import android.Manifest.permission.USE_SIP
-import android.Manifest.permission.ADD_VOICEMAIL
-import android.Manifest.permission.WRITE_CALL_LOG
-import android.Manifest.permission.READ_CALL_LOG
-import android.Manifest.permission.CALL_PHONE
-import android.Manifest.permission.READ_PHONE_STATE
-import android.Manifest.permission.RECORD_AUDIO
-import android.Manifest.permission.ACCESS_COARSE_LOCATION
-import android.Manifest.permission.ACCESS_FINE_LOCATION
-import android.Manifest.permission.GET_ACCOUNTS
-import android.Manifest.permission.WRITE_CONTACTS
-import android.Manifest.permission.READ_CONTACTS
-import android.Manifest.permission.WRITE_CALENDAR
-import android.Manifest.permission.READ_CALENDAR
-
/**
@@ -50,7 +24,7 @@ fun Activity.kauOnRequestPermissionsResult(permissions: Array<out String>, grant
* The [callback] returns [granted], which is true if all permissions are granted
* [deniedPerm] is the first denied permission, if granted is false
*/
-fun Context.requestPermissions(vararg permissions: String, callback: (granted: Boolean, deniedPerm: String?) -> Unit)
+fun Context.kauRequestPermissions(vararg permissions: String, callback: (granted: Boolean, deniedPerm: String?) -> Unit)
= PermissionManager(this, permissions, callback)
/**
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 8b8d784..b793f40 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
@@ -6,7 +6,7 @@ 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.requestPermissions
+import ca.allanwang.kau.permissions.kauRequestPermissions
import ca.allanwang.kau.utils.fullLinearRecycler
import ca.allanwang.kau.utils.startActivitySlideOut
import ca.allanwang.kau.utils.toast
@@ -30,7 +30,7 @@ class AnimActivity : AppCompatActivity() {
).map{ PermissionCheckbox(it) })
adapter.withOnClickListener { _, _, item, _ ->
KL.d("Perm Click")
- requestPermissions(item.permission) {
+ kauRequestPermissions(item.permission) {
granted, deniedPerm ->
toast("${item.permission} enabled: $granted")
adapter.notifyAdapterDataSetChanged()