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

- Create the font size LabeledSeekBarPreference and add the entry
1) It's integrated with the system font scale configurations.
2) Create the new PreviewSizeSeekBarController component for controlling the LabeledSeekBarPreference of the display/font size.
3) Create the new PreviewSizeData component to store the configurations related to the display/font size features.

Bug: 211503117
Test: make RunSettingsRoboTests ROBOTEST_FILTER=FontSizeDataTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=PreviewSizeSeekBarControllerTest

Change-Id: I0c1cf6d0425c5c8b61cc8ed0c9fedadf7a65bd27
This commit is contained in:
Peter_Liang
2022-01-21 00:53:32 +08:00
parent 0ee078d37a
commit 4681ef2b47
7 changed files with 408 additions and 0 deletions

View File

@@ -17,12 +17,17 @@
package com.android.settings.accessibility;
import android.app.settings.SettingsEnums;
import android.content.Context;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList;
import java.util.List;
/**
* Accessibility settings for adjusting the system features which are related to the reading. For
* example, bold text, high contrast text, display size, font size and so on.
@@ -30,6 +35,7 @@ import com.android.settingslib.search.SearchIndexable;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class TextReadingPreferenceFragment extends DashboardFragment {
private static final String TAG = "TextReadingPreferenceFragment";
private static final String FONT_SIZE_KEY = "font_size";
@Override
protected int getPreferenceScreenResId() {
@@ -46,6 +52,16 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
return SettingsEnums.ACCESSIBILITY_TEXT_READING_OPTIONS;
}
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final FontSizeData fontSizeData = new FontSizeData(context);
controllers.add(new PreviewSizeSeekBarController(context, FONT_SIZE_KEY, fontSizeData));
return controllers;
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.accessibility_text_reading_options);
}