Search in sources :

Example 1 with MainKeyboardView

use of com.android.inputmethod.keyboard.MainKeyboardView in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LatinIME method onFinishInputInternal.

void onFinishInputInternal() {
    super.onFinishInput();
    mDictionaryFacilitator.onFinishInput(this);
    final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
    if (mainKeyboardView != null) {
        mainKeyboardView.closing();
    }
}
Also used : MainKeyboardView(com.android.inputmethod.keyboard.MainKeyboardView)

Example 2 with MainKeyboardView

use of com.android.inputmethod.keyboard.MainKeyboardView in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LatinIME method onCodeInput.

// Implementation of {@link KeyboardActionListener}.
@Override
public void onCodeInput(final int codePoint, final int x, final int y, final boolean isKeyRepeat) {
    // TODO: this processing does not belong inside LatinIME, the caller should be doing this.
    final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
    // x and y include some padding, but everything down the line (especially native
    // code) needs the coordinates in the keyboard frame.
    // TODO: We should reconsider which coordinate system should be used to represent
    // keyboard event. Also we should pull this up -- LatinIME has no business doing
    // this transformation, it should be done already before calling onEvent.
    final int keyX = mainKeyboardView.getKeyX(x);
    final int keyY = mainKeyboardView.getKeyY(y);
    final Event event = createSoftwareKeypressEvent(getCodePointForKeyboard(codePoint), keyX, keyY, isKeyRepeat);
    onEvent(event);
}
Also used : MainKeyboardView(com.android.inputmethod.keyboard.MainKeyboardView) Event(com.android.inputmethod.event.Event) KeyEvent(android.view.KeyEvent)

Example 3 with MainKeyboardView

use of com.android.inputmethod.keyboard.MainKeyboardView in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LatinIME method onUpdateMainDictionaryAvailability.

// Note that this method is called from a non-UI thread.
@Override
public void onUpdateMainDictionaryAvailability(final boolean isMainDictionaryAvailable) {
    final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
    if (mainKeyboardView != null) {
        mainKeyboardView.setMainDictionaryAvailability(isMainDictionaryAvailable);
    }
    if (mHandler.hasPendingWaitForDictionaryLoad()) {
        mHandler.cancelWaitForDictionaryLoad();
        mHandler.postResumeSuggestions(false);
    }
}
Also used : MainKeyboardView(com.android.inputmethod.keyboard.MainKeyboardView)

Example 4 with MainKeyboardView

use of com.android.inputmethod.keyboard.MainKeyboardView in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LatinIME method hapticAndAudioFeedback.

private void hapticAndAudioFeedback(final int code, final int repeatCount) {
    final MainKeyboardView keyboardView = mKeyboardSwitcher.getMainKeyboardView();
    if (keyboardView != null && keyboardView.isInDraggingFinger()) {
        // No need to feedback while finger is dragging.
        return;
    }
    if (repeatCount > 0) {
        if (code == Constants.CODE_DELETE && !mInputLogic.mConnection.canDeleteCharacters()) {
            // No need to feedback when repeat delete key will have no effect.
            return;
        }
        // a repeat count to thin out feedback.
        if (repeatCount % PERIOD_FOR_AUDIO_AND_HAPTIC_FEEDBACK_IN_KEY_REPEAT == 0) {
            return;
        }
    }
    final AudioAndHapticFeedbackManager feedbackManager = AudioAndHapticFeedbackManager.getInstance();
    if (repeatCount == 0) {
        // TODO: Reconsider how to perform haptic feedback when repeating key.
        feedbackManager.performHapticFeedback(keyboardView);
    }
    feedbackManager.performAudioFeedback(code);
}
Also used : MainKeyboardView(com.android.inputmethod.keyboard.MainKeyboardView)

Example 5 with MainKeyboardView

use of com.android.inputmethod.keyboard.MainKeyboardView in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class LatinIME method showGesturePreviewAndSuggestionStrip.

// This method must run on the UI Thread.
void showGesturePreviewAndSuggestionStrip(@Nonnull final SuggestedWords suggestedWords, final boolean dismissGestureFloatingPreviewText) {
    showSuggestionStrip(suggestedWords);
    final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
    mainKeyboardView.showGestureFloatingPreviewText(suggestedWords, dismissGestureFloatingPreviewText);
}
Also used : MainKeyboardView(com.android.inputmethod.keyboard.MainKeyboardView)

Aggregations

MainKeyboardView (com.android.inputmethod.keyboard.MainKeyboardView)8 Intent (android.content.Intent)1 KeyEvent (android.view.KeyEvent)1 AccessibilityUtils (com.android.inputmethod.accessibility.AccessibilityUtils)1 Event (com.android.inputmethod.event.Event)1 KeyboardSwitcher (com.android.inputmethod.keyboard.KeyboardSwitcher)1 SettingsValues (com.android.inputmethod.latin.settings.SettingsValues)1