Bug 1071267 - Part 3: Create large tappable margin for site security.
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 08 Oct 2014 17:48:32 -0700
changeset 209667 700ef0cb9a6ca789d660dca71429fb011206a4a2
parent 209666 6e02d0f5d6425ba25f11bfc472e96f704a282849
child 209668 b2afd3b9c1b4c722769e1741bdd1d7b9f45e1a60
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs1071267
milestone35.0a1
Bug 1071267 - Part 3: Create large tappable margin for site security.
mobile/android/base/newtablet/res/layout-large-v11/new_tablet_browser_toolbar.xml
mobile/android/base/resources/values/dimens.xml
mobile/android/base/toolbar/ToolbarDisplayLayout.java
--- 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);
             }