Ejemplo n.º 1
0
    @Override
    public View getChildView(
        int groupPosition, int childPosition, boolean b, View view, ViewGroup viewGroup) {
      //        OrderCenterItemAdapter carStyleAdapter = new OrderCenterItemAdapter(context,new
      // HashMap<String ,String>(),R.layout.order_center_child_item);

      ViewHolder viewHolder1 = null;
      if (view == null) {
        viewHolder1 = new ViewHolder();
        LayoutInflater inflater = LayoutInflater.from(context);
        view = inflater.inflate(R.layout.order_group_middle, null);
        viewHolder1.order_heard_show = (TextView) view.findViewById(R.id.order_heard_show);
        viewHolder1.hotel_room_type = (TextView) view.findViewById(R.id.hotel_room_type);
        viewHolder1.hotel_order_inroom_day =
            (TextView) view.findViewById(R.id.hotel_order_inroom_day);
        viewHolder1.hotel_order_outroom_day =
            (TextView) view.findViewById(R.id.hotel_order_outroom_day);
        viewHolder1.hotel_order_no = (TextView) view.findViewById(R.id.hotel_order_no);
        viewHolder1.tx_guest_name = (TextView) view.findViewById(R.id.tx_guest_name);
        viewHolder1.tx_guest_phone = (TextView) view.findViewById(R.id.tx_guest_phone);
        viewHolder1.point_value = (TextView) view.findViewById(R.id.point_value);
        viewHolder1.price_value = (TextView) view.findViewById(R.id.price_value);
        viewHolder1.text_count_days = (TextView) view.findViewById(R.id.text_count_days);

        view.setTag(viewHolder1);
      } else {
        viewHolder1 = (ViewHolder) view.getTag();
      }
      if (child != null) {

        viewHolder1.hotel_order_inroom_day.setText(
            DateUtil.formatStringDateTime(
                child.get(childPosition).getRoomInfo().getStartDate(), "MM月dd日"));
        viewHolder1.hotel_order_outroom_day.setText(
            DateUtil.formatStringDateTime(
                child.get(childPosition).getRoomInfo().getEndDate(), "MM月dd日"));
        viewHolder1.order_heard_show.setText(child.get(childPosition).getRoomInfo().getHotelName());
        viewHolder1.hotel_room_type.setText(
            child.get(childPosition).getRoomInfo().getViewIntro()
                + child.get(childPosition).getRoomInfo().getRoomTypeName()
                + "-"
                + child.get(childPosition).getRoomInfo().getFloorName()
                + "-"
                + child.get(childPosition).getRoomInfo().getRoomCode()
                + " "
                + child.get(childPosition).getRoomInfo().getBedTypeContent());
        int subday =
            DateUtil.nDaysBetweenTwoDate(
                child.get(childPosition).getRoomInfo().getStartDate(),
                child.get(childPosition).getRoomInfo().getEndDate());
        viewHolder1.text_count_days.setText(
            context.getString(R.string._subday, subday + "")); // 共计天数
      }
      return view;
    }
Ejemplo n.º 2
0
  @Override
  public View getChildView(
      int groupPosition, int childPosition, boolean b, View view, ViewGroup viewGroup) {
    //        OrderCenterItemAdapter carStyleAdapter = new OrderCenterItemAdapter(context,new
    // HashMap<String ,String>(),R.layout.order_center_child_item);

    ViewHolder viewHolder1 = null;
    if (view == null) {
      viewHolder1 = new ViewHolder();
      LayoutInflater inflater = LayoutInflater.from(context);
      view = inflater.inflate(R.layout.common_subdays, null);
      viewHolder1.order_heard_show = (TextView) view.findViewById(R.id.order_heard_show);
      viewHolder1.hotel_room_type = (TextView) view.findViewById(R.id.hotel_room_type);
      viewHolder1.hotel_order_inroom_day =
          (TextView) view.findViewById(R.id.hotel_order_inroom_day);
      viewHolder1.hotel_order_outroom_day =
          (TextView) view.findViewById(R.id.hotel_order_outroom_day);
      viewHolder1.hotel_order_no = (TextView) view.findViewById(R.id.hotel_order_no);
      viewHolder1.tx_guest_name = (TextView) view.findViewById(R.id.tx_guest_name);
      viewHolder1.tx_guest_phone = (TextView) view.findViewById(R.id.tx_guest_phone);
      viewHolder1.point_value = (TextView) view.findViewById(R.id.point_value);
      viewHolder1.price_value = (TextView) view.findViewById(R.id.price_value);
      viewHolder1.text_count_days = (TextView) view.findViewById(R.id.text_count_days);

      view.setTag(viewHolder1);
    } else {
      viewHolder1 = (ViewHolder) view.getTag();
    }

    int subday =
        DateUtil.nDaysBetweenTwoDate(
            group.get(groupPosition).getStartDate(), group.get(groupPosition).getEndDate());
    viewHolder1.text_count_days.setText(context.getString(R.string._subday, subday + "")); // 共计天数
    viewHolder1.hotel_order_inroom_day.setText(
        DateUtil.formatStringDateTime(group.get(groupPosition).getStartDate(), "MM月dd日"));
    viewHolder1.hotel_order_outroom_day.setText(
        DateUtil.formatStringDateTime(group.get(groupPosition).getEndDate(), "MM月dd日"));
    viewHolder1.hotel_order_no.setText(group.get(groupPosition).getOrderNo());

    //        for(GuestInfo guest:guestInfos){
    //        }
    viewHolder1.tx_guest_name.setText(guestInfos.get(0).getGuestName());
    viewHolder1.tx_guest_phone.setText(guestInfos.get(0).getTelephone());
    viewHolder1.point_value.setText(
        Handler_String.isBlank(group.get(groupPosition).getPointNight())
            ? "0.00"
            : group.get(groupPosition).getPointNight());
    viewHolder1.price_value.setText(group.get(groupPosition).getConsumption());

    //     Animation   translateAnimation= AnimationUtils.loadAnimation(context, R.anim.push_up_in);
    //      view.setAnimation(translateAnimation);
    return view;
  }
  /**
   * @Function getMapList @Description 格式化消费订单列表,封装到适配器中 @Input jsonString:消费明细json格式 @Return 无返回值
   */
  public ArrayList<HashMap<String, String>> getMapList(String jsonString) {
    ArrayList<HashMap<String, String>> list =
        (ArrayList<HashMap<String, String>>) Handler_Json.jsonToListOrMap("list", jsonString);
    for (HashMap<String, String> map : list) {
      // 格式化时间
      Handler_Time costDate = Handler_Time.getInstance(map.get("costDate").toString());

      HashMap<String, String> hashMap = new HashMap<String, String>();
      hashMap.put(
          "hotel_card_recordType",
          map.get("unitName").toString() + "-" + map.get("recordType").toString());
      hashMap.put(
          "hotel_card_costime",
          DateUtil.formatStringDateTime(map.get("costDate").toString(), "yyyy.MM.dd  HH:mm"));
      hashMap.put("hotel_card_unitcost", map.get("unitCost").toString());

      mapList.add(hashMap);
    }

    return mapList;
  }