Moving cursor to the end of the search query when set explicitly.
This situation is encountered in Contacts when the activity intercepts unsolicited input from the keyboard, takes that character entered by the user and switches the whole app to "search mode". At this time it puts the character entered by the user in the search field. The user should be able to continue typing. Change-Id: Ief40f12bb8f31bced6114d61a0fd95472f21b1be
This commit is contained in:
@@ -306,6 +306,10 @@ public class SearchView extends LinearLayout {
|
||||
*/
|
||||
public void setQuery(CharSequence query, boolean submit) {
|
||||
mQueryTextView.setText(query);
|
||||
if (query != null) {
|
||||
mQueryTextView.setSelection(query.length());
|
||||
}
|
||||
|
||||
// If the query is not empty and submit is requested, submit the query
|
||||
if (submit && !TextUtils.isEmpty(query)) {
|
||||
onSubmitQuery();
|
||||
|
||||
Reference in New Issue
Block a user