Esempio n. 1
0
  /** 获取抢单列表数据 */
  public void getData() {
    // 拼接url
    StringBuffer sb = new StringBuffer();
    sb.append(Constants.getCurrUrl()).append(Constants.URL_GET_REQUEST_LIST).append("?");
    String url = sb.toString();
    RequestParams rp = new RequestParams();
    rp.add("needid", needId);
    postWithLoading(
        url,
        rp,
        false,
        new HttpCallback() {
          @Override
          public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
            MyNeedListBean bean = (MyNeedListBean) t;
            if (bean != null && bean.data.size() != 0) {
              for (int i = 0; i < bean.data.size(); i++) {
                bankList.add(bean.data.get(i));
              }
              mListview.setAdapter(new ListAdapter());
            }

            String str = bean.data.size() + "人抢单";
            SpannableStringBuilder spanStrContent = new SpannableStringBuilder(str);
            ForegroundColorSpan span_1 = new ForegroundColorSpan(Color.argb(255, 255, 0, 0));
            spanStrContent.setSpan(span_1, 0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
            mTVType.setText(spanStrContent.toString());

            // 时间
            if (!Utils.isEmpty(grabSingleBean.getEnddate())) {
              String[] sourceStrArray = grabSingleBean.getEnddate().split(" ");
              mTVTime.setText(sourceStrArray[0]);
              mTVTime.setCompoundDrawablesWithIntrinsicBounds(
                  getResources().getDrawable(R.drawable.pic_time), null, null, null);
            }
          }

          @Override
          public void onFailure(BaseBean base) {
            int status = base.getStatus(); // 状态码
            String msg = base.getMsg(); // 错误信息
            ToastUtil.show(mContext, "status = " + status + "\n" + "msg = " + msg);
          }
        },
        MyNeedListBean.class);
  }
Esempio n. 2
0
  /** 获取个人数据 */
  public void getInfoData(String userid) {
    // 拼接url
    StringBuffer sb = new StringBuffer();
    sb.append(Constants.getCurrUrl()).append(Constants.GETINFO).append("?");
    String url = sb.toString();
    RequestParams rp = new RequestParams();
    rp.add("userid", userid);
    postWithLoading(
        url,
        rp,
        false,
        new HttpCallback() {
          @Override
          public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
            final MyInfoBean base = (MyInfoBean) t;
            if (base != null) {

              // 公司头像
              if (!Utils.isEmpty(base.getData().getImghead())) {
                String picUrl =
                    Constants.getCurrUrl()
                        + Constants.CASE_IMAGE_URL_HEADER
                        + base.getData().getImghead();
                ImageLoader.getInstance()
                    .displayImage(
                        picUrl,
                        mTVGSIcon,
                        TopADApplication.getSelf().getImageLoaderOption(),
                        new ImageLoadingListener() {
                          @Override
                          public void onLoadingStarted(String s, View view) {}

                          @Override
                          public void onLoadingFailed(String s, View view, FailReason failReason) {}

                          @Override
                          public void onLoadingComplete(String s, View view, Bitmap bitmap) {}

                          @Override
                          public void onLoadingCancelled(String s, View view) {}
                        });
              }

              // 公司名
              if (!Utils.isEmpty(base.getData().getCompanyname())) {
                mTVGSName.setText(base.getData().getCompanyname());
              }

              // 0 - 未开始 1-项目进行中,2-项目完成
              if ("2".equals(state)) {
                mTVProgectState.setText("项目已完成");
              } else if ("1".equals(state)) {
                mTVProgectState.setText("项目进行中...");
              }

              // 时间
              if (!Utils.isEmpty(base.getData().getAdddate())) {
                String[] sourceStrArray = base.getData().getAdddate().split(" ");
                mTVProgectTime.setText(sourceStrArray[0]);
              }

              mTVGSIcon.setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                      MyNeedBean myNeedBean = new MyNeedBean();
                      myNeedBean.setAdddate(base.getData().getAdddate());
                      myNeedBean.setAddress(base.getData().getAddress());
                      myNeedBean.setBirthday(base.getData().getBirthday());
                      myNeedBean.setCompanyname(base.getData().getCompanyname());
                      myNeedBean.setId(base.getData().getId());
                      myNeedBean.setImgcard1(base.getData().getImgcard1());
                      myNeedBean.setImgcard2(base.getData().getImgcard2());
                      myNeedBean.setImgdiploma(base.getData().getImgdiploma());
                      myNeedBean.setImghead(base.getData().getImghead());
                      myNeedBean.setImglicense(base.getData().getImglicense());
                      myNeedBean.setImgnamecard(base.getData().getImgnamecard());
                      myNeedBean.setImghead(base.getData().getImghead());
                      myNeedBean.setIntro(base.getData().getIntro());
                      myNeedBean.setJob1(base.getData().getJob1());
                      myNeedBean.setJob2(base.getData().getJob2());
                      myNeedBean.setNeedid(needId);
                      myNeedBean.setNickname(base.getData().getNickname());
                      myNeedBean.setSex(base.getData().getSex());
                      myNeedBean.setUserid(base.getData().getUserid());

                      Intent intent = new Intent(MyNeedDetailsActivity.this, DetailsActivity.class);
                      intent.putExtra("data_details", myNeedBean);
                      startActivity(intent);
                    }
                  });
            }
          }

          @Override
          public void onFailure(BaseBean base) {
            String msg = base.getMsg(); // 错误信息
            ToastUtil.show(mContext, msg);
          }
        },
        MyInfoBean.class);
  }
