@Override
  public View getHeaderView(int i, View convertView, ViewGroup viewGroup) {
    Cursor cursor = getCursor();

    HeaderViewHolder holder;

    if (convertView == null) {
      holder = new HeaderViewHolder();
      convertView = li.inflate(R.layout.push_contact_selection_list_header, viewGroup, false);
      holder.text = (TextView) convertView.findViewById(R.id.text);
      convertView.setTag(holder);
    } else {
      holder = (HeaderViewHolder) convertView.getTag();
    }

    cursor.moveToPosition(i);

    int type = cursor.getInt(cursor.getColumnIndexOrThrow(ContactsDatabase.TYPE_COLUMN));

    if (type == ContactsDatabase.PUSH_TYPE)
      holder.text.setText(R.string.contact_selection_list__header_textsecure_users);
    else holder.text.setText(R.string.contact_selection_list__header_other);

    return convertView;
  }
Exemplo n.º 2
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;
  }
  @Override
  public View getHeaderView(int i, View convertView, ViewGroup viewGroup) {
    final Cursor c = getCursor();
    final HeaderViewHolder holder;
    if (convertView == null) {
      holder = new HeaderViewHolder();
      convertView = li.inflate(R.layout.push_contact_selection_list_header, viewGroup, false);
      holder.text = (TextView) convertView.findViewById(R.id.text);
      convertView.setTag(holder);
    } else {
      holder = (HeaderViewHolder) convertView.getTag();
    }
    c.moveToPosition(i);

    final int type = c.getInt(c.getColumnIndexOrThrow(ContactsDatabase.TYPE_COLUMN));
    final int headerTextRes;
    switch (type) {
      case 1:
        headerTextRes = R.string.contact_selection_list__header_textsecure_users;
        break;
      default:
        headerTextRes = R.string.contact_selection_list__header_other;
        break;
    }
    holder.text.setText(headerTextRes);
    return convertView;
  }
Exemplo n.º 4
0
  @Override
  public View getHeaderView(int position, View convertView, ViewGroup parent) {
    HeaderViewHolder holder;
    if (convertView == null) {
      holder = new HeaderViewHolder();
      convertView = inflater.inflate(R.layout.header, parent, false);
      holder.text = (TextView) convertView.findViewById(R.id.text);
      convertView.setTag(holder);
    } else {
      holder = (HeaderViewHolder) convertView.getTag();
    }
    // set header text as first char in name
    AllEpisodesResponse episode = getItem(position);
    String airDate = episode.getAirdate();
    String monthNumber = getMonthNumber(airDate);
    String day = getDay(airDate);
    String headerTextDate = null;
    if (monthNumber != null && day != null) {
      String monthName = getMonthName(monthNumber);
      if (monthName != null) {
        headerTextDate = monthName + " " + day;
      }
    }

    String headerText = null;
    if (headerTextDate != null && headerTextDate.length() > 0) {
      headerText = scheduleData.get(position).getDay() + ", " + headerTextDate;
    } else {
      headerText = scheduleData.get(position).getDay();
    }
    holder.text.setText(headerText);
    return convertView;
  }
Exemplo n.º 5
0
 @Override
 public View getHeaderView(int position, View convertView, ViewGroup parent) {
   HeaderViewHolder holder;
   if (convertView == null) {
     holder = new HeaderViewHolder();
     convertView = mInflater.inflate(R.layout.header, parent, false);
     holder.text = (TextView) convertView.findViewById(R.id.text1);
     convertView.setTag(holder);
   } else {
     holder = (HeaderViewHolder) convertView.getTag();
   }
   // set header text as first char in name
   String headerText = Emails.get(position).Date;
   holder.text.setText(headerText);
   return convertView;
 }
