/**
   * 普通上传文件
   *
   * @param uri
   */
  @Background
  void doUpload(Uri uri) {

    //        if (uploading) {
    //            System.out.println("上传中,请稍后");
    //            return;
    //        }

    uploading = true;
    String key = IO.UNDEFINED_KEY; // 自动生成key
    PutExtra extra = new PutExtra();
    extra.params = new HashMap<String, String>();
    extra.params.put("x:a", "测试中文信息");
    System.out.println("上传中");
    IO.putFile(
        this,
        uptoken,
        key,
        uri,
        extra,
        new JSONObjectRet() {
          @Override
          public void onProcess(long current, long total) {
            System.out.println(current + "/" + total);
          }

          @Override
          public void onSuccess(JSONObject resp) {
            // uploading = false;
            String hash = resp.optString("hash", "");
            String value = resp.optString("x:a", "");
            String redirect = "http://" + domain + "/" + hash;
            System.out.println("上传成功! " + hash);

            // Toasts notification
            Context context = getApplicationContext();
            CharSequence text = "上传成功!";
            int duration = Toast.LENGTH_SHORT;

            Toast toast = Toast.makeText(context, text, duration);
            toast.show();
          }

          @Override
          public void onFailure(Exception ex) {
            uploading = false;
            System.out.println("错误: " + ex.getMessage());
          }
        });
  }
  /**
   * 普通上传文件
   *
   * @param uri
   */
  private void doUpload(Uri uri) {

    System.out.println(uri.toString());
    if (uploading) {
      hint.setText("上传中,请稍后");
      return;
    }
    uploading = true;
    String key = IO.UNDEFINED_KEY; // 自动生成key
    PutExtra extra = new PutExtra();
    extra.params = new HashMap<String, String>();
    extra.params.put("x:a", "测试中文信息");
    hint.setText("上传中");
    IO.putFile(
        this,
        uptoken,
        key,
        uri,
        extra,
        new JSONObjectRet() {
          @Override
          public void onProcess(long current, long total) {
            hint.setText(current + "/" + total);
          }

          @Override
          public void onSuccess(JSONObject resp) {
            uploading = false;
            String hash = resp.optString("hash", "");
            String value = resp.optString("x:a", "");
            String redirect = "http://" + domain + "/" + hash;
            hint.setText("上传成功! " + hash);
            // Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(redirect));
            // startActivity(intent);
          }

          @Override
          public void onFailure(Exception ex) {
            uploading = false;
            hint.setText("错误: " + ex.getMessage());
          }
        });
  }