From f59250951cf47d81fda125e9bab324d66ed75214 Mon Sep 17 00:00:00 2001 From: Mindy Pereira Date: Tue, 17 Sep 2013 20:32:48 -0700 Subject: Please bring back the nice swipe to dismiss animation. Change-Id: I81efbe3026303c1ef0afb6534734891da74aa4e6 --- .../android/dialer/list/PhoneFavoriteFragment.java | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java index beeb320dd..84bd4b484 100644 --- a/src/com/android/dialer/list/PhoneFavoriteFragment.java +++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java @@ -454,7 +454,31 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen child.animate().alpha(1.0f) .setDuration(mAnimationDuration) .start(); - break; + } else { + Integer startTop = mItemIdTopMap.get(itemId); + final int top = child.getTop(); + if (DEBUG) { + Log.d(TAG, "Found itemId: " + itemId + " for listview child " + i + + " Top: " + top); + } + int delta = 0; + if (startTop != null) { + if (startTop != top) { + delta = startTop - top; + } + } else if (!mItemIdLeftMap.containsKey(itemId)) { + // Animate new views along with the others. The catch is that they did + // not exist in the start state, so we must calculate their starting + // position based on neighboring views. + int childHeight = child.getHeight() + mListView.getDividerHeight(); + startTop = top + (i > 0 ? childHeight : -childHeight); + delta = startTop - top; + } + + if (delta != 0) { + child.setTranslationY(delta); + child.animate().setDuration(mAnimationDuration).translationY(0); + } } } mItemIdTopMap.clear(); -- cgit v1.2.3