Beispiel #1
0
  @Override
  public View getHeaderView(int position, View convertView, ViewGroup parent) {
    HeaderViewHolder holder;
    String headerText;
    long duration = 0;
    if (convertView == null) {
      holder = new HeaderViewHolder();
      convertView = inflater.inflate(R.layout.history_list_header, parent, false);
      holder.text = (TextView) convertView.findViewById(R.id.history_list_header_text);
      holder.hours = (TextView) convertView.findViewById(R.id.history_list_header_hours);
      convertView.setTag(holder);
    } else {
      holder = (HeaderViewHolder) convertView.getTag();
    }

    headerText = headerFormat.format(tataDays.get(position).getDate());

    for (TataDay t : this.tataDays) {
      if (yearMonthFormat
          .format(t.getDate())
          .equals(yearMonthFormat.format(tataDays.get(position).getDate()))) {
        duration += (t.getEnd().getTime() - t.getBegin().getTime());
      }
    }
    holder.text.setText(headerText);
    holder.hours.setText(Utility.convertSecondsToHHMmSs(duration));
    return convertView;
  }
Beispiel #2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    long duree;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = inflater.inflate(R.layout.history_list_item, parent, false);
      holder.date = (TextView) convertView.findViewById(R.id.history_list_item_date);
      holder.period = (TextView) convertView.findViewById(R.id.history_list_item_period);
      holder.hours = (TextView) convertView.findViewById(R.id.history_list_item_hours);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.date.setText(dateFormat.format(tataDays.get(position).getDate()));
    holder.period.setText(
        hoursFormat.format(tataDays.get(position).getBegin())
            + " - "
            + hoursFormat.format(tataDays.get(position).getEnd()));
    duree = tataDays.get(position).getEnd().getTime() - tataDays.get(position).getBegin().getTime();
    holder.hours.setText(Utility.convertSecondsToHHMmSs(duree));

    return convertView;
  }