Пример #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;

    if (convertView == null) {
      holder = new ViewHolder();
      convertView = inflater.inflate(R.layout.mark_company, null);
      holder.company_logo_iv = (ImageView) convertView.findViewById(R.id.golfs_img_usericon);
      holder.timeTextView = (TextView) convertView.findViewById(R.id.golfs_speak_month);
      holder.pinmessageTextView = (TextView) convertView.findViewById(R.id.golfs_speak_message);
      holder.usenameTextView = (TextView) convertView.findViewById(R.id.golfs_speak_day);

      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }
    holder.pinBean = listCompanyObj.get(position);
    holder.pinmessageTextView.setText(listCompanyObj.get(position).markCommentBean.content);

    holder.usenameTextView.setText(listCompanyObj.get(position).displayName);

    // 发朋友圈时间

    String time =
        DateUtil.beforeTime(new Date(Long.valueOf(listCompanyObj.get(position).createTime)));
    if (time != null) {
      holder.timeTextView.setText(time);
    } else {
      holder.timeTextView.setText(
          format.format(new Date(Long.valueOf(listCompanyObj.get(position).createTime))));
    }

    ImageDisplayer.load(holder.company_logo_iv, listCompanyObj.get(position).myLogo, null, null);

    return convertView;
  }
  private void initUI(String priceInclude, String parkTel, String bookDescription) {
    // 取消订单
    quxioaTextView = (TextView) findViewById(R.id.cancel_order_tv);
    kefuTextView = aQuery.id(R.id.call_service_tv).getTextView();
    // 若是未支付,能取消订单,但不能联系客服
    if (orderBean.orderStatus == 1 && orderBean.payStatus == 0) {
      quxioaTextView.setOnClickListener(click);
      kefuTextView.setOnClickListener(click);

      // 支付完成,不可以取消订单,但是可以联系客服
    } else if (orderBean.orderStatus == 1 && orderBean.payStatus != 0) {
      quxioaTextView.setEnabled(false);
      quxioaTextView.setClickable(false);
      quxioaTextView.setBackgroundResource(R.drawable.focus_n_btn);
      quxioaTextView.setTextColor(getResources().getColor(R.color.gr_color_03));
      kefuTextView.setOnClickListener(click);

      // 已取消订单
    } else if (orderBean.orderStatus == 2 && orderBean.payStatus == 0) {
      kefuTextView.setEnabled(false);
      kefuTextView.setClickable(false);
      kefuTextView.setBackgroundResource(R.drawable.focus_n_btn);
      kefuTextView.setTextColor(getResources().getColor(R.color.gr_color_03));

      quxioaTextView.setEnabled(false);
      quxioaTextView.setClickable(false);
      quxioaTextView.setBackgroundResource(R.drawable.focus_n_btn);
      quxioaTextView.setTextColor(getResources().getColor(R.color.gr_color_03));
    }

    order_status_tv = (TextView) findViewById(R.id.order_status_tv); // 订单状态

    if (orderBean.orderStatus == 1 && orderBean.payStatus == 0) {
      order_status_tv.setText("待支付");
    } else if (orderBean.orderStatus == 1 && orderBean.payStatus != 0) {
      order_status_tv.setText("完成预订");
    } else if (orderBean.orderStatus == 2 && orderBean.payStatus == 0) {
      order_status_tv.setText("已取消");
    } else if (orderBean.orderStatus == 0 && orderBean.payStatus == 0) {
      order_status_tv.setText("处理中");
      quxioaTextView.setOnClickListener(click);
      kefuTextView.setOnClickListener(click);
    }

    aQuery.id(R.id.order_time_tv).text(DateUtil.Times(orderBean.createTime)); // 下单时间
    aQuery
        .id(R.id.order_all_price_tv)
        .text(getString(R.string.golfs_money) + orderBean.goodsAmount); // 订单总价

    aQuery.id(R.id.order_num_tv).text(orderBean.orderSn); // 订单号

    payment_way_tv = (TextView) findViewById(R.id.payment_way_tv); // 支付方式
    if (orderBean.payType == 0) {
      payment_way_tv.setText(
          getString(R.string.Stadium_now_pay) + getString(R.string.RMB) + orderBean.goodsAmount);
    } else {
      payment_way_tv.setText(
          getString(R.string.online_payment) + getString(R.string.RMB) + orderBean.goodsAmount);
    }
    aQuery.id(R.id.provider_tv).text(orderBean.goodsName).clicked(click); // 球场
    aQuery.id(R.id.open_ball_time_tv).text(orderBean.goodsAttr); // 开球时间
    aQuery.id(R.id.play_people_num_tv).text(orderBean.goodsNum + ""); // 打球人数
    aQuery.id(R.id.player_name_tv).text(orderBean.consignee); // 打球人名
    aQuery.id(R.id.user_phone_tv).text(orderBean.mobile); // 用户联系电话
    aQuery.id(R.id.provide_business_tv).text(orderBean.address); // 提供商
    aQuery.id(R.id.book_description_tv).text(bookDescription); // 预订说明
    aQuery.id(R.id.priceInclude).text(priceInclude); // 价格包含
    aQuery
        .id(R.id.my_remark_tv)
        .text(TextUtils.isEmpty(orderBean.postscript) ? "无备注" : orderBean.postscript); // 我的备注
    aQuery.id(R.id.call_ball_park_tv).text(parkTel).clicked(click); // 联系球场
  }