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

Commit 2dfba67a authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Filter out ACTION_UP events in onKey() listener.

Previously we invokes performeSave both for ACTION_DOWN and ACTION_UP,
thus it creates two documents.

Change-Id: I7fc2a62c34fc239c2bf3ca6c71122e360d589727
Fixes: 28179791
parent 790cd3c9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -84,6 +84,13 @@ public class SaveFragment extends Fragment {
                new View.OnKeyListener() {
                    @Override
                    public boolean onKey(View v, int keyCode, KeyEvent event) {
                        // Only handle key-down events. This is simpler, consistent with most other
                        // UIs, and enables the handling of repeated key events from holding down a
                        // key.
                        if (event.getAction() != KeyEvent.ACTION_DOWN) {
                            return false;
                        }

                        if (keyCode == KeyEvent.KEYCODE_ENTER && mSave.isEnabled()) {
                            performSave();
                            return true;