Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 7a3f141

Browse files
committed
Version 0.3.1
1 parent f70c857 commit 7a3f141

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ EasyPermissions is installed by adding the following dependency to your `build.g
99

1010
```groovy
1111
dependencies {
12-
compile 'pub.devrel:easypermissions:0.3.0'
12+
compile 'pub.devrel:easypermissions:0.3.1'
1313
}
1414
```
1515

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ ext {
2929

3030
mavenGroup = 'pub.devrel'
3131
mavenArtifactId = 'easypermissions'
32-
mavenVersion = '0.3.0'
32+
mavenVersion = '0.3.1'
3333

3434
bintrayOrg = 'easygoogle'
3535

36-
support_library_version = '25.2.0'
36+
support_library_version = '25.3.1'
3737

3838
buildTools = '25.0.2'
3939
compileSdk = 25

easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
*/
4141
public class EasyPermissions {
4242

43+
/**
44+
* Callback interface to receive the results of {@code EasyPermissions.requestPermissions()}
45+
* calls.
46+
*/
4347
public interface PermissionCallbacks extends ActivityCompat.OnRequestPermissionsResultCallback {
4448

4549
void onPermissionsGranted(int requestCode, List<String> perms);
@@ -434,6 +438,12 @@ public static boolean somePermissionDenied(@NonNull android.app.Fragment fragmen
434438
return shouldShowRationale(fragment, perms);
435439
}
436440

441+
/**
442+
* Determine if rationale should be shown before asking for the given permission.
443+
* @param object the Fragment or Activity.
444+
* @param perm the permission.
445+
* @return {@code true} if rationale should be shown, {@code false} otherwise.
446+
*/
437447
private static boolean shouldShowRequestPermissionRationale(@NonNull Object object,
438448
@NonNull String perm) {
439449
if (object instanceof Activity) {
@@ -467,6 +477,12 @@ private static void showRationaleDialogFragment(@NonNull android.app.FragmentMan
467477
.show(fragmentManager, DIALOG_TAG);
468478
}
469479

480+
/**
481+
* Find all methods annotated with {@link AfterPermissionGranted} on a given object with the
482+
* correc requestCode argument.
483+
* @param object the object with annotated methods.
484+
* @param requestCode the requestCode passed to the annotation.
485+
*/
470486
private static void runAnnotatedMethods(@NonNull Object object, int requestCode) {
471487
Class clazz = object.getClass();
472488
if (isUsingAndroidAnnotations(object)) {
@@ -504,6 +520,9 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)
504520
}
505521
}
506522

523+
/**
524+
* Determine if the project is using the AndroidAnnoations library.
525+
*/
507526
private static boolean isUsingAndroidAnnotations(@NonNull Object object) {
508527
if (!object.getClass().getSimpleName().endsWith("_")) {
509528
return false;

0 commit comments

Comments
 (0)