Add a done button to vision setting pages in setup flow

Root cause: User feels confused because the particular screen doesn't have a back button but at that moment of the setup flow the regular UI gestures didn't even work.
Solution: Add a done button to the vision settings pages for clearer navigation.

Bug: 262995569
Test: make RunSettingsRoboTests ROBOTEST_FILTER=FragmentForSetupWizardTest
Change-Id: Id3a0d78389e0e6c11b5b5cf016b37673fde7f286
This commit is contained in:
menghanli
2023-02-13 17:18:40 +08:00
parent d3ff83eb4f
commit dd2ec775c8
11 changed files with 119 additions and 33 deletions

View File

@@ -33,7 +33,6 @@ 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;
/**
@@ -55,26 +54,14 @@ public class TextReadingPreferenceFragmentForSetupWizard extends TextReadingPref
/* 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());
}
AccessibilitySetupWizardUtils.setPrimaryButton(getContext(), mixin, R.string.done, () -> {
setResult(RESULT_CANCELED);
finish();
});
AccessibilitySetupWizardUtils.setSecondaryButton(getContext(), mixin,
R.string.accessibility_text_reading_reset_button_title,
() -> showDialog(DIALOG_RESET_SETTINGS)
);
}
@Override