Java Code Examples for com.theartofdev.edmodo.cropper.CropImage#startPickImageActivity()

The following examples show how to use com.theartofdev.edmodo.cropper.CropImage#startPickImageActivity() . 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();
    }
  }
}
 
Example 4
Source File: FlutterImagePickCropPlugin.java    From FlutterImagePickCrop with Apache License 2.0 5 votes vote down vote up
private void openPickupFromGallery() {
     //Toast.makeText(activity, REQUEST_FOR_GALLERY, Toast.LENGTH_SHORT).show();

     // For Image capture from Gallary
/*     activity.startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
             PICK_FROM_GALLARY);*/
     CropImage.startPickImageActivity(activity);

 }
 
Example 5
Source File: PickImageActivity.java    From social-app-android with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
public void onSelectImageClick(View view) {
    if (CropImage.isExplicitCameraPermissionRequired(this)) {
        requestPermissions(new String[]{Manifest.permission.CAMERA}, CropImage.CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE);
    } else {
        CropImage.startPickImageActivity(this);
    }
}
 
Example 6
Source File: PickImageActivity.java    From social-app-android with Apache License 2.0 5 votes vote down vote up
@SuppressLint("NewApi")
public void onSelectImageClick(View view) {
    if (CropImage.isExplicitCameraPermissionRequired(this)) {
        requestPermissions(new String[]{Manifest.permission.CAMERA}, CropImage.CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE);
    } else {
        CropImage.startPickImageActivity(this);
    }
}
 
Example 7
Source File: FlutterImagePickCropPlugin.java    From FlutterImagePickCrop with Apache License 2.0 4 votes vote down vote up
public void onSelectImageClick(View view) {
    CropImage.startPickImageActivity(activity);
}