diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 9a8b7e5..96cc43e 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
diff --git a/.idea/dictionaries/holybible.xml b/.idea/dictionaries/holybible.xml
new file mode 100644
index 0000000..01dd7df
--- /dev/null
+++ b/.idea/dictionaries/holybible.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 62d9317..b2f9aa0 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -5,7 +5,6 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/.idea/libraries/appcompat_v7_23_1_1.xml b/.idea/libraries/appcompat_v7_23_1_1.xml
index e310108..7630df0 100644
--- a/.idea/libraries/appcompat_v7_23_1_1.xml
+++ b/.idea/libraries/appcompat_v7_23_1_1.xml
@@ -1,15 +1,17 @@
-
+
+
-
-
+
+
-
+
+
\ No newline at end of file
diff --git a/.idea/libraries/butterknife_7_0_1.xml b/.idea/libraries/butterknife_7_0_1.xml
deleted file mode 100644
index 13dc3ce..0000000
--- a/.idea/libraries/butterknife_7_0_1.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/compiler_compiler.xml b/.idea/libraries/compiler_compiler.xml
deleted file mode 100644
index bf17687..0000000
--- a/.idea/libraries/compiler_compiler.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/mpermission_annotation_1_0_0.xml b/.idea/libraries/mpermission_annotation_1_0_0.xml
deleted file mode 100644
index fe27351..0000000
--- a/.idea/libraries/mpermission_annotation_1_0_0.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/mpermission_api_1_0_0.xml b/.idea/libraries/mpermission_api_1_0_0.xml
deleted file mode 100644
index 8649669..0000000
--- a/.idea/libraries/mpermission_api_1_0_0.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_23_1_1.xml b/.idea/libraries/support_annotations_23_1_1.xml
index 0339ca4..39c8444 100644
--- a/.idea/libraries/support_annotations_23_1_1.xml
+++ b/.idea/libraries/support_annotations_23_1_1.xml
@@ -1,11 +1,11 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_23_1_1.xml b/.idea/libraries/support_v4_23_1_1.xml
index c8b00b3..33b2c1f 100644
--- a/.idea/libraries/support_v4_23_1_1.xml
+++ b/.idea/libraries/support_v4_23_1_1.xml
@@ -1,16 +1,18 @@
-
+
+
-
-
-
+
+
+
-
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index dae7a60..b8fbcee 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -27,6 +27,22 @@
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
+
@@ -37,7 +53,7 @@
-
+
@@ -47,7 +63,18 @@
- 1.7
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b51822f..64936c4 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,22 +1,39 @@
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -29,75 +46,91 @@
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
@@ -105,6 +138,13 @@
+
+
+
+
+
+
+
@@ -121,8 +161,8 @@
-
-
+
+
@@ -137,8 +177,8 @@
-
-
+
+
@@ -150,6 +190,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -181,7 +276,7 @@
-
+
@@ -191,12 +286,12 @@
-
+
-
+
@@ -224,12 +319,12 @@
-
+
-
+
@@ -254,7 +349,7 @@
-
+
@@ -284,12 +379,10 @@
-
-
@@ -303,17 +396,16 @@
-
-
+
-
+
@@ -335,7 +427,7 @@
-
+
@@ -345,13 +437,17 @@
+
+
+
+
-
+
@@ -361,13 +457,17 @@
+
+
+
+
-
+
@@ -383,7 +483,7 @@
-
+
@@ -393,13 +493,17 @@
+
+
+
+
-
+
@@ -411,14 +515,14 @@
-
+
-
+
-
+
-
+
@@ -442,10 +546,6 @@
-
-
-
-
@@ -516,6 +616,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -564,72 +684,72 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
+
-
+
@@ -643,14 +763,6 @@
-
-
-
-
-
-
-
-
@@ -665,7 +777,7 @@
-
+
@@ -754,37 +866,86 @@
+
+
+
+
+
-
+
-
+
-
-
+
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -814,16 +975,24 @@
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
@@ -865,6 +1034,11 @@
+
+
+
+
+
@@ -876,7 +1050,7 @@
-
+
@@ -886,20 +1060,40 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -919,15 +1113,30 @@
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -943,13 +1152,18 @@
+
+
+
+
+
-
+
@@ -984,6 +1198,11 @@
+
+
+
+
+
@@ -995,7 +1214,7 @@
-
+
@@ -1005,20 +1224,40 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1038,15 +1277,30 @@
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1062,13 +1316,18 @@
+
+
+
+
+
-
+
@@ -1109,12 +1368,10 @@
-
-
@@ -1128,7 +1385,6 @@
-
@@ -1147,18 +1403,23 @@
+
+
+
+
+
-
+
-
+
@@ -1190,7 +1451,7 @@
-
+
@@ -1200,13 +1461,17 @@
+
+
+
+
-
+
@@ -1216,13 +1481,17 @@
+
+
+
+
-
+
@@ -1238,7 +1507,7 @@
-
+
@@ -1248,33 +1517,42 @@
+
+
+
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
@@ -1288,18 +1566,24 @@
-
+
-
+
-
+
-
+
+
+
+
+
+
+
-
+
@@ -1376,6 +1660,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1422,74 +1731,79 @@
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
-
+
-
+
-
+
@@ -1503,14 +1817,6 @@
-
-
-
-
-
-
-
-
@@ -1525,7 +1831,7 @@
-
+
@@ -1609,6 +1915,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -1629,6 +1945,16 @@
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MPermissions.iml b/MPermissions.iml
index b634f71..c5c5d64 100644
--- a/MPermissions.iml
+++ b/MPermissions.iml
@@ -13,7 +13,7 @@
-
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index adbc66c..406ceec 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,9 +5,9 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
- classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
- classpath 'com.novoda:bintray-release:0.2.10'
+ classpath 'com.android.tools.build:gradle:2.1.2'
+ classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
+ classpath 'com.novoda:bintray-release:0.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/compiler/src/main/java/com/zhy/m/permission/PermissionProcessor.java b/compiler/src/main/java/com/zhy/m/permission/PermissionProcessor.java
index 87abfe7..2ba6815 100644
--- a/compiler/src/main/java/com/zhy/m/permission/PermissionProcessor.java
+++ b/compiler/src/main/java/com/zhy/m/permission/PermissionProcessor.java
@@ -28,40 +28,35 @@
import static javax.lang.model.SourceVersion.latestSupported;
@AutoService(Processor.class)
-public class PermissionProcessor extends AbstractProcessor
-{
+public class PermissionProcessor extends AbstractProcessor {
private Messager messager;
private Elements elementUtils;
private Map mProxyMap = new HashMap();
@Override
- public synchronized void init(ProcessingEnvironment processingEnv)
- {
+ public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
messager = processingEnv.getMessager();
elementUtils = processingEnv.getElementUtils();
}
@Override
- public Set getSupportedAnnotationTypes()
- {
+ public Set getSupportedAnnotationTypes() {
HashSet supportTypes = new LinkedHashSet<>();
supportTypes.add(PermissionDenied.class.getCanonicalName());
supportTypes.add(PermissionGrant.class.getCanonicalName());
+ supportTypes.add(PermissionGot.class.getCanonicalName());
supportTypes.add(ShowRequestPermissionRationale.class.getCanonicalName());
return supportTypes;
}
@Override
- public SourceVersion getSupportedSourceVersion()
- {
+ public SourceVersion getSupportedSourceVersion() {
return latestSupported();
}
- private boolean processAnnotations(RoundEnvironment roundEnv, Class extends Annotation> clazz)
- {
- for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(clazz))
- {
+ private boolean processAnnotations(RoundEnvironment roundEnv, Class extends Annotation> clazz) {
+ for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(clazz)) {
if (!checkMethodValid(annotatedElement, clazz)) return false;
@@ -72,8 +67,7 @@ private boolean processAnnotations(RoundEnvironment roundEnv, Class extends An
String fqClassName = classElement.getQualifiedName().toString();
ProxyInfo proxyInfo = mProxyMap.get(fqClassName);
- if (proxyInfo == null)
- {
+ if (proxyInfo == null) {
proxyInfo = new ProxyInfo(elementUtils, classElement);
mProxyMap.put(fqClassName, proxyInfo);
proxyInfo.setTypeElement(classElement);
@@ -81,20 +75,19 @@ private boolean processAnnotations(RoundEnvironment roundEnv, Class extends An
Annotation annotation = annotatedMethod.getAnnotation(clazz);
- if (annotation instanceof PermissionGrant)
- {
+ if (annotation instanceof PermissionGot) {
+ int requestCode = ((PermissionGot) annotation).value();
+ proxyInfo.gotMethodMap.put(requestCode, annotatedMethod.getSimpleName().toString());
+ } else if (annotation instanceof PermissionGrant) {
int requestCode = ((PermissionGrant) annotation).value();
proxyInfo.grantMethodMap.put(requestCode, annotatedMethod.getSimpleName().toString());
- } else if (annotation instanceof PermissionDenied)
- {
+ } else if (annotation instanceof PermissionDenied) {
int requestCode = ((PermissionDenied) annotation).value();
proxyInfo.deniedMethodMap.put(requestCode, annotatedMethod.getSimpleName().toString());
- } else if (annotation instanceof ShowRequestPermissionRationale)
- {
+ } else if (annotation instanceof ShowRequestPermissionRationale) {
int requestCode = ((ShowRequestPermissionRationale) annotation).value();
proxyInfo.rationaleMethodMap.put(requestCode, annotatedMethod.getSimpleName().toString());
- } else
- {
+ } else {
error(annotatedElement, "%s not support .", clazz.getSimpleName());
return false;
}
@@ -105,21 +98,19 @@ private boolean processAnnotations(RoundEnvironment roundEnv, Class extends An
}
@Override
- public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv)
- {
+ public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
mProxyMap.clear();
messager.printMessage(Diagnostic.Kind.NOTE, "process...");
+ if (!processAnnotations(roundEnv, PermissionGot.class)) return false;
if (!processAnnotations(roundEnv, PermissionGrant.class)) return false;
if (!processAnnotations(roundEnv, PermissionDenied.class)) return false;
if (!processAnnotations(roundEnv, ShowRequestPermissionRationale.class)) return false;
- for (String key : mProxyMap.keySet())
- {
+ for (String key : mProxyMap.keySet()) {
ProxyInfo proxyInfo = mProxyMap.get(key);
- try
- {
+ try {
JavaFileObject jfo = processingEnv.getFiler().createSourceFile(
proxyInfo.getProxyClassFullName(),
proxyInfo.getTypeElement());
@@ -127,8 +118,7 @@ public boolean process(Set extends TypeElement> annotations, RoundEnvironment
writer.write(proxyInfo.generateJavaCode());
writer.flush();
writer.close();
- } catch (IOException e)
- {
+ } catch (IOException e) {
error(proxyInfo.getTypeElement(),
"Unable to write injector for type %s: %s",
proxyInfo.getTypeElement(), e.getMessage());
@@ -138,24 +128,19 @@ public boolean process(Set extends TypeElement> annotations, RoundEnvironment
return true;
}
- private void error(Element element, String message, Object... args)
- {
- if (args.length > 0)
- {
+ private void error(Element element, String message, Object... args) {
+ if (args.length > 0) {
message = String.format(message, args);
}
processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, message, element);
}
- private boolean checkMethodValid(Element annotatedElement, Class clazz)
- {
- if (annotatedElement.getKind() != ElementKind.METHOD)
- {
+ private boolean checkMethodValid(Element annotatedElement, Class clazz) {
+ if (annotatedElement.getKind() != ElementKind.METHOD) {
error(annotatedElement, "%s must be declared on method.", clazz.getSimpleName());
return false;
}
- if (ClassValidator.isPrivate(annotatedElement) || ClassValidator.isAbstract(annotatedElement))
- {
+ if (ClassValidator.isPrivate(annotatedElement) || ClassValidator.isAbstract(annotatedElement)) {
error(annotatedElement, "%s() must can not be abstract or private.", annotatedElement.getSimpleName());
return false;
}
diff --git a/compiler/src/main/java/com/zhy/m/permission/ProxyInfo.java b/compiler/src/main/java/com/zhy/m/permission/ProxyInfo.java
index 1fdddd7..234f18d 100644
--- a/compiler/src/main/java/com/zhy/m/permission/ProxyInfo.java
+++ b/compiler/src/main/java/com/zhy/m/permission/ProxyInfo.java
@@ -7,20 +7,19 @@
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
-public class ProxyInfo
-{
+public class ProxyInfo {
private String packageName;
private String proxyClassName;
private TypeElement typeElement;
Map grantMethodMap = new HashMap<>();
Map deniedMethodMap = new HashMap<>();
+ Map gotMethodMap = new HashMap<>();
Map rationaleMethodMap = new HashMap<>();
public static final String PROXY = "PermissionProxy";
- public ProxyInfo(Elements elementUtils, TypeElement classElement)
- {
+ public ProxyInfo(Elements elementUtils, TypeElement classElement) {
PackageElement packageElement = elementUtils.getPackageOf(classElement);
String packageName = packageElement.getQualifiedName().toString();
//classname
@@ -30,13 +29,11 @@ public ProxyInfo(Elements elementUtils, TypeElement classElement)
}
- public String getProxyClassFullName()
- {
+ public String getProxyClassFullName() {
return packageName + "." + proxyClassName;
}
- public String generateJavaCode()
- {
+ public String generateJavaCode() {
StringBuilder builder = new StringBuilder();
builder.append("// Generated code. Do not modify!\n");
builder.append("package ").append(packageName).append(";\n\n");
@@ -55,9 +52,9 @@ public String generateJavaCode()
}
- private void generateMethods(StringBuilder builder)
- {
+ private void generateMethods(StringBuilder builder) {
+ generateGotMethod(builder);
generateGrantMethod(builder);
generateDeniedMethod(builder);
generateRationaleMethod(builder);
@@ -65,13 +62,11 @@ private void generateMethods(StringBuilder builder)
}
- private void generateRationaleMethod(StringBuilder builder)
- {
+ private void generateRationaleMethod(StringBuilder builder) {
builder.append("@Override\n ");
builder.append("public void rationale(" + typeElement.getSimpleName() + " source , int requestCode) {\n");
builder.append("switch(requestCode) {");
- for (int code : rationaleMethodMap.keySet())
- {
+ for (int code : rationaleMethodMap.keySet()) {
builder.append("case " + code + ":");
builder.append("source." + rationaleMethodMap.get(code) + "();");
builder.append("break;");
@@ -85,8 +80,7 @@ private void generateRationaleMethod(StringBuilder builder)
builder.append("@Override\n ");
builder.append("public boolean needShowRationale(int requestCode) {\n");
builder.append("switch(requestCode) {");
- for (int code : rationaleMethodMap.keySet())
- {
+ for (int code : rationaleMethodMap.keySet()) {
builder.append("case " + code + ":");
builder.append("return true;");
}
@@ -96,13 +90,28 @@ private void generateRationaleMethod(StringBuilder builder)
builder.append(" }\n");
}
- private void generateDeniedMethod(StringBuilder builder)
- {
+ private void generateGotMethod(StringBuilder builder) {
+ builder.append("@Override\n ");
+ builder.append("public void got(" + typeElement.getSimpleName() + " source , int requestCode) {\n");
+ builder.append("switch(requestCode) {");
+ for (int code : gotMethodMap.keySet()) {
+ builder.append("case " + code + ":");
+ builder.append("source." + gotMethodMap.get(code) + "();");
+ builder.append("break;");
+ }
+ builder.append("default:");
+ builder.append("grant(source, requestCode);");
+ builder.append("break;");
+
+ builder.append("}");
+ builder.append(" }\n");
+ }
+
+ private void generateDeniedMethod(StringBuilder builder) {
builder.append("@Override\n ");
builder.append("public void denied(" + typeElement.getSimpleName() + " source , int requestCode) {\n");
builder.append("switch(requestCode) {");
- for (int code : deniedMethodMap.keySet())
- {
+ for (int code : deniedMethodMap.keySet()) {
builder.append("case " + code + ":");
builder.append("source." + deniedMethodMap.get(code) + "();");
builder.append("break;");
@@ -112,13 +121,11 @@ private void generateDeniedMethod(StringBuilder builder)
builder.append(" }\n");
}
- private void generateGrantMethod(StringBuilder builder)
- {
+ private void generateGrantMethod(StringBuilder builder) {
builder.append("@Override\n ");
builder.append("public void grant(" + typeElement.getSimpleName() + " source , int requestCode) {\n");
builder.append("switch(requestCode) {");
- for (int code : grantMethodMap.keySet())
- {
+ for (int code : grantMethodMap.keySet()) {
builder.append("case " + code + ":");
builder.append("source." + grantMethodMap.get(code) + "();");
builder.append("break;");
@@ -128,13 +135,11 @@ private void generateGrantMethod(StringBuilder builder)
builder.append(" }\n");
}
- public TypeElement getTypeElement()
- {
+ public TypeElement getTypeElement() {
return typeElement;
}
- public void setTypeElement(TypeElement typeElement)
- {
+ public void setTypeElement(TypeElement typeElement) {
this.typeElement = typeElement;
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 8a284c0..cd84193 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/permission-annotation/src/main/java/com/zhy/m/permission/PermissionGot.java b/permission-annotation/src/main/java/com/zhy/m/permission/PermissionGot.java
new file mode 100644
index 0000000..49a875d
--- /dev/null
+++ b/permission-annotation/src/main/java/com/zhy/m/permission/PermissionGot.java
@@ -0,0 +1,12 @@
+package com.zhy.m.permission;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+/**
+ * Created by holybible on 16/8/5.
+ */
+@Target(ElementType.METHOD)
+public @interface PermissionGot {
+ int value();
+}
diff --git a/permission-lib/build.gradle b/permission-lib/build.gradle
index 0d50e3b..e0119d2 100644
--- a/permission-lib/build.gradle
+++ b/permission-lib/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'bintray-release'
android {
compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 10
diff --git a/permission-lib/permission-lib.iml b/permission-lib/permission-lib.iml
index 774f510..6e1a4d8 100644
--- a/permission-lib/permission-lib.iml
+++ b/permission-lib/permission-lib.iml
@@ -12,10 +12,7 @@
-
-
- generateDebugAndroidTestSources
generateDebugSources
@@ -29,7 +26,7 @@
-
+
@@ -37,13 +34,13 @@
-
+
-
+
@@ -51,6 +48,15 @@
+
+
+
+
+
+
+
+
+
@@ -58,6 +64,7 @@
+
@@ -65,32 +72,39 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
+
+
-
-
-
-
+
+
-
+
-
+
diff --git a/permission-lib/src/main/java/com/zhy/m/permission/MPermissions.java b/permission-lib/src/main/java/com/zhy/m/permission/MPermissions.java
index 83ae3ef..b5eba42 100644
--- a/permission-lib/src/main/java/com/zhy/m/permission/MPermissions.java
+++ b/permission-lib/src/main/java/com/zhy/m/permission/MPermissions.java
@@ -48,7 +48,8 @@ private static void _requestPermissions(Object object, int requestCode, String..
{
if (!Utils.isOverMarshmallow())
{
- doExecuteSuccess(object, requestCode);
+// doExecuteSuccess(object, requestCode);
+ doExecuteGot(object, requestCode);
return;
}
List deniedPermissions = Utils.findDeniedPermissions(Utils.getActivity(object), permissions);
@@ -67,7 +68,8 @@ private static void _requestPermissions(Object object, int requestCode, String..
}
} else
{
- doExecuteSuccess(object, requestCode);
+ doExecuteGot(object, requestCode);
+// doExecuteSuccess(object, requestCode);
}
}
@@ -93,6 +95,10 @@ private static PermissionProxy findPermissionProxy(Object activity)
}
+ private static void doExecuteGot(Object activity, int requestCode) {
+ findPermissionProxy(activity).got(activity, requestCode);
+ }
+
private static void doExecuteSuccess(Object activity, int requestCode)
{
findPermissionProxy(activity).grant(activity, requestCode);
diff --git a/permission-lib/src/main/java/com/zhy/m/permission/PermissionProxy.java b/permission-lib/src/main/java/com/zhy/m/permission/PermissionProxy.java
index 7fb25de..788ddab 100644
--- a/permission-lib/src/main/java/com/zhy/m/permission/PermissionProxy.java
+++ b/permission-lib/src/main/java/com/zhy/m/permission/PermissionProxy.java
@@ -5,6 +5,8 @@
*/
public interface PermissionProxy
{
+ void got(T source, int requestCode);
+
void grant(T source, int requestCode);
void denied(T source, int requestCode);
diff --git a/permission-sample/build.gradle b/permission-sample/build.gradle
index b719da4..d65d6f6 100644
--- a/permission-sample/build.gradle
+++ b/permission-sample/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.zhy.permission_sample"
@@ -30,10 +30,10 @@ dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
-// compile project(':permission-lib')
-// apt project(':compiler')
+ compile project(':permission-lib')
+ apt project(':compiler')
- apt 'com.zhy:mpermission-compiler:1.0.0'
- compile 'com.zhy:mpermission-api:1.0.0'
+// apt 'com.zhy:mpermission-compiler:1.0.0'
+// compile 'com.zhy:mpermission-api:1.0.0'
}
diff --git a/permission-sample/permission-sample.iml b/permission-sample/permission-sample.iml
index acf4e91..61acbb9 100644
--- a/permission-sample/permission-sample.iml
+++ b/permission-sample/permission-sample.iml
@@ -12,10 +12,7 @@
-
-
- generateDebugAndroidTestSources
generateDebugSources
@@ -28,22 +25,22 @@
-
+
+
-
-
+
-
+
@@ -51,6 +48,15 @@
+
+
+
+
+
+
+
+
+
@@ -58,6 +64,7 @@
+
@@ -65,37 +72,40 @@
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
+
-
-
+
-
+
+
\ No newline at end of file
diff --git a/permission-sample/src/main/java/com/zhy/permission_sample/MainActivity.java b/permission-sample/src/main/java/com/zhy/permission_sample/MainActivity.java
index 3c12faf..e07a789 100644
--- a/permission-sample/src/main/java/com/zhy/permission_sample/MainActivity.java
+++ b/permission-sample/src/main/java/com/zhy/permission_sample/MainActivity.java
@@ -9,6 +9,7 @@
import com.zhy.m.permission.MPermissions;
import com.zhy.m.permission.PermissionDenied;
+import com.zhy.m.permission.PermissionGot;
import com.zhy.m.permission.PermissionGrant;
import com.zhy.m.permission.ShowRequestPermissionRationale;
@@ -68,6 +69,10 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
+ @PermissionGot(REQUECT_CODE_SDCARD)
+ public void sdCardAlreadyGot() {
+ Toast.makeText(this, "GOT ACCESS SDCARD!", Toast.LENGTH_SHORT).show();
+ }
@PermissionGrant(REQUECT_CODE_SDCARD)
public void requestSdcardSuccess()