Skip to content

Commit 72c4fc5

Browse files
committed
1.1版本更新
1 parent fb23f43 commit 72c4fc5

File tree

10 files changed

+490
-490
lines changed

10 files changed

+490
-490
lines changed

Diff for: README.md

+3-16
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,14 @@
22

33
![](XXPermissions.gif)
44

5-
#### 集成步骤
5+
>[点击此处下载Demo](https://raw.githubusercontent.com/getActivity/XXPermissions/master/XXPermissions.apk)
66
7-
> 在Module工程的build.gradle文件中添加依赖
7+
#### 集成步骤
88

99
dependencies {
1010
compile 'com.hjq:xxpermissions:1.0'
1111
}
1212

13-
> 如果导入失败,请检查在Project工程的build.gradle文件的配置
14-
15-
allprojects {
16-
17-
repositories {
18-
//添加对JCenter仓库的支持
19-
jcenter()
20-
......
21-
}
22-
......
23-
}
24-
2513
#### 一句代码搞定权限请求,从未如此简单
2614

2715
XXPermissions.with(this)
@@ -34,9 +22,8 @@
3422
}
3523

3624
@Override
37-
public void noPermission(List<String> denied, boolean permanent) {
25+
public void noPermission(List<String> denied, boolean quick) {
3826
3927
}
4028
});
4129

42-

Diff for: XXPermissions.apk

1.29 MB
Binary file not shown.

Diff for: app-debug.apk

-1.31 MB
Binary file not shown.

Diff for: app/src/main/java/com/hjq/permissions/demo/MainActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public void hasPermission(List<String> granted) {
3131
}
3232

