summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-04-18 14:05:01 -0700
committerYorke Lee <yorkelee@google.com>2014-04-21 15:27:32 -0700
commitefb2d9c2e32ca4ed434ff785c4b3d18c9e08db6d (patch)
treece2311920dedaebf8abaa33f139e21502ffd4c5b /tests
parent93dcef71c7ea7a99ef4067ab3dea79a263b9613b (diff)
downloadandroid_packages_apps_Dialer-efb2d9c2e32ca4ed434ff785c4b3d18c9e08db6d.tar.gz
android_packages_apps_Dialer-efb2d9c2e32ca4ed434ff785c4b3d18c9e08db6d.tar.bz2
android_packages_apps_Dialer-efb2d9c2e32ca4ed434ff785c4b3d18c9e08db6d.zip
Use PhoneFavoritesTileAdapter directly in GridView
This CL moves the adapter that contains the speed dial contacts into its own GridView that lives in PhoneFavoritesFragment. This is the first step to splitting up PhoneFavoritesMergedAdapter into a list of shortcuts and a grid of contacts, and also get rid of the convoluted ContactTileRow logic within PhoneFavoritesTileAdapter, to facilitate a future transition to RecyclerView. * PhoneFavoritesTileAdapter now directly returns PhoneFavoriteTileViews rather than ContactTileRows. * Deleted a lot of unnecessary complicated logic within PhoneFavoritesTileAdapter that had to do with ContactTileRows. * Simplified and rewrote animation logic so that animations now perform as expected within the GridView. In the future this may not be necessary if RecyclerView is used. * Rewrote layout/measurement logic for PhoneFavoriteTileView. It now determines its height directly based on what its measured width is. * Replaced PhoneFavoritesListView in PhoneFavoriteFragment with a standard GridView * Delete stale PhoneFavoriteTileAdapter tests Notes: Call shortcut cards are now temporarily missing due to this change Bug: 13963734 Bug: 13933092 Bug: 13419223 Change-Id: I71e8970667589e4024d00e9af2c8b45c843c5db1
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java69
1 files changed, 0 insertions, 69 deletions
diff --git a/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java b/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
index 7a2076d8e..c2069bda7 100644
--- a/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
+++ b/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
@@ -53,75 +53,6 @@ public class PhoneFavoritesTileAdapterTest extends AndroidTestCase {
}
- public void testGetRowIndex_NoRowLimit() {
- mAdapter = getAdapterForTest(2, PhoneFavoritesTileAdapter.NO_ROW_LIMIT);
- assertEquals(0, mAdapter.getRowCount(0));
- assertEquals(1, mAdapter.getRowCount(1));
- assertEquals(1, mAdapter.getRowCount(2));
- assertEquals(2, mAdapter.getRowCount(4));
- assertEquals(4, mAdapter.getRowCount(7));
- assertEquals(100, mAdapter.getRowCount(199));
-
- mAdapter = getAdapterForTest(5, PhoneFavoritesTileAdapter.NO_ROW_LIMIT);
- assertEquals(0, mAdapter.getRowCount(0));
- assertEquals(1, mAdapter.getRowCount(1));
- assertEquals(1, mAdapter.getRowCount(3));
- assertEquals(1, mAdapter.getRowCount(5));
- assertEquals(2, mAdapter.getRowCount(7));
- assertEquals(2, mAdapter.getRowCount(10));
- assertEquals(40, mAdapter.getRowCount(199));
- }
-
- public void testGetItemId_NoRowLimit() {
- mAdapter = getAdapterForTest(2, PhoneFavoritesTileAdapter.NO_ROW_LIMIT);
- assertEquals(0, mAdapter.getItemId(0));
- assertEquals(1, mAdapter.getItemId(1));
- assertEquals(5, mAdapter.getItemId(5));
- assertEquals(10, mAdapter.getItemId(10));
- }
-
- public void testGetAdjustedItemId_NoRowLimit() {
- mAdapter = getAdapterForTest(2, PhoneFavoritesTileAdapter.NO_ROW_LIMIT);
- assertEquals(0, mAdapter.getAdjustedItemId(0));
- assertEquals(1, mAdapter.getAdjustedItemId(1));
- assertEquals(5, mAdapter.getAdjustedItemId(5));
- assertEquals(10, mAdapter.getAdjustedItemId(10));
- }
-
- public void testGetItem_NoRowLimit() {
- mAdapter = getAdapterForTest(2, PhoneFavoritesTileAdapter.NO_ROW_LIMIT);
- mAdapter.setContactCursor(getCursorForTest(5, 5));
-
- final ArrayList<ContactEntry> row1 = new ArrayList<ContactEntry> ();
- row1.add(getTestContactEntry(0, true));
- row1.add(getTestContactEntry(1, true));
- assertContactEntryRowsEqual(row1, mAdapter.getItem(0));
-
- final ArrayList<ContactEntry> row3 = new ArrayList<ContactEntry> ();
- row3.add(getTestContactEntry(4, true));
- row3.add(getTestContactEntry(5, false));
- assertContactEntryRowsEqual(row3, mAdapter.getItem(2));
-
- final ArrayList<ContactEntry> row5 = new ArrayList<ContactEntry> ();
- row5.add(getTestContactEntry(8, false));
- row5.add(getTestContactEntry(9, false));
- assertContactEntryRowsEqual(row5, mAdapter.getItem(4));
- }
-
- /**
- * Ensures that PhoneFavoritesTileAdapter returns true for hasStableIds. This is needed for
- * animation purposes.
- */
- public void testHasStableIds() {
- mAdapter = new PhoneFavoritesTileAdapter(getContext(), null, null, 2, 2);
- assertTrue(mAdapter.hasStableIds());
- }
-
- private PhoneFavoritesTileAdapter getAdapterForTest(int numCols, int numRows) {
- return new PhoneFavoritesTileAdapter(getContext(), null,
- sOnDataSetChangedForAnimationListener, numCols, numRows);
- }
-
/**
* Returns a cursor containing starred and frequent contacts for test purposes.
*