Bug 783092: Make the animation ready for Lightweight themes. [r=lucasr, f=mfinkle]

--HG--
extra : rebase_source : e6eac76d57ae7301963a710bb315a43e7e5b178f
This commit is contained in:
Sriram Ramasubramanian 2012-10-31 10:59:46 -07:00
parent bfbabd4190
commit ceca8192c1
2 changed files with 37 additions and 11 deletions

View File

@ -543,7 +543,8 @@ abstract public class BrowserApp extends GeckoApp
else
mTabsPanel.setDrawingCacheEnabled(false);
if (hasTabsSideBar() && mTabsPanel.isShown()) {
if (mTabsPanel.isShown()) {
if (hasTabsSideBar()) {
boolean usingTextureView = mLayerView.shouldUseTextureView();
int leftMargin = (usingTextureView ? 0 : mTabsPanel.getWidth());
@ -552,15 +553,17 @@ abstract public class BrowserApp extends GeckoApp
if (!usingTextureView)
mGeckoLayout.scrollTo(0, 0);
mGeckoLayout.requestLayout();
}
if (!mTabsPanel.isShown()) {
mGeckoLayout.requestLayout();
} else {
mBrowserToolbar.updateTabs(false);
mBrowserToolbar.finishTabsAnimation();
mTabsPanel.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
}
if (hasTabsSideBar())
mBrowserToolbar.adjustTabsAnimation(true);
}
/* Favicon methods */

View File

@ -515,6 +515,9 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
PropertyAnimator.Property.TRANSLATION_X,
width);
// Uses the old mTabsPaneWidth.
adjustTabsAnimation(false);
mTabsPaneWidth = width;
// Only update title padding immediatelly when shrinking the browser
@ -524,6 +527,22 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
setPageActionVisibility(mStop.getVisibility() == View.VISIBLE);
}
public void adjustTabsAnimation(boolean reset) {
int width = reset ? 0 : mTabsPaneWidth;
mAwesomeBarRightEdge.setTranslationX(-width);
mAwesomeBar.setTranslationX(width);
mAddressBarBg.setTranslationX(width);
mTabs.setTranslationX(width);
mTabsCount.setTranslationX(width);
mBack.setTranslationX(width);
mForward.setTranslationX(width);
mTitle.setTranslationX(width);
mFavicon.setTranslationX(width);
mSiteSecurity.setTranslationX(width);
((ViewGroup.MarginLayoutParams) mLayout.getLayoutParams()).leftMargin = reset ? mTabsPaneWidth : 0;
}
public void finishTabsAnimation() {
setPageActionVisibility(mStop.getVisibility() == View.VISIBLE);
}
@ -550,6 +569,10 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mMenu.getBackground().setLevel(TABS_CONTRACTED);
}
}
// A level change will not trigger onMeasure() for the tabs, where the path is created.
// Manually requesting a layout to re-calculate the path.
mTabs.requestLayout();
}
public void setProgressVisibility(boolean visible) {
@ -582,7 +605,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
// We want title to fill the whole space available for it when there are icons
// being shown on the right side of the toolbar as the icons already have some
// padding in them. This is just to avoid wasting space when icons are shown.
mTitle.setPadding(0, 0, (!mShowReader && !isLoading ? mTitlePadding : 0) + mTabsPaneWidth, 0);
mTitle.setPadding(0, 0, (!mShowReader && !isLoading ? mTitlePadding : 0), 0);
updateFocusOrder();
}