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

Update all the things! #152

Merged
merged 1 commit into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ android:
components:
- tools
- platform-tools
- build-tools-25.0.3
- android-25
- extra-android-m2repository
- build-tools-26.0.1
- android-26

script: ./gradlew build
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {

defaultConfig {
applicationId "pub.devrel.easypermissions.sample"
minSdkVersion 9
minSdkVersion 14
targetSdkVersion targetSdk
versionCode 1
versionName "1.0"
Expand All @@ -28,5 +28,5 @@ dependencies {
compile project(':easypermissions')

testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.3.2'
testCompile 'org.robolectric:robolectric:3.4.2'
}
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha8'
classpath 'com.android.tools.build:gradle:3.0.0-beta2'

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
Expand All @@ -15,7 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}
}

Expand All @@ -35,9 +35,9 @@ ext {

bintrayOrg = 'easygoogle'

support_library_version = '25.3.1'
support_library_version = '26.0.1'

buildTools = '25.0.3'
compileSdk = 25
targetSdk = 25
buildTools = '26.0.1'
compileSdk = 26
targetSdk = 26
}
2 changes: 1 addition & 1 deletion easypermissions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android {
buildToolsVersion buildTools

defaultConfig {
minSdkVersion 9
minSdkVersion 14
targetSdkVersion targetSdk
versionCode 1
versionName mavenVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public static boolean hasPermissions(Context context, @NonNull String... perms)

/**
* Request permissions from an Activity with standard OK/Cancel buttons.
*
* @see #requestPermissions(Activity, String, int, int, int, String...)
*/
public static void requestPermissions(
Expand All @@ -100,6 +101,7 @@ public static void requestPermissions(

/**
* Request permissions from a Support Fragment with standard OK/Cancel buttons.
*
* @see #requestPermissions(Activity, String, int, int, int, String...)
*/
public static void requestPermissions(
Expand All @@ -112,6 +114,7 @@ public static void requestPermissions(

/**
* Request permissions from a standard Fragment with standard OK/Cancel buttons.
*
* @see #requestPermissions(Activity, String, int, int, int, String...)
*/
public static void requestPermissions(
Expand Down Expand Up @@ -145,6 +148,7 @@ public static void requestPermissions(

/**
* Request permissions from a Support Fragment.
*
* @see #requestPermissions(Activity, String, int, int, int, String...)
*/
public static void requestPermissions(
Expand Down Expand Up @@ -302,7 +306,7 @@ public static boolean permissionPermanentlyDenied(@NonNull android.app.Fragment
/**
* See if some denied permission has been permanently denied.
*
* @param host requesting context.
* @param host requesting context.
* @param perms array of permissions.
* @return true if the user has previously denied any of the {@code perms} and we should show a
* rationale, false otherwise.
Expand All @@ -329,11 +333,12 @@ public static boolean somePermissionDenied(@NonNull android.app.Fragment host,
}

/**
* Run permission callbacks on an object that requested permissions but already has them
* by simulating {@link PackageManager#PERMISSION_GRANTED}.
* @param object the object requesting permissions.
* Run permission callbacks on an object that requested permissions but already has them by
* simulating {@link PackageManager#PERMISSION_GRANTED}.
*
* @param object the object requesting permissions.
* @param requestCode the permission request code.
* @param perms a list of permissions requested.
* @param perms a list of permissions requested.
*/
private static void notifyAlreadyHasPermissions(@NonNull Object object,
int requestCode,
Expand All @@ -348,8 +353,9 @@ private static void notifyAlreadyHasPermissions(@NonNull Object object,

/**
* Find all methods annotated with {@link AfterPermissionGranted} on a given object with the
* correc requestCode argument.
* @param object the object with annotated methods.
* correct requestCode argument.
*
* @param object the object with annotated methods.
* @param requestCode the requestCode passed to the annotation.
*/
private static void runAnnotatedMethods(@NonNull Object object, int requestCode) {
Expand All @@ -360,9 +366,9 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)

while (clazz != null) {
for (Method method : clazz.getDeclaredMethods()) {
if (method.isAnnotationPresent(AfterPermissionGranted.class)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intellij started complaining about this being a java 8 only feature. It shouldn't really matter since marshmallow came with 1.8, but I've made it backwards compatible anyway.

AfterPermissionGranted ann = method.getAnnotation(AfterPermissionGranted.class);
if (ann != null) {
// Check for annotated methods with matching request code.
AfterPermissionGranted ann = method.getAnnotation(AfterPermissionGranted.class);
if (ann.value() == requestCode) {
// Method must be void so that we can invoke it
if (method.getParameterTypes().length > 0) {
Expand Down Expand Up @@ -390,7 +396,7 @@ private static void runAnnotatedMethods(@NonNull Object object, int requestCode)
}

/**
* Determine if the project is using the AndroidAnnoations library.
* Determine if the project is using the AndroidAnnotations library.
*/
private static boolean isUsingAndroidAnnotations(@NonNull Object object) {
if (!object.getClass().getSimpleName().endsWith("_")) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jun 14 07:57:23 PDT 2017
#Fri Aug 18 16:20:16 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip