@@ -141,6 +141,21 @@ class MaterialViewThemeUtils
141141 }
142142 }
143143
144+ fun themeSearchCardView (cardView : MaterialCardView ) {
145+ withScheme(cardView) { scheme ->
146+ cardView.backgroundTintList =
147+ ColorStateList .valueOf(
148+ dynamicColor.surfaceContainerHigh().getArgb(scheme)
149+ )
150+ cardView.setStrokeColor(
151+ buildColorStateList(
152+ android.R .attr.state_checked to dynamicColor.surfaceContainerHigh().getArgb(scheme),
153+ - android.R .attr.state_checked to dynamicColor.surfaceContainerHigh().getArgb(scheme)
154+ )
155+ )
156+ }
157+ }
158+
144159 fun themeDragHandleView (dragHandleView : BottomSheetDragHandleView ) {
145160 withScheme(dragHandleView) { scheme ->
146161 dragHandleView.imageTintList = ColorStateList .valueOf(dynamicColor.onSurfaceVariant().getArgb(scheme))
@@ -293,17 +308,26 @@ class MaterialViewThemeUtils
293308 - android.R .attr.state_pressed to dynamicColor.onPrimary().getArgb(scheme)
294309 )
295310
311+ colorMaterialButtonContent(button)
312+ }
313+ }
314+
315+ fun colorMaterialButtonContent (
316+ button : MaterialButton ,
317+ colorRole : ColorRole = ColorRole .PRIMARY
318+ ) {
319+ withScheme(button) { scheme ->
296320 val contentColorList =
297321 buildColorStateList(
298- android.R .attr.state_enabled to dynamicColor.primary().getArgb (scheme),
322+ android.R .attr.state_enabled to colorRole.select (scheme),
299323 - android.R .attr.state_enabled to
300324 colorUtil.adjustOpacity(
301- dynamicColor.primary().getArgb (scheme),
325+ colorRole.select (scheme),
302326 ON_SURFACE_OPACITY_BUTTON_DISABLED
303327 ),
304- - android.R .attr.state_hovered to dynamicColor.primary().getArgb (scheme),
305- - android.R .attr.state_focused to dynamicColor.primary().getArgb (scheme),
306- - android.R .attr.state_pressed to dynamicColor.primary().getArgb (scheme)
328+ - android.R .attr.state_hovered to colorRole.select (scheme),
329+ - android.R .attr.state_focused to colorRole.select (scheme),
330+ - android.R .attr.state_pressed to colorRole.select (scheme)
307331 )
308332
309333 button.setTextColor(
0 commit comments