[Expressive design] Update MainSwitchPreference padding in SettingsActivity.

Update padding programmatically to avoid regression in b/385850462.

Bug: 349681531
Flag: EXEMPT migration
Test: visual
Change-Id: I916dd6e9a41f410ab7d71252944fbf831cd96198
This commit is contained in:
Yuchen
2024-12-30 02:51:53 +00:00
parent 12df61328a
commit 3cef2a0f96

View File

@@ -315,6 +315,12 @@ public class SettingsActivity extends SettingsBaseActivity
if (mMainSwitch != null) { if (mMainSwitch != null) {
mMainSwitch.setMetricsCategory(lookupMetricsCategory()); mMainSwitch.setMetricsCategory(lookupMetricsCategory());
mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1); mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1);
if (SettingsThemeHelper.isExpressiveTheme(this)) {
final int paddingHorizontal = getResources().getDimensionPixelSize(
com.android.settingslib.widget.theme
.R.dimen.settingslib_expressive_space_small1);
mMainSwitch.setPadding(paddingHorizontal, 0, paddingHorizontal, 0);
}
} }
getSupportFragmentManager().addOnBackStackChangedListener(this); getSupportFragmentManager().addOnBackStackChangedListener(this);