@Override public int compare(InputMethodInfo imi1, InputMethodInfo imi2) { if (imi2 == null) return 0; if (imi1 == null) return 1; if (mPackageManager == null) { return imi1.getId().compareTo(imi2.getId()); } CharSequence imiId1 = imi1.loadLabel(mPackageManager) + "/" + imi1.getId(); CharSequence imiId2 = imi2.loadLabel(mPackageManager) + "/" + imi2.getId(); return imiId1.toString().compareTo(imiId2.toString()); }
private InputMethodPreference getInputMethodPreference(InputMethodInfo imi, int imiSize) { final PackageManager pm = getPackageManager(); final CharSequence label = imi.loadLabel(pm); // IME settings final Intent intent; final String settingsActivity = imi.getSettingsActivity(); if (!TextUtils.isEmpty(settingsActivity)) { intent = new Intent(Intent.ACTION_MAIN); intent.setClassName(imi.getPackageName(), settingsActivity); } else { intent = null; } // Add a check box for enabling/disabling IME InputMethodPreference pref = new InputMethodPreference(this, intent, mImm, imi, imiSize); pref.setKey(imi.getId()); pref.setTitle(label); return pref; }
private CharSequence getIMIName(InputMethodInfo imi) { if (imi == null) return null; return imi.loadLabel(mPackageManager); }