Bug 853497 - Remove spacer view from gecko_app.xml (r=cwiiis)

This commit is contained in:
Lucas Rocha 2013-03-22 10:26:26 +00:00
Родитель b7021f1391
Коммит 4c0b89b72e
2 изменённых файлов: 16 добавлений и 19 удалений

Просмотреть файл

@ -110,10 +110,6 @@ abstract public class BrowserApp extends GeckoApp
// Whether the dynamic toolbar pref is enabled.
private boolean mDynamicToolbarEnabled = false;
// The widget used to push the LayerView below the address bar when the
// toolbar is disabled.
private View mToolbarSpacer = null;
// The last recorded touch event from onInterceptTouchEvent. These are
// not updated until the movement threshold has been exceeded.
private float mLastTouchX = 0.0f;
@ -439,8 +435,6 @@ abstract public class BrowserApp extends GeckoApp
super.onCreate(savedInstanceState);
mToolbarSpacer = findViewById(R.id.toolbar_spacer);
LinearLayout actionBar = (LinearLayout) getActionBarLayout();
mMainLayout.addView(actionBar, 2);
@ -498,7 +492,7 @@ abstract public class BrowserApp extends GeckoApp
@Override
public void run() {
if (mDynamicToolbarEnabled) {
mToolbarSpacer.setPadding(0, 0, 0, 0);
setToolbarMargin(0);
} else {
// Immediately show the toolbar when disabling the dynamic
// toolbar.
@ -601,6 +595,16 @@ abstract public class BrowserApp extends GeckoApp
mLayerView.setOnKeyListener(this);
}
private void setSidebarMargin(int margin) {
((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).leftMargin = margin;
mGeckoLayout.requestLayout();
}
private void setToolbarMargin(int margin) {
((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).topMargin = margin;
mGeckoLayout.requestLayout();
}
public void setToolbarHeight(int aHeight, int aVisibleHeight) {
if (!mDynamicToolbarEnabled || Boolean.TRUE.equals(mAboutHomeShowing)) {
// Use aVisibleHeight here so that when the dynamic toolbar is
@ -612,11 +616,11 @@ abstract public class BrowserApp extends GeckoApp
// LayerView, which can cause visible artifacts.
mAboutHomeContent.setPadding(0, aVisibleHeight, 0, 0);
} else {
mToolbarSpacer.setPadding(0, aVisibleHeight, 0, 0);
setToolbarMargin(aVisibleHeight);
}
aHeight = aVisibleHeight = 0;
} else {
mToolbarSpacer.setPadding(0, 0, 0, 0);
setToolbarMargin(0);
}
// Update the Gecko-side global for fixed viewport margins.
@ -757,9 +761,7 @@ abstract public class BrowserApp extends GeckoApp
}
mBrowserToolbar.adjustForTabsLayout(width);
((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).setMargins(width, 0, 0, 0);
mGeckoLayout.requestLayout();
setSidebarMargin(width);
}
if (changed) {
@ -987,9 +989,8 @@ abstract public class BrowserApp extends GeckoApp
// Set the gecko layout for sliding.
if (!mTabsPanel.isShown()) {
((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).setMargins(0, 0, 0, 0);
mGeckoLayout.scrollTo(mTabsPanel.getWidth() * -1, 0);
mGeckoLayout.requestLayout();
setSidebarMargin(0);
}
mMainLayoutAnimator.attach(mGeckoLayout,
@ -1036,7 +1037,7 @@ abstract public class BrowserApp extends GeckoApp
if (mTabsPanel.isShown()) {
if (hasTabsSideBar()) {
((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).setMargins(mTabsPanel.getWidth(), 0, 0, 0);
setSidebarMargin(mTabsPanel.getWidth());
mGeckoLayout.scrollTo(0, 0);
}

Просмотреть файл

@ -19,10 +19,6 @@
<!-- BrowserToolbar will be added dynamically -->
<FrameLayout android:id="@+id/toolbar_spacer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<RelativeLayout android:id="@+id/gecko_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"