Bug 1312114 - Support VectorDrawable's in ResourceDrawableUtils r=sebastian
authorAndrzej Hunt <ahunt@mozilla.com>
Thu, 03 Nov 2016 11:47:38 +0100
changeset 347630 23668d4083a4e04932e8ba8e4e7fe8a43ba0cc1b
parent 347629 9cf52476e2aa47d698a83de81f41486a096dad29
child 347631 4c5989da040c79d1ae1c9e7a3b57e55224919e5a
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1312114
milestone52.0a1
Bug 1312114 - Support VectorDrawable's in ResourceDrawableUtils r=sebastian MozReview-Commit-ID: 26jCSWUpiRU
mobile/android/base/java/org/mozilla/gecko/util/DrawableUtil.java
mobile/android/base/java/org/mozilla/gecko/util/ResourceDrawableUtils.java
--- a/mobile/android/base/java/org/mozilla/gecko/util/DrawableUtil.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/DrawableUtil.java
@@ -11,30 +11,31 @@ import android.graphics.Color;
 import android.graphics.drawable.Drawable;
 import android.support.annotation.CheckResult;
 import android.support.annotation.ColorInt;
 import android.support.annotation.ColorRes;
 import android.support.annotation.DrawableRes;
 import android.support.annotation.NonNull;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.graphics.drawable.DrawableCompat;
+import android.support.v7.widget.AppCompatDrawableManager;
 
 import org.mozilla.gecko.AppConstants;
 
 public class DrawableUtil {
 
     /**
      * Tints the given drawable with the given color and returns it.
      */
     @CheckResult
     public static Drawable tintDrawable(@NonNull final Context context,
                                         @DrawableRes final int drawableID,
                                         @ColorInt final int color) {
         final Drawable icon = DrawableCompat.wrap(
-                ContextCompat.getDrawable(context, drawableID).mutate());
+                AppCompatDrawableManager.get().getDrawable(context, drawableID).mutate());
         DrawableCompat.setTint(icon, color);
         return icon;
     }
 
     /**
      * Tints the given drawable with the given color and returns it.
      */
     @CheckResult
--- a/mobile/android/base/java/org/mozilla/gecko/util/ResourceDrawableUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/ResourceDrawableUtils.java
@@ -110,17 +110,17 @@ public class ResourceDrawableUtils {
             } catch (Exception ex) { }
 
             return;
         }
 
         if (data.startsWith("drawable://")) {
             final Uri imageUri = Uri.parse(data);
             final int id = getResource(context, imageUri);
-            final Drawable d = context.getResources().getDrawable(id);
+            final Drawable d = AppCompatDrawableManager.get().getDrawable(context, id);
 
             runOnBitmapFoundOnUiThread(loader, d);
             return;
         }
 
         runOnBitmapFoundOnUiThread(loader, null);
     }