Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a7421ba authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Don't submit a query if it's whitespace only.

Just to maintain backward compatibility. It's not documented that a space
is not a valid query, but it does make sense to expect that.
Bug: 5079755

Also avoid showing an x by an empty query, by having the SearchDialog simulate an ActionBar.

Change-Id: I3a9332286a439b659e179a249587c491ef29e5c1
parent 72de151f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ public class SearchDialog extends Dialog {
        mSearchView.setOnCloseListener(mOnCloseListener);
        mSearchView.setOnQueryTextListener(mOnQueryChangeListener);
        mSearchView.setOnSuggestionListener(mOnSuggestionSelectionListener);
        mSearchView.onActionViewExpanded();

        mCloseSearch = findViewById(com.android.internal.R.id.closeButton);
        mCloseSearch.setOnClickListener(new View.OnClickListener() {
+1 −1
Original line number Diff line number Diff line
@@ -958,7 +958,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {

    private void onSubmitQuery() {
        CharSequence query = mQueryTextView.getText();
        if (!TextUtils.isEmpty(query)) {
        if (query != null && TextUtils.getTrimmedLength(query) > 0) {
            if (mOnQueryChangeListener == null
                    || !mOnQueryChangeListener.onQueryTextSubmit(query.toString())) {
                if (mSearchable != null) {