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 | |
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')
-rw-r--r-- | src/com/android/browser/BaseUi.java | 10 | ||||
-rw-r--r-- | src/com/android/browser/NavigationBarTablet.java | 41 | ||||
-rw-r--r-- | src/com/android/browser/UI.java | 2 |
3 files changed, 40 insertions, 13 deletions
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index e3f5986..cfe9a53 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -113,6 +113,7 @@ public abstract class BaseUi implements UI { protected TitleBar mTitleBar; private NavigationBarBase mNavigationBar; protected PieControl mPieControl; + private boolean mBlockFocusAnimations; public BaseUi(Activity browser, UiController controller) { mActivity = browser; @@ -264,6 +265,8 @@ public abstract class BaseUi implements UI { @Override public void setActiveTab(final Tab tab) { if (tab == null) return; + // block unnecessary focus change animations during tab switch + mBlockFocusAnimations = true; mHandler.removeMessages(MSG_HIDE_TITLEBAR); if ((tab != mActiveTab) && (mActiveTab != null)) { removeTabFromContentView(mActiveTab); @@ -294,6 +297,7 @@ public abstract class BaseUi implements UI { onProgressChanged(tab); mNavigationBar.setIncognitoMode(tab.isPrivateBrowsingEnabled()); updateAutoLogin(tab, false); + mBlockFocusAnimations = false; } protected void updateUrlBarAutoShowManagerTarget() { @@ -860,4 +864,10 @@ public abstract class BaseUi implements UI { mContentView.setLayoutParams(params); } } + + @Override + public boolean blockFocusAnimations() { + return mBlockFocusAnimations; + } + } 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) { diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java index aeab746..96f6640 100644 --- a/src/com/android/browser/UI.java +++ b/src/com/android/browser/UI.java @@ -146,4 +146,6 @@ public interface UI { public boolean shouldCaptureThumbnails(); + boolean blockFocusAnimations(); + } |