Example usage for android.view KeyEvent META_ALT_MASK

List of usage examples for android.view KeyEvent META_ALT_MASK

Introduction

In this page you can find the example usage for android.view KeyEvent META_ALT_MASK.

Prototype

int META_ALT_MASK

To view the source code for android.view KeyEvent META_ALT_MASK.

Click Source Link

Document

This mask is a combination of #META_ALT_ON , #META_ALT_LEFT_ON and #META_ALT_RIGHT_ON .

Usage

From source file:org.distantshoresmedia.keyboard.LatinIME.java

public void updateShiftKeyState(EditorInfo attr) {
    InputConnection ic = getCurrentInputConnection();
    if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode()) {
        int oldState = getShiftState();
        boolean isShifted = mShiftKeyState.isChording();
        boolean isCapsLock = (oldState == Keyboard.SHIFT_CAPS_LOCKED || oldState == Keyboard.SHIFT_LOCKED);
        boolean isCaps = isCapsLock || getCursorCapsMode(ic, attr) != 0;
        //Log.i(TAG, "updateShiftKeyState isShifted=" + isShifted + " isCaps=" + isCaps + " isMomentary=" + mShiftKeyState.isMomentary() + " cursorCaps=" + getCursorCapsMode(ic, attr));
        int newState = Keyboard.SHIFT_OFF;
        if (isShifted) {
            newState = (mSavedShiftState == Keyboard.SHIFT_LOCKED) ? Keyboard.SHIFT_CAPS : Keyboard.SHIFT_ON;
        } else if (isCaps) {
            newState = isCapsLock ? getCapsOrShiftLockState() : Keyboard.SHIFT_CAPS;
        }//w  w  w  .j a va 2  s  . c  o  m
        //Log.i(TAG, "updateShiftKeyState " + oldState + " -> " + newState);
        mKeyboardSwitcher.setShiftState(newState);
    }
    if (ic != null) {
        // Clear modifiers other than shift, to avoid them getting stuck
        int states = KeyEvent.META_FUNCTION_ON | KeyEvent.META_ALT_MASK | KeyEvent.META_CTRL_MASK
                | KeyEvent.META_META_MASK | KeyEvent.META_SYM_ON;
        ic.clearMetaKeyStates(states);
    }
}