@@ -89,6 +89,7 @@ public static boolean hasPermissions(Context context, @NonNull String... perms)
8989
9090 /**
9191 * Request permissions from an Activity with standard OK/Cancel buttons.
92+ *
9293 * @see #requestPermissions(Activity, String, int, int, int, String...)
9394 */
9495 public static void requestPermissions (
@@ -100,6 +101,7 @@ public static void requestPermissions(
100101
101102 /**
102103 * Request permissions from a Support Fragment with standard OK/Cancel buttons.
104+ *
103105 * @see #requestPermissions(Activity, String, int, int, int, String...)
104106 */
105107 public static void requestPermissions (
@@ -112,6 +114,7 @@ public static void requestPermissions(
112114
113115 /**
114116 * Request permissions from a standard Fragment with standard OK/Cancel buttons.
117+ *
115118 * @see #requestPermissions(Activity, String, int, int, int, String...)
116119 */
117120 public static void requestPermissions (
@@ -145,6 +148,7 @@ public static void requestPermissions(
145148
146149 /**
147150 * Request permissions from a Support Fragment.
151+ *
148152 * @see #requestPermissions(Activity, String, int, int, int, String...)
149153 */
150154 public static void requestPermissions (
@@ -302,7 +306,7 @@ public static boolean permissionPermanentlyDenied(@NonNull android.app.Fragment
302306 /**
303307 * See if some denied permission has been permanently denied.
304308 *
305- * @param host requesting context.
309+ * @param host requesting context.
306310 * @param perms array of permissions.
307311 * @return true if the user has previously denied any of the {@code perms} and we should show a
308312 * rationale, false otherwise.
@@ -329,11 +333,12 @@ public static boolean somePermissionDenied(@NonNull android.app.Fragment host,
329333 }
330334
331335 /**
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.
335340 * @param requestCode the permission request code.
336- * @param perms a list of permissions requested.
341+ * @param perms a list of permissions requested.
337342 */
338343 private static void notifyAlreadyHasPermissions (@ NonNull Object object ,
339344 int requestCode ,
@@ -348,8 +353,9 @@ private static void notifyAlreadyHasPermissions(@NonNull Object object,
348353
349354 /**
350355 * 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.
353359 * @param requestCode the requestCode passed to the annotation.
354360 */
355361 private static void runAnnotatedMethods (@ NonNull Object object , int requestCode ) {
@@ -360,9 +366,9 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)
360366
361367 while (clazz != null ) {
362368 for (Method method : clazz .getDeclaredMethods ()) {
363- if (method .isAnnotationPresent (AfterPermissionGranted .class )) {
369+ AfterPermissionGranted ann = method .getAnnotation (AfterPermissionGranted .class );
370+ if (ann != null ) {
364371 // Check for annotated methods with matching request code.
365- AfterPermissionGranted ann = method .getAnnotation (AfterPermissionGranted .class );
366372 if (ann .value () == requestCode ) {
367373 // Method must be void so that we can invoke it
368374 if (method .getParameterTypes ().length > 0 ) {
@@ -390,7 +396,7 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)
390396 }
391397
392398 /**
393- * Determine if the project is using the AndroidAnnoations library.
399+ * Determine if the project is using the AndroidAnnotations library.
394400 */
395401 private static boolean isUsingAndroidAnnotations (@ NonNull Object object ) {
396402 if (!object .getClass ().getSimpleName ().endsWith ("_" )) {
0 commit comments