Esempio n. 3
0
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      ViewHolder holder = null;
      if (convertView == null) {
        convertView = mInflater.inflate((R.layout.activity_need_details_item), null);
        holder = new ViewHolder();
        holder.icon = (ImageView) convertView.findViewById(R.id.tv_need_item_gs_icon);
        holder.name = (TextView) convertView.findViewById(R.id.tv_need_item_gs_name);
        holder.state = (TextView) convertView.findViewById(R.id.tv_need_item_state);
        holder.time = (TextView) convertView.findViewById(R.id.tv_need_item_time);
        holder.agree = (Button) convertView.findViewById(R.id.btn_agree);

        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      if (!Utils.isEmpty(bankList.get(position).getImghead())) {
        String picUrl =
            Constants.getCurrUrl()
                + Constants.CASE_IMAGE_URL_HEADER
                + bankList.get(position).getImghead();
        ImageLoader.getInstance()
            .displayImage(
                picUrl,
                holder.icon,
                TopADApplication.getSelf().getImageLoaderOption(),
                new ImageLoadingListener() {
                  @Override
                  public void onLoadingStarted(String s, View view) {}

                  @Override
                  public void onLoadingFailed(String s, View view, FailReason failReason) {}

                  @Override
                  public void onLoadingComplete(String s, View view, Bitmap bitmap) {}

                  @Override
                  public void onLoadingCancelled(String s, View view) {}
                });
      }
      holder.icon.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              Intent intent = new Intent(MyNeedDetailsActivity.this, DetailsActivity.class);
              intent.putExtra("data_details", bankList.get(position));
              startActivity(intent);
            }
          });

      // 公司名
      holder.name.setText(bankList.get(position).getCompanyname());

      // 时间
      Date date = null;
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
      try {
        date = sdf.parse(bankList.get(position).getAdddate());
      } catch (ParseException e) {
        e.printStackTrace();
      }
      //            holder.time.setText(Utils.getTimeFormatText(date));
      holder.time.setVisibility(View.INVISIBLE);
      // 同意
      holder.agree.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              // 拼接url
              StringBuffer sb = new StringBuffer();
              sb.append(Constants.getCurrUrl()).append(Constants.URL_NEED_START).append("?");
              String url = sb.toString();
              RequestParams rp = new RequestParams();
              rp.add("needid", needId);
              rp.add("userid1", grabSingleBean.getUserid());
              rp.add("userid2", bankList.get(position).getUserid());
              rp.add("token", TopADApplication.getSelf().getToken());
              postWithLoading(
                  url,
                  rp,
                  false,
                  new HttpCallback() {
                    @Override
                    public <T> void onModel(int respStatusCode, String respErrorMsg, T t) {
                      mLYProductFinish.setVisibility(View.VISIBLE);
                      mFinish.setVisibility(View.VISIBLE);
                      mTVPrompt.setVisibility(View.VISIBLE);
                      //                            mLYTrust.setVisibility(View.GONE);

                      mProjectTrust.setVisibility(View.GONE);
                      mTVPrompt2.setVisibility(View.GONE);
                      mProjectCancel.setVisibility(View.GONE);
                      mListview.setVisibility(View.GONE);
                      mTVState.setVisibility(View.VISIBLE);
                      state = "1";
                      // 类别
                      if (!Utils.isEmpty(grabSingleBean.getType1())
                          && !Utils.isEmpty(grabSingleBean.getType2())) {
                        SpannableStringBuilder ssb =
                            new SpannableStringBuilder(
                                grabSingleBean.getType1() + "-" + grabSingleBean.getType2());
                        mTVTime.setText(ssb.toString());
                        mTVTime.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
                      }
                      // 时间
                      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);
                      }

                      Message msg = new Message();
                      msg.what = GET_USERINFE;
                      Bundle b = new Bundle();
                      b.putString("userid", bankList.get(position).getUserid());
                      msg.setData(b);
                      updateHandler.sendMessage(msg);
                    }

                    @Override
                    public void onFailure(BaseBean base) {
                      int status = base.getStatus(); // 状态码
                      String msg = base.getMsg(); // 错误信息
                      //                            ToastUtil.show(mContext, "status = " + status +
                      // "\n"
                      //                                    + "msg = " + msg);
                    }
                  },
                  BaseBean.class);
            }
          });
      return convertView;
    }
Esempio n. 4
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;
    }
  }