コード例 #1
0
  @Override
  public void onClick(View v) {
    super.onClick(v);
    switch (v.getId()) {
        // 项目完成
      case R.id.btn_finish:
        DialogManager.showDialog(
            MyNeedDetailsActivity.this,
            null,
            "点击确定,将完成项目。托管的项目款将直接打入接单方钱包。",
            "确定",
            "",
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                // 拼接url
                StringBuffer sb = new StringBuffer();
                sb.append(Constants.getCurrUrl()).append(Constants.URL_NEED_ENDPRJ).append("?");
                String url = sb.toString();
                RequestParams rp = new RequestParams();
                rp.add("needid", needId);
                rp.add("userid", grabSingleBean.getUserid());
                rp.add("token", TopADApplication.getSelf().getToken());
                postWithLoading(
                    url,
                    rp,
                    false,
                    new HttpCallback() {
                      @Override
                      public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
                        mFinish.setVisibility(View.GONE);
                        mProjectTrust.setVisibility(View.GONE);
                        mTVPrompt2.setVisibility(View.GONE);
                        mTVPrompt.setVisibility(View.GONE);
                        mTVProgectState.setText("项目已完成");
                      }

                      @Override
                      public void onFailure(BaseBean base) {
                        int status = base.getStatus(); // 状态码
                        String msg = base.getMsg(); // 错误信息
                        //                        ToastUtil.show(mContext, "status = " + status +
                        // "\n"
                        //                                + "msg = " + msg);
                      }
                    },
                    BaseBean.class);
              }
            },
            null,
            true,
            null);

        break;

        // 项目款托管
      case R.id.btn_project_trust:
        AliPayUtil aliPayUtil = new AliPayUtil(MyNeedDetailsActivity.this);
        aliPayUtil.aliPay(
            MyNeedDetailsActivity.this,
            "项目款托管",
            TopADApplication.getSelf().getUserId() + "|3|" + grabSingleBean.getId(),
            grabSingleBean.getBudget());
        break;

        // 项目取消
      case R.id.btn_project_cancel:
        // 拼接url
        StringBuffer sbcancel = new StringBuffer();
        sbcancel.append(Constants.getCurrUrl()).append(Constants.URL_NEED_DELPROJECT).append("?");
        String urlcancel = sbcancel.toString();
        RequestParams rpcancel = new RequestParams();
        rpcancel.add("needid", needId);
        rpcancel.add("userid", grabSingleBean.getUserid());
        rpcancel.add("token", TopADApplication.getSelf().getToken());
        postWithLoading(
            urlcancel,
            rpcancel,
            false,
            new HttpCallback() {
              @Override
              public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
                finish();
              }

              @Override
              public void onFailure(BaseBean base) {
                int status = base.getStatus(); // 状态码
                String msg = base.getMsg(); // 错误信息
                ToastUtil.show(mContext, "status = " + status + "\n" + "msg = " + msg);
              }
            },
            BaseBean.class);
        break;

      default:
        break;
    }
  }
