use of com.karumi.dexter.listener.single.PermissionListener 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.single.PermissionListener in project Dexter by Karumi.
the class DexterInstanceTest method onPermissionDeniedDoSequentialCheckPermissionThenNotifiesListener.
@Test
public void onPermissionDeniedDoSequentialCheckPermissionThenNotifiesListener() throws InterruptedException {
givenPermissionIsAlreadyDenied(ANY_PERMISSION);
givenShouldShowRationaleForPermission(ANY_PERMISSION);
PermissionListener checkPermissionOnDeniedPermissionListener = givenARetryCheckPermissionOnDeniedPermissionListener(permissionListener);
whenCheckPermission(checkPermissionOnDeniedPermissionListener, ANY_PERMISSION);
dexter.onPermissionRequestDenied(Collections.singletonList(ANY_PERMISSION));
asyncExecutor.waitForExecution();
thenPermissionIsDenied(ANY_PERMISSION);
}
Aggregations