Bug 1299201 - Pre: move activity stream topsites dimensions into xml draft
authorAndrzej Hunt <ahunt@mozilla.com>
Tue, 06 Sep 2016 12:08:26 -0700
changeset 410395 46dfade752a4172ec437c0c7bd3154742bc5f4a1
parent 410344 37c9349b4e8167a61b08b7e119c21ea177b98942
child 410396 6dda59a26608b96d4fa94844627d10b4f24f21d1
push id28739
push userahunt@mozilla.com
push dateTue, 06 Sep 2016 19:44:59 +0000
bugs1299201
milestone51.0a1
Bug 1299201 - Pre: move activity stream topsites dimensions into xml Due to RecyclerView bugs (fixed in newer support library versions), and also because ViewPager doesn't appear to handle wrap_content, we need to hardcode heights. (Most of these issues would probably go away if we switched to a static layout in place of the RecyclerView.) MozReview-Commit-ID: Bx7RoUMCAut
mobile/android/base/resources/layout/activity_stream_main_toppanel.xml
mobile/android/base/resources/layout/activity_stream_topsites_card.xml
mobile/android/base/resources/layout/activity_stream_topsites_page.xml
mobile/android/base/resources/values/dimens.xml
--- a/mobile/android/base/resources/layout/activity_stream_main_toppanel.xml
+++ b/mobile/android/base/resources/layout/activity_stream_main_toppanel.xml
@@ -3,17 +3,17 @@
                 xmlns:tools="http://schemas.android.com/tools"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 xmlns:app="http://schemas.android.com/apk/res-auto"
                 android:orientation="vertical">
 
     <android.support.v4.view.ViewPager
         android:layout_width="match_parent"
-        android:layout_height="123dp"
+        android:layout_height="@dimen/activity_stream_topsites_page_height"
         android:id="@+id/topsites_pager"
         android:layout_alignParentTop="true"
         android:layout_alignParentLeft="true"
         android:layout_alignParentStart="true"/>
 
     <org.mozilla.gecko.home.activitystream.topsites.CirclePageIndicator
         android:id="@+id/topsites_indicator"
         android:padding="10dip"
--- a/mobile/android/base/resources/layout/activity_stream_topsites_card.xml
+++ b/mobile/android/base/resources/layout/activity_stream_topsites_card.xml
@@ -1,15 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <org.mozilla.gecko.widget.FilledCardView
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="wrap_content"
-    android:layout_height="115dp"
-    android:layout_margin="1dp">
+    android:layout_height="@dimen/activity_stream_topsites_cardheight">
 
     <RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
         <org.mozilla.gecko.widget.FaviconView
             android:id="@+id/favicon"
             android:layout_width="match_parent"
--- a/mobile/android/base/resources/layout/activity_stream_topsites_page.xml
+++ b/mobile/android/base/resources/layout/activity_stream_topsites_page.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <org.mozilla.gecko.home.activitystream.topsites.TopSitesPage xmlns:android="http://schemas.android.com/apk/res/android"
               android:orientation="vertical"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
-              android:padding="4dp"/>
+              android:padding="@dimen/activity_stream_topsites_page_padding"/>
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -214,9 +214,15 @@
     <!-- http://blog.danlew.net/2015/01/06/handling-android-resources-with-non-standard-formats/ -->
     <item name="match_parent" type="dimen">-1</item>
     <item name="wrap_content" type="dimen">-2</item>
 
     <item name="tab_strip_content_start" type="dimen">12dp</item>
     <item name="firstrun_tab_strip_content_start" type="dimen">15dp</item>
 
     <item name="notification_media_cover" type="dimen">128dp</item>
+
+    <item name="activity_stream_topsites_cardheight" type="dimen">115dp</item>
+    <item name="activity_stream_topsites_page_padding" type="dimen">4dp</item>
+    <!-- page height must equal card_height + 2 * page_padding
+         unfortunately Android doesn't allow for arithmetic in xml attributes -->
+    <item name="activity_stream_topsites_page_height" type="dimen">123dp</item>
 </resources>