|
26 | 26 | import com.fox2code.mmm.utils.Http; |
27 | 27 | import com.fox2code.rosettax.LanguageSwitcher; |
28 | 28 | import com.google.android.material.color.DynamicColors; |
| 29 | +import com.google.android.material.color.DynamicColorsOptions; |
29 | 30 | import com.topjohnwu.superuser.Shell; |
30 | 31 |
|
31 | 32 | import java.text.SimpleDateFormat; |
@@ -122,7 +123,8 @@ public static boolean isDohEnabled() { |
122 | 123 | } |
123 | 124 |
|
124 | 125 | public static boolean isMonetEnabled() { |
125 | | - return getSharedPreferences().getBoolean("pref_enable_monet", false); |
| 126 | + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && |
| 127 | + getSharedPreferences().getBoolean("pref_enable_monet", true); |
126 | 128 | } |
127 | 129 |
|
128 | 130 | public static boolean isBlurEnabled() { |
@@ -274,10 +276,10 @@ public boolean isLightTheme() { |
274 | 276 | public void onCreate() { |
275 | 277 | if (INSTANCE == null) INSTANCE = this; |
276 | 278 | super.onCreate(); |
277 | | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
278 | | - if (MainApplication.isMonetEnabled()) { |
279 | | - DynamicColors.applyToActivitiesIfAvailable(this); |
280 | | - } |
| 279 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && isMonetEnabled()) { |
| 280 | + DynamicColors.applyToActivitiesIfAvailable(this, |
| 281 | + new DynamicColorsOptions.Builder().setPrecondition( |
| 282 | + (activity, theme) -> isMonetEnabled()).build()); |
281 | 283 | } |
282 | 284 | SharedPreferences sharedPreferences = MainApplication.getSharedPreferences(); |
283 | 285 | // We are only one process so it's ok to do this |
|
0 commit comments