зеркало из https://github.com/mozilla/gecko-dev.git
Bug 900148 - Handle taps on search/suggestion rows. r=lucasr
This commit is contained in:
Родитель
edbdd9ca7e
Коммит
8ba833df0c
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче