Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java |
| index a842cc2d072ae051c1cd48829be72d926ebda0aa..dc2cb90a91b48eb6fd123b38a8fa90c3f79e9f78 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SearchEngineAdapter.java |
| @@ -89,7 +89,7 @@ public class SearchEngineAdapter extends BaseAdapter implements LoadListener, On |
| } |
| void setValueForTesting(String value) { |
| - radioButtonClicked(Integer.parseInt(value)); |
| + searchEngineSelected(Integer.parseInt(value)); |
| } |
| /** |
| @@ -164,22 +164,19 @@ public class SearchEngineAdapter extends BaseAdapter implements LoadListener, On |
| view = mLayoutInflater.inflate(R.layout.search_engine, null); |
| } |
| - RadioButton radioButton = (RadioButton) view.findViewById(R.id.radiobutton); |
| - TextView description = (TextView) view.findViewById(R.id.description); |
| - TextView link = (TextView) view.findViewById(R.id.link); |
| - |
| - TemplateUrl templateUrl = mSearchEngines.get(position); |
| - Resources resources = mContext.getResources(); |
| + view.setOnClickListener(this); |
| + view.setTag(position); |
| + RadioButton radioButton = (RadioButton) view.findViewById(R.id.radiobutton); |
| boolean selected = position == mSelectedSearchEnginePosition; |
| radioButton.setChecked(selected); |
| - radioButton.setOnClickListener(this); |
| - radioButton.setTag(position); |
| + TextView description = (TextView) view.findViewById(R.id.description); |
| + TemplateUrl templateUrl = mSearchEngines.get(position); |
| + Resources resources = mContext.getResources(); |
| description.setText(getSearchEngineNameAndDomain(resources, templateUrl)); |
| - description.setOnClickListener(this); |
| - description.setTag(position); |
|
Finnur
2015/04/29 09:55:13
Just to confirm... clicking on the description sti
newt (away)
2015/04/29 17:33:05
Yes. Click events are first sent to the deepest vi
|
| + TextView link = (TextView) view.findViewById(R.id.link); |
| link.setVisibility(selected ? View.VISIBLE : View.GONE); |
| if (selected) { |
| ForegroundColorSpan linkSpan = new ForegroundColorSpan( |
| @@ -219,19 +216,17 @@ public class SearchEngineAdapter extends BaseAdapter implements LoadListener, On |
| if (view.getTag() == null) { |
| onLocationLinkClicked(); |
| } else { |
| - radioButtonClicked((int) view.getTag()); |
| + searchEngineSelected((int) view.getTag()); |
| } |
| } |
| - private void radioButtonClicked(int position) { |
| + private void searchEngineSelected(int position) { |
| // First clean up any automatically added permissions (if any) for the previously selected |
| // search engine. |
| SharedPreferences sharedPreferences = |
| PreferenceManager.getDefaultSharedPreferences(mContext); |
| if (sharedPreferences.getBoolean(PrefServiceBridge.LOCATION_AUTO_ALLOWED, false)) { |
| if (locationEnabled(mSelectedSearchEnginePosition)) { |
| - TemplateUrl templateUrl = mSearchEngines.get(mSelectedSearchEnginePosition); |
|
newt (away)
2015/04/29 00:02:25
dead code
|
| - |
| String url = TemplateUrlService.getInstance().getSearchEngineUrlFromTemplateUrl( |
| toIndex(mSelectedSearchEnginePosition)); |
| WebsitePreferenceBridge.nativeSetGeolocationSettingForOrigin( |