PhotoCroper介绍使用

PhotoCroper

A helper to use system gallery or camera take Photo
used code
fix some problem

    • can not save crop pitcure
    • can not picker some photo from gallery
    • some api review

      # How to use
    • new helper and set CropParam
    CropHelper cropHelper = new CropHelper(this);
    cropHelper.setCropParams(new CropParams());
    
    1. insert handle
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    cropHelper.handleResult(requestCode,resultCode,data);
    }
    1. handle result
     cropHelper.setCropListener(new CropListener() {
            @Override
    public void onPhotoCropped(Uri uri) {
    Log.d(TAG, "Crop Uri in path: " + uri.getPath());
    Toast.makeText(TestActivity.this, "Photo cropped!", Toast.LENGTH_LONG).show();
    mImageView.setImageBitmap(cropHelper.getCropBitmap());
    }

    @Override
    public void onCropCancel() {
    Toast.makeText(TestActivity.this,"cancel",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onCropFailed(String message) {
    Toast.makeText(TestActivity.this,message+"",Toast.LENGTH_SHORT).show();
    }
    });

    Thanks for

  1. Android大图片裁剪终极解决方案(上:原理分析)

  2. Code