Search in sources :

Example 16 with Event

use of com.android.inputmethod.event.Event in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class InputLogicTestsDeadKeys method testDoubleDeadOgonek.

public void testDoubleDeadOgonek() {
    final int MODIFIER_LETTER_OGONEK = 0x02DB;
    final String EXPECTED_RESULT = "txǫs˛fk";
    final EventList events = new EventList().addCodePoint('t', false).addCodePoint('x', false).addCodePoint(MODIFIER_LETTER_OGONEK, true).addCodePoint('o', false).addCodePoint('s', false).addCodePoint(MODIFIER_LETTER_OGONEK, true).addCodePoint(MODIFIER_LETTER_OGONEK, true).addCodePoint('f', false).addCodePoint(MODIFIER_LETTER_OGONEK, true).addCodePoint(MODIFIER_LETTER_OGONEK, true).addKey(Constants.CODE_DELETE).addCodePoint('k', false);
    for (final Event event : events) {
        mLatinIME.onEvent(event);
    }
    assertEquals("double dead ogonek, and backspace", EXPECTED_RESULT, mEditText.getText().toString());
}
Also used : Event(com.android.inputmethod.event.Event)

Example 17 with Event

use of com.android.inputmethod.event.Event in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class InputLogicTestsDeadKeys method testFinnishStroke.

public void testFinnishStroke() {
    final int MODIFIER_LETTER_STROKE = '-';
    final String EXPECTED_RESULT = "xĐħ";
    final EventList events = new EventList().addCodePoint('x', false).addCodePoint(MODIFIER_LETTER_STROKE, true).addCodePoint('D', false).addCodePoint(MODIFIER_LETTER_STROKE, true).addCodePoint('h', false);
    for (final Event event : events) {
        mLatinIME.onEvent(event);
    }
    assertEquals("Finnish dead stroke", EXPECTED_RESULT, mEditText.getText().toString());
}
Also used : Event(com.android.inputmethod.event.Event)

Example 18 with Event

use of com.android.inputmethod.event.Event in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class WordComposer method processEvent.

/**
     * Process an event and return an event, and return a processed event to apply.
     * @param event the unprocessed event.
     * @return the processed event. Never null, but may be marked as consumed.
     */
@Nonnull
public Event processEvent(@Nonnull final Event event) {
    final Event processedEvent = mCombinerChain.processEvent(mEvents, event);
    // The retained state of the combiner chain may have changed while processing the event,
    // so we need to update our cache.
    refreshTypedWordCache();
    mEvents.add(event);
    return processedEvent;
}
Also used : Event(com.android.inputmethod.event.Event) Nonnull(javax.annotation.Nonnull)

Example 19 with Event

use of com.android.inputmethod.event.Event in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LatinIME method onKeyDown.

// Hooks for hardware keyboard
@Override
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
    if (mEmojiAltPhysicalKeyDetector == null) {
        mEmojiAltPhysicalKeyDetector = new EmojiAltPhysicalKeyDetector(getApplicationContext().getResources());
    }
    mEmojiAltPhysicalKeyDetector.onKeyDown(keyEvent);
    if (!ProductionFlags.IS_HARDWARE_KEYBOARD_SUPPORTED) {
        return super.onKeyDown(keyCode, keyEvent);
    }
    final Event event = getHardwareKeyEventDecoder(keyEvent.getDeviceId()).decodeHardwareKey(keyEvent);
    // If it's handled, we return true because we did handle it.
    if (event.isHandled()) {
        mInputLogic.onCodeInput(mSettings.getCurrent(), event, mKeyboardSwitcher.getKeyboardShiftMode(), // TODO: this is not necessarily correct for a hardware keyboard right now
        mKeyboardSwitcher.getCurrentKeyboardScriptId(), mHandler);
        return true;
    }
    return super.onKeyDown(keyCode, keyEvent);
}
Also used : Event(com.android.inputmethod.event.Event) KeyEvent(android.view.KeyEvent)

Example 20 with Event

use of com.android.inputmethod.event.Event in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LatinIME method onTextInput.

// Called from PointerTracker through the KeyboardActionListener interface
@Override
public void onTextInput(final String rawText) {
    // TODO: have the keyboard pass the correct key code when we need it.
    final Event event = Event.createSoftwareTextEvent(rawText, Constants.CODE_OUTPUT_TEXT);
    final InputTransaction completeInputTransaction = mInputLogic.onTextInput(mSettings.getCurrent(), event, mKeyboardSwitcher.getKeyboardShiftMode(), mHandler);
    updateStateAfterInputTransaction(completeInputTransaction);
    mKeyboardSwitcher.onEvent(event, getCurrentAutoCapsState(), getCurrentRecapitalizeState());
}
Also used : InputTransaction(com.android.inputmethod.event.InputTransaction) Event(com.android.inputmethod.event.Event) KeyEvent(android.view.KeyEvent)

Aggregations

Event (com.android.inputmethod.event.Event)21 KeyEvent (android.view.KeyEvent)6 InputTransaction (com.android.inputmethod.event.InputTransaction)3 Point (android.graphics.Point)1 SpannableString (android.text.SpannableString)1 Key (com.android.inputmethod.keyboard.Key)1 MainKeyboardView (com.android.inputmethod.keyboard.MainKeyboardView)1 SuggestedWords (com.android.inputmethod.latin.SuggestedWords)1 Nonnull (javax.annotation.Nonnull)1