Android InputMethodInfo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android InputMethodInfo class.

This code example shows how to use the following methods:getSubtypeCount
     */ 
    public boolean init(final Context context, final PreferenceScreen prefScreen) {
        mContext = context;
        mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        mImi = getMyImi(context, mImm);
        if (mImi == null || mImi.getSubtypeCount() <= 1) {
            return false; 
        } 
        mSubtypeEnablerPreference = new Preference(context);
        mSubtypeEnablerPreference
                .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                    @Override 
                    public boolean onPreferenceClick(Preference preference) {
                        final CharSequence title = getSubtypeEnablerTitle(context);
                        final Intent intent =
                                new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
                        intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
                        if (!TextUtils.isEmpty(title)) {
                            intent.putExtra(Intent.EXTRA_TITLE, title);
                        } 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:loadLabel
This code example shows how to use the following methods:getId
        final Map<InputMethodInfo, List<InputMethodSubtype>> shortcuts =
                mRichImm.getInputMethodManager().getShortcutInputMethodsAndSubtypes();
        mShortcutInputMethodInfo = null;
        mShortcutSubtype = null;
        for (final InputMethodInfo imi : shortcuts.keySet()) {
            final List<InputMethodSubtype> subtypes = shortcuts.get(imi);
            // TODO: Returns the first found IMI for now. Should handle all shortcuts as 
            // appropriate. 
            mShortcutInputMethodInfo = imi;
            // TODO: Pick up the first found subtype for now. Should handle all subtypes 
            // as appropriate. 
            mShortcutSubtype = subtypes.size() > 0 ? subtypes.get(0) : null;
            break; 
        } 
        if (DBG) {
            Log.d(TAG, "Update shortcut IME to : "
                    + (mShortcutInputMethodInfo == null
                            ? "<null>" : mShortcutInputMethodInfo.getId()) + ", "
                    + (mShortcutSubtype == null ? "<null>" : (
                            mShortcutSubtype.getLocale() + ", " + mShortcutSubtype.getMode())));

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getId
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getServiceInfo
            } 
        } 
    } 
 
    public static boolean isSystemIme(InputMethodInfo property) {
        return (property.getServiceInfo().applicationInfo.flags
                & ApplicationInfo.FLAG_SYSTEM) != 0;
    } 
 
    public static boolean isAuxiliaryIme(InputMethodInfo imi) {
        return imi.isAuxiliaryIme();
    } 
 
    public static boolean isAlwaysCheckedIme(InputMethodInfo imi, Context context, int imiCount) {
        if (imiCount <= 1) {
            return true; 
        } 
        if (!isSystemIme(imi)) {
            return false; 
        } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getSubtypeCount
	 */ 
	public boolean init(final Context context, final PreferenceScreen prefScreen) {
		mContext = context;
		mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
		mImi = getMyImi(context, mImm);
		if (mImi == null || mImi.getSubtypeCount() <= 1) {
			return false; 
		} 
		mSubtypeEnablerPreference = new Preference(context);
		mSubtypeEnablerPreference
				.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
					@Override 
					public boolean onPreferenceClick(Preference preference) {
						final CharSequence title = getSubtypeEnablerTitle(context);
						final Intent intent =
								new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
						intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
						if (!TextUtils.isEmpty(title)) {
							intent.putExtra(Intent.EXTRA_TITLE, title);
						} 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getId
                    @Override 
                    public boolean onPreferenceClick(Preference preference) {
                        final CharSequence title = getSubtypeEnablerTitle(context);
                        final Intent intent =
                                new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
                        intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
                        if (!TextUtils.isEmpty(title)) {
                            intent.putExtra(Intent.EXTRA_TITLE, title);
                        } 
                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
                                | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        context.startActivity(intent);
                        return true; 
                    } 
                }); 
        prefScreen.addPreference(mSubtypeEnablerPreference);
        updateSubtypeEnabler(); 
        return true; 
    } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getServiceInfo
    private InputMethodUtils() { 
        // This utility class is not publicly instantiable. 
    } 
 
    public static boolean isSystemIme(InputMethodInfo inputMethod) {
        return (inputMethod.getServiceInfo().applicationInfo.flags
                & ApplicationInfo.FLAG_SYSTEM) != 0;
    } 
 
    public static boolean isSystemImeThatHasEnglishKeyboardSubtype(InputMethodInfo imi) {
        if (!isSystemIme(imi)) {
            return false; 
        } 
        return containsSubtypeOf(imi, ENGLISH_LOCALE.getLanguage(), SUBTYPE_MODE_KEYBOARD);
    } 
 
    private static boolean isSystemAuxilialyImeThatHashAutomaticSubtype(InputMethodInfo imi) {
        if (!isSystemIme(imi)) {
            return false; 
        } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getPackageName, getServiceInfo
    } 
 
    private CharSequence getSubtypeName(InputMethodInfo imi, InputMethodSubtype subtype) {
        if (imi == null || subtype == null) return null;
        if (DEBUG) {
            Log.d(TAG, "Get text from: " + imi.getPackageName() + subtype.getNameResId()
                    + imi.getServiceInfo().applicationInfo);
        } 
        return subtype.getDisplayName(
                mContext, imi.getPackageName(), imi.getServiceInfo().applicationInfo);
    } 
 
    private Drawable getSubtypeIcon(InputMethodInfo imi, InputMethodSubtype subtype) {
        if (imi != null) {
            if (DEBUG) {
                Log.d(TAG, "Update icons of IME: " + imi.getPackageName());
                if (subtype != null) {
                    Log.d(TAG, "subtype =" + subtype.getLocale() + "," + subtype.getMode());
                } 
            } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getId
					@Override 
					public boolean onPreferenceClick(Preference preference) {
						final CharSequence title = getSubtypeEnablerTitle(context);
						final Intent intent =
								new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
						intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
						if (!TextUtils.isEmpty(title)) {
							intent.putExtra(Intent.EXTRA_TITLE, title);
						} 
						intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
								| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
								| Intent.FLAG_ACTIVITY_CLEAR_TOP);
						context.startActivity(intent);
						return true; 
					} 
				}); 
		prefScreen.addPreference(mSubtypeEnablerPreference);
		updateSubtypeEnabler(); 
		return true; 
	} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android InputMethodInfo Questions & Answers:

See Code Examples for Android InputMethodInfo Methods: