Skip to content

Commit 74b0a8e

Browse files
SUPERCILEXsamtstern
authored andcommitted
Fix duplicated callback events in DonePressedListener (#885)
Signed-off-by: Alex Saveau <[email protected]>
1 parent 1e179c0 commit 74b0a8e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

auth/src/main/java/com/firebase/ui/auth/ui/ImeHelper.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ public static void setImeOnDoneListener(EditText doneEditText,
1717
doneEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
1818
@Override
1919
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
20-
if (event != null
21-
&& event.getKeyCode() == KeyEvent.KEYCODE_ENTER
22-
|| actionId == EditorInfo.IME_ACTION_DONE) {
20+
if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
21+
if (event.getAction() == KeyEvent.ACTION_UP) {
22+
listener.onDonePressed();
23+
}
24+
25+
// We need to return true even if we didn't handle the event to continue
26+
// receiving future callbacks.
27+
return true;
28+
} else if (actionId == EditorInfo.IME_ACTION_DONE) {
2329
listener.onDonePressed();
2430
return true;
2531
}

0 commit comments

Comments
 (0)