Пример #1
0
  @Override
  public void onSaveComplete(File file) {
    Toast.makeText(this, "Image Saved", Toast.LENGTH_SHORT).show();

    Util.scanMedia(this, file);

    if (mShare) {
      mShare = false;
      Util.shareImage(this, file);
    }

    if (mSaveProgressDialog != null) {
      mSaveProgressDialog.dismiss();
    }
  }
Пример #2
0
  private void showSaveDialog() {

    File pathFile =
        new File(
            Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)
                + File.separator
                + "Pixelator");
    if (!pathFile.exists()) {
      pathFile.mkdirs();
    }
    File dir = null;
    try {
      String path = Util.getRealPathFromURI(this, mUri);
      if (!TextUtils.isEmpty(path)) {
        File output = new File(path);
        String name = output.getName();
        if (!TextUtils.isEmpty(name)) {
          dir = new File(pathFile, name);
        }
      }
    } catch (NullPointerException e) {
    }

    if (dir == null) {
      SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
      dir = new File(pathFile, "img_" + format.format(new Date()) + ".jpg");
    }
    SaveAsDialogFragment saveAsDialogFragment = SaveAsDialogFragment.newInstance(dir);
    saveAsDialogFragment.show(getSupportFragmentManager(), "save");
  }