diff options
author | Andrew Lee <anwlee@google.com> | 2015-04-08 14:58:45 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-04-09 18:43:12 -0700 |
commit | 492cd7371c6d8fddc4de85887a4ed9a89d602767 (patch) | |
tree | 14c9ea0382ea342cde7dcc86ff17af223e93d23d /tests/src/com | |
parent | 69748953bc507fc8c02ad401f51b7df2efd77688 (diff) |
Replace ListView with RecyclerView in call log.
Yay, finally!
+ Replace ListView with RecyclerView in layout and fragment files.
+ Change GroupingListAdapter to extend RecyclerView.Adapter instead
of BaseAdapter.
+ Change CallLogListItemViews to extend RecyclerView.ViewHolder.
+ Adapt onBindViewHolder and onCreateViewHolder methods in the
CallLogAdapter.
+ Update/rework tests for related classes.
+ Fix a bug in the GroupingListAdapter, where childCount was not
updated for standalone views, and the previously cached group size
was used instead. Set childCount to 1 for standalone views.
- Removed the idea of creating different views for standalone vs
group vs group headers from the adapters. This logic has not been
used for quite some time and all these functions funneled into
createView/bindView methods anyways, so there is no logical
difference. If we need to create custom views in the future, we can
leverage onCreateViewHolder's viewType parameter.
Bug: 19372817
Change-Id: I1b7289340600609669db22d8bc89265240d0b561
Diffstat (limited to 'tests/src/com')
3 files changed, 91 insertions, 89 deletions
diff --git a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java index 845e279c9..bffbe5cf5 100644 --- a/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogAdapterTest.java @@ -87,7 +87,8 @@ public class CallLogAdapterTest extends AndroidTestCase { mCursor.addRow(createCallLogEntry()); // Bind the views of a single row. - mAdapter.bindStandAloneView(mView, getContext(), mCursor); + mAdapter.changeCursor(mCursor); + mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); @@ -105,7 +106,8 @@ public class CallLogAdapterTest extends AndroidTestCase { mCursor.addRow(createCallLogEntryWithCachedValues()); // Bind the views of a single row. - mAdapter.bindStandAloneView(mView, getContext(), mCursor); + mAdapter.changeCursor(mCursor); + mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); @@ -123,7 +125,9 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.injectContactInfoForTest(TEST_NUMBER, TEST_COUNTRY_ISO, createContactInfo()); // Bind the views of a single row. - mAdapter.bindStandAloneView(mView, getContext(), mCursor); + mAdapter.changeCursor(mCursor); + mAdapter.onBindViewHolder( + CallLogListItemViews.fromView(getContext(), mView), 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); @@ -138,7 +142,8 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.injectContactInfoForTest(TEST_NUMBER, TEST_COUNTRY_ISO, createContactInfo()); // Bind the views of a single row. - mAdapter.bindStandAloneView(mView, getContext(), mCursor); + mAdapter.changeCursor(mCursor); + mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); // Cache and call log are up-to-date: no need to request update. assertEquals(0, mAdapter.getContactInfoCache().requests.size()); @@ -153,7 +158,8 @@ public class CallLogAdapterTest extends AndroidTestCase { mAdapter.injectContactInfoForTest(TEST_NUMBER, TEST_COUNTRY_ISO, info); // Bind the views of a single row. - mAdapter.bindStandAloneView(mView, getContext(), mCursor); + mAdapter.changeCursor(mCursor); + mAdapter.onBindViewHolder(CallLogListItemViews.fromView(getContext(), mView), 0); // There is one request for contact details. assertEquals(1, mAdapter.getContactInfoCache().requests.size()); diff --git a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java index b57489d55..fe14f8709 100644 --- a/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java +++ b/tests/src/com/android/dialer/calllog/CallLogFragmentTest.java @@ -30,6 +30,7 @@ import android.net.Uri; import android.provider.CallLog.Calls; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.VoicemailContract; +import android.support.v7.widget.RecyclerView.ViewHolder; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.test.ActivityInstrumentationTestCase2; @@ -94,9 +95,9 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme // An item in the call list. All the methods performing checks use it. private CallLogListItemViews mItem; - // The list of views representing the data in the DB. View are in - // reverse order compare to the DB. - private View[] mList; + + // The list of view holderss representing the data in the DB, in reverse order from the DB. + private ViewHolder[] mList; public CallLogFragmentTest() { super(FragmentTestActivity.class); @@ -129,6 +130,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme mAdapter.pauseCache(); mParentView = new FrameLayout(mActivity); mCursor = new MatrixCursor(CallLogQuery._PROJECTION); + mAdapter.setCursorForTesting(mCursor); } /** @@ -140,7 +142,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme @MediumTest public void testCallViewIsNotVisibleForPrivateAndUnknownNumbers() { final int SIZE = 100; - mList = new View[SIZE]; + mList = new ViewHolder[SIZE]; // Insert the first batch of entries. mCursor.moveToFirst(); @@ -168,34 +170,34 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme insertPrivate(NOW, 0); insertPrivate(NOW, 0); insertPrivate(NOW, 0); - View view = mAdapter.newGroupView(getActivity(), mParentView); - mAdapter.bindGroupView(view, getActivity(), mCursor, 3, false); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + mAdapter.onBindViewHolder(viewHolder, /* position */ 0); } @MediumTest public void testCallAndGroupViews_StandAloneView() { mCursor.moveToFirst(); insertPrivate(NOW, 0); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, 0); + bindViewForTest(viewHolder); } @MediumTest public void testCallAndGroupViews_ChildView() { mCursor.moveToFirst(); insertPrivate(NOW, 0); - View view = mAdapter.newChildView(getActivity(), mParentView); - mAdapter.bindChildView(view, getActivity(), mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + mAdapter.onBindViewHolder(viewHolder, /* position */ 0); } @MediumTest public void testBindView_NumberOnlyNoCache() { mCursor.moveToFirst(); insert(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, NOW, 0, Calls.INCOMING_TYPE); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertNameIs(views, TEST_NUMBER); } @@ -206,10 +208,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme Calls.PRESENTATION_ALLOWED, NOW, 0, Calls.INCOMING_TYPE); values[CallLogQuery.CACHED_FORMATTED_NUMBER] = TEST_FORMATTED_NUMBER; insertValues(values); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertNameIs(views, TEST_FORMATTED_NUMBER); } @@ -220,10 +222,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme // {@value com.android.dialer.calllog.ContactInfo#GEOCODE_AS_LABEL} insertWithCachedValues(TEST_NUMBER, NOW, 0, Calls.INCOMING_TYPE, "John Doe", Phone.TYPE_HOME, TEST_DEFAULT_CUSTOM_LABEL); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertNameIs(views, "John Doe"); assertLabel(views, TEST_FORMATTED_NUMBER, getTypeLabel(Phone.TYPE_HOME)); } @@ -233,10 +235,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme mCursor.moveToFirst(); insertWithCachedValues("sip:johndoe@gmail.com", NOW, 0, Calls.INCOMING_TYPE, "John Doe", Phone.TYPE_HOME, TEST_DEFAULT_CUSTOM_LABEL); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertNameIs(views, "John Doe"); assertLabel(views, "sip:johndoe@gmail.com", "sip:johndoe@gmail.com"); } @@ -248,10 +250,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme // {@value com.android.dialer.calllog.ContactInfo#GEOCODE_AS_LABEL} insertWithCachedValues(TEST_NUMBER, NOW, 0, Calls.INCOMING_TYPE, "John Doe", Phone.TYPE_HOME, TEST_DEFAULT_CUSTOM_LABEL); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertNameIs(views, "John Doe"); assertLabel(views, TEST_FORMATTED_NUMBER, getTypeLabel(Phone.TYPE_HOME)); } @@ -263,10 +265,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme // {@link com.android.dialer.calllog.ContactInfo#GEOCODE_AS_LABEL} insertWithCachedValues(TEST_NUMBER, NOW, 0, Calls.INCOMING_TYPE, "John Doe", Phone.TYPE_WORK, TEST_DEFAULT_CUSTOM_LABEL); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertNameIs(views, "John Doe"); assertLabel(views, TEST_FORMATTED_NUMBER, getTypeLabel(Phone.TYPE_WORK)); } @@ -277,10 +279,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme String numberLabel = "My label"; insertWithCachedValues(TEST_NUMBER, NOW, 0, Calls.INCOMING_TYPE, "John Doe", Phone.TYPE_CUSTOM, numberLabel); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertNameIs(views, "John Doe"); assertLabel(views, TEST_FORMATTED_NUMBER, numberLabel); } @@ -290,10 +292,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme mCursor.moveToFirst(); insertWithCachedValues(TEST_NUMBER, NOW, 0, Calls.INCOMING_TYPE, "John Doe", Phone.TYPE_HOME, ""); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertTrue(views.quickContactView.isEnabled()); } @@ -301,10 +303,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme public void testBindView_WithoutQuickContactBadge() { mCursor.moveToFirst(); insert(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, NOW, 0, Calls.INCOMING_TYPE); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; assertFalse(views.quickContactView.isEnabled()); } @@ -312,10 +314,11 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme public void testBindView_CallButton() { mCursor.moveToFirst(); insert(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, NOW, 0, Calls.INCOMING_TYPE); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + mAdapter.changeCursor(mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; // The primaryActionView tag is set in the // {@link com.android.dialer.calllog.CallLogAdapter#bindView} method. If it is possible @@ -333,10 +336,10 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme public void testBindView_PlayButton() { mCursor.moveToFirst(); insertVoicemail(TEST_NUMBER, Calls.PRESENTATION_ALLOWED, NOW, 0); - View view = mAdapter.newStandAloneView(getActivity(), mParentView); - bindViewForTest(view, mCursor); + ViewHolder viewHolder = mAdapter.onCreateViewHolder(mParentView, /* viewType */ 0); + bindViewForTest(viewHolder); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); + CallLogListItemViews views = (CallLogListItemViews) viewHolder; IntentProvider intentProvider = (IntentProvider) views.voicemailButtonView.getTag(); Intent intent = intentProvider.getIntent(mActivity); // Starts the call detail activity. @@ -372,7 +375,7 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme if (null == mList[i]) { break; } - mItem = (CallLogListItemViews) mList[i].getTag(); + mItem = (CallLogListItemViews) mList[i]; int presentation = getPhoneNumberPresentationForListEntry(i); if (presentation == Calls.PRESENTATION_RESTRICTED || presentation == Calls.PRESENTATION_UNKNOWN) { @@ -420,11 +423,12 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme private void buildViewListFromDb() { int i = 0; mCursor.moveToLast(); - while(!mCursor.isBeforeFirst()) { + while (!mCursor.isBeforeFirst()) { if (null == mList[i]) { - mList[i] = mAdapter.newStandAloneView(mActivity, mParentView); + mList[i] = mAdapter.onCreateViewHolder(mParentView, /* itemType */ 0); } - bindViewForTest(mList[i], mCursor); + // Bind to the proper position, despite iterating in reverse. + bindViewForTest(mList[i], mCursor.getCount() - i - 1); mCursor.moveToPrevious(); i++; } @@ -446,12 +450,15 @@ public class CallLogFragmentTest extends ActivityInstrumentationTestCase2<Fragme * unit tests can access the buttons contained within. * * @param view The current call log row. - * @param cursor The cursor to bind from. + * @param position The position of hte item. */ - private void bindViewForTest(View view, MatrixCursor cursor) { - mAdapter.bindView(view, cursor, /* count */ 1); - CallLogListItemViews views = (CallLogListItemViews) view.getTag(); - mAdapter.expandItem(views, /* expand */ true); + private void bindViewForTest(ViewHolder viewHolder, int position) { + mAdapter.onBindViewHolder(viewHolder, position); + mAdapter.expandItem((CallLogListItemViews) viewHolder, /* expand */ true); + } + + private void bindViewForTest(ViewHolder viewHolder) { + bindViewForTest(viewHolder, /* position */ 0); } /** diff --git a/tests/src/com/android/dialer/calllog/GroupingListAdapterTests.java b/tests/src/com/android/dialer/calllog/GroupingListAdapterTests.java index 3eb5f06b1..53583e0a7 100644 --- a/tests/src/com/android/dialer/calllog/GroupingListAdapterTests.java +++ b/tests/src/com/android/dialer/calllog/GroupingListAdapterTests.java @@ -23,6 +23,7 @@ import static com.android.dialer.calllog.GroupingListAdapter.ITEM_TYPE_STANDALON import android.content.Context; import android.database.Cursor; import android.database.MatrixCursor; +import android.support.v7.widget.RecyclerView; import android.test.AndroidTestCase; import android.text.TextUtils; import android.view.View; @@ -34,7 +35,7 @@ import android.view.ViewGroup; * Running all tests: * * adb shell am instrument -e class com.android.dialer.calllog.GroupingListAdapterTests \ - * -w com.google.android.dialer.tests/android.test.InstrumentationTestRunner + * -w com.android.dialer.tests/android.test.InstrumentationTestRunner */ public class GroupingListAdapterTests extends AndroidTestCase { @@ -76,34 +77,22 @@ public class GroupingListAdapterTests extends AndroidTestCase { } @Override - protected void bindChildView(View view, Context context, Cursor cursor) { + public void onContentChanged() { + // Do nothing. } @Override - protected void bindGroupView(View view, Context context, Cursor cursor, int groupSize, - boolean expanded) { - } - - @Override - protected void bindStandAloneView(View view, Context context, Cursor cursor) { - } - - @Override - protected View newChildView(Context context, ViewGroup parent) { + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int position) { return null; } @Override - protected View newGroupView(Context context, ViewGroup parent) { - return null; - } - - @Override - protected View newStandAloneView(Context context, ViewGroup parent) { - return null; + public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { + // Do nothing. } }; + private void buildCursor(String... numbers) { mCursor = new MatrixCursor(PROJECTION); mNextId = 1; @@ -117,7 +106,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { buildCursor("1", "2", "3"); mAdapter.changeCursor(mCursor); - assertEquals(3, mAdapter.getCount()); + assertEquals(3, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 1); assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 2); @@ -127,7 +116,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { buildCursor("1", "1", "2"); mAdapter.changeCursor(mCursor); - assertEquals(2, mAdapter.getCount()); + assertEquals(2, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_GROUP_HEADER, false, 0); assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 2); } @@ -137,7 +126,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.toggleGroup(0); - assertEquals(4, mAdapter.getCount()); + assertEquals(4, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_GROUP_HEADER, true, 0); assertPositionMetadata(1, ITEM_TYPE_IN_GROUP, false, 0); assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1); @@ -150,7 +139,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { mAdapter.toggleGroup(0); mAdapter.toggleGroup(0); - assertEquals(2, mAdapter.getCount()); + assertEquals(2, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_GROUP_HEADER, false, 0); assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 2); } @@ -159,7 +148,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { buildCursor("1", "2", "2", "2", "3"); mAdapter.changeCursor(mCursor); - assertEquals(3, mAdapter.getCount()); + assertEquals(3, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1); assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 4); @@ -170,7 +159,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.toggleGroup(1); - assertEquals(6, mAdapter.getCount()); + assertEquals(6, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, true, 1); assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1); @@ -183,7 +172,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { buildCursor("1", "2", "3", "3", "3"); mAdapter.changeCursor(mCursor); - assertEquals(3, mAdapter.getCount()); + assertEquals(3, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 1); assertPositionMetadata(2, ITEM_TYPE_GROUP_HEADER, false, 2); @@ -194,7 +183,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { mAdapter.changeCursor(mCursor); mAdapter.toggleGroup(2); - assertEquals(6, mAdapter.getCount()); + assertEquals(6, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_STANDALONE, false, 1); assertPositionMetadata(2, ITEM_TYPE_GROUP_HEADER, true, 2); @@ -207,7 +196,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { buildCursor("1", "2", "2", "3", "4", "4", "5", "5", "6"); mAdapter.changeCursor(mCursor); - assertEquals(6, mAdapter.getCount()); + assertEquals(6, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1); assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 3); @@ -225,7 +214,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { // 4th to the 6th position mAdapter.toggleGroup(6); - assertEquals(10, mAdapter.getCount()); + assertEquals(10, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, true, 1); assertPositionMetadata(2, ITEM_TYPE_IN_GROUP, false, 1); @@ -243,7 +232,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { mAdapter.changeCursor(mCursor); // First pass - building up cache - assertEquals(6, mAdapter.getCount()); + assertEquals(6, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1); assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 3); @@ -252,7 +241,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { assertPositionMetadata(5, ITEM_TYPE_STANDALONE, false, 8); // Second pass - using cache - assertEquals(6, mAdapter.getCount()); + assertEquals(6, mAdapter.getItemCount()); assertPositionMetadata(0, ITEM_TYPE_STANDALONE, false, 0); assertPositionMetadata(1, ITEM_TYPE_GROUP_HEADER, false, 1); assertPositionMetadata(2, ITEM_TYPE_STANDALONE, false, 3); @@ -295,7 +284,7 @@ public class GroupingListAdapterTests extends AndroidTestCase { buildCursor(numbers); mAdapter.changeCursor(mCursor); - assertEquals(250, mAdapter.getCount()); + assertEquals(250, mAdapter.getItemCount()); } private void assertPositionMetadata(int position, int itemType, boolean isExpanded, |