Skip to content

Commit

Permalink
Fix Enter key handling on API level 23 (closes #1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Sep 26, 2024
1 parent 26e944c commit 1b2fed5
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ public void afterTextChanged(Editable e) {
etInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE ||
(event != null && event.getAction() == KeyEvent.ACTION_UP)) {
if ((actionId == EditorInfo.IME_ACTION_DONE && event == null) || // Soft keyboard
(event != null && event.getAction() == KeyEvent.ACTION_UP) // Hard keyboard
) {
String text = etInput.getText().toString() + "\n";
etInput.setText("");
output(span(text, new StyleSpan(Typeface.BOLD)));
Expand Down

0 comments on commit 1b2fed5

Please sign in to comment.