Create tooltip for notifying auto-adding the font scaling tile

1. Add string for the content of tooltip.
2. Show the tooltip if needed: the tooltip will only be shown once when users change the font size from the Settings page for the first time.
3. Since the layout shown on the screen will be recreated after font size changes, we need to save the state of the tooltip popup window to check if we need to reshow it in displayPreference.

Bug: 269679768
Test: Manually - attach videos to the bug
Test: make RunSettingsRoboTests ROBOTEST_FILTER=PreviewSizeSeekBarControllerTest
Change-Id: I1b6c5fdbd74c7a868cf42bd21d2cdb1052c0bbe6
This commit is contained in:
Candice Lo
2023-03-20 08:17:26 +00:00
parent 813f654aa1
commit b132ada169
5 changed files with 242 additions and 14 deletions

View File

@@ -16,11 +16,13 @@
package com.android.settings.accessibility;
import static com.android.internal.accessibility.AccessibilityShortcutController.FONT_SIZE_COMPONENT_NAME;
import static com.android.settings.accessibility.TextReadingResetController.ResetStateListener;
import android.app.Activity;
import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
@@ -156,12 +158,34 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
controllers.add(mPreviewController);
final PreviewSizeSeekBarController fontSizeController = new PreviewSizeSeekBarController(
context, FONT_SIZE_KEY, fontSizeData);
context, FONT_SIZE_KEY, fontSizeData) {
@Override
ComponentName getTileComponentName() {
return FONT_SIZE_COMPONENT_NAME;
}
@Override
CharSequence getTileTooltipContent() {
return context.getText(
R.string.accessibility_font_scaling_auto_added_qs_tooltip_content);
}
};
fontSizeController.setInteractionListener(mPreviewController);
getSettingsLifecycle().addObserver(fontSizeController);
controllers.add(fontSizeController);
final PreviewSizeSeekBarController displaySizeController = new PreviewSizeSeekBarController(
context, DISPLAY_SIZE_KEY, displaySizeData);
context, DISPLAY_SIZE_KEY, displaySizeData) {
@Override
ComponentName getTileComponentName() {
return null;
}
@Override
CharSequence getTileTooltipContent() {
return null;
}
};
displaySizeController.setInteractionListener(mPreviewController);
controllers.add(displaySizeController);