示例#1
0
        private static long release(long state, int what, long mask, long pressed, long released
                                    , long used, android.view.KeyEvent @event)
        {
            switch (@event.getKeyCharacterMap().getModifierBehavior())
            {
            case android.view.KeyCharacterMap.MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED:
            {
                if ((state & used) != 0)
                {
                    state &= ~mask;
                }
                else
                {
                    if ((state & pressed) != 0)
                    {
                        state |= what | released;
                    }
                }
                break;
            }

            default:
            {
                state &= ~mask;
                break;
            }
            }
            return(state);
        }
示例#2
0
        private android.text.method.KeyListener getKeyListener(android.view.KeyEvent @event
                                                               )
        {
            android.view.KeyCharacterMap kmap = @event.getKeyCharacterMap();
            int kind = kmap.getKeyboardType();

            if (kind == android.view.KeyCharacterMap.ALPHA)
            {
                return(android.text.method.QwertyKeyListener.getInstance(mAutoText, mAutoCap));
            }
            else
            {
                if (kind == android.view.KeyCharacterMap.NUMERIC)
                {
                    return(android.text.method.MultiTapKeyListener.getInstance(mAutoText, mAutoCap));
                }
                else
                {
                    if (kind == android.view.KeyCharacterMap.FULL || kind == android.view.KeyCharacterMap
                        .SPECIAL_FUNCTION)
                    {
                        // We consider special function keyboards full keyboards as a workaround for
                        // devices that do not have built-in keyboards.  Applications may try to inject
                        // key events using the built-in keyboard device id which may be configured as
                        // a special function keyboard using a default key map.  Ideally, as of Honeycomb,
                        // these applications should be modified to use KeyCharacterMap.VIRTUAL_KEYBOARD.
                        return(android.text.method.QwertyKeyListener.getInstanceForFullKeyboard());
                    }
                }
            }
            return(android.text.method.TextKeyListener.NullKeyListener.getInstance());
        }
示例#3
0
        // no super to call through to
        private void release(android.text.Editable content, object what, android.view.KeyEvent
                             @event)
        {
            int current = content.getSpanFlags(what);

            switch (@event.getKeyCharacterMap().getModifierBehavior())
            {
            case android.view.KeyCharacterMap.MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED:
            {
                if (current == USED)
                {
                    content.removeSpan(what);
                }
                else
                {
                    if (current == PRESSED)
                    {
                        content.setSpan(what, 0, 0, RELEASED);
                    }
                }
                break;
            }

            default:
            {
                content.removeSpan(what);
                break;
            }
            }
        }