android.support.v13.app.FragmentCompat Java Examples
The following examples show how to use
android.support.v13.app.FragmentCompat.
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: BaseFragment.java From Learning-Resources with MIT License | 6 votes |
/** * Ask Permission to be granted. * * @param permissionAsk */ private void internalRequestPermission(String[] permissionAsk) { String arrayPermissionNotGranted[]; ArrayList<String> permissionsNotGranted = new ArrayList<>(); for (String aPermissionAsk : permissionAsk) { if (!isPermissionGranted(getActivity(), aPermissionAsk)) { permissionsNotGranted.add(aPermissionAsk); } } if (permissionsNotGranted.isEmpty()) { if (permissionResult != null) permissionResult.permissionGranted(); } else { arrayPermissionNotGranted = new String[permissionsNotGranted.size()]; arrayPermissionNotGranted = permissionsNotGranted.toArray(arrayPermissionNotGranted); FragmentCompat.requestPermissions(this, arrayPermissionNotGranted, KEY_PERMISSION); } }
Example #2
Source File: Camera2Fragment.java From Camera2-Video with Apache License 2.0 | 5 votes |
protected void requestVideoPermissions() { if (CameraUtil.shouldShowRequestPermissionRationale(this, Camera2PermissionDialog.VIDEO_PERMISSIONS)) { Camera2PermissionDialog.newInstance(this, mRationaleMessage).show(getChildFragmentManager(), Camera2PermissionDialog.FRAGMENT_DIALOG); } else { FragmentCompat.requestPermissions(this, Camera2PermissionDialog.VIDEO_PERMISSIONS, Camera2PermissionDialog.REQUEST_VIDEO_PERMISSIONS); } }
Example #3
Source File: Camera2VideoFragment.java From android-Camera2Video with Apache License 2.0 | 5 votes |
/** * Requests permissions needed for recording video. */ private void requestVideoPermissions() { if (shouldShowRequestPermissionRationale(VIDEO_PERMISSIONS)) { new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG); } else { FragmentCompat.requestPermissions(this, VIDEO_PERMISSIONS, REQUEST_VIDEO_PERMISSIONS); } }
Example #4
Source File: Camera2VideoFragment.java From android-Camera2Video with Apache License 2.0 | 5 votes |
/** * 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 #5
Source File: Camera2RawFragment.java From android-Camera2Raw with Apache License 2.0 | 5 votes |
/** * 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: Camera2RawFragment.java From android-Camera2Raw with Apache License 2.0 | 5 votes |
/** * Requests permissions necessary to use camera and save pictures. */ private void requestCameraPermissions() { if (shouldShowRationale()) { PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog"); } else { FragmentCompat.requestPermissions(this, CAMERA_PERMISSIONS, REQUEST_CAMERA_PERMISSIONS); } }
Example #7
Source File: Camera2BasicFragment.java From Android-Camera2-Front-with-Face-Detection with Apache License 2.0 | 5 votes |
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: Camera2Fragment.java From MultiMediaSample with Apache License 2.0 | 5 votes |
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 #9
Source File: CameraUtil.java From Camera2-Video with Apache License 2.0 | 5 votes |
public static boolean shouldShowRequestPermissionRationale(Fragment context, String[] permissions) { for (String permission : permissions) { if (FragmentCompat.shouldShowRequestPermissionRationale(context, permission)) { return true; } } return false; }
Example #10
Source File: Camera2BasicFragment.java From opencv-documentscanner-android with Apache License 2.0 | 5 votes |
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: Camera2BasicFragment.java From android-object-distance with Apache License 2.0 | 5 votes |
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 #12
Source File: CaptureHighSpeedVideoMode.java From Android-Slow-Motion-Camera2 with GNU General Public License v3.0 | 5 votes |
/** * Requests permissions needed for recording video. */ private void requestVideoPermissions() { if (shouldShowRequestPermissionRationale(VIDEO_PERMISSIONS)) { new ConfirmationDialog().show(getChildFragmentManager(), FRAGMENT_DIALOG); } else { FragmentCompat.requestPermissions(this, VIDEO_PERMISSIONS, REQUEST_VIDEO_PERMISSIONS); } }
Example #13
Source File: CaptureHighSpeedVideoMode.java From Android-Slow-Motion-Camera2 with GNU General Public License v3.0 | 5 votes |
/** * 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 #14
Source File: Camera2Fragment.java From 361Camera with Apache License 2.0 | 5 votes |
/** * 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 #15
Source File: Camera2Fragment.java From 361Camera with Apache License 2.0 | 5 votes |
/** * Requests permissions necessary to use camera and save pictures. */ private void requestCameraPermissions() { if (shouldShowRationale()) { PermissionConfirmationDialog.newInstance().show(getChildFragmentManager(), "dialog"); } else { FragmentCompat.requestPermissions(this, CAMERA_PERMISSIONS, REQUEST_CAMERA_PERMISSIONS); } }
Example #16
Source File: CameraFragment.java From polling-station-app with GNU Lesser General Public License v3.0 | 5 votes |
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 #17
Source File: CameraFragment.java From polling-station-app with GNU Lesser General Public License v3.0 | 5 votes |
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 #18
Source File: Camera2BasicFragment.java From Cam2Caption with BSD 3-Clause "New" or "Revised" License | 5 votes |
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 #19
Source File: PermissionUtils.java From SimpleSmsRemote with MIT License | 2 votes |
/** * request common permissions via dialog <br/> * with common permissions are meant all permissions that can be request via the standard dialog * * @param fragment any fragment * @param permissions permissions to request * @param resultCode code to identify this request */ public static void RequestCommonPermissions(Fragment fragment, String[] permissions, int resultCode) { FragmentCompat.requestPermissions(fragment, permissions, resultCode); }