Bug 1071267 - Part 3: Create large tappable margin for site security.
--- a/mobile/android/base/newtablet/res/layout-large-v11/new_tablet_browser_toolbar.xml
+++ b/mobile/android/base/newtablet/res/layout-large-v11/new_tablet_browser_toolbar.xml
@@ -38,22 +38,22 @@
style="@style/UrlBar.Button"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:visibility="gone"
android:orientation="horizontal"
android:layout_toRightOf="@id/back"
android:layout_toLeftOf="@id/menu_items"/>
- <!-- Values of marginLeft are used to animate the forward button so don't change its value. -->
+ <!-- Note: * Values of marginLeft are used to animate the forward button so don't change its value.
+ * We set the padding on the site security icon to increase its tappable area. -->
<org.mozilla.gecko.toolbar.ToolbarDisplayLayout android:id="@+id/display_layout"
style="@style/UrlBar.Button.Container"
android:layout_toRightOf="@id/back"
android:layout_toLeftOf="@id/menu_items"
- android:paddingLeft="6dip"
android:paddingRight="4dip"/>
<LinearLayout android:id="@+id/menu_items"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_marginLeft="6dp"
android:orientation="horizontal"
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -18,18 +18,21 @@
<dimen name="browser_toolbar_shadow_size">2dp</dimen>
<dimen name="new_tablet_tab_strip_height">48dp</dimen>
<dimen name="new_tablet_tab_strip_item_width">250dp</dimen>
<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_site_security_height">60dp</dimen>
- <dimen name="new_tablet_site_security_width">18dp</dimen>
+ <dimen name="new_tablet_site_security_width">34dp</dimen>
+ <!-- We primarily use padding (instead of margins) to increase the hit area. -->
<dimen name="new_tablet_site_security_padding_vertical">21dp</dimen>
+ <dimen name="new_tablet_site_security_padding_horizontal">8dp</dimen>
+ <dimen name="new_tablet_site_security_right_margin">1dp</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="new_tablet_browser_toolbar_menu_item_inset_vertical">5dp</dimen>
<dimen name="new_tablet_browser_toolbar_menu_item_inset_horizontal">3dp</dimen>
<dimen name="new_tablet_browser_toolbar_menu_item_corner_radius">5dp</dimen>
--- a/mobile/android/base/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/base/toolbar/ToolbarDisplayLayout.java
@@ -156,20 +156,25 @@ public class ToolbarDisplayLayout extend
mSiteSecurity.setImageResource(R.drawable.new_tablet_site_security_level);
// TODO: This can likely be set statically in resources when new tablet is default.
// Dynamically update parameters for new tablet.
final LinearLayout.LayoutParams lp =
(LinearLayout.LayoutParams) mSiteSecurity.getLayoutParams();
lp.height = res.getDimensionPixelSize(R.dimen.new_tablet_site_security_height);
lp.width = res.getDimensionPixelSize(R.dimen.new_tablet_site_security_width);
+ // TODO: Override a common static value when new tablet is standard.
+ lp.rightMargin = res.getDimensionPixelSize(R.dimen.new_tablet_site_security_right_margin);
mSiteSecurity.setLayoutParams(lp);
final int siteSecurityVerticalPadding =
res.getDimensionPixelSize(R.dimen.new_tablet_site_security_padding_vertical);
- mSiteSecurity.setPadding(0, siteSecurityVerticalPadding, 0, siteSecurityVerticalPadding);
+ final int siteSecurityHorizontalPadding =
+ res.getDimensionPixelSize(R.dimen.new_tablet_site_security_padding_horizontal);
+ mSiteSecurity.setPadding(siteSecurityHorizontalPadding, siteSecurityVerticalPadding,
+ siteSecurityHorizontalPadding, siteSecurityVerticalPadding);
// We don't show favicons in the toolbar on new tablet. Note that while we could
// null the favicon reference, we don't do so to avoid excessive null-checking.
removeView(mFavicon);
} else {
if (Versions.feature16Plus) {
mFavicon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
}