当前位置: 首页>>代码示例>>Java>>正文


Java InputMethodManager.getEnabledInputMethodList方法代码示例

本文整理汇总了Java中android.view.inputmethod.InputMethodManager.getEnabledInputMethodList方法的典型用法代码示例。如果您正苦于以下问题:Java InputMethodManager.getEnabledInputMethodList方法的具体用法?Java InputMethodManager.getEnabledInputMethodList怎么用?Java InputMethodManager.getEnabledInputMethodList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.inputmethod.InputMethodManager的用法示例。


在下文中一共展示了InputMethodManager.getEnabledInputMethodList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: switchToNextInputMethodAndSubtype

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
private boolean switchToNextInputMethodAndSubtype(final IBinder token) {
    final InputMethodManager imm = mImmWrapper.mImm;
    final List<InputMethodInfo> enabledImis = imm.getEnabledInputMethodList();
    final int currentIndex = getImiIndexInList(getInputMethodInfoOfThisIme(), enabledImis);
    if (currentIndex == INDEX_NOT_FOUND) {
        Log.w(TAG, "Can't find current IME in enabled IMEs: IME package="
                + getInputMethodInfoOfThisIme().getPackageName());
        return false;
    }
    final InputMethodInfo nextImi = getNextNonAuxiliaryIme(currentIndex, enabledImis);
    final List<InputMethodSubtype> enabledSubtypes = getEnabledInputMethodSubtypeList(nextImi,
            true /* allowsImplicitlySelectedSubtypes */);
    if (enabledSubtypes.isEmpty()) {
        // The next IME has no subtype.
        imm.setInputMethod(token, nextImi.getId());
        return true;
    }
    final InputMethodSubtype firstSubtype = enabledSubtypes.get(0);
    imm.setInputMethodAndSubtype(token, nextImi.getId(), firstSubtype);
    return true;
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:22,代码来源:RichInputMethodManager.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: rokomojiEnabled

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
public static boolean rokomojiEnabled(Activity activity) {
//        requestPermissionIfNeeded(Manifest.permission.READ_EXTERNAL_STORAGE, activity);
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        List<InputMethodInfo> imList = imm.getEnabledInputMethodList();
        for (InputMethodInfo imi : imList) {

            if (activity.getPackageName().equalsIgnoreCase(imi.getPackageName()) && SERVICE_NAME.equalsIgnoreCase(imi.getServiceName())) {
                //if (SERVICE_NAME.equalsIgnoreCase(imi.getServiceName())) {
                return true;
            }
        }
        return false;
    }
 
开发者ID:ROKOLabs,项目名称:ROKOmoji.Emoji.Keyboard.App-Android,代码行数:14,代码来源:KeyboardService.java

示例4: 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

示例5: getVoiceImeInputMethodInfo

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
private static InputMethodInfo getVoiceImeInputMethodInfo(InputMethodManager inputMethodManager)
        throws SecurityException, IllegalArgumentException {
    for (InputMethodInfo inputMethodInfo : inputMethodManager.getEnabledInputMethodList()) {
        for (int i = 0; i < inputMethodInfo.getSubtypeCount(); i++) {
            InputMethodSubtype subtype = inputMethodInfo.getSubtypeAt(i);
            if (VOICE_IME_SUBTYPE_MODE.equals(subtype.getMode())) {
                if (inputMethodInfo.getComponent().getPackageName()
                        .startsWith(VOICE_IME_PACKAGE_PREFIX)) {
                    return inputMethodInfo;
                }
            }
        }
    }
    return null;
}
 
开发者ID:MohammadAlBanna,项目名称:Swift-Braille-Soft-keyboard,代码行数:16,代码来源:ImeTrigger.java

示例6: initInputMethods

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
private static void initInputMethods(Context context) {
    InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> inputMethods = inputMethodManager.getEnabledInputMethodList();
    final int count = inputMethods == null ? 0 : inputMethods.size();
    for (int i = 0; i < count; ++i) {
        inputMethodPackages.add(inputMethods.get(i).getPackageName());
    }
}
 
开发者ID:brevent,项目名称:prevent,代码行数:9,代码来源:PackageUtils.java

示例7: isThisImeEnabled

import android.view.inputmethod.InputMethodManager; //导入方法依赖的package包/类
/**
 * Check if the IME specified by the context is enabled.
 * CAVEAT: This may cause a round trip IPC.
 *
 * @param context package context of the IME to be checked.
 * @param imm the {@link InputMethodManager}.
 * @return true if this IME is enabled.
 */
public static boolean isThisImeEnabled(final Context context,
        final InputMethodManager imm) {
    final String packageName = context.getPackageName();
    for (final InputMethodInfo imi : imm.getEnabledInputMethodList()) {
        if (packageName.equals(imi.getPackageName())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:19,代码来源:UncachedInputMethodManagerUtils.java


注:本文中的android.view.inputmethod.InputMethodManager.getEnabledInputMethodList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。