From 533cd4f2bf7fb0e169719da2b241c0214f043bf8 Mon Sep 17 00:00:00 2001 From: HJQ Date: Thu, 16 Aug 2018 10:56:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E8=A3=85=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=92=8C=E6=82=AC=E6=B5=AE=E7=AA=97=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- app/build.gradle | 4 ++-- library/build.gradle | 6 ++--- .../com/hjq/permissions/PermissionUtils.java | 22 ++++++++++++++----- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e9fbf07..a974bfb 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ #### 集成步骤 dependencies { - implementation 'com.hjq:xxpermissions:3.5' + implementation 'com.hjq:xxpermissions:3.6' } #### 一句代码搞定权限请求,从未如此简单 diff --git a/app/build.gradle b/app/build.gradle index 7b1a85a..8c63a0c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 { diff --git a/library/build.gradle b/library/build.gradle index d7766ac..6dbd8bc 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 11 targetSdkVersion 26 - versionCode 35 - versionName "3.5" + versionCode 36 + versionName "3.6" } } @@ -17,7 +17,7 @@ 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中的地址 } diff --git a/library/src/main/java/com/hjq/permissions/PermissionUtils.java b/library/src/main/java/com/hjq/permissions/PermissionUtils.java index e7624f8..514b65b 100644 --- a/library/src/main/java/com/hjq/permissions/PermissionUtils.java +++ b/library/src/main/java/com/hjq/permissions/PermissionUtils.java @@ -99,11 +99,23 @@ static ArrayList getFailPermissions(Context context, List 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; }