Skip to content

Commit

Permalink
修复安装权限和悬浮窗权限检测的Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
HJQ committed Aug 16, 2018
1 parent 7c139e8 commit 533cd4f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#### 集成步骤

dependencies {
implementation 'com.hjq:xxpermissions:3.5'
implementation 'com.hjq:xxpermissions:3.6'
}

#### 一句代码搞定权限请求,从未如此简单
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.hjq.permissions.demo"
minSdkVersion 14
targetSdkVersion 26
versionCode 35
versionName "3.5"
versionCode 36
versionName "3.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ android {
defaultConfig {
minSdkVersion 11
targetSdkVersion 26
versionCode 35
versionName "3.5"
versionCode 36
versionName "3.6"
}
}

publish {
userOrg = 'getactivity'//填写bintray用户名,注意大小写
groupId = 'com.hjq'//定义的maven group id最终引用形式
artifactId = 'xxpermissions'//maven的artifact id
version = '3.5'//maven 上发布版本号
version = '3.6'//maven 上发布版本号
description = 'Android 6.0 permissions adaptation framework'//描述,自己定义
website = "https://github.com/getActivity/XXPermissions"//项目在github中的地址
}
Expand Down
22 changes: 17 additions & 5 deletions library/src/main/java/com/hjq/permissions/PermissionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,23 @@ static ArrayList<String> getFailPermissions(Context context, List<String> permis

for (String permission : permissions) {

//检测安装权限和悬浮窗权限
if ((permission.equals(Permission.REQUEST_INSTALL_PACKAGES) && !isHasInstallPermission(context)) ||
(permission.equals(Permission.SYSTEM_ALERT_WINDOW) && !isHasOverlaysPermission(context))) {
if (failPermissions == null) failPermissions = new ArrayList<>();
failPermissions.add(permission);
//检测安装权限
if (permission.equals(Permission.REQUEST_INSTALL_PACKAGES)) {

if (!isHasInstallPermission(context)) {
if (failPermissions == null) failPermissions = new ArrayList<>();
failPermissions.add(permission);
}
continue;
}

//检测悬浮窗权限
if (permission.equals(Permission.SYSTEM_ALERT_WINDOW)) {

if (!isHasOverlaysPermission(context)) {
if (failPermissions == null) failPermissions = new ArrayList<>();
failPermissions.add(permission);
}
continue;
}

Expand Down

0 comments on commit 533cd4f

Please sign in to comment.