Exemplo n.º 1
0
  private void onPickCamera() {
    boolean takePhoto = Utils.isIntentAvailable(context, MediaStore.ACTION_IMAGE_CAPTURE);
    if (!takePhoto) {
      UIUtils.alert(context, R.string.not_found_camera);
      return;
    }

    mPhotoPath = Utils.nextPath(context) + ".png";
    Uri imageUri = Uri.fromFile(new File(mPhotoPath));

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
    Intent openInChooser = Intent.createChooser(intent, getString(R.string.complete_action_using));
    startActivityForResult(openInChooser, PICK_CAMERA);
  }
Exemplo n.º 2
0
 private void onCamera(Intent intent) {
   if (mPhotoPath != null) {
     Uri imgUri = Uri.fromFile(new File(mPhotoPath));
     filePath = AndroidUtils.getPath(mActivity, imgUri);
     Utils.galleryAddPic(context, filePath);
     beginCrop(imgUri);
   } else {
     if (intent != null) {
       Uri imgUri = intent.getData();
       filePath = AndroidUtils.getPath(mActivity, imgUri);
       Utils.galleryAddPic(context, filePath);
       beginCrop(imgUri);
     } else {
       askRePickPhoto();
       return;
     }
   }
 }