Skip to content

Commit b84f35f

Browse files
committed
[Color] Update DynamicColors util to use activity.getTheme().applyStyle() instead of activity.setTheme() to workaround Force Dark issue
Resolves #2521 PiperOrigin-RevId: 422816956
1 parent 80e50de commit b84f35f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/java/com/google/android/material/color/DynamicColors.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ private static void applyIfAvailable(
231231
theme = getDefaultThemeOverlay(activity);
232232
}
233233
if (theme != 0 && precondition.shouldApplyDynamicColors(activity, theme)) {
234-
activity.setTheme(theme);
234+
// Use applyStyle() instead of setTheme() due to Force Dark issue.
235+
activity.getTheme().applyStyle(theme, /* force= */ true);
235236
}
236237
}
237238

0 commit comments

Comments
 (0)