Add Autoclick cursor area size settings dialog

Replace Autoclick sliderbar with an alert dialog
and radio group to match the new UI requirement.

Screenshot:
 - Click area column:
   go/screenshot-5AfdF7FGghsdiXk
 - Alert dialog:
   go/screenshot-4dgtojcc6lvjtyy

Bug: 390460480
Test: ToggleAutoclickCustomSeekbarControllerTest
Flag: com.android.server.accessibility.enable_autoclick_indicator
Change-Id: Ic79f8833e69dde8d8eb3e945e5acd551d2ee9ff5
This commit is contained in:
Yuhan Yang
2025-02-04 07:33:49 +00:00
parent 43dc7840ef
commit 7630d396a6
6 changed files with 226 additions and 135 deletions

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2025 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/autoclick_cursor_area_size_dialog_title"
android:text="@string/autoclick_cursor_area_size_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="26dp"
android:textSize="20sp"
android:textColor="?android:attr/textColorPrimary"
android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
/>
<TextView
android:id="@+id/autoclick_cursor_area_size_dialog_subtitle"
android:text="@string/autoclick_cursor_area_size_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="26dp"
android:layout_marginTop="8dp"
android:textSize="16sp"
android:textColor="?android:attr/textColorSecondary"
/>
<RadioGroup
android:id="@+id/autoclick_cursor_area_size_value_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="16dp">
<RadioButton
android:id="@+id/autoclick_cursor_area_size_value_extra_small"
android:text="@string/autoclick_cursor_area_size_dialog_option_extra_small"
style="@style/AutoclickDialogRadioButton"/>
<RadioButton
android:id="@+id/autoclick_cursor_area_size_value_small"
android:text="@string/autoclick_cursor_area_size_dialog_option_small"
style="@style/AutoclickDialogRadioButton"/>
<RadioButton
android:id="@+id/autoclick_cursor_area_size_value_default"
android:text="@string/autoclick_cursor_area_size_dialog_option_default"
style="@style/AutoclickDialogRadioButton"/>
<RadioButton
android:id="@+id/autoclick_cursor_area_size_value_large"
android:text="@string/autoclick_cursor_area_size_dialog_option_large"
style="@style/AutoclickDialogRadioButton"/>
<RadioButton
android:id="@+id/autoclick_cursor_area_size_value_extra_large"
android:text="@string/autoclick_cursor_area_size_dialog_option_extra_large"
style="@style/AutoclickDialogRadioButton"/>
</RadioGroup>
</LinearLayout>

View File

@@ -5621,12 +5621,27 @@
<string name="accessibility_autoclick_longer_desc">Longer</string>
<!-- Description for the seekbar that adjust auto click time. [CHAR_LIMIT=NONE] -->
<string name="accessibility_autoclick_seekbar_desc">Auto click time</string>
<!-- Title for the seekbar that adjust auto click cursor area size. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/383901288): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_title" translatable="false">Cursor area size</string>
<!-- Summary for the seekbar that adjust auto click cursor area size. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/383901288): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_summary" translatable="false">Adjust the autoclick ring indicator area size</string>
<!-- Title for the alert dialog that adjust auto click cursor area size. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/394683600): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_title" translatable="false">Click area</string>
<!-- Summary for the alert dialog that adjust auto click cursor area size. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/394683600): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_summary" translatable="false">The area where the cursor can move freely without canceling the click once the countdown starts</string>
<!-- Option for the autoclick area dialog that adjust auto click cursor area size to extra large. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/394683600): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_dialog_option_extra_large" translatable="false">Extra large</string>
<!-- Option for the autoclick area dialog that adjust auto click cursor area size to large. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/394683600): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_dialog_option_large" translatable="false">Large</string>
<!-- Option for the autoclick area dialog that adjust auto click cursor area size to Medium(Default). [CHAR_LIMIT=NONE] -->
<!-- TODO(b/394683600): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_dialog_option_default" translatable="false">Default</string>
<!-- Option for the autoclick area dialog that adjust auto click cursor area size to small. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/394683600): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_dialog_option_small" translatable="false">Small</string>
<!-- Option for the autoclick area dialog that adjust auto click cursor area size to extra small. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/394683600): Update string to translatable once approved by UXW. -->
<string name="autoclick_cursor_area_size_dialog_option_extra_small" translatable="false">Extra small</string>
<!-- Title for the toggle button that turns on/off the autoclick setting of ignoring minor cursor movement. [CHAR_LIMIT=NONE] -->
<!-- TODO(b/388845718): Update string to translatable once approved by UXW. -->
<string name="autoclick_ignore_minor_cursor_movement_title" translatable="false">Ignore minor cursor movement</string>

View File

@@ -710,6 +710,14 @@
<item name="android:textSize">14sp</item>
</style>
<style name="AutoclickDialogRadioButton">
<item name="android:paddingStart">12dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">48dp</item>
<item name="android:layout_gravity">start|center_vertical</item>
<item name="android:background">@null</item>
</style>
<style name="Widget.PopupWindow.Settings"
parent="@android:style/Widget.DeviceDefault.PopupWindow">
<item name="android:clipToPadding">true</item>

View File

@@ -76,13 +76,12 @@
settings:searchable="false"
settings:controller="com.android.settings.accessibility.ToggleAutoclickCustomSeekbarController"/>
<com.android.settingslib.widget.SliderPreference
<Preference
android:key="accessibility_control_autoclick_cursor_area_size"
android:title="@string/autoclick_cursor_area_size_title"
android:summary="@string/autoclick_cursor_area_size_summary"
android:selectable="false"
android:persistent="false"
settings:searchable="false"
settings:controller="com.android.settings.accessibility.ToggleAutoclickCursorAreaSizeController"/>
android:title="@string/autoclick_cursor_area_size_title"
settings:controller="com.android.settings.accessibility.ToggleAutoclickCursorAreaSizeController" />
<SwitchPreferenceCompat
android:key="accessibility_control_autoclick_ignore_minor_cursor_movement"