Esempio n. 1
0
 public void menuClick(int which) {
   switch (which) {
     case 1:
       if (Util.existSDcard()) {
         Intent intent = new Intent(); // 调用照相机
         String messagepath = StaticFactory.APKCardPath;
         File fa = new File(messagepath);
         if (!fa.exists()) {
           fa.mkdirs();
         }
         fragment.cameraPath = messagepath + new Date().getTime(); // 图片路径
         intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(fragment.cameraPath)));
         intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
         startActivityForResult(intent, AddPicFragment.Camera);
       } else {
         Toast.makeText(getApplicationContext(), "亲,请检查是否安装存储卡!", Toast.LENGTH_SHORT).show();
       }
       break;
     case 0:
       if (Util.existSDcard()) {
         String messagepath = StaticFactory.APKCardPath;
         File fa = new File(messagepath);
         if (!fa.exists()) {
           fa.mkdirs();
         }
         PhotoAlbumMainActivity_.intent(this)
             .maxnum(6)
             .paths(fragment.getSdibs())
             .startForResult(AddPicFragment.Album);
       } else {
         Toast.makeText(getApplicationContext(), "亲,请检查是否安装存储卡!", Toast.LENGTH_SHORT).show();
       }
       break;
   }
 }
Esempio n. 2
0
 public void onSuccess(JSONObject jo) {
   customDismissDialog();
   try {
     int status = jo.getInt(URL.STATUS);
     switch (status) {
       case 0:
         if (fragment.getCount() > 0) {
           dyid = jo.getJSONObject(URL.RESPONSE).getString("dyid");
           uploadImg(0);
         } else {
           showCustomToast("发表成功");
           setResult(RESULT_OK);
           isOk = false;
           finish();
         }
         break;
       default:
         showFailInfo(jo);
         isOk = true;
         break;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 };
Esempio n. 3
0
  public void uploadImg(int i) {
    LogUtil.d("================图片上传次数", i + "");
    if (i == fragment.getCount()) {
      return;
    }

    LoginUser user = getHelper().getUser();
    try {
      RequestParams ap = getAjaxParams();
      ap.put("file", new File(fragment.getItem(i)));
      ap.put("userid", user.getId());
      ap.put("dyid", dyid);
      ap.put("position", i + "");
      ac.finalHttp.post(URL.PUBLISH_IMG, ap, new callBack(i));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  }
Esempio n. 4
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   for (String str : fragment.getIbs()) {
     File file = new File(str);
     if (file.exists()) {
       file.delete();
     }
   }
   location.destory();
 }
Esempio n. 5
0
  @OptionsItem(R.id.ok)
  public void ok() {
    if (!isOk) {
      return;
    }

    //        String content = Util.FilterEmoji(edittxt.getText().toString().trim());
    String content = edittxt.getText().toString().trim();
    // content=EmojiFilter.filterEmoji(content);
    if (!Util.isStrNotNull(content) && fragment.getCount() == 0) {
      showCustomToast("请输入内容或添加图片");
      return;
    }
    isOk = false;
    customShowDialog("正在定位");
    location.startLocation();
  }
Esempio n. 6
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   fragment.onActivityResult(requestCode, resultCode, data);
   super.onActivityResult(requestCode, resultCode, data);
 }
Esempio n. 7
0
 public void menuDeleteClick() {
   fragment.removeByView(tempImageView);
 }