[Accessibility button settings] Remove half circle option in size selector
Half circle accessibility floating menu mode changed to be triggered from gesture. Bug: 173940869 Test: atest FloatingMenuSizePreferenceControllerTest Change-Id: I123baaf3684d5cbb0a33fc2383da72aa022876c0
This commit is contained in:
@@ -985,7 +985,6 @@
|
||||
<string-array name="accessibility_button_size_selector_titles">
|
||||
<item>Small</item>
|
||||
<item>Large</item>
|
||||
<item>Half Circle</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Values for the accessibility button size. -->
|
||||
@@ -994,8 +993,6 @@
|
||||
<item>0</item>
|
||||
<!-- Large -->
|
||||
<item>1</item>
|
||||
<!-- Half Circle -->
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Match this with the constants in VpnProfile. --> <skip />
|
||||
|
@@ -59,24 +59,11 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
|
||||
@IntDef({
|
||||
Size.SMALL,
|
||||
Size.LARGE,
|
||||
Size.EDGE
|
||||
})
|
||||
@VisibleForTesting
|
||||
@interface Size {
|
||||
int SMALL = 0;
|
||||
int LARGE = 1;
|
||||
int EDGE = 2;
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
EdgeMode.FULL_CIRCLE,
|
||||
EdgeMode.HALF_CIRCLE,
|
||||
})
|
||||
@VisibleForTesting
|
||||
@interface EdgeMode {
|
||||
int FULL_CIRCLE = 0;
|
||||
int HALF_CIRCLE = 1;
|
||||
}
|
||||
|
||||
public FloatingMenuSizePreferenceController(Context context, String preferenceKey) {
|
||||
@@ -110,7 +97,7 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
|
||||
final ListPreference listPreference = (ListPreference) preference;
|
||||
final Integer value = Ints.tryParse((String) newValue);
|
||||
if (value != null) {
|
||||
writeToFloatingMenuSettings(value);
|
||||
putAccessibilityFloatingMenuSize(value);
|
||||
updateState(listPreference);
|
||||
}
|
||||
return true;
|
||||
@@ -121,7 +108,7 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
|
||||
super.updateState(preference);
|
||||
final ListPreference listPreference = (ListPreference) preference;
|
||||
|
||||
listPreference.setValue(getCurrentAccessibilityButtonSize());
|
||||
listPreference.setValue(String.valueOf(getAccessibilityFloatingMenuSize(mDefaultSize)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,24 +144,6 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
|
||||
}
|
||||
}
|
||||
|
||||
private void writeToFloatingMenuSettings(@Size int sizeValue) {
|
||||
if (sizeValue == Size.EDGE) {
|
||||
putAccessibilityFloatingMenuSize(Size.SMALL);
|
||||
putAccessibilityFloatingMenuIconType(EdgeMode.HALF_CIRCLE);
|
||||
} else {
|
||||
putAccessibilityFloatingMenuSize(sizeValue);
|
||||
putAccessibilityFloatingMenuIconType(EdgeMode.FULL_CIRCLE);
|
||||
}
|
||||
}
|
||||
|
||||
private String getCurrentAccessibilityButtonSize() {
|
||||
final @EdgeMode int iconType = getAccessibilityFloatingMenuIconType(EdgeMode.FULL_CIRCLE);
|
||||
final @Size int btnSize = getAccessibilityFloatingMenuSize(mDefaultSize);
|
||||
|
||||
return (iconType == EdgeMode.HALF_CIRCLE)
|
||||
? String.valueOf(Size.EDGE) : String.valueOf(btnSize);
|
||||
}
|
||||
|
||||
@Size
|
||||
private int getAccessibilityFloatingMenuSize(@Size int defaultValue) {
|
||||
return Settings.Secure.getInt(mContentResolver,
|
||||
@@ -185,15 +154,4 @@ public class FloatingMenuSizePreferenceController extends BasePreferenceControll
|
||||
Settings.Secure.putInt(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE, value);
|
||||
}
|
||||
|
||||
@EdgeMode
|
||||
private int getAccessibilityFloatingMenuIconType(@EdgeMode int defaultValue) {
|
||||
return Settings.Secure.getInt(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_ICON_TYPE, defaultValue);
|
||||
}
|
||||
|
||||
private void putAccessibilityFloatingMenuIconType(@EdgeMode int value) {
|
||||
Settings.Secure.putInt(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_ICON_TYPE, value);
|
||||
}
|
||||
}
|
||||
|
@@ -84,9 +84,6 @@ public class FloatingMenuSizePreferenceControllerTest {
|
||||
public void updateState_floatingMenuLargeSizeAndFullCircle_largeSizeValue() {
|
||||
Settings.Secure.putInt(mContentResolver, Settings.Secure.ACCESSIBILITY_FLOATING_MENU_SIZE,
|
||||
FloatingMenuSizePreferenceController.Size.LARGE);
|
||||
Settings.Secure.putInt(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_ICON_TYPE,
|
||||
FloatingMenuSizePreferenceController.EdgeMode.FULL_CIRCLE);
|
||||
|
||||
mController.updateState(mListPreference);
|
||||
|
||||
@@ -94,28 +91,6 @@ public class FloatingMenuSizePreferenceControllerTest {
|
||||
assertThat(mListPreference.getValue()).isEqualTo(largeSize);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_floatingMenuHalfCircle_edgeSizeValue() {
|
||||
Settings.Secure.putInt(mContentResolver,
|
||||
Settings.Secure.ACCESSIBILITY_FLOATING_MENU_ICON_TYPE,
|
||||
FloatingMenuSizePreferenceController.EdgeMode.HALF_CIRCLE);
|
||||
|
||||
mController.updateState(mListPreference);
|
||||
|
||||
final String edgeSize = String.valueOf(FloatingMenuSizePreferenceController.Size.EDGE);
|
||||
assertThat(mListPreference.getValue()).isEqualTo(edgeSize);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_floatingMenuEdgeSize_edgeSizeValue() {
|
||||
final String edgeSize = String.valueOf(
|
||||
FloatingMenuSizePreferenceController.Size.EDGE);
|
||||
|
||||
mController.onPreferenceChange(mListPreference, edgeSize);
|
||||
|
||||
assertThat(mListPreference.getValue()).isEqualTo(edgeSize);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onChange_a11yBtnModeChangeToNavigationBar_preferenceDisabled() {
|
||||
mController.mPreference = mListPreference;
|
||||
|
Reference in New Issue
Block a user