Bug 1072469: Change new tablet toolbar height to 60dp and menu buttons to 56x60dp. r=lucasr

This commit is contained in:
Michael Comella 2014-10-01 14:22:45 -07:00
parent 3c4b4b5713
commit c1ed87533d
6 changed files with 71 additions and 11 deletions

View File

@ -406,6 +406,7 @@ gbjar.sources += [
'TextSelection.java',
'TextSelectionHandle.java',
'ThumbnailHelper.java',
'toolbar/ActionBarViewFlipper.java',
'toolbar/AutocompleteHandler.java',
'toolbar/BackButton.java',
'toolbar/BrowserToolbar.java',

View File

@ -24,7 +24,7 @@
android:layout_alignLeft="@id/back"/>
<org.mozilla.gecko.toolbar.BackButton android:id="@id/back"
style="@style/UrlBar.ImageButton"
style="@style/UrlBar.ImageButton.NewTablet"
android:layout_width="@dimen/back_button_width"
android:layout_height="@dimen/back_button_width"
android:layout_centerVertical="true"
@ -61,23 +61,26 @@
<org.mozilla.gecko.widget.ThemedImageButton
android:id="@+id/tabs"
style="@style/UrlBar.ImageButton"
style="@style/UrlBar.ImageButton.NewTablet"
android:layout_toLeftOf="@id/menu"
android:background="@drawable/action_bar_button"/>
<!-- In a 56dp space, centering 24dp image will leave 16dp on the horizontal sides. -->
<!-- In a 56x60dp space, centering 24dp image will leave 16x18dp. -->
<org.mozilla.gecko.toolbar.TabCounter android:id="@+id/tabs_counter"
style="@style/UrlBar.ImageButton.TabCount.NewTablet"
android:layout_alignLeft="@id/tabs"
android:layout_alignRight="@id/tabs"
android:layout_alignTop="@id/tabs"
android:layout_alignBottom="@id/tabs"
android:layout_margin="16dp"
android:layout_marginTop="18dp"
android:layout_marginBottom="18dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
gecko:layout="@layout/new_tablet_tabs_counter"/>
<org.mozilla.gecko.widget.ThemedImageButton
android:id="@+id/menu"
style="@style/UrlBar.ImageButton"
style="@style/UrlBar.ImageButton.NewTablet"
android:layout_alignParentRight="true"
android:layout_marginRight="6dp"
android:contentDescription="@string/menu"
@ -86,7 +89,7 @@
<org.mozilla.gecko.widget.ThemedImageView
android:id="@+id/menu_icon"
style="@style/UrlBar.ImageButton"
style="@style/UrlBar.ImageButton.NewTablet"
android:layout_alignLeft="@id/menu"
android:layout_alignRight="@id/menu"
android:src="@drawable/new_tablet_menu"

View File

@ -87,7 +87,7 @@
android:layout_height="@dimen/new_tablet_tab_strip_height"
android:visibility="gone"/>
<org.mozilla.gecko.widget.GeckoViewFlipper
<org.mozilla.gecko.toolbar.ActionBarViewFlipper
android:id="@+id/browser_actionbar"
android:layout_width="match_parent"
android:layout_height="@dimen/browser_toolbar_height"
@ -108,7 +108,7 @@
android:layout_width="match_parent"
style="@style/GeckoActionBar"/>
</org.mozilla.gecko.widget.GeckoViewFlipper>
</org.mozilla.gecko.toolbar.ActionBarViewFlipper>
</LinearLayout>

View File

@ -5,6 +5,10 @@
<resources>
<style name="UrlBar.ImageButton.NewTablet">
<item name="android:layout_width">@dimen/new_tablet_browser_toolbar_menu_item_width</item>
</style>
<style name="UrlBar.ImageButton.Forward">
<item name="android:contentDescription">@string/forward</item>
<item name="android:layout_width">45dip</item>
@ -33,6 +37,9 @@
<style name="UrlBar.ImageButton.TabCount.NewTablet">
<item name="android:background">@drawable/new_tablet_tabs_count</item>
<!-- From UrlBar.ImageButton.NewTablet because we can't inherit directly. -->
<item name="android:layout_width">@dimen/new_tablet_browser_toolbar_menu_item_width</item>
</style>
<style name="UrlBar.Button.Container">
@ -65,16 +72,25 @@
<style name="Widget.MenuItemActionBar">
<item name="android:layout_width">@dimen/browser_toolbar_height</item>
<item name="android:layout_height">@dimen/browser_toolbar_height</item>
<item name="android:padding">@dimen/browser_toolbar_button_padding</item>
<item name="android:background">@drawable/action_bar_button</item>
<item name="android:scaleType">fitCenter</item>
<!-- We split up padding* because we can't override it in *.NewTablet otherwise. -->
<item name="android:paddingTop">@dimen/browser_toolbar_button_padding</item>
<item name="android:paddingBottom">@dimen/browser_toolbar_button_padding</item>
<item name="android:paddingLeft">@dimen/browser_toolbar_button_padding</item>
<item name="android:paddingRight">@dimen/browser_toolbar_button_padding</item>
</style>
<style name="Widget.MenuItemActionBar.NewTablet">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:padding">@dimen/new_tablet_browser_toolbar_menu_item_padding</item>
<item name="android:scaleType">center</item>
<item name="android:paddingTop">@dimen/new_tablet_browser_toolbar_menu_item_padding_vertical</item>
<item name="android:paddingBottom">@dimen/new_tablet_browser_toolbar_menu_item_padding_vertical</item>
<item name="android:paddingLeft">@dimen/new_tablet_browser_toolbar_menu_item_padding_horizontal</item>
<item name="android:paddingRight">@dimen/new_tablet_browser_toolbar_menu_item_padding_horizontal</item>
</style>
<style name="Widget.BookmarksListView" parent="Widget.HomeListView">

View File

@ -22,7 +22,11 @@
<dimen name="new_tablet_tab_strip_item_margin">-30dp</dimen>
<dimen name="new_tablet_tab_strip_favicon_size">16dp</dimen>
<dimen name="new_tablet_forward_default_offset">-6dp</dimen>
<dimen name="new_tablet_browser_toolbar_menu_item_padding">19dp</dimen>
<dimen name="new_tablet_browser_toolbar_height">60dp</dimen>
<dimen name="new_tablet_browser_toolbar_menu_item_width">56dp</dimen>
<!-- Padding combines with an 18dp image to form the menu item width and height. -->
<dimen name="new_tablet_browser_toolbar_menu_item_padding_horizontal">19dp</dimen>
<dimen name="new_tablet_browser_toolbar_menu_item_padding_vertical">21dp</dimen>
<dimen name="forward_default_offset">-13dip</dimen>
<!-- Dimensions used by Favicons and FaviconView -->

View File

@ -0,0 +1,36 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* 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/. */
package org.mozilla.gecko.toolbar;
import org.mozilla.gecko.NewTabletUI;
import org.mozilla.gecko.R;
import org.mozilla.gecko.widget.GeckoViewFlipper;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
//TODO: (bug 1058909) Remove this class when old tablet is removed.
/**
* A temporary view that sets its height based on whether we are on new tablet or not.
* Note that this view should be removed when the old tablet is removed and replaced with using
* browser_toolbar_height directly.
*/
public class ActionBarViewFlipper extends GeckoViewFlipper {
public ActionBarViewFlipper(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onAttachedToWindow() {
if (NewTabletUI.isEnabled(getContext())) {
final ViewGroup.LayoutParams lp = getLayoutParams();
lp.height = getResources().getDimensionPixelSize(R.dimen.new_tablet_browser_toolbar_height);
setLayoutParams(lp);
}
}
}