예제 #1
0
 private void startDetailActivity(AdapterView<?> parent, int position) {
   Order order = (Order) (parent.getAdapter().getItem(position));
   if (order == null) {
     return;
   }
   String type = order.getInfoType();
   Intent intent = null;
   if (type != null) {
     if (type.equals("car")) {
       intent = new Intent(context, CarOrderDetailActivity.class);
     } else if (type.equals("line")) {
       intent = new Intent(context, XianLuOrderDetailActivity.class);
     } else if (type.equals("goods")) {
       intent = new Intent(context, GoodsOrderDetailActivity.class);
     }
   }
   intent.putExtra(OrderDetailContants.ORDER_ID, order.getOrderId());
   startActivity(intent);
 }
예제 #2
0
    @SuppressLint("NewApi")
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
      final Order data = buyList.get(position);
      ViewHolder holder;
      if (convertView == null) {
        holder = new ViewHolder();
        convertView =
            LayoutInflater.from(context).inflate(R.layout.search_source_listview_item, null);
        holder.tvPlace =
            (TextView)
                convertView.findViewById(
                    R.id.search_source_listview_item_tv_departrue_and_destination);
        holder.tvCarState =
            (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_car_state);
        holder.ivIsEfficacy =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_isEfficacy);
        holder.ivShopping =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_shopping);
        holder.ivColletion =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_colletion);
        holder.tvEqualTitle =
            (TextView) convertView.findViewById(R.id.search_source_listview_item_tv_equaltitle);
        holder.tvDate =
            (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_date);
        holder.tvDescribe =
            (TextView) convertView.findViewById(R.id.serch_source_listview_item_tv_describe);
        holder.tvDeal = (TextView) convertView.findViewById(R.id.serch_source_listview_item_deal);
        holder.tvName =
            (TextView) convertView.findViewById(R.id.search_source_listview_item_company_name);
        holder.llStar =
            (LinearLayout) convertView.findViewById(R.id.search_source_listview_item_ll_star);
        holder.spinner = (ProgressBar) convertView.findViewById(R.id.download_progressBar);
        holder.imDownload =
            (ImageView) convertView.findViewById(R.id.search_source_listview_item_iv_company_logo);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      final ImageView imageView = holder.imDownload;
      final ProgressBar progressBar = holder.spinner;
      setShareImgPath(data.getIconUrl(), imageView, progressBar);
      holder.tvName.setText(data.getCompanyName());
      holder.tvEqualTitle.setText("¥" + data.getTransportPrice() + "元");
      holder.tvPlace.setText(data.getDeparture() + " 至 " + data.getArrival());
      holder.tvDate.setText(
          "承运日期:"
              + dateStringtoString(data.getAcceptStartTime())
              + " 至 "
              + dateStringtoString(data.getAcceptEndTime()));
      String describe = "";
      String type = data.getInfoType();
      if (type != null) {
        if (type.equals("car")) {
          describe = "[运力]";
        } else if (type.equals("line")) {
          describe = "[路线]";
        } else if (type.equals("goods")) {
          describe = "[物品]";
        }
      }
      holder.tvDeal.setText("成交单数:" + data.getOrderCount());
      holder.tvDescribe.setText(describe + data.getInfoName());
      holder.tvCarState.setVisibility(View.VISIBLE);
      final int index = position;
      switch (data.getExecuteState()) {
        case 100:
          holder.tvCarState.setText("同意发车"); // bn
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));

          break;
        case 0:
          holder.tvCarState.setText("同意发车"); // n
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg));
          holder.tvCarState.setOnClickListener(
              new OnClickListener() {

                @Override
                public void onClick(View v) {
                  CarDepartureAllowRequest req1 = new CarDepartureAllowRequest();
                  req1.setOrderCode(data.getOrderCode());
                  sendCarRequest(req1, index);
                }
              });
          break;
        case 1:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 2:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 3:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 4:
          holder.tvCarState.setText("同意结算"); // n
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg));
          holder.tvCarState.setOnClickListener(
              new OnClickListener() {

                @Override
                public void onClick(View v) {
                  Intent intent = new Intent(context, AgreePayForActivity.class);

                  intent.putExtra(AgreePayForActivity.ORDERID, data.getOrderCode());
                  intent.putExtra(AgreePayForActivity.AMOUNT, data.getTransportPrice());
                  startActivity(intent);
                }
              });
          break;
        case 5:
          holder.tvCarState.setText("同意结算"); // n
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.btn_orange_bg));
          holder.tvCarState.setOnClickListener(
              new OnClickListener() {

                @Override
                public void onClick(View v) {
                  //						SettlementAllowRequest req3 = new SettlementAllowRequest();
                  //						req3.setOrderCode(data.getOrderCode());
                  //						sendCarRequest(req3, index);
                  Intent intent = new Intent(context, AgreePayForActivity.class);

                  intent.putExtra(AgreePayForActivity.ORDERID, data.getOrderCode());
                  intent.putExtra(AgreePayForActivity.AMOUNT, data.getTransportPrice());
                  startActivity(intent);
                }
              });
          holder.tvCarState.setVisibility(View.GONE);
          break;
        case 6:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setVisibility(View.GONE);
          holder.tvCarState.setBackground(getResources().getDrawable(R.drawable.no_click));
          break;
        case 7:
          holder.tvCarState.setText("同意结算");
          holder.tvCarState.setVisibility(View.GONE);
          break;

        default:
          break;
      }

      holder.ivShopping.setVisibility(View.GONE);
      holder.ivColletion.setVisibility(View.GONE);
      final String state = holder.tvCarState.getText().toString();

      return convertView;
    }