[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_BOUNCE_KEYS_CUSTOM_VALUE_CHANGE;
|
||||
import static android.app.settings.SettingsEnums.ACTION_BOUNCE_KEYS_DISABLED;
|
||||
import static android.app.settings.SettingsEnums.ACTION_BOUNCE_KEYS_ENABLED;
|
||||
|
||||
@@ -32,13 +31,13 @@ import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.PrimarySwitchPreference;
|
||||
|
||||
public class KeyboardAccessibilityBounceKeysController extends
|
||||
InputSettingPreferenceController implements
|
||||
LifecycleObserver {
|
||||
public static final int BOUNCE_KEYS_THRESHOLD = 500;
|
||||
private static final String KEY_TAG = "bounce_keys_dialog_tag";
|
||||
|
||||
@Nullable
|
||||
private PrimarySwitchPreference mPrimaryPreference;
|
||||
@@ -46,8 +45,6 @@ public class KeyboardAccessibilityBounceKeysController extends
|
||||
public KeyboardAccessibilityBounceKeysController(@NonNull Context context,
|
||||
@NonNull String key) {
|
||||
super(context, key);
|
||||
constructDialog(context, R.string.bounce_keys_dialog_title,
|
||||
R.string.bounce_keys_dialog_subtitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,12 +62,11 @@ public class KeyboardAccessibilityBounceKeysController 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();
|
||||
}
|
||||
KeyboardAccessibilityBounceKeysDialogFragment.getInstance().show(mFragmentManager, KEY_TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -87,12 +83,6 @@ public class KeyboardAccessibilityBounceKeysController extends
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCustomValueUpdated(int thresholdTimeMillis) {
|
||||
mMetricsFeatureProvider.action(mContext, ACTION_BOUNCE_KEYS_CUSTOM_VALUE_CHANGE,
|
||||
thresholdTimeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInputSettingUpdated() {
|
||||
if (mPrimaryPreference != null) {
|
||||
@@ -111,9 +101,4 @@ public class KeyboardAccessibilityBounceKeysController extends
|
||||
protected void updateInputSettingKeysValue(int thresholdTimeMillis) {
|
||||
InputSettings.setAccessibilityBounceKeysThreshold(mContext, thresholdTimeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getInputSettingKeysValue() {
|
||||
return InputSettings.getAccessibilityBounceKeysThreshold(mContext);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user