java类android.view.inputmethod.InputMethodInfo的实例源码

RichInputMethodManager.java 文件源码 项目:simple-keyboard 阅读 27 收藏 0 点赞 0 评论 0
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;
}
CustomInputStylePreference.java 文件源码 项目:simple-keyboard 阅读 34 收藏 0 点赞 0 评论 0
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = new TreeSet<>();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (InputMethodSubtypeCompatUtils.isAsciiCapable(subtype)) {
            items.add(new SubtypeLocaleItem(subtype));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
InputMethodSettingsImpl.java 文件源码 项目:simple-keyboard 阅读 32 收藏 0 点赞 0 评论 0
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();
}
ImeTrigger.java 文件源码 项目:Swift-Braille-Soft-keyboard 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Switches to Voice IME.
 */
@Override
public void startVoiceRecognition(String language) {
    InputMethodManager inputMethodManager = getInputMethodManager(mInputMethodService);

    InputMethodInfo inputMethodInfo = getVoiceImeInputMethodInfo(inputMethodManager);

    if (inputMethodInfo == null) {
        return;
    }

    inputMethodManager.setInputMethodAndSubtype(mInputMethodService.getWindow().getWindow()
            .getAttributes().token,
            inputMethodInfo.getId(),
            getVoiceImeSubtype(inputMethodManager, inputMethodInfo));
}
InputMethodSettingsImpl.java 文件源码 项目:myan 阅读 28 收藏 0 点赞 0 评论 0
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();
}
RichInputMethodManager.java 文件源码 项目:AOSP-Kayboard-7.1.2 阅读 27 收藏 0 点赞 0 评论 0
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;
}
RichInputMethodManager.java 文件源码 项目:AOSP-Kayboard-7.1.2 阅读 25 收藏 0 点赞 0 评论 0
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;
}
CustomInputStylePreference.java 文件源码 项目:AOSP-Kayboard-7.1.2 阅读 35 收藏 0 点赞 0 评论 0
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = new TreeSet<>();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            Log.d(TAG_SUBTYPE, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (InputMethodSubtypeCompatUtils.isAsciiCapable(subtype)) {
            items.add(new SubtypeLocaleItem(subtype));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
InputMethodSettingsImpl.java 文件源码 项目:AOSP-Kayboard-7.1.2 阅读 28 收藏 0 点赞 0 评论 0
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();
}
InputMethodSettingsImpl.java 文件源码 项目:accentype-android 阅读 28 收藏 0 点赞 0 评论 0
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();
}
MainActivity.java 文件源码 项目:webkeyboard 阅读 25 收藏 0 点赞 0 评论 0
/**
 *
 * @return
 */
private boolean isWebKeyboardEnabled() {
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> enabledList = imm.getEnabledInputMethodList();
    Iterator<InputMethodInfo> it = enabledList.iterator();

    boolean available = false;
    while (it.hasNext()) {
        available = it.next()
                .getServiceName()
                .equals(RemoteKeyboardService.class.getCanonicalName());
        if (available) {
            break;
        }
    }

    return available;
}
RawResources.java 文件源码 项目:ContentBlocker 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Gets input languages
 *
 * @param context Application context
 * @return List of input languages
 */
private static List<String> getInputLanguages(Context context) {
    List<String> languages = new ArrayList<>();

    try {
        InputMethodManager imm = (InputMethodManager) context.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 ("keyboard".equals(subMethod.getMode())) {
                    String currentLocale = subMethod.getLocale();
                    String language = cleanUpLanguageCode(new Locale(currentLocale).getLanguage());
                    if (!languages.contains(language)) {
                        languages.add(language);
                    }
                }
            }
        }
    } catch (Exception ex) {
        LOG.warn("Cannot get user input languages\r\n", ex);
    }

    return languages;
}
UIUtil.java 文件源码 项目:Newton_for_Android_AS 阅读 34 收藏 0 点赞 0 评论 0
/**
 * 获取已激活输入法的详细信息
 * @param context
 * @param packageName 输入法应用的包名
 * @return
 */
