Merge "Add dynamic color support" into tm-dev
diff --git a/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java b/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java
index f55960b..938d224 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java
@@ -26,6 +26,8 @@
import com.android.settings.SetupWizardUtils;
import com.android.settings.core.InstrumentedActivity;
+import com.google.android.setupdesign.util.ThemeHelper;
+
public abstract class WifiDppBaseActivity extends InstrumentedActivity {
protected FragmentManager mFragmentManager;
@@ -35,6 +37,8 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ applyTheme();
+
setContentView(R.layout.wifi_dpp_activity);
mFragmentManager = getSupportFragmentManager();
@@ -45,8 +49,18 @@
@Override
protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
- final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
- theme.applyStyle(R.style.SetupWizardPartnerResource, /* force */ true);
- super.onApplyThemeResource(theme, new_resid, first);
+ theme.applyStyle(R.style.SetupWizardPartnerResource, true);
+ super.onApplyThemeResource(theme, resid, first);
+ }
+
+ 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()));
+ }
}
}