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

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

    return offset;
  }
示例#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;
  }
示例#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);
 }
示例#5
0
 @Override
 public long getItemId(int i) {
   if (pattern.insertForIndex(i)) return -1L;
   return wrappedAdapter.getItemId(i - getOffsetForIndex(i));
 }
示例#6
0
 @Override
 public Object getItem(int i) {
   if (pattern.insertForIndex(i)) return null;
   return wrappedAdapter.getItem(i - getOffsetForIndex(i));
 }