/** 未支付订单 */ private void getNoLoginOrder() { Selector selector = Selector.from(SubmittedOrderEntity.class); selector.select(" * "); List<SubmittedOrderEntity> list = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE).findAll(selector); if (list != null && list.size() > 0) { initToolBar(); OrdrDetail orderDetail = new OrdrDetail(); Long time = DateUtil.getStartAndEndToTimes( DateUtil.formatDateTime(new Date(), "yyyy-MM-dd HH:mm:ss"), list.get(0).getCreateTime()); orderDetail.setFailureTime(DateUtil.timer(time)); String orderGroupId = ""; String orderGroupNo = ""; for (int i = 0; i < list.size(); i++) { if (Handler_String.isBlank(orderGroupId) || i != (list.size() - 1)) { orderGroupNo += list.get(i).getOrderNo() + ","; orderGroupId += list.get(i).getOrderId() + ","; } else { orderGroupId += list.get(i).getOrderId(); orderGroupNo += list.get(i).getOrderNo(); } } Ioc.getIoc().getLogger().d("订单组id:" + orderGroupId); orderDetail.setOrderIdGroup(orderGroupId); group.add(orderDetail); oca.notifyDataSetChanged(); } }
@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; }
@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; }
/** * @return void 返回类型 * @throws @Title: initView @Description: 初始化控件 */ public void initView() { LayoutInflater inflater = android.view.LayoutInflater.from(getActivity()); heardView = inflater.inflate(R.layout.reservation_conditions_room, null); listview_roomlist.addHeaderView(heardView); gallery_hotel = (IMGGallery) heardView.findViewById(R.id.gallery_hotel); indicator_container = (LinearLayout) heardView.findViewById(R.id.indicator_container); text_startDate = (TextView) heardView.findViewById(R.id.text_startDate); text_endDate = (TextView) heardView.findViewById(R.id.text_endDate); text_count_days = (TextView) heardView.findViewById(R.id.text_count_days); text_hotelname = (TextView) heardView.findViewById(R.id.text_hotelname); text_hotelidx = (TextView) heardView.findViewById(R.id.text_hotelidx); rd = (ReservationDto) MapVo.get("reservtion"); text_hotelname.setText(rd.getHotelName()); text_hotelidx.setText(rd.getProjectIdx()); text_startDate.setText(rd.getStartDate()); text_endDate.setText(rd.getEndDate()); int subDay = DateUtil.nDaysBetweenTwoDate(rd.getStartDate(), rd.getEndDate()); text_count_days.setText(getString(R.string._subday, subDay)); }
/** * @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; }
@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; }