Java Code Examples for com.theartofdev.edmodo.cropper.CropImage#CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE

The following examples show how to use com.theartofdev.edmodo.cropper.CropImage#CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE . 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: PickImageActivity.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    if (requestCode == CropImage.CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE) {
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            LogUtil.logDebug(TAG, "CAMERA_CAPTURE_PERMISSIONS granted");
            CropImage.startPickImageActivity(this);
        } else {
            showSnackBar(R.string.permissions_not_granted);
            LogUtil.logDebug(TAG, "CAMERA_CAPTURE_PERMISSIONS not granted");
        }
    }
    if (requestCode == CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE) {
        if (imageUri != null && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            LogUtil.logDebug(TAG, "PICK_IMAGE_PERMISSIONS granted");
            onImagePikedAction();
        } else {
            showSnackBar(R.string.permissions_not_granted);
            LogUtil.logDebug(TAG, "PICK_IMAGE_PERMISSIONS not granted");
        }
    }
}
 
Example 2
Source File: PickImageActivity.java    From social-app-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    if (requestCode == CropImage.CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE) {
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            LogUtil.logDebug(TAG, "CAMERA_CAPTURE_PERMISSIONS granted");
            CropImage.startPickImageActivity(this);
        } else {
            showSnackBar(R.string.permissions_not_granted);
            LogUtil.logDebug(TAG, "CAMERA_CAPTURE_PERMISSIONS not granted");
        }
    }
    if (requestCode == CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE) {
        if (imageUri != null && grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            LogUtil.logDebug(TAG, "PICK_IMAGE_PERMISSIONS granted");
            onImagePikedAction();
        } else {
            showSnackBar(R.string.permissions_not_granted);
            LogUtil.logDebug(TAG, "PICK_IMAGE_PERMISSIONS not granted");
        }
    }
}
 
Example 3
Source File: MainActivity.java    From Android-Image-Cropper with Apache License 2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(
    int requestCode, String permissions[], int[] grantResults) {
  if (requestCode == CropImage.CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE) {
    if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
      CropImage.startPickImageActivity(this);
    } else {
      Toast.makeText(this, "Cancelling, required permissions are not granted", Toast.LENGTH_LONG)
          .show();
    }
  }
  if (requestCode == CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE) {
    if (mCropImageUri != null
        && grantResults.length > 0
        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
      mCurrentFragment.setImageUri(mCropImageUri);
    } else {
      Toast.makeText(this, "Cancelling, required permissions are not granted", Toast.LENGTH_LONG)
          .show();
    }
  }
}