Java Code Examples for com.theartofdev.edmodo.cropper.CropImage#CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE
The following examples show how to use
com.theartofdev.edmodo.cropper.CropImage#CROP_IMAGE_ACTIVITY_RESULT_ERROR_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: SetupActivity.java From Simple-Blog-App with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == GALLARY_REQUEST && resultCode == RESULT_OK) { Uri imageUri = data.getData(); CropImage.activity(imageUri) .setGuidelines(CropImageView.Guidelines.ON) .setAspectRatio(1, 1) .start(this); } if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { mImageUri = result.getUri(); mSetupImage.setImageURI(mImageUri); } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); Log.d("setupError", error + ""); } } }
Example 2
Source File: PublishProfilePictureActivity.java From Pix-Art-Messenger with GNU General Public License v3.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { this.avatarUri = result.getUri(); if (xmppConnectionServiceBound) { loadImageIntoPreview(this.avatarUri); } } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); if (error != null) { ToastCompat.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show(); } } } else if (requestCode == REQUEST_CHOOSE_PICTURE) { if (resultCode == RESULT_OK) { cropUri(this, data.getData()); } } }
Example 3
Source File: PublishGroupChatProfilePictureActivity.java From Pix-Art-Messenger with GNU General Public License v3.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { final CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { this.uri = result.getUri(); if (xmppConnectionServiceBound) { reloadAvatar(); } } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); if (error != null) { ToastCompat.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show(); } } } else if (requestCode == REQUEST_CHOOSE_PICTURE) { if (resultCode == RESULT_OK) { PublishProfilePictureActivity.cropUri(this, data.getData()); } } }
Example 4
Source File: MainActivity.java From Android-Image-Cropper with Apache License 2.0 | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // handle result of CropImageActivity if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { ((ImageView) findViewById(R.id.quick_start_cropped_image)).setImageURI(result.getUri()); Toast.makeText( this, "Cropping successful, Sample: " + result.getSampleSize(), Toast.LENGTH_LONG) .show(); } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Toast.makeText(this, "Cropping failed: " + result.getError(), Toast.LENGTH_LONG).show(); } } }
Example 5
Source File: MainActivity.java From Android-Image-Cropper with Apache License 2.0 | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // handle result of CropImageActivity if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { ((ImageView) findViewById(R.id.quick_start_cropped_image)).setImageURI(result.getUri()); Toast.makeText( this, "Cropping successful, Sample: " + result.getSampleSize(), Toast.LENGTH_LONG) .show(); } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Toast.makeText(this, "Cropping failed: " + result.getError(), Toast.LENGTH_LONG).show(); } } }
Example 6
Source File: PublishProfilePictureActivity.java From Conversations with GNU General Public License v3.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { this.avatarUri = result.getUri(); if (xmppConnectionServiceBound) { loadImageIntoPreview(this.avatarUri); } } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); if (error != null) { Toast.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show(); } } } else if (requestCode == REQUEST_CHOOSE_PICTURE) { if (resultCode == RESULT_OK) { cropUri(this, data.getData()); } } }
Example 7
Source File: PublishGroupChatProfilePictureActivity.java From Conversations with GNU General Public License v3.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { final CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { this.uri = result.getUri(); if (xmppConnectionServiceBound) { reloadAvatar(); } } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); if (error != null) { Toast.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show(); } } } else if (requestCode == REQUEST_CHOOSE_PICTURE) { if (resultCode == RESULT_OK) { PublishProfilePictureActivity.cropUri(this, data.getData()); } } }
Example 8
Source File: FragmentEditImage.java From iGap-Android with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); String path; if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) { final Uri resultUri = UCrop.getOutput(data); path = AttachFile.getFilePathFromUri(resultUri); serCropAndFilterImage(path); } else if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { // result for crop CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { path = result.getUri().getPath(); serCropAndFilterImage(path); } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { // Exception error = result.getError(); } } }
Example 9
Source File: ProfileEditActivity.java From FaceT with Mozilla Public License 2.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == GALLERY_REQUEST && resultCode == RESULT_OK) { Uri imageUri = data.getData(); CropImage.activity(imageUri) .setGuidelines(CropImageView.Guidelines.ON) .setCropShape(CropImageView.CropShape.OVAL) .setAspectRatio(1, 1) .start(this); } if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { mImageUri = result.getUri(); editProfilepic.setImageURI(mImageUri); } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); Log.e(TAG + "crop_error", error.toString()); } } }
Example 10
Source File: ChannelNameActivity.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(intent); if (resultCode == RESULT_OK) { if (intent == null) { return; } if (imageChangeUri != null) { imageChangeUri = result.getUri(); applozicGroupProfileIcon.setImageDrawable(null); // <--- added to force redraw of ImageView applozicGroupProfileIcon.setImageURI(imageChangeUri); } else { imageChangeUri = result.getUri(); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_" + ".jpeg"; applozicGroupProfileIcon.setImageDrawable(null); // <--- added to force redraw of ImageView applozicGroupProfileIcon.setImageURI(imageChangeUri); profilePhotoFile = FileClientService.getFilePath(imageFileName, this, "image/jpeg"); fileClientService.writeFile(imageChangeUri, profilePhotoFile); } } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Utils.printLog(this,ChannelNameActivity.class.getName(),this.getString(R.string.applozic_Cropping_failed)+result.getError()); } } if (resultCode == Activity.RESULT_OK) { handleOnActivityResult(requestCode, intent); } }
Example 11
Source File: ChannelCreateActivity.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); try { if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(intent); if (resultCode == RESULT_OK) { if (intent == null) { return; } if (imageChangeUri != null) { imageChangeUri = result.getUri(); circleImageView.setImageDrawable(null); // <--- added to force redraw of ImageView circleImageView.setImageURI(imageChangeUri); new ProfilePictureUpload(true, profilePhotoFile, imageChangeUri, ChannelCreateActivity.this).execute((Void[]) null); } else { imageChangeUri = result.getUri(); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_" + ".jpeg"; circleImageView.setImageDrawable(null); // <--- added to force redraw of ImageView circleImageView.setImageURI(imageChangeUri); profilePhotoFile = FileClientService.getFilePath(imageFileName, this, "image/jpeg"); new ProfilePictureUpload(true, profilePhotoFile, imageChangeUri, ChannelCreateActivity.this).execute((Void[]) null); } } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Toast.makeText(this, this.getString(R.string.applozic_Cropping_failed) + result.getError(), Toast.LENGTH_LONG).show(); } } if (resultCode == Activity.RESULT_OK) { handleOnActivityResult(requestCode, intent); } } catch (Exception e) { Utils.printLog(this, TAG, "exception in profile image"); } }
Example 12
Source File: FlutterImagePickCropPlugin.java From FlutterImagePickCrop with Apache License 2.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.M) @RequiresApi(api = Build.VERSION_CODES.M) @Override public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { Uri resultUri = result.getUri(); finishWithSuccess(resultUri.getPath()); } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); finishWithError("Failed Permission",error.getMessage()); } return true; } if (requestCode == CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE && resultCode == RESULT_OK) { Uri imageUri = CropImage.getPickImageResultUri(context, data); if (CropImage.isReadExternalStoragePermissionsRequired(context, imageUri)) { mCropImageUri = imageUri; //Toast.makeText(activity, "check: " + mCropImageUri.toString(), Toast.LENGTH_SHORT).show(); activity.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE); } else { startCropImageActivity(imageUri); } return true; } // // else if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK) { // Uri imageUri = CropImage.getPickImageResultUri(context, data); // if (imageUri != null) { // finishWithSuccess(imageUri.getPath()); // }else { // finishWithSuccess(null); // } // return true; // } return false; }
Example 13
Source File: CropperImageActivity.java From WanAndroid with Apache License 2.0 | 4 votes |
protected void setResultOK(Uri uri, Exception error, int sampleSize) { int resultCode = error == null ? RESULT_OK : CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE; setResult(resultCode, getResultIntent(uri, error, sampleSize)); finish(); }
Example 14
Source File: ImageUtilityHelper.java From AndroidDesignPatterns with Apache License 2.0 | 4 votes |
public void onSelectionResult(int requestCode, int resultCode, Intent data) { //For Android-Image-Cropper if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { Uri resultUri = result.getUri(); cropImageView.setImageURI(resultUri); isDeleteLocalImage = true; } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); Toast.makeText(mContext, "" + error, Toast.LENGTH_SHORT).show(); } } else //For Image chooser intent if (resultCode == RESULT_OK) { if (requestCode == MainActivity.IMAGE_CHOOSER_CODE) { boolean isCamera; if (data == null) { isCamera = true; } else { final String action = data.getAction(); if (action == null) { isCamera = false; } else { isCamera = action.equals(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); } } if (isCamera) { //Result From Camera localImageFile = new File(Environment.getExternalStorageDirectory().toString()); for (File temp : localImageFile.listFiles()) { if (temp.getName().equals("temp.jpg")) { localImageFile = temp; break; } } Uri selectedFileUri = Uri.fromFile(localImageFile); //call image crop activity getSetCropImage(selectedFileUri); } else { //Result From Gallery Uri selectedImageUri = data.getData(); //call image crop activity getSetCropImage(selectedImageUri); } } } }
Example 15
Source File: ConversationActivity.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { try { conversationUIService.onActivityResult(requestCode, resultCode, data); handleOnActivityResult(requestCode, data); if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { CropImage.ActivityResult result = CropImage.getActivityResult(data); if (resultCode == RESULT_OK) { if (data == null) { return; } if (imageUri != null) { imageUri = result.getUri(); if (imageUri != null && profilefragment != null) { profilefragment.handleProfileimageUpload(true, imageUri, profilePhotoFile); } } else { imageUri = result.getUri(); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_" + ".jpeg"; profilePhotoFile = FileClientService.getFilePath(imageFileName, this, "image/jpeg"); if (imageUri != null && profilefragment != null) { profilefragment.handleProfileimageUpload(true, imageUri, profilePhotoFile); } } } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Utils.printLog(this, ConversationActivity.class.getName(), "Cropping failed:" + result.getError()); } } if (requestCode == LOCATION_SERVICE_ENABLE) { if (((LocationManager) getSystemService(Context.LOCATION_SERVICE)) .isProviderEnabled(LocationManager.GPS_PROVIDER)) { googleApiClient.connect(); } else { Toast.makeText(ConversationActivity.this, R.string.unable_to_fetch_location, Toast.LENGTH_LONG).show(); } return; } } catch (Exception e) { e.printStackTrace(); } }