Bug 900148 - Handle taps on search/suggestion rows. r=lucasr

This commit is contained in:
Margaret Leibovic 2013-08-05 11:59:49 -07:00
parent edbdd9ca7e
commit 8ba833df0c

View File

@ -109,6 +109,23 @@ class SearchEngineRow extends AnimatedHeightLayout {
mUserEnteredView.setOnClickListener(mClickListener);
mUserEnteredTextView = (TextView) findViewById(R.id.suggestion_text);
// Handle clicks on this row that don't happen on individual suggestion views.
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Don't do anything if we are showing suggestions.
if (mSearchEngine.suggestions.size() > 0) {
return;
}
// Otherwise, perform a search for the user entered term.
String searchTerm = getSuggestionTextFromView(mUserEnteredView);
if (mSearchListener != null) {
mSearchListener.onSearch(mSearchEngine.name, searchTerm);
}
}
});
}
private String getSuggestionTextFromView(View v) {