From 7bdaadedecc19b5942f69376a5c0b54978e06e64 Mon Sep 17 00:00:00 2001
From: tk2232 <33070559+tk2232@users.noreply.github.com>
Date: Sat, 8 Sep 2018 01:09:01 +0200
Subject: [PATCH] Create README.md
---
README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
create mode 100644 README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..245dd44
--- /dev/null
+++ b/README.md
@@ -0,0 +1,97 @@
+# EasyPermissions
+
+
+## Setup
+
+```java
+allprojects {
+ repositories {
+ ...
+ maven { url 'https://jitpack.io' }
+ }
+ }
+```
+
+```java
+dependencies {
+ implementation 'com.github.tk2232:EasyPermissions:v1.0.1'
+ }
+```
+
+Declare specific permissions in your AndroidMnifest.xml
+Example:
+```java
+
+
+
+```
+
+## Usage:
+
+### In Activity:
+
+```java
+ private void takePicture() {
+ if (!EasyPermissions.config(this).checkCameraAndStorragePermissions()) {
+ //takePicture
+ } else {
+ EasyPermissions.config(this).requestCameraAndStorragePermissions();
+ }
+ }
+```
+
+```java
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ EasyPermissions.handleRequestPermissionsResult(requestCode, permissions, grantResults, new PermissionCallback() {
+ @Override
+ public void onPermissionGranted(int requestCode, String[] permissions) {
+ log("Granted", permissions);
+ }
+
+ @Override
+ public void onPermissionDenied(int requestCode, String[] permissions, int[] grantResults) {
+ log("Denied", permissions);
+ }
+ });
+ }
+```
+
+## Examples
+### Check permissions
+
+```java
+ EasyPermissions.config(this).checkAccessCoarseLocationPermission();
+ EasyPermissions.config(this).checkAccessFineLocationPermission();
+ EasyPermissions.config(this).checkCameraAndStorragePermissions();
+ EasyPermissions.config(this).checkCameraPermission();
+ EasyPermissions.config(this).checkReadExternalStorragePermission();
+ EasyPermissions.config(this).checkWriteExternalStorragePermission();
+ EasyPermissions.config(this).checkReadWriteStorragePermission();
+
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
+ EasyPermissions.config(this).isExplicitCameraPermissionRequired();
+```
+### Request permissions
+
+```java
+ EasyPermissions.config(this).requestCameraAndStorragePermissions();
+ EasyPermissions.config(this).requestCameraPermission();
+ EasyPermissions.config(this).requestCoarseLocation();
+ EasyPermissions.config(this).requestFineLocation();
+ EasyPermissions.config(this).requestReadExternalStorrage();
+ EasyPermissions.config(this).requestWriteExternalStorrage();
+ EasyPermissions.config(this).requestReadWriteExternalStorrage();
+ EasyPermissions.config(this).requestPermissions(Sring[] permissions, int PERMISSION_REQUEST);
+```
+
+### Configuration
+
+```java
+ EasyPermissions.config(this).customExplanationSnackBar(Snackbar snackbar);
+ EasyPermissions.config(this).setupExplanationSnackBar(String actionTitle, String actionDescription);
+ EasyPermissions.config(this).showExplanationSnackBar(boolean show);
+ EasyPermissions.config(this).explanationDialog(AlertDialog dialog);
+```
+