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

Commit

Permalink
Migrate to AndroidX (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern authored Jan 23, 2019
1 parent 62ee80e commit 67d611b
Show file tree
Hide file tree
Showing 32 changed files with 231 additions and 187 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ EasyPermissions is installed by adding the following dependency to your `build.g

```groovy
dependencies {
   implementation 'pub.devrel:easypermissions:2.0.1'
// For developers using AndroidX in their applications
   implementation 'pub.devrel:easypermissions:3.0.0'
// For developers using the Android Support Library
implementation 'pub.devrel:easypermissions:2.0.1'
}
```

Expand Down
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ android {
}

dependencies {
implementation "com.android.support:appcompat-v7:$support_library_version"

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation project(':easypermissions')
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import android.Manifest;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -12,6 +10,8 @@

import java.util.List;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;

Expand Down
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.13.0'
}
Expand All @@ -31,12 +31,10 @@ ext {

mavenGroup = 'pub.devrel'
mavenArtifactId = 'easypermissions'
mavenVersion = '2.0.1'
mavenVersion = '3.0.0'

bintrayOrg = 'easygoogle'

support_library_version = '28.0.0'

compileSdk = 28
targetSdk = 28
}
9 changes: 5 additions & 4 deletions easypermissions/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ junitJacoco {
}

dependencies {
api "com.android.support:appcompat-v7:$support_library_version"
api "com.android.support:support-compat:$support_library_version"
api "com.android.support:support-fragment:$support_library_version"
api "androidx.appcompat:appcompat:1.0.2"
api "androidx.core:core:1.0.1"
api "androidx.fragment:fragment:1.0.0"

testImplementation 'junit:junit:4.12'
testImplementation 'com.google.truth:truth:0.42'
testImplementation 'org.robolectric:robolectric:4.1'
testImplementation 'org.robolectric:shadows-supportv4:4.1'
testImplementation 'androidx.test:core:1.1.0'
testImplementation 'androidx.fragment:fragment-testing:1.1.0-alpha03'
testImplementation 'org.mockito:mockito-core:2.23.4'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.StringRes;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;

/**
* Dialog to prompt the user to go to the app's settings screen and enable permissions. If the user
* clicks 'OK' on the dialog, they are sent to the settings screen. The result is returned to the
Expand Down Expand Up @@ -119,7 +120,7 @@ public void show() {
AlertDialog showDialog(DialogInterface.OnClickListener positiveListener,
DialogInterface.OnClickListener negativeListener) {
AlertDialog.Builder builder;
if (mThemeResId > 0) {
if (mThemeResId != -1) {
builder = new AlertDialog.Builder(mContext, mThemeResId);
} else {
builder = new AlertDialog.Builder(mContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.RestrictTo;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.RestrictTo;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class AppSettingsDialogHolderActivity extends AppCompatActivity implements DialogInterface.OnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Size;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import androidx.annotation.NonNull;
import androidx.annotation.Size;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.core.content.ContextCompat;
import android.util.Log;

import java.lang.reflect.InvocationTargetException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package pub.devrel.easypermissions;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.annotation.Size;
import android.support.annotation.StringRes;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.Size;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;
import androidx.fragment.app.Fragment;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v7.app.AlertDialog;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AlertDialog;

/**
* Configuration for either {@link RationaleDialogFragment} or {@link RationaleDialogFragmentCompat}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.annotation.StyleRes;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleRes;

/**
* {@link DialogFragment} to display rationale for permission requests when the request comes from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.annotation.StyleRes;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatDialogFragment;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleRes;
import androidx.fragment.app.FragmentManager;
import androidx.appcompat.app.AppCompatDialogFragment;

/**
* {@link AppCompatDialogFragment} to display rationale for permission requests when the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v4.app.ActivityCompat;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.core.app.ActivityCompat;
import android.util.Log;

import pub.devrel.easypermissions.RationaleDialogFragment;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package pub.devrel.easypermissions.helper;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.FragmentManager;
import androidx.appcompat.app.AppCompatActivity;

/**
* Permissions helper for {@link AppCompatActivity}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package pub.devrel.easypermissions.helper;

import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.util.Log;

import pub.devrel.easypermissions.RationaleDialogFragmentCompat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.fragment.app.Fragment;

/**
* Permissions helper for apps built against API < 23, which do not need runtime permissions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AppCompatActivity;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package pub.devrel.easypermissions.helper;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

/**
* Permissions helper for {@link Fragment} from the support library.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
package pub.devrel.easypermissions.helper;

import android.support.annotation.RestrictTo;
import androidx.annotation.RestrictTo;
Loading

1 comment on commit 67d611b

@Arti2102
Copy link

Choose a reason for hiding this comment

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

gradle.properties

Please sign in to comment.