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

The following examples show how to use android.view.inputmethod.InputMethodSubtype#containsExtraValueKey() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
Source File: AdditionalSubtypeUtils.java    From openboard with GNU General Public License v3.0 4 votes vote down vote up
@UsedForTesting
public static boolean isAdditionalSubtype(final InputMethodSubtype subtype) {
    return subtype.containsExtraValueKey(IS_ADDITIONAL_SUBTYPE);
}
 
Example 8
Source File: AdditionalSubtypeUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
@UsedForTesting
public static boolean isAdditionalSubtype(final InputMethodSubtype subtype) {
    return subtype.containsExtraValueKey(IS_ADDITIONAL_SUBTYPE);
}
 
Example 9
Source File: InputMethodSubtypeCompatUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
public static boolean isAsciiCapable(final InputMethodSubtype subtype) {
    return isAsciiCapableWithAPI(subtype)
            || subtype.containsExtraValueKey(Constants.Subtype.ExtraValue.ASCII_CAPABLE);
}
 
Example 10
Source File: InputMethodManagerService.java    From TvRemoteControl with Apache License 2.0 4 votes vote down vote up
private boolean needsToShowImeSwitchOngoingNotification() {
    if (!mShowOngoingImeSwitcherForPhones) return false;
    if (isScreenLocked()) return false;
    synchronized (mMethodMap) {
        List<InputMethodInfo> imis = mSettings.getEnabledInputMethodListLocked();
        final int N = imis.size();
        if (N > 2) return true;
        if (N < 1) return false;
        int nonAuxCount = 0;
        int auxCount = 0;
        InputMethodSubtype nonAuxSubtype = null;
        InputMethodSubtype auxSubtype = null;
        for(int i = 0; i < N; ++i) {
            final InputMethodInfo imi = imis.get(i);
            final List<InputMethodSubtype> subtypes =
                    mSettings.getEnabledInputMethodSubtypeListLocked(mContext, imi, true);
            final int subtypeCount = subtypes.size();
            if (subtypeCount == 0) {
                ++nonAuxCount;
            } else {
                for (int j = 0; j < subtypeCount; ++j) {
                    final InputMethodSubtype subtype = subtypes.get(j);
                    if (!subtype.isAuxiliary()) {
                        ++nonAuxCount;
                        nonAuxSubtype = subtype;
                    } else {
                        ++auxCount;
                        auxSubtype = subtype;
                    }
                }
            }
        }
        if (nonAuxCount > 1 || auxCount > 1) {
            return true;
        } else if (nonAuxCount == 1 && auxCount == 1) {
            if (nonAuxSubtype != null && auxSubtype != null
                    && (nonAuxSubtype.getLocale().equals(auxSubtype.getLocale())
                            || auxSubtype.overridesImplicitlyEnabledSubtype()
                            || nonAuxSubtype.overridesImplicitlyEnabledSubtype())
                    && nonAuxSubtype.containsExtraValueKey(TAG_TRY_SUPPRESSING_IME_SWITCHER)) {
                return false;
            }
            return true;
        }
        return false;
    }
}
 
Example 11
Source File: AdditionalSubtypeUtils.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
@UsedForTesting
public static boolean isAdditionalSubtype(final InputMethodSubtype subtype) {
    return subtype.containsExtraValueKey(IS_ADDITIONAL_SUBTYPE);
}
 
Example 12
Source File: InputMethodSubtypeCompatUtils.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
public static boolean isAsciiCapable(final InputMethodSubtype subtype) {
    return isAsciiCapableWithAPI(subtype)
            || subtype.containsExtraValueKey(Constants.Subtype.ExtraValue.ASCII_CAPABLE);
}