Commit 358ed727 authored by Theresa Wellington's avatar Theresa Wellington Committed by Commit Bot

Define toolbar button height and width in-line instead of in styles.xml

Define the layout_height and layout_width for ToolbarButton elements
in-line rather than in styles.xml. This is a speculative fix for crash
reports we've received indicating these attributes are missing.

BUG=779271

Change-Id: I732ee9b39262aa8bfbc74dea57ea72469cd9e647
Reviewed-on: https://chromium-review.googlesource.com/764378
Commit-Queue: Theresa <twellington@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515966}
parent 4e6d1c85
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
found in the LICENSE file. --> found in the LICENSE file. -->
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" <ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:contentDescription="@null" android:contentDescription="@null"
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
<ImageButton <ImageButton
android:id="@+id/close_button" android:id="@+id/close_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:layout_gravity="start|center_vertical" android:layout_gravity="start|center_vertical"
android:contentDescription="@string/close_tab" /> android:contentDescription="@string/close_tab" />
<FrameLayout <FrameLayout
...@@ -63,6 +65,7 @@ ...@@ -63,6 +65,7 @@
<ImageButton <ImageButton
android:id="@+id/action_button" android:id="@+id/action_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:maxWidth="@dimen/custom_tabs_toolbar_maxWidth" android:maxWidth="@dimen/custom_tabs_toolbar_maxWidth"
android:paddingTop="@dimen/custom_tabs_toolbar_vertical_padding" android:paddingTop="@dimen/custom_tabs_toolbar_vertical_padding"
...@@ -77,7 +80,8 @@ ...@@ -77,7 +80,8 @@
android:id="@+id/menu_button" android:id="@+id/menu_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:layout_width="42dp" android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_menu_button_width"
android:paddingEnd="4dp" android:paddingEnd="4dp"
android:src="@drawable/ic_more_vert_black_24dp" android:src="@drawable/ic_more_vert_black_24dp"
android:contentDescription="@string/accessibility_toolbar_btn_menu" android:contentDescription="@string/accessibility_toolbar_btn_menu"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<view class="org.chromium.chrome.browser.widget.newtab.NewTabButton" <view class="org.chromium.chrome.browser.widget.newtab.NewTabButton"
android:id="@+id/empty_new_tab_button" android:id="@+id/empty_new_tab_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="start|top" android:layout_gravity="start|top"
android:paddingStart="16dp" android:paddingStart="16dp"
......
...@@ -44,18 +44,21 @@ ...@@ -44,18 +44,21 @@
android:id="@+id/find_prev_button" android:id="@+id/find_prev_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/ic_collapsed" android:src="@drawable/ic_collapsed"
android:contentDescription="@string/accessibility_find_toolbar_btn_prev" /> android:contentDescription="@string/accessibility_find_toolbar_btn_prev" />
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/find_next_button" android:id="@+id/find_next_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/ic_expanded" android:src="@drawable/ic_expanded"
android:contentDescription="@string/accessibility_find_toolbar_btn_next" /> android:contentDescription="@string/accessibility_find_toolbar_btn_next" />
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/close_find_button" android:id="@+id/close_find_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/btn_close" android:src="@drawable/btn_close"
android:contentDescription="@string/close" /> android:contentDescription="@string/close" />
</LinearLayout> </LinearLayout>
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<org.chromium.chrome.browser.widget.newtab.NewTabButton <org.chromium.chrome.browser.widget.newtab.NewTabButton
android:id="@+id/new_tab_button" android:id="@+id/new_tab_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="start|top" android:layout_gravity="start|top"
android:paddingStart="16dp" android:paddingStart="16dp"
...@@ -22,6 +23,8 @@ ...@@ -22,6 +23,8 @@
<org.chromium.chrome.browser.toolbar.HomePageButton <org.chromium.chrome.browser.toolbar.HomePageButton
android:id="@+id/home_button" android:id="@+id/home_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/btn_toolbar_home" android:src="@drawable/btn_toolbar_home"
android:contentDescription="@string/accessibility_toolbar_btn_home" android:contentDescription="@string/accessibility_toolbar_btn_home"
android:visibility="gone" /> android:visibility="gone" />
...@@ -45,12 +48,16 @@ ...@@ -45,12 +48,16 @@
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/expand_sheet_button" android:id="@+id/expand_sheet_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/ic_collapsed" android:src="@drawable/ic_collapsed"
android:contentDescription="@string/accessibility_toolbar_btn_expand" android:contentDescription="@string/accessibility_toolbar_btn_expand"
android:visibility="gone" /> android:visibility="gone" />
<ImageButton android:id="@+id/tab_switcher_button" <ImageButton android:id="@+id/tab_switcher_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:layout_gravity="top" android:layout_gravity="top"
android:contentDescription="@string/accessibility_toolbar_btn_tabswitcher_toggle_default" /> android:contentDescription="@string/accessibility_toolbar_btn_tabswitcher_toggle_default" />
...@@ -62,12 +69,16 @@ ...@@ -62,12 +69,16 @@
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/menu_button" android:id="@+id/menu_button"
style="@style/ToolbarMenuButtonPhone" style="@style/ToolbarMenuButtonPhone"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_menu_button_width"
android:src="@drawable/ic_more_vert_black_24dp" android:src="@drawable/ic_more_vert_black_24dp"
android:contentDescription="@string/accessibility_toolbar_btn_menu" /> android:contentDescription="@string/accessibility_toolbar_btn_menu" />
<ImageView <ImageView
android:id="@+id/menu_badge" android:id="@+id/menu_badge"
style="@style/ToolbarMenuButtonPhone" style="@style/ToolbarMenuButtonPhone"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_menu_button_width"
android:src="@drawable/badge_update_dark" android:src="@drawable/badge_update_dark"
android:contentDescription="@null" android:contentDescription="@null"
android:importantForAccessibility="no" android:importantForAccessibility="no"
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
<org.chromium.chrome.browser.toolbar.HomePageButton <org.chromium.chrome.browser.toolbar.HomePageButton
android:id="@+id/home_button" android:id="@+id/home_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/btn_toolbar_home" android:src="@drawable/btn_toolbar_home"
android:contentDescription="@string/accessibility_toolbar_btn_home" android:contentDescription="@string/accessibility_toolbar_btn_home"
android:visibility="gone" /> android:visibility="gone" />
...@@ -30,18 +32,24 @@ ...@@ -30,18 +32,24 @@
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/back_button" android:id="@+id/back_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/btn_back" android:src="@drawable/btn_back"
android:contentDescription="@string/accessibility_toolbar_btn_back" /> android:contentDescription="@string/accessibility_toolbar_btn_back" />
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/forward_button" android:id="@+id/forward_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/btn_forward" android:src="@drawable/btn_forward"
android:contentDescription="@string/accessibility_toolbar_btn_forward" /> android:contentDescription="@string/accessibility_toolbar_btn_forward" />
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/refresh_button" android:id="@+id/refresh_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:src="@drawable/btn_reload_stop" android:src="@drawable/btn_reload_stop"
android:contentDescription="@string/accessibility_btn_refresh" /> android:contentDescription="@string/accessibility_btn_refresh" />
...@@ -60,6 +68,8 @@ ...@@ -60,6 +68,8 @@
<ImageButton <ImageButton
android:id="@+id/tab_switcher_button" android:id="@+id/tab_switcher_button"
style="@style/ToolbarButton" style="@style/ToolbarButton"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_button_width"
android:contentDescription="@string/accessibility_toolbar_btn_tabswitcher_toggle_default" android:contentDescription="@string/accessibility_toolbar_btn_tabswitcher_toggle_default"
android:visibility="gone" /> android:visibility="gone" />
...@@ -71,12 +81,16 @@ ...@@ -71,12 +81,16 @@
<org.chromium.chrome.browser.widget.TintedImageButton <org.chromium.chrome.browser.widget.TintedImageButton
android:id="@+id/menu_button" android:id="@+id/menu_button"
style="@style/ToolbarMenuButtonTablet" style="@style/ToolbarMenuButtonTablet"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_menu_button_width"
android:src="@drawable/ic_more_vert_black_24dp" android:src="@drawable/ic_more_vert_black_24dp"
android:contentDescription="@string/accessibility_toolbar_btn_menu" /> android:contentDescription="@string/accessibility_toolbar_btn_menu" />
<ImageView <ImageView
android:id="@+id/menu_badge" android:id="@+id/menu_badge"
style="@style/ToolbarMenuButtonTablet" style="@style/ToolbarMenuButtonTablet"
android:layout_height="@dimen/toolbar_height_no_shadow"
android:layout_width="@dimen/toolbar_menu_button_width"
android:src="@drawable/badge_update_dark" android:src="@drawable/badge_update_dark"
android:contentDescription="@null" android:contentDescription="@null"
android:importantForAccessibility="no" android:importantForAccessibility="no"
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<dimen name="tab_strip_and_toolbar_height">96dp</dimen> <dimen name="tab_strip_and_toolbar_height">96dp</dimen>
<dimen name="location_bar_icon_width">40dp</dimen> <dimen name="location_bar_icon_width">40dp</dimen>
<dimen name="toolbar_menu_button_width">43dp</dimen>
<!-- NTP dimensions --> <!-- NTP dimensions -->
<dimen name="ntp_logo_height">180dp</dimen> <dimen name="ntp_logo_height">180dp</dimen>
......
...@@ -602,18 +602,14 @@ ...@@ -602,18 +602,14 @@
</style> </style>
<style name="ToolbarButton"> <style name="ToolbarButton">
<item name="android:background">?attr/selectableItemBackground</item> <item name="android:background">?attr/selectableItemBackground</item>
<item name="android:layout_width">@dimen/toolbar_button_width</item>
<item name="android:layout_height">56dp</item>
<item name="android:scaleType">center</item> <item name="android:scaleType">center</item>
</style> </style>
<style name="ToolbarMenuButtonPhone" parent="ToolbarButton"> <style name="ToolbarMenuButtonPhone" parent="ToolbarButton">
<item name="android:layout_gravity">top</item> <item name="android:layout_gravity">top</item>
<item name="android:layout_width">42dp</item>
<item name="android:paddingEnd">4dp</item> <item name="android:paddingEnd">4dp</item>
<item name="android:background">@null</item> <item name="android:background">@null</item>
</style> </style>
<style name="ToolbarMenuButtonTablet" parent="ToolbarButton"> <style name="ToolbarMenuButtonTablet" parent="ToolbarButton">
<item name="android:layout_width">43dp</item>
<item name="android:paddingEnd">3.5dp</item> <item name="android:paddingEnd">3.5dp</item>
</style> </style>
<style name="AppMenuItem"> <style name="AppMenuItem">
......
...@@ -240,6 +240,7 @@ ...@@ -240,6 +240,7 @@
<dimen name="toolbar_shadow_height">8dp</dimen> <dimen name="toolbar_shadow_height">8dp</dimen>
<dimen name="toolbar_progress_bar_height">2dp</dimen> <dimen name="toolbar_progress_bar_height">2dp</dimen>
<dimen name="toolbar_button_width">48dp</dimen> <dimen name="toolbar_button_width">48dp</dimen>
<dimen name="toolbar_menu_button_width">42dp</dimen>
<dimen name="toolbar_handle_height">3dp</dimen> <dimen name="toolbar_handle_height">3dp</dimen>
<dimen name="toolbar_handle_width">20dp</dimen> <dimen name="toolbar_handle_width">20dp</dimen>
<dimen name="toolbar_handle_corner_radius">1.5dp</dimen> <dimen name="toolbar_handle_corner_radius">1.5dp</dimen>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment