Enlarge the touch area of edit shortcut dialog
Bug: 148837311 Test: Manual test Change-Id: I54ca93ccaa87514bf4d201b95ed855003d1c164c
This commit is contained in:
@@ -21,11 +21,21 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/checkbox"
|
android:id="@+id/checkbox"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false"
|
||||||
|
android:focusableInTouchMode="false"
|
||||||
android:paddingStart="12dp"
|
android:paddingStart="12dp"
|
||||||
android:saveEnabled="false"
|
android:saveEnabled="false"
|
||||||
android:textColor="?android:attr/textColorAlertDialogListItem"
|
android:textColor="?android:attr/textColorAlertDialogListItem"
|
||||||
@@ -40,6 +50,8 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
||||||
android:textColor="?android:attr/textColorSecondary" />
|
android:textColor="?android:attr/textColorSecondary" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image"
|
android:id="@+id/image"
|
||||||
android:layout_width="176dp"
|
android:layout_width="176dp"
|
||||||
|
@@ -452,12 +452,23 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(Dialog dialog) {
|
private void initializeDialogCheckBox(Dialog dialog) {
|
||||||
final View dialogSoftwareView = dialog.findViewById(R.id.software_shortcut);
|
final View dialogSoftwareView = dialog.findViewById(R.id.software_shortcut);
|
||||||
mSoftwareTypeCheckBox = dialogSoftwareView.findViewById(R.id.checkbox);
|
mSoftwareTypeCheckBox = dialogSoftwareView.findViewById(R.id.checkbox);
|
||||||
|
setDialogTextAreaClickListener(dialogSoftwareView, mSoftwareTypeCheckBox);
|
||||||
|
|
||||||
final View dialogHardwareView = dialog.findViewById(R.id.hardware_shortcut);
|
final View dialogHardwareView = dialog.findViewById(R.id.hardware_shortcut);
|
||||||
mHardwareTypeCheckBox = dialogHardwareView.findViewById(R.id.checkbox);
|
mHardwareTypeCheckBox = dialogHardwareView.findViewById(R.id.checkbox);
|
||||||
|
setDialogTextAreaClickListener(dialogHardwareView, mHardwareTypeCheckBox);
|
||||||
|
|
||||||
updateAlertDialogCheckState();
|
updateAlertDialogCheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,9 +479,6 @@ public abstract class ToggleFeaturePreferenceFragment extends SettingsPreference
|
|||||||
|
|
||||||
private void updateCheckStatus(CheckBox checkBox, @UserShortcutType int type) {
|
private void updateCheckStatus(CheckBox checkBox, @UserShortcutType int type) {
|
||||||
checkBox.setChecked((mUserShortcutTypeCache & type) == type);
|
checkBox.setChecked((mUserShortcutTypeCache & type) == type);
|
||||||
checkBox.setOnClickListener(v -> {
|
|
||||||
updateUserShortcutType(/* saveChanges= */ false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUserShortcutType(boolean saveChanges) {
|
private void updateUserShortcutType(boolean saveChanges) {
|
||||||
|
@@ -246,13 +246,27 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
throw new IllegalArgumentException("Unsupported dialogId " + dialogId);
|
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) {
|
private void initializeDialogCheckBox(AlertDialog dialog) {
|
||||||
final View dialogSoftwareView = dialog.findViewById(R.id.software_shortcut);
|
final View dialogSoftwareView = dialog.findViewById(R.id.software_shortcut);
|
||||||
mSoftwareTypeCheckBox = dialogSoftwareView.findViewById(R.id.checkbox);
|
mSoftwareTypeCheckBox = dialogSoftwareView.findViewById(R.id.checkbox);
|
||||||
|
setDialogTextAreaClickListener(dialogSoftwareView, mSoftwareTypeCheckBox);
|
||||||
|
|
||||||
final View dialogHardwareView = dialog.findViewById(R.id.hardware_shortcut);
|
final View dialogHardwareView = dialog.findViewById(R.id.hardware_shortcut);
|
||||||
mHardwareTypeCheckBox = dialogHardwareView.findViewById(R.id.checkbox);
|
mHardwareTypeCheckBox = dialogHardwareView.findViewById(R.id.checkbox);
|
||||||
|
setDialogTextAreaClickListener(dialogHardwareView, mHardwareTypeCheckBox);
|
||||||
|
|
||||||
final View dialogTripleTapView = dialog.findViewById(R.id.triple_tap_shortcut);
|
final View dialogTripleTapView = dialog.findViewById(R.id.triple_tap_shortcut);
|
||||||
mTripleTapTypeCheckBox = dialogTripleTapView.findViewById(R.id.checkbox);
|
mTripleTapTypeCheckBox = dialogTripleTapView.findViewById(R.id.checkbox);
|
||||||
|
setDialogTextAreaClickListener(dialogTripleTapView, mTripleTapTypeCheckBox);
|
||||||
|
|
||||||
final View advancedView = dialog.findViewById(R.id.advanced_shortcut);
|
final View advancedView = dialog.findViewById(R.id.advanced_shortcut);
|
||||||
updateAlertDialogCheckState();
|
updateAlertDialogCheckState();
|
||||||
|
|
||||||
@@ -276,9 +290,6 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
|||||||
|
|
||||||
private void updateCheckStatus(CheckBox checkBox, @UserShortcutType int type) {
|
private void updateCheckStatus(CheckBox checkBox, @UserShortcutType int type) {
|
||||||
checkBox.setChecked((mUserShortcutTypeCache & type) == type);
|
checkBox.setChecked((mUserShortcutTypeCache & type) == type);
|
||||||
checkBox.setOnClickListener(v -> {
|
|
||||||
updateUserShortcutType(/* saveChanges= */ false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUserShortcutType(boolean saveChanges) {
|
private void updateUserShortcutType(boolean saveChanges) {
|
||||||
|
Reference in New Issue
Block a user