Methods Summary |
---|
private static java.lang.String | getEnabledSubtypesLabel(android.content.Context context, android.view.inputmethod.InputMethodManager imm, android.view.inputmethod.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();
|
private static android.view.inputmethod.InputMethodInfo | getMyImi(android.content.Context context, android.view.inputmethod.InputMethodManager imm)
final List<InputMethodInfo> imis = imm.getInputMethodList();
for (int i = 0; i < imis.size(); ++i) {
final InputMethodInfo imi = imis.get(i);
if (imis.get(i).getPackageName().equals(context.getPackageName())) {
return imi;
}
}
return null;
|
public boolean | init(android.content.Context context, android.preference.PreferenceScreen prefScreen)Initialize internal states of this object.
mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
mImi = getMyImi(context, mImm);
if (mImi == null || mImi.getSubtypeCount() <= 1) {
return false;
}
final Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
mSubtypeEnablerPreference = new Preference(context);
mSubtypeEnablerPreference.setIntent(intent);
prefScreen.addPreference(mSubtypeEnablerPreference);
updateSubtypeEnabler();
return true;
|
public void | setInputMethodSettingsCategoryTitle(int resId){@inheritDoc}
mInputMethodSettingsCategoryTitleRes = resId;
updateSubtypeEnabler();
|
public void | setInputMethodSettingsCategoryTitle(java.lang.CharSequence title){@inheritDoc}
mInputMethodSettingsCategoryTitleRes = 0;
mInputMethodSettingsCategoryTitle = title;
updateSubtypeEnabler();
|
public void | setSubtypeEnablerIcon(int resId){@inheritDoc}
mSubtypeEnablerIconRes = resId;
updateSubtypeEnabler();
|
public void | setSubtypeEnablerIcon(android.graphics.drawable.Drawable drawable){@inheritDoc}
mSubtypeEnablerIconRes = 0;
mSubtypeEnablerIcon = drawable;
updateSubtypeEnabler();
|
public void | setSubtypeEnablerTitle(int resId){@inheritDoc}
mSubtypeEnablerTitleRes = resId;
updateSubtypeEnabler();
|
public void | setSubtypeEnablerTitle(java.lang.CharSequence title){@inheritDoc}
mSubtypeEnablerTitleRes = 0;
mSubtypeEnablerTitle = title;
updateSubtypeEnabler();
|
public void | updateSubtypeEnabler()
final Preference pref = mSubtypeEnablerPreference;
if (pref == null) {
return;
}
final Context context = pref.getContext();
final CharSequence title;
if (mSubtypeEnablerTitleRes != 0) {
title = context.getString(mSubtypeEnablerTitleRes);
} else {
title = mSubtypeEnablerTitle;
}
pref.setTitle(title);
final Intent intent = pref.getIntent();
if (intent != null) {
intent.putExtra(Intent.EXTRA_TITLE, title);
}
final String summary = getEnabledSubtypesLabel(context, mImm, mImi);
if (!TextUtils.isEmpty(summary)) {
pref.setSummary(summary);
}
if (mSubtypeEnablerIconRes != 0) {
pref.setIcon(mSubtypeEnablerIconRes);
} else {
pref.setIcon(mSubtypeEnablerIcon);
}
|