Exemplo n.º 6
0
 @Override
 public View getHeaderView(int position, View convertView, ViewGroup parent) {
   HeaderViewHolder holder;
   if (convertView == null) {
     holder = new HeaderViewHolder();
     convertView = inflater.inflate(R.layout.header, parent, false);
     holder.text = (TextView) convertView.findViewById(R.id.text1);
     convertView.setTag(holder);
   } else {
     holder = (HeaderViewHolder) convertView.getTag();
   }
   // set header text as first char in name
   String headerText = "" + countries[position].subSequence(0, 1).charAt(0);
   holder.text.setText(headerText);
   return convertView;
 }
 public View getHeaderView(int position, View convertView, ViewGroup parent) {
   HeaderViewHolder holder;
   if (convertView == null) {
     holder = new HeaderViewHolder();
     convertView = inflater.inflate(R.layout.list_row_header, parent, false);
     holder.text = (TextView) convertView.findViewById(R.id.headerText);
     convertView.setTag(holder);
   } else {
     holder = (HeaderViewHolder) convertView.getTag();
   }
   // set header text as first char in name
   char headerChar =
       indexer.getSections()[indexer.getSectionForPosition(position)].toString().trim().charAt(0);
   String headerText = Character.toString(headerChar);
   holder.text.setText(headerText);
   return convertView;
 }
 @Override
 public View getHeaderView(int position, View convertView, ViewGroup parent) {
   HeaderViewHolder holder;
   if (convertView == null) {
     holder = new HeaderViewHolder();
     convertView = inflater.inflate(R.layout.header_all_appointment, parent, false);
     holder.text = (TextView) convertView.findViewById(R.id.slot);
     convertView.setTag(holder);
   } else {
     holder = (HeaderViewHolder) convertView.getTag();
   }
   // set header text as first char in name
   String headerText =
       ""
           + UtilSingleInstance.getInstance()
               .getDateFormattedInStringFormatUsingLong(appointment.get(position).getDateTime())
               .subSequence(7, 11);
   holder.text.setText(headerText);
   return convertView;
 }
  @Override
  public View getHeaderView(int position, View convertView, ViewGroup parent) {
    HeaderViewHolder holder;

    if (convertView == null) {
      holder = new HeaderViewHolder();
      convertView = inflater.inflate(R.layout.item_listview_header, parent, false);
      holder.text = (TextView) convertView.findViewById(R.id.tv_fragment_lv_header);
      holder.background = (RelativeLayout) convertView.findViewById(R.id.rv_lv_header);
      convertView.setTag(holder);

    } else {
      holder = (HeaderViewHolder) convertView.getTag();
    }
    // set header text as first char in name
    String headerText = "" + getItemTypeText(getItem(position));
    holder.text.setText(headerText);

    return convertView;
  }
Exemplo n.º 10
0
    @SuppressWarnings("incomplete-switch")
    @Override
    public View getHeaderView(int position, View convertView, ViewGroup parent) {
      HeaderViewHolder holder;
      if (convertView == null) {
        convertView = inflater.inflate(R.layout.header, parent, false);
        holder = new HeaderViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.text);
        holder.sumExpense = (TextView) convertView.findViewById(R.id.sum_expense);
        holder.sumIncome = (TextView) convertView.findViewById(R.id.sum_income);
        holder.sumTransfer = (TextView) convertView.findViewById(R.id.sum_transfer);
        holder.interimBalance = (TextView) convertView.findViewById(R.id.interim_balance);
        convertView.setTag(holder);
      } else {
        holder = (HeaderViewHolder) convertView.getTag();
      }

      Cursor c = getCursor();
      c.moveToPosition(position);
      int year =
          c.getInt(
              mAccount.grouping.equals(Grouping.WEEK)
                  ? columnIndexYearOfWeekStart
                  : columnIndexYear);
      int second = -1;

      if (mGroupingCursor != null) {
        mGroupingCursor.moveToFirst();
        // no grouping, we need the first and only row
        if (mAccount.grouping.equals(Grouping.NONE)) {
          fillSums(holder, mGroupingCursor);
        } else {
          traverseCursor:
          while (!mGroupingCursor.isAfterLast()) {
            if (mGroupingCursor.getInt(columnIndexGroupYear) == year) {
              switch (mAccount.grouping) {
                case YEAR:
                  fillSums(holder, mGroupingCursor);
                  break traverseCursor;
                case DAY:
                  second = c.getInt(columnIndexDay);
                  if (mGroupingCursor.getInt(columnIndexGroupSecond) != second) break;
                  else {
                    fillSums(holder, mGroupingCursor);
                    break traverseCursor;
                  }
                case MONTH:
                  second = c.getInt(columnIndexMonth);
                  if (mGroupingCursor.getInt(columnIndexGroupSecond) != second) break;
                  else {
                    fillSums(holder, mGroupingCursor);
                    break traverseCursor;
                  }
                case WEEK:
                  second = c.getInt(columnIndexWeek);
                  if (mGroupingCursor.getInt(columnIndexGroupSecond) != second) break;
                  else {
                    fillSums(holder, mGroupingCursor);
                    break traverseCursor;
                  }
              }
            }
            mGroupingCursor.moveToNext();
          }
        }
        if (!mGroupingCursor.isAfterLast())
          mappedCategoriesPerGroup.put(
              position, mGroupingCursor.getInt(columnIndexGroupMappedCategories) > 0);
      }
      holder.text.setText(mAccount.grouping.getDisplayTitle(getActivity(), year, second, c));
      // holder.text.setText(mAccount.grouping.getDisplayTitle(getActivity(), year, second,
      // mAccount.grouping.equals(Grouping.WEEK)?this_year_of_week_start:this_year,
      // this_week,this_day));
      return convertView;
    }