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

Commit ed82973e authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Interaction model of KeyboarView should be same as latimIME" into jb-dev

parents 321a56c8 b6a0b09b
Loading
Loading
Loading
Loading
+20 −15
Original line number Original line Diff line number Diff line
@@ -855,15 +855,23 @@ public class KeyboardView extends View implements View.OnClickListener {
                Key oldKey = keys[oldKeyIndex];
                Key oldKey = keys[oldKeyIndex];
                oldKey.onReleased(mCurrentKeyIndex == NOT_A_KEY);
                oldKey.onReleased(mCurrentKeyIndex == NOT_A_KEY);
                invalidateKey(oldKeyIndex);
                invalidateKey(oldKeyIndex);
                final int keyCode = oldKey.codes[0];
                sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT,
                sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT,
                        oldKey.codes[0]);
                        keyCode);
                // TODO: We need to implement AccessibilityNodeProvider for this view.
                sendAccessibilityEventForUnicodeCharacter(
                        AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED, keyCode);
            }
            }
            if (mCurrentKeyIndex != NOT_A_KEY && keys.length > mCurrentKeyIndex) {
            if (mCurrentKeyIndex != NOT_A_KEY && keys.length > mCurrentKeyIndex) {
                Key newKey = keys[mCurrentKeyIndex];
                Key newKey = keys[mCurrentKeyIndex];
                newKey.onPressed();
                newKey.onPressed();
                invalidateKey(mCurrentKeyIndex);
                invalidateKey(mCurrentKeyIndex);
                final int keyCode = newKey.codes[0];
                sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER,
                sendAccessibilityEventForUnicodeCharacter(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER,
                        newKey.codes[0]);
                        keyCode);
                // TODO: We need to implement AccessibilityNodeProvider for this view.
                sendAccessibilityEventForUnicodeCharacter(
                        AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED, keyCode);
            }
            }
        }
        }
        // If key changed and preview is on ...
        // If key changed and preview is on ...
@@ -1154,20 +1162,17 @@ public class KeyboardView extends View implements View.OnClickListener {
        if (mAccessibilityManager.isTouchExplorationEnabled() && event.getPointerCount() == 1) {
        if (mAccessibilityManager.isTouchExplorationEnabled() && event.getPointerCount() == 1) {
            final int action = event.getAction();
            final int action = event.getAction();
            switch (action) {
            switch (action) {
                case MotionEvent.ACTION_HOVER_ENTER:
                case MotionEvent.ACTION_HOVER_ENTER: {
                case MotionEvent.ACTION_HOVER_MOVE:
                    event.setAction(MotionEvent.ACTION_DOWN);
                    final int touchX = (int) event.getX() - mPaddingLeft;
                } break;
                    int touchY = (int) event.getY() - mPaddingTop;
                case MotionEvent.ACTION_HOVER_MOVE: {
                    if (touchY >= -mVerticalCorrection) {
                    event.setAction(MotionEvent.ACTION_MOVE);
                        touchY += mVerticalCorrection;
                } break;
                    }
                case MotionEvent.ACTION_HOVER_EXIT: {
                    final int keyIndex = getKeyIndices(touchX, touchY, null);
                    event.setAction(MotionEvent.ACTION_UP);
                    showPreview(keyIndex);
                } break;
                    break;
            }
                case MotionEvent.ACTION_HOVER_EXIT:
            return onTouchEvent(event);
                    showPreview(NOT_A_KEY);
                    break;
            }
        }
        }
        return true;
        return true;
    }
    }