Do not allow toggle to be clickable/focusable

The entire preference is already clickable/focusable. Also, changed it so that
the entire preferenceview is clickable/focusable in non-accessibility mode as well
to better match Settings UX.

Also, no need to setClickable, since it is already by default

Fixes: 130398575

Test: With and without accessibility turned on, toggle works
Test: With accessibility turned on, toggle no longer takes a separate
      focus in addition to the preference

Change-Id: Iaff05cdf350f8d4f4c0f53b539770a7ad1f7d8ad
This commit is contained in:
Kevin Chyn
2019-06-17 13:08:23 -07:00
parent 8573d27d31
commit 92d2aae337
2 changed files with 5 additions and 4 deletions

View File

@@ -60,6 +60,8 @@ public class FaceEnrollAccessibilityToggle extends LinearLayout {
} }
mSwitch = findViewById(R.id.toggle); mSwitch = findViewById(R.id.toggle);
mSwitch.setChecked(false); mSwitch.setChecked(false);
mSwitch.setClickable(false);
mSwitch.setFocusable(false);
} }
public boolean isChecked() { public boolean isChecked() {

View File

@@ -159,13 +159,12 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
mSwitchDiversity = findViewById(R.id.toggle_diversity); mSwitchDiversity = findViewById(R.id.toggle_diversity);
mSwitchDiversity.setListener(mSwitchDiversityListener); mSwitchDiversity.setListener(mSwitchDiversityListener);
if (accessibilityEnabled) {
accessibilityButton.callOnClick();
mSwitchDiversity.setClickable(true);
mSwitchDiversity.setOnClickListener(v -> { mSwitchDiversity.setOnClickListener(v -> {
mSwitchDiversity.getSwitch().toggle(); mSwitchDiversity.getSwitch().toggle();
}); });
if (accessibilityEnabled) {
accessibilityButton.callOnClick();
} }
} }