diff options
author | Mindy Pereira <mindyp@google.com> | 2013-09-17 20:32:48 -0700 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2013-09-18 08:49:29 -0700 |
commit | f59250951cf47d81fda125e9bab324d66ed75214 (patch) | |
tree | df0fb6d70705b7110caea377aec4c7e49ee128ac | |
parent | f3bee6a83e80b8353dff397dc614bc743ef26df9 (diff) |
Please bring back the nice swipe to dismiss animation.
Change-Id: I81efbe3026303c1ef0afb6534734891da74aa4e6
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoriteFragment.java | 26 |
1 files changed, 25 insertions, 1 deletions
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(); |