Skip to content

Commit

Permalink
[M3][SearchBar][SearchView] Renamed search style attributes to add "m…
Browse files Browse the repository at this point in the history
…aterial" prefix.

PiperOrigin-RevId: 490260853
  • Loading branch information
raajkumars authored and drchen committed Nov 22, 2022
1 parent b813b2b commit 978ffdf
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/components/Search.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Element | Style
----------------- | ------------------------------------------------
**Search Bar Default style** | `Widget.Material3.SearchBar`

Default search bar style theme attribute: `?attr/searchBarStyle`.
Default search bar style theme attribute: `?attr/materialSearchBarStyle`.

### Scrolling Behavior

Expand Down Expand Up @@ -217,7 +217,7 @@ Element | Style
----------------- | ------------------------------------------------
**Search View Default style** | `Widget.Material3.SearchView`

Default search view style theme attribute: `?attr/searchViewStyle`.
Default search view style theme attribute: `?attr/materialSearchViewStyle`.

### Expand and Collapse Animations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
<item name="navigationRailStyle">@style/Widget.Material3.NavigationRailView</item>
<item name="navigationViewStyle">@style/Widget.Material3.NavigationView</item>
<item name="radioButtonStyle">@style/Widget.Material3.CompoundButton.RadioButton</item>
<item name="searchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="searchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="materialSearchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="materialSearchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="sliderStyle">@style/Widget.Material3.Slider</item>
<item name="snackbarStyle">@style/Widget.Material3.Snackbar</item>
<item name="snackbarButtonStyle">@style/Widget.Material3.Button.TextButton.Snackbar</item>
Expand Down Expand Up @@ -365,8 +365,8 @@
<item name="navigationRailStyle">@style/Widget.Material3.NavigationRailView</item>
<item name="navigationViewStyle">@style/Widget.Material3.NavigationView</item>
<item name="radioButtonStyle">@style/Widget.Material3.CompoundButton.RadioButton</item>
<item name="searchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="searchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="materialSearchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="materialSearchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="sliderStyle">@style/Widget.Material3.Slider</item>
<item name="snackbarStyle">@style/Widget.Material3.Snackbar</item>
<item name="snackbarButtonStyle">@style/Widget.Material3.Button.TextButton.Snackbar</item>
Expand Down
2 changes: 1 addition & 1 deletion lib/java/com/google/android/material/search/SearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public SearchBar(@NonNull Context context) {
}

public SearchBar(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, R.attr.searchBarStyle);
this(context, attrs, R.attr.materialSearchBarStyle);
}

public SearchBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public SearchView(@NonNull Context context) {
}

public SearchView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, R.attr.searchViewStyle);
this(context, attrs, R.attr.materialSearchViewStyle);
}

public SearchView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

<!-- Definitions of attributes to be exposed as public -->
<resources>
<public name="searchBarStyle" type="attr"/>
<public name="searchViewStyle" type="attr"/>
<public name="searchViewPrefixStyle" type="attr"/>
<public name="materialSearchBarStyle" type="attr"/>
<public name="materialSearchViewStyle" type="attr"/>
<public name="materialSearchViewPrefixStyle" type="attr"/>
<public name="defaultMarginsEnabled" type="attr"/>
<public name="defaultScrollFlagsEnabled" type="attr"/>
<public name="hideNavigationIcon" type="attr"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<TextView
android:id="@+id/search_view_search_prefix"
style="?attr/searchViewPrefixStyle"
style="?attr/materialSearchViewPrefixStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<resources>

<!-- Style to use for SearchBars in this theme. -->
<attr name="searchBarStyle" format="reference"/>
<attr name="materialSearchBarStyle" format="reference"/>
<!-- Style to use for SearchViews in this theme. -->
<attr name="searchViewStyle" format="reference"/>
<attr name="materialSearchViewStyle" format="reference"/>
<!-- Style to use for SearchView prefixes in this theme. -->
<attr name="searchViewPrefixStyle" format="reference"/>
<attr name="materialSearchViewPrefixStyle" format="reference"/>
<!-- Attribute to use for hiding the navigation icon in search bar and search view. -->
<attr name="hideNavigationIcon" format="boolean"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
<item name="materialSwitchStyle">@style/Widget.Material3.CompoundButton.MaterialSwitch</item>
<item name="navigationRailStyle">@style/Widget.Material3.NavigationRailView</item>
<item name="navigationViewStyle">@style/Widget.Material3.NavigationView</item>
<item name="searchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="searchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="materialSearchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="materialSearchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="radioButtonStyle">@style/Widget.Material3.CompoundButton.RadioButton</item>
<item name="sliderStyle">@style/Widget.Material3.Slider</item>
<item name="snackbarStyle">@style/Widget.Material3.Snackbar</item>
Expand Down Expand Up @@ -382,8 +382,8 @@
<item name="materialSwitchStyle">@style/Widget.Material3.CompoundButton.MaterialSwitch</item>
<item name="navigationRailStyle">@style/Widget.Material3.NavigationRailView</item>
<item name="navigationViewStyle">@style/Widget.Material3.NavigationView</item>
<item name="searchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="searchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="materialSearchBarStyle">@style/Widget.Material3.SearchBar</item>
<item name="materialSearchViewStyle">@style/Widget.Material3.SearchView</item>
<item name="radioButtonStyle">@style/Widget.Material3.CompoundButton.RadioButton</item>
<item name="sliderStyle">@style/Widget.Material3.Slider</item>
<item name="snackbarStyle">@style/Widget.Material3.Snackbar</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ public class ThemeTest {
R.attr.materialCardViewElevatedStyle,
R.attr.materialSwitchStyle,
R.attr.radioButtonStyle,
R.attr.searchBarStyle,
R.attr.searchViewStyle,
R.attr.materialSearchBarStyle,
R.attr.materialSearchViewStyle,
R.attr.sliderStyle,
R.attr.snackbarStyle,
R.attr.snackbarButtonStyle,
Expand Down

0 comments on commit 978ffdf

Please sign in to comment.