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

Commit f28d1875 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Make sure that suggestions are queried on focus or tapping.

Bug: 3110831
Change-Id: Ic74a7eac1c5aa7d07c8a2e3f1ad19e026c990153
parent e3f5edf9
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
        mCloseButton.setOnClickListener(mOnClickListener);
        mSubmitButton.setOnClickListener(mOnClickListener);
        mVoiceButton.setOnClickListener(mOnClickListener);
        mQueryTextView.setOnClickListener(mOnClickListener);

        mQueryTextView.addTextChangedListener(mTextWatcher);
        mQueryTextView.setOnEditorActionListener(mOnEditorActionListener);
@@ -319,7 +320,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
        // If it is not iconified, then give the focus to the text field
        if (!isIconified()) {
            boolean result = mQueryTextView.requestFocus(direction, previouslyFocusedRect);
            if (result) updateViewsVisibility(false);
            if (result) {
                updateViewsVisibility(false);
            }
            return result;
        } else {
            return super.requestFocus(direction, previouslyFocusedRect);
@@ -681,6 +684,8 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
                onSubmitQuery();
            } else if (v == mVoiceButton) {
                onVoiceClicked();
            } else if (v == mQueryTextView) {
                forceSuggestionQuery();
            }
        }
    };
@@ -1029,6 +1034,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
    void onTextFocusChanged() {
        updateViewsVisibility(isIconified());
        updateFocusedState(mQueryTextView.hasFocus());
        if (mQueryTextView.hasFocus()) {
            forceSuggestionQuery();
        }
    }

    @Override
@@ -1376,6 +1384,11 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
        }
    }

    private void forceSuggestionQuery() {
        mQueryTextView.doBeforeTextChanged();
        mQueryTextView.doAfterTextChanged();
    }

    static boolean isLandscapeMode(Context context) {
        return context.getResources().getConfiguration().orientation
                == Configuration.ORIENTATION_LANDSCAPE;