@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (resultCode == RESULT_OK && requestCode == ACTION_REQUEST_NEW_PRINTER) {

      //            /** CLEAR THE ARRAYLIST AND REFRESH THE LIST OF PRINTERS **/
      //            arrPrinters.clear();
      //            new fetchPrintersList().execute();

    } else if (resultCode == RESULT_OK) {
      EasyImage.handleActivityResult(
          requestCode,
          resultCode,
          data,
          OldCategoryCreator.this,
          new DefaultCallback() {

            @Override
            public void onImagePicked(File imageFile, EasyImage.ImageSource source) {
              super.onImagePicked(imageFile, source);
              onPhotoReturned(imageFile);
            }

            @Override
            public void onImagePickerError(Exception e, EasyImage.ImageSource source) {
              super.onImagePickerError(e, source);
            }

            @Override
            public void onCanceled(EasyImage.ImageSource source) {
              super.onCanceled(source);
            }
          });
    }
  }
Esempio n. 2
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    EasyImage.handleActivityResult(
        requestCode,
        resultCode,
        data,
        this,
        new EasyImage.Callbacks() {
          @Override
          public void onImagePickerError(Exception e, EasyImage.ImageSource imageSource, int i) {
            showToast("出错啦,请重新试试");
          }

          @Override
          public void onImagePicked(File file, EasyImage.ImageSource imageSource, int i) {
            UCrop.of(Uri.fromFile(file), Uri.fromFile(file))
                .withMaxResultSize(800, 800)
                .start(AddSouvenirActivity.this);
          }

          @Override
          public void onCanceled(EasyImage.ImageSource imageSource, int i) {
            if (imageSource == EasyImage.ImageSource.CAMERA) {
              File photoFile = EasyImage.lastlyTakenButCanceledPhoto(AddSouvenirActivity.this);
              if (photoFile != null) {
                photoFile.delete();
              }
            }
          }
        });
    if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
      try {
        imgfile = new File(new URI(UCrop.getOutput(data).toString()));
      } catch (URISyntaxException e) {
        e.printStackTrace();
      }
      Glide.with(this).load(imgfile).into(ivAlbum);
    } else if (resultCode == UCrop.RESULT_ERROR) {
      showToast("出错啦,请稍后再试");
      Throwable throwable = UCrop.getError(data);
      if (throwable != null) {
        Logger.e(throwable.getMessage());
      }
    }
  }
Esempio n. 3
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK && requestCode == ACTION_REQUEST_NEW_CATEGORY) {

      /** CLEAR THE ARRAYLIST AND REFRESH THE SPINNER CATEGORIES DATA * */
      arrCategory.clear();
      new fetchMenuCategories().execute();

    } else if (resultCode == RESULT_OK) {
      EasyImage.handleActivityResult(
          requestCode,
          resultCode,
          data,
          this,
          new DefaultCallback() {

            @Override
            public void onImagePicked(File imageFile, EasyImage.ImageSource source) {
              super.onImagePicked(imageFile, source);
              onPhotoReturned(imageFile);
              //                Log.e("DATA", String.valueOf(data));

              if (source == EasyImage.ImageSource.CAMERA) {
                imgSource = 1;
              } else {
                imgSource = 2;
              }
            }

            @Override
            public void onImagePickerError(Exception e, EasyImage.ImageSource source) {
              super.onImagePickerError(e, source);
            }

            @Override
            public void onCanceled(EasyImage.ImageSource source) {
              super.onCanceled(source);
            }
          });
    }
  }