New feature “Text and reading options” for SetupWizard, Wallpaper, and Settings (13/n).

- Add the ResetPreference for controlling all preferences state in the text and reading options page.
1) Create a new interface ResetStateListener for the other preferences.

- Link-up between the reset, font size, and display size preferences.

Bug: 211503117
Test: make RunSettingsRoboTests ROBOTEST_FILTER=PreviewSizeSeekBarControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=TextReadingResetControllerTest
Change-Id: Ida773967834e32737b1daac885a2dd71189d32c8
This commit is contained in:
Peter_Liang
2022-02-06 21:45:03 +08:00
parent edb52508d3
commit f71050b515
9 changed files with 291 additions and 7 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.accessibility;
import static com.android.settings.accessibility.TextReadingResetController.ResetStateListener;
import android.app.settings.SettingsEnums;
import android.content.Context;
@@ -27,6 +29,7 @@ import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* Accessibility settings for adjusting the system features which are related to the reading. For
@@ -38,6 +41,7 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
private static final String FONT_SIZE_KEY = "font_size";
private static final String DISPLAY_SIZE_KEY = "display_size";
private static final String PREVIEW_KEY = "preview";
private static final String RESET_KEY = "reset";
@Override
protected int getPreferenceScreenResId() {
@@ -74,6 +78,13 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
displaySizeController.setInteractionListener(previewController);
controllers.add(displaySizeController);
final List<ResetStateListener> resetStateListeners =
controllers.stream().filter(c -> c instanceof ResetStateListener).map(
c -> (ResetStateListener) c).collect(Collectors.toList());
final TextReadingResetController resetController =
new TextReadingResetController(context, RESET_KEY, resetStateListeners);
controllers.add(resetController);
return controllers;
}