Bug 1393477 - Resize favicon shown in doorhanger. r=nechen
authorJing-wei Wu <topwu.tw@gmail.com>
Thu, 31 Aug 2017 16:29:13 +0800
changeset 428192 a62b77c74881d6352e896e945b557dbd4a731912
parent 428191 670f548e668947054c77d3c1614b0cac2636411b
child 428193 f9d606261ddf934c84a73d3ab1cb32c3339f27ef
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnechen
bugs1393477
milestone57.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 1393477 - Resize favicon shown in doorhanger. r=nechen MozReview-Commit-ID: I8vFxePDOeF
mobile/android/base/java/org/mozilla/gecko/widget/DoorHanger.java
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DoorHanger.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DoorHanger.java
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.widget;
 
 import android.content.Context;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
 import android.support.annotation.Nullable;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.widget.TextViewCompat;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewStub;
 import android.widget.Button;
 import android.widget.ImageView;
@@ -222,18 +223,23 @@ public abstract class DoorHanger extends
             return false;
         }
 
         return true;
     }
 
     public void showTitle(@Nullable Bitmap favicon, String title) {
         mDoorhangerTitle.setText(title);
-        TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(mDoorhangerTitle, new BitmapDrawable(getResources(), favicon), null, null, null);
+
         if (favicon != 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);
+
+            TextViewCompat.setCompoundDrawablesRelative(mDoorhangerTitle, faviconDrawable, null, null, null);
             mDoorhangerTitle.setCompoundDrawablePadding((int) mContext.getResources().getDimension(R.dimen.doorhanger_drawable_padding));
         }
         mDoorhangerTitle.setVisibility(VISIBLE);
     }
 
     public void hideTitle() {
         mDoorhangerTitle.setVisibility(GONE);
     }