@@ -89,6 +89,7 @@ public static boolean hasPermissions(Context context, @NonNull String... perms)
89
89
90
90
/**
91
91
* Request permissions from an Activity with standard OK/Cancel buttons.
92
+ *
92
93
* @see #requestPermissions(Activity, String, int, int, int, String...)
93
94
*/
94
95
public static void requestPermissions (
@@ -100,6 +101,7 @@ public static void requestPermissions(
100
101
101
102
/**
102
103
* Request permissions from a Support Fragment with standard OK/Cancel buttons.
104
+ *
103
105
* @see #requestPermissions(Activity, String, int, int, int, String...)
104
106
*/
105
107
public static void requestPermissions (
@@ -112,6 +114,7 @@ public static void requestPermissions(
112
114
113
115
/**
114
116
* Request permissions from a standard Fragment with standard OK/Cancel buttons.
117
+ *
115
118
* @see #requestPermissions(Activity, String, int, int, int, String...)
116
119
*/
117
120
public static void requestPermissions (
@@ -145,6 +148,7 @@ public static void requestPermissions(
145
148
146
149
/**
147
150
* Request permissions from a Support Fragment.
151
+ *
148
152
* @see #requestPermissions(Activity, String, int, int, int, String...)
149
153
*/
150
154
public static void requestPermissions (
@@ -302,7 +306,7 @@ public static boolean permissionPermanentlyDenied(@NonNull android.app.Fragment
302
306
/**
303
307
* See if some denied permission has been permanently denied.
304
308
*
305
- * @param host requesting context.
309
+ * @param host requesting context.
306
310
* @param perms array of permissions.
307
311
* @return true if the user has previously denied any of the {@code perms} and we should show a
308
312
* rationale, false otherwise.
@@ -329,11 +333,12 @@ public static boolean somePermissionDenied(@NonNull android.app.Fragment host,
329
333
}
330
334
331
335
/**
332
- * Run permission callbacks on an object that requested permissions but already has them
333
- * by simulating {@link PackageManager#PERMISSION_GRANTED}.
334
- * @param object the object requesting permissions.
336
+ * Run permission callbacks on an object that requested permissions but already has them by
337
+ * simulating {@link PackageManager#PERMISSION_GRANTED}.
338
+ *
339
+ * @param object the object requesting permissions.
335
340
* @param requestCode the permission request code.
336
- * @param perms a list of permissions requested.
341
+ * @param perms a list of permissions requested.
337
342
*/
338
343
private static void notifyAlreadyHasPermissions (@ NonNull Object object ,
339
344
int requestCode ,
@@ -348,8 +353,9 @@ private static void notifyAlreadyHasPermissions(@NonNull Object object,
348
353
349
354
/**
350
355
* Find all methods annotated with {@link AfterPermissionGranted} on a given object with the
351
- * correc requestCode argument.
352
- * @param object the object with annotated methods.
356
+ * correct requestCode argument.
357
+ *
358
+ * @param object the object with annotated methods.
353
359
* @param requestCode the requestCode passed to the annotation.
354
360
*/
355
361
private static void runAnnotatedMethods (@ NonNull Object object , int requestCode ) {
@@ -360,9 +366,9 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)
360
366
361
367
while (clazz != null ) {
362
368
for (Method method : clazz .getDeclaredMethods ()) {
363
- if (method .isAnnotationPresent (AfterPermissionGranted .class )) {
369
+ AfterPermissionGranted ann = method .getAnnotation (AfterPermissionGranted .class );
370
+ if (ann != null ) {
364
371
// Check for annotated methods with matching request code.
365
- AfterPermissionGranted ann = method .getAnnotation (AfterPermissionGranted .class );
366
372
if (ann .value () == requestCode ) {
367
373
// Method must be void so that we can invoke it
368
374
if (method .getParameterTypes ().length > 0 ) {
@@ -390,7 +396,7 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)
390
396
}
391
397
392
398
/**
393
- * Determine if the project is using the AndroidAnnoations library.
399
+ * Determine if the project is using the AndroidAnnotations library.
394
400
*/
395
401
private static boolean isUsingAndroidAnnotations (@ NonNull Object object ) {
396
402
if (!object .getClass ().getSimpleName ().endsWith ("_" )) {
0 commit comments