Esempio n. 1
0
    @Override
    public View getGroupView(
        final int groupPosition, boolean isExpanded, View convertView, ViewGroup viewGroup) {

      if (convertView == null) {
        viewHolder = new ViewHolder();
        LayoutInflater inflater = LayoutInflater.from(context);
        convertView = inflater.inflate(layout_id, null);

        viewHolder.hotel_order_payState =
            (TextView) convertView.findViewById(R.id.hotel_order_payState);
        viewHolder.create_order_date = (TextView) convertView.findViewById(R.id.create_order_date);
        viewHolder.del_img = (ImageView) convertView.findViewById(R.id.del_img);
        viewHolder.hotel_order_payState =
            (TextView) convertView.findViewById(R.id.hotel_order_payState);
        viewHolder.relative_layout5 =
            (RelativeLayout) convertView.findViewById(R.id.relative_layout5);
        viewHolder.hotel_order_detail_down =
            (ImageView) convertView.findViewById(R.id.hotel_order_detail_down);
        viewHolder.order_checkBox = (CheckBox) convertView.findViewById(R.id.order_checkBox);
        viewHolder.order_check_in_date =
            (TextView) convertView.findViewById(R.id.order_check_in_date);

        viewHolder.order_checkBox.setFocusable(false);
        viewHolder.order_checkBox.setClickable(false);
        Timers(
            timerCount(group.get(groupPosition).getFailureTime()),
            viewHolder.order_check_in_date,
            groupPosition);
        convertView.setTag(viewHolder);
      } else {
        viewHolder = (ViewHolder) convertView.getTag();
      }
      if (isExpanded) {
        viewHolder.order_checkBox.setChecked(true);
      } else {
        viewHolder.order_checkBox.setChecked(false);
      }
      viewHolder.order_checkBox.setOnCheckedChangeListener(
          new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
              // 异步传递信息
              Message msg = new Message();
              Bundle build = new Bundle();
              build.putInt("groupPosition", groupPosition);
              build.putBoolean("isChecked", b);
              msg.setData(build);
              handler.sendMessage(msg);
            }
          });
      //            RelativeLayout relative_layout = (RelativeLayout)
      // convertView.findViewById(R.id.relative_layout5);
      //            relative_layout.setVisibility(View.GONE);
      viewHolder.hotel_order_payState.setBackgroundResource(R.drawable.order_red);
      viewHolder.hotel_order_payState.setText(
          OrderStateEnum.getOrderStateEnumName(group.get(groupPosition).getStatus()));
      viewHolder.order_checkBox.setText("已经提交订单 请在倒计时结束前支付");
      //
      // viewHolder.create_order_date.setText(group.get(groupPosition).getOrderInfo().getCreateDate());
      viewHolder.order_check_in_date.setText("剩余支付时间 " + group.get(groupPosition).getFailureTime());
      return convertView;
    }
Esempio n. 2
0
  @Override
  public View getGroupView(
      final int groupPosition, boolean isExpanded, View convertView, ViewGroup viewGroup) {

    if (convertView == null) {
      viewHolder = new ViewHolder();
      LayoutInflater inflater = LayoutInflater.from(context);
      convertView = inflater.inflate(layout_id, null);

      viewHolder.hotel_order_payState =
          (TextView) convertView.findViewById(R.id.hotel_order_payState);
      viewHolder.create_order_date = (TextView) convertView.findViewById(R.id.create_order_date);
      viewHolder.del_img = (ImageView) convertView.findViewById(R.id.del_img);
      viewHolder.hotel_order_payState =
          (TextView) convertView.findViewById(R.id.hotel_order_payState);
      viewHolder.relative_layout5 =
          (RelativeLayout) convertView.findViewById(R.id.relative_layout5);
      viewHolder.hotel_order_detail_down =
          (ImageView) convertView.findViewById(R.id.hotel_order_detail_down);
      viewHolder.order_checkBox = (CheckBox) convertView.findViewById(R.id.order_checkBox);
      viewHolder.order_check_in_date =
          (TextView) convertView.findViewById(R.id.order_check_in_date);
      viewHolder.order_heard_show = (TextView) convertView.findViewById(R.id.order_heard_show);
      viewHolder.hotel_room_type = (TextView) convertView.findViewById(R.id.hotel_room_type);
      viewHolder.img_footer = (ImageView) convertView.findViewById(R.id.img_footer);
      viewHolder.order_checkBox.setFocusable(false);
      viewHolder.order_checkBox.setClickable(true);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.order_checkBox.setButtonDrawable(R.drawable.radio_style);
    if (isExpanded) {
      viewHolder.order_checkBox.setChecked(true);
      viewHolder.img_footer.setVisibility(View.GONE);
    } else {
      viewHolder.img_footer.setVisibility(View.VISIBLE);
    }
    guestInfos = getNotSubOrderGuest(group.get(groupPosition).getId());
    group.get(groupPosition).setGuestInfo(guestInfos);
    viewHolder.order_checkBox.setTag(group.get(groupPosition));
    viewHolder.order_checkBox.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Ioc.getIoc().getLogger().d("当前选择状态" + viewHolder.order_checkBox.isChecked());
            if (!viewHolder.order_checkBox.isChecked()) listView.collapseGroup(groupPosition);
          }
        });
    viewHolder.order_checkBox.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            // 异步传递信息
            Message msg = new Message();
            Bundle build = new Bundle();
            build.putInt("groupPosition", groupPosition);
            build.putBoolean("isChecked", b);
            msg.setData(build);
            handler.sendMessage(msg);
          }
        });
    viewHolder.del_img.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            cancelOrderConfrim(groupPosition);
            notifyDataSetChanged();
          }
        });
    viewHolder.hotel_order_payState.setText(
        OrderStateEnum.getOrderStateEnumName(group.get(groupPosition).getOrderState()));
    viewHolder.hotel_order_payState.setBackgroundResource(R.drawable.order_cancel);
    viewHolder.create_order_date.setText(DateUtil.formatDateTime(new Date(), "yyyy-MM-dd HH:mm"));
    //        viewHolder.order_check_in_date.setText(group.get(groupPosition).getStartDate() + "至" +
    // group.get(groupPosition).getEndDate());
    //
    // viewHolder.create_order_date.setText(DateUtil.formatDateTime(group.get(groupPosition).getCreateDateTime(),"yyyy-MM-dd"));
    System.out.println(group.get(groupPosition).getHotelName());
    viewHolder.order_heard_show.setText(group.get(groupPosition).getHotelName());
    viewHolder.hotel_room_type.setText(group.get(groupPosition).getRoomName());
    return convertView;
  }