summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-08-01 14:30:57 -0700
committerYorke Lee <yorkelee@google.com>2013-08-01 14:31:53 -0700
commitc1e769c16792a880ac803b912851d6d258ed4550 (patch)
tree827a5144a1ac2ae550259c8336f5ff8a69875fe2 /src/com/android
parent01f15ad65dfbc72d7c8f165bda8e602ba287b434 (diff)
Fix PhoneFavoritesTileAdapter.getCount()
getCount() was reporting an incorrect length when the number of entries is less than mColumnCount * mMaxTiledRows Change-Id: I4504b200c938f4bf1a230fc4c2f1bf06ebc5128c
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java9
1 files changed, 6 insertions, 3 deletions
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() {