Esempio n. 1
0
  private void startCrop() {
    if (isFinishing()) {
      return;
    }
    imageView.setImageRotateBitmapResetBase(rotateBitmap, true);
    CropUtil.startBackgroundJob(
        this,
        null,
        getResources().getString(R.string.crop__wait),
        new Runnable() {

          public void run() {
            final CountDownLatch latch = new CountDownLatch(1);
            handler.post(
                new Runnable() {

                  public void run() {
                    if (imageView.getScale() == 1F) {
                      imageView.center(true, true);
                    }
                    latch.countDown();
                  }
                });
            try {
              latch.await();
            } catch (InterruptedException e) {
              throw new RuntimeException(e);
            }
            new Cropper().crop();
          }
        },
        handler);
  }
 private void saveImage(Bitmap croppedImage) {
   if (croppedImage != null) {
     final Bitmap b = croppedImage;
     CropUtil.startBackgroundJob(
         this,
         null,
         getResources().getString(R.string.crop__saving),
         new Runnable() {
           public void run() {
             saveOutput(b);
           }
         },
         handler);
   } else {
     finish();
   }
 }