Java Code Examples for android.view.inputmethod.InputMethodSubtype#getExtraValueOf()

The following examples show how to use android.view.inputmethod.InputMethodSubtype#getExtraValueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SubtypeLocaleUtils.java    From openboard with GNU General Public License v3.0 6 votes vote down vote up
@Nonnull
public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
    String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
    if (keyboardLayoutSet == null) {
        // This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
        // layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
        // pre-JellyBean.
        final String key = subtype.getLocale() + ":" + subtype.getExtraValue();
        keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(key);
    }
    // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
    // fixed.
    if (keyboardLayoutSet == null) {
        android.util.Log.w(TAG, "KeyboardLayoutSet not found, use QWERTY: " +
                "locale=" + subtype.getLocale() + " extraValue=" + subtype.getExtraValue());
        return QWERTY;
    }
    return keyboardLayoutSet;
}
 
Example 2
Source File: SubtypeLocaleUtils.java    From LokiBoard-Android-Keylogger with Apache License 2.0 6 votes vote down vote up
public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
    String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
    if (keyboardLayoutSet == null) {
        // This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
        // layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
        // pre-JellyBean.
        final String key = subtype.getLocale() + ":" + subtype.getExtraValue();
        keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(key);
    }
    // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
    // fixed.
    if (keyboardLayoutSet == null) {
        android.util.Log.w(TAG, "KeyboardLayoutSet not found, use QWERTY: " +
                "locale=" + subtype.getLocale() + " extraValue=" + subtype.getExtraValue());
        return QWERTY;
    }
    return keyboardLayoutSet;
}
 
Example 3
Source File: SubtypeLocaleUtils.java    From simple-keyboard with Apache License 2.0 6 votes vote down vote up
public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
    String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
    if (keyboardLayoutSet == null) {
        // This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
        // layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
        // pre-JellyBean.
        keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(subtype.getLocale());
    }
    // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
    // fixed.
    if (keyboardLayoutSet == null) {
        android.util.Log.w(TAG, "KeyboardLayoutSet not found, use QWERTY: " +
                "locale=" + subtype.getLocale() + " extraValue=" + subtype.getExtraValue());
        return QWERTY;
    }
    return keyboardLayoutSet;
}
 
Example 4
Source File: SubtypeLocaleUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
    String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
    if (keyboardLayoutSet == null) {
        // This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
        // layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
        // pre-JellyBean.
        final String key = subtype.getLocale() + ":" + subtype.getExtraValue();
        keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(key);
    }
    // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
    // fixed.
    if (keyboardLayoutSet == null) {
        Log.w(TAG, "KeyboardLayoutSet not found, use QWERTY: " +
                "locale=" + subtype.getLocale() + " extraValue=" + subtype.getExtraValue());
        return QWERTY;
    }
    return keyboardLayoutSet;
}
 
Example 5
Source File: LatinIME.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
private boolean checkForTransliteration() {
    Locale locale = mRichImm.getCurrentSubtypeLocale();

    if (!locale.getLanguage().equals("en")) {
        mInputLogic.setIndic(true);
    } else {
        mInputLogic.setIndic(false);
    }

    InputMethodSubtype currentSubtype = mRichImm.getCurrentSubtype().getRawSubtype();
    if(currentSubtype.containsExtraValueKey(TRANSLITERATION_METHOD)) {
        try {
            String transliterationName = currentSubtype.getExtraValueOf(TRANSLITERATION_METHOD);
            mInputLogic.enableTransliteration(transliterationName, getApplicationContext());
            Log.d("IndicKeyboard", "-------------transliteration enabled-----------");
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
    mInputLogic.disableTransliteration();
    Log.d("IndicKeyboard", "-------------transliteration disabled----------------");
    return false;
}
 
Example 6
Source File: SubtypeLocaleUtils.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
    String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
    if (keyboardLayoutSet == null) {
        // This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
        // layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
        // pre-JellyBean.
        final String key = subtype.getLocale() + ":" + subtype.getExtraValue();
        keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(key);
    }
    // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
    // fixed.
    if (keyboardLayoutSet == null) {
        android.util.Log.w(TAG, "KeyboardLayoutSet not found, use QWERTY: " +
                "locale=" + subtype.getLocale() + " extraValue=" + subtype.getExtraValue());
        return QWERTY;
    }
    return keyboardLayoutSet;
}
 
Example 7
Source File: SubtypeLocaleUtils.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
@Nonnull
private static String getReplacementString(@Nonnull final InputMethodSubtype subtype,
        @Nonnull final Locale displayLocale) {
    if (subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
        return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
    }
    return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
}
 
Example 8
Source File: SubtypeLocaleUtils.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
private static String getReplacementString(final InputMethodSubtype subtype,
        final Locale displayLocale) {
    if (subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
        return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
    }
    return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
}
 
Example 9
Source File: SubtypeLocaleUtils.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
private static String getReplacementString(final InputMethodSubtype subtype,
        final Locale displayLocale) {
    if (subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
        return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
    }
    return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
}
 
Example 10
Source File: SubtypeLocaleUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static String getReplacementString(@Nonnull final InputMethodSubtype subtype,
        @Nonnull final Locale displayLocale) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
            && subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
        return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
    }
    return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
}
 
Example 11
Source File: SubtypeLocaleUtils.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static String getReplacementString(@Nonnull final InputMethodSubtype subtype,
        @Nonnull final Locale displayLocale) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
            && subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
        return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
    }
    return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
}
 
Example 12
Source File: SubtypeLocaleUtils.java    From openboard with GNU General Public License v3.0 4 votes vote down vote up
public static String getCombiningRulesExtraValue(final InputMethodSubtype subtype) {
    return subtype.getExtraValueOf(COMBINING_RULES);
}
 
Example 13
Source File: SubtypeLocaleUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
public static String getCombiningRulesExtraValue(final InputMethodSubtype subtype) {
    return subtype.getExtraValueOf(COMBINING_RULES);
}
 
Example 14
Source File: SubtypeLocaleUtils.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
public static String getCombiningRulesExtraValue(final InputMethodSubtype subtype) {
    return subtype.getExtraValueOf(COMBINING_RULES);
}