[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:
@@ -15,11 +15,18 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
android:id="@+id/input_keys_dialog_scroll_view"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:id="@+id/modifier_key_fragment_container"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/input_setting_keys_dialog_title"
|
||||
@@ -121,16 +128,48 @@
|
||||
android:paddingEnd="36dp"
|
||||
android:min="1"
|
||||
android:max="50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:progressBackgroundTint="@color/input_dialog_slider_progress_background"
|
||||
android:progressTint="@color/input_dialog_slider_progress"
|
||||
android:thumbTint="@color/input_dialog_slider_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="6dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:paddingVertical="14dp"
|
||||
android:layout_toStartOf="@+id/done_button"
|
||||
style="@style/SettingsLibActionButton"
|
||||
android:text="@string/cancel"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/done_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingVertical="14dp"
|
||||
style="@style/SettingsLibActionButton"
|
||||
android:text="@string/done"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@@ -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,8 +79,8 @@ 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) -> {
|
||||
Button doneButton = dialoglayout.findViewById(R.id.done_button);
|
||||
doneButton.setOnClickListener(v -> {
|
||||
RadioGroup radioGroup =
|
||||
dialoglayout.findViewById(
|
||||
R.id.input_setting_keys_value_group);
|
||||
@@ -106,8 +107,13 @@ public abstract class KeyboardAccessibilityKeysDialogFragment extends DialogFrag
|
||||
}
|
||||
updateInputSettingKeysValue(threshold);
|
||||
onCustomValueUpdated(threshold);
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
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,
|
||||
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();
|
||||
|
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.app.AlertDialog;
|
||||
import android.hardware.input.InputSettings;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.fragment.app.testing.FragmentScenario;
|
||||
@@ -70,7 +71,8 @@ public class KeyboardAccessibilityBounceKeysDialogFragmentTest {
|
||||
RadioGroup radioGroup = mAlertDialog.findViewById(R.id.input_setting_keys_value_group);
|
||||
radioGroup.check(R.id.input_setting_keys_value_200);
|
||||
|
||||
mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
|
||||
Button doneButton = mAlertDialog.findViewById(R.id.done_button);
|
||||
doneButton.performClick();
|
||||
ShadowLooper.idleMainLooper();
|
||||
|
||||
assertThat(mAlertDialog.isShowing()).isFalse();
|
||||
|
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import android.app.AlertDialog;
|
||||
import android.hardware.input.InputSettings;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.fragment.app.testing.FragmentScenario;
|
||||
@@ -70,7 +71,8 @@ public class KeyboardAccessibilitySlowKeysDialogFragmentTest {
|
||||
RadioGroup radioGroup = mAlertDialog.findViewById(R.id.input_setting_keys_value_group);
|
||||
radioGroup.check(R.id.input_setting_keys_value_200);
|
||||
|
||||
mAlertDialog.getButton(AlertDialog.BUTTON_POSITIVE).performClick();
|
||||
Button doneButton = mAlertDialog.findViewById(R.id.done_button);
|
||||
doneButton.performClick();
|
||||
ShadowLooper.idleMainLooper();
|
||||
|
||||
assertThat(mAlertDialog.isShowing()).isFalse();
|
||||
|
Reference in New Issue
Block a user