Snap for 13107126 from 49859abb4b to 25Q2-release
Change-Id: Iec9270578a82caf7e31bb4ccc3c2a0a1d3d16fda
This commit is contained in:
@@ -15,122 +15,161 @@
|
||||
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/input_setting_keys_dialog_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/input_setting_keys_dialog_subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="26dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/input_setting_keys_value_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/input_setting_keys_value_200"
|
||||
android:text="@string/input_setting_keys_dialog_option_200"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:background="@null"/>
|
||||
<RadioButton
|
||||
android:id="@+id/input_setting_keys_value_400"
|
||||
android:text="@string/input_setting_keys_dialog_option_400"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@null"/>
|
||||
<RadioButton
|
||||
android:id="@+id/input_setting_keys_value_600"
|
||||
android:text="@string/input_setting_keys_dialog_option_600"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@null"/>
|
||||
|
||||
<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:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="6dp">
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/input_setting_keys_dialog_subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="26dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/input_setting_keys_value_group"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/input_setting_keys_value_custom"
|
||||
android:id="@+id/input_setting_keys_value_200"
|
||||
android:text="@string/input_setting_keys_dialog_option_200"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/input_setting_keys_custom_title"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:background="@null"/>
|
||||
<RadioButton
|
||||
android:id="@+id/input_setting_keys_value_400"
|
||||
android:text="@string/input_setting_keys_dialog_option_400"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@null"/>
|
||||
<RadioButton
|
||||
android:id="@+id/input_setting_keys_value_600"
|
||||
android:text="@string/input_setting_keys_dialog_option_600"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_marginTop="6dp"
|
||||
android:background="@null"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/input_setting_keys_custom_value_option"
|
||||
android:orientation="vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="16dp">
|
||||
<TextView
|
||||
android:id="@+id/input_setting_keys_value_custom_title"
|
||||
android:text="@string/input_setting_keys_custom_title"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<TextView
|
||||
android:id="@+id/input_setting_keys_value_custom_value"
|
||||
android:text="@string/input_setting_keys_custom_value"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="6dp">
|
||||
<RadioButton
|
||||
android:id="@+id/input_setting_keys_value_custom"
|
||||
android:paddingStart="12dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone"/>
|
||||
<SeekBar
|
||||
android:id="@+id/input_setting_keys_value_custom_slider"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="36dp"
|
||||
android:min="1"
|
||||
android:max="50"
|
||||
android:contentDescription="@string/input_setting_keys_custom_title"
|
||||
android:background="@null"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/input_setting_keys_custom_value_option"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
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_marginTop="8dp"
|
||||
android:visibility="gone"/>
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="16dp">
|
||||
<TextView
|
||||
android:id="@+id/input_setting_keys_value_custom_title"
|
||||
android:text="@string/input_setting_keys_custom_title"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
<TextView
|
||||
android:id="@+id/input_setting_keys_value_custom_value"
|
||||
android:text="@string/input_setting_keys_custom_value"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone"/>
|
||||
<SeekBar
|
||||
android:id="@+id/input_setting_keys_value_custom_slider"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="36dp"
|
||||
android:min="1"
|
||||
android:max="50"
|
||||
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>
|
||||
</LinearLayout>
|
||||
</RadioGroup>
|
||||
</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>
|
||||
@@ -22,23 +22,25 @@
|
||||
<com.android.settingslib.widget.TopIntroPreference
|
||||
android:key="accessibility_autoclick_intro"
|
||||
android:title="@string/accessibility_autoclick_intro_text"
|
||||
settings:searchable="false"
|
||||
android:order="10"/>
|
||||
settings:searchable="false"/>
|
||||
|
||||
<com.android.settingslib.widget.IllustrationPreference
|
||||
android:key="accessibility_autoclick_banner"
|
||||
android:selectable="false"
|
||||
settings:searchable="false"
|
||||
settings:lottie_rawRes="@drawable/accessibility_dwell"
|
||||
android:order="20"/>
|
||||
settings:lottie_rawRes="@drawable/accessibility_dwell"/>
|
||||
|
||||
<com.android.settings.accessibility.ShortcutPreference
|
||||
android:key="autoclick_shortcut_preference"
|
||||
android:title="@string/accessibility_autoclick_shortcut_title"
|
||||
android:persistent="false"/>
|
||||
|
||||
<!-- Items in a list should not be searchable. -->
|
||||
<com.android.settingslib.widget.SelectorWithWidgetPreference
|
||||
android:key="accessibility_control_autoclick_default"
|
||||
android:title="@string/accessibility_autoclick_default_title"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"
|
||||
android:order="30"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"/>
|
||||
|
||||
<!-- Items in a list should not be searchable. -->
|
||||
<com.android.settingslib.widget.SelectorWithWidgetPreference
|
||||
@@ -46,8 +48,7 @@
|
||||
android:title="@string/accessibility_autoclick_short_title"
|
||||
android:summary="@string/accessibility_autoclick_short_summary"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"
|
||||
android:order="31"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"/>
|
||||
|
||||
<!-- Items in a list should not be searchable. -->
|
||||
<com.android.settingslib.widget.SelectorWithWidgetPreference
|
||||
@@ -55,8 +56,7 @@
|
||||
android:title="@string/accessibility_autoclick_medium_title"
|
||||
android:summary="@string/accessibility_autoclick_medium_summary"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"
|
||||
android:order="32"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"/>
|
||||
|
||||
<!-- Items in a list should not be searchable. -->
|
||||
<com.android.settingslib.widget.SelectorWithWidgetPreference
|
||||
@@ -64,16 +64,14 @@
|
||||
android:title="@string/accessibility_autoclick_long_title"
|
||||
android:summary="@string/accessibility_autoclick_long_summary"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"
|
||||
android:order="33"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"/>
|
||||
|
||||
<!-- Items in a list should not be searchable. -->
|
||||
<com.android.settingslib.widget.SelectorWithWidgetPreference
|
||||
android:key="accessibility_control_autoclick_custom"
|
||||
android:title="@string/accessibility_autoclick_custom_title"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"
|
||||
android:order="34"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickPreferenceController"/>
|
||||
|
||||
<com.android.settingslib.widget.LayoutPreference
|
||||
android:key="autoclick_custom_seekbar"
|
||||
@@ -81,28 +79,24 @@
|
||||
android:selectable="false"
|
||||
android:visibility="gone"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickCustomSeekbarController"
|
||||
android:order="40"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickCustomSeekbarController"/>
|
||||
|
||||
<Preference
|
||||
android:key="accessibility_control_autoclick_cursor_area_size"
|
||||
android:persistent="false"
|
||||
settings:searchable="false"
|
||||
android:title="@string/autoclick_cursor_area_size_title"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickCursorAreaSizeController"
|
||||
android:order="50"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickCursorAreaSizeController"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:key="accessibility_control_autoclick_ignore_minor_cursor_movement"
|
||||
android:title="@string/autoclick_ignore_minor_cursor_movement_title"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickIgnoreMinorCursorMovementController"
|
||||
android:order="60"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickIgnoreMinorCursorMovementController"/>
|
||||
|
||||
<com.android.settings.accessibility.AccessibilityFooterPreference
|
||||
android:key="accessibility_autoclick_footer"
|
||||
android:title="@string/accessibility_autoclick_description"
|
||||
android:selectable="false"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickFooterPreferenceController"
|
||||
android:order="70"/>
|
||||
settings:controller="com.android.settings.accessibility.ToggleAutoclickFooterPreferenceController"/>
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -104,14 +104,17 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
mShortcutPreference = new ShortcutPreference(getPrefContext(), /* attrs= */ null);
|
||||
mShortcutPreference.setPersistent(false);
|
||||
mShortcutPreference.setKey(getShortcutPreferenceKey());
|
||||
mShortcutPreference =
|
||||
getPreferenceScreen().findPreference(getShortcutPreferenceKey());
|
||||
if (mShortcutPreference == null) {
|
||||
mShortcutPreference = new ShortcutPreference(getPrefContext(), /* attrs= */ null);
|
||||
mShortcutPreference.setPersistent(false);
|
||||
mShortcutPreference.setKey(getShortcutPreferenceKey());
|
||||
getPreferenceScreen().addPreference(mShortcutPreference);
|
||||
}
|
||||
|
||||
mShortcutPreference.setOnClickCallback(this);
|
||||
mShortcutPreference.setTitle(getShortcutTitle());
|
||||
|
||||
getPreferenceScreen().addPreference(mShortcutPreference);
|
||||
|
||||
mTouchExplorationStateChangeListener = isTouchExplorationEnabled -> {
|
||||
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||
};
|
||||
|
||||
@@ -24,6 +24,8 @@ import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
|
||||
import com.android.settings.R;
|
||||
@@ -60,7 +62,7 @@ public class ShortcutPreference extends TwoTargetPreference {
|
||||
private boolean mChecked = false;
|
||||
private boolean mSettingsEditable = true;
|
||||
|
||||
ShortcutPreference(Context context, AttributeSet attrs) {
|
||||
public ShortcutPreference(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setIconSpaceReserved(false);
|
||||
// Treat onSettingsClicked as this preference's click.
|
||||
|
||||
@@ -20,16 +20,19 @@ import static com.android.internal.accessibility.AccessibilityShortcutController
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.server.accessibility.Flags;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
import com.android.settingslib.widget.SelectorWithWidgetPreference;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Fragment for preference screen for settings related to Automatically click after mouse stops
|
||||
@@ -41,7 +44,7 @@ public class ToggleAutoclickPreferenceFragment
|
||||
|
||||
private static final String TAG = "AutoclickPrefFragment";
|
||||
|
||||
static final String KEY_CONTROL_DEFAULT = "accessibility_control_autoclick_default";
|
||||
@VisibleForTesting
|
||||
static final String KEY_AUTOCLICK_SHORTCUT_PREFERENCE = "autoclick_shortcut_preference";
|
||||
|
||||
/**
|
||||
@@ -100,15 +103,22 @@ public class ToggleAutoclickPreferenceFragment
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (Flags.enableAutoclickIndicator()) {
|
||||
SelectorWithWidgetPreference optionDefault = findPreference(KEY_CONTROL_DEFAULT);
|
||||
mShortcutPreference.setOrder(optionDefault.getOrder() - 1);
|
||||
} else {
|
||||
if (!Flags.enableAutoclickIndicator()) {
|
||||
getPreferenceScreen().removePreference(mShortcutPreference);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.accessibility_autoclick_settings);
|
||||
new BaseSearchIndexProvider(R.xml.accessibility_autoclick_settings) {
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
List<String> niks = super.getNonIndexableKeys(context);
|
||||
|
||||
if (!Flags.enableAutoclickIndicator()) {
|
||||
niks.add(KEY_AUTOCLICK_SHORTCUT_PREFERENCE);
|
||||
}
|
||||
return niks;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -16,10 +16,15 @@
|
||||
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
import static com.android.settings.accessibility.ToggleAutoclickPreferenceFragment.KEY_AUTOCLICK_SHORTCUT_PREFERENCE;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
@@ -27,6 +32,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.XmlTestUtils;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -37,6 +43,8 @@ import java.util.List;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class ToggleAutoclickPreferenceFragmentTest {
|
||||
|
||||
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
private final Context mContext = ApplicationProvider.getApplicationContext();
|
||||
private ToggleAutoclickPreferenceFragment mFragment;
|
||||
|
||||
@@ -77,4 +85,22 @@ public class ToggleAutoclickPreferenceFragmentTest {
|
||||
|
||||
assertThat(keys).containsAtLeastElementsIn(niks);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR)
|
||||
public void getNonIndexableKeys_flagDisabled_doesNotContainShortcut() {
|
||||
final List<String> niks = ToggleAutoclickPreferenceFragment.SEARCH_INDEX_DATA_PROVIDER
|
||||
.getNonIndexableKeys(mContext);
|
||||
|
||||
assertThat(niks).contains(KEY_AUTOCLICK_SHORTCUT_PREFERENCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnableFlags(com.android.server.accessibility.Flags.FLAG_ENABLE_AUTOCLICK_INDICATOR)
|
||||
public void getNonIndexableKeys_returnsOnlyShortcutKey() {
|
||||
final List<String> niks = ToggleAutoclickPreferenceFragment.SEARCH_INDEX_DATA_PROVIDER
|
||||
.getNonIndexableKeys(mContext);
|
||||
|
||||
assertThat(niks).doesNotContain(KEY_AUTOCLICK_SHORTCUT_PREFERENCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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