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

Commit abb27777 authored by Joe Onorato's avatar Joe Onorato
Browse files

Don't cancel the key buttons when you drag outside their bounds.

Bug: 3183205
Change-Id: I9e0f2e4e550b3e5b1b46099145b4c703b77aca77
parent 64f11630
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -100,18 +100,20 @@ public class KeyButtonView extends ImageView {
                if (mSending) {
                    x = (int)ev.getX();
                    y = (int)ev.getY();
                    if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) {
                    setPressed(x >= 0 && x < getWidth() && y >= 0 &&  y < getHeight());
                }
                break;
            case MotionEvent.ACTION_CANCEL:
                setPressed(false);
                if (mSending && !mLongPressed) {
                    mSending = false;
                    sendEvent(KeyEvent.ACTION_UP,
                            KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY
                                | KeyEvent.FLAG_CANCELED);
                        setPressed(false);
                    removeCallbacks(mCheckLongPress);
                }
                }
                break;
            case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_CANCEL:
                setPressed(false);
                if (mSending && !mLongPressed) {
                    mSending = false;