Bug 1389092 - Adjust TwoLinePageRow layout. r?nechen draft
authorJing-wei Wu <topwu.tw@gmail.com>
Tue, 05 Sep 2017 18:14:33 +0800
changeset 659022 2447f9413985751471d4a6da5a2bc8f43b452f82
parent 659021 b9437a22087b8eaeb5cc11cc6011a580a0da9860
child 729851 586356d09df280525f970bc535b7945d70082795
push id77981
push userbmo:topwu.tw@gmail.com
push dateTue, 05 Sep 2017 10:20:31 +0000
reviewersnechen
bugs1389092
milestone57.0a1
Bug 1389092 - Adjust TwoLinePageRow layout. r?nechen Adjust icon position and increase text size of title field. MozReview-Commit-ID: F0eb8m7dvHY
mobile/android/app/src/main/res/layout/bookmark_folder_row.xml
mobile/android/app/src/main/res/layout/two_line_folder_row.xml
mobile/android/app/src/photon/res/layout/two_line_page_row.xml
mobile/android/app/src/photon/res/values/styles.xml
mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java
--- a/mobile/android/app/src/main/res/layout/bookmark_folder_row.xml
+++ b/mobile/android/app/src/main/res/layout/bookmark_folder_row.xml
@@ -3,13 +3,9 @@
    - 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/. -->
 
 <org.mozilla.gecko.home.BookmarkFolderView xmlns:android="http://schemas.android.com/apk/res/android"
                                            style="@style/Widget.FolderView"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:minHeight="@dimen/page_row_height"
-                                           android:paddingLeft="16dp"
-                                           android:paddingStart="16dp"
-                                           android:paddingRight="16dp"
-                                           android:paddingEnd="16dp"
                                            android:gravity="center_vertical" />
--- a/mobile/android/app/src/main/res/layout/two_line_folder_row.xml
+++ b/mobile/android/app/src/main/res/layout/two_line_folder_row.xml
@@ -1,51 +1,66 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!-- 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/. -->
 
 <merge xmlns:android="http://schemas.android.com/apk/res/android"
+       xmlns:gecko="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
-       xmlns:gecko="http://schemas.android.com/apk/res-auto"
-       tools:context=".BrowserApp">
-
-    <ImageView android:id="@+id/icon"
-               android:src="@drawable/folder_closed"
-               android:layout_width="@dimen/favicon_small_size"
-               android:layout_height="@dimen/favicon_small_size"
-               android:scaleType="fitCenter" />
+       tools:context=".BrowserApp"
+       tools:layout_height="wrap_content"
+       tools:layout_width="match_parent"
+       tools:minHeight="@dimen/page_row_height"
+       tools:orientation="horizontal"
+       tools:parentTag="LinearLayout">
 
-    <LinearLayout android:layout_width="0dp"
-                  android:layout_height="wrap_content"
-                  android:layout_weight="1"
-                  android:layout_gravity="center_vertical"
-                  android:paddingLeft="16dp"
-                  android:paddingStart="16dp"
-                  android:paddingRight="16dp"
-                  android:paddingEnd="16dp"
-                  android:orientation="vertical">
+    <ImageView
+        android:id="@+id/icon"
+        android:layout_width="@dimen/favicon_small_size"
+        android:layout_height="@dimen/favicon_small_size"
+        android:layout_gravity="center"
+        android:layout_marginLeft="20dp"
+        android:layout_marginRight="20dp"
+        android:scaleType="fitCenter"
+        android:src="@drawable/folder_closed"/>
+
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:paddingEnd="@dimen/page_row_edge_padding"
+        android:paddingRight="@dimen/page_row_edge_padding">
 
         <org.mozilla.gecko.widget.FadedSingleColorTextView
-                android:id="@+id/title"
-                style="@style/Widget.TwoLinePageRow.Title"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                gecko:fadeWidth="90dp"
-                tools:text="This is a long test title"/>
+            android:id="@+id/title"
+            style="@style/Widget.TwoLinePageRow.Title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            gecko:fadeWidth="90dp"
+            tools:text="This is a long test title"/>
 
