History log of /packages/apps/Dialer/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
18e7fdd55f67e3636c161462cb54e7f5555a04de 09-Sep-2013 Yorke Lee <yorkelee@google.com> Add no contacts view to Dialer

Bug: 10330508
Change-Id: I5f73a63118558e734cd36e681c59f4b82050a49c
/packages/apps/Dialer/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
c36684277aa45085999284bfe71cb8be71b3a464 06-Aug-2013 Yorke Lee <yorkelee@google.com> Rewrite animation logic

* Remove old animation-related code. In the past, animations would be applied to a
view everytime getView was called. This is no longer the case so it fixes the issue of
animations triggering everytime the list was scrolled, dialpad opened, etc.

* Make PhoneFavoriteMergedAdapter (and PhoneFavoritesTileAdapter) return stable IDs, so
that they can be used for animations. The ID schemes are described below:
(N + 1) to -2: CallLogAdapterItems, where N is equal to the number of call log items
-1: All contacts button
0 to (N -1): Rows of tiled contacts, where N is equal to the max rows of tiled contacts
N to infinity: Rows of regular contacts. Their item id is calculated by N + contact_id,
where contact_id is guaranteed to never be negative.

* Perform animations by saving each view's offset before the data set changes, and then
applying a translation animation to them based on their new offsets in the updated list view.
This is the same method described by the framework team at :
http://graphics-geek.blogspot.com/2013/06/devbytes-animating-listview-deletion.html
In our case, we need to perform both horizontal and vertical animations because of the
contact tile favorites.

Bug: 10294203

Change-Id: I3ea4ff9995c539267410a264dbbea5ffa02bc6e3
/packages/apps/Dialer/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java
55f3ec9f882b2389e498ea68f68ce8670c5d4c73 01-Aug-2013 Yorke Lee <yorkelee@google.com> Integrate pinning support with drag and drop UI

* Added the concept of a blank entry. This is used to keep the
rest of the list in place while a contact is being dragged.
Blank entries appear as invisible views for now.

* Added the concept of a DEMOTED contact, which is used to
indicate that a contact should never be displayed in the favorites
list.

* Pinned position management methods and tests
Added two methods to handle assigning of contact positions based
on their pinned positions, as well as reflowing of contacts
when a contact is pinned at a new position.

The assigning of contact positions works as defined below:
1) All contacts with pinned positions are assigned their defined
pinned positions as necessary.
2) If two contacts have been given the same pinned position, they are
ranked based on the order returned from the ContactsProvider (
alphabetical by display name). The second contact is then pushed to
the next position, bumping all corresponding pinned contacts down
by one spot as necessary.
3) If there is a contact with a pinned position that is greater than
the number of starred + frequent contacts (this can happen if user clears
frequents, for example), then it is simply treated as an unpinned contacts.
4) All unpinned contacts flow to fill in the gaps between pinned contacts.

The reflowing of contacts works as defined below:
1) Pinning a contact at a new spot replacing an unpinned contact simply
pins it at that position.
2) Pinning a contact at a new spot where there was already an existing
pinned contact bumps that replaced pinned contact down by one spot
alongside all subsequent pinned contacts as necessary.

I.e. contact A is pinned at position 2.
Before: [A][1][P][P][4][P] After: [0][1][A][P][P][P]

3) If there is no more space at the end of the list to bump the pinned
contacts one spot further, then the replaced pinned contacts will shift
to the left to take the space of the original moved contact.

I.e. contact A is pinned at position 3.
Before: [A][1][P][P][P][P] After: [0][P][P][A][P][P]

* We no longer perform dynamic updates of the in-memory list.
Instead, when a contact is dropped at a new location, the new
positions are sent to the ContactsProvider, which updates the database
and notifies the adapter that there is a new cursor with updated data.
The new list of ContactEntries is then reconstructed from this new cursor.

Note that animation behavior with the newly introduced pinned contacts
is pretty janky looking - Instead of flowing together with the rest of the
unpinned contacts, pinned contacts should remain in position and not animate
on a dataset change. Likewise for empty contacts. In order to support this,
the animation logic will have to be rewritten to take into account
not just soley where the dragged contact was dropped, but also the old and new
position of each and every single contact in the list, before and after
the database refresh.

Change-Id: I5c9542a7fec529f5d965eebe76acbebe1fc10357
/packages/apps/Dialer/tests/src/com/android/dialer/list/PhoneFavoritesTileAdapterTest.java