当前位置: 首页>>代码示例>>Java>>正文


Java FragmentCompat.shouldShowRequestPermissionRationale方法代码示例

本文整理汇总了Java中android.support.v13.app.FragmentCompat.shouldShowRequestPermissionRationale方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentCompat.shouldShowRequestPermissionRationale方法的具体用法?Java FragmentCompat.shouldShowRequestPermissionRationale怎么用?Java FragmentCompat.shouldShowRequestPermissionRationale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v13.app.FragmentCompat的用法示例。


在下文中一共展示了FragmentCompat.shouldShowRequestPermissionRationale方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requestCameraPermission

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
/**
 * Handles the requesting of the camera permission.  This includes
 * showing a "Snackbar" message of why the permission is needed then
 * sending the request.
 */
private void requestCameraPermission() {
    Log.w(TAG, "Camera permission is not granted. Requesting permission");

    final String[] permissions = new String[]{Manifest.permission.CAMERA};

    if (!FragmentCompat.shouldShowRequestPermissionRationale(this,
            Manifest.permission.CAMERA)) {
        FragmentCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);
        return;
    }

    View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            FragmentCompat.requestPermissions(ScannerFragment.this, permissions,
                    RC_HANDLE_CAMERA_PERM);
        }
    };

    Snackbar.make(getView(), R.string.scanner_permission_camera_rationale,
            Snackbar.LENGTH_INDEFINITE)
            .setAction(android.R.string.ok, listener)
            .show();
}
 
开发者ID:MobileTribe,项目名称:pandroid,代码行数:30,代码来源:ScannerFragment.java

示例2: onRequestPermissionsResult

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    Log.d(TAG, "onRequestPermissionsResult " + requestCode);
    if (requestCode == REQUEST_CODE_PERMISSION) {
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            Log.d(TAG, "permission granted");
            startSelectImage();
        } else {
            if (FragmentCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
                Log.d(TAG, "show permission rationale");
                Snackbar.make(getView(), "You need to allow the app to read your disk if you want to add custom images.", Snackbar.LENGTH_LONG).show();
            }
        }
    }
    Log.d(TAG, "permission denied");
}
 
开发者ID:patrickfav,项目名称:BlurTestAndroid,代码行数:18,代码来源:BlurBenchmarkFragment.java

示例3: requestCameraPermission

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:vulovicv23,项目名称:opencv-documentscanner-android,代码行数:9,代码来源:Camera2BasicFragment.java

示例4: shouldShowRequestPermissionRationale

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:mywitness,项目名称:Camara2-Video-Demo-fixed,代码行数:15,代码来源:Camera2VideoFragment.java

示例5: shouldShowRequestPermissionRationale

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
private boolean shouldShowRequestPermissionRationale(String[] permissions) {
    for (String permission : permissions) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(this, permission)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:wingskyer,项目名称:android-Camera2Basic-master,代码行数:9,代码来源:Camera2BasicFragment.java

示例6: requestCameraPermission

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:9,代码来源:CameraFragment.java

示例7: requestStoragePermissions

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:8,代码来源:CameraFragment.java

示例8: shouldShowRationale

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:gengqifu,项目名称:361Camera,代码行数:14,代码来源:Camera2Fragment.java

示例9: shouldShowRationale

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
/**
 * Gets whether you should show UI with rationale for requesting the permissions.
 *
 * @return True if the UI should be shown.
 */
public static boolean  shouldShowRationale(Fragment fragment) {
    for (String permission : CAMERA_PERMISSIONS) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(fragment, permission)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:OkayCamera,项目名称:OkayCamera-Android,代码行数:14,代码来源:PermissionManager.java

示例10: shouldShowRequestPermissionRationale

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
public static boolean shouldShowRequestPermissionRationale(Fragment context, String[] permissions) {
    for (String permission : permissions) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(context, permission)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:WesleyElliott,项目名称:Camera2-Video,代码行数:9,代码来源:CameraUtil.java

示例11: requestCameraPermission

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:ResearchStack,项目名称:MoleMapperAndroid,代码行数:14,代码来源:LollipopCameraFragment.java

示例12: shouldShowRequestPermissionRationale

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
/**
 * Checks given permissions are needed to show rationale.
 *
 * @param fragment    fragment
 * @param permissions permission list
 * @return returns true if one of the permission is needed to show rationale.
 */
public static boolean shouldShowRequestPermissionRationale(Fragment fragment, String... permissions) {
    for (String permission : permissions) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(fragment, permission)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:permissions-dispatcher,项目名称:PermissionsDispatcher,代码行数:16,代码来源:PermissionUtils.java

示例13: shouldShowPermissionRationale

import android.support.v13.app.FragmentCompat; //导入方法依赖的package包/类
/**
 * Check if at least one of the given permissions should show a permission rationale.
 */
static boolean shouldShowPermissionRationale(Fragment fragment, @NonNull String[] permissions) {
    for (String permission : permissions) {
        if (FragmentCompat.shouldShowRequestPermissionRationale(fragment, permission)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:buchandersenn,项目名称:android-permission-manager,代码行数:13,代码来源:PermissionUtil.java


注:本文中的android.support.v13.app.FragmentCompat.shouldShowRequestPermissionRationale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。