Bug 1179479 - Set search icon to tabs icon grey when in private mode. r=mhaigh
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 30 Jul 2015 19:18:29 -0700
changeset 257200 b163bf0c487ff9f219b1bf9256bcc13dda7c85e9
parent 257199 a1ffe0d6a9ee26fde54adb455d61b7ce041c8e4a
child 257201 ecb79b9ae0f9a4e1b8605bca88a313760a9b89f5
push id29209
push userryanvm@gmail.com
push dateTue, 11 Aug 2015 14:52:43 +0000
treeherdermozilla-central@38c1ea9ccae3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh
bugs1179479
milestone43.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 1179479 - Set search icon to tabs icon grey when in private mode. r=mhaigh
mobile/android/base/toolbar/ToolbarEditText.java
--- a/mobile/android/base/toolbar/ToolbarEditText.java
+++ b/mobile/android/base/toolbar/ToolbarEditText.java
@@ -8,21 +8,23 @@ package org.mozilla.gecko.toolbar;
 import org.mozilla.gecko.AboutPages;
 import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.CustomEditText;
 import org.mozilla.gecko.InputMethods;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.toolbar.BrowserToolbar.OnCommitListener;
 import org.mozilla.gecko.toolbar.BrowserToolbar.OnDismissListener;
 import org.mozilla.gecko.toolbar.BrowserToolbar.OnFilterListener;
+import org.mozilla.gecko.util.DrawableUtil;
 import org.mozilla.gecko.util.GamepadUtils;
 import org.mozilla.gecko.util.StringUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 
 import android.content.Context;
+import android.graphics.drawable.Drawable;
 import android.graphics.Rect;
 import android.text.Editable;
 import android.text.NoCopySpan;
 import android.text.Selection;
 import android.text.Spanned;
 import android.text.TextUtils;
 import android.text.TextWatcher;
 import android.text.style.BackgroundColorSpan;
@@ -166,21 +168,28 @@ public class ToolbarEditText extends Cus
      *         text has changed and is not empty.
      */
     void updateSearchIcon(boolean isActive) {
         if (!HardwareUtils.isTablet()) {
             return;
         }
 
         // When on tablet show a magnifying glass in editing mode
-        if (isActive) {
-            setCompoundDrawablesWithIntrinsicBounds(R.drawable.search_icon_active, 0, 0, 0);
+        final int searchDrawableId = R.drawable.search_icon_active;
+        final Drawable searchDrawable;
+        if (!isActive) {
+            searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.placeholder_grey);
         } else {
-            setCompoundDrawablesWithIntrinsicBounds(R.drawable.search_icon_inactive, 0, 0, 0);
+            if (isPrivateMode()) {
+                searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.tabs_tray_icon_grey);
+            } else {
+                searchDrawable = getResources().getDrawable(searchDrawableId);
+            }
         }
+        setCompoundDrawablesWithIntrinsicBounds(searchDrawable, null, null, null);
     }
 
     /**
      * Mark the start of autocomplete changes so our text change
      * listener does not react to changes in autocomplete text
      */
     private void beginSettingAutocomplete() {
         beginBatchEdit();