From 25482b142510a2b30ab398f91edb0c07afdf896a Mon Sep 17 00:00:00 2001 From: pekingme <8545955+pekingme@users.noreply.github.com> Date: Fri, 3 Jun 2022 12:16:06 -0700 Subject: [PATCH] [FAB] Migrated "regular/default" sized styles to new shape system. PiperOrigin-RevId: 452817382 --- docs/components/FloatingActionButton.md | 37 +++++++++++-------- .../floatingactionbutton/res/values/attrs.xml | 2 +- .../res/values/dimens.xml | 1 - .../res/values/styles.xml | 9 ++++- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/docs/components/FloatingActionButton.md b/docs/components/FloatingActionButton.md index a6e01efa8b2..fc49578254f 100644 --- a/docs/components/FloatingActionButton.md +++ b/docs/components/FloatingActionButton.md @@ -78,21 +78,28 @@ extendedFab.shrink() ### Sizing FABs -The `FloatingActionButton` can be sized either by using the discrete sizing -modes, a custom size, or for the large FAB by applying the desired style. - -There are three `app:fabSize` modes: - -* `normal` - the normal sized button, 56dp. -* `mini` - the small sized button, 40dp. -* `auto` (default) - the button size will change based on the window size. For - small sized windows (largest screen dimension < 470dp) this will select a - small sized button, and for larger sized windows it will select a normal - sized button. - -Or, you can set a custom size via the `app:fabCustomSize` attribute. If set, -`app:fabSize` will be ignored, unless the custom size is cleared via the -`clearCustomSize` method. +The `FloatingActionButton` can be sized either by using `app:fabCustomSize` or +for the large/small FAB (M3 only) by applying the desired style. The +`app:fabSize` discrete size mode is deprecated in Material3 style. If the +`app:fabSize` is overridden in your FAB style, which inherits from one of these +styles: + +* `Widget.Material3.FloatingActionButton(.Large).Primary` +* `Widget.Material3.FloatingActionButton(.Large).Secondary` +* `Widget.Material3.FloatingActionButton(.Large).Tertiary` +* `Widget.Material3.FloatingActionButton(.Large).Surface` + +Please consider one of the following migration options: + +* If `normal` size is used, set the parent style to + `Widget.Material3.FloatingActionButton.{Color}` and remove `app:fabSize`. +* If `mini` size is used, set the parent style to + `Widget.Material3.FloatingActionButton.Small.{Color}` and remove + `app:fabSize`. +* If FAB size changes in runtime by either setting `fabSize` or + `fabCustomSize`, and relative sized corners are desired, set + `shapeAppearanceOverlay` as + `@style/ShapeAppearanceOverlay.Material3.FloatingActionButton` in the style. If you'd like to use the small FAB, apply one of these style attributes: diff --git a/lib/java/com/google/android/material/floatingactionbutton/res/values/attrs.xml b/lib/java/com/google/android/material/floatingactionbutton/res/values/attrs.xml index 3f831f5eca4..303b4ad98ad 100644 --- a/lib/java/com/google/android/material/floatingactionbutton/res/values/attrs.xml +++ b/lib/java/com/google/android/material/floatingactionbutton/res/values/attrs.xml @@ -25,7 +25,7 @@ - + diff --git a/lib/java/com/google/android/material/floatingactionbutton/res/values/dimens.xml b/lib/java/com/google/android/material/floatingactionbutton/res/values/dimens.xml index cca6f155c90..1fa9ba065c3 100644 --- a/lib/java/com/google/android/material/floatingactionbutton/res/values/dimens.xml +++ b/lib/java/com/google/android/material/floatingactionbutton/res/values/dimens.xml @@ -37,7 +37,6 @@ 20dp 24dp 12dp - 24dp 120dp 48dp 0dp diff --git a/lib/java/com/google/android/material/floatingactionbutton/res/values/styles.xml b/lib/java/com/google/android/material/floatingactionbutton/res/values/styles.xml index d3269a9759d..4fa61e2d1e7 100644 --- a/lib/java/com/google/android/material/floatingactionbutton/res/values/styles.xml +++ b/lib/java/com/google/android/material/floatingactionbutton/res/values/styles.xml @@ -111,7 +111,8 @@ @dimen/m3_fab_translation_z_hovered_focused @dimen/m3_fab_translation_z_pressed @color/m3_button_ripple_color_selector - @style/ShapeAppearanceOverlay.Material3.FloatingActionButton + ?attr/shapeAppearanceCornerLarge + @null @color/m3_button_foreground_color_selector @null @@ -242,6 +243,12 @@ + +