Skip to content

Commit

Permalink
ReadMe Creation #1 Part 2
Browse files Browse the repository at this point in the history
*Create screenshots.
  • Loading branch information
rayliverified committed Feb 10, 2018
1 parent ebbf089 commit 478992d
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 2 deletions.
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Custom Permissions Dialogue is the only permissions library that supports ALL permission request scenarios. This library handles multiple edge cases such as not enabling all permissions or permanently rejecting a permission request.

Custom Permissions Dialogue is also the FIRST permissions library with a graphic interface. Not only does Custom Permissions Dialogue offer the most advanced functionality, it looks fantastic while doing so!
Custom Permissions Dialogue is also the FIRST permissions library with a graphical interface. Not only does Custom Permissions Dialogue offer the most advanced functionality, it looks fantastic while doing so!

This library is part of the Custom UI collection of beautiful, minimalistic, and customizable Android UI components.

Expand All @@ -21,8 +21,12 @@ implementation 'com.github.searchy2:CustomPermissionsDialogue:latest-version'
```
# Usage

### Code

Custom Permissions Dialogue uses the Builder format to initialize a popup permissions dialogue programmatically. To request a single permissions, just drag and drop the following code into your project. It's that simple!

![Screenshots](screenshots/Custom-Permissions-Dialogue-Simple_540x.jpg)

```java
PermissionsDialogue.Builder permissionsDialogue = new PermissionsDialogue.Builder(getActivity())
.setMessage(getString(R.string.app_name) + " is a sample permissions app and requires the following permissions: ")
Expand All @@ -44,6 +48,50 @@ permissionsDialogue.show();

Do not attempt to construct the dialogue with `getContext()`. The Builder requires an Activity and passing a Context does not work!

### Manifest

Remember to add the permissions your app requires to your manifest file. The following code contains a list of all regular Android permissions.

```java
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_SMS"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.READ_SYNC_STATS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.RECEIVE_MMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.SET_ALARM"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SMS"/>
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
```

# Customization

Custom Permissions Dialogue supports extensive customization options to fit your permission request needs.
Expand All @@ -52,6 +100,8 @@ Custom Permissions Dialogue supports extensive customization options to fit your

**All - Showcases all Custom Permissions Dialogue permissions.**

![Screenshots](screenshots/Custom-Permissions-Dialogue-All_540x.jpg)

```java
PermissionsDialogue.Builder permissionsDialogue = new PermissionsDialogue.Builder(getActivity())
.setMessage(getString(R.string.app_name) + " is a sample permissions app and requires the following permissions: ")
Expand All @@ -77,6 +127,8 @@ permissionsDialogue.show();

**Required - Displays all required permissions for the user to grant.**

![Screenshots](screenshots/Custom-Permissions-Dialogue-Required_540x.jpg)

```java
PermissionsDialogue.Builder permissionsDialogue = new PermissionsDialogue.Builder(getActivity())
.setMessage(getString(R.string.app_name) + " is a sample permissions app and requires the following permissions: ")
Expand All @@ -97,6 +149,8 @@ permissionsDialogue.show();

**Optional - Optional permissions allows user to selectively enable permissions.**

![Screenshots](screenshots/Custom-Permissions-Dialogue-Optional_540x.jpg)

```java
PermissionsDialogue.Builder permissionsDialogue = new PermissionsDialogue.Builder(getActivity())
.setRequireCamera(PermissionsDialogue.OPTIONAL)
Expand All @@ -119,6 +173,8 @@ permissionsDialogue.show();

**Single - Requests a single permission from the user.**

![Screenshots](screenshots/Custom-Permissions-Dialogue-Single_540x.jpg)

```java
PermissionsDialogue.Builder permissionsDialogue = new PermissionsDialogue.Builder(getActivity())
.setMessage(getString(R.string.app_name) + " is a sample permissions app and requires the following permissions: ")
Expand All @@ -136,6 +192,8 @@ permissionsDialogue.show();

**Combined - A single permission request combined with other optional permissions that the user can grant.**

![Screenshots](screenshots/Custom-Permissions-Dialogue-Combined_540x.jpg)

```java
PermissionsDialogue.Builder permissionsDialogue = new PermissionsDialogue.Builder(getActivity())
.setMessage(getString(R.string.app_name) + " is a sample permissions app and requires the following permissions: ")
Expand All @@ -157,6 +215,8 @@ permissionsDialogue.show();

**Uncancelable - Set Cancelable to false to force user to grant permissions before proceeding.**

![Screenshots](screenshots/Custom-Permissions-Dialogue-Single_540x.jpg)

```java
PermissionsDialogue.Builder permissionsDialogue = new PermissionsDialogue.Builder(getActivity())
.setMessage(getString(R.string.app_name) + " is a sample permissions app and requires the following permissions: ")
Expand Down Expand Up @@ -287,4 +347,4 @@ Ray Li
</a>

#### Search Terms
android, popup, permission, permissions, dialog, dialogs, Marshmallow, grant, enable, manager
android, popup, permission, permissions, dialog, dialogs, Marshmallow, grant, enable, give, manager
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;

import stream.custombutton.CustomButton;
import stream.custompermissionsdialogue.PermissionsDialogue;
Expand All @@ -18,6 +21,8 @@ public class PermissionsFragment extends Fragment implements View.OnClickListene
private PermissionsDialogue.Builder alertPermissions;

FrameLayout mFrameLayout;
ImageView mBackground;
CardView mCardView;
CustomButton mButton1;
CustomButton mButton2;
CustomButton mButton3;
Expand Down Expand Up @@ -45,6 +50,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

View rootView = inflater.inflate(R.layout.fragment_permissions, container, false);
mFrameLayout = rootView.findViewById(R.id.intro_layout);
mBackground = rootView.findViewById(R.id.background);
mCardView = rootView.findViewById(R.id.cardview);
mButton1 = rootView.findViewById(R.id.btn_1);
mButton2 = rootView.findViewById(R.id.btn_2);
mButton3 = rootView.findViewById(R.id.btn_3);
Expand Down Expand Up @@ -187,6 +194,28 @@ public void OnClick(View view, Dialog dialog) {
}
}

//Hide background for screenshots.
public void HideBackground(boolean hide)
{
if (hide)
{
mBackground.setVisibility(View.GONE);
mCardView.setVisibility(View.GONE);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
HideBackground(false);
}
}, 5000);
}
else
{
mBackground.setVisibility(View.VISIBLE);
mCardView.setVisibility(View.VISIBLE);
}
}

public void onDestroyView() {
super.onDestroyView();
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_permissions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
android:background="@drawable/bg_triangle_color"/>

<android.support.v7.widget.CardView
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 478992d

Please sign in to comment.