当前位置: 首页>>代码示例>>Java>>正文


Java UCrop.getError方法代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:BoxingUcrop.java

示例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;
        }
    }
 
开发者ID:Loofer,项目名称:Watermark,代码行数:37,代码来源:SimpleRxGalleryFinal.java

示例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");
    }
}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:9,代码来源:UpdateUserInfoActivity.java

示例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");
    }
}
 
开发者ID:monsterLin,项目名称:Pigeon,代码行数:9,代码来源:EditFamilyActivity.java

示例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");
    }
}
 
开发者ID:hkq325800,项目名称:YellowNote,代码行数:10,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:drakeet,项目名称:Lunei,代码行数:12,代码来源:TakePictureHelper.java

示例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);
        }
    }
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:36,代码来源:MatisseDemoActivity.java

示例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();
}
 
开发者ID:hanks-zyh,项目名称:note,代码行数:13,代码来源:GridImageActivity.java

示例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);
        }
    }
}
 
开发者ID:joeydeluca,项目名称:apparel,代码行数:33,代码来源:ImagePickerActivity.java

示例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);
    }
}
 
开发者ID:tengbinlive,项目名称:aibao_demo,代码行数:10,代码来源:UserFragment.java

示例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);

    }
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:40,代码来源:EditDeliveryFragment.java

示例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);

    }


}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:35,代码来源:AddItemCategory.java

示例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);

    }

}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:37,代码来源:EditItemCategory.java

示例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);

    }
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:40,代码来源:EditItemImageFragment.java

示例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);
            }

        }





    }
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-Distributor-Android-app,代码行数:73,代码来源:EditItemFragmentNew.java


注:本文中的com.yalantis.ucrop.UCrop.getError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。