[Physical Keyboard] Update Input Setting Dialog
1. update button style to use custom one 2. use scrollview so it won't be truncated in shorter screen Bug:389973784 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: I57765e88751b6090606d56bbe2335813ef7fd2fc
This commit is contained in:
@@ -25,6 +25,7 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.SeekBar;
|
||||
@@ -78,36 +79,41 @@ public abstract class KeyboardAccessibilityKeysDialogFragment extends DialogFrag
|
||||
R.layout.dialog_keyboard_a11y_input_setting_keys, null);
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity);
|
||||
dialogBuilder.setView(dialoglayout);
|
||||
dialogBuilder.setPositiveButton(android.R.string.ok,
|
||||
(dialog, which) -> {
|
||||
RadioGroup radioGroup =
|
||||
dialoglayout.findViewById(
|
||||
R.id.input_setting_keys_value_group);
|
||||
SeekBar seekbar = dialoglayout.findViewById(
|
||||
R.id.input_setting_keys_value_custom_slider);
|
||||
RadioButton customRadioButton = dialoglayout.findViewById(
|
||||
R.id.input_setting_keys_value_custom);
|
||||
int threshold;
|
||||
if (customRadioButton.isChecked()) {
|
||||
threshold = seekbar.getProgress() * CUSTOM_PROGRESS_INTERVAL;
|
||||
} else {
|
||||
int checkedRadioButtonId = radioGroup.getCheckedRadioButtonId();
|
||||
if (checkedRadioButtonId == R.id.input_setting_keys_value_600) {
|
||||
threshold = 600;
|
||||
} else if (checkedRadioButtonId
|
||||
== R.id.input_setting_keys_value_400) {
|
||||
threshold = 400;
|
||||
} else if (checkedRadioButtonId
|
||||
== R.id.input_setting_keys_value_200) {
|
||||
threshold = 200;
|
||||
} else {
|
||||
threshold = 0;
|
||||
}
|
||||
}
|
||||
updateInputSettingKeysValue(threshold);
|
||||
onCustomValueUpdated(threshold);
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
Button doneButton = dialoglayout.findViewById(R.id.done_button);
|
||||
doneButton.setOnClickListener(v -> {
|
||||
RadioGroup radioGroup =
|
||||
dialoglayout.findViewById(
|
||||
R.id.input_setting_keys_value_group);
|
||||
SeekBar seekbar = dialoglayout.findViewById(
|
||||
R.id.input_setting_keys_value_custom_slider);
|
||||
RadioButton customRadioButton = dialoglayout.findViewById(
|
||||
R.id.input_setting_keys_value_custom);
|
||||
int threshold;
|
||||
if (customRadioButton.isChecked()) {
|
||||
threshold = seekbar.getProgress() * CUSTOM_PROGRESS_INTERVAL;
|
||||
} else {
|
||||
int checkedRadioButtonId = radioGroup.getCheckedRadioButtonId();
|
||||
if (checkedRadioButtonId == R.id.input_setting_keys_value_600) {
|
||||
threshold = 600;
|
||||
} else if (checkedRadioButtonId
|
||||
== R.id.input_setting_keys_value_400) {
|
||||
threshold = 400;
|
||||
} else if (checkedRadioButtonId
|
||||
== R.id.input_setting_keys_value_200) {
|
||||
threshold = 200;
|
||||
} else {
|
||||
threshold = 0;
|
||||
}
|
||||
}
|
||||
updateInputSettingKeysValue(threshold);
|
||||
onCustomValueUpdated(threshold);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
Button cancelButton = dialoglayout.findViewById(R.id.cancel_button);
|
||||
cancelButton.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
AlertDialog accessibilityKeyDialog = dialogBuilder.create();
|
||||
accessibilityKeyDialog.setOnShowListener(dialog -> {
|
||||
RadioGroup cannedValueRadioGroup = accessibilityKeyDialog.findViewById(
|
||||
@@ -162,8 +168,21 @@ public abstract class KeyboardAccessibilityKeysDialogFragment extends DialogFrag
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
});
|
||||
initStateBasedOnThreshold(cannedValueRadioGroup, customRadioButton, customValueTextView,
|
||||
customProgressBar);
|
||||
if (cannedValueRadioGroup.getCheckedRadioButtonId() == -1
|
||||
&& !customRadioButton.isChecked()) {
|
||||
//if canned radio group and custom are not select, initial check state from input
|
||||
// setting
|
||||
initStateBasedOnThreshold(cannedValueRadioGroup, customRadioButton,
|
||||
customValueTextView,
|
||||
customProgressBar);
|
||||
} else if (customRadioButton.isChecked()) {
|
||||
cannedValueRadioGroup.clearCheck();
|
||||
customRadioButton.setChecked(true);
|
||||
customValueTextView.setVisibility(View.VISIBLE);
|
||||
customValueTextView.setText(
|
||||
progressToThresholdInSecond(customProgressBar.getProgress()));
|
||||
customProgressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
final Window window = accessibilityKeyDialog.getWindow();
|
||||
|
Reference in New Issue
Block a user