Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkSangGwon authored Aug 21, 2021
1 parent 4f26f74 commit 0bb8a13
Showing 1 changed file with 7 additions and 31 deletions.
38 changes: 7 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Call `check()` to start checking for permissions.
`setRationaleMessage()` and `setDeniedMessage()` are optional methods for displaying messages.

```java
TedPermission.with(this)
TedPermission.create()
.setPermissionListener(permissionlistener)
.setDeniedMessage("If you reject permission,you can not use this service\n\nPlease turn on permissions at [Setting] > [Permission]")
.setPermissions(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION)
Expand All @@ -123,37 +123,13 @@ Call `check()` to start checking for permissions.
<br/><br/>


### RxJava1
```java

TedRxPermission.with(this)
.setDeniedMessage(
"If you reject permission,you can not use this service\n\nPlease turn on permissions at [Setting] > [Permission]")
.setPermissions(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION)
.request()
.subscribe(tedPermissionResult -> {
if (tedPermissionResult.isGranted()) {
Toast.makeText(RxJava1Activity.this, "Permission Granted", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(RxJava1Activity.this,
"Permission Denied\n" + tedPermissionResult.getDeniedPermissions().toString(), Toast.LENGTH_SHORT)
.show();
}
}, throwable -> {
});

```

<br/><br/>


### RxJava
If you use RxJava, You can use `request()` method instead `check()`.
When permission check has finished, you will receive `TedPermissionResult` instance.
`TedPermissionResult` instance has `isGranted()`, `getDeniedPermissions()` methods for checking permission check result.

```java
TedRx2Permission.with(this)
TedRx2Permission.create()
.setRationaleTitle(R.string.rationale_title)
.setRationaleMessage(R.string.rationale_message) // "we need permission for read contact and find your location"
.setPermissions(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION)
Expand Down Expand Up @@ -187,12 +163,12 @@ TedPermission supports the following methods.<br />
* `setGotoSettingButtonText(R.string.xxx or String) (default: setting / 설정)`

Also you can use the following utility functions.
* `isGranted(Context context, String... permissions)`: Check if all permissions are granted
* `isDenied(Context context, String... permissions)`: Check if all permissions are denied
* `getDeniedPermissions(Context context, String... permissions)`
* `isGranted(String... permissions)`: Check if all permissions are granted
* `isDenied(String... permissions)`: Check if all permissions are denied
* `getDeniedPermissions(String... permissions)`
* `canRequestPermission(Activity activity, String... permissions)`: If `true` you can request a system popup, `false` means user checked `Never ask again`.
* `startSettingActivityForResult(Activity activity)`
* `startSettingActivityForResult(Activity activity, int requestCode)`
* `startSettingActivityForResult()`
* `startSettingActivityForResult(int requestCode)`


<br/><br/>
Expand Down

0 comments on commit 0bb8a13

Please sign in to comment.