public static InputMethodInfo getEnableInputMethodInfor(Context context, String packageName) {
    if (packageName == null) {
        return null;
    }
    final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> imeInfoList = imm.getEnabledInputMethodList();

    if (imeInfoList != null) {
        for (InputMethodInfo imeInfo : imeInfoList) {
            if (packageName.equals(imeInfo.getPackageName())) {
                return imeInfo;
            }
        }
    }
    return null;
}
SimpleInputConnection.java 文件源码 项目:cryptogram 阅读 24 收藏 0 点赞 0 评论 0
@Nullable
public static InputMethodInfo getIme(Context context) {
    final InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    final InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
    if (ims != null) {
        for (InputMethodInfo imi : imm.getEnabledInputMethodList()) {
            if (imi == null) {
                continue;
            }
            for (int i = 0; i < imi.getSubtypeCount(); i++) {
                if (ims.equals(imi.getSubtypeAt(i))) {
                    return imi;
                }
            }
        }
    }
    return null;
}
KeyboardSwitcher.java 文件源码 项目:kgb 阅读 26 收藏 0 点赞 0 评论 0
public static List<String> getKeyboards(Context context) {
  InputMethodManager imeManager = (InputMethodManager) context
      .getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imeManager == null) {
    return Collections.emptyList();
  }

  List<InputMethodInfo> imesInfo = imeManager.getEnabledInputMethodList();
  List<String> keyboards = new ArrayList<>(imesInfo.size());

  for (InputMethodInfo imi : imesInfo) {
    keyboards.add(imi.getId());
  }

  return keyboards;
}
InputMethodSettingsImpl.java 文件源码 项目:accentype-android 阅读 30 收藏 0 点赞 0 评论 0
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();
}
PopupWindowManager.java 文件源码 项目:Noyze 阅读 30 收藏 0 点赞 0 评论 0
protected ComponentName retrieveActiveInputMethod() {
       if (null == mContext) return null;
    final String id = Settings.Secure.getString(
        mContext.getContentResolver(), 
        Settings.Secure.DEFAULT_INPUT_METHOD
    );

    if (TextUtils.isEmpty(id)) return null;
    List<InputMethodInfo> mInputMethodProperties = mInputMethodManager.getEnabledInputMethodList();
    for (InputMethodInfo mInputMethod : mInputMethodProperties) {
        if (id.equals(mInputMethod.getId())) {
            return mInputMethod.getComponent();
        }
    }

    return null;
}
UiUtils.java 文件源码 项目:365browser 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Gets the set of locales supported by the current enabled Input Methods.
 * @param context A {@link Context} instance.
 * @return A possibly-empty {@link Set} of locale strings.
 */
