Search in sources :

Example 1 with UCropView

use of com.yalantis.ucrop.view.UCropView in project uCrop by Yalantis.

the class ResultActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_result);
    Uri uri = getIntent().getData();
    if (uri != null) {
        try {
            UCropView uCropView = findViewById(R.id.ucrop);
            uCropView.getCropImageView().setImageUri(uri, null);
            uCropView.getOverlayView().setShowCropFrame(false);
            uCropView.getOverlayView().setShowCropGrid(false);
            uCropView.getOverlayView().setDimmedColor(Color.TRANSPARENT);
        } catch (Exception e) {
            Log.e(TAG, "setImageUri", e);
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
        }
    }
    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(new File(getIntent().getData().getPath()).getAbsolutePath(), options);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(getString(R.string.format_crop_result_d_d, options.outWidth, options.outHeight));
    }
}
Also used : UCropView(com.yalantis.ucrop.view.UCropView) BitmapFactory(android.graphics.BitmapFactory) Uri(android.net.Uri) File(java.io.File) ActionBar(androidx.appcompat.app.ActionBar)

Aggregations

BitmapFactory (android.graphics.BitmapFactory)1 Uri (android.net.Uri)1 ActionBar (androidx.appcompat.app.ActionBar)1 UCropView (com.yalantis.ucrop.view.UCropView)1 File (java.io.File)1