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


Java InputMethodSubtype.getNameResId方法代码示例

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


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

示例1: getSubtypeDisplayNameInternal

import android.view.inputmethod.InputMethodSubtype; //导入方法依赖的package包/类
@NonNull
private static String getSubtypeDisplayNameInternal(@NonNull final InputMethodSubtype subtype,
        @NonNull final Locale displayLocale) {
    final String replacementString = getReplacementString(subtype, displayLocale);
    // TODO: rework this for multi-lingual subtypes
    final int nameResId = subtype.getNameResId();
    final RunInLocale<String> getSubtypeName = new RunInLocale<String>() {
        @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 "";
            }
        }
    };
    return StringUtils.capitalizeFirstCodePoint(
            getSubtypeName.runInLocale(sResources, displayLocale), displayLocale);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:27,代码来源:SubtypeLocaleUtils.java

示例2: getSubtypeDisplayNameInternal

import android.view.inputmethod.InputMethodSubtype; //导入方法依赖的package包/类
@Nonnull
private static String getSubtypeDisplayNameInternal(@Nonnull final InputMethodSubtype subtype,
        @Nonnull final Locale displayLocale) {
    final String replacementString = getReplacementString(subtype, displayLocale);
    // TODO: rework this for multi-lingual subtypes
    final int nameResId = subtype.getNameResId();
    final RunInLocale<String> getSubtypeName = new RunInLocale<String>() {
        @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 "";
            }
        }
    };
    return StringUtils.capitalizeFirstCodePoint(
            getSubtypeName.runInLocale(sResources, displayLocale), displayLocale);
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:27,代码来源:SubtypeLocaleUtils.java

示例3: createAdditionalSubtypesArray

import android.view.inputmethod.InputMethodSubtype; //导入方法依赖的package包/类
public static InputMethodSubtype[] createAdditionalSubtypesArray(final String prefSubtypes) {
    if (TextUtils.isEmpty(prefSubtypes)) {
        return EMPTY_SUBTYPE_ARRAY;
    }
    final String[] prefSubtypeArray = prefSubtypes.split(PREF_SUBTYPE_SEPARATOR);
    final ArrayList<InputMethodSubtype> subtypesList = new ArrayList<>(prefSubtypeArray.length);
    for (final String prefSubtype : prefSubtypeArray) {
        final String elems[] = prefSubtype.split(LOCALE_AND_LAYOUT_SEPARATOR);
        if (elems.length != LENGTH_WITHOUT_EXTRA_VALUE
                && elems.length != LENGTH_WITH_EXTRA_VALUE) {
            Log.w(TAG, "Unknown additional subtype specified: " + prefSubtype + " in "
                    + prefSubtypes);
            continue;
        }
        final String localeString = elems[INDEX_OF_LOCALE];
        final String keyboardLayoutSetName = elems[INDEX_OF_KEYBOARD_LAYOUT];
        // Here we assume that all the additional subtypes have AsciiCapable and EmojiCapable.
        // This is actually what the setting dialog for additional subtype is doing.
        final InputMethodSubtype subtype = createAsciiEmojiCapableAdditionalSubtype(
                localeString, keyboardLayoutSetName);
        if (subtype.getNameResId() == SubtypeLocaleUtils.UNKNOWN_KEYBOARD_LAYOUT) {
            // Skip unknown keyboard layout subtype. This may happen when predefined keyboard
            // layout has been removed.
            continue;
        }
        subtypesList.add(subtype);
    }
    return subtypesList.toArray(new InputMethodSubtype[subtypesList.size()]);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:30,代码来源:AdditionalSubtypeUtils.java


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