Search in sources :

Example 6 with AfterPermissionGranted

use of pub.devrel.easypermissions.AfterPermissionGranted in project JustAndroid by chinaltz.

the class OtherUtilsFragment method didStartCaptureVideo.

@AfterPermissionGranted(REQUEST_Camera_CAPTUREVIDEO)
public void didStartCaptureVideo() {
    if (EasyPermissions.hasPermissions(mContext, Manifest.permission.CAMERA)) {
        String videoFilePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + AbStrUtil.get36UUID() + ".mp4";
        File videoFile = new File(videoFilePath);
        // 启动视频录制
        CaptureVideoActivity.start((Activity) mContext, videoFilePath, 1000);
    } else {
        // Ask for one permission
        EasyPermissions.requestPermissions(this, "需要使用相机信息权限", REQUEST_Camera_CAPTUREVIDEO, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO);
    }
}
Also used : File(java.io.File) AfterPermissionGranted(pub.devrel.easypermissions.AfterPermissionGranted)

Example 7 with AfterPermissionGranted

use of pub.devrel.easypermissions.AfterPermissionGranted in project JustAndroid by chinaltz.

the class OtherUtilsFragment method didStartCapture.

@AfterPermissionGranted(REQUEST_Camera_PERM)
public void didStartCapture() {
    if (EasyPermissions.hasPermissions(mContext, Manifest.permission.CAMERA)) {
        Intent intent = new Intent();
        intent.setClass(mContext, CaptureActivity.class);
        startActivity(intent);
    } else {
        // Ask for one permission
        EasyPermissions.requestPermissions(this, "需要使用相机信息权限", REQUEST_Camera_PERM, Manifest.permission.CAMERA);
    }
}
Also used : Intent(android.content.Intent) AfterPermissionGranted(pub.devrel.easypermissions.AfterPermissionGranted)

Example 8 with AfterPermissionGranted

use of pub.devrel.easypermissions.AfterPermissionGranted in project FirebaseUI-Android by firebase.

the class ImageActivity method choosePhoto.

@AfterPermissionGranted(RC_IMAGE_PERMS)
protected void choosePhoto() {
    if (!EasyPermissions.hasPermissions(this, PERMS)) {
        EasyPermissions.requestPermissions(this, getString(R.string.rational_image_perm), RC_IMAGE_PERMS, PERMS);
        return;
    }
    Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(i, RC_CHOOSE_PHOTO);
}
Also used : Intent(android.content.Intent) AfterPermissionGranted(pub.devrel.easypermissions.AfterPermissionGranted)

Aggregations

AfterPermissionGranted (pub.devrel.easypermissions.AfterPermissionGranted)8 Intent (android.content.Intent)4 File (java.io.File)3 SharedPreferences (android.content.SharedPreferences)1 LocationProvider (com.litingzhe.justandroid.ui.mapView.AMapUtils.LocationProvider)1