Bug 1556437 - Use VectorDrawableCompat to load the error svg; r=AndreiLazar a=RyanVM
authorPetru Lingurar <petru.lingurar@softvision.ro>
Tue, 16 Jul 2019 13:21:54 +0000
changeset 544679 b0ad1f66125c316df95b46bede5856a59ea0d75c
parent 544678 8d8802147a78b165439eb25dd66c49d26aab40e0
child 544680 80b47b3c406e9e8bffb31d45c9e11bfb1547dfc3
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersAndreiLazar, RyanVM
bugs1556437
milestone69.0
Bug 1556437 - Use VectorDrawableCompat to load the error svg; r=AndreiLazar a=RyanVM VectorDrawableCompat allows backwards compatibility up to API 14. Differential Revision: https://phabricator.services.mozilla.com/D38185
mobile/android/base/java/org/mozilla/gecko/FindInPageBar.java
--- a/mobile/android/base/java/org/mozilla/gecko/FindInPageBar.java
+++ b/mobile/android/base/java/org/mozilla/gecko/FindInPageBar.java
@@ -7,16 +7,17 @@ package org.mozilla.gecko;
 import org.mozilla.gecko.util.ActivityUtils;
 import org.mozilla.gecko.util.BundleEventListener;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoBundle;
 
 import android.content.Context;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
+import android.support.graphics.drawable.VectorDrawableCompat;
 import android.text.Editable;
 import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
 import android.text.TextWatcher;
 import android.text.style.ForegroundColorSpan;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.KeyEvent;
@@ -161,17 +162,17 @@ public class FindInPageBar extends Linea
 
     private void updateFindTextError() {
         if (!TextUtils.isEmpty(mFindText.getText().toString())) {
             String errorText = getResources().getString(R.string.find_error);
             ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(Color.WHITE);
             SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(errorText);
             spannableStringBuilder.setSpan(foregroundColorSpan, 0, errorText.length(), 0);
 
-            Drawable errorDrawable = getResources().getDrawable(R.drawable.ic_baseline_error);
+            Drawable errorDrawable = VectorDrawableCompat.create(getResources(), R.drawable.ic_baseline_error, null);
             errorDrawable.setBounds(0, 0, errorDrawable.getIntrinsicWidth(), errorDrawable.getIntrinsicHeight());
 
             mFindText.setError(spannableStringBuilder, errorDrawable);
         }
     }
 
     private void updateFindTextBackgroundColor(final boolean hasResults) {
         if (TextUtils.isEmpty(mFindText.getText().toString())) {