diff options
author | Yorke Lee <yorkelee@google.com> | 2014-08-05 19:28:34 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-08-06 17:23:22 +0000 |
commit | 49447a9859b6f45dd4eb4cb9302931c725257038 (patch) | |
tree | 56569f027636cf70479619dbc10ced1f1ad761ad /src | |
parent | 005303e4b1da7fff6e7d441c95936b1ba9eaa934 (diff) |
Fix pinned positions handling in Dialer UI
Bug: 16714956
Change-Id: I651056eceb2a10d7228548feedc29c5453230138
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoritesTileAdapter.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index 7814718c2..382e42e56 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -609,11 +609,15 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements final int upperBound = Math.max(oldPos, newPinPos); for (int i = lowerBound; i <= upperBound; i++) { final ContactEntry entry = list.get(i); - if (entry.pinned == i) continue; + + // Pinned positions in the database start from 1 instead of being zero-indexed like + // arrays, so offset by 1. + final int databasePinnedPosition = i + 1; + if (entry.pinned == databasePinnedPosition) continue; final Uri uri = Uri.withAppendedPath(Contacts.CONTENT_URI, String.valueOf(entry.id)); final ContentValues values = new ContentValues(); - values.put(Contacts.PINNED, i); + values.put(Contacts.PINNED, databasePinnedPosition); positions.add(ContentProviderOperation.newUpdate(uri).withValues(values).build()); } return positions; |