[Physical Keyboard] Move Dialog to DialogFragment
Move Bounce key and Slow key Dialog to DialogFragment, dialog will not be dismissed when screen rotate. Bug: 390243451 Bug: 374037603 Flag: com.android.settings.keyboard.keyboard_and_touchpad_a11y_new_page_enabled Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/inputmethod/ Change-Id: Ide87dbf8214f411941114281e7a5e8c81f75bdd4
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.inputmethod;
|
||||
|
||||
import static android.app.settings.SettingsEnums.ACTION_SLOW_KEYS_CUSTOM_VALUE_CHANGE;
|
||||
import static android.app.settings.SettingsEnums.ACTION_SLOW_KEYS_DISABLED;
|
||||
import static android.app.settings.SettingsEnums.ACTION_SLOW_KEYS_ENABLED;
|
||||
|
||||
@@ -32,20 +31,19 @@ import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.PrimarySwitchPreference;
|
||||
|
||||
public class KeyboardAccessibilitySlowKeysController extends
|
||||
InputSettingPreferenceController implements
|
||||
LifecycleObserver {
|
||||
public static final int SLOW_KEYS_THRESHOLD = 500;
|
||||
private static final String KEY_TAG = "slow_keys_dialog_tag";
|
||||
|
||||
@Nullable
|
||||
private PrimarySwitchPreference mPrimarySwitchPreference;
|
||||
|
||||
public KeyboardAccessibilitySlowKeysController(@NonNull Context context, @NonNull String key) {
|
||||
super(context, key);
|
||||
constructDialog(context, R.string.slow_keys, R.string.slow_keys_summary);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,12 +88,11 @@ public class KeyboardAccessibilitySlowKeysController extends
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(@NonNull Preference preference) {
|
||||
if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
|
||||
if (!TextUtils.equals(preference.getKey(), getPreferenceKey())
|
||||
|| mFragmentManager == null) {
|
||||
return false;
|
||||
}
|
||||
if (mAlertDialog != null) {
|
||||
mAlertDialog.show();
|
||||
}
|
||||
KeyboardAccessibilitySlowKeysDialogFragment.getInstance().show(mFragmentManager, KEY_TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -103,15 +100,4 @@ public class KeyboardAccessibilitySlowKeysController extends
|
||||
protected void updateInputSettingKeysValue(int thresholdTimeMillis) {
|
||||
InputSettings.setAccessibilitySlowKeysThreshold(mContext, thresholdTimeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCustomValueUpdated(int thresholdTimeMillis) {
|
||||
mMetricsFeatureProvider.action(mContext,
|
||||
ACTION_SLOW_KEYS_CUSTOM_VALUE_CHANGE, thresholdTimeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getInputSettingKeysValue() {
|
||||
return InputSettings.getAccessibilitySlowKeysThreshold(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user