public static Set<String> getIMELocales(Context context) {
    LinkedHashSet<String> locales = new LinkedHashSet<String>();
    InputMethodManager imManager =
            (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> enabledMethods = imManager.getEnabledInputMethodList();
    for (int i = 0; i < enabledMethods.size(); i++) {
        List<InputMethodSubtype> subtypes =
                imManager.getEnabledInputMethodSubtypeList(enabledMethods.get(i), true);
        if (subtypes == null) continue;
        for (int j = 0; j < subtypes.size(); j++) {
            String locale = ApiCompatibilityUtils.getLocale(subtypes.get(j));
            if (!TextUtils.isEmpty(locale)) locales.add(locale);
        }
    }
    return locales;
}
Utils.java 文件源码 项目:breadwallet-android 阅读 31 收藏 0 点赞 0 评论 0
public static boolean isUsingCustomInputMethod(Activity context) {
    if (context == null) return false;
    InputMethodManager imm = (InputMethodManager) context.getSystemService(
            Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList();
    final int N = mInputMethodProperties.size();
    for (int i = 0; i < N; i++) {
        InputMethodInfo imi = mInputMethodProperties.get(i);
        if (imi.getId().equals(
                Settings.Secure.getString(context.getContentResolver(),
                        Settings.Secure.DEFAULT_INPUT_METHOD))) {
            if ((imi.getServiceInfo().applicationInfo.flags &
                    ApplicationInfo.FLAG_SYSTEM) == 0) {
                return true;
            }
        }
    }
    return false;
}
InputMethodSettingsImpl.java 文件源码 项目:MUA-Keyboard 阅读 33 收藏 0 点赞 0 评论 0
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();
}
SettingsActivity.java 文件源码 项目:CtrlVKeyboard 阅读 30 收藏 0 点赞 0 评论 0
private boolean isKeyboardEnabled() {
    InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(
            Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> inputMethodList = inputMethodManager.getEnabledInputMethodList();
    ComponentName ctrlV = new ComponentName(this, CtrlVKeyboard.class);
    boolean ctrlVIsEnabled = false;
    int i = 0;

    while (!ctrlVIsEnabled && i < inputMethodList.size()) {
        if (inputMethodList.get(i).getComponent().equals(ctrlV)) {
            ctrlVIsEnabled = true;
        }
        i++;
    }

    return ctrlVIsEnabled;
}
PopupWindowManager.java 文件源码 项目:Noyze 阅读 24 收藏 0 点赞 0 评论 0
protected ComponentName retrieveActiveInputMethod() {
       if (null == mContext) return null;
    final String id = Settings.Secure.getString(
        mContext.getContentResolver(), 
        Settings.Secure.DEFAULT_INPUT_METHOD
    );

    if (TextUtils.isEmpty(id)) return null;
    List<InputMethodInfo> mInputMethodProperties = mInputMethodManager.getEnabledInputMethodList();
    for (InputMethodInfo mInputMethod : mInputMethodProperties) {
        if (id.equals(mInputMethod.getId())) {
            return mInputMethod.getComponent();
        }
    }

    return null;
}
InputMethodSettingsImpl.java 文件源码 项目:animal 阅读 36 收藏 0 点赞 0 评论 0
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();
}
RichInputMethodManager.java 文件源码 项目:android-kioskime 阅读 28 收藏 0 点赞 0 评论 0
private boolean switchToNextInputMethodAndSubtype(final IBinder token) {
    final InputMethodManager imm = mImmWrapper.mImm;
    final List<InputMethodInfo> enabledImis = imm.getEnabledInputMethodList();
    final int currentIndex = getImiIndexInList(mInputMethodInfoOfThisIme, enabledImis);
    if (currentIndex == INDEX_NOT_FOUND) {
        Log.w(TAG, "Can't find current IME in enabled IMEs: IME package="
                + mInputMethodInfoOfThisIme.getPackageName());
        return false;
    }
    final InputMethodInfo nextImi = getNextNonAuxiliaryIme(currentIndex, enabledImis);
    final List<InputMethodSubtype> enabledSubtypes = imm.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;
}
AdditionalSubtypeSettings.java 文件源码 项目:android-kioskime 阅读 25 收藏 0 点赞 0 评论 0
public SubtypeLocaleAdapter(final Context context) {
    super(context, android.R.layout.simple_spinner_item);
    setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    final TreeSet<SubtypeLocaleItem> items = CollectionUtils.newTreeSet();
    final InputMethodInfo imi = RichInputMethodManager.getInstance()
            .getInputMethodInfoOfThisIme();
    final int count = imi.getSubtypeCount();
    for (int i = 0; i < count; i++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(i);
        if (DEBUG_SUBTYPE_ID) {
            android.util.Log.d(TAG, String.format("%-6s 0x%08x %11d %s",
                    subtype.getLocale(), subtype.hashCode(), subtype.hashCode(),
                    SubtypeLocale.getSubtypeDisplayNameInSystemLocale(subtype)));
        }
        if (subtype.containsExtraValueKey(ASCII_CAPABLE)) {
            items.add(createItem(context, subtype.getLocale()));
        }
    }
    // TODO: Should filter out already existing combinations of locale and layout.
    addAll(items);
}
InputMethodSettingsImpl.java 文件源码 项目:android-kioskime 阅读 31 收藏 0 点赞 0 评论 0
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();
}
KeyboardService.java 文件源码 项目:ROKOmoji.Emoji.Keyboard.App-Android 阅读 30 收藏 0 点赞 0 评论 0
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;
    }
RichInputMethodManager.java 文件源码 项目:simple-keyboard 阅读 24 收藏 0 点赞 0 评论 0
private static int getImiIndexInList(final InputMethodInfo inputMethodInfo,
        final List<InputMethodInfo> imiList) {
    final int count = imiList.size();
    for (int index = 0; index < count; index++) {
        final InputMethodInfo imi = imiList.get(index);
        if (imi.equals(inputMethodInfo)) {
            return index;
        }
    }
    return INDEX_NOT_FOUND;
}
RichInputMethodManager.java 文件源码 项目:simple-keyboard 阅读 25 收藏 0 点赞 0 评论 0
private static InputMethodInfo getNextNonAuxiliaryIme(final int currentIndex,
        final List<InputMethodInfo> imiList) {
    final int count = imiList.size();
    for (int i = 1; i < count; i++) {
        final int nextIndex = (currentIndex + i) % count;
        final InputMethodInfo nextImi = imiList.get(nextIndex);
        if (!isAuxiliaryIme(nextImi)) {
            return nextImi;
        }
    }
    return imiList.get(currentIndex);
}
RichInputMethodManager.java 文件源码 项目:simple-keyboard 阅读 33 收藏 0 点赞 0 评论 0
private static boolean isAuxiliaryIme(final InputMethodInfo imi) {
    final int count = imi.getSubtypeCount();
    if (count == 0) {
        return false;
    }
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype subtype = imi.getSubtypeAt(index);
        if (!subtype.isAuxiliary()) {
            return false;
        }
    }
    return true;
}


问题


面经


文章

微信
公众号

扫码关注公众号