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


Java InputMethodInfo类代码示例

本文整理汇总了Java中android.view.inputmethod.InputMethodInfo的典型用法代码示例。如果您正苦于以下问题:Java InputMethodInfo类的具体用法?Java InputMethodInfo怎么用?Java InputMethodInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: switchToNextInputMethodAndSubtype

import android.view.inputmethod.InputMethodInfo; //导入依赖的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: SubtypeLocaleAdapter

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
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);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:23,代码来源:CustomInputStylePreference.java

示例3: getEnabledSubtypesLabel

import android.view.inputmethod.InputMethodInfo; //导入依赖的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

示例4: startVoiceRecognition

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:MohammadAlBanna,项目名称:Swift-Braille-Soft-keyboard,代码行数:19,代码来源:ImeTrigger.java

示例5: isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes

import android.view.inputmethod.InputMethodInfo; //导入依赖的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

示例6: isWebKeyboardEnabled

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
/**
 *
 * @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;
}
 
开发者ID:Viovie-com,项目名称:webkeyboard,代码行数:22,代码来源:MainActivity.java

示例7: getInputLanguages

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:AdguardTeam,项目名称:ContentBlocker,代码行数:32,代码来源:RawResources.java

示例8: getEnableInputMethodInfor

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
/**
 * 获取已激活输入法的详细信息
 * @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;
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:23,代码来源:UIUtil.java

示例9: getIme

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
@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;
}
 
开发者ID:pflammertsma,项目名称:cryptogram,代码行数:19,代码来源:SimpleInputConnection.java

示例10: getKeyboards

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
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;
}
 
开发者ID:evernote,项目名称:kgb,代码行数:17,代码来源:KeyboardSwitcher.java

示例11: retrieveActiveInputMethod

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
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;
}
 
开发者ID:Tombarr,项目名称:Noyze,代码行数:18,代码来源:PopupWindowManager.java

示例12: getIMELocales

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:22,代码来源:UiUtils.java

示例13: isUsingCustomInputMethod

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
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;
}
 
开发者ID:breadwallet,项目名称:breadwallet-android,代码行数:20,代码来源:Utils.java

示例14: isKeyboardEnabled

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
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;
}
 
开发者ID:ZhDev,项目名称:CtrlVKeyboard,代码行数:18,代码来源:SettingsActivity.java

示例15: switchToNextInputMethodAndSubtype

import android.view.inputmethod.InputMethodInfo; //导入依赖的package包/类
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;
}
 
开发者ID:slightfoot,项目名称:android-kioskime,代码行数:22,代码来源:RichInputMethodManager.java


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