Skip to content

Commit 76bd45e

Browse files
author
hotchemi
committed
Tweak Kotlin doc a bit.
1 parent a611d36 commit 76bd45e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

doc/kotlin_usage.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22

33
Here's a minimum example, in which you register a `MainActivity` which requires `Manifest.permission.CAMERA`.
44

5-
### 0. Preparation
5+
### 0. Prepare AndroidManifest
66

77
Add the following line to `AndroidManifest.xml`:
88

99
`<uses-permission android:name="android.permission.CAMERA" />`
1010

1111
### 1. Attach annotations
1212

13+
PermissionsDispatcher introduces only a few annotations, keeping its general API concise:
14+
1315
> NOTE: Annotated methods must not be `private`.
1416
17+
|Annotation|Required|Description|
18+
|---|---|---|
19+
|`@RuntimePermissions`|****|Register an `Activity` or `Fragment`(we support both) to handle permissions|
20+
|`@NeedsPermission`|****|Annotate a method which performs the action that requires one or more permissions|
21+
|`@OnShowRationale`||Annotate a method which explains why the permission/s is/are needed. It passes in a `PermissionRequest` object which can be used to continue or abort the current permission request upon user input|
22+
|`@OnPermissionDenied`||Annotate a method which is invoked if the user doesn't grant the permissions|
23+
|`@OnNeverAskAgain`||Annotate a method which is invoked if the user chose to have the device "never ask again" about a permission|
24+
1525
```kotlin
1626
@RuntimePermissions
1727
class MainActivity : AppCompatActivity(), View.OnClickListener {

0 commit comments

Comments
 (0)