Skip to content

Commit 32338bb

Browse files
author
Shintaro Katafuchi
committed
Prepare for 1.2.0.
1 parent 9511594 commit 32338bb

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ChangeLog
22

3+
- 1.2.0 2015/09/07
4+
- Add `@DeniedPermission` and `@DeniedPermissions`.
35
- 1.1.2 2015/08/26
46
- Downgrade processor jdk version to 1.7.
57
- 1.1.1 2015/08/25

README.md

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
[![Build Status](https://travis-ci.org/hotchemi/PermissionsDispatcher.svg)](https://travis-ci.org/hotchemi/PermissionsDispatcher)
44
[ ![Download](https://api.bintray.com/packages/hotchemi/maven/permissionsdispatcher/images/download.svg) ](https://bintray.com/hotchemi/maven/permissionsdispatcher/_latestVersion)
5-
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-PermissionsDispatcher-green.svg?style=flat)](https://android-arsenal.com/details/1/2316)
65

76
PermissionsDispatcher provides simple annotation-based API to handle runtime permissions in Marshmallow.
87

98
[Runtime permissions](https://developer.android.com/preview/features/runtime-permissions.html) is so great for users but also the hell for developers.
109

11-
You can be released from the burden that writing a bunch of check statements whether a permission have been granted or not.
10+
You can be released from the burden that writing a bunch of check statements whether a permission have been granted or not.
1211

1312
## Usage
1413

@@ -18,11 +17,17 @@ Here's a minimum example that you register `MainActivity` which requires `Manife
1817

1918
There are only few annotations.
2019

20+
#### Must
21+
2122
- `@RuntimePermissions`: Register an Activity or Fragment to handle permissions.
2223
- `@NeedsPermission`: Register a method which the permission is needed.
2324
- You can use `@NeedsPermissions` for multiple requests.
25+
26+
#### Option
2427
- `@ShowsRationale`: Register a method which explains why the permission is needed. An annotated method is called when `shouldShowRequestPermissionRationale` returns true.
2528
- You can use `@ShowsRationales` for multiple requests.
29+
- `@DeniedPermission`: Register a method called when user deny a permission.
30+
- You can use `@DeniedPermissions` for multiple requests.
2631

2732
> NOTE: Annotated methods must be package private or above.
2833
@@ -38,11 +43,16 @@ public class MainActivity extends Activity {
3843
.commitAllowingStateLoss();
3944
}
4045

41-
// this is option
46+
// Option
4247
@ShowsRationale(Manifest.permission.CAMERA)
4348
void showRationaleForCamera() {
4449
Toast.makeText(this, R.string.permission_camera_rationale, Toast.LENGTH_SHORT).show();
4550
}
51+
52+
// Option
53+
@DeniedPermission(Manifest.permission.CAMERA)
54+
void showDeniedForCamera() {
55+
Toast.makeText(this, R.string.permission_camera_denied, Toast.LENGTH_SHORT).show();
4656
}
4757
```
4858

@@ -62,23 +72,8 @@ protected void onCreate(Bundle savedInstanceState) {
6272
super.onCreate(savedInstanceState);
6373
setContentView(R.layout.activity_main);
6474
Button cameraButton = (Button) findViewById(R.id.button_camera);
65-
cameraButton.setOnClickListener(this);
66-
Button contactsButton = (Button) findViewById(R.id.button_contacts);
67-
contactsButton.setOnClickListener(this);
68-
}
69-
70-
@Override
71-
public void onClick(View v) {
72-
switch (v.getId()) {
73-
case R.id.button_camera:
74-
// NOTE: delegate the permission handling to generated method
75-
MainActivityPermissionsDispatcher.showCameraWithCheck(this);
76-
break;
77-
case R.id.button_contacts:
78-
// NOTE: delegate the permission handling to generated method
79-
MainActivityPermissionsDispatcher.showContactsWithCheck(this);
80-
break;
81-
}
75+
cameraButton.setOnClickListener(v ->
76+
MainActivityPermissionsDispatcher.showCameraWithCheck(this));
8277
}
8378

8479
@Override
@@ -105,8 +100,8 @@ buildscript {
105100
apply plugin: 'android-apt'
106101

107102
dependencies {
108-
compile 'com.github.hotchemi:permissionsdispatcher:1.1.2'
109-
apt 'com.github.hotchemi:permissionsdispatcher-processor:1.1.2'
103+
compile 'com.github.hotchemi:permissionsdispatcher:1.2.0'
104+
apt 'com.github.hotchemi:permissionsdispatcher-processor:1.2.0'
110105
}
111106
```
112107

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ USER = hotchemi
22
GROUP_ID = com.github.hotchemi
33
ARTIFACT_ID_CORE = permissionsdispatcher
44
ARTIFACT_ID_PROCESSOR = permissionsdispatcher-processor
5-
VERSION = 1.1.2
5+
VERSION = 1.2.0
66
DESCRIPTION = Annotation-based library for generating runtime permissions dispatcher.
77
WEBSITE = https://github.com/hotchemi/PermissionsDispatcher
88
LICENCES = ['Apache-2.0']

0 commit comments

Comments
 (0)