From 4523236c326b7635bf8a0d72c11ee9da0432c5f8 Mon Sep 17 00:00:00 2001 From: Sriram Ramasubramanian Date: Wed, 27 Feb 2013 14:18:28 -0800 Subject: [PATCH] Bug 846949: Cleanup browser toolbar animation. [r=lucasr] --HG-- extra : rebase_source : ba77407efe264e20a8dfb013ee77def241042a6a --- mobile/android/base/BrowserToolbar.java | 25 +++++++++++-------- .../base/BrowserToolbarBackground.java | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/BrowserToolbar.java b/mobile/android/base/BrowserToolbar.java index 12a36bd55aa6..d3814e2be757 100644 --- a/mobile/android/base/BrowserToolbar.java +++ b/mobile/android/base/BrowserToolbar.java @@ -622,7 +622,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory, barParams.rightMargin = 0; mAddressBarBgCurveTowards = mAddressBarBg.getCurveTowards(); mAddressBarBg.setCurveTowards(BrowserToolbarBackground.CurveTowards.NONE); - mAddressBarBg.requestLayout(); // If we don't have any menu_items, then we simply slide all elements on the // rigth side of the toolbar out of screen. @@ -679,10 +678,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory, proxy.setTranslationX(translation); proxy = AnimatorProxy.create(mTabsCount); proxy.setTranslationX(translation); - proxy = AnimatorProxy.create(mMenu); - proxy.setTranslationX(translation); proxy = AnimatorProxy.create(mActionItemBar); proxy.setTranslationX(translation); + + if (mHasSoftMenuButton) { + proxy = AnimatorProxy.create(mMenu); + proxy.setTranslationX(translation); + } } // Restore opacity of content elements in the toolbar immediatelly @@ -712,13 +714,15 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory, contentAnimator.attach(mTabsCount, PropertyAnimator.Property.TRANSLATION_X, 0); - contentAnimator.attach(mMenu, - PropertyAnimator.Property.TRANSLATION_X, - 0); contentAnimator.attach(mActionItemBar, PropertyAnimator.Property.TRANSLATION_X, 0); + if (mHasSoftMenuButton) + contentAnimator.attach(mMenu, + PropertyAnimator.Property.TRANSLATION_X, + 0); + contentAnimator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() { @Override public void onPropertyAnimationStart() { @@ -739,7 +743,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory, MarginLayoutParams barParams = (MarginLayoutParams) mAddressBarBg.getLayoutParams(); barParams.rightMargin = mAddressBarBgRightMargin; mAddressBarBg.setCurveTowards(mAddressBarBgCurveTowards); - mAddressBarBg.requestLayout(); // If there are action bar items in the toolbar, we have to restore the // alignment of the entry in relation to them. mAwesomeBarParams might @@ -822,13 +825,15 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory, contentAnimator.attach(mTabsCount, PropertyAnimator.Property.TRANSLATION_X, translation); - contentAnimator.attach(mMenu, - PropertyAnimator.Property.TRANSLATION_X, - translation); contentAnimator.attach(mActionItemBar, PropertyAnimator.Property.TRANSLATION_X, translation); + if (mHasSoftMenuButton) + contentAnimator.attach(mMenu, + PropertyAnimator.Property.TRANSLATION_X, + translation); + contentAnimator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() { @Override public void onPropertyAnimationStart() { diff --git a/mobile/android/base/BrowserToolbarBackground.java b/mobile/android/base/BrowserToolbarBackground.java index db783cd92070..8a3fc54c4e15 100644 --- a/mobile/android/base/BrowserToolbarBackground.java +++ b/mobile/android/base/BrowserToolbarBackground.java @@ -119,6 +119,6 @@ public class BrowserToolbarBackground extends GeckoLinearLayout return; mSide = side; - invalidate(); + requestLayout(); } }