Bug 1186260 - Favicon in site info doorhanger is too large when using default favicon. r=margaret
authorChenxia Liu <liuche@mozilla.com>
Wed, 22 Jul 2015 14:45:45 -0700
changeset 286878 922aaca0f5f83b1affcb80cec69c3b6ff2291fec
parent 286877 2cd865efd0b03212dfd10423d42a4bb2bd20fa65
child 286879 5e9f481c0192521d8cb6d1e5dc14885477036dd1
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1186260
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1186260 - Favicon in site info doorhanger is too large when using default favicon. r=margaret
mobile/android/base/toolbar/SiteIdentityPopup.java
--- a/mobile/android/base/toolbar/SiteIdentityPopup.java
+++ b/mobile/android/base/toolbar/SiteIdentityPopup.java
@@ -1,16 +1,17 @@
 /* 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/. */
 
 package org.mozilla.gecko.toolbar;
 
 import android.content.ClipData;
 import android.content.ClipboardManager;
+import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.widget.ImageView;
 import android.widget.Toast;
 import org.json.JSONException;
 import org.json.JSONArray;
 import org.mozilla.gecko.AboutPages;
@@ -56,16 +57,17 @@ public class SiteIdentityPopup extends A
         "https://support.mozilla.org/kb/how-does-insecure-content-affect-safety-android";
 
     private static final String TRACKING_CONTENT_SUPPORT_URL =
         "https://support.mozilla.org/kb/firefox-android-tracking-protection";
 
     // Placeholder string.
     private final static String FORMAT_S = "%s";
 
+    private final Resources mResources;
     private SiteIdentity mSiteIdentity;
 
     private LinearLayout mIdentity;
 
     private LinearLayout mIdentityKnownContainer;
     private LinearLayout mIdentityUnknownContainer;
 
     private ImageView mIcon;
@@ -83,16 +85,18 @@ public class SiteIdentityPopup extends A
     private DoorHanger mTrackingContentNotification;
     private DoorHanger mSelectLoginDoorhanger;
 
     private final OnButtonClickListener mContentButtonClickListener;
 
     public SiteIdentityPopup(Context context) {
         super(context);
 
+        mResources = mContext.getResources();
+
         mContentButtonClickListener = new ContentNotificationButtonListener();
         EventDispatcher.getInstance().registerGeckoThreadListener(this, "Doorhanger:Logins");
         EventDispatcher.getInstance().registerGeckoThreadListener(this, "Permissions:CheckResult");
     }
 
     @Override
     protected void init() {
         super.init();
@@ -437,17 +441,21 @@ public class SiteIdentityPopup extends A
             addSelectLoginDoorhanger(selectedTab);
         } catch (JSONException e) {
             Log.e(LOGTAG, "Error adding selectLogin doorhanger", e);
         }
 
         mTitle.setText(selectedTab.getBaseDomain());
         final Bitmap favicon = selectedTab.getFavicon();
         if (favicon != null) {
-            mTitle.setCompoundDrawablesWithIntrinsicBounds(new BitmapDrawable(mContext.getResources(), favicon), null, null, null);
+            final Drawable faviconDrawable = new BitmapDrawable(mResources, favicon);
+            final int dimen = (int) mResources.getDimension(R.dimen.browser_toolbar_favicon_size);
+            faviconDrawable.setBounds(0, 0, dimen, dimen);
+
+            mTitle.setCompoundDrawables(faviconDrawable, null, null, null);
             mTitle.setCompoundDrawablePadding((int) mContext.getResources().getDimension(R.dimen.doorhanger_drawable_padding));
         }
 
         showDividers();
 
         super.show();
     }