Add MaterialComponents.DayNight to SearchBarStyle

When opening the Settings app or changing colors in ThemePicker
there are tons of warnings with UnsupportedOperationException in
the log. These logs are related to the
LayoutInflater attempting to inflate a MaterialCardView and
TypedArray#getColor where it expects the colors to be either an integer
color or a color state list. This happens every time you re-start
Settings.

To enable layout inflater finding colors for Settings we add a
MaterialComponents theme to SearchBarStyle, this makes sure that
TypedArray#getColor gets an integer color instead of relying on
framework to solve this.

Flag: NA
Bug: 363970601
Test: manual, open Settings and check the logs
Change-Id: I728c1537537bb4d32af6006800de93e64facfa8e
This commit is contained in:
Robin Vinterbladh
2024-09-03 12:29:54 +02:00
committed by Mattias Nilsson
parent ec571901be
commit dc419524c5

View File

@@ -455,11 +455,13 @@
</style>
<style name="SearchBarStyle">
<item name="android:theme">@style/Theme.MaterialComponents.DayNight</item>
<item name="cardCornerRadius">@dimen/search_bar_corner_radius</item>
<item name="cardElevation">0dp</item>
</style>
<style name="SearchBarStyle_v2">
<item name="android:theme">@style/Theme.MaterialComponents.DayNight</item>
<item name="cardCornerRadius">40dp</item>
<item name="cardElevation">0dp</item>
<item name="strokeWidth">1dp</item>