Bug 1277277 - Update the clock icon used for search history suggestions. r=liuche draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Tue, 16 Aug 2016 20:40:18 +0200
changeset 551330 283ca301ed2265c95b6ec4f6f2d1bbe34ca35e6d
parent 508542 01e83a6c14857af24ffbac861454b6c714befeb0
child 621521 90380d54fd1cf3af6ce070bcc26ae65c0301f43a
push id51027
push usermozilla@buttercookie.de
push dateSat, 25 Mar 2017 18:37:43 +0000
reviewersliuche
bugs1277277
milestone55.0a1
Bug 1277277 - Update the clock icon used for search history suggestions. r=liuche The old icon was tinted so that the visual end result approximated disabled_grey. Since the new icon's colour already is disabled_grey, there's no need for tinting anymore. MozReview-Commit-ID: AM582wPT0ET
mobile/android/base/java/org/mozilla/gecko/home/SearchEngineRow.java
mobile/android/base/resources/drawable-hdpi/icon_most_recent_empty.png
mobile/android/base/resources/drawable-xhdpi/icon_most_recent_empty.png
mobile/android/base/resources/layout/suggestion_item.xml
--- a/mobile/android/base/java/org/mozilla/gecko/home/SearchEngineRow.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/SearchEngineRow.java
@@ -9,26 +9,24 @@ import org.mozilla.gecko.GeckoSharedPref
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Telemetry;
 import org.mozilla.gecko.TelemetryContract;
 import org.mozilla.gecko.home.BrowserSearch.OnEditSuggestionListener;
 import org.mozilla.gecko.home.BrowserSearch.OnSearchListener;
 import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
 import org.mozilla.gecko.icons.IconResponse;
 import org.mozilla.gecko.preferences.GeckoPreferences;
-import org.mozilla.gecko.util.DrawableUtil;
 import org.mozilla.gecko.util.StringUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.widget.AnimatedHeightLayout;
 import org.mozilla.gecko.widget.FaviconView;
 import org.mozilla.gecko.widget.FlowLayout;
 
 import android.content.Context;
 import android.content.SharedPreferences;
-import android.graphics.drawable.Drawable;
 import android.graphics.Typeface;
 import android.support.annotation.Nullable;
 import android.text.TextUtils;
 import android.text.style.StyleSpan;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
 import android.util.AttributeSet;
 import android.view.KeyEvent;
@@ -72,19 +70,16 @@ class SearchEngineRow extends AnimatedHe
     private OnSearchListener mSearchListener;
 
     // On edit suggestion listener
     private OnEditSuggestionListener mEditSuggestionListener;
 
     // Selected suggestion view
     private int mSelectedView;
 
-    // android:backgroundTint only works in Android 21 and higher so we can't do this statically in the xml
-    private Drawable mSearchHistorySuggestionIcon;
-
     // Maximums for suggestions
     private int mMaxSavedSuggestions;
     private int mMaxSearchSuggestions;
 
     private final List<Integer> mOccurrences = new ArrayList<Integer>();
 
     public SearchEngineRow(Context context) {
         this(context, null);
@@ -141,17 +136,16 @@ class SearchEngineRow extends AnimatedHe
         mSuggestionView = (FlowLayout) findViewById(R.id.suggestion_layout);
         mIconView = (FaviconView) findViewById(R.id.suggestion_icon);
 
         // User-entered search term is first suggestion
         mUserEnteredView = (LinearLayout) findViewById(R.id.suggestion_user_entered);
         mUserEnteredView.setOnClickListener(mClickListener);
 
         mUserEnteredTextView = (TextView) findViewById(R.id.suggestion_text);
-        mSearchHistorySuggestionIcon = DrawableUtil.tintDrawableWithColorRes(getContext(), R.drawable.icon_most_recent_empty, R.color.tabs_tray_icon_grey);
 
         // Suggestion limits
         mMaxSavedSuggestions = getResources().getInteger(R.integer.max_saved_suggestions);
         mMaxSearchSuggestions = getResources().getInteger(R.integer.max_search_suggestions);
     }
 
     private void setDescriptionOnSuggestion(View v, String suggestion) {
         v.setContentDescription(getResources().getString(R.string.suggestion_for_engine,
@@ -199,22 +193,17 @@ class SearchEngineRow extends AnimatedHe
      * All instances of mUserSearchTerm in the suggestion are not bold.
      *
      * @param v The View that needs to be populated
      * @param suggestion The suggestion text that will be placed in the view
      * @param isUserSavedSearch whether the suggestion is from history or not
      */
     private void setSuggestionOnView(View v, String suggestion, boolean isUserSavedSearch) {
         final ImageView historyIcon = (ImageView) v.findViewById(R.id.suggestion_item_icon);
-        if (isUserSavedSearch) {
-            historyIcon.setImageDrawable(mSearchHistorySuggestionIcon);
-            historyIcon.setVisibility(View.VISIBLE);
-        } else {
-            historyIcon.setVisibility(View.GONE);
-        }
+        historyIcon.setVisibility(isUserSavedSearch ? View.VISIBLE : View.GONE);
 
         final TextView suggestionText = (TextView) v.findViewById(R.id.suggestion_text);
         final String searchTerm = getSuggestionTextFromView(mUserEnteredView);
         final int searchTermLength = searchTerm.length();
         refreshOccurrencesWith(searchTerm, suggestion);
         if (mOccurrences.size() > 0) {
             final SpannableStringBuilder sb = new SpannableStringBuilder(suggestion);
             int nextStartSpanIndex = 0;
deleted file mode 100644
index 92b41a224a2a1ab1642880ca70f8c18e6bd45012..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 710fded09eef2511b190576d8b304db2101ab3ac..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/android/base/resources/layout/suggestion_item.xml
+++ b/mobile/android/base/resources/layout/suggestion_item.xml
@@ -9,20 +9,23 @@
               android:minHeight="32dp"
               android:orientation="horizontal"
               android:background="@drawable/search_suggestion_button"
               android:gravity="center_vertical"
               android:clickable="true"
               android:padding="5dp">
 
     <ImageView android:id="@+id/suggestion_item_icon"
-               android:src="@drawable/icon_most_recent_empty"
-               android:layout_marginRight="3dip"
-               android:layout_width="18dip"
-               android:layout_height="18dip"
+               android:src="@drawable/icon_recent"
+               android:layout_marginLeft="1dip"
+               android:layout_marginStart="1dip"
+               android:layout_marginRight="4dip"
+               android:layout_marginEnd="4dip"
+               android:layout_width="16dip"
+               android:layout_height="16dip"
                android:visibility="gone"/>
 
     <TextView android:id="@+id/suggestion_text"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:textColor="@color/text_and_tabs_tray_grey"
               android:textSize="14sp"
               android:gravity="center_vertical"