Example #1
0
 @Override
 public int getItemViewType(int position) {
   if (pattern.insertForIndex(position)) {
     return super.getViewTypeCount();
   }
   return super.getItemViewType(position);
 }
Example #2
0
  private int getOffsetForIndex(int index) {
    int offset = 0;

    for (int i = 0; i < index; i++) {
      if (pattern.insertForIndex(i)) {
        offset++;
      }
    }

    return offset;
  }
Example #3
0
  private int getTotalCount(int countWrappedAdapter) {
    int offset = 0;
    int totalListSize = countWrappedAdapter;

    for (int i = 0; i < totalListSize; i++) {
      if (pattern.insertForIndex(i)) {
        offset++;
        totalListSize++;
      }
    }

    return countWrappedAdapter + offset;
  }
Example #4
0
 @Override
 public View getView(int i, View view, ViewGroup viewGroup) {
   if (pattern.insertForIndex(i)) return viewProvider.getView(i, view, viewGroup);
   return wrappedAdapter.getView(i - getOffsetForIndex(i), view, viewGroup);
 }
Example #5
0
 @Override
 public long getItemId(int i) {
   if (pattern.insertForIndex(i)) return -1L;
   return wrappedAdapter.getItemId(i - getOffsetForIndex(i));
 }
Example #6
0
 @Override
 public Object getItem(int i) {
   if (pattern.insertForIndex(i)) return null;
   return wrappedAdapter.getItem(i - getOffsetForIndex(i));
 }