diff options
author | Andrew Lee <anwlee@google.com> | 2014-05-15 02:16:04 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-05-15 10:43:10 -0700 |
commit | 2a58ab88d23238f252d5ccc6a6798f58b0e9ef56 (patch) | |
tree | 74ed9fc626ab1a539c99cfc0d9d08efe7c0d878d /src/com/android/dialer/dialpad/DialpadFragment.java | |
parent | 64b8e8af3f24b07baff1942f4723af4269d56b9d (diff) |
Cleanup dialpad show/hide logic.
This is the first step in cleaning up the DialtactsActivity logic to
make it easier to transition between different states, and handle
the states in between (hopefully).
Originally, I thought to also block show/hide actions if there was
already a dialpad transition in progress, but in the end I did not
do this because it made the UI seem unresponsive.
- Delete custom predraw listener in DialpadFragment; it doesn't
appear to be used (?) and made the animation logic more confusing.
- Replace the fragment custom animations with our own animations,
which seem to perform better.
- Changed the animation xmls from objectAnimators to translates.
- Replaced isDialpadShowing with uses of mIsDialpadShown.
- Reorder show/hide logic. Now it is less parallel, but better
reflects the ordering/nature of fragment transactions.
- Reorder some methods to group them more logically.
- Pull out a helper method for updating the search fragment's
yTranslation.
- Pull out a helper method for updating the floating action bar.
- Delete predraw method in DialpadFragment; doesn't appear to be
used and caused.
Bug: 14900155
Change-Id: I768324b2293622ea43974f7f566eec9b11fb0d4e
Diffstat (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java')
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 4557bd4b1..418d54a20 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -347,29 +347,6 @@ public class DialpadFragment extends Fragment false); fragmentView.buildLayer(); - final ViewTreeObserver vto = fragmentView.getViewTreeObserver(); - // Adjust the translation of the DialpadFragment in a preDrawListener instead of in - // DialtactsActivity, because at the point in time when the DialpadFragment is added, - // its views have not been laid out yet. - final OnPreDrawListener preDrawListener = new OnPreDrawListener() { - - @Override - public boolean onPreDraw() { - - if (isHidden()) return true; - if (mAnimate && fragmentView.getTranslationY() == 0) { - ((DialpadSlidingLinearLayout) fragmentView).setYFraction( - DIALPAD_SLIDE_FRACTION); - } - final ViewTreeObserver vto = fragmentView.getViewTreeObserver(); - vto.removeOnPreDrawListener(this); - return true; - } - - }; - - vto.addOnPreDrawListener(preDrawListener); - Resources r = getResources(); mDialpadView = (DialpadView) fragmentView.findViewById(R.id.dialpad_view); @@ -1593,9 +1570,7 @@ public class DialpadFragment extends Fragment final DialtactsActivity activity = (DialtactsActivity) getActivity(); final DialpadView dialpadView = (DialpadView) getView().findViewById(R.id.dialpad_view); if (activity == null) return; - if (hidden) { - activity.onDialpadHidden(); - } else { + if (!hidden) { if (mAnimate) { dialpadView.animateShow(); } @@ -1608,6 +1583,10 @@ public class DialpadFragment extends Fragment mAnimate = value; } + public boolean getAnimate() { + return mAnimate; + } + public void setYFraction(float yFraction) { ((DialpadSlidingLinearLayout) getView()).setYFraction(yFraction); } |