3333
@Override
34-
public void noPermission(List<String> denied, boolean permanent) {
35-
if(permanent) {
34+
public void noPermission(List<String> denied, boolean quick) {
35+
if(quick) {
3636
Toast.makeText(MainActivity.this, "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
3737
//如果是被永久拒绝就跳转到应用权限系统设置页面
3838
PermissionUtils.gotoPermissionSettings(MainActivity.this);

Diff for: library/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/build
1+
/build

Diff for: library/build.gradle

+130-130
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,131 @@
1-
//文件开头配置
2-
apply plugin: 'com.android.library'
3-
apply plugin: 'com.jfrog.bintray'
4-
apply plugin: 'com.github.dcendents.android-maven'
5-
6-
android {
7-
compileSdkVersion 25
8-
buildToolsVersion "25.0.3"
9-
10-
defaultConfig {
11-
minSdkVersion 11
12-
targetSdkVersion 25
13-
versionCode 1
14-
versionName "1.0"
15-
}
16-
}
17-
18-
def siteUrl = 'https://github.com/getActivity/XXPermissions' //项目在github中的地址
19-
def gitUrl = siteUrl + ".git" //项目在github中的地址
20-
21-
//compile 'com.hjq:xxpermissions:1.0'
22-
def groupId = 'com.hjq' //定义的maven group id最终引用形式
23-
def artifactId = 'xxpermissions'//maven的artifact id,不要带大写,可以用“-”代替
24-
def versionName = '1.0'//maven 上发布版本号
25-
26-
def repositoryName = 'maven' //自己创建的仓库名,直接在bintray账号下创建的
27-
def repositoryDesc = 'Android 6.0 permissions adaptation framework' //仓库描述,自己定义
28-
def packageName = 'XXPermissions' //在仓库创建的包名称,在maven jcenter上显示的名字,最终引用的名字
29-
30-
def idName = 'getactivity' //填写bintray用户名,注意大小写
31-
def orgName = idName //自己的organization(组织)名称,这里的组织直接就是自己的用户名
32-
def developerName = 'huangjinqun' //开发者姓名
33-
def developerEmail = 'jinqun0730@gmail.com' //开发者邮箱
34-
35-
def licensesName = 'Apache-2.0' //不能随便写,只能是仓库创建时选择的license type
36-
def licensesUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' //协议地址
37-
38-
def codedFormat = 'UTF-8'//如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
39-
def packagingType = 'aar'//打包类型,可以打包成aar也可以打包成jar,本质上都是zip包
40-
41-
Properties properties = new Properties()
42-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
43-
44-
//Gradle配置
45-
version = versionName
46-
group = groupId
47-
bintray {
48-
user = properties.getProperty('bintray.user')
49-
key = properties.getProperty('bintray.apikey')
50-
pkg {
51-
repo = repositoryName
52-
name = packageName
53-
websiteUrl = siteUrl
54-
vcsUrl = gitUrl
55-
licenses = [licensesName]
56-
userOrg = orgName
57-
publish = true // 是否是公开项目,公开别人可以引用
58-
version {
59-
name = versionName
60-
desc = repositoryDesc
61-
released = new Date()
62-
vcsTag = 'v1.0'
63-
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
64-
}
65-
}
66-
configurations = ['archives']
67-
}
68-
69-
install {
70-
repositories.mavenInstaller {
71-
// This generates POM.xml with proper parameters
72-
pom {
73-
project {
74-
packaging packagingType
75-
name artifactId
76-
description repositoryDesc
77-
url siteUrl
78-
// Set your license
79-
licenses {
80-
license {
81-
name licensesName
82-
url licensesUrl
83-
}
84-
}
85-
developers {
86-
developer {
87-
id idName
88-
name developerName
89-
email developerEmail
90-
}
91-
}
92-
scm {
93-
connection gitUrl
94-
developerConnection gitUrl
95-
url siteUrl
96-
}
97-
}
98-
}
99-
}
100-
}
101-
102-
task sourcesJar(type: Jar) {
103-
from android.sourceSets.main.java.srcDirs
104-
classifier = 'sources'
105-
}
106-
107-
task javadoc(type: Javadoc) {
108-
failOnError false //必须添加以免出错
109-
source = android.sourceSets.main.java.srcDirs
110-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
111-
}
112-
113-
task javadocJar(type: Jar, dependsOn: javadoc) {
114-
classifier = 'javadoc'
115-
from javadoc.destinationDir
116-
}
117-
118-
artifacts {
119-
archives javadocJar
120-
archives sourcesJar
121-
}
122-
123-
javadoc {
124-
options {
125-
encoding codedFormat
126-
charSet codedFormat
127-
author true
128-
version true
129-
links 'http://docs.oracle.com/javase/7/docs/api'
130-
}
1+
//文件开头配置
2+
apply plugin: 'com.android.library'
3+
apply plugin: 'com.jfrog.bintray'
4+
apply plugin: 'com.github.dcendents.android-maven'
5+
6+
android {
7+
compileSdkVersion 25
8+
buildToolsVersion "25.0.3"
9+
10+
defaultConfig {
11+
minSdkVersion 11
12+
targetSdkVersion 25
13+
versionCode 2
14+
versionName "1.1"
15+
}
16+
}
17+
18+
def siteUrl = 'https://github.com/getActivity/XXPermissions' //项目在github中的地址
19+
def gitUrl = siteUrl + ".git" //项目在github中的地址
20+
21+
//compile 'com.hjq:xxpermissions:1.1'
22+
def groupId = 'com.hjq' //定义的maven group id最终引用形式
23+
def artifactId = 'xxpermissions'//maven的artifact id,不要带大写,可以用“-”代替
24+
def versionName = '1.1'//maven 上发布版本号
25+
26+
def repositoryName = 'maven' //自己创建的仓库名,直接在bintray账号下创建的
27+
def repositoryDesc = 'Android 6.0 permissions adaptation framework' //仓库描述,自己定义
28+
def packageName = 'XXPermissions' //在仓库创建的包名称,在maven jcenter上显示的名字,最终引用的名字
29+
30+
def idName = 'getactivity' //填写bintray用户名,注意大小写
31+
def orgName = idName //自己的organization(组织)名称,这里的组织直接就是自己的用户名
32+
def developerName = 'huangjinqun' //开发者姓名
33+
def developerEmail = 'jinqun0730@gmail.com' //开发者邮箱
34+
35+
def licensesName = 'Apache-2.0' //不能随便写,只能是仓库创建时选择的license type
36+
def licensesUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' //协议地址
37+
38+
def codedFormat = 'UTF-8'//如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
39+
def packagingType = 'aar'//打包类型,可以打包成aar也可以打包成jar,本质上都是zip包
40+
41+
Properties properties = new Properties()
42+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
43+
44+
//Gradle配置
45+
version = versionName
46+
group = groupId
47+
bintray {
48+
user = properties.getProperty('bintray.user')
49+
key = properties.getProperty('bintray.apikey')
50+
pkg {
51+
repo = repositoryName
52+
name = packageName
53+
websiteUrl = siteUrl
54+
vcsUrl = gitUrl
55+
licenses = [licensesName]
56+
userOrg = orgName
57+
publish = true // 是否是公开项目,公开别人可以引用
58+
version {
59+
name = versionName
60+
desc = repositoryDesc
61+
released = new Date()
62+
vcsTag = 'v1.0'
63+
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
64+
}
65+
}
66+
configurations = ['archives']
67+
}
68+
69+
install {
70+
repositories.mavenInstaller {
71+
// This generates POM.xml with proper parameters
72+
pom {
73+
project {
74+
packaging packagingType
75+
name artifactId
76+
description repositoryDesc
77+
url siteUrl
78+
// Set your license
79+
licenses {
80+
license {
81+
name licensesName
82+
url licensesUrl
83+
}
84+
}
85+
developers {
86+
developer {
87+
id idName
88+
name developerName
89+
email developerEmail
90+
}
91+
}
92+
scm {
93+
connection gitUrl
94+
developerConnection gitUrl
95+
url siteUrl
96+
}
97+
}
98+
}
99+
}
100+
}
101+
102+
task sourcesJar(type: Jar) {
103+
from android.sourceSets.main.java.srcDirs
104+
classifier = 'sources'
105+
}
106+
107+
task javadoc(type: Javadoc) {
108+
failOnError false //必须添加以免出错
109+
source = android.sourceSets.main.java.srcDirs
110+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
111+
}
112+
113+
task javadocJar(type: Jar, dependsOn: javadoc) {
114+
classifier = 'javadoc'
115+
from javadoc.destinationDir
116+
}
117+
118+
artifacts {
119+
archives javadocJar
120+
archives sourcesJar
121+
}
122+
123+
javadoc {
124+
options {
125+
encoding codedFormat
126+
charSet codedFormat
127+
author true
128+
version true
129+
links 'http://docs.oracle.com/javase/7/docs/api'
130+
}
131131
}
+23-23
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
package com.hjq.permissions;
2-
3-
import java.util.List;
4-
5-
/**
6-
* Created by HJQ on 2018-6-15.
7-
*/
8-
public interface OnPermission {
9-
10-
/**
11-
* 有权限被授予时回调
12-
*
13-
* @param granted 请求成功的权限组
14-
*/
15-
void hasPermission(List<String> granted);
16-
17-
/**
18-
* 有权限被拒绝授予时回调
19-
*
20-
* @param denied 请求失败的权限组
21-
* @param permanent 是否永久拒绝了
22-
*/
23-
void noPermission(List<String> denied, boolean permanent);
1+
package com.hjq.permissions;
2+
3+
import java.util.List;
4+
5+
/**
6+
* Created by HJQ on 2018-6-15.
7+
*/
8+
public interface OnPermission {
9+
10+
/**
11+
* 有权限被授予时回调
12+
*
13+
* @param granted 请求成功的权限组
14+
*/
15+
void hasPermission(List<String> granted);
16+
17+
/**
18+
* 有权限被拒绝授予时回调
19+
*
20+
* @param denied 请求失败的权限组
21+
* @param quick 是否永久拒绝了
22+
*/
23+
void noPermission(List<String> denied, boolean quick);
2424
}

0 commit comments

Comments
 (0)