Bug 869411 - Part 2: Replace getPadding() with getTopPadding() in AboutHome. r=lucasr

This commit is contained in:
Brian Nicholson 2013-05-23 11:29:43 -07:00
parent 7e35d62296
commit c6a2e91f5c
2 changed files with 7 additions and 13 deletions

View File

@ -466,7 +466,7 @@ abstract public class BrowserApp extends GeckoApp
if (mLayerView != null) {
mLayerView.getLayerClient().setOnMetricsChangedListener(null);
}
mAboutHome.setPadding(0, 0, 0, 0);
mAboutHome.setTopPadding(0);
if (mBrowserToolbar != null) {
mBrowserToolbar.getLayout().scrollTo(0, 0);
}
@ -742,7 +742,7 @@ abstract public class BrowserApp extends GeckoApp
// When the dynamic toolbar is enabled, set the padding on the
// about:home widget directly - this is to avoid resizing the
// LayerView, which can cause visible artifacts.
mAboutHome.setPadding(0, height, 0, 0);
mAboutHome.setTopPadding(height);
} else {
setToolbarMargin(height);
height = 0;

View File

@ -37,10 +37,7 @@ public class AboutHome extends Fragment {
private LoadCompleteListener mLoadCompleteListener;
private LightweightTheme mLightweightTheme;
private ContentObserver mTabsContentObserver;
private int mPaddingLeft;
private int mPaddingRight;
private int mPaddingTop;
private int mPaddingBottom;
private int mTopPadding;
private AboutHomeView mAboutHomeView;
private AddonsSection mAddonsSection;
private LastTabsSection mLastTabsSection;
@ -113,7 +110,7 @@ public class AboutHome extends Fragment {
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
view.setPadding(0, mTopPadding, 0, 0);
((PromoBox) view.findViewById(R.id.promo_box)).showRandomPromo();
update(AboutHome.UpdateFlags.ALL);
@ -242,18 +239,15 @@ public class AboutHome extends Fragment {
}
}
public void setPadding(int left, int top, int right, int bottom) {
public void setTopPadding(int topPadding) {
View view = getView();
if (view != null) {
view.setPadding(left, top, right, bottom);
view.setPadding(0, topPadding, 0, 0);
}
// If the padding has changed but the view hasn't been created yet,
// store the padding values here; they will be used later in
// onViewCreated().
mPaddingLeft = left;
mPaddingRight = right;
mPaddingTop = top;
mPaddingBottom = bottom;
mTopPadding = topPadding;
}
}