From c1e769c16792a880ac803b912851d6d258ed4550 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Thu, 1 Aug 2013 14:30:57 -0700 Subject: Fix PhoneFavoritesTileAdapter.getCount() getCount() was reporting an incorrect length when the number of entries is less than mColumnCount * mMaxTiledRows Change-Id: I4504b200c938f4bf1a230fc4c2f1bf06ebc5128c --- src/com/android/dialer/list/PhoneFavoritesTileAdapter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/com/android') diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index 91ad110f2..992cb1f08 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -276,13 +276,16 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter { @Override public int getCount() { - if (mContactEntries == null) { + if (mContactEntries == null || mContactEntries.isEmpty()) { return 0; } int total = mContactEntries.size(); - - return total - (mMaxTiledRows * (mColumnCount - 1)); + // The number of contacts that don't show up as tiles + final int nonTiledRows = Math.max(0, total - getMaxContactsInTiles()); + // The number of tiled rows + final int tiledRows = getRowCount(total - nonTiledRows); + return nonTiledRows + tiledRows; } public int getMaxTiledRows() { -- cgit v1.2.3