Skip to content

Commit

Permalink
1.1版本更新
Browse files Browse the repository at this point in the history
  • Loading branch information
getActivity committed Jul 3, 2018
1 parent fb23f43 commit 72c4fc5
Show file tree
Hide file tree
Showing 10 changed files with 490 additions and 490 deletions.
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,14 @@

![](XXPermissions.gif)

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

dependencies {
compile 'com.hjq:xxpermissions:1.0'
}

> 如果导入失败,请检查在Project工程的build.gradle文件的配置
allprojects {

repositories {
//添加对JCenter仓库的支持
jcenter()
......
}
......
}

#### 一句代码搞定权限请求,从未如此简单

XXPermissions.with(this)
Expand All @@ -34,9 +22,8 @@
}

@Override
public void noPermission(List<String> denied, boolean permanent) {
public void noPermission(List<String> denied, boolean quick) {
}
});


Binary file added XXPermissions.apk
Binary file not shown.
Binary file removed app-debug.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/src/main/java/com/hjq/permissions/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public void hasPermission(List<String> granted) {
}

@Override
public void noPermission(List<String> denied, boolean permanent) {
if(permanent) {
public void noPermission(List<String> denied, boolean quick) {
if(quick) {
Toast.makeText(MainActivity.this, "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
//如果是被永久拒绝就跳转到应用权限系统设置页面
PermissionUtils.gotoPermissionSettings(MainActivity.this);
Expand Down
2 changes: 1 addition & 1 deletion library/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/build
/build
260 changes: 130 additions & 130 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,131 +1,131 @@
//文件开头配置
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
}

def siteUrl = 'https://github.com/getActivity/XXPermissions' //项目在github中的地址
def gitUrl = siteUrl + ".git" //项目在github中的地址

//compile 'com.hjq:xxpermissions:1.0'
def groupId = 'com.hjq' //定义的maven group id最终引用形式
def artifactId = 'xxpermissions'//maven的artifact id,不要带大写,可以用“-”代替
def versionName = '1.0'//maven 上发布版本号

def repositoryName = 'maven' //自己创建的仓库名,直接在bintray账号下创建的
def repositoryDesc = 'Android 6.0 permissions adaptation framework' //仓库描述,自己定义
def packageName = 'XXPermissions' //在仓库创建的包名称,在maven jcenter上显示的名字,最终引用的名字

def idName = 'getactivity' //填写bintray用户名,注意大小写
def orgName = idName //自己的organization(组织)名称,这里的组织直接就是自己的用户名
def developerName = 'huangjinqun' //开发者姓名
def developerEmail = '[email protected]' //开发者邮箱

def licensesName = 'Apache-2.0' //不能随便写,只能是仓库创建时选择的license type
def licensesUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' //协议地址

def codedFormat = 'UTF-8'//如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
def packagingType = 'aar'//打包类型,可以打包成aar也可以打包成jar,本质上都是zip包

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

//Gradle配置
version = versionName
group = groupId
bintray {
user = properties.getProperty('bintray.user')
key = properties.getProperty('bintray.apikey')
pkg {
repo = repositoryName
name = packageName
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = [licensesName]
userOrg = orgName
publish = true // 是否是公开项目,公开别人可以引用
version {
name = versionName
desc = repositoryDesc
released = new Date()
vcsTag = 'v1.0'
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
}
}
configurations = ['archives']
}

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging packagingType
name artifactId
description repositoryDesc
url siteUrl
// Set your license
licenses {
license {
name licensesName
url licensesUrl
}
}
developers {
developer {
id idName
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
failOnError false //必须添加以免出错
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}

javadoc {
options {
encoding codedFormat
charSet codedFormat
author true
version true
links 'http://docs.oracle.com/javase/7/docs/api'
}
//文件开头配置
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 2
versionName "1.1"
}
}

def siteUrl = 'https://github.com/getActivity/XXPermissions' //项目在github中的地址
def gitUrl = siteUrl + ".git" //项目在github中的地址

//compile 'com.hjq:xxpermissions:1.1'
def groupId = 'com.hjq' //定义的maven group id最终引用形式
def artifactId = 'xxpermissions'//maven的artifact id,不要带大写,可以用“-”代替
def versionName = '1.1'//maven 上发布版本号

def repositoryName = 'maven' //自己创建的仓库名,直接在bintray账号下创建的
def repositoryDesc = 'Android 6.0 permissions adaptation framework' //仓库描述,自己定义
def packageName = 'XXPermissions' //在仓库创建的包名称,在maven jcenter上显示的名字,最终引用的名字

def idName = 'getactivity' //填写bintray用户名,注意大小写
def orgName = idName //自己的organization(组织)名称,这里的组织直接就是自己的用户名
def developerName = 'huangjinqun' //开发者姓名
def developerEmail = '[email protected]' //开发者邮箱

def licensesName = 'Apache-2.0' //不能随便写,只能是仓库创建时选择的license type
def licensesUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' //协议地址

def codedFormat = 'UTF-8'//如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
def packagingType = 'aar'//打包类型,可以打包成aar也可以打包成jar,本质上都是zip包

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

//Gradle配置
version = versionName
group = groupId
bintray {
user = properties.getProperty('bintray.user')
key = properties.getProperty('bintray.apikey')
pkg {
repo = repositoryName
name = packageName
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = [licensesName]
userOrg = orgName
publish = true // 是否是公开项目,公开别人可以引用
version {
name = versionName
desc = repositoryDesc
released = new Date()
vcsTag = 'v1.0'
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
}
}
configurations = ['archives']
}

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging packagingType
name artifactId
description repositoryDesc
url siteUrl
// Set your license
licenses {
license {
name licensesName
url licensesUrl
}
}
developers {
developer {
id idName
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
failOnError false //必须添加以免出错
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}

javadoc {
options {
encoding codedFormat
charSet codedFormat
author true
version true
links 'http://docs.oracle.com/javase/7/docs/api'
}
}
46 changes: 23 additions & 23 deletions library/src/main/java/com/hjq/permissions/OnPermission.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package com.hjq.permissions;

import java.util.List;

/**
* Created by HJQ on 2018-6-15.
*/
public interface OnPermission {

/**
* 有权限被授予时回调
*
* @param granted 请求成功的权限组
*/
void hasPermission(List<String> granted);

/**
* 有权限被拒绝授予时回调
*
* @param denied 请求失败的权限组
* @param permanent 是否永久拒绝了
*/
void noPermission(List<String> denied, boolean permanent);
package com.hjq.permissions;

import java.util.List;

/**
* Created by HJQ on 2018-6-15.
*/
public interface OnPermission {

/**
* 有权限被授予时回调
*
* @param granted 请求成功的权限组
*/
void hasPermission(List<String> granted);

/**
* 有权限被拒绝授予时回调
*
* @param denied 请求失败的权限组
* @param quick 是否永久拒绝了
*/
void noPermission(List<String> denied, boolean quick);
}
Loading

0 comments on commit 72c4fc5

Please sign in to comment.