mars885/persistent-search-view

Trigger onSearchConfirmed when pressing the "ENTER" key (tablets with external keyboard)

svrzii opened this issue · 0 comments

Hello,

I'm having difficulties using the fork through jitpack.io (1.1.4 does not build successfully). I'm getting this: "⚠️ ERROR: No build artifacts found". https://jitpack.io/com/github/svrzii/persistent-search-view/v1.1.4/build.log

Is it possible to add this statement to the project, so on pressing ENTER, the listener would trigger correctly?

private final TextView.OnEditorActionListener mInternalEditorActionListener = new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
            if((actionId == EditorInfo.IME_ACTION_SEARCH) && (onSearchConfirmedListener != null)) {
                onSearchConfirmedListener.onSearchConfirmed(PersistentSearchView.this, getInputQuery());
            } else if (event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
                onSearchConfirmedListener.onSearchConfirmed(PersistentSearchView.this, getInputQuery());
            }

            return true;
        }
  };

https://github.com/svrzii/persistent-search-view/commit/23cccd82d10ec9f2fee04884d9b455eeae8f5684