Bug 1325096 - Wrap FaviconView to workaround ignored margin r=maliu
authorAndrzej Hunt <ahunt@mozilla.com>
Mon, 23 Jan 2017 15:55:46 -0800
changeset 360900 bbde80c84235661510c1ecf9f466eafdd9a98590
parent 360899 e13b9d48a99abd6713fc0b557e6731f08e9adc37
child 360901 83dc8e87b382b577852f1b675baf796a1d3d540c
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaliu
bugs1325096
milestone54.0a1
Bug 1325096 - Wrap FaviconView to workaround ignored margin r=maliu This seems to be an Android platform bug affecting Android 4.X, which is visible primarily on tablets (on phones, page titles are often broken over two lines, which isn't the case on tablets, hence it's easy to spot if this bug is happening). MozReview-Commit-ID: AfSw3AJHFqH
mobile/android/base/resources/layout/activity_stream_card_history_item.xml
--- a/mobile/android/base/resources/layout/activity_stream_card_history_item.xml
+++ b/mobile/android/base/resources/layout/activity_stream_card_history_item.xml
@@ -16,27 +16,38 @@
     android:orientation="vertical">
 
     <RelativeLayout
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
         android:background="?android:attr/selectableItemBackground">
 
-        <org.mozilla.gecko.widget.FaviconView
-            android:id="@+id/icon"
-            android:layout_width="@dimen/favicon_bg"
-            android:layout_height="@dimen/favicon_bg"
-            android:layout_marginLeft="@dimen/activity_stream_base_margin"
-            android:layout_marginStart="@dimen/activity_stream_base_margin"
-            android:layout_marginTop="@dimen/activity_stream_base_margin"
-            android:layout_marginBottom="@dimen/activity_stream_base_margin"
-            android:layout_gravity="center"
-            gecko:enableRoundCorners="false"
-            tools:background="@drawable/favicon_globe" />
+
+        <!-- On some devices, marginBottom is ignored for Views within a RelativeLayout.
+             Wrapping in a FrameLayout appears to be a sufficient workaround for this issue -->
+        <FrameLayout
+            android:id="@+id/icon_wrapper"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content">
+
+            <org.mozilla.gecko.widget.FaviconView
+                android:id="@+id/icon"
+                android:layout_width="@dimen/favicon_bg"
+                android:layout_height="@dimen/favicon_bg"
+                android:layout_marginLeft="@dimen/activity_stream_base_margin"
+                android:layout_marginStart="@dimen/activity_stream_base_margin"
+                android:layout_marginTop="@dimen/activity_stream_base_margin"
+                android:layout_marginBottom="@dimen/activity_stream_base_margin"
+                android:layout_gravity="center"
+                gecko:enableRoundCorners="false"
+                tools:background="@drawable/favicon_globe" />
+
+        </FrameLayout>
+
 
         <ImageView
             android:id="@+id/menu"
             android:layout_width="wrap_content"
             android:layout_height="36dp"
             android:layout_margin="2dp"
             android:layout_alignParentEnd="true"
             android:layout_alignParentRight="true"
@@ -48,48 +59,48 @@
 
         <TextView
             android:id="@+id/page"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             tools:text="twitter"
             android:textSize="12sp"
             android:textColor="@color/activity_stream_subtitle"
-            android:layout_toRightOf="@id/icon"
-            android:layout_toEndOf="@id/icon"
+            android:layout_toRightOf="@id/icon_wrapper"
+            android:layout_toEndOf="@id/icon_wrapper"
             android:layout_toLeftOf="@id/menu"
             android:layout_toStartOf="@id/menu"
             android:paddingTop="@dimen/activity_stream_base_margin"
             android:paddingLeft="@dimen/activity_stream_base_margin"
             android:paddingStart="@dimen/activity_stream_base_margin"/>
 
         <TextView
             android:id="@+id/card_history_label"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_toEndOf="@id/icon"
-            android:layout_toRightOf="@id/icon"
+            android:layout_toEndOf="@id/icon_wrapper"
+            android:layout_toRightOf="@id/icon_wrapper"
             android:maxLines="3"
             android:ellipsize="end"
             android:paddingLeft="@dimen/activity_stream_base_margin"
             android:paddingStart="@dimen/activity_stream_base_margin"
             android:textSize="14sp"
             android:textStyle="bold"
             android:textColor="#ff000000"
             android:layout_below="@id/page"
             android:layout_toLeftOf="@id/menu"
             android:layout_toStartOf="@id/menu"
             tools:text="Descriptive title of a page that is veeeeeeery long - maybe even too long?" />
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal"
-            android:layout_toRightOf="@id/icon"
-            android:layout_toEndOf="@id/icon"
+            android:layout_toRightOf="@id/icon_wrapper"
+            android:layout_toEndOf="@id/icon_wrapper"
             android:layout_alignParentBottom="true"
             android:paddingLeft="@dimen/activity_stream_base_margin"
             android:paddingStart="@dimen/activity_stream_base_margin"
             android:paddingRight="@dimen/activity_stream_base_margin"
             android:paddingEnd="@dimen/activity_stream_base_margin"
             android:paddingTop="4dp"
             android:paddingBottom="@dimen/activity_stream_base_margin"
             android:gravity="center_vertical"