Java Code Examples for android.support.v13.app.FragmentCompat#shouldShowRequestPermissionRationale()

The following examples show how to use android.support.v13.app.FragmentCompat#shouldShowRequestPermissionRationale() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Camera2BasicFragment.java    From opencv-documentscanner-android with Apache License 2.0 5 votes vote down vote up
private void requestCameraPermission() {
    if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG);
    } else {
        FragmentCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
                REQUEST_CAMERA_PERMISSION);
    }
}
 
Example 2
Source File: Camera2BasicFragment.java    From Cam2Caption with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void requestCameraPermission() {
    if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG);
    } else {
        FragmentCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
                REQUEST_CAMERA_PERMISSION);
    }
}
 
Example 3
Source File: CameraFragment.java    From polling-station-app with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void requestCameraPermission() {
    if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        showInfoDialog(R.string.ocr_camera_permission_explanation);
    } else {
        FragmentCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
                REQUEST_CAMERA_PERMISSION);
    }
}
 
Example 4
Source File: CameraFragment.java    From polling-station-app with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void requestStoragePermissions() {
    if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
        showInfoDialog(R.string.storage_permission_explanation);
    } else {
        FragmentCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_WRITE_PERMISSIONS);
    }
}
 
Example 5
Source File: Camera2Fragment.java    From 361Camera with Apache License 2.0 5 votes vote down vote up
/**
 * Gets whether you should show UI with rationale for requesting the permissions.
 *
 * @return True if the UI should be shown.
 */
private boolean shouldShowRationale() {
    for (String permission : CAMERA_PERMISSIONS) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
            return true;
        }
    }
    return false;
}
 
Example 6
Source File: CaptureHighSpeedVideoMode.java    From Android-Slow-Motion-Camera2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets whether you should show UI with rationale for requesting permissions.
 *
 * @param permissions The permissions your app wants to request.
 * @return Whether you can show permission rationale UI.
 */
private boolean shouldShowRequestPermissionRationale(String[] permissions) {
    for (String permission : permissions) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
            return true;
        }
    }
    return false;
}
 
Example 7
Source File: Camera2BasicFragment.java    From android-object-distance with Apache License 2.0 5 votes vote down vote up
private void requestCameraPermission() {
    if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG);
    } else {
        FragmentCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
                REQUEST_CAMERA_PERMISSION);
    }
}
 
Example 8
Source File: CameraUtil.java    From Camera2-Video with Apache License 2.0 5 votes vote down vote up
public static boolean shouldShowRequestPermissionRationale(Fragment context, String[] permissions) {
    for (String permission : permissions) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(context, permission)) {
            return true;
        }
    }
    return false;
}
 
Example 9
Source File: Camera2Fragment.java    From MultiMediaSample with Apache License 2.0 5 votes vote down vote up
private void requestCameraPermission() {
    if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG);
    } else {
        FragmentCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
                REQUEST_CAMERA_PERMISSION);
    }
}
 
Example 10
Source File: Camera2BasicFragment.java    From Android-Camera2-Front-with-Face-Detection with Apache License 2.0 5 votes vote down vote up
private void requestCameraPermission() {
    if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
        new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG);
    } else {
        FragmentCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
                REQUEST_CAMERA_PERMISSION);
    }
}
 
Example 11
Source File: Camera2RawFragment.java    From android-Camera2Raw with Apache License 2.0 5 votes vote down vote up
/**
 * Gets whether you should show UI with rationale for requesting the permissions.
 *
 * @return True if the UI should be shown.
 */
private boolean shouldShowRationale() {
    for (String permission : CAMERA_PERMISSIONS) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
            return true;
        }
    }
    return false;
}
 
Example 12
Source File: Camera2VideoFragment.java    From android-Camera2Video with Apache License 2.0 5 votes vote down vote up
/**
 * Gets whether you should show UI with rationale for requesting permissions.
 *
 * @param permissions The permissions your app wants to request.
 * @return Whether you can show permission rationale UI.
 */
private boolean shouldShowRequestPermissionRationale(String[] permissions) {
    for (String permission : permissions) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
            return true;
        }
    }
    return false;
}