@@ -26,14 +26,15 @@ import androidx.compose.ui.graphics.Color
2626import androidx.compose.ui.platform.LocalContext
2727import com.google.android.material.color.MaterialColors
2828import com.google.android.material.R as RMaterial
29+ import androidx.appcompat.R as RAndroid
2930
3031/* *
3132 * Automatically defines the Jetpack Compose MaterialTheme based on the
3233 * values defined as an XML theme in the context where this is called.
3334 */
3435@Composable
3536fun MaterialThemeFromXml (content : @Composable () -> Unit ): Unit = with (LocalContext .current) {
36- val primary = getMaterialColor(RMaterial .attr.colorPrimary)
37+ val primary = getMaterialColor(RAndroid .attr.colorPrimary)
3738
3839 MaterialTheme (
3940 colorScheme = ColorScheme (
@@ -50,7 +51,7 @@ fun MaterialThemeFromXml(content: @Composable () -> Unit): Unit = with(LocalCont
5051 onTertiary = getMaterialColor(RMaterial .attr.colorOnTertiary),
5152 tertiaryContainer = getMaterialColor(RMaterial .attr.colorTertiaryContainer),
5253 onTertiaryContainer = getMaterialColor(RMaterial .attr.colorOnTertiaryContainer),
53- background = getMaterialColor(RMaterial .attr.background),
54+ background = getMaterialColor(RAndroid .attr.background),
5455 onBackground = getMaterialColor(RMaterial .attr.colorOnBackground),
5556 surface = getMaterialColor(RMaterial .attr.colorSurface),
5657 onSurface = getMaterialColor(RMaterial .attr.colorOnSurface),
@@ -61,7 +62,7 @@ fun MaterialThemeFromXml(content: @Composable () -> Unit): Unit = with(LocalCont
6162 surfaceTint = primary,
6263 inverseSurface = getMaterialColor(RMaterial .attr.colorSurfaceInverse),
6364 inverseOnSurface = getMaterialColor(RMaterial .attr.colorOnSurfaceInverse),
64- error = getMaterialColor(RMaterial .attr.colorError),
65+ error = getMaterialColor(RAndroid .attr.colorError),
6566 onError = getMaterialColor(RMaterial .attr.colorOnError),
6667 errorContainer = getMaterialColor(RMaterial .attr.colorErrorContainer),
6768 onErrorContainer = getMaterialColor(RMaterial .attr.colorOnErrorContainer),
0 commit comments