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); } } } }
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); } } } }
private ArrayList<String> getInputLanguages() { ArrayList<String> inputlanguages=new ArrayList<String>(); 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(); Locale locale = new Locale(localeString); String currentLanguage = locale.getDisplayLanguage(); inputlanguages.Add(currentLanguage ); } } } return inputlangauges; }
@Override protected String job(final Resources res) { try { return res.getString(nameResId, replacementString); } catch (Resources.NotFoundException e) { // TODO: Remove this catch when InputMethodManager.getCurrentInputMethodSubtype // is fixed. Log.w(TAG, "Unknown subtype: mode=" + subtype.getMode() + " nameResId=" + subtype.getNameResId() + " locale=" + subtype.getLocale() + " extra=" + subtype.getExtraValue() + "\n" + DebugLogUtils.getStackTrace()); return ""; } } };
? "<null>" : mShortcutInputMethodInfo.getId()) + ", " + (mShortcutSubtype == null ? "<null>" : ( mShortcutSubtype.getLocale() + ", " + mShortcutSubtype.getMode()))); ? "<null>" : mShortcutInputMethodInfo.getId()) + ", " + (mShortcutSubtype == null ? "<null>" : ( mShortcutSubtype.getLocale() + ", " + mShortcutSubtype.getMode())));
@Override protected String job(final Resources res) { try { return res.getString(nameResId, replacementString); } catch (Resources.NotFoundException e) { // TODO: Remove this catch when InputMethodManager.getCurrentInputMethodSubtype // is fixed. Log.w(TAG, "Unknown subtype: mode=" + subtype.getMode() + " nameResId=" + subtype.getNameResId() + " locale=" + subtype.getLocale() + " extra=" + subtype.getExtraValue() + "\n" + DebugLogUtils.getStackTrace()); return ""; } } };
private void recordKeyboardLocaleUma() { InputMethodManager imm = (InputMethodManager) mAppContext.getSystemService(Context.INPUT_METHOD_SERVICE); List<InputMethodInfo> ims = imm.getEnabledInputMethodList(); ArrayList<String> uniqueLanguages = new ArrayList<String>(); for (InputMethodInfo method : ims) { List<InputMethodSubtype> submethods = imm.getEnabledInputMethodSubtypeList(method, true); for (InputMethodSubtype submethod : submethods) { if (submethod.getMode().equals("keyboard")) { String language = submethod.getLocale().split("_")[0]; if (!uniqueLanguages.contains(language)) { uniqueLanguages.add(language); } } } } RecordHistogram.recordCountHistogram("InputMethod.ActiveCount", uniqueLanguages.size()); InputMethodSubtype currentSubtype = imm.getCurrentInputMethodSubtype(); Locale systemLocale = Locale.getDefault(); if (currentSubtype != null && currentSubtype.getLocale() != null && systemLocale != null) { String keyboardLanguage = currentSubtype.getLocale().split("_")[0]; boolean match = systemLocale.getLanguage().equalsIgnoreCase(keyboardLanguage); RecordHistogram.recordBooleanHistogram("InputMethod.MatchesSystemLanguage", match); } }
if (KEYBOARD_MODE.equals(subtype.getMode())) { ++keyboardCount;
if (KEYBOARD_MODE.equals(subtype.getMode())) { ++keyboardCount;
? "<null>" : mShortcutInputMethodInfo.getId()) + ", " + (mShortcutSubtype == null ? "<null>" : ( mShortcutSubtype.getLocale() + ", " + mShortcutSubtype.getMode()))); ? "<null>" : mShortcutInputMethodInfo.getId()) + ", " + (mShortcutSubtype == null ? "<null>" : ( mShortcutSubtype.getLocale() + ", " + mShortcutSubtype.getMode())));