diff options
author | Michael Kolb <kolby@google.com> | 2012-05-29 11:15:27 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2012-05-29 11:15:27 -0700 |
commit | bae0cb200f6ad93ce61c5781100f4b6ac0cb6649 (patch) | |
tree | 7904c5c9bce82e3986b55f34ee923b6d1a64f54f /src/com/android/browser/NavigationBarTablet.java | |
parent | 070a0c79c3c6498c2b05c9ad1f4c93b13c46382c (diff) | |
download | packages_apps_Browser-bae0cb200f6ad93ce61c5781100f4b6ac0cb6649.zip packages_apps_Browser-bae0cb200f6ad93ce61c5781100f4b6ac0cb6649.tar.gz packages_apps_Browser-bae0cb200f6ad93ce61c5781100f4b6ac0cb6649.tar.bz2 |
tighten nav bar layout & fix animation bug
Bug: 6563289
Change-Id: I00fdecf645128bb1fec8e23be94aa2b85fb586f7
Diffstat (limited to 'src/com/android/browser/NavigationBarTablet.java')
-rw-r--r-- | src/com/android/browser/NavigationBarTablet.java | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java index b9c86e3..426174b 100644 --- a/src/com/android/browser/NavigationBarTablet.java +++ b/src/com/android/browser/NavigationBarTablet.java @@ -259,34 +259,49 @@ public class NavigationBarTablet extends NavigationBarBase { mStopButton.setContentDescription(mRefreshDescription); } + private AnimatorSet mAnimation; + private void hideNavButtons() { + if (mBaseUi.blockFocusAnimations()) { + mNavButtons.setVisibility(View.GONE); + return; + } int awidth = mNavButtons.getMeasuredWidth(); Animator anim1 = ObjectAnimator.ofFloat(mNavButtons, View.TRANSLATION_X, 0, - awidth); Animator anim2 = ObjectAnimator.ofInt(mUrlContainer, "left", mUrlContainer.getLeft(), mUrlContainer.getPaddingLeft()); Animator anim3 = ObjectAnimator.ofFloat(mNavButtons, View.ALPHA, 1f, 0f); - AnimatorSet combo = new AnimatorSet(); - combo.playTogether(anim1, anim2, anim3); - combo.addListener(new AnimatorListenerAdapter() { + mAnimation = new AnimatorSet(); + mAnimation.playTogether(anim1, anim2, anim3); + mAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mNavButtons.setVisibility(View.GONE); + mAnimation = null; } }); - combo.setDuration(150); - combo.start(); + mAnimation.setDuration(150); + mAnimation.start(); } private void showNavButtons() { - int awidth = mNavButtons.getMeasuredWidth(); - Animator anim1 = ObjectAnimator.ofFloat(mNavButtons, View.TRANSLATION_X, -awidth, 0); - Animator anim2 = ObjectAnimator.ofInt(mUrlContainer, "left", 0, awidth); - Animator anim3 = ObjectAnimator.ofFloat(mNavButtons, View.ALPHA, 0f, 1f); - AnimatorSet combo = new AnimatorSet(); - combo.playTogether(anim1, anim2, anim3); + if (mAnimation != null) { + mAnimation.cancel(); + } mNavButtons.setVisibility(View.VISIBLE); - combo.setDuration(150); - combo.start(); + if (!mBaseUi.blockFocusAnimations()) { + int awidth = mNavButtons.getMeasuredWidth(); + Animator anim1 = ObjectAnimator.ofFloat(mNavButtons, + View.TRANSLATION_X, -awidth, 0); + Animator anim2 = ObjectAnimator.ofInt(mUrlContainer, "left", 0, + awidth); + Animator anim3 = ObjectAnimator.ofFloat(mNavButtons, View.ALPHA, + 0f, 1f); + AnimatorSet combo = new AnimatorSet(); + combo.playTogether(anim1, anim2, anim3); + combo.setDuration(150); + combo.start(); + } } private void showHideStar(Tab tab) { |