From d28c74d0422c74def8c5a60b5219a91c099ebde8 Mon Sep 17 00:00:00 2001 From: goweii Date: Tue, 1 Oct 2019 14:13:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8C=E5=88=86=E7=BB=84?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=87=8D=E5=A4=8D=E7=94=B3=E8=AF=B7BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../per/goweii/anypermission/RuntimeRequester.java | 11 ++++++++++- app/src/main/AndroidManifest.xml | 1 + .../goweii/android/anypermission/TestActivity.java | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java b/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java index 23c071f..9551ac5 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java +++ b/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java @@ -182,11 +182,15 @@ public void onAction(final List data) { } private void next() { - // findUnGrantedPermissions(); if (mUnGrantedPermissions.peek() == null) { onSuccess(); return; } + if (AndPermission.hasPermissions(mContext, mUnGrantedPermissions.peek())) { + mUnGrantedPermissions.poll(); + next(); + return; + } onBeforeRequest(); } @@ -195,6 +199,11 @@ private void again() { onSuccess(); return; } + if (AndPermission.hasPermissions(mContext, mUnGrantedPermissions.peek())) { + mUnGrantedPermissions.poll(); + next(); + return; + } if (AndPermission.hasAlwaysDeniedPermission(mContext, mUnGrantedPermissions.peek())) { onGoSetting(); } else { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 10d8976..9b8e6ca 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,7 @@ + diff --git a/app/src/main/java/per/goweii/android/anypermission/TestActivity.java b/app/src/main/java/per/goweii/android/anypermission/TestActivity.java index 60718cd..3da1712 100644 --- a/app/src/main/java/per/goweii/android/anypermission/TestActivity.java +++ b/app/src/main/java/per/goweii/android/anypermission/TestActivity.java @@ -70,13 +70,15 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten } private void requestRuntime() { - mRuntimeRequester = AnyPermission.with(this).runtime(1) + mRuntimeRequester = AnyPermission.with(this) + .runtime(1) .permissions(Manifest.permission.CAMERA, Manifest.permission.CALL_PHONE, Manifest.permission.READ_CALENDAR, Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.RECORD_AUDIO, + Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.SEND_SMS) .onBeforeRequest(new RequestInterceptor() {