InputMethodSubtype subtype = mInputMethodManager.getCurrentInputMethodSubtype(); switch(subtype.getLocale()) { case "fa_IR": setLatinKeyboard(mPersianKeyboard); break; case "en_US": setLatinKeyboard(mQwertyKeyboard); break; }
@Override public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) { mInputView.setSubtypeOnSpaceKey(subtype); switch(subtype.getLocale()) { case "fa_IR": setLatinKeyboard(mSymbolsKeyboard); break; case "en_US": setLatinKeyboard(mQwertyKeyboard); break; }; }
public static boolean isNoLanguage(final InputMethodSubtype subtype) { final String localeString = subtype.getLocale(); return NO_LANGUAGE.equals(localeString); }
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodSubtype ims = imm.getCurrentInputMethodSubtype(); String localeString = ims.getLocale(); Locale locale = new Locale(localeString); String currentLanguage = locale.getDisplayLanguage();
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodSubtype ims = imm.getCurrentInputMethodSubtype(); String localeString = ims.getLocale(); Locale locale = new Locale(localeString); String currentLanguage = locale.getDisplayLanguage();
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodSubtype ims = imm.getCurrentInputMethodSubtype(); String localeString = ims.getLocale(); Locale locale = new Locale(localeString); String currentLanguage = locale.getDisplayLanguage(); if(Keyboard input method.equals(currentLanguage) { //do something }
private void printInputLanguages() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); List<InputMethodInfo> ims = imm.getEnabledInputMethodList(); for (InputMethodInfo method : ims) { List<InputMethodSubtype> submethods = imm.getEnabledInputMethodSubtypeList(method, true); for (InputMethodSubtype submethod : submethods) { if (submethod.getMode().equals("keyboard")) { String currentLocale = submethod.getLocale(); Log.i(TAG, "Available input method locale: " + currentLocale); } } } }
public SubtypeLocaleItem(final InputMethodSubtype subtype) { mLocaleString = subtype.getLocale(); mDisplayName = SubtypeLocaleUtils.getSubtypeLocaleDisplayNameInSystemLocale( mLocaleString); }
@NonNull public static Locale getSubtypeLocale(@NonNull final InputMethodSubtype subtype) { final String localeString = subtype.getLocale(); return LocaleUtils.constructLocaleFromString(localeString); }
public static Locale getSubtypeLocale(final InputMethodSubtype subtype) { final String localeString = subtype.getLocale(); return LocaleUtils.constructLocaleFromString(localeString); }
public static Locale getLocaleObject(final InputMethodSubtype subtype) { // Locale.forLanguageTag() is available only in Android L and later. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { final String languageTag = subtype.getLanguageTag(); if (!TextUtils.isEmpty(languageTag)) { return Locale.forLanguageTag(languageTag); } } return LocaleUtils.constructLocaleFromString(subtype.getLocale()); } }
@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); }
private InputMethodSubtype findDuplicatedSubtype(final InputMethodSubtype subtype) { final String localeString = subtype.getLocale(); final String keyboardLayoutSetName = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype); return mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet( localeString, keyboardLayoutSetName); }
@NonNull public String getFullDisplayName() { if (isNoLanguage()) { return SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(mSubtype); } return SubtypeLocaleUtils.getSubtypeLocaleDisplayName(mSubtype.getLocale()); }
@NonNull public String getMiddleDisplayName() { if (isNoLanguage()) { return SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(mSubtype); } return SubtypeLocaleUtils.getSubtypeLanguageDisplayName(mSubtype.getLocale()); }
public static String getPrefSubtype(final InputMethodSubtype subtype) { final String localeString = subtype.getLocale(); final String keyboardLayoutSetName = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype); final String layoutExtraValue = KEYBOARD_LAYOUT_SET + "=" + keyboardLayoutSetName; final String extraValue = StringUtils.removeFromCommaSplittableTextIfExists( layoutExtraValue, StringUtils.removeFromCommaSplittableTextIfExists( IS_ADDITIONAL_SUBTYPE, subtype.getExtraValue())); final String basePrefSubtype = localeString + LOCALE_AND_LAYOUT_SEPARATOR + keyboardLayoutSetName; return extraValue.isEmpty() ? basePrefSubtype : basePrefSubtype + LOCALE_AND_LAYOUT_SEPARATOR + extraValue; }
public static String getMiddleDisplayName(final InputMethodSubtype subtype) { if (SubtypeLocaleUtils.isNoLanguage(subtype)) { return SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(subtype); } return SubtypeLocaleUtils.getSubtypeLanguageDisplayName(subtype.getLocale()); } }
private static String getReplacementString(final InputMethodSubtype subtype, 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); } else { return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale); } }
public Locale getCurrentSubtypeLocale() { if (null != sForcedSubtypeForTesting) { return LocaleUtils.constructLocaleFromString(sForcedSubtypeForTesting.getLocale()); } return SubtypeLocaleUtils.getSubtypeLocale(getCurrentSubtype()); }
public static String getFullDisplayName(final InputMethodSubtype subtype) { if (SubtypeLocaleUtils.isNoLanguage(subtype)) { return SubtypeLocaleUtils.getKeyboardLayoutSetDisplayName(subtype); } return SubtypeLocaleUtils.getSubtypeLocaleDisplayName(subtype.getLocale()); }