@SmallTest @Test public void itemRangeChangedTest() { int itemCount = 4; ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector); adapter.add(new SectionRow("section 1")); for (int i = 0; i < itemCount; i++) { HeaderItem headerItem = new HeaderItem(i, "header "+i); adapter.add(new ListRow(headerItem, createListRowAdapter())); } ListRowDataAdapter listRowDataAdapter = new ListRowDataAdapter(adapter); listRowDataAdapter.registerObserver(dataObserver); SectionRow sectionRow = new SectionRow("section 11"); adapter.replace(0, sectionRow); verify(dataObserver, times(1)).onItemRangeChanged(0, 1); assertEquals(5, listRowDataAdapter.size()); }
@Override public int size() { return mLastVisibleRowIndex + 1; }
ListRowDataAdapter extends ObjectAdapter { @Override public int size() { return mLastVisibleRowIndex + 1; } }
ListRowDataAdapter extends ObjectAdapter { @Override public int size() { return mLastVisibleRowIndex + 1; } ListRowDataAdapter(ObjectAdapter adapter); }
ListRowDataAdapter extends ObjectAdapter { @Override public int size() { return mLastVisibleRowIndex + 1; } ListRowDataAdapter(ObjectAdapter adapter); @Override int size(); @Override Object get(int index); }
ListRowDataAdapter extends ObjectAdapter { @Override public int size() { return mLastVisibleRowIndex + 1; } ListRowDataAdapter(ObjectAdapter adapter); @Override int size(); @Override Object get(int index); static final int ON_ITEM_RANGE_CHANGED; static final int ON_ITEM_RANGE_INSERTED; static final int ON_ITEM_RANGE_REMOVED; static final int ON_CHANGED; }