From c9d30fa2870e48d095fc76fb3f162a9ffee65d1b Mon Sep 17 00:00:00 2001 From: Erik Eelde Date: Wed, 15 Nov 2017 16:32:24 +0100 Subject: [PATCH 1/4] Remove permisio permission requesting --- .../app/PermisoPermissionActivity.java | 49 ------------------- .../app/PermissionRequestingActivity.java | 2 - .../layout/activity_permission_requesting.xml | 16 +----- 3 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 app/src/main/java/se/eelde/granter/app/PermisoPermissionActivity.java 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" />