ed.apply();
}
+ private void addToSearchHistory() {
+ addToSearchHistory(searchView.getQuery().toString());
+ }
+
private void addToSearchHistory(String text) {
if (text == null || text.isEmpty()) return;
int exists = searchHistory.indexOf(text);
@Override
public boolean onSuggestionClick(int position) {
- setSearchText(searchHistory.get(position), true);
+ String h = searchHistory.get(position);
+ addToSearchHistory(h);
+ setSearchText(h, true);
return true;
}
});
for (int i = savedHistory.size() - 1; i >= 0; i--) {
addToSearchHistory(savedHistory.get(i));
}
+ addToSearchHistory(text);
setSearchText(text, true);
Log.d(LOG, "Trying to restore searchText=" + text);
@Override
public boolean onQueryTextSubmit(String query) {
Log.d(LOG, "OnQueryTextListener: onQueryTextSubmit: " + searchView.getQuery());
- addToSearchHistory(searchView.getQuery().toString());
+ addToSearchHistory();
hideKeyboard();
return true;
}
@Override
protected void onPause() {
super.onPause();
+ addToSearchHistory();
saveSearchHistory();
}
searchView.requestFocus();
}
if (searchView.getQuery().toString().length() > 0) {
+ addToSearchHistory();
searchView.setQuery("", false);
}
showKeyboard();
@Override
public void run() {
setIndexAndSearchText(actualIndexToUse, selectedText, true);
+ addToSearchHistory(selectedText);
}
}, 100);
}
if (hideKeyboard) {
hideKeyboard();
}
- addToSearchHistory(text);
}
private void setSearchText(final String text, final boolean triggerSearch) {