Trigger onSearchConfirmed when pressing the "ENTER" key (tablets with external keyboard)
svrzii opened this issue · 0 comments
svrzii commented
Hello,
I'm having difficulties using the fork through jitpack.io (1.1.4 does not build successfully). I'm getting this: "
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