Merge "[Expressive design] Update MainSwitch in SettingsActivity." into main

This commit is contained in:
Yuchen Sun
2024-12-17 17:29:06 -08:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 1 deletions

View File

@@ -28,6 +28,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.android.settings.widget.SettingsMainSwitchBar
android:id="@+id/expressive_switch_bar"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dip"/>
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"

View File

@@ -311,7 +311,10 @@ public class SettingsActivity extends SettingsBaseActivity
}
setContentView(R.layout.settings_main_prefs);
mMainSwitch = findViewById(R.id.switch_bar);
mMainSwitch = SettingsThemeHelper.isExpressiveTheme(this)
? findViewById(R.id.expressive_switch_bar)
: findViewById(R.id.switch_bar);
if (mMainSwitch != null) {
mMainSwitch.setMetricsCategory(lookupMetricsCategory());
mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1);