コード例 #2
0
  public void showView() {
    // 设置title
    mTitleView.setLeftClickListener(new TitleLeftOnClickListener());
    // 名字
    if (!Utils.isEmpty(grabSingleBean.getTitle())) {
      mTitleView.setTitle(grabSingleBean.getTitle());
    }
    // 名字
    if (!Utils.isEmpty(grabSingleBean.getCompanyname())) {
      mName.setText(grabSingleBean.getCompanyname());
    }

    // 价格
    if (!Utils.isEmpty(grabSingleBean.getBudget())) {
      SpannableStringBuilder ssb = new SpannableStringBuilder("¥" + grabSingleBean.getBudget());
      mMoney.setText(ssb.toString());
    }

    // 介绍
    if (!Utils.isEmpty(grabSingleBean.getDetail())) {
      mContent.setText(grabSingleBean.getDetail());
    }

    // 地址
    if (!Utils.isEmpty(grabSingleBean.getAddress())) {
      mAddress.setText(grabSingleBean.getAddress());
    }

    // 0 - 未开始 1-项目进行中,2-项目完成
    if ("0".equals(state)) { //  未开始
      mLYProductFinish.setVisibility(View.GONE);
      mFinish.setVisibility(View.GONE);
      mTVPrompt.setVisibility(View.GONE);
      //            mLYTrust.setVisibility(View.VISIBLE);
      mTVPrompt2.setVisibility(View.VISIBLE);
      mProjectCancel.setVisibility(View.VISIBLE);
      mListview.setVisibility(View.VISIBLE);

      // 托管
      if (!Utils.isEmpty(grabSingleBean.getIspay())) {
        if ("0".equals(grabSingleBean.getIspay())) {
          mProjectTrust.setVisibility(View.VISIBLE);
          mTVPrompt2.setVisibility(View.VISIBLE);
          mTVState.setVisibility(View.GONE);
        } else {
          mProjectTrust.setVisibility(View.GONE);
          mTVPrompt2.setVisibility(View.GONE);
          mTVState.setVisibility(View.VISIBLE);
        }
      }

      getData();
    } else if ("1".equals(state)) { // 项目进行中
      mLYProductFinish.setVisibility(View.VISIBLE);
      mFinish.setVisibility(View.VISIBLE);
      mTVPrompt.setVisibility(View.VISIBLE);
      //            mLYTrust.setVisibility(View.GONE);
      mTVPrompt2.setVisibility(View.GONE);
      mProjectCancel.setVisibility(View.GONE);
      mListview.setVisibility(View.GONE);

      // 托管
      if (!Utils.isEmpty(grabSingleBean.getIspay())) {
        if ("0".equals(grabSingleBean.getIspay())) {
          mProjectTrust.setVisibility(View.VISIBLE);
          mTVPrompt2.setVisibility(View.VISIBLE);
          mTVState.setVisibility(View.GONE);
        } else {
          mProjectTrust.setVisibility(View.GONE);
          mTVPrompt2.setVisibility(View.GONE);
          mTVState.setVisibility(View.VISIBLE);
        }
      }

      // 类别
      if (!Utils.isEmpty(grabSingleBean.getType1()) && !Utils.isEmpty(grabSingleBean.getType2())) {
        SpannableStringBuilder ssb =
            new SpannableStringBuilder(grabSingleBean.getType1() + "-" + grabSingleBean.getType2());
        mTVTime.setText(ssb.toString());
      }
      // 时间
      if (!Utils.isEmpty(grabSingleBean.getEnddate())) {
        String[] sourceStrArray = grabSingleBean.getEnddate().split(" ");
        mTVType.setText(sourceStrArray[0]);
        mTVType.setCompoundDrawablesWithIntrinsicBounds(
            getResources().getDrawable(R.drawable.pic_time), null, null, null);
      }
      getInfoData(grabSingleBean.getUserid2());
    } else if ("2".equals(state)) { // 项目完成
      mLYProductFinish.setVisibility(View.VISIBLE);
      mFinish.setVisibility(View.GONE);
      mTVPrompt.setVisibility(View.GONE);
      //            mLYTrust.setVisibility(View.GONE);
      mProjectCancel.setVisibility(View.GONE);
      mListview.setVisibility(View.GONE);
      mProjectTrust.setVisibility(View.GONE);
      mTVPrompt2.setVisibility(View.GONE);
      // 托管
      if (!Utils.isEmpty(grabSingleBean.getIspay())) {
        if ("0".equals(grabSingleBean.getIspay())) {
          mTVState.setVisibility(View.GONE);
        } else {
          mTVState.setVisibility(View.VISIBLE);
        }
      }

      // 类别
      if (!Utils.isEmpty(grabSingleBean.getType1()) && !Utils.isEmpty(grabSingleBean.getType2())) {
        SpannableStringBuilder ssb =
            new SpannableStringBuilder(
                "类型:" + grabSingleBean.getType1() + "-" + grabSingleBean.getType2());
        mTVTime.setText(ssb.toString());
      }
      // 时间
      if (!Utils.isEmpty(grabSingleBean.getEnddate())) {
        String[] sourceStrArray = grabSingleBean.getEnddate().split(" ");
        mTVType.setText(sourceStrArray[0]);
        mTVType.setCompoundDrawablesWithIntrinsicBounds(
            getResources().getDrawable(R.drawable.pic_time), null, null, null);
      }
      getInfoData(grabSingleBean.getUserid2());
    }
  }