Bug 1394641: AS FaviconView shares styles; add distribution comments. r=sebastian draft
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 05 Sep 2017 16:16:53 -0700
changeset 660331 66b5480fd4fe52d6a61eb2976917c216d920d08b
parent 659065 3ecda4678c49ca255c38b1697142b9118cdd27e7
child 660332 11b4a710c1d81e701568c7d83ab6155cf4bc1229
push id78386
push usermichael.l.comella@gmail.com
push dateWed, 06 Sep 2017 22:49:03 +0000
reviewerssebastian
bugs1394641
milestone57.0a1
Bug 1394641: AS FaviconView shares styles; add distribution comments. r=sebastian MozReview-Commit-ID: 7d2aXNDTxZs
mobile/android/app/src/main/res/layout/activity_stream_overridable_page_icon_layout.xml
mobile/android/app/src/main/res/layout/activity_stream_topsites_card.xml
mobile/android/app/src/photon/res/values/styles.xml
--- a/mobile/android/app/src/main/res/layout/activity_stream_overridable_page_icon_layout.xml
+++ b/mobile/android/app/src/main/res/layout/activity_stream_overridable_page_icon_layout.xml
@@ -1,26 +1,21 @@
 <?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/tools">
 
-    <!-- The default visibilities are set in code.
-
-         centerInside will center smaller favicons and draw a colored border around them. -->
+    <!-- The default visibilities are set in code. -->
     <org.mozilla.gecko.widget.FaviconView
             android:id="@+id/favicon_view"
+            style="@style/ActivityStreamFaviconView"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            gecko:enableRoundCorners="false"
-            gecko:overrideScaleType="false"
-            android:scaleType="centerInside"
-            />
+            android:layout_height="match_parent"/>
 
     <ImageView
             android:id="@+id/image_view"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             />
 
 </merge>
\ No newline at end of file
--- a/mobile/android/app/src/main/res/layout/activity_stream_topsites_card.xml
+++ b/mobile/android/app/src/main/res/layout/activity_stream_topsites_card.xml
@@ -1,26 +1,22 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout
     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"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_marginBottom="@dimen/activity_stream_base_margin">
 
-    <!-- centerInside will center smaller favicons and draw a colored border around them. -->
     <org.mozilla.gecko.widget.FaviconView
         android:id="@+id/favicon"
+        style="@style/ActivityStreamFaviconView"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        gecko:enableRoundCorners="false"
-        tools:background="@drawable/favicon_globe"
-        android:scaleType="centerInside"
-        gecko:overrideScaleType="false" />
+        tools:background="@drawable/favicon_globe"/>
 
     <!-- scrollHorizontally=false allows drags on the TextView to scroll the ViewPager.
          See https://stackoverflow.com/a/18171834/2219998 -->
     <TextView
         android:id="@+id/title"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="#66000000"
--- a/mobile/android/app/src/photon/res/values/styles.xml
+++ b/mobile/android/app/src/photon/res/values/styles.xml
@@ -1,14 +1,17 @@
 <?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/. -->
 
-<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
+<resources
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:tools="http://schemas.android.com/tools"
+        xmlns:gecko="http://schemas.android.com/apk/res-auto">
 
     <!--
         Base application styles. This could be overridden in other res/values-XXX/themes.xml.
     -->
     <style name="Widget"/>
 
     <style name="Widget.BaseButton" parent="android:style/Widget.Button"/>
 
@@ -823,16 +826,25 @@
         <item name="android:listDivider">@drawable/as_contextmenu_divider</item>
     </style>
 
     <style name="ActivityStreamButton" parent="Widget.AppCompat.Button.Colored">
         <item name="colorButtonNormal">@color/link_blue</item>
         <item name="android:textColor">@android:color/white</item>
     </style>
 
+    <!-- centerInside will downscale larger icons to fit or center smaller favicons and allow us to draw a colored
+         border around them. When changing these values, consider favicons downloaded from the internet and
+         those provided by suggested sites, including suggested sites from distributions. -->
+    <style name="ActivityStreamFaviconView">
+        <item name="enableRoundCorners">false</item>
+        <item name="overrideScaleType">false</item>
+        <item name="android:scaleType">centerInside</item>
+    </style>
+
     <!-- URL bar - Site identity -->
     <style name="UrlBar.SiteIdentity" parent="UrlBar.V15.SiteIdentity"/>
     <style name="UrlBar.Base.SiteIdentity" parent="UrlBar.Button">
         <item name="android:layout_width">@dimen/browser_toolbar_site_security_width</item>
         <item name="android:layout_height">@dimen/browser_toolbar_url_height</item>
         <item name="android:scaleType">center</item>
     </style>
     <style name="UrlBar.V15.SiteIdentity" parent="UrlBar.Base.SiteIdentity">