Bug 865228 - Slide tabs button all the way off screen (r=mfinkle)

This commit is contained in:
Lucas Rocha 2013-05-01 17:32:01 +01:00
parent 0d25779643
commit 17d4bcd1ff

View File

@ -542,10 +542,14 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
}
}
private int getAwesomeBarAnimTranslation() {
private int getAwesomeBarEntryTranslation() {
return mLayout.getWidth() - mAwesomeBarEntry.getRight();
}
private int getAwesomeBarCurveTranslation() {
return mLayout.getWidth() - mTabs.getLeft();
}
public void fromAwesomeBarSearch(String url) {
// Update the title with the url that was just entered. Don't update the title if
// the AwesomeBar activity was cancelled, or if the user entered an empty string.
@ -568,20 +572,21 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
// Keep the entry highlighted during the animation
mLayout.setSelected(true);
final int translation = getAwesomeBarAnimTranslation();
final int entryTranslation = getAwesomeBarEntryTranslation();
final int curveTranslation = getAwesomeBarCurveTranslation();
proxy = AnimatorProxy.create(mAwesomeBarRightEdge);
proxy.setTranslationX(translation);
proxy.setTranslationX(entryTranslation);
proxy = AnimatorProxy.create(mTabs);
proxy.setTranslationX(translation);
proxy.setTranslationX(curveTranslation);
proxy = AnimatorProxy.create(mTabsCounter);
proxy.setTranslationX(translation);
proxy.setTranslationX(curveTranslation);
proxy = AnimatorProxy.create(mActionItemBar);
proxy.setTranslationX(translation);
proxy.setTranslationX(curveTranslation);
if (mHasSoftMenuButton) {
proxy = AnimatorProxy.create(mMenu);
proxy.setTranslationX(translation);
proxy.setTranslationX(curveTranslation);
}
}
@ -624,7 +629,6 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
contentAnimator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
@Override
public void onPropertyAnimationStart() {
mTabs.setVisibility(View.VISIBLE);
}
@Override
@ -672,7 +676,8 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
final PropertyAnimator contentAnimator = new PropertyAnimator(250);
contentAnimator.setUseHardwareLayer(false);
final int translation = getAwesomeBarAnimTranslation();
final int entryTranslation = getAwesomeBarEntryTranslation();
final int curveTranslation = getAwesomeBarCurveTranslation();
// Keep the entry highlighted during the animation
mLayout.setSelected(true);
@ -706,21 +711,21 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
// Slide the right side elements of the toolbar
contentAnimator.attach(mAwesomeBarRightEdge,
PropertyAnimator.Property.TRANSLATION_X,
translation);
entryTranslation);
contentAnimator.attach(mTabs,
PropertyAnimator.Property.TRANSLATION_X,
translation);
curveTranslation);
contentAnimator.attach(mTabsCounter,
PropertyAnimator.Property.TRANSLATION_X,
translation);
curveTranslation);
contentAnimator.attach(mActionItemBar,
PropertyAnimator.Property.TRANSLATION_X,
translation);
curveTranslation);
if (mHasSoftMenuButton)
contentAnimator.attach(mMenu,
PropertyAnimator.Property.TRANSLATION_X,
translation);
curveTranslation);
contentAnimator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
@Override
@ -729,8 +734,6 @@ public class BrowserToolbar implements Tabs.OnTabsChangedListener,
@Override
public void onPropertyAnimationEnd() {
mTabs.setVisibility(View.INVISIBLE);
// Once the entry is fully expanded, start awesome screen
mActivity.onSearchRequested();
mAnimatingEntry = false;