本文整理汇总了Java中com.yalantis.ucrop.UCrop.getError方法的典型用法代码示例。如果您正苦于以下问题:Java UCrop.getError方法的具体用法?Java UCrop.getError怎么用?Java UCrop.getError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.yalantis.ucrop.UCrop
的用法示例。
在下文中一共展示了UCrop.getError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCropFinish
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public Uri onCropFinish(int resultCode, Intent data) {
if (data == null) {
return null;
}
Throwable throwable = UCrop.getError(data);
if (throwable != null) {
return null;
}
return UCrop.getOutput(data);
}
示例2: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
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;
}
}
示例3: handleCropError
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void handleCropError(@NonNull Intent result) {
final Throwable cropError = UCrop.getError(result);
if (cropError != null) {
ToastUtils.showToast(UpdateUserInfoActivity.this,cropError.getMessage());
} else {
ToastUtils.showToast(UpdateUserInfoActivity.this,"handleCropError");
}
}
示例4: handleCropError
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void handleCropError(@NonNull Intent result) {
final Throwable cropError = UCrop.getError(result);
if (cropError != null) {
ToastUtils.showToast(EditFamilyActivity.this, cropError.getMessage());
} else {
ToastUtils.showToast(EditFamilyActivity.this, "handleCropError");
}
}
示例5: handleCropError
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
private void handleCropError(@NonNull Intent result) {
final Throwable cropError = UCrop.getError(result);
if (cropError != null) {
Trace.e(TAG, "handleCropError: ", cropError);
Trace.show(MainActivity.this, cropError.getMessage(), false);
} else {
Trace.show(MainActivity.this, "UnExpected Error");
}
}
示例6: handleCropError
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private void handleCropError(@NonNull Intent result) {
final Throwable cropError = UCrop.getError(result);
if (cropError != null) {
Toast.makeText(mActivity, cropError.getMessage(), Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(mActivity, R.string.toast_unexpected_error,
Toast.LENGTH_SHORT).show();
}
}
示例7: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@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);
}
}
示例8: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@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();
}
示例9: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@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);
}
}
}
示例10: handleCropError
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private void handleCropError(@NonNull Intent result) {
final Throwable cropError = UCrop.getError(result);
if (cropError != null) {
CommonUtil.showToast(cropError.getMessage());
} else {
CommonUtil.showToast(R.string.toast_unexpected_error);
}
}
示例11: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent result) {
super.onActivityResult(requestCode, resultCode, result);
if (requestCode == ImageCropUtility.PICK_IMAGE_REQUEST && resultCode == RESULT_OK
&& result != null
&& result.getData() != null) {
Uri filePath = result.getData();
//imageUri = filePath;
if (filePath != null) {
startCropActivity(result.getData(),getContext());
}
}
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
resultView.setImageURI(null);
resultView.setImageURI(UCrop.getOutput(result));
isImageChanged = true;
isImageRemoved = false;
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(result);
}
}
示例12: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent result) {
super.onActivityResult(requestCode, resultCode, result);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK
&& result != null
&& result.getData() != null) {
Uri filePath = result.getData();
if (filePath != null) {
ImageCropUtility.startCropActivity(result.getData(),this);
}
}
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
resultView.setImageURI(UCrop.getOutput(result));
isImageAdded = true;
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(result);
}
}
示例13: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent result) {
super.onActivityResult(requestCode, resultCode, result);
if (requestCode == ImageCropUtility.PICK_IMAGE_REQUEST && resultCode == RESULT_OK
&& result != null
&& result.getData() != null) {
Uri filePath = result.getData();
//imageUri = filePath;
if (filePath != null) {
ImageCropUtility.startCropActivity(result.getData(),this);
}
}
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
resultView.setImageURI(UCrop.getOutput(result));
isImageChanged = true;
isImageRemoved = false;
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(result);
}
}
示例14: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent result) {
super.onActivityResult(requestCode, resultCode, result);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK
&& result != null
&& result.getData() != null) {
Uri filePath = result.getData();
//imageUri = filePath;
if (filePath != null) {
startCropActivity(result.getData(),getContext());
}
}
if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
resultView.setImageURI(null);
resultView.setImageURI(UCrop.getOutput(result));
isImageChanged = true;
isImageRemoved = false;
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(result);
}
}
示例15: onActivityResult
import com.yalantis.ucrop.UCrop; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent result) {
super.onActivityResult(requestCode, resultCode, result);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK
&& result != null
&& result.getData() != null) {
Uri filePath = result.getData();
//imageUri = filePath;
if (filePath != null) {
startCropActivity(result.getData(),getContext());
}
}
else if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP)
{
resultView.setImageURI(null);
resultView.setImageURI(UCrop.getOutput(result));
isImageChanged = true;
isImageRemoved = false;
} else if (resultCode == UCrop.RESULT_ERROR) {
final Throwable cropError = UCrop.getError(result);
}
else
{
IntentResult resultLocal = IntentIntegrator.parseActivityResult(requestCode, resultCode, result);
if(result != null) {
if(resultLocal.getContents() == null) {
Toast.makeText(getActivity(), "Cancelled", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity(), "Scanned: " + resultLocal.getContents(), Toast.LENGTH_LONG).show();
String resultsText = "Barcode : " + resultLocal.getContents();
resultsText = resultsText + "\nFormat : " + resultLocal.getFormatName();
// barcodeResults.setText(resultLocal.getContents());
// barcodeResults.setText(resultLocal.getFormatName());
item.setBarcode(resultLocal.getContents());
item.setBarcodeFormat(resultLocal.getFormatName());
barcode = resultLocal.getContents();
barcodeFormat = resultLocal.getFormatName();
barcodeResults.setText(resultsText);
}
} else {
super.onActivityResult(requestCode, resultCode, result);
}
}
}