Search in sources :

Example 1 with KeyboardLayoutSet

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

the class AndroidSpellCheckerService method createKeyboardSetForSpellChecker.

private KeyboardLayoutSet createKeyboardSetForSpellChecker(final InputMethodSubtype subtype) {
    final EditorInfo editorInfo = new EditorInfo();
    editorInfo.inputType = InputType.TYPE_CLASS_TEXT;
    final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(this, editorInfo);
    builder.setKeyboardGeometry(SPELLCHECKER_DUMMY_KEYBOARD_WIDTH, SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT);
    builder.setSubtype(RichInputMethodSubtype.getRichInputMethodSubtype(subtype));
    builder.setIsSpellChecker(true);
    builder.disableTouchPositionCorrectionData();
    return builder.build();
}
Also used : EditorInfo(android.view.inputmethod.EditorInfo) KeyboardLayoutSet(com.android.inputmethod.keyboard.KeyboardLayoutSet)

Example 2 with KeyboardLayoutSet

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

the class ActionTestsBase method doTestActionKey.

protected void doTestActionKey(final String tag, final InputMethodSubtype subtype, final EditorInfo editorInfo, final ExpectedActionKey expectedKey) {
    // Test text layouts.
    editorInfo.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL;
    final KeyboardLayoutSet layoutSet = createKeyboardLayoutSet(subtype, editorInfo);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_ALPHABET, expectedKey);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS, expectedKey);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_SYMBOLS_SHIFTED, expectedKey);
    // Test phone number layouts.
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE, expectedKey);
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_PHONE_SYMBOLS, expectedKey);
    // Test normal number layout.
    assertActionKey(tag, layoutSet, KeyboardId.ELEMENT_NUMBER, expectedKey);
    // Test number password layout.
    editorInfo.inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
    final KeyboardLayoutSet passwordSet = createKeyboardLayoutSet(subtype, editorInfo);
    assertActionKey(tag, passwordSet, KeyboardId.ELEMENT_NUMBER, expectedKey);
}
Also used : KeyboardLayoutSet(com.android.inputmethod.keyboard.KeyboardLayoutSet)

Example 3 with KeyboardLayoutSet

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

the class AndroidSpellCheckerService method createKeyboardForLocale.

private Keyboard createKeyboardForLocale(final Locale locale) {
    final String keyboardLayoutName = getKeyboardLayoutNameForLocale(locale);
    final InputMethodSubtype subtype = AdditionalSubtypeUtils.createDummyAdditionalSubtype(locale.toString(), keyboardLayoutName);
    final KeyboardLayoutSet keyboardLayoutSet = createKeyboardSetForSpellChecker(subtype);
    return keyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET);
}
Also used : RichInputMethodSubtype(com.android.inputmethod.latin.RichInputMethodSubtype) InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) KeyboardLayoutSet(com.android.inputmethod.keyboard.KeyboardLayoutSet)

Aggregations

KeyboardLayoutSet (com.android.inputmethod.keyboard.KeyboardLayoutSet)3 EditorInfo (android.view.inputmethod.EditorInfo)1 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)1 RichInputMethodSubtype (com.android.inputmethod.latin.RichInputMethodSubtype)1