merge fx-team to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 14 Sep 2015 13:47:41 +0200
changeset 262250 d885df6c27c10f5fba28b9523f00b5c416b476b2
parent 262247 b2b031d9239b355116ae3f613714f82298a48079 (current diff)
parent 262249 00693818cbf5fdd073dd4d895be44771091e9432 (diff)
child 262264 fba4b0cd3823975949765acc0b16b964d1712b75
push id29368
push usercbook@mozilla.com
push dateMon, 14 Sep 2015 11:47:56 +0000
treeherdermozilla-central@d885df6c27c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
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
merge fx-team to mozilla-central a=merge
--- a/mobile/android/base/home/SearchEngineRow.java
+++ b/mobile/android/base/home/SearchEngineRow.java
@@ -156,17 +156,17 @@ class SearchEngineRow extends AnimatedHe
             mSearchListener.onSearch(mSearchEngine, searchTerm);
         }
     }
 
     public void setSearchTerm(String searchTerm) {
         mUserEnteredTextView.setText(searchTerm);
 
         // mSearchEngine is not set in the first call to this method; the content description
-        // is instead initially set in updateFromSearchEngine.
+        // is instead initially set in updateSuggestions().
         if (mSearchEngine != null) {
             setDescriptionOnSuggestion(mUserEnteredTextView, searchTerm);
         }
     }
 
     public void setOnUrlOpenListener(OnUrlOpenListener listener) {
         mUrlOpenListener = listener;
     }
@@ -238,26 +238,17 @@ class SearchEngineRow extends AnimatedHe
                 } while (c.moveToNext());
             }
         } finally {
             c.close();
         }
         hideRecycledSuggestions(suggestionCounter, recycledSuggestionCount);
     }
 
-    private int updateFromSearchEngine(SearchEngine searchEngine, boolean animate, int recycledSuggestionCount) {
-        // Update search engine reference.
-        mSearchEngine = searchEngine;
-
-        // Set the search engine icon (e.g., Google) for the row.
-        mIconView.updateAndScaleImage(mSearchEngine.getIcon(), mSearchEngine.getEngineIdentifier());
-
-        // Set the initial content description.
-        setDescriptionOnSuggestion(mUserEnteredTextView, mUserEnteredTextView.getText().toString());
-
+    private int updateFromSearchEngine(boolean animate, int recycledSuggestionCount) {
         int suggestionCounter = 0;
         // Apply Search Engine's suggestions
         for (String suggestion : mSearchEngine.getSuggestions()) {
             bindSuggestionView(suggestion, animate, recycledSuggestionCount, suggestionCounter, false);
             ++suggestionCounter;
         }
 
         hideRecycledSuggestions(suggestionCounter, recycledSuggestionCount);
@@ -266,20 +257,26 @@ class SearchEngineRow extends AnimatedHe
         if (mSelectedView >= mSuggestionView.getChildCount()) {
             mSelectedView = mSuggestionView.getChildCount() - 1;
         }
 
         return suggestionCounter;
     }
 
     public void updateSuggestions(boolean suggestionsEnabled, SearchEngine searchEngine, String searchTerm, boolean animate) {
+        // Update search engine reference. Even if the user has not seen the prompt, we need to set the engine for the mSearchTerm suggestion
+        mSearchEngine = searchEngine;
+        // Set the search engine icon (e.g., Google) for the row.
+        mIconView.updateAndScaleImage(mSearchEngine.getIcon(), mSearchEngine.getEngineIdentifier());
+        // Set the initial content description.
+        setDescriptionOnSuggestion(mUserEnteredTextView, mUserEnteredTextView.getText().toString());
         // This can be called before the opt-in permission prompt is shown or set. Check first.
         if (suggestionsEnabled) {
             final int recycledSuggestionCount = mSuggestionView.getChildCount();
-            final int suggestionViewCount = updateFromSearchEngine(searchEngine, animate, recycledSuggestionCount);
+            final int suggestionViewCount = updateFromSearchEngine(animate, recycledSuggestionCount);
             if (AppConstants.NIGHTLY_BUILD) {
                 updateFromSavedSearches(searchTerm, animate, suggestionViewCount, recycledSuggestionCount);
             }
         }
     }
 
     @Override
     public boolean onKeyDown(int keyCode, android.view.KeyEvent event) {