-        <org.mozilla.gecko.widget.FadedSingleColorTextView android:id="@+id/subtitle"
-                  style="@style/Widget.TwoLinePageRow.Url"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:visibility="gone"
-                  gecko:fadeWidth="90dp"
-                  tools:text="1 items"/>
+        <org.mozilla.gecko.widget.FadedSingleColorTextView
+            android:id="@+id/subtitle"
+            style="@style/Widget.TwoLinePageRow.Url"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:visibility="gone"
+            gecko:fadeWidth="90dp"
+            tools:text="1 items"/>
 
     </LinearLayout>
 
-    <ImageView android:id="@+id/indicator"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_gravity="center"
-               android:src="@drawable/arrow" />
+    <ImageView
+        android:id="@+id/indicator"
+        android:layout_width="20dp"
+        android:layout_height="20dp"
+        android:layout_gravity="center"
+        android:scaleType="centerInside"
+        android:src="@drawable/arrow"/>
 
+    <View
+        android:id="@+id/padding_end"
+        android:layout_width="@dimen/page_row_edge_padding"
+        android:layout_height="1dp"/>
 </merge>
--- a/mobile/android/app/src/photon/res/layout/two_line_page_row.xml
+++ b/mobile/android/app/src/photon/res/layout/two_line_page_row.xml
@@ -35,17 +35,17 @@
             android:id="@+id/title"
             style="@style/Widget.TwoLinePageRow.Title"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginBottom="2dp"
             android:background="@null"
             android:lineSpacingMultiplier="1.1"
             android:textColor="@color/two_line_page_row_title"
-            android:textSize="14sp"
+            android:textSize="15sp"
             gecko:fadeWidth="90dp"
             tools:text="This is a long test title"/>
 
         <org.mozilla.gecko.widget.FadedSingleColorTextView
             android:id="@+id/url"
             style="@style/Widget.TwoLinePageRow.Url"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -66,9 +66,13 @@
         android:id="@+id/status_icon_bookmark"
         android:layout_width="20dp"
         android:layout_height="20dp"
         android:layout_gravity="center"
         android:src="@drawable/star_blue"
         android:visibility="gone"
         tools:visibility="visible"/>
 
+    <View
+        android:id="@+id/padding_end"
+        android:layout_width="@dimen/page_row_edge_padding"
+        android:layout_height="1dp"/>
 </merge>
--- a/mobile/android/app/src/photon/res/values/styles.xml
+++ b/mobile/android/app/src/photon/res/values/styles.xml
@@ -168,20 +168,16 @@
     </style>
 
     <style name="Widget.FolderView" parent="Widget.FolderTitle.OneLine">
         <item name="android:layout_height">@dimen/page_group_height</item>
         <item name="android:minHeight">@dimen/page_group_height</item>
         <item name="android:singleLine">true</item>
         <item name="android:ellipsize">none</item>
         <item name="android:background">@color/about_page_header_grey</item>
-        <item name="android:paddingLeft">20dp</item>
-        <item name="android:paddingStart">20dp</item>
-        <item name="android:paddingRight">0dp</item>
-        <item name="android:paddingEnd">0dp</item>
         <item name="android:drawablePadding">20dp</item>
     </style>
 
     <style name="Widget.PanelItemView" />
 
     <style name="Widget.PanelItemView.Title">
         <item name="android:textAppearance">@style/TextAppearance.Widget.Home.ItemTitle</item>
         <item name="android:maxLines">2</item>
--- a/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java
@@ -65,18 +65,16 @@ public class TwoLinePageRow extends Them
     }
 
     public TwoLinePageRow(Context context, AttributeSet attrs) {
         super(context, attrs);
 
         setGravity(Gravity.CENTER_VERTICAL);
 
         LayoutInflater.from(context).inflate(R.layout.two_line_page_row, this);
-        // Merge layouts lose their padding, so set it dynamically.
-        ViewCompat.setPaddingRelative(this, 0, 0, (int) getResources().getDimension(R.dimen.page_row_edge_padding), 0);
 
         mTitle = (ThemedTextView) findViewById(R.id.title);
         mUrl = (ThemedTextView) findViewById(R.id.url);
         mStatusIcon = (ImageView) findViewById(R.id.status_icon_bookmark);
 
         mSwitchToTabIconId = NO_ICON;
         mShowIcons = true;