diff --git a/app/build.gradle b/app/build.gradle
deleted file mode 100644
index 8d88099..0000000
--- a/app/build.gradle
+++ /dev/null
@@ -1,34 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 28
-
- dataBinding {
- enabled = true
- }
- defaultConfig {
- applicationId "se.eelde.granter.app"
- minSdkVersion 17
- targetSdkVersion 28
- versionCode 2
- versionName "1.0.1"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-
-dependencies {
- implementation 'com.android.support:appcompat-v7:28.0.0'
- implementation 'com.android.support:support-v4:28.0.0'
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
- implementation project(path: ':granter')
-}
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 0000000..217013d
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,39 @@
+plugins {
+ id("com.android.application")
+ kotlin("android")
+ kotlin("android.extensions")
+}
+
+android {
+ compileSdkVersion(28)
+
+ defaultConfig {
+ applicationId = "se.eelde.granter.app"
+ minSdkVersion(17)
+ targetSdkVersion(28)
+ versionCode = 2
+ versionName = "1.0.1"
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ implementation("androidx.appcompat:appcompat:1.0.2")
+ implementation("androidx.legacy:legacy-support-v4:1.0.0")
+ implementation("androidx.constraintlayout:constraintlayout:1.1.3")
+ implementation(project(path = ":granter"))
+ implementation(embeddedKotlin("stdlib-jdk7"))
+}
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2604fe5..9afff45 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
@@ -9,12 +10,13 @@
+ android:theme="@style/AppTheme"
+ tools:ignore="GoogleAppIndexingWarning">
@@ -24,8 +26,6 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..5302f47
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/se/eelde/granter/app/DummyFragment.java b/app/src/main/java/se/eelde/granter/app/DummyFragment.java
deleted file mode 100644
index 95b2557..0000000
--- a/app/src/main/java/se/eelde/granter/app/DummyFragment.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package se.eelde.granter.app;
-
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import se.eelde.granter.app.databinding.FragmentDummyBinding;
-
-public class DummyFragment extends Fragment {
- public DummyFragment() {
- }
-
- public static Fragment newInstance() {
- return new DummyFragment();
- }
-
- @Nullable
- @Override
- public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
- FragmentDummyBinding binding = FragmentDummyBinding.inflate(inflater, container, false);
- return binding.getRoot();
- }
-}
diff --git a/app/src/main/java/se/eelde/granter/app/DummyFragment.kt b/app/src/main/java/se/eelde/granter/app/DummyFragment.kt
new file mode 100644
index 0000000..98e4234
--- /dev/null
+++ b/app/src/main/java/se/eelde/granter/app/DummyFragment.kt
@@ -0,0 +1,19 @@
+package se.eelde.granter.app
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+
+class DummyFragment : Fragment() {
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ return inflater.inflate(R.layout.fragment_dummy, container, false)
+ }
+
+ companion object {
+ internal fun newInstance(): Fragment {
+ return DummyFragment()
+ }
+ }
+}
diff --git a/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.java b/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.java
deleted file mode 100644
index 408997c..0000000
--- a/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package se.eelde.granter.app;
-
-import android.Manifest;
-import android.databinding.DataBindingUtil;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v7.app.AppCompatActivity;
-import android.util.Log;
-import android.widget.Toast;
-
-import java.util.List;
-
-import pub.devrel.easypermissions.AfterPermissionGranted;
-import pub.devrel.easypermissions.EasyPermissions;
-import se.eelde.granter.Granter;
-import se.eelde.granter.app.databinding.ActivityPermissionRequestingBinding;
-
-public class PermissionRequestingActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks {
-
- public static final int RC_CAMERA = 121;
- public static final int RC_2 = 122;
- public static final int RC_multiple = 123;
- private static final String TAG = "PermissionActivity";
- private ActivityPermissionRequestingBinding binding;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- binding = DataBindingUtil.setContentView(this, R.layout.activity_permission_requesting);
-
- binding.regularPermission.setOnClickListener(view -> RegularPermissionActivity.start(this));
-
- binding.permission1Button.setOnClickListener(view -> new Granter.Builder(this)
- .requestCode(RC_CAMERA)
- .addPermission(Manifest.permission.CAMERA)
- .build()
- .show());
-
- binding.permission2Button.setOnClickListener(view -> new Granter.Builder(this)
- .requestCode(RC_2)
- .addPermission(Manifest.permission.SEND_SMS)
- .build()
- .show());
-
- binding.permissionMultipleButton.setOnClickListener(view -> new Granter.Builder(this)
- .requestCode(RC_multiple)
- .addPermission(Manifest.permission.RECORD_AUDIO, Manifest.permission.ACCESS_FINE_LOCATION)
- .rationale("This app neeeds access to audio and location!")
- .build()
- .show());
-
- if (savedInstanceState == null) {
- getSupportFragmentManager()
- .beginTransaction()
- .replace(binding.fragmentContainer.getId(), PermissionRequestingFragment.newInstance())
- .commit();
- }
- }
-
- @AfterPermissionGranted(RC_CAMERA)
- public void rc1() {
- Toast.makeText(this, "TODO: rc1 things", Toast.LENGTH_SHORT).show();
-
- getSupportFragmentManager()
- .beginTransaction()
- .replace(binding.fragmentContainer.getId(), DummyFragment.newInstance())
- .commit();
- }
-
- @AfterPermissionGranted(RC_2)
- public void rc2() {
- Toast.makeText(this, "TODO: rc2 things", Toast.LENGTH_SHORT).show();
- }
-
- @AfterPermissionGranted(RC_multiple)
- public void rc_multiple() {
- Toast.makeText(this, "TODO: rc_multiple things", Toast.LENGTH_SHORT).show();
- }
-
- @Override
- public void onPermissionsGranted(int requestCode, @NonNull List perms) {
- Log.d(TAG, "onPermissionsGranted:" + requestCode + ":" + perms.size());
- }
-
- @Override
- public void onPermissionsDenied(int requestCode, @NonNull List perms) {
- Log.d(TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size());
- }
-
-}
diff --git a/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.kt b/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.kt
new file mode 100644
index 0000000..6960629
--- /dev/null
+++ b/app/src/main/java/se/eelde/granter/app/PermissionRequestingActivity.kt
@@ -0,0 +1,91 @@
+package se.eelde.granter.app
+
+import android.Manifest
+import android.os.Bundle
+import android.util.Log
+import android.widget.Toast
+import androidx.appcompat.app.AppCompatActivity
+import kotlinx.android.synthetic.main.activity_permission_requesting.*
+import pub.devrel.easypermissions.AfterPermissionGranted
+import pub.devrel.easypermissions.EasyPermissions
+import se.eelde.granter.Granter
+
+class PermissionRequestingActivity : AppCompatActivity(), EasyPermissions.PermissionCallbacks {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ setContentView(R.layout.activity_permission_requesting)
+
+ regular_permission.setOnClickListener { RegularPermissionActivity.start(this) }
+
+ permission_1_button.setOnClickListener {
+ Granter.Builder(this)
+ .requestCode(RC_CAMERA)
+ .addPermission(Manifest.permission.CAMERA)
+ .build()
+ .show()
+ }
+
+ permission_2_button.setOnClickListener {
+ Granter.Builder(this)
+ .requestCode(RC_2)
+ .addPermission(Manifest.permission.SEND_SMS)
+ .build()
+ .show()
+ }
+
+ permission_multiple_button.setOnClickListener {
+ Granter.Builder(this)
+ .requestCode(RC_multiple)
+ .addPermission(Manifest.permission.RECORD_AUDIO, Manifest.permission.ACCESS_FINE_LOCATION)
+ .rationale("This app neeeds access to audio and location!")
+ .build()
+ .show()
+ }
+
+ if (savedInstanceState == null) {
+ supportFragmentManager
+ .beginTransaction()
+ .replace(fragment_container.id, PermissionRequestingFragment.newInstance())
+ .commit()
+ }
+ }
+
+ @AfterPermissionGranted(RC_CAMERA)
+ fun rc1() {
+ Toast.makeText(this, "TODO: rc1 things", Toast.LENGTH_SHORT).show()
+
+ supportFragmentManager
+ .beginTransaction()
+ .replace(fragment_container.id, DummyFragment.newInstance())
+ .commit()
+ }
+
+ @AfterPermissionGranted(RC_2)
+ fun rc2() {
+ Toast.makeText(this, "TODO: rc2 things", Toast.LENGTH_SHORT).show()
+ }
+
+ @AfterPermissionGranted(RC_multiple)
+ fun rc_multiple() {
+ Toast.makeText(this, "TODO: rc_multiple things", Toast.LENGTH_SHORT).show()
+ }
+
+ override fun onPermissionsGranted(requestCode: Int, perms: List) {
+ Log.d(TAG, "onPermissionsGranted:" + requestCode + ":" + perms.size)
+ }
+
+ override fun onPermissionsDenied(requestCode: Int, perms: List) {
+ Log.d(TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size)
+ }
+
+ companion object {
+ private const val TAG = "PermissionActivity"
+ private const val RC_CAMERA = 121
+ private const val RC_2 = 122
+ private const val RC_multiple = 123
+
+ }
+}
+
diff --git a/app/src/main/java/se/eelde/granter/app/PermissionRequestingFragment.java b/app/src/main/java/se/eelde/granter/app/PermissionRequestingFragment.java
deleted file mode 100644
index 9f2bcd1..0000000
--- a/app/src/main/java/se/eelde/granter/app/PermissionRequestingFragment.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package se.eelde.granter.app;
-
-import android.Manifest;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-import pub.devrel.easypermissions.AfterPermissionGranted;
-import se.eelde.granter.Granter;
-import se.eelde.granter.app.databinding.FragmentPermissionRequestingBinding;
-
-/**
- * Created in {@link R.layout#activity_permission_requesting}
- */
-public class PermissionRequestingFragment extends Fragment {
-
- private static final int RC_READ_CONTACTS_PERM = 122;
-
- public static Fragment newInstance() {
- return new PermissionRequestingFragment();
- }
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- FragmentPermissionRequestingBinding binding = FragmentPermissionRequestingBinding.inflate(inflater, container, false);
-
- binding.fragmentPermission1Button.setOnClickListener(view -> new Granter.Builder(this)
- .requestCode(RC_READ_CONTACTS_PERM)
- .addPermission(Manifest.permission.READ_CONTACTS)
- .build()
- .show());
-
- return binding.getRoot();
- }
-
- @AfterPermissionGranted(RC_READ_CONTACTS_PERM)
- private void contactsTask() {
- Toast.makeText(getActivity(), "TODO: Read contacts things", Toast.LENGTH_LONG).show();
- }
-}
diff --git a/app/src/main/java/se/eelde/granter/app/PermissionRequestingFragment.kt b/app/src/main/java/se/eelde/granter/app/PermissionRequestingFragment.kt
new file mode 100644
index 0000000..1dd88de
--- /dev/null
+++ b/app/src/main/java/se/eelde/granter/app/PermissionRequestingFragment.kt
@@ -0,0 +1,47 @@
+package se.eelde.granter.app
+
+import android.Manifest
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.Toast
+import androidx.fragment.app.Fragment
+import kotlinx.android.synthetic.main.fragment_permission_requesting.view.*
+import pub.devrel.easypermissions.AfterPermissionGranted
+import se.eelde.granter.Granter
+
+/**
+ * Created in [R.layout.activity_permission_requesting]
+ */
+class PermissionRequestingFragment : Fragment() {
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ return inflater.inflate(R.layout.fragment_permission_requesting, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ view.fragment_permission_1_button.setOnClickListener {
+ Granter.Builder(this)
+ .requestCode(RC_READ_CONTACTS_PERM)
+ .addPermission(Manifest.permission.READ_CONTACTS)
+ .build()
+ .show()
+ }
+
+ }
+
+ @AfterPermissionGranted(RC_READ_CONTACTS_PERM)
+ private fun contactsTask() {
+ Toast.makeText(activity, "TODO: Read contacts things", Toast.LENGTH_LONG).show()
+ }
+
+ companion object {
+
+ private const val RC_READ_CONTACTS_PERM = 122
+
+ internal fun newInstance(): Fragment {
+ return PermissionRequestingFragment()
+ }
+ }
+}
diff --git a/app/src/main/java/se/eelde/granter/app/RegularPermissionActivity.java b/app/src/main/java/se/eelde/granter/app/RegularPermissionActivity.java
deleted file mode 100644
index a6e1370..0000000
--- a/app/src/main/java/se/eelde/granter/app/RegularPermissionActivity.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package se.eelde.granter.app;
-
-import android.Manifest;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.databinding.DataBindingUtil;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatActivity;
-
-import se.eelde.granter.app.databinding.ActivityRegularPermissionBinding;
-
-public class RegularPermissionActivity extends AppCompatActivity {
-
- private static final int REQUEST_PERMISSION_LOCATION_RATIONALE = 213;
- private static final int REQUEST_PERMISSION_LOCATION = 212;
- private ActivityRegularPermissionBinding binding;
-
- public static void start(Context context) {
- context.startActivity(new Intent(context, RegularPermissionActivity.class));
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_regular_permission);
- binding = DataBindingUtil.setContentView(this, R.layout.activity_regular_permission);
-
- binding.regularPermissionButton.setOnClickListener(view -> checkPermissions());
- }
-
- private void moveToNextStep() {
- getSupportFragmentManager()
- .beginTransaction()
- .replace(binding.fragmentContainer.getId(), DummyFragment.newInstance())
- .commit();
- }
-
- private void checkPermissions() {
- if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- // Should we show an explanation?
- if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
- new AlertDialog.Builder(this)
- .setTitle("title")
- .setMessage("message")
- .setPositiveButton("ok", (dialog, which) -> ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSION_LOCATION_RATIONALE))
- .setNegativeButton("nah", null)
- .create()
- .show();
-
- } else {
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_PERMISSION_LOCATION);
- }
- } else {
- moveToNextStep();
- }
- }
-
- @Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
- switch (requestCode) {
- case REQUEST_PERMISSION_LOCATION: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- moveToNextStep();
- } else if (!ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
- new AlertDialog.Builder(this)
- .setTitle("title")
- .setMessage("settings")
- .setPositiveButton("ok", null)
- .setNegativeButton("nah", null)
- .create()
- .show();
-
- }
- }
- case REQUEST_PERMISSION_LOCATION_RATIONALE: {
- if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- moveToNextStep();
- }
- }
- default: {
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- }
- }
- }
-}
diff --git a/app/src/main/java/se/eelde/granter/app/RegularPermissionActivity.kt b/app/src/main/java/se/eelde/granter/app/RegularPermissionActivity.kt
new file mode 100644
index 0000000..995172c
--- /dev/null
+++ b/app/src/main/java/se/eelde/granter/app/RegularPermissionActivity.kt
@@ -0,0 +1,96 @@
+package se.eelde.granter.app
+
+import android.Manifest
+import android.content.Context
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.os.Bundle
+import androidx.appcompat.app.AlertDialog
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.app.ActivityCompat
+import androidx.core.content.ContextCompat
+import kotlinx.android.synthetic.main.activity_regular_permission.*
+
+class RegularPermissionActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_regular_permission)
+
+ regular_permission_button.setOnClickListener { checkPermissions() }
+ }
+
+ private fun moveToNextStep() {
+ supportFragmentManager
+ .beginTransaction()
+ .replace(fragment_container.id, DummyFragment.newInstance())
+ .commit()
+ }
+
+ private fun checkPermissions() {
+ if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+ // Should we show an explanation?
+ if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
+ AlertDialog.Builder(this)
+ .setTitle("title")
+ .setMessage("message")
+ .setPositiveButton("ok") { _, _ -> ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), REQUEST_PERMISSION_LOCATION_RATIONALE) }
+ .setNegativeButton("nah", null)
+ .create()
+ .show()
+
+ } else {
+ ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), REQUEST_PERMISSION_LOCATION)
+ }
+ } else {
+ moveToNextStep()
+ }
+ }
+
+ override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
+ when (requestCode) {
+ REQUEST_PERMISSION_LOCATION -> {
+ run {
+ if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ moveToNextStep()
+ } else if (!ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
+ AlertDialog.Builder(this)
+ .setTitle("title")
+ .setMessage("settings")
+ .setPositiveButton("ok", null)
+ .setNegativeButton("nah", null)
+ .create()
+ .show()
+
+ }
+ }
+ run {
+ if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ moveToNextStep()
+ }
+ }
+ run { super.onRequestPermissionsResult(requestCode, permissions, grantResults) }
+ }
+ REQUEST_PERMISSION_LOCATION_RATIONALE -> {
+ run {
+ if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ moveToNextStep()
+ }
+ }
+ run { super.onRequestPermissionsResult(requestCode, permissions, grantResults) }
+ }
+ else -> {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults)
+ }
+ }
+ }
+
+ companion object {
+ private const val REQUEST_PERMISSION_LOCATION_RATIONALE = 213
+ private const val REQUEST_PERMISSION_LOCATION = 212
+
+ fun start(context: Context) {
+ context.startActivity(Intent(context, RegularPermissionActivity::class.java))
+ }
+ }
+}
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..a1e7fcb
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_permiso_permission.xml b/app/src/main/res/layout/activity_permiso_permission.xml
index e1911e8..9e85ad0 100644
--- a/app/src/main/res/layout/activity_permiso_permission.xml
+++ b/app/src/main/res/layout/activity_permiso_permission.xml
@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
-
-
+
diff --git a/app/src/main/res/layout/activity_permission_requesting.xml b/app/src/main/res/layout/activity_permission_requesting.xml
index bdb32e1..d74ce9a 100644
--- a/app/src/main/res/layout/activity_permission_requesting.xml
+++ b/app/src/main/res/layout/activity_permission_requesting.xml
@@ -1,70 +1,67 @@
-
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="se.eelde.granter.app.PermissionRequestingActivity">
-
+
-
+
-
+
-
+
-
+
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_regular_permission.xml b/app/src/main/res/layout/activity_regular_permission.xml
index b12b9a1..62ef39c 100644
--- a/app/src/main/res/layout/activity_regular_permission.xml
+++ b/app/src/main/res/layout/activity_regular_permission.xml
@@ -1,34 +1,31 @@
-
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ tools:context="se.eelde.granter.app.RegularPermissionActivity">
-
-
-
+
-
-
-
+
+
diff --git a/app/src/main/res/layout/fragment_dummy.xml b/app/src/main/res/layout/fragment_dummy.xml
index 46917c8..131162c 100644
--- a/app/src/main/res/layout/fragment_dummy.xml
+++ b/app/src/main/res/layout/fragment_dummy.xml
@@ -1,9 +1,6 @@
-
-
-
-
+
diff --git a/app/src/main/res/layout/fragment_permission_requesting.xml b/app/src/main/res/layout/fragment_permission_requesting.xml
index 66b1963..8bf009d 100644
--- a/app/src/main/res/layout/fragment_permission_requesting.xml
+++ b/app/src/main/res/layout/fragment_permission_requesting.xml
@@ -1,19 +1,16 @@
-
+
-
+ android:layout_marginStart="8dp"
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="8dp"
+ android:text="@string/fragment_permission_1" />
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 00f9eaa..ac94b34 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index 00f9eaa..ac94b34 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index 5507303..8ce9518 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
index 8fab6a3..682959f 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 6bc7fcd..07eb915 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
index 1eecc0e..5a0cc26 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index ec87dce..9a1bff1 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
index 05ca079..f7a5122 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 6f67f21..bb1740b 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
index 8bac0f2..ada6d73 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 0327e13..23872f1 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
index bacd3e7..a2f094f 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..6dcea11
--- /dev/null
+++ b/app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #C56E6E
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 5c7e701..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,32 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
-
- repositories {
- google()
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.3.0'
-
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-plugins {
- id 'com.github.ben-manes.versions' version '0.20.0'
- id 'digital.wup.android-maven-publish' version '3.6.2'
-}
-
-allprojects {
- repositories {
- google()
- jcenter()
- }
-}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..9132bc6
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,28 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath("com.android.tools.build:gradle:3.3.2")
+ classpath(embeddedKotlin("gradle-plugin"))
+ }
+}
+
+plugins {
+ id("com.github.ben-manes.versions") version "0.21.0"
+ id("digital.wup.android-maven-publish") version "3.6.2"
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+task("clean") {
+ delete(rootProject.buildDir)
+}
diff --git a/gradle.properties b/gradle.properties
index 80d6acd..5ad6125 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -11,9 +11,10 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
-CIVersionCode=3
-CIVersionName=1.2.0.1
+CIVersionCode=4
+CIVersionName=3.0.0.0
CIVersionNameSufix=
artifactory_user=USER
artifactory_password=PASSWORD
-artifactory_url=https://my.artifactory/repository
\ No newline at end of file
+artifactory_url=https://my.artifactory/repository
+android.useAndroidX=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index cea9c76..1b2b07c 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Tue Jan 22 16:48:12 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/granter/build.gradle b/granter/build.gradle
deleted file mode 100644
index 6716dab..0000000
--- a/granter/build.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'digital.wup.android-maven-publish'
-
-android {
- compileSdkVersion 28
-
- defaultConfig {
- minSdkVersion 15
- targetSdkVersion 28
- versionCode 2
- versionName "1.0.1"
-
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-task sourceJar(type: Jar) {
- classifier = 'sources'
- from android.sourceSets.main.java.sourceFiles
-}
-
-publishing {
- repositories {
- maven {
- url "${artifactory_url}"
- credentials {
- username = "${artifactory_user}" // The publisher user name
- password = "${artifactory_password}" // The publisher password
- }
- }
- }
-
- publications {
- aar(MavenPublication) {
- groupId = 'se.eelde'
- artifactId = project.name
- version = CIVersionName + CIVersionNameSufix
-
- from components.android
-
- artifact sourceJar
- }
- }
-}
-
-
-dependencies {
- implementation 'com.android.support:appcompat-v7:28.0.0'
- api 'pub.devrel:easypermissions:2.0.1'
-}
diff --git a/granter/build.gradle.kts b/granter/build.gradle.kts
new file mode 100644
index 0000000..9338bfd
--- /dev/null
+++ b/granter/build.gradle.kts
@@ -0,0 +1,65 @@
+plugins {
+ id("com.android.library")
+ id("digital.wup.android-maven-publish")
+}
+
+android {
+ compileSdkVersion(28)
+
+ defaultConfig {
+ minSdkVersion(15)
+ targetSdkVersion(28)
+ versionCode = 2
+ versionName = "1.0.1"
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ getByName("release") {
+ isMinifyEnabled = false
+ proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
+ }
+ }
+}
+
+val sourceJar = task("sourceJar") {
+ archiveClassifier.set("sources")
+ from(android.sourceSets["main"].java.sourceFiles)
+}
+
+publishing {
+ repositories {
+ maven {
+ val artifactory_url: String by project
+ setUrl(artifactory_url)
+ credentials {
+ val artifactory_user: String by project
+ val artifactory_password: String by project
+
+ username = artifactory_user
+ password = artifactory_password
+ }
+ }
+ }
+
+ publications {
+ create("aar") {
+ groupId = "se.eelde"
+ artifactId = project.name
+
+ val CIVersionName: String by project
+ val CIVersionNameSufix: String by project
+
+ version = CIVersionName + CIVersionNameSufix
+
+ from(components["android"])
+ artifact(sourceJar)
+ }
+ }
+}
+
+dependencies {
+ implementation("androidx.appcompat:appcompat:1.0.2")
+ api("pub.devrel:easypermissions:3.0.0")
+}
diff --git a/granter/src/main/java/se/eelde/granter/Granter.java b/granter/src/main/java/se/eelde/granter/Granter.java
index 0b8b338..71bf8d1 100644
--- a/granter/src/main/java/se/eelde/granter/Granter.java
+++ b/granter/src/main/java/se/eelde/granter/Granter.java
@@ -1,16 +1,17 @@
package se.eelde.granter;
import android.content.res.Resources;
-import android.support.annotation.Nullable;
-import android.support.annotation.StringRes;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v7.app.AppCompatActivity;
import java.util.ArrayList;
import java.util.Arrays;
+import androidx.annotation.Nullable;
+import androidx.annotation.StringRes;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+
public class Granter {
private static final String PERMISSIONS_FRAGMENT_TAG = "permissions_fragment_tag";
diff --git a/granter/src/main/java/se/eelde/granter/GranterFragment.java b/granter/src/main/java/se/eelde/granter/GranterFragment.java
index d5f8080..4c3bd4b 100644
--- a/granter/src/main/java/se/eelde/granter/GranterFragment.java
+++ b/granter/src/main/java/se/eelde/granter/GranterFragment.java
@@ -7,14 +7,14 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
diff --git a/granter/src/main/java/se/eelde/granter/Stolen.java b/granter/src/main/java/se/eelde/granter/Stolen.java
index 85af7a4..106f2e7 100644
--- a/granter/src/main/java/se/eelde/granter/Stolen.java
+++ b/granter/src/main/java/se/eelde/granter/Stolen.java
@@ -1,13 +1,13 @@
package se.eelde.granter;
import android.content.pm.PackageManager;
-import android.support.annotation.NonNull;
-import android.support.v4.app.Fragment;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;
diff --git a/granter/src/main/res/values/strings.xml b/granter/src/main/res/values/strings.xml
index 751004b..805ad9d 100644
--- a/granter/src/main/res/values/strings.xml
+++ b/granter/src/main/res/values/strings.xml
@@ -1,5 +1,4 @@
This app needs access to permissions to work.
Go to system settings to set up permissions.
- >
diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index 86f73d9..0000000
--- a/settings.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':app', ':granter'
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..d9fc37a
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1 @@
+include(":app", ":granter")