本文整理汇总了Java中com.yalantis.ucrop.UCrop.RESULT_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java UCrop.RESULT_ERROR属性的具体用法?Java UCrop.RESULT_ERROR怎么用?Java UCrop.RESULT_ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.yalantis.ucrop.UCrop
的用法示例。
在下文中一共展示了UCrop.RESULT_ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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);
}
}
示例9: 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;
}
}
示例10: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {
List<Uri> mUris = Matisse.obtainResult(data);
mStrings = Matisse.obtainPathResult(data);
// try {
// ExifInterface mExifInterface = new ExifInterface(mStrings.get(0));
// Log.e(TAG, "onActivityResult: " + mExifInterface.getAttribute(ExifInterface.TAG_GPS_ALTITUDE));
// } catch (IOException e) {
// e.printStackTrace();
// }
mMyAdapter.setData(mStrings);
Tools.getPhotoInfo(mStrings.get(0));
// Uri destinationUri = Uri.fromFile(new File(getCacheDir(), "test.jpg"));
// UCrop.of(mUris.get(0), destinationUri)
// .withAspectRatio(16, 9)
// .withMaxResultSize(maxWidth, maxHeight)
// .start(this);
}
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
final Uri resultUri = UCrop.getOutput(data);
Intent mIntent = new Intent(MatisseDemoActivity.this, PhotoProcessActivity.class);
mIntent.putExtra("url", resultUri);
startActivity(mIntent);
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(data);
}
}
示例11: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == UCrop.RESULT_ERROR) {
mCameraTv.setText(UCrop.getError(data) + "");
return;
}
if (resultCode == RESULT_OK) {
switch (requestCode) {
case RESULT_CODE_1:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
cropRawPhoto(mProviderUri);
} else {
cropRawPhoto(mUri);
}
break;
case RESULT_CODE_2:
LogUtils.i("onActivityResult: " + data.getData());
cropRawPhoto(data.getData());
break;
case UCrop.REQUEST_CROP:
LogUtils.i("onActivityResult: " + UCrop.getOutput(data));
mCameraTv.setText(UCrop.getOutput(data) + "");
Glide.with(this)
.load(UCrop.getOutput(data))
.crossFade()
.into(mCameraImg);
break;
default:
break;
}
}
}
示例12: onActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
final Uri resultUri = UCrop.getOutput(data);
data.putExtra(HGallery.EXTRA_PATH, resultUri.getPath());
setResult(RESULT_OK, data);
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(data);
Toast.makeText(GridImageActivity.this, cropError.getMessage(), Toast.LENGTH_SHORT).show();
}
finish();
}
示例13: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
chosenImageUri = UCrop.getOutput(data);
simpleDraweeView.setImageURI(chosenImageUri);
chosenImageUuid = new File(chosenImageUri.toString()).getName();
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(data);
Log.e("ImagePickerActivity", cropError.getMessage());
Toast.makeText(getApplicationContext(), "Error cropping image", Toast.LENGTH_SHORT).show();
}
else if (requestCode == 200 && resultCode == Activity.RESULT_OK) {
Uri imageUri = ImagePickerHelper.getPickImageResultUri(data, getApplicationContext());
// For API >= 23 we need to check specifically that we have permissions to read external storage,
// but we don't know if we need to for the URI so the simplest is to try open the stream and see if we get error.
boolean requirePermissions = false;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED &&
ImagePickerHelper.isUriRequiresPermissions(imageUri, getApplicationContext())) {
// request permissions and handle the result in onRequestPermissionsResult()
requirePermissions = true;
mCropImageUri = imageUri;
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
}
if (!requirePermissions) {
startUCrop(imageUri);
}
}
}
示例14: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case CAMERA:
if (resultCode == RESULT_OK) {
openCrop(imageUri, imageCroppedUri);
} else {
Toast.makeText(this, "未拍摄图片", Toast.LENGTH_SHORT).show();
}
break;
case GALLARY:
if (resultCode == RESULT_OK) {
String filePath = null;
if (Build.VERSION.SDK_INT >= 19) {
filePath = handleImageOnKitKat(data);
} else {
filePath = handleImageBeforeKitKat(data);
}
//获取打开文件的URI
if (Build.VERSION.SDK_INT >= 24) {
imageUri = FileProvider.getUriForFile(ModifyInfoActivity.this,
"com.jshaz.daigo.fileprovider", new File(filePath));
imageCroppedUri = FileProvider.getUriForFile(ModifyInfoActivity.this,
"com.jshaz.daigo.fileprovider", croppedImage);
} else {
imageUri = Uri.fromFile(new File(filePath));
imageCroppedUri = Uri.fromFile(croppedImage);
}
openCrop(imageUri, imageCroppedUri);
} else {
Toast.makeText(this, "未选择图片", Toast.LENGTH_SHORT).show();
}
break;
case UCrop.REQUEST_CROP:
if (data != null) {
final Uri resultUri = UCrop.getOutput(data);
finalHeadBitmap = Utility.compressBitmap(
BitmapFactory.decodeFile(croppedImage.getAbsolutePath()));
CBModifyHead.setImageBitmap(finalHeadBitmap);
} else {
Toast.makeText(this, "裁剪图片失败", Toast.LENGTH_SHORT).show();
}
break;
case UCrop.RESULT_ERROR:
Toast.makeText(this, "裁剪图片失败", Toast.LENGTH_SHORT).show();
break;
case RESET_PASSWORD:
if (resultCode == RESULT_OK) {
user.setPassword((String) data.getStringExtra("data"));
user.writeToLocalDatabase();
}
break;
case RESET_PHONE:
if (resultCode == RESULT_OK) {
user.setPhoneNum((String) data.getStringExtra("data"));
user.writeToLocalDatabase();
runOnUiThread(new Runnable() {
@Override
public void run() {
fillUserInfo();
}
});
}
break;
case VERIFICATION:
break;
default:
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
示例15: onActivityResult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case CAMERA:
if (resultCode == RESULT_OK) {
openCrop(imageUri, imageCroppedUri);
} else {
Toast.makeText(this, "未拍摄图片", Toast.LENGTH_SHORT).show();
}
break;
case GALLARY:
if (resultCode == RESULT_OK) {
String filePath = null;
if (Build.VERSION.SDK_INT >= 19) {
filePath = handleImageOnKitKat(data);
} else {
filePath = handleImageBeforeKitKat(data);
}
//获取打开文件的URI
if (Build.VERSION.SDK_INT >= 24) {
imageUri = FileProvider.getUriForFile(VerificationActivity.this,
"com.jshaz.daigo.fileprovider", new File(filePath));
imageCroppedUri = FileProvider.getUriForFile(VerificationActivity.this,
"com.jshaz.daigo.fileprovider", croppedImage);
} else {
imageUri = Uri.fromFile(new File(filePath));
imageCroppedUri = Uri.fromFile(croppedImage);
}
openCrop(imageUri, imageCroppedUri);
} else {
Toast.makeText(this, "未选择图片", Toast.LENGTH_SHORT).show();
}
break;
case UCrop.REQUEST_CROP:
final Uri resultUri = UCrop.getOutput(data);
BMPs[selectImage] = BitmapFactory.decodeFile(croppedImage.getAbsolutePath());
IVs[selectImage].setImageBitmap(BMPs[selectImage]);
break;
case UCrop.RESULT_ERROR:
Toast.makeText(this, "裁剪图片失败", Toast.LENGTH_SHORT).show();
break;
default:
break;
}
super.onActivityResult(requestCode, resultCode, data);
}