private boolean validInput() {
    // validate input
    if (isNullOrOverLength(mEtText)) {
      ToastUtils.show(PublishActivity.this, "请输入120字以内的独白");
      mEtText.requestFocus();
      return false;
    }
    if (mLat == 0 && mLng == 0) {
      ToastUtils.show(PublishActivity.this, "请定位");
      return false;
    }

    if (TextUtils.isEmpty(mSelectPath)) {
      ToastUtils.show(PublishActivity.this, "请选择图片");
      return false;
    }
    return true;
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int id = item.getItemId();
   if (id == R.id.action_publish) {
     if (!bIsUploading) {
       if (validInput()) {
         ToastUtils.show(PublishActivity.this, "开始上传");
         // 上传图片,然后发布消息
         handler.sendEmptyMessage(HANDLER_PUBLISH);
         item.setEnabled(false);
       }
     } else {
       ToastUtils.show(PublishActivity.this, "上传中");
     }
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
    @Override
    public void handleMessage(Message msg) {
      super.handleMessage(msg);
      switch (msg.what) {
        case HANDLER_IMAGE_UPLOAD_FAILED:
          ToastUtils.show(mAct.get(), "图片上传失败,请重试");
          mAct.get().bIsUploading = false;
          break;
        case HANDLER_IMAGE_UPLOAD_SUCCESS:
          mAct.get().post();
          break;
        case HANDLER_GET_THUMB_SUCCESS:
          Uri imageUri = Uri.fromFile(mThumbFile);
          mAct.get().mIvImg.setImageURI(imageUri);
          break;
        case HANDLER_GET_THUMB_FAILED:
          ToastUtils.show(mAct.get(), "图片选择失败,请重试");
          mAct.get().bIsUploading = false;
          break;
        case HANDLER_PUBLISH_FAILED:
          ToastUtils.show(mAct.get(), "网络错误请重试");
          mAct.get().bIsUploading = false;
          break;
        case HANDLER_PUBLISH_SUCCESS:
          ToastUtils.show(mAct.get(), "发布成功");
          mAct.get().bIsUploading = false;

          // 计数
          UserBean owner = PrefService.getInstance(getApplicationContext()).getUser();
          owner.setStatue_count(owner.getStatue_count() + 1);
          PrefService.getInstance(getApplicationContext()).setUser(owner);
          mAct.get().setResult(MainActivity.RESULT_OK);

          finish();
          break;
        case HANDLER_PUBLISH:
          mAct.get().bIsUploading = true;
          mAct.get().getUploadToken(); // new Thread(new uploadImgTask()).start();
          break;
      }
    }