diff options
author | Yorke Lee <yorkelee@google.com> | 2014-07-25 21:21:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-24 15:36:51 +0000 |
commit | 3559b44a6331d9ce4e36b9719dfefacf20ec3168 (patch) | |
tree | 39b48ce36c99225cb719b12b9915b024e44f3677 | |
parent | 6ee1cd11ae405e6af97e55ffbf11fbdfde3f8987 (diff) | |
parent | 0a3ad7a81821da5b8f4bde566368f5dbc9889aad (diff) |
Merge "Update the value of PinnedPositions.UNPINNED to 0" into lmp-dev
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoritesTileAdapter.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index 0c4e23eaa..7814718c2 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -107,7 +107,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements /** Indicates whether a drag is in process. */ private boolean mInDragging = false; - public static final int PIN_LIMIT = 20; + // Pinned positions start from 1, so there are a total of 20 maximum pinned contacts + public static final int PIN_LIMIT = 21; /** * The soft limit on how many contact tiles to show. @@ -551,7 +552,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements for (int i = 0; i < length; i++) { final ContactEntry contact = toArrange.get(i); // Decide whether the contact is hidden(demoted), pinned, or unpinned - if (contact.pinned > PIN_LIMIT) { + if (contact.pinned > PIN_LIMIT || contact.pinned == PinnedPositions.UNPINNED) { unpinnedContacts.add(contact); } else if (contact.pinned > PinnedPositions.DEMOTED) { // Demoted or contacts with negative pinned positions are ignored. @@ -565,7 +566,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements final int maxToPin = Math.min(PIN_LIMIT, pinnedQueue.size() + unpinnedContacts.size()); toArrange.clear(); - for (int i = 0; i < maxToPin; i++) { + for (int i = 1; i < maxToPin + 1; i++) { if (!pinnedQueue.isEmpty() && pinnedQueue.peek().pinned <= i) { final ContactEntry toPin = pinnedQueue.poll(); toPin.pinned = i; |