Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 6eb5f45

Browse files
authored
Merge pull request #53 from samtstern/master
Version 0.2.1
2 parents a5cb77f + a6dca8b commit 6eb5f45

File tree

13 files changed

+432
-222
lines changed

13 files changed

+432
-222
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ EasyPermissions is installed by adding the following dependency to your `build.g
99

1010
```java
1111
dependencies {
12-
compile 'pub.devrel:easypermissions:0.2.0'
12+
compile 'pub.devrel:easypermissions:0.2.1'
1313
}
1414
```
1515

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,10 @@
2222
<category android:name="android.intent.category.LAUNCHER" />
2323
</intent-filter>
2424
</activity>
25+
26+
<!-- For testing only -->
27+
<activity
28+
android:name=".BasicActivity"
29+
android:exported="true" />
2530
</application>
2631
</manifest>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package pub.devrel.easypermissions.sample;
2+
3+
import android.Manifest;
4+
import android.app.Activity;
5+
import android.os.Bundle;
6+
import android.support.annotation.NonNull;
7+
import android.util.Log;
8+
import android.view.View;
9+
10+
import java.util.List;
11+
12+
import pub.devrel.easypermissions.EasyPermissions;
13+
14+
/**
15+
* NOTE: This class is used only for testing EasyPermissions outside of the support library.
16+
*
17+
* See {@link MainActivity} for an example of how to use EasyPermissions.
18+
*/
19+
public class BasicActivity extends Activity implements EasyPermissions.PermissionCallbacks {
20+
21+
private static final String TAG = "BasicActivity";
22+
23+
@Override
24+
protected void onCreate(Bundle savedInstanceState) {
25+
super.onCreate(savedInstanceState);
26+
setContentView(R.layout.activity_basic);
27+
28+
findViewById(R.id.button_request).setOnClickListener(new View.OnClickListener() {
29+
@Override
30+
public void onClick(View v) {
31+
// Request SMS permission
32+
EasyPermissions.requestPermissions(BasicActivity.this, "NEED SMS PLZ", 1001,
33+
Manifest.permission.READ_SMS);
34+
}
35+
});
36+
}
37+
38+
@Override
39+
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
40+
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
41+
42+
// EasyPermissions handles the request result.
43+
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
44+
}
45+
46+
47+
@Override
48+
public void onPermissionsGranted(int requestCode, List<String> perms) {
49+
Log.d(TAG, "onPermissionsGranted:" + requestCode + ":" + perms.size());
50+
}
51+
52+
@Override
53+
public void onPermissionsDenied(int requestCode, List<String> perms) {
54+
Log.d(TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size());
55+
}
56+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:orientation="vertical"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent"
7+
tools:context=".BasicActivity">
8+
9+
<Button
10+
android:id="@+id/button_request"
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content"
13+
android:text="Request" />
14+
15+
</LinearLayout>

easypermissions/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@ android {
1111
versionCode 1
1212
versionName "$mavenVersion"
1313
}
14+
1415
buildTypes {
1516
release {
1617
minifyEnabled false
1718
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1819
}
1920
}
21+
22+
lintOptions {
23+
abortOnError false
24+
}
2025
}
2126

2227
dependencies {

easypermissions/constants.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ext {
66

77
mavenGroup = 'pub.devrel'
88
mavenArtifactId = 'easypermissions'
9-
mavenVersion = '0.2.0'
9+
mavenVersion = '0.2.1'
1010

1111
bintrayOrg = 'easygoogle'
1212
}

0 commit comments

Comments
 (0)