@Override
 public int getViewTypeCount() {
   // assume that headers count as one, then total all sections
   int total = 1;
   for (Adapter adapter : this.sections.values()) total += adapter.getViewTypeCount();
   return total;
 }
Esempio n. 2
0
 /** {@inheritDoc} */
 @Override
 public int getViewTypeCount() {
   // assume that mHeaders count as one, then total all mSections
   int total = 1;
   for (final Adapter adapter : mSections.values()) {
     total += adapter.getViewTypeCount();
   }
   return total;
 }
Esempio n. 3
0
    public int getItemViewType(int position) {
      int type = 1;
      for (Object section : this.sections.keySet()) {
        Adapter adapter = sections.get(section);
        int size = adapter.getCount() + 1;

        if (position == 0) return TYPE_SECTION_HEADER;
        if (position < size) return type + adapter.getItemViewType(position - 1);

        position -= size;
        type += adapter.getViewTypeCount();
      }
      return -1;
    }
  public int getItemViewType(int position) {
    int type = 1;
    for (Object section : this.sections.keySet()) {
      Adapter adapter = sections.get(section);
      int size = adapter.getCount() + 1;

      // check if position inside this section
      if (position == 0) return TYPE_SECTION_HEADER;
      if (position < size) return type + adapter.getItemViewType(position - 1);

      // otherwise jump into next section
      position -= size;
      type += adapter.getViewTypeCount();
    }
    return -1;
  }
  private void reloadAdapter() {
    if (null != mAdapter) {
      mItemTypeCount = mAdapter.getViewTypeCount();
      mItemCount = mAdapter.getCount();

      mRecycleBin = Collections.synchronizedList(new ArrayList<Queue<View>>());
      for (int i = 0; i < mItemTypeCount; i++) {
        mRecycleBin.add(new LinkedList<View>());
      }
    } else {
      mItemCount = 0;
    }

    mDataChanged = true;
    requestLayout();
  }
Esempio n. 6
0
  /** {@inheritDoc} */
  @Override
  public int getItemViewType(int position) {
    int type = 1;
    for (final Object section : mSections.keySet()) {
      final Adapter adapter = mSections.get(section);
      final int size = adapter.getCount() + 1;

      // check if position inside this section
      if (position == 0) {
        return TYPE_SECTION_HEADER;
      }
      if (position < size) {
        return type + adapter.getItemViewType(position - 1);
      }

      // otherwise jump into next section
      position -= size;
      type += adapter.getViewTypeCount();
    }
    return -1;
  }
  public int getItemViewType(int position) {
    int type = 1;
    for (int i = 0; i < headers.getCount(); i++) {
      String section = headers.getItem(i);
      Adapter adapter = sections.get(section);

      // skip empty sections
      if (adapter.getCount() > 0) {
        int size = adapter.getCount() + 1;

        // check if position inside this section
        if (position == 0) return TYPE_SECTION_HEADER;
        if (position < size) return type + adapter.getItemViewType(position - 1);

        // otherwise jump into next section
        position -= size;
        type += adapter.getViewTypeCount();
      }
    }
    return -1;
  }
Esempio n. 8
0
 public int getViewTypeCount() {
   int total = 1;
   for (Adapter adapter : this.sections.values()) total += adapter.getViewTypeCount();
   return total;
 }