mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1058909 - Part 3: Adjust new tablet browser_toolbar spacing. r=lucasr
This commit is contained in:
parent
de8b90d6cf
commit
5c2595748d
@ -7,6 +7,7 @@ package org.mozilla.gecko.menu;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.mozilla.gecko.AppConstants.Versions;
|
import org.mozilla.gecko.AppConstants.Versions;
|
||||||
|
import org.mozilla.gecko.NewTabletUI;
|
||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
@ -126,13 +127,20 @@ public class GeckoMenuInflater extends MenuInflater {
|
|||||||
item.id = a.getResourceId(R.styleable.MenuItem_android_id, NO_ID);
|
item.id = a.getResourceId(R.styleable.MenuItem_android_id, NO_ID);
|
||||||
item.order = a.getInt(R.styleable.MenuItem_android_orderInCategory, 0);
|
item.order = a.getInt(R.styleable.MenuItem_android_orderInCategory, 0);
|
||||||
item.title = a.getText(R.styleable.MenuItem_android_title);
|
item.title = a.getText(R.styleable.MenuItem_android_title);
|
||||||
item.iconRes = a.getResourceId(R.styleable.MenuItem_android_icon, 0);
|
|
||||||
item.checkable = a.getBoolean(R.styleable.MenuItem_android_checkable, false);
|
item.checkable = a.getBoolean(R.styleable.MenuItem_android_checkable, false);
|
||||||
item.checked = a.getBoolean(R.styleable.MenuItem_android_checked, false);
|
item.checked = a.getBoolean(R.styleable.MenuItem_android_checked, false);
|
||||||
item.visible = a.getBoolean(R.styleable.MenuItem_android_visible, true);
|
item.visible = a.getBoolean(R.styleable.MenuItem_android_visible, true);
|
||||||
item.enabled = a.getBoolean(R.styleable.MenuItem_android_enabled, true);
|
item.enabled = a.getBoolean(R.styleable.MenuItem_android_enabled, true);
|
||||||
item.hasSubMenu = false;
|
item.hasSubMenu = false;
|
||||||
|
|
||||||
|
// TODO: (bug 1058909) Remove this branch when we remove old tablet. We do this to
|
||||||
|
// avoid using a new menu resource for new tablet (which only has a new reload button).
|
||||||
|
if (item.id == R.id.reload && NewTabletUI.isEnabled(mContext)) {
|
||||||
|
item.iconRes = R.drawable.new_tablet_ic_menu_reload;
|
||||||
|
} else {
|
||||||
|
item.iconRes = a.getResourceId(R.styleable.MenuItem_android_icon, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (Versions.feature11Plus) {
|
if (Versions.feature11Plus) {
|
||||||
item.showAsAction = a.getInt(R.styleable.MenuItem_android_showAsAction, 0);
|
item.showAsAction = a.getInt(R.styleable.MenuItem_android_showAsAction, 0);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
|
||||||
|
<level-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:gecko="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item android:maxLevel="1">
|
||||||
|
|
||||||
|
<selector>
|
||||||
|
|
||||||
|
<item gecko:state_private="true" android:drawable="@drawable/menu_pb"/>
|
||||||
|
<item android:drawable="@drawable/new_tablet_menu"/>
|
||||||
|
|
||||||
|
</selector>
|
||||||
|
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item android:maxLevel="2" android:drawable="@android:color/transparent"/>
|
||||||
|
|
||||||
|
</level-list>
|
@ -73,7 +73,7 @@
|
|||||||
style="@style/UrlBar.Button.Container"
|
style="@style/UrlBar.Button.Container"
|
||||||
android:layout_toRightOf="@id/back"
|
android:layout_toRightOf="@id/back"
|
||||||
android:layout_toLeftOf="@id/menu_items"
|
android:layout_toLeftOf="@id/menu_items"
|
||||||
android:paddingLeft="8dip"
|
android:paddingLeft="12dip"
|
||||||
android:paddingRight="8dip"/>
|
android:paddingRight="8dip"/>
|
||||||
|
|
||||||
<LinearLayout android:id="@id/menu_items"
|
<LinearLayout android:id="@id/menu_items"
|
||||||
|
@ -6,15 +6,14 @@
|
|||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:gecko="http://schemas.android.com/apk/res-auto">
|
xmlns:gecko="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<!-- In editing mode, the toolbar shrinks by changing to
|
|
||||||
dynamically constructed LayoutParams. -->
|
|
||||||
<ImageView android:id="@+id/url_bar_entry"
|
<ImageView android:id="@+id/url_bar_entry"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignLeft="@+id/back"
|
||||||
android:layout_toLeftOf="@id/menu_items"
|
android:layout_toLeftOf="@id/menu_items"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="@dimen/back_button_width_half"
|
||||||
android:layout_marginTop="7dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginBottom="7dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:duplicateParentState="true"
|
android:duplicateParentState="true"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
@ -22,17 +21,16 @@
|
|||||||
|
|
||||||
<org.mozilla.gecko.toolbar.ForwardButton style="@style/UrlBar.ImageButton.Forward"
|
<org.mozilla.gecko.toolbar.ForwardButton style="@style/UrlBar.ImageButton.Forward"
|
||||||
android:id="@+id/forward"
|
android:id="@+id/forward"
|
||||||
android:layout_alignLeft="@id/url_bar_entry"/>
|
android:layout_alignLeft="@id/back"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.toolbar.BackButton android:id="@+id/back"
|
<org.mozilla.gecko.toolbar.BackButton android:id="@id/back"
|
||||||
style="@style/UrlBar.ImageButton"
|
style="@style/UrlBar.ImageButton"
|
||||||
android:layout_width="50dip"
|
android:layout_width="@dimen/back_button_width"
|
||||||
android:layout_height="50dip"
|
android:layout_height="@dimen/back_button_width"
|
||||||
android:layout_marginLeft="-15dp"
|
|
||||||
android:layout_alignLeft="@id/url_bar_entry"
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:padding="13dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:src="@drawable/ic_menu_back"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:src="@drawable/new_tablet_ic_menu_back"
|
||||||
android:contentDescription="@string/back"
|
android:contentDescription="@string/back"
|
||||||
android:background="@drawable/url_bar_nav_button"/>
|
android:background="@drawable/url_bar_nav_button"/>
|
||||||
|
|
||||||
@ -52,53 +50,50 @@
|
|||||||
style="@style/UrlBar.Button.Container"
|
style="@style/UrlBar.Button.Container"
|
||||||
android:layout_toRightOf="@id/back"
|
android:layout_toRightOf="@id/back"
|
||||||
android:layout_toLeftOf="@id/menu_items"
|
android:layout_toLeftOf="@id/menu_items"
|
||||||
android:paddingLeft="8dip"
|
android:paddingLeft="6dip"
|
||||||
android:paddingRight="4dip"/>
|
android:paddingRight="4dip"/>
|
||||||
|
|
||||||
|
<!-- TODO: The reload asset is too small (bug 1072466) so we have white-space above and below the menu item.
|
||||||
|
We add marginTop to center and compensate: remove this when the final asset is added. -->
|
||||||
<LinearLayout android:id="@+id/menu_items"
|
<LinearLayout android:id="@+id/menu_items"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginLeft="6dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_toLeftOf="@id/tabs"
|
android:layout_toLeftOf="@id/tabs"/>
|
||||||
android:layout_alignWithParentIfMissing="true"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.widget.ThemedImageButton android:id="@+id/tabs"
|
<org.mozilla.gecko.widget.ThemedImageButton
|
||||||
|
android:id="@+id/tabs"
|
||||||
style="@style/UrlBar.ImageButton"
|
style="@style/UrlBar.ImageButton"
|
||||||
android:layout_width="56dip"
|
|
||||||
android:layout_toLeftOf="@id/menu"
|
android:layout_toLeftOf="@id/menu"
|
||||||
android:background="@drawable/action_bar_button"/>
|
android:background="@drawable/action_bar_button"/>
|
||||||
|
|
||||||
<!-- The TextSwitcher should be shifted 28dp on the right, to avoid
|
<!-- In a 56dp space, centering 24dp image will leave 16dp on the horizontal sides. -->
|
||||||
the curve. On a 56dp space, centering 24dp image will leave
|
|
||||||
16dp on all sides. However this image has a perception of
|
|
||||||
2 layers. Hence to center this, an additional 4dp is added to the right.
|
|
||||||
The margins will be 12dp on left, 48dp on right, instead of ideal 16dp
|
|
||||||
and 44dp. -->
|
|
||||||
<org.mozilla.gecko.toolbar.TabCounter android:id="@+id/tabs_counter"
|
<org.mozilla.gecko.toolbar.TabCounter android:id="@+id/tabs_counter"
|
||||||
style="@style/UrlBar.ImageButton.TabCount.NewTablet"
|
style="@style/UrlBar.ImageButton.TabCount.NewTablet"
|
||||||
android:layout_width="24dip"
|
|
||||||
android:layout_height="24dip"
|
|
||||||
android:layout_margin="16dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_alignLeft="@id/tabs"
|
android:layout_alignLeft="@id/tabs"
|
||||||
android:layout_alignRight="@id/tabs"
|
android:layout_alignRight="@id/tabs"
|
||||||
|
android:layout_alignTop="@id/tabs"
|
||||||
|
android:layout_alignBottom="@id/tabs"
|
||||||
|
android:layout_margin="16dp"
|
||||||
gecko:layout="@layout/new_tablet_tabs_counter"/>
|
gecko:layout="@layout/new_tablet_tabs_counter"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.widget.ThemedImageButton android:id="@+id/menu"
|
<org.mozilla.gecko.widget.ThemedImageButton
|
||||||
|
android:id="@+id/menu"
|
||||||
style="@style/UrlBar.ImageButton"
|
style="@style/UrlBar.ImageButton"
|
||||||
android:layout_width="56dip"
|
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginRight="6dp"
|
||||||
android:contentDescription="@string/menu"
|
android:contentDescription="@string/menu"
|
||||||
android:background="@drawable/action_bar_button"
|
android:background="@drawable/action_bar_button"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.widget.ThemedImageView android:id="@+id/menu_icon"
|
<org.mozilla.gecko.widget.ThemedImageView
|
||||||
|
android:id="@+id/menu_icon"
|
||||||
style="@style/UrlBar.ImageButton"
|
style="@style/UrlBar.ImageButton"
|
||||||
android:layout_alignLeft="@id/menu"
|
android:layout_alignLeft="@id/menu"
|
||||||
android:layout_alignRight="@id/menu"
|
android:layout_alignRight="@id/menu"
|
||||||
android:gravity="center_vertical"
|
android:src="@drawable/new_tablet_menu_level"
|
||||||
android:src="@drawable/menu_level"
|
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<!-- We draw after the menu items so when they are hidden, the cancel button,
|
<!-- We draw after the menu items so when they are hidden, the cancel button,
|
||||||
|
@ -103,7 +103,7 @@
|
|||||||
style="@style/UrlBar.Button"
|
style="@style/UrlBar.Button"
|
||||||
android:layout_alignLeft="@id/url_bar_entry"
|
android:layout_alignLeft="@id/url_bar_entry"
|
||||||
android:layout_alignRight="@id/url_bar_entry"
|
android:layout_alignRight="@id/url_bar_entry"
|
||||||
android:paddingLeft="4dip"
|
android:paddingLeft="8dip"
|
||||||
android:paddingRight="4dip"/>
|
android:paddingRight="4dip"/>
|
||||||
|
|
||||||
</merge>
|
</merge>
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
android:id="@+id/browser_toolbar"
|
android:id="@+id/browser_toolbar"
|
||||||
style="@style/BrowserToolbar"
|
style="@style/BrowserToolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/browser_toolbar_height"
|
android:layout_height="match_parent"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:background="@drawable/url_bar_bg"/>
|
android:background="@drawable/url_bar_bg"/>
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
style="@style/UrlBar.ImageButton"
|
style="@style/UrlBar.ImageButton"
|
||||||
android:layout_width="@dimen/browser_toolbar_favicon_size"
|
android:layout_width="@dimen/browser_toolbar_favicon_size"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:paddingLeft="4dip"
|
|
||||||
android:paddingRight="4dip"
|
android:paddingRight="4dip"
|
||||||
android:layout_gravity="center_vertical"/>
|
android:layout_gravity="center_vertical"/>
|
||||||
|
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
|
|
||||||
<dimen name="browser_toolbar_height">56dp</dimen>
|
<dimen name="browser_toolbar_height">56dp</dimen>
|
||||||
<dimen name="browser_toolbar_button_padding">16dp</dimen>
|
<dimen name="browser_toolbar_button_padding">16dp</dimen>
|
||||||
|
|
||||||
|
<!-- If you update one of these values, update the other. -->
|
||||||
|
<dimen name="back_button_width">42dp</dimen>
|
||||||
|
<dimen name="back_button_width_half">21dp</dimen>
|
||||||
|
|
||||||
<dimen name="tabs_counter_size">26sp</dimen>
|
<dimen name="tabs_counter_size">26sp</dimen>
|
||||||
<dimen name="panel_grid_view_column_width">200dp</dimen>
|
<dimen name="panel_grid_view_column_width">200dp</dimen>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user