From bd09e28a84821a4f7da467ada68d96542ffc4f6d Mon Sep 17 00:00:00 2001 From: menghanli Date: Mon, 23 Mar 2020 21:00:58 +0800 Subject: [PATCH] Enlarge the touch area of edit shortcut dialog Bug: 148837311 Test: Manual test Change-Id: I54ca93ccaa87514bf4d201b95ed855003d1c164c --- .../accessibility_edit_shortcut_component.xml | 42 ++++++++++++------- .../ToggleFeaturePreferenceFragment.java | 14 +++++-- ...ScreenMagnificationPreferenceFragment.java | 17 ++++++-- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/res/layout/accessibility_edit_shortcut_component.xml b/res/layout/accessibility_edit_shortcut_component.xml index 02938c3a903..074a8783436 100644 --- a/res/layout/accessibility_edit_shortcut_component.xml +++ b/res/layout/accessibility_edit_shortcut_component.xml @@ -21,24 +21,36 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:background="?android:attr/selectableItemBackground" + android:orientation="vertical"> - + + + + + { + checkBox.toggle(); + updateUserShortcutType(/* saveChanges= */ false); + }); + } private void initializeDialogCheckBox(Dialog dialog) { final View dialogSoftwareView = dialog.findViewById(R.id.software_shortcut); mSoftwareTypeCheckBox = dialogSoftwareView.findViewById(R.id.checkbox); + setDialogTextAreaClickListener(dialogSoftwareView, mSoftwareTypeCheckBox); + final View dialogHardwareView = dialog.findViewById(R.id.hardware_shortcut); mHardwareTypeCheckBox = dialogHardwareView.findViewById(R.id.checkbox); + setDialogTextAreaClickListener(dialogHardwareView, mHardwareTypeCheckBox); + updateAlertDialogCheckState(); } @@ -468,9 +479,6 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference private void updateCheckStatus(CheckBox checkBox, @UserShortcutType int type) { checkBox.setChecked((mUserShortcutTypeCache & type) == type); - checkBox.setOnClickListener(v -> { - updateUserShortcutType(/* saveChanges= */ false); - }); } private void updateUserShortcutType(boolean saveChanges) { diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java index 4c2945ad176..5573746ca72 100644 --- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java +++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java @@ -246,13 +246,27 @@ public class ToggleScreenMagnificationPreferenceFragment extends throw new IllegalArgumentException("Unsupported dialogId " + dialogId); } + private void setDialogTextAreaClickListener(View dialogView, CheckBox checkBox) { + final View dialogTextArea = dialogView.findViewById(R.id.container); + dialogTextArea.setOnClickListener(v -> { + checkBox.toggle(); + updateUserShortcutType(/* saveChanges= */ false); + }); + } + private void initializeDialogCheckBox(AlertDialog dialog) { final View dialogSoftwareView = dialog.findViewById(R.id.software_shortcut); mSoftwareTypeCheckBox = dialogSoftwareView.findViewById(R.id.checkbox); + setDialogTextAreaClickListener(dialogSoftwareView, mSoftwareTypeCheckBox); + final View dialogHardwareView = dialog.findViewById(R.id.hardware_shortcut); mHardwareTypeCheckBox = dialogHardwareView.findViewById(R.id.checkbox); + setDialogTextAreaClickListener(dialogHardwareView, mHardwareTypeCheckBox); + final View dialogTripleTapView = dialog.findViewById(R.id.triple_tap_shortcut); mTripleTapTypeCheckBox = dialogTripleTapView.findViewById(R.id.checkbox); + setDialogTextAreaClickListener(dialogTripleTapView, mTripleTapTypeCheckBox); + final View advancedView = dialog.findViewById(R.id.advanced_shortcut); updateAlertDialogCheckState(); @@ -276,9 +290,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends private void updateCheckStatus(CheckBox checkBox, @UserShortcutType int type) { checkBox.setChecked((mUserShortcutTypeCache & type) == type); - checkBox.setOnClickListener(v -> { - updateUserShortcutType(/* saveChanges= */ false); - }); } private void updateUserShortcutType(boolean saveChanges) {