use of com.karumi.dexter.listener.multi.MultiplePermissionsListener in project Dexter by Karumi.
the class SampleActivity method createPermissionListeners.
private void createPermissionListeners() {
PermissionListener feedbackViewPermissionListener = new SamplePermissionListener(this);
MultiplePermissionsListener feedbackViewMultiplePermissionListener = new SampleMultiplePermissionListener(this);
allPermissionsListener = new CompositeMultiplePermissionsListener(feedbackViewMultiplePermissionListener, SnackbarOnAnyDeniedMultiplePermissionsListener.Builder.with(contentView, R.string.all_permissions_denied_feedback).withOpenSettingsButton(R.string.permission_rationale_settings_button_text).build());
contactsPermissionListener = new CompositePermissionListener(feedbackViewPermissionListener, SnackbarOnDeniedPermissionListener.Builder.with(contentView, R.string.contacts_permission_denied_feedback).withOpenSettingsButton(R.string.permission_rationale_settings_button_text).withCallback(new Snackbar.Callback() {
@Override
public void onShown(Snackbar snackbar) {
super.onShown(snackbar);
}
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
}
}).build());
PermissionListener dialogOnDeniedPermissionListener = DialogOnDeniedPermissionListener.Builder.withContext(this).withTitle(R.string.audio_permission_denied_dialog_title).withMessage(R.string.audio_permission_denied_dialog_feedback).withButtonText(android.R.string.ok).withIcon(R.mipmap.ic_logo_karumi).build();
audioPermissionListener = new CompositePermissionListener(feedbackViewPermissionListener, dialogOnDeniedPermissionListener);
cameraPermissionListener = new SampleBackgroundThreadPermissionListener(this);
errorListener = new SampleErrorListener();
}
use of com.karumi.dexter.listener.multi.MultiplePermissionsListener in project Dexter by Karumi.
the class DexterInstance method checkSinglePermission.
private void checkSinglePermission(PermissionListener listener, String permission, Thread thread) {
MultiplePermissionsListener adapter = new MultiplePermissionsListenerToPermissionListenerAdapter(listener);
checkMultiplePermissions(adapter, Collections.singleton(permission), thread);
}
use of com.karumi.dexter.listener.multi.MultiplePermissionsListener in project Dexter by Karumi.
the class DexterInstance method onPermissionsChecked.
private void onPermissionsChecked(Collection<String> permissions) {
if (pendingPermissions.isEmpty()) {
return;
}
synchronized (pendingPermissionsMutex) {
pendingPermissions.removeAll(permissions);
if (pendingPermissions.isEmpty()) {
// the permission is checked. Issues #243 and #221
if (activity != null) {
activity.finish();
}
isRequestingPermission.set(false);
rationaleAccepted.set(false);
isShowingNativeDialog.set(false);
MultiplePermissionsListener currentListener = listener;
listener = EMPTY_LISTENER;
currentListener.onPermissionsChecked(multiplePermissionsReport);
}
}
}
Aggregations