當前位置: 首頁>>代碼示例>>Java>>正文


Java InputMethodManager.getEnabledInputMethodSubtypeList方法代碼示例

本文整理匯總了Java中android.view.inputmethod.InputMethodManager.getEnabledInputMethodSubtypeList方法的典型用法代碼示例。如果您正苦於以下問題:Java InputMethodManager.getEnabledInputMethodSubtypeList方法的具體用法?Java InputMethodManager.getEnabledInputMethodSubtypeList怎麽用?Java InputMethodManager.getEnabledInputMethodSubtypeList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.inputmethod.InputMethodManager的用法示例。


在下文中一共展示了InputMethodManager.getEnabledInputMethodSubtypeList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEnabledSubtypesLabel

import android.view.inputmethod.InputMethodManager; //導入方法依賴的package包/類
private static String getEnabledSubtypesLabel(
        Context context, InputMethodManager imm, InputMethodInfo imi) {
    if (context == null || imm == null || imi == null) return null;
    final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(imi, true);
    final StringBuilder sb = new StringBuilder();
    final int N = subtypes.size();
    for (int i = 0; i < N; ++i) {
        final InputMethodSubtype subtype = subtypes.get(i);
        if (sb.length() > 0) {
            sb.append(", ");
        }
        sb.append(subtype.getDisplayName(context, imi.getPackageName(),
                imi.getServiceInfo().applicationInfo));
    }
    return sb.toString();
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:17,代碼來源:InputMethodSettingsImpl.java

示例2: isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes

import android.view.inputmethod.InputMethodManager; //導入方法依賴的package包/類
public boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes() {
    final Locale systemLocale = mContext.getResources().getConfiguration().locale;
    final Set<InputMethodSubtype> enabledSubtypesOfEnabledImes = new HashSet<>();
    final InputMethodManager inputMethodManager = getInputMethodManager();
    final List<InputMethodInfo> enabledInputMethodInfoList =
            inputMethodManager.getEnabledInputMethodList();
    for (final InputMethodInfo info : enabledInputMethodInfoList) {
        final List<InputMethodSubtype> enabledSubtypes =
                inputMethodManager.getEnabledInputMethodSubtypeList(
                        info, true /* allowsImplicitlySelectedSubtypes */);
        if (enabledSubtypes.isEmpty()) {
            // An IME with no subtypes is found.
            return false;
        }
        enabledSubtypesOfEnabledImes.addAll(enabledSubtypes);
    }
    for (final InputMethodSubtype subtype : enabledSubtypesOfEnabledImes) {
        if (!subtype.isAuxiliary() && !subtype.getLocale().isEmpty()
                && !systemLocale.equals(SubtypeLocaleUtils.getSubtypeLocale(subtype))) {
            return false;
        }
    }
    return true;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:25,代碼來源:RichInputMethodManager.java

示例3: recordKeyboardLocaleUma

import android.view.inputmethod.InputMethodManager; //導入方法依賴的package包/類
private void recordKeyboardLocaleUma() {
    InputMethodManager imm =
            (InputMethodManager) mAppContext.getSystemService(Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> ims = imm.getEnabledInputMethodList();
    ArrayList<String> uniqueLanguages = new ArrayList<>();
    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);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:28,代碼來源:DeferredStartupHandler.java


注:本文中的android.view.inputmethod.InputMethodManager.getEnabledInputMethodSubtypeList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。