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

The following examples show how to use android.view.inputmethod.InputMethodSubtype#getExtraValue() . 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 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 4
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 5
Source File: InputMethodService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Called when the subtype was changed.
 * @param newSubtype the subtype which is being changed to.
 */
protected void onCurrentInputMethodSubtypeChanged(InputMethodSubtype newSubtype) {
    if (DEBUG) {
        int nameResId = newSubtype.getNameResId();
        String mode = newSubtype.getMode();
        String output = "changeInputMethodSubtype:"
            + (nameResId == 0 ? "<none>" : getString(nameResId)) + ","
            + mode + ","
            + newSubtype.getLocale() + "," + newSubtype.getExtraValue();
        Log.v(TAG, "--- " + output);
    }
}