use of com.android.settingslib.inputmethod.InputMethodPreference in project android_packages_apps_Settings by LineageOS.
the class AvailableVirtualKeyboardFragment method onSaveInputMethodPreference.
@Override
public void onSaveInputMethodPreference(final InputMethodPreference pref) {
final boolean hasHardwareKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
InputMethodAndSubtypeUtil.saveInputMethodSubtypeList(this, getContentResolver(), mImm.getInputMethodList(), hasHardwareKeyboard);
// Update input method settings and preference list.
mInputMethodSettingValues.refreshAllInputMethodAndSubtypes();
for (final InputMethodPreference p : mInputMethodPreferenceList) {
p.updatePreferenceViews();
}
}
use of com.android.settingslib.inputmethod.InputMethodPreference in project android_packages_apps_Settings by crdroidandroid.
the class AvailableVirtualKeyboardFragment method onSaveInputMethodPreference.
@Override
public void onSaveInputMethodPreference(final InputMethodPreference pref) {
final boolean hasHardwareKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
InputMethodAndSubtypeUtil.saveInputMethodSubtypeList(this, getContentResolver(), mImm.getInputMethodList(), hasHardwareKeyboard);
// Update input method settings and preference list.
mInputMethodSettingValues.refreshAllInputMethodAndSubtypes();
for (final InputMethodPreference p : mInputMethodPreferenceList) {
p.updatePreferenceViews();
}
}
use of com.android.settingslib.inputmethod.InputMethodPreference in project android_packages_apps_Settings by SudaMod.
the class VirtualKeyboardFragment method updateInputMethodPreferenceViews.
private void updateInputMethodPreferenceViews() {
// Clear existing "InputMethodPreference"s
mInputMethodPreferenceList.clear();
List<String> permittedList = mDpm.getPermittedInputMethodsForCurrentUser();
final Context context = getPrefContext();
final List<InputMethodInfo> imis = mImm.getEnabledInputMethodList();
final int N = (imis == null ? 0 : imis.size());
for (int i = 0; i < N; ++i) {
final InputMethodInfo imi = imis.get(i);
final boolean isAllowedByOrganization = permittedList == null || permittedList.contains(imi.getPackageName());
Drawable icon;
try {
// TODO: Consider other ways to retrieve an icon to show here.
icon = getActivity().getPackageManager().getApplicationIcon(imi.getPackageName());
} catch (Exception e) {
// TODO: Consider handling the error differently perhaps by showing default icons.
icon = NO_ICON;
}
final InputMethodPreference pref = new InputMethodPreference(context, imi, false, /* isImeEnabler */
isAllowedByOrganization, null);
pref.setIcon(icon);
mInputMethodPreferenceList.add(pref);
}
final Collator collator = Collator.getInstance();
mInputMethodPreferenceList.sort((lhs, rhs) -> lhs.compareTo(rhs, collator));
getPreferenceScreen().removeAll();
for (int i = 0; i < N; ++i) {
final InputMethodPreference pref = mInputMethodPreferenceList.get(i);
pref.setOrder(i);
getPreferenceScreen().addPreference(pref);
InputMethodAndSubtypeUtil.removeUnnecessaryNonPersistentPreference(pref);
pref.updatePreferenceViews();
}
mAddVirtualKeyboardScreen.setIcon(R.drawable.ic_add_24dp);
mAddVirtualKeyboardScreen.setOrder(N);
getPreferenceScreen().addPreference(mAddVirtualKeyboardScreen);
}
use of com.android.settingslib.inputmethod.InputMethodPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AvailableVirtualKeyboardFragment method onSaveInputMethodPreference.
@Override
public void onSaveInputMethodPreference(final InputMethodPreference pref) {
final boolean hasHardwareKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
InputMethodAndSubtypeUtilCompat.saveInputMethodSubtypeList(this, getContentResolver(), mImm.getInputMethodList(), hasHardwareKeyboard);
// Update input method settings and preference list.
mInputMethodSettingValues.refreshAllInputMethodAndSubtypes();
for (final InputMethodPreference p : mInputMethodPreferenceList) {
p.updatePreferenceViews();
}
}
use of com.android.settingslib.inputmethod.InputMethodPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AvailableVirtualKeyboardFragment method updateInputMethodPreferenceViews.
private void updateInputMethodPreferenceViews() {
mInputMethodSettingValues.refreshAllInputMethodAndSubtypes();
// Clear existing "InputMethodPreference"s
mInputMethodPreferenceList.clear();
List<String> permittedList = mDpm.getPermittedInputMethodsForCurrentUser();
final Context context = getPrefContext();
final List<InputMethodInfo> imis = mInputMethodSettingValues.getInputMethodList();
final int numImis = (imis == null ? 0 : imis.size());
for (int i = 0; i < numImis; ++i) {
final InputMethodInfo imi = imis.get(i);
final boolean isAllowedByOrganization = permittedList == null || permittedList.contains(imi.getPackageName());
final InputMethodPreference pref = new InputMethodPreference(context, imi, true, isAllowedByOrganization, this);
pref.setIcon(imi.loadIcon(context.getPackageManager()));
mInputMethodPreferenceList.add(pref);
}
final Collator collator = Collator.getInstance();
mInputMethodPreferenceList.sort((lhs, rhs) -> lhs.compareTo(rhs, collator));
getPreferenceScreen().removeAll();
for (int i = 0; i < numImis; ++i) {
final InputMethodPreference pref = mInputMethodPreferenceList.get(i);
pref.setOrder(i);
getPreferenceScreen().addPreference(pref);
InputMethodAndSubtypeUtilCompat.removeUnnecessaryNonPersistentPreference(pref);
pref.updatePreferenceViews();
}
}
Aggregations