@@ -405,16 +405,33 @@ private static boolean shouldShowRationale(@NonNull Object object, @NonNull Stri
405
405
406
406
/**
407
407
* @param activity Activity
408
+ * @param perms Array of permissions
408
409
* @return true if the user has previously denied any of the {@code perms} and we should show a
409
410
* rationale, false otherwise.
410
411
*/
411
- public static boolean shouldShowRationale (@ NonNull Activity activity , @ NonNull String [] perms ) {
412
- boolean shouldShowRationale = false ;
413
- for (String perm : perms ) {
414
- shouldShowRationale =
415
- shouldShowRationale || shouldShowRequestPermissionRationale (activity , perm );
416
- }
417
- return shouldShowRationale ;
412
+ public static boolean somePermissionDenied (@ NonNull Activity activity , @ NonNull String [] perms ) {
413
+ return shouldShowRationale (activity , perms );
414
+ }
415
+
416
+ /**
417
+ * @param fragment Fragment
418
+ * @param perms Array of permissions
419
+ * @return true if the user has previously denied any of the {@code perms} and we should show a
420
+ * rationale, false otherwise.
421
+ */
422
+ public static boolean somePermissionDenied (@ NonNull Fragment fragment , @ NonNull String [] perms ) {
423
+ return shouldShowRationale (fragment , perms );
424
+ }
425
+
426
+ /**
427
+ * @param fragment Fragment
428
+ * @param perms Array of permissions
429
+ * @return true if the user has previously denied any of the {@code perms} and we should show a
430
+ * rationale, false otherwise.
431
+ */
432
+ @ RequiresApi (api = Build .VERSION_CODES .M )
433
+ public static boolean somePermissionDenied (@ NonNull android .app .Fragment fragment , @ NonNull String [] perms ) {
434
+ return shouldShowRationale (fragment , perms );
418
435
}
419
436
420
437
private static boolean shouldShowRequestPermissionRationale (@ NonNull Object object ,
0 commit comments