diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..4aaa807
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,28 @@
+language: android
+jdk: oraclejdk8
+
+android:
+ components:
+ - tools
+ - platform-tools
+
+before_install:
+ # Install SDK license so Android Gradle plugin can install deps.
+ - mkdir "$ANDROID_HOME/licenses" || true
+ - echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
+ - yes | sdkmanager tools
+
+
+script:
+ - ./gradlew check test
+
+sudo: false
+
+before_cache:
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+
+cache:
+ directories:
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index dc00fe6..49de559 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 26
- buildToolsVersion '26.0.1'
+ compileSdkVersion 27
+
dataBinding {
enabled = true
}
defaultConfig {
applicationId "se.eelde.granter.app"
minSdkVersion 17
- targetSdkVersion 26
+ targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -27,9 +27,8 @@ android {
}
dependencies {
- implementation 'com.android.support:appcompat-v7:26.0.2'
+ implementation 'com.android.support:appcompat-v7:27.0.1'
+ implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation project(path: ':granter')
-
- compile 'com.greysonparrelli.permiso:permiso:0.3.0'
}
diff --git a/app/src/main/java/se/eelde/granter/app/PermisoPermissionActivity.java b/app/src/main/java/se/eelde/granter/app/PermisoPermissionActivity.java
deleted file mode 100644
index e460166..0000000
--- a/app/src/main/java/se/eelde/granter/app/PermisoPermissionActivity.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package se.eelde.granter.app;
-
-import android.Manifest;
-import android.content.Context;
-import android.content.Intent;
-import android.databinding.DataBindingUtil;
-import android.os.Bundle;
-
-import com.greysonparrelli.permiso.Permiso;
-import com.greysonparrelli.permiso.PermisoActivity;
-
-import se.eelde.granter.app.databinding.ActivityPermisoPermissionBinding;
-
-public class PermisoPermissionActivity extends PermisoActivity {
-
- private ActivityPermisoPermissionBinding binding;
-
- public static void start(Context context) {
- context.startActivity(new Intent(context, PermisoPermissionActivity.class));
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_regular_permission);
- binding = DataBindingUtil.setContentView(this, R.layout.activity_permiso_permission);
-
- Permiso.getInstance().setActivity(this);
-
- binding.permisoPermission.setOnClickListener(view -> Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
- @Override
- public void onPermissionResult(Permiso.ResultSet resultSet) {
- moveToNextStep();
- }
-
- @Override
- public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
- Permiso.getInstance().showRationaleInDialog("Title", "Message", null, callback);
- }
- }, Manifest.permission.ACCESS_FINE_LOCATION));
- }
-
- private void moveToNextStep() {
- getSupportFragmentManager()
- .beginTransaction()
- .replace(binding.fragmentContainer.getId(), DummyFragment.newInstance())
- .commit();
- }
-}
diff --git a/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.java b/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.java
index 1212fa2..09208c0 100644
--- a/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.java
+++ b/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.java
@@ -29,8 +29,6 @@ protected void onCreate(Bundle savedInstanceState) {
binding.regularPermission.setOnClickListener(view -> RegularPermissionActivity.start(this));
- binding.buttonPermisoPermission.setOnClickListener(view -> PermisoPermissionActivity.start(this));
-
binding.permission1Button.setOnClickListener(view -> new Granter.Builder(this)
.requestCode(RC_CAMERA)
.addPermission(Manifest.permission.CAMERA)
diff --git a/app/src/main/res/layout/activity_permission_requesting.xml b/app/src/main/res/layout/activity_permission_requesting.xml
index 5480229..bdb32e1 100644
--- a/app/src/main/res/layout/activity_permission_requesting.xml
+++ b/app/src/main/res/layout/activity_permission_requesting.xml
@@ -29,8 +29,7 @@
android:text="@string/permission_1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/button_permiso_permission" />
-
+ app:layout_constraintTop_toBottomOf="@+id/regular_permission" />
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 03ae81c..020eae2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.0-beta5'
+ classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
diff --git a/granter/build.gradle b/granter/build.gradle
index a8035b0..bcc3bdc 100644
--- a/granter/build.gradle
+++ b/granter/build.gradle
@@ -1,13 +1,11 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 26
- buildToolsVersion "26.0.1"
-
-
+ compileSdkVersion 27
+
defaultConfig {
minSdkVersion 15
- targetSdkVersion 26
+ targetSdkVersion 27
versionCode 1
versionName "1.0"
@@ -23,7 +21,7 @@ android {
}
dependencies {
- implementation 'com.android.support:appcompat-v7:26.0.2'
+ implementation 'com.android.support:appcompat-v7:27.0.1'
- api 'pub.devrel:easypermissions:1.0.0'
+ api 'pub.devrel:easypermissions:1.0.1'
}
diff --git a/granter/src/main/java/se/eelde/granter/Granter.java b/granter/src/main/java/se/eelde/granter/Granter.java
index bc14546..c1f8ef9 100644
--- a/granter/src/main/java/se/eelde/granter/Granter.java
+++ b/granter/src/main/java/se/eelde/granter/Granter.java
@@ -35,7 +35,7 @@ public static class Builder {
private final FragmentManager fragmentManager;
private final ArrayList permissions = new ArrayList<>();
private final Resources resources;
- private int requestCode;
+ private int requestCode = 7896;
private String rationale = null;
private String systemSettingRationale = null;
diff --git a/granter/src/main/java/se/eelde/granter/GranterFragment.java b/granter/src/main/java/se/eelde/granter/GranterFragment.java
index 1320d8d..e466edc 100644
--- a/granter/src/main/java/se/eelde/granter/GranterFragment.java
+++ b/granter/src/main/java/se/eelde/granter/GranterFragment.java
@@ -58,10 +58,12 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
shouldHaveShownRationale = Stolen.shouldShowRationale(this, requestedPermissions);
if (!EasyPermissions.hasPermissions(getContext(), requestedPermissions)) {
- EasyPermissions.requestPermissions(this,
- rationale,
- RC_PERMISSIONS,
- requestedPermissions);
+ if (savedInstanceState == null) {
+ EasyPermissions.requestPermissions(this,
+ rationale,
+ RC_PERMISSIONS,
+ requestedPermissions);
+ }
} else {
int[] ints = new int[requestedPermissions.length];
Arrays.fill(ints, PackageManager.PERMISSION_GRANTED);