Skip to content

Commit 12a136c

Browse files
pekingmeleticiarossi
authored andcommitted
[NavRail] Migrated to new token sets.
PiperOrigin-RevId: 749147576
1 parent e980f60 commit 12a136c

File tree

6 files changed

+83
-58
lines changed

6 files changed

+83
-58
lines changed

lib/java/com/google/android/material/navigationrail/res/color/m3_navigation_rail_item_with_indicator_icon_tint.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
~ limitations under the License.
1616
-->
1717
<selector xmlns:android="http://schemas.android.com/apk/res/android">
18-
<item android:color="@macro/m3_comp_navigation_rail_active_icon_color" android:state_checked="true"/>
19-
<item android:color="@macro/m3_comp_navigation_rail_inactive_icon_color"/>
18+
<item android:color="@macro/m3_comp_nav_rail_item_active_icon_color" android:state_checked="true"/>
19+
<item android:color="@macro/m3_comp_nav_rail_item_inactive_icon_color"/>
2020
</selector>

lib/java/com/google/android/material/navigationrail/res/color/m3_navigation_rail_item_with_indicator_label_tint.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
~ limitations under the License.
1616
-->
1717
<selector xmlns:android="http://schemas.android.com/apk/res/android">
18-
<item android:color="@macro/m3_comp_navigation_rail_active_label_text_color" android:state_checked="true"/>
19-
<item android:color="@macro/m3_comp_navigation_rail_inactive_label_text_color"/>
18+
<item android:color="?attr/colorOnSurface" android:state_checked="true"/>
19+
<item android:color="?attr/colorOnSurfaceVariant"/>
2020
</selector>

lib/java/com/google/android/material/navigationrail/res/color/m3_navigation_rail_ripple_color_selector.xml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,26 @@
1717
<selector xmlns:android="http://schemas.android.com/apk/res/android">
1818

1919
<!-- Selected. -->
20-
<item android:alpha="@dimen/m3_comp_navigation_rail_pressed_state_layer_opacity" android:color="@macro/m3_comp_navigation_rail_active_pressed_state_layer_color" android:state_pressed="true" android:state_selected="true"/>
21-
<item android:alpha="@dimen/m3_comp_navigation_rail_focus_state_layer_opacity" android:color="@macro/m3_comp_navigation_rail_active_focus_state_layer_color" android:state_focused="true" android:state_selected="true"/>
22-
<item android:alpha="@dimen/m3_comp_navigation_rail_hover_state_layer_opacity" android:color="@macro/m3_comp_navigation_rail_active_hover_state_layer_color" android:state_hovered="true" android:state_selected="true"/>
20+
<item android:alpha="@dimen/m3_comp_nav_rail_item_active_pressed_state_layer_opacity"
21+
android:color="?attr/colorOnSurface"
22+
android:state_pressed="true" android:state_selected="true"/>
23+
<item android:alpha="@dimen/m3_comp_nav_rail_item_active_focused_state_layer_opacity"
24+
android:color="?attr/colorOnSurface"
25+
android:state_focused="true" android:state_selected="true"/>
26+
<item android:alpha="@dimen/m3_comp_nav_rail_item_active_hovered_state_layer_opacity"
27+
android:color="?attr/colorOnSurface"
28+
android:state_hovered="true" android:state_selected="true"/>
2329

2430
<!-- Unselected. -->
25-
<item android:alpha="@dimen/m3_comp_navigation_rail_pressed_state_layer_opacity" android:color="@macro/m3_comp_navigation_rail_inactive_pressed_state_layer_color" android:state_pressed="true"/>
26-
<item android:alpha="@dimen/m3_comp_navigation_rail_focus_state_layer_opacity" android:color="@macro/m3_comp_navigation_rail_inactive_focus_state_layer_color" android:state_focused="true"/>
27-
<item android:alpha="@dimen/m3_comp_navigation_rail_hover_state_layer_opacity" android:color="@macro/m3_comp_navigation_rail_inactive_hover_state_layer_color" android:state_hovered="true"/>
31+
<item android:alpha="@dimen/m3_comp_nav_rail_item_active_pressed_state_layer_opacity"
32+
android:color="?attr/colorOnSurface"
33+
android:state_pressed="true"/>
34+
<item android:alpha="@dimen/m3_comp_nav_rail_item_active_focused_state_layer_opacity"
35+
android:color="?attr/colorOnSurface"
36+
android:state_focused="true"/>
37+
<item android:alpha="@dimen/m3_comp_nav_rail_item_active_hovered_state_layer_opacity"
38+
android:color="?attr/colorOnSurface"
39+
android:state_hovered="true"/>
2840
<item android:color="@android:color/transparent"/>
2941
</selector>
3042

lib/java/com/google/android/material/navigationrail/res/values/dimens.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
<dimen name="mtrl_navigation_rail_icon_margin">14dp</dimen>
2727
<dimen name="mtrl_navigation_rail_text_bottom_margin">16dp</dimen>
2828

29-
<dimen name="m3_navigation_rail_elevation">@dimen/m3_comp_navigation_rail_container_elevation</dimen>
30-
<dimen name="m3_navigation_rail_icon_size">@dimen/m3_comp_navigation_rail_icon_size</dimen>
31-
<dimen name="m3_navigation_rail_default_width">@dimen/m3_comp_navigation_rail_container_width</dimen>
29+
<dimen name="m3_navigation_rail_elevation">@dimen/m3_comp_nav_rail_collapsed_container_elevation</dimen>
30+
<dimen name="m3_navigation_rail_icon_size">@dimen/m3_comp_nav_rail_item_icon_size</dimen>
31+
<dimen name="m3_navigation_rail_default_width">@dimen/m3_comp_nav_rail_collapsed_narrow_container_width</dimen>
3232
<dimen name="m3_navigation_rail_item_min_height">60dp</dimen>
3333
<dimen name="m3_navigation_rail_item_padding_top">4dp</dimen>
3434
<dimen name="m3_navigation_rail_item_padding_top_with_large_font">12dp</dimen>
35-
<dimen name="m3_navigation_rail_item_padding_bottom_with_large_font">20dp</dimen>
3635
<dimen name="m3_navigation_rail_item_padding_bottom">12dp</dimen>
37-
<dimen name="m3_navigation_rail_item_active_indicator_width">@dimen/m3_comp_navigation_rail_active_indicator_width</dimen>
38-
<dimen name="m3_navigation_rail_item_active_indicator_height">@dimen/m3_comp_navigation_rail_active_indicator_height</dimen>
36+
<dimen name="m3_navigation_rail_item_padding_bottom_with_large_font">20dp</dimen>
37+
<dimen name="m3_navigation_rail_item_active_indicator_width">@dimen/m3_comp_nav_rail_item_vertical_active_indicator_width</dimen>
38+
<dimen name="m3_navigation_rail_item_active_indicator_height">@dimen/m3_comp_nav_rail_item_vertical_active_indicator_height</dimen>
3939
<dimen name="m3_navigation_rail_item_active_indicator_margin_horizontal">4dp</dimen>
4040
<dimen name="m3_navigation_rail_label_padding_horizontal">2dp</dimen>
4141
<dimen name="m3_navigation_rail_icon_label_padding">4dp</dimen>

lib/java/com/google/android/material/navigationrail/res/values/styles.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@
1919
<!-- Styles for M3 NavigationRailView. -->
2020

2121
<style name="Widget.Material3.NavigationRailView" parent="Widget.MaterialComponents.NavigationRailView">
22-
<item name="android:minWidth">@dimen/m3_navigation_rail_default_width</item>
23-
<item name="android:background">@macro/m3_comp_navigation_rail_container_color</item>
22+
<item name="android:minWidth">@dimen/m3_comp_nav_rail_collapsed_narrow_container_width</item>
23+
<item name="android:background">@macro/m3_comp_nav_rail_collapsed_container_color</item>
2424
<item name="backgroundTint">@null</item>
25-
<item name="elevation">@dimen/m3_navigation_rail_elevation</item>
26-
<item name="shapeAppearance">@style/ShapeAppearance.M3.Comp.NavigationRail.Container.Shape</item>
25+
<item name="elevation">@dimen/m3_comp_nav_rail_collapsed_container_elevation</item>
26+
<item name="shapeAppearance">@style/ShapeAppearance.M3.Comp.NavRail.Collapsed.Container.Shape</item>
2727
<item name="itemActiveIndicatorStyle">@style/Widget.Material3.NavigationRailView.ActiveIndicator</item>
2828
<item name="itemRippleColor">@color/m3_navigation_rail_ripple_color_selector</item>
29-
<item name="itemIconSize">@dimen/m3_comp_navigation_rail_icon_size</item>
29+
<item name="itemIconSize">@dimen/m3_comp_nav_rail_item_icon_size</item>
3030
<item name="itemIconTint">@color/m3_navigation_rail_item_with_indicator_icon_tint</item>
3131
<item name="itemTextColor">@color/m3_navigation_rail_item_with_indicator_label_tint</item>
3232
<item name="itemPaddingTop">@dimen/m3_navigation_rail_item_padding_top</item>
3333
<item name="itemPaddingBottom">@dimen/m3_navigation_rail_item_padding_bottom</item>
3434
<item name="itemMinHeight">@dimen/m3_navigation_rail_item_min_height</item>
35-
<item name="itemTextAppearanceInactive">@macro/m3_comp_navigation_rail_label_text_type</item>
36-
<item name="itemTextAppearanceActive">@macro/m3_comp_navigation_rail_label_text_type</item>
35+
<item name="itemTextAppearanceInactive">@macro/m3_comp_nav_rail_item_vertical_label_text_font</item>
36+
<item name="itemTextAppearanceActive">@macro/m3_comp_nav_rail_item_vertical_label_text_font</item>
3737
<item name="materialThemeOverlay">@style/ThemeOverlay.Material3.NavigationRailView</item>
3838
<item name="activeIndicatorLabelPadding">@dimen/m3_navigation_rail_icon_label_padding</item>
3939
<item name="iconLabelHorizontalSpacing">@dimen/m3_navigation_rail_icon_label_horizontal_padding</item>
4040
</style>
4141

4242
<style name="Widget.Material3.NavigationRailView.ActiveIndicator" parent="">
43-
<item name="android:width">@dimen/m3_navigation_rail_item_active_indicator_width</item>
44-
<item name="android:height">@dimen/m3_navigation_rail_item_active_indicator_height</item>
43+
<item name="android:width">@dimen/m3_comp_nav_rail_item_vertical_active_indicator_width</item>
44+
<item name="android:height">@dimen/m3_comp_nav_rail_item_vertical_active_indicator_height</item>
4545
<item name="marginHorizontal">@dimen/m3_navigation_rail_item_active_indicator_margin_horizontal</item>
46-
<item name="shapeAppearance">@style/ShapeAppearance.M3.Comp.NavigationRail.ActiveIndicator.Shape</item>
47-
<item name="android:color">@macro/m3_comp_navigation_rail_active_indicator_color</item>
46+
<item name="shapeAppearance">@style/ShapeAppearance.M3.Comp.NavRail.Item.ActiveIndicator.Shape</item>
47+
<item name="android:color">@macro/m3_comp_nav_rail_item_active_indicator_color</item>
4848
<item name="expandedWidth">wrap_content</item>
4949
<item name="expandedHeight">@dimen/m3_navigation_rail_expanded_active_indicator_height</item>
5050
<item name="expandedMarginHorizontal">@dimen/m3_navigation_rail_expanded_leading_trailing_space</item>

lib/java/com/google/android/material/navigationrail/res/values/tokens.xml

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,49 @@
1919

2020
<resources>
2121

22-
<!-- Generated from token set (md.comp.navigation-rail) in context (platform=android, audience=3p). -->
23-
<!-- Group: [Deprecated] Enabled - [Deprecated] Container -->
24-
<macro name="m3_comp_navigation_rail_container_color">?attr/colorSurface</macro>
25-
<style name="ShapeAppearance.M3.Comp.NavigationRail.Container.Shape" parent="ShapeAppearance.M3.Sys.Shape.Corner.None"/>
26-
<dimen name="m3_comp_navigation_rail_container_width">80dp</dimen>
27-
<dimen name="m3_comp_navigation_rail_container_elevation">@dimen/m3_sys_elevation_level0</dimen>
28-
<!-- Group: [Deprecated] Enabled - [Deprecated] Label text -->
29-
<macro name="m3_comp_navigation_rail_label_text_type">?attr/textAppearanceLabelMedium</macro>
30-
<macro name="m3_comp_navigation_rail_active_label_text_color">?attr/colorOnSurface</macro>
31-
<macro name="m3_comp_navigation_rail_inactive_label_text_color">?attr/colorOnSurfaceVariant</macro>
32-
<!-- Group: [Deprecated] Enabled - [Deprecated] Icon -->
33-
<dimen name="m3_comp_navigation_rail_icon_size">24dp</dimen>
34-
<macro name="m3_comp_navigation_rail_active_icon_color">?attr/colorOnSecondaryContainer</macro>
35-
<macro name="m3_comp_navigation_rail_inactive_icon_color">?attr/colorOnSurfaceVariant</macro>
36-
<!-- Group: [Deprecated] Enabled - [Deprecated] Active indicator -->
37-
<macro name="m3_comp_navigation_rail_active_indicator_color">?attr/colorSecondaryContainer</macro>
38-
<dimen name="m3_comp_navigation_rail_active_indicator_height">32dp</dimen>
39-
<style name="ShapeAppearance.M3.Comp.NavigationRail.ActiveIndicator.Shape" parent="ShapeAppearance.M3.Sys.Shape.Corner.Full"/>
40-
<dimen name="m3_comp_navigation_rail_active_indicator_width">56dp</dimen>
41-
<!-- Group: [Deprecated] Hovered - [Deprecated] State layer -->
42-
<macro name="m3_comp_navigation_rail_active_hover_state_layer_color">?attr/colorOnSurface</macro>
43-
<macro name="m3_comp_navigation_rail_inactive_hover_state_layer_color">?attr/colorOnSurface</macro>
44-
<dimen name="m3_comp_navigation_rail_hover_state_layer_opacity">@dimen/m3_sys_state_hover_state_layer_opacity</dimen>
45-
<!-- Group: [Deprecated] Focused - [Deprecated] State layer -->
46-
<macro name="m3_comp_navigation_rail_active_focus_state_layer_color">?attr/colorOnSurface</macro>
47-
<macro name="m3_comp_navigation_rail_inactive_focus_state_layer_color">?attr/colorOnSurface</macro>
48-
<dimen name="m3_comp_navigation_rail_focus_state_layer_opacity">@dimen/m3_sys_state_focus_state_layer_opacity</dimen>
49-
<!-- Group: [Deprecated] Pressed (ripple) - [Deprecated] State layer -->
50-
<macro name="m3_comp_navigation_rail_active_pressed_state_layer_color">?attr/colorOnSurface</macro>
51-
<macro name="m3_comp_navigation_rail_inactive_pressed_state_layer_color">?attr/colorOnSurface</macro>
52-
<dimen name="m3_comp_navigation_rail_pressed_state_layer_opacity">@dimen/m3_sys_state_pressed_state_layer_opacity</dimen>
22+
<!-- Generated from token set (md.comp.nav-rail) in context (platform=android, audience=3p). -->
23+
<!-- Group: Enabled -->
24+
<macro name="m3_comp_nav_rail_item_active_indicator_color">?attr/colorSecondaryContainer</macro>
25+
<macro name="m3_comp_nav_rail_item_active_label_text_color">?attr/colorSecondary</macro>
26+
<macro name="m3_comp_nav_rail_item_inactive_label_text_color">?attr/colorOnSurfaceVariant</macro>
27+
<macro name="m3_comp_nav_rail_item_active_icon_color">?attr/colorOnSecondaryContainer</macro>
28+
<macro name="m3_comp_nav_rail_item_inactive_icon_color">?attr/colorOnSurfaceVariant</macro>
29+
<!-- Group: Hovered -->
30+
<macro name="m3_comp_nav_rail_item_active_hovered_state_layer_color">?attr/colorOnSecondaryContainer</macro>
31+
<dimen name="m3_comp_nav_rail_item_active_hovered_state_layer_opacity">@dimen/m3_sys_state_hover_state_layer_opacity</dimen>
32+
<macro name="m3_comp_nav_rail_item_inactive_hovered_state_layer_color">?attr/colorOnSecondaryContainer</macro>
33+
<!-- Group: Focused -->
34+
<macro name="m3_comp_nav_rail_item_active_focused_state_layer_color">?attr/colorOnSecondaryContainer</macro>
35+
<dimen name="m3_comp_nav_rail_item_active_focused_state_layer_opacity">@dimen/m3_sys_state_focus_state_layer_opacity</dimen>
36+
<macro name="m3_comp_nav_rail_item_inactive_focused_state_layer_color">?attr/colorOnSecondaryContainer</macro>
37+
<!-- Group: Pressed -->
38+
<macro name="m3_comp_nav_rail_item_active_pressed_state_layer_color">?attr/colorOnSecondaryContainer</macro>
39+
<dimen name="m3_comp_nav_rail_item_active_pressed_state_layer_opacity">@dimen/m3_sys_state_pressed_state_layer_opacity</dimen>
40+
<macro name="m3_comp_nav_rail_item_inactive_pressed_state_layer_color">?attr/colorOnSecondaryContainer</macro>
41+
42+
<!-- Generated from token set (md.comp.nav-rail.collapsed) in context (platform=android, audience=3p). -->
43+
<dimen name="m3_comp_nav_rail_collapsed_container_width">96dp</dimen>
44+
<dimen name="m3_comp_nav_rail_collapsed_narrow_container_width">80dp</dimen>
45+
<dimen name="m3_comp_nav_rail_collapsed_container_elevation">@dimen/m3_sys_elevation_level0</dimen>
46+
<style name="ShapeAppearance.M3.Comp.NavRail.Collapsed.Container.Shape" parent="ShapeAppearance.M3.Sys.Shape.Corner.None"/>
47+
<macro name="m3_comp_nav_rail_collapsed_container_color">?attr/colorSurface</macro>
48+
<dimen name="m3_comp_nav_rail_collapsed_item_vertical_space">4dp</dimen>
49+
<dimen name="m3_comp_nav_rail_collapsed_top_space">44dp</dimen>
50+
51+
<!-- Generated from token set (md.comp.nav-rail.item) in context (platform=android, audience=3p). -->
52+
<dimen name="m3_comp_nav_rail_item_icon_size">24dp</dimen>
53+
<style name="ShapeAppearance.M3.Comp.NavRail.Item.ActiveIndicator.Shape" parent="ShapeAppearance.M3.Sys.Shape.Corner.Full"/>
54+
<dimen name="m3_comp_nav_rail_item_container_height">64dp</dimen>
55+
<dimen name="m3_comp_nav_rail_item_short_container_height">56dp</dimen>
56+
<dimen name="m3_comp_nav_rail_item_container_vertical_space">6dp</dimen>
57+
<dimen name="m3_comp_nav_rail_item_header_space_minimum">40dp</dimen>
58+
59+
<!-- Generated from token set (md.comp.nav-rail.item.vertical) in context (platform=android, audience=3p). -->
60+
<dimen name="m3_comp_nav_rail_item_vertical_active_indicator_height">32dp</dimen>
61+
<dimen name="m3_comp_nav_rail_item_vertical_active_indicator_width">56dp</dimen>
62+
<macro name="m3_comp_nav_rail_item_vertical_label_text_font">?attr/textAppearanceLabelMedium</macro>
63+
<dimen name="m3_comp_nav_rail_item_vertical_icon_label_space">4dp</dimen>
64+
<dimen name="m3_comp_nav_rail_item_vertical_leading_space">16dp</dimen>
65+
<dimen name="m3_comp_nav_rail_item_vertical_trailing_space">16dp</dimen>
5366

5467
</resources>

0 commit comments

Comments
 (0)