Example usage for android.view KeyEvent META_FUNCTION_ON

List of usage examples for android.view KeyEvent META_FUNCTION_ON

Introduction

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

Prototype

int META_FUNCTION_ON

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

Click Source Link

Document

This mask is used to check whether the FUNCTION meta key is pressed.

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;
        }/*from www. jav a  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);
    }
}