Settings app: Include package icons in list of virtual keyboards

Bug: 25752812
Change-Id: I2070de953c92cce90dbf178c9ffdbe300d4c2646
This commit is contained in:
Abodunrinwa Toki
2016-01-23 16:37:37 +00:00
parent a16852480f
commit 567ebd68e1
4 changed files with 53 additions and 3 deletions

View File

@@ -54,6 +54,7 @@ class InputMethodPreference extends RestrictedSwitchPreference implements OnPref
OnPreferenceChangeListener {
private static final String TAG = InputMethodPreference.class.getSimpleName();
private static final String EMPTY_TEXT = "";
private static final int SETTINGS_ICON_LAYOUT = R.layout.preference_settings_icon_widget;
interface OnSavePreferenceListener {
/**
@@ -97,8 +98,8 @@ class InputMethodPreference extends RestrictedSwitchPreference implements OnPref
mIsAllowedByOrganization = isAllowedByOrganization;
mOnSaveListener = onSaveListener;
if (!isImeEnabler) {
// Hide switch widget.
setWidgetLayoutResource(0 /* widgetLayoutResId */);
// Replace switch widget with settings icon.
setWidgetLayoutResource(SETTINGS_ICON_LAYOUT);
}
// Disable on/off switch texts.
setSwitchTextOn(EMPTY_TEXT);
@@ -133,7 +134,7 @@ class InputMethodPreference extends RestrictedSwitchPreference implements OnPref
private boolean isImeEnabler() {
// If this {@link SwitchPreference} doesn't have a widget layout, we explicitly hide the
// switch widget at constructor.
return getWidgetLayoutResource() != 0;
return getWidgetLayoutResource() != SETTINGS_ICON_LAYOUT;
}
@Override