Fix toggle display and preferen style old style and barely seen in “Vision Settings”
Root cause: Apply ThemeHelper.trySetDynamicColor would overlay the settings style. Solution: Create SudDynamicColorThemeSettings.SetupWizard to support dynamicColor and settings style. Bug: 192410829 Test: manual test Change-Id: Ic196dfe417e7f804c68ed4ea7bc05b4716999bcf
This commit is contained in:
@@ -223,6 +223,24 @@
|
|||||||
<!-- This theme was applied to Settings pages which are running under SUW. -->
|
<!-- This theme was applied to Settings pages which are running under SUW. -->
|
||||||
<style name="SubSettings.SetupWizard" parent="SudThemeGlifV3.Light" />
|
<style name="SubSettings.SetupWizard" parent="SudThemeGlifV3.Light" />
|
||||||
|
|
||||||
|
<!-- This theme was applied to Settings pages which are running under SUW with DynamicColor. -->
|
||||||
|
<style name="SudDynamicColorThemeSettings.SetupWizard" parent="SudDynamicColorThemeGlifV3.Light">
|
||||||
|
<item name="android:textAppearanceListItem">@style/TextAppearance.PreferenceTitle.SettingsLib</item>
|
||||||
|
<item name="android:listPreferredItemPaddingStart">24dp</item>
|
||||||
|
<item name="android:listPreferredItemPaddingEnd">16dp</item>
|
||||||
|
<item name="preferenceTheme">@style/PreferenceTheme.SettingsLib</item>
|
||||||
|
<item name="android:switchStyle">@style/Switch.SettingsLib</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- This theme was applied to Settings pages which are running under SUW with DynamicColor. -->
|
||||||
|
<style name="SudDynamicColorThemeSettings.SetupWizard.DayNight" parent="SudDynamicColorThemeGlifV3.DayNight">
|
||||||
|
<item name="android:textAppearanceListItem">@style/TextAppearance.PreferenceTitle.SettingsLib</item>
|
||||||
|
<item name="android:listPreferredItemPaddingStart">24dp</item>
|
||||||
|
<item name="android:listPreferredItemPaddingEnd">16dp</item>
|
||||||
|
<item name="preferenceTheme">@style/PreferenceTheme.SettingsLib</item>
|
||||||
|
<item name="android:switchStyle">@style/Switch.SettingsLib</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- DayNight themes -->
|
<!-- DayNight themes -->
|
||||||
<style name="GlifTheme.DayNight" parent="GlifTheme.Light" />
|
<style name="GlifTheme.DayNight" parent="GlifTheme.Light" />
|
||||||
<style name="GlifV2Theme.DayNight" parent="GlifV2Theme.Light" />
|
<style name="GlifV2Theme.DayNight" parent="GlifV2Theme.Light" />
|
||||||
|
@@ -101,12 +101,22 @@ public class AccessibilitySettingsForSetupWizardActivity extends SettingsActivit
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedState) {
|
protected void onCreate(Bundle savedState) {
|
||||||
super.onCreate(savedState);
|
super.onCreate(savedState);
|
||||||
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
applyTheme();
|
||||||
ThemeHelper.trySetDynamicColor(this);
|
|
||||||
tryLaunchFontSizeSettings();
|
tryLaunchFontSizeSettings();
|
||||||
findViewById(R.id.content_parent).setFitsSystemWindows(false);
|
findViewById(R.id.content_parent).setFitsSystemWindows(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyTheme() {
|
||||||
|
if (ThemeHelper.trySetDynamicColor(this)) {
|
||||||
|
final int appliedTheme = ThemeHelper.isSetupWizardDayNightEnabled(this)
|
||||||
|
? R.style.SudDynamicColorThemeSettings_SetupWizard_DayNight
|
||||||
|
: R.style.SudDynamicColorThemeSettings_SetupWizard;
|
||||||
|
setTheme(appliedTheme);
|
||||||
|
} else {
|
||||||
|
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void tryLaunchFontSizeSettings() {
|
void tryLaunchFontSizeSettings() {
|
||||||
if (WizardManagerHelper.isAnySetupWizard(getIntent())
|
if (WizardManagerHelper.isAnySetupWizard(getIntent())
|
||||||
|
@@ -91,10 +91,17 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
|
|||||||
// Apply SetupWizard light theme during setup flow. This is for SubSettings pages.
|
// Apply SetupWizard light theme during setup flow. This is for SubSettings pages.
|
||||||
final boolean isAnySetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
final boolean isAnySetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||||
if (isAnySetupWizard && this instanceof SubSettings) {
|
if (isAnySetupWizard && this instanceof SubSettings) {
|
||||||
final int appliedTheme = ThemeHelper.isSetupWizardDayNightEnabled(this)
|
int appliedTheme;
|
||||||
? R.style.SubSettings_SetupWizard : R.style.SudThemeGlifV3_Light;
|
if (ThemeHelper.trySetDynamicColor(this)) {
|
||||||
|
appliedTheme = ThemeHelper.isSetupWizardDayNightEnabled(this)
|
||||||
|
? R.style.SudDynamicColorThemeSettings_SetupWizard_DayNight
|
||||||
|
: R.style.SudDynamicColorThemeSettings_SetupWizard;
|
||||||
|
} else {
|
||||||
|
appliedTheme = ThemeHelper.isSetupWizardDayNightEnabled(this)
|
||||||
|
? R.style.SubSettings_SetupWizard
|
||||||
|
: R.style.SudThemeGlifV3_Light;
|
||||||
|
}
|
||||||
setTheme(appliedTheme);
|
setTheme(appliedTheme);
|
||||||
ThemeHelper.trySetDynamicColor(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isToolbarEnabled() && !isAnySetupWizard) {
|
if (isToolbarEnabled() && !isAnySetupWizard) {
|
||||||
|
Reference in New Issue
Block a user