Refine the UI of the text reading page across SuW.

Actions:
1) Customize pages and use the components from SuW lib to align SuW consistent style.
2) Add the done button in the Anything Else page.

Bug: 232771631
Bug: 222419452
Test: make RunSettingsRoboTests ROBOTEST_FILTER=TextReadingResetControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=TextReadingPreferenceFragmentForSetupWizardTest
Change-Id: Ie3f3513ceee7c40d6286335dce91979df0d27f02
This commit is contained in:
Peter Liang
2022-12-11 12:04:58 +08:00
parent 2c2a826c3f
commit 5e931b2c23
7 changed files with 92 additions and 82 deletions

View File

@@ -16,6 +16,10 @@
package com.android.settings.accessibility;
import static android.app.Activity.RESULT_CANCELED;
import static com.android.settings.accessibility.AccessibilityDialogUtils.DialogEnums.DIALOG_RESET_SETTINGS;
import android.app.settings.SettingsEnums;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -28,9 +32,10 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.settings.R;
import com.android.settingslib.Utils;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupdesign.GlifPreferenceLayout;
/**
* A {@link androidx.preference.PreferenceFragmentCompat} that displays the settings page related
* to the text and reading option in the SetupWizard.
@@ -48,6 +53,28 @@ public class TextReadingPreferenceFragmentForSetupWizard extends TextReadingPref
icon.setTintList(Utils.getColorAttr(getContext(), android.R.attr.colorPrimary));
AccessibilitySetupWizardUtils.updateGlifPreferenceLayout(getContext(), layout, title,
/* description= */ null, icon);
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);
mixin.setSecondaryButton(
new FooterButton.Builder(getContext())
.setText(R.string.accessibility_text_reading_reset_button_title)
.setListener(l -> showDialog(DIALOG_RESET_SETTINGS))
.setButtonType(FooterButton.ButtonType.CLEAR)
.setTheme(R.style.SudGlifButton_Secondary)
.build());
if (isCallingFromAnythingElseEntryPoint()) {
mixin.setPrimaryButton(
new FooterButton.Builder(getContext())
.setText(R.string.done)
.setListener(l -> {
setResult(RESULT_CANCELED);
finish();
})
.setButtonType(FooterButton.ButtonType.DONE)
.setTheme(R.style.SudGlifButton_Primary)
.build());
}
}
@Override