Skip to content

Commit

Permalink
Add shouldShowRequestPermissionRationale method into the PermissionMa…
Browse files Browse the repository at this point in the history
…nager.
  • Loading branch information
Tony---Zhang authored and Zhang Shuai committed Nov 12, 2015
1 parent 4a6d690 commit 8137230
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions library/src/main/java/com/anthonycr/grant/PermissionsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ public static boolean hasAllPermissions(@Nullable Context context, @NonNull Stri
return hasAllPermissions;
}

/**
* This static method can be used to check whether or not you should show request permission rational.
* If you pass in a null Activity object, it will return true
* @param activity the Activity necessary to check the permission
* @param permission the permission to check
* @return false if user selected never ask permission again, true otherwise
*/
@SuppressWarnings("unused")
public static boolean shouldShowRequestPermissionRationale(@Nullable Activity activity, @NonNull String permission) {
return activity == null || ActivityCompat.shouldShowRequestPermissionRationale(activity, permission);
}

/**
* This method will request all the permissions declared in your application manifest
* for the specified {@link PermissionsResultAction}. The purpose of this method is to enable
Expand Down

0 comments on commit 8137230

Please sign in to comment.