本文整理汇总了Java中com.yalantis.ucrop.UCrop.REQUEST_CROP属性的典型用法代码示例。如果您正苦于以下问题:Java UCrop.REQUEST_CROP属性的具体用法?Java UCrop.REQUEST_CROP怎么用?Java UCrop.REQUEST_CROP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.yalantis.ucrop.UCrop
的用法示例。
在下文中一共展示了UCrop.REQUEST_CROP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PICK_PIC_REQUEST) {
List<String> photos = (List<String>) data.getSerializableExtra(GalleryActivity.PHOTOS);
presenter.openCropper(photos.get(0));
}
if (requestCode == UCrop.REQUEST_CROP) {
try {
String filename = FNAME_PREFIX + System.currentTimeMillis();
presenter.processPicture(
openFileOutput(filename, Context.MODE_PRIVATE), filename, UCrop.getOutput(data));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
}
示例2: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
textView1.setText(R.string.identify_document);
if (backTaked) {
performOCRIFE(type, uri1, UCrop.getOutput(data));
backTaked = false;
} else {
rectangleIfeFront.setVisibility(View.GONE);
rectangleIfeBack.setVisibility(View.GONE);
rectangleIneBack.setVisibility(View.GONE);
uri1 = UCrop.getOutput(data);
backTaked = true;
if (type == Constants.IFEB || type == Constants.IFEC) {
rectangleIfeBack.setVisibility(View.VISIBLE);
} else if (type == Constants.IFED || type == Constants.IFEE) {
rectangleIneBack.setVisibility(View.VISIBLE);
}
}
} else {
//final Throwable cropError = UCrop.getError(data);
}
}
示例3: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_SELECT_PICTURE) {
final Uri selectedUri = data.getData();
if (selectedUri != null) {
startCropActivity(data.getData());
} else {
ToastUtils.showToast(UpdateUserInfoActivity.this,"类型不匹配");
}
} else if (requestCode == UCrop.REQUEST_CROP) {
handleCropResult(data);
}
}
if (resultCode == UCrop.RESULT_ERROR) {
handleCropError(data);
}
}
示例4: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_SELECT_PICTURE) {
final Uri selectedUri = data.getData();
if (selectedUri != null) {
startCropActivity(data.getData());
} else {
ToastUtils.showToast(EditFamilyActivity.this, "类型不匹配");
}
} else if (requestCode == UCrop.REQUEST_CROP) {
handleCropResult(data);
}
}
if (resultCode == UCrop.RESULT_ERROR) {
handleCropError(data);
}
}
示例5: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_LOAD_IMAGE && null != data) {
final Uri selectedImage = data.getData();
CropUtil.startCropActivity(MainActivity.this, selectedImage);
} else if (requestCode == REQUEST_QRCODE && data != null) {
dealQRCode(data);
} else if (requestCode == REQUEST_IMAGE && data != null) {
dealQRImage(data);
} else if (requestCode == UCrop.REQUEST_CROP) {
dealCropResult(data);
}
} else if (resultCode == UCrop.RESULT_ERROR) {
handleCropError(data);
}
// super.onActivityResult(requestCode, resultCode, data);
}
示例6: onActivityResultToCrop
public void onActivityResultToCrop(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_SELECT_PICTURE) {
final Uri selectedUri = data.getData();
if (selectedUri != null) {
startCropActivity(data.getData());
} else {
Toast.makeText(mActivity,
R.string.toast_cannot_retrieve_selected_image,
Toast.LENGTH_SHORT).show();
}
} else if (requestCode == UCrop.REQUEST_CROP) {
handleCropResult(data);
}
}
if (resultCode == UCrop.RESULT_ERROR) {
handleCropError(data);
}
}
示例7: handleResult
/**
* 注意,调用时data为null的判断
*
* @param context
* @param cropHandler
* @param requestCode
* @param resultCode
* @param data
*/
public static void handleResult(Activity context, CropHandler cropHandler, int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_SELECT_PICTURE) {//第一次,选择图片后返回
final Uri selectedUri = data.getData();
if (selectedUri != null) {
startCropActivity(context, data.getData());
} else {
Toast.makeText(context, "Cannot retrieve selected image", Toast.LENGTH_SHORT).show();
}
} else if (requestCode == UCrop.REQUEST_CROP) {//第二次返回,图片已经剪切好
Uri finalUri = UCrop.getOutput(data);
cropHandler.handleCropResult(finalUri,config.tag);
} else if (requestCode == REQUEST_CAMERA) {//第一次,拍照后返回,因为设置了MediaStore.EXTRA_OUTPUT,所以data为null,数据直接就在uri中
startCropActivity(context, uri);
}
}
if (resultCode == UCrop.RESULT_ERROR) {
cropHandler.handleCropError(data);
}
}
示例8: onActivityResult
/**
* 注意,调用时data为null的判断
*
* @param context
* @param cropHandler
* @param requestCode
* @param resultCode
* @param data
*/
public static void onActivityResult( int requestCode, int resultCode, Intent data,Activity context, CropHandler cropHandler) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_SELECT_PICTURE) {//第一次,选择图片后返回
final Uri selectedUri = data.getData();
if (selectedUri != null) {
startCropActivity(context, data.getData());
} else {
Toast.makeText(context, "Cannot retrieve selected image", Toast.LENGTH_SHORT).show();
}
} else if (requestCode == UCrop.REQUEST_CROP) {//第二次返回,图片已经剪切好
Uri finalUri = UCrop.getOutput(data);
cropHandler.handleCropResult(finalUri,config.tag);
} else if (requestCode == REQUEST_CAMERA) {//第一次,拍照后返回,因为设置了MediaStore.EXTRA_OUTPUT,所以data为null,数据直接就在uri中
startCropActivity(context, uri);
}
}
if (resultCode == UCrop.RESULT_ERROR) {
cropHandler.handleCropError(data);
}
}
示例9: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == FLAG_CHOOSE_CAMERA) {
startCropActivity(imageUri);
} else if (requestCode == FLAG_CHOOSE_IMG) {
processCropIMG(data);
} else if (requestCode == UCrop.REQUEST_CROP) {
handleCropResult(data);
}
}
if (resultCode == UCrop.RESULT_ERROR) {
handleCropError(data);
}
}
示例10: onActivityResult
@SuppressWarnings("ResultOfMethodCallIgnored")
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
if (mTempFile != null && mTempFile.exists()) {
mTempFile.delete();
}
Uri outUri= UCrop.getOutput(data);
if (outUri != null ) {
if (mCallback != null) {
mCallback.onCropperCallback(CropperResult.success, mSrcFile, mOutFile,outUri);
}
} else {
if (mCallback != null) {
mCallback.onCropperCallback(CropperResult.error_illegal_out_file, mSrcFile, null,null);
}
}
}
}
示例11: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// 收到从Activity传递过来的回调,然后取出其中的值进行图片加载
// 如果是我能够处理的类型
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
// 通过UCrop得到对应的Uri
final Uri resultUri = UCrop.getOutput(data);
if (resultUri != null) {
loadPortrait(resultUri);
}
} else if (resultCode == UCrop.RESULT_ERROR) {
Application.showToast(R.string.data_rsp_error_unknown);
}
}
示例12: onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (resultCode) {
case Activity.RESULT_CANCELED:
listener.onCropCancel();
break;
case UCrop.RESULT_ERROR:
if (data != null) {
Throwable cropError = UCrop.getError(data);
if (cropError != null) {
listener.onCropError(cropError.getMessage());
} else {
listener.onCropError("裁剪出现未知错误");
}
} else {
listener.onCropError("获取相册图片出现错误");
}
break;
case Activity.RESULT_OK:
switch (requestCode) {
case TYPE_CAMERA:
notifyImageToCamera(listener.getSimpleActivity(), imagePath);
UCrop of = UCrop.of(imagePath, Uri.fromFile(getDiskCacheDir()));
// of.withAspectRatio(8,5);
UCrop.Options options = new UCrop.Options();
options.setAspectRatioOptions(0, new AspectRatio("8:5", 8, 5));
of.withOptions(options);
of.start(listener.getSimpleActivity());
break;
case UCrop.REQUEST_CROP:
listener.onCropSuccess(UCrop.getOutput(data));
break;
}
break;
}
}
示例13: onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) {
tempOutputFile.delete();
return;
}
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_SELECT_IMAGE) {
// user selected an image off their device. other condition they took the image and that image is in our tempoutput file
Uri outputFile;
Uri tempFileUri = Uri.fromFile(tempOutputFile);
// if statement will detect if the user selected an image from the device or took an image
if (data != null && (data.getAction() == null || !data.getAction()
.equals(MediaStore.ACTION_IMAGE_CAPTURE))) {
//then it means user selected an image off the device
// so we can get the Uri of that image using data.getData
outputFile = data.getData();
// Now we need to do the crop
} else {
// image was out temp file. user took an image using camera
outputFile = tempFileUri;
// Now we need to do the crop
}
startCropActivity(outputFile);
} else if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
uploadFile(Uri.parse(tempOutputFile.getPath()));
Timber.e(String.valueOf(Uri.fromFile(tempOutputFile)));
avatarView.setImageResource(0);
avatarView.setImageURI(Uri.fromFile(tempOutputFile));
// avatarProgressFrame.setVisibility(View.VISIBLE);
// bus.post(new Account.ChangeAvatarRequest(Uri.fromFile(tempOutputFile)));
}
}
}
示例14: onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) {
tempOutputFile.delete();
return;
}
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_SELECT_IMAGE) {
// user selected an image off their device. other condition they took the image and that image is in our tempoutput file
Uri outputFile;
Uri tempFileUri = Uri.fromFile(tempOutputFile);
// if statement will detect if the user selected an image from the device or took an image
if (data != null && (data.getAction() == null || !data.getAction()
.equals(MediaStore.ACTION_IMAGE_CAPTURE))) {
//then it means user selected an image off the device
// so we can get the Uri of that image using data.getData
outputFile = data.getData();
// Now we need to do the crop
} else {
// image was out temp file. user took an image using camera
outputFile = tempFileUri;
// Now we need to do the crop
}
startCropActivity(outputFile);
} else if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
uploadFile(Uri.parse(tempOutputFile.getPath()));
Timber.e(String.valueOf(Uri.fromFile(tempOutputFile)));
// avatarProgressFrame.setVisibility(View.VISIBLE);
// bus.post(new Account.ChangeAvatarRequest(Uri.fromFile(tempOutputFile)));
}
}
}
示例15: onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_OK) {
tempOutputFile.delete();
return;
}
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_SELECT_IMAGE) {
// user selected an image off their device. other condition they took the image and that image is in our tempoutput file
Uri outputFile;
Uri tempFileUri = Uri.fromFile(tempOutputFile);
// if statement will detect if the user selected an image from the device or took an image
if (data != null && (data.getAction() == null || !data.getAction()
.equals(MediaStore.ACTION_IMAGE_CAPTURE))) {
//then it means user selected an image off the device
// so we can get the Uri of that image using data.getData
outputFile = data.getData();
// Now we need to do the crop
} else {
// image was out temp file. user took an image using camera
outputFile = tempFileUri;
// Now we need to do the crop
}
startCropActivity(outputFile);
} else if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
uploadFile(Uri.parse(tempOutputFile.getPath()));
Timber.e(String.valueOf(Uri.fromFile(tempOutputFile)));
ivProfileImage.setImageResource(0);
ivProfileImage.setImageURI(Uri.fromFile(tempOutputFile));
// avatarProgressFrame.setVisibility(View.VISIBLE);
// bus.post(new Account.ChangeAvatarRequest(Uri.fromFile(tempOutputFile)));
}
}
}