Skip to content

Commit

Permalink
[Badge] Integrated component tokens.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 490569205
  • Loading branch information
pekingme authored and drchen committed Nov 28, 2022
1 parent 2f7a700 commit 03bd77f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

<!-- M3 Badge -->
<style name="Widget.Material3.Badge" parent="Widget.MaterialComponents.Badge">
<item name="backgroundColor">@macro/m3_comp_badge_color</item>
<!-- Badge "dot" without text -->
<item name="badgeRadius">@dimen/m3_badge_radius</item>
<item name="horizontalOffset">@dimen/m3_badge_horizontal_offset</item>
Expand Down
26 changes: 26 additions & 0 deletions lib/java/com/google/android/material/badge/res/values/tokens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- AUTOGENERATED FILE. DO NOT MODIFY. -->
<!-- Version: v0.141 -->

<resources>

<!-- Generated from token set (md.comp.badge) in context (platform=android, audience=3p). -->
<!-- Enabled - Container -->
<macro name="m3_comp_badge_color">?attr/colorError</macro>

</resources>
15 changes: 15 additions & 0 deletions token_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,21 @@ conversion_tasks:
- md.comp.plain-tooltip.supporting-text.color
# TODO(b/260002910) Current style uses "Full" shape as the shape appearance.
- md.comp.plain-tooltip.container.shape
- # Badge component tokens.
token_sets: md.comp.badge
files:
- {input: tokens.jinja2, output: badge/res/values/tokens.xml}
suppressed_tokens:
# TODO(b/260151426) Token defines shape appearance, implementation defines shape radius.
- md.comp.badge.shape
- md.comp.badge.large.shape
# TODO(b/260151426) Token defines size, implementation defines shape radius by assuming it's always a circle.
- md.comp.badge.size
- md.comp.badge.large.size
# TODO(b/260151426) Assuming color doesn't change for different sizes.
- md.comp.badge.large.color
# TODO(b/260151426) Text appearance is not styleable. The current text appearance is shared between M2 and M3.
- md.comp.badge.large.label-text.(color|type|weight|tracking|size|line-height|font)

metadata:
# md.sys.shape.corner.extra-small
Expand Down

0 comments on commit 03bd77f

Please sign in to comment.