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

Commit bec916f

Browse files
committed
Update everything and fix #84 (Call annotated methods from super)
1 parent 178bc41 commit bec916f

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
}
55

66
dependencies {
7-
classpath 'com.android.tools.build:gradle:2.3.0-beta2'
7+
classpath 'com.android.tools.build:gradle:2.3.0-rc1'
88

99
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1010
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
@@ -33,7 +33,7 @@ ext {
3333

3434
bintrayOrg = 'easygoogle'
3535

36-
support_library_version = '25.1.0'
36+
support_library_version = '25.1.1'
3737

3838
buildTools = '25.0.2'
3939
compileSdk = 25

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

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -442,30 +442,34 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)
442442
clazz = clazz.getSuperclass();
443443
}
444444

445-
for (Method method : clazz.getDeclaredMethods()) {
446-
if (method.isAnnotationPresent(AfterPermissionGranted.class)) {
447-
// Check for annotated methods with matching request code.
448-
AfterPermissionGranted ann = method.getAnnotation(AfterPermissionGranted.class);
449-
if (ann.value() == requestCode) {
450-
// Method must be void so that we can invoke it
451-
if (method.getParameterTypes().length > 0) {
452-
throw new RuntimeException(
453-
"Cannot execute method " + method.getName() + " because it is non-void method and/or has input parameters.");
454-
}
445+
while (clazz != null) {
446+
for (Method method : clazz.getDeclaredMethods()) {
447+
if (method.isAnnotationPresent(AfterPermissionGranted.class)) {
448+
// Check for annotated methods with matching request code.
449+
AfterPermissionGranted ann = method.getAnnotation(AfterPermissionGranted.class);
450+
if (ann.value() == requestCode) {
451+
// Method must be void so that we can invoke it
452+
if (method.getParameterTypes().length > 0) {
453+
throw new RuntimeException(
454+
"Cannot execute method " + method.getName() + " because it is non-void method and/or has input parameters.");
455+
}
455456

456-
try {
457-
// Make method accessible if private
458-
if (!method.isAccessible()) {
459-
method.setAccessible(true);
457+
try {
458+
// Make method accessible if private
459+
if (!method.isAccessible()) {
460+
method.setAccessible(true);
461+
}
462+
method.invoke(object);
463+
} catch (IllegalAccessException e) {
464+
Log.e(TAG, "runDefaultMethod:IllegalAccessException", e);
465+
} catch (InvocationTargetException e) {
466+
Log.e(TAG, "runDefaultMethod:InvocationTargetException", e);
460467
}
461-
method.invoke(object);
462-
} catch (IllegalAccessException e) {
463-
Log.e(TAG, "runDefaultMethod:IllegalAccessException", e);
464-
} catch (InvocationTargetException e) {
465-
Log.e(TAG, "runDefaultMethod:InvocationTargetException", e);
466468
}
467469
}
468470
}
471+
472+
clazz = clazz.getSuperclass();
469473
}
470474
}
471475

gradle/wrapper/gradle-wrapper.jar

0 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Jan 17 19:09:58 PST 2017
1+
#Tue Feb 21 17:54:37 PST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip

0 commit comments

Comments
 (0)