import android.text.TextUtils;
import android.view.InputDevice;
-import com.android.internal.inputmethod.InputMethodUtils;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.Preconditions;
import com.android.settings.R;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
import java.util.Objects;
private PreferenceCategory mKeyboardAssistanceCategory;
@NonNull
private SwitchPreference mShowVirtualKeyboardSwitch;
- @NonNull
- private InputMethodUtils.InputMethodSettings mSettings;
private Intent mIntentWaitingForResult;
Activity activity = Preconditions.checkNotNull(getActivity());
addPreferencesFromResource(R.xml.physical_keyboard_settings);
mIm = Preconditions.checkNotNull(activity.getSystemService(InputManager.class));
- mSettings = new InputMethodUtils.InputMethodSettings(
- activity.getResources(),
- getContentResolver(),
- new HashMap<>(),
- new ArrayList<>(),
- UserHandle.myUserId(),
- false /* copyOnWrite */);
mKeyboardAssistanceCategory = Preconditions.checkNotNull(
(PreferenceCategory) findPreference(KEYBOARD_ASSISTANCE_CATEGORY));
mShowVirtualKeyboardSwitch = Preconditions.checkNotNull(
}
private void updateShowVirtualKeyboardSwitch() {
- mShowVirtualKeyboardSwitch.setChecked(mSettings.isShowImeWithHardKeyboardEnabled());
+ mShowVirtualKeyboardSwitch.setChecked(
+ Secure.getInt(getContentResolver(), Secure.SHOW_IME_WITH_HARD_KEYBOARD, 0) != 0);
}
private void toggleKeyboardShortcutsMenu() {
}
private final OnPreferenceChangeListener mShowVirtualKeyboardSwitchPreferenceChangeListener =
- new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- mSettings.setShowImeWithHardKeyboard((Boolean) newValue);
- return true;
- }
+ (preference, newValue) -> {
+ Secure.putInt(getContentResolver(), Secure.SHOW_IME_WITH_HARD_KEYBOARD,
+ ((Boolean) newValue) ? 1 : 0);
+ return true;
};
private final ContentObserver mContentObserver = new ContentObserver(new Handler(true)) {