KeyEvent getMetaState - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for KeyEvent getMetaState method.

This code example shows how to use the following methods:getAction, getKeyCode, getMetaState, getUnicodeChar
        super.onDestroy(); 
    } 
 
    @Override 
    public boolean dispatchKeyEvent(KeyEvent event) {
        switch (event.getAction()) {
            case KeyEvent.ACTION_DOWN:
                int uni = event.getUnicodeChar(event.getMetaState());
                return handleKeyDown(event.getKeyCode(), uni);
            case KeyEvent.ACTION_UP:
                return handleKeyUp(event.getKeyCode());
            default: 
                return false; 
        } 
    } 
 
    @Override 
    public void setTitle(CharSequence title) {
        mTitle.setText(title);
    } 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getAction, getEventTime, getKeyCode, getMetaState, getUnicodeChar
    } 
 
    boolean translateAndSendNativeEvents(KeyEvent event) {
        if (mNativeImeAdapterAndroid == 0) return false;
 
        int action = event.getAction();
        if (action != KeyEvent.ACTION_DOWN &&
            action != KeyEvent.ACTION_UP) {
            // action == KeyEvent.ACTION_MULTIPLE 
            // TODO(bulach): confirm the actual behavior. Apparently: 
            // If event.getKeyCode() == KEYCODE_UNKNOWN, we can send a 
            // composition key down (229) followed by a commit text with the 
            // string from event.getUnicodeChars(). 
            // Otherwise, we'd need to send an event with a 
            // WebInputEvent::IsAutoRepeat modifier. We also need to verify when 
            // we receive ACTION_MULTIPLE: we may receive it after an ACTION_DOWN, 
            // and if that's the case, we'll need to review when to send the Char 
            // event. 
            return false; 
        } 

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:handleKeyDown, getMetaState, getUnicodeChar
     * This translates incoming hard key events in to edit operations on an 
     * InputConnection.  It is only needed when using the 
     * PROCESS_HARD_KEYS option. 
     */ 
    private boolean translateKeyDown(int keyCode, KeyEvent event) {
        mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
                keyCode, event);
        int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
        mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
        InputConnection ic = getCurrentInputConnection();
        if (c == 0 || ic == null) {
            return false; 
        } 
         
        boolean dead = false;
 
        if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
            dead = true;
            c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
        } 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMetaState, getUnicodeChar
		case KeyEvent.KEYCODE_BACK:
			result = mBackKeyCode;
			break; 
 
		default: { 
			int metaState = event.getMetaState();
			chordedCtrl = ((META_CTRL_ON & metaState) != 0);
			boolean effectiveCaps = allowToggle && (mCapKey.isActive());
			boolean effectiveAlt = allowToggle && mAltKey.isActive();
			int effectiveMetaState = metaState & (~META_CTRL_MASK);
			if (effectiveCaps) {
				effectiveMetaState |= KeyEvent.META_SHIFT_ON;
			} 
			if (!allowToggle && (effectiveMetaState & META_ALT_ON) != 0) {
				effectiveAlt = true;
			} 
			if (effectiveAlt) {
				if (mAltSendsEsc) {
					mTermSession.write(new byte[] { 0x1b }, 0, 1);
					effectiveMetaState &= ~KeyEvent.META_ALT_MASK;

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:handleKeyDown, getMetaState, getUnicodeChar
	 * This translates incoming hard key events in to edit operations on an 
	 * InputConnection. It is only needed when using the PROCESS_HARD_KEYS 
	 * option. 
	 */ 
	private boolean translateKeyDown(int keyCode, KeyEvent event) {
		mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState, keyCode,
				event);
		int c = event.getUnicodeChar(MetaKeyKeyListener
				.getMetaState(mMetaState));
		mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
		InputConnection ic = getCurrentInputConnection();
		if (c == 0 || ic == null) {
			return false; 
		} 
 
		if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
			c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
		} 
 
		if (mComposing.length() > 0) {

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:handleKeyDown, getMetaState, getUnicodeChar
     * This translates incoming hard key events in to edit operations on an 
     * InputConnection.  It is only needed when using the 
     * PROCESS_HARD_KEYS option. 
     */ 
    private boolean translateKeyDown(int keyCode, KeyEvent event) {
        mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
                keyCode, event);
        int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
        mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
        InputConnection ic = getCurrentInputConnection();
        if (c == 0 || ic == null) {
            return false; 
        } 
         
        boolean dead = false;
 
        if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
            dead = true;
            c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
        } 

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMetaState, getUnicodeChar, isAltPressed
    private boolean processStateInput(int keyChar, int keyCode, KeyEvent event,
            boolean realAction) {
        // If ALT key is pressed, input alternative key. But if the 
        // alternative key is quote key, it will be used for input a splitter 
        // in Pinyin string. 
        if (event.isAltPressed()) {
            if ('\'' != event.getUnicodeChar(event.getMetaState())) {
                if (realAction) {
                    char fullwidth_char = KeyMapDream.getChineseLabel(keyCode);
                    if (0 != fullwidth_char) {
                        commitResultText(mDecInfo
                                .getCurrentFullSent(mCandidatesContainer
                                        .getActiveCandiatePos()) + 
                                        String.valueOf(fullwidth_char));
                        resetToIdleState(false); 
                    } 
                } 
                return true; 
            } else { 
                keyChar = '\'';
3
CodeRank
Experience pair programming with AI  Get Codota for Java

Related KeyEvent getMetaState Questions & Answers:

getMetaState Method Overview
Returns the state of the meta keys.
See Code Examples for other Android KeyEvent Methods: