Bug 732902 - Set list of search engines in one step (r=mfinkle)

This commit is contained in:
Lucas Rocha 2013-01-23 17:54:00 +00:00
Родитель 94af92dd8f
Коммит d27ec088d9
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -566,7 +566,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
boolean suggestionsPrompted = suggest.getBoolean("prompted");
JSONArray engines = data.getJSONArray("searchEngines");
mSearchEngines = new ArrayList<SearchEngine>();
ArrayList<SearchEngine> searchEngines = new ArrayList<SearchEngine>();
for (int i = 0; i < engines.length(); i++) {
JSONObject engineJSON = engines.getJSONObject(i);
String name = engineJSON.getString("name");
@ -574,7 +574,7 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
Bitmap icon = BitmapUtils.getBitmapFromDataURI(iconURI);
if (name.equals(suggestEngine) && suggestTemplate != null) {
// suggest engine should be at the front of the list
mSearchEngines.add(0, new SearchEngine(name, icon));
searchEngines.add(0, new SearchEngine(name, icon));
// The only time Tabs.getInstance().getSelectedTab() should
// be null is when we're restoring after a crash. We should
@ -584,9 +584,11 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
if (tab == null || !tab.isPrivate())
mSuggestClient = new SuggestClient(GeckoApp.mAppContext, suggestTemplate, SUGGESTION_TIMEOUT, SUGGESTION_MAX);
} else {
mSearchEngines.add(new SearchEngine(name, icon));
searchEngines.add(new SearchEngine(name, icon));
}
}
mSearchEngines = searchEngines;
mCursorAdapter.notifyDataSetChanged();
// show suggestions opt-in if user hasn't been prompted