157 Commits

Author SHA1 Message Date
rightnao
a601107868 [MaterialButton] Add methods to not toggle checked state on buttons on click
Resolves https://github.com/material-components/material-components-android/issues/2291

PiperOrigin-RevId: 453569861
2022-06-07 18:53:01 -07:00
raajkumars
467a2c9f73 [Button] Updated M3 button style to add outlined icon button style. Updated catalog to showcase the same.
PiperOrigin-RevId: 448118229
2022-05-12 17:17:21 -04:00
raajkumars
14578ed68c [Button] Updated M3 button style to add filled tonal icon button style. Updated catalog to showcase the same.
PiperOrigin-RevId: 447784383
2022-05-10 15:05:30 -04:00
raajkumars
25606cf34a [Button] Updated M3 button style to add filled icon button style. Updated catalog to showcase the same.
PiperOrigin-RevId: 447523530
2022-05-09 15:00:34 -04:00
conradchen
363e2b1708 [Button] Always update drawable state when background changed
In certain situations drawable states won't be correctly propagated to the background drawable wrapped in a LayerDrawable during setting view background. Always explicitly updates the drawable state to fix the issue.

Resolves https://github.com/material-components/material-components-android/issues/2670

PiperOrigin-RevId: 446786432
2022-05-06 12:13:07 -04:00
raajkumars
402bdf4bbe [Button] Added materialIconButtonStyle attribute and updated M3 doc to document icon (only) button style and attribute.
PiperOrigin-RevId: 446487810
2022-05-04 18:27:31 -04:00
conradchen
1d3bb00de2 [Button] Migrated shape appearance to new shape system.
PiperOrigin-RevId: 446183150
2022-05-03 12:53:54 -04:00
conradchen
45b99f603e [Button] Fix the issue that button state is not updated
On Lollipop, when first assigned as View's background, RippleDrawable won't/can't propagate states to its content drawable. This causes the issue that the state relevant features like stroke colors are not correctly updated when the background is recreated. Explicitly assigns states to the content drawable to fix the issue.

Resolves https://github.com/material-components/material-components-android/issues/1422

PiperOrigin-RevId: 442676637
2022-04-19 10:57:43 -04:00
conradchen
b6b895a1e4 [Button] Fix icon textStart/End alignment with multiline text
When calculating text width to decide the icon position with textStart/End alignment, we missed accounting for multiline text. Fixes this by calculating each line's width separately and take the widest one to decide the icon position.

Resolves https://github.com/material-components/material-components-android/issues/2007

PiperOrigin-RevId: 440982189
2022-04-11 17:13:57 -04:00
conradchen
19d05000bc [Button] Fix icon position with multiline text
When the icon gravity is textTop, we are using the smaller one of the calculated height from text paint and the text layout height to decide the icon position. This is wrong when there are multiple lines of text since the text paint is always single line and always shorter than the actual height.

Fixes this by returning the actual layout height whenever there are multiple lines of text to fix the issue.

Resolves https://github.com/material-components/material-components-android/issues/2619

PiperOrigin-RevId: 440923733
2022-04-11 15:12:33 -04:00
conradchen
b0f37007aa [Button] Fix icon position not being updated when size is not changed
If a button has a WRAP_CONTENT width and after its text is updated but its size does not change, the icon position won't be updated because at the moment when onTextChanged() is called, getLayout() will return null and a new layout to display text will only be recreated in the next onMeasure() call.

To fix this issue, the change moves updateIconPosition() from onSizeChanged() to onLayout(), which will always be called after onMeasure() or onSizeChanged() is called, and thus covers both of the cases after the text is updated (the button changes its size or not.)

Note: we still need to keep the updateIconPosition() call in onTextChanged(), to cover the case that the button has a fixed width, in which updating text won't trigger remeasuring of the button.

Resolves https://github.com/material-components/material-components-android/issues/2553

PiperOrigin-RevId: 427215840
2022-02-09 15:56:11 +00:00
dsn5ft
96fa85e216 [MaterialButtonToggleGroup] Removed getAccessibilityClassName() override since TalkBack doesn't recognize the class name, in favor of getting identified as a generic list container
PiperOrigin-RevId: 423814546
2022-01-24 15:47:55 -05:00
conradchen
6c41f070e8 [Button] Support icon gravity with text alignments other than centered
Resolves https://github.com/material-components/material-components-android/issues/1371

PiperOrigin-RevId: 421605261
2022-01-18 12:02:02 -05:00
conradchen
3db25be3b6 [ButtonGroup] Simplify MaterialButtonToggleGroup's checking logic
1. Consolidates single selected ID and multiple selected IDs to a single selected
   ID set.
2. Separates View states and internal checked states so we can focus and enforce
   policies much easier on only internal states.

PiperOrigin-RevId: 420087718
2022-01-06 15:44:19 -05:00
conradchen
a17af6ee04 Automated g4 rollback of changelist 418054400
PiperOrigin-RevId: 418062580
2021-12-28 11:44:12 -05:00
conradchen
747bcf25ff [ButtonGroup] Simplify MaterialButtonTogglerGroup's checking logic
1. Consolidates single selected ID and multiple selected IDs to a single selected
   ID set.
2. Separates View states and internal checked states so we can focus and enforce
   policies much easier on only internal states.

Resolves https://github.com/material-components/material-components-android/issues/2263

PiperOrigin-RevId: 418054400
2021-12-28 08:55:31 -05:00
conradchen
672e7440f9 [M3][Dialog] Fix dialog paddings
We missed to include top/bottom insets of button styles into dialog action margin calculation. Also the paddings between titles and messages were not correct.

PiperOrigin-RevId: 417626927
2021-12-22 14:46:19 -05:00
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
pfthomas
3c9b45292d [M3][Button] Add missing attributes to M3 button styles
PiperOrigin-RevId: 411585842
2021-11-29 17:29:47 +00:00
pfthomas
db64adb5fb [M3][Button] Update elevation to match specs
PiperOrigin-RevId: 411148215
2021-11-29 16:59:33 +00:00
pfthomas
f028380fb2 [M3][Button] Update padding to match specs
PiperOrigin-RevId: 410823046
2021-11-29 16:48:32 +00:00
dsn5ft
9ae56ceedd [Javadocs] Remove all broken attr links from Javadocs
PiperOrigin-RevId: 404246710
2021-10-20 19:06:18 +00:00
pekingme
9de9319b1e [Resources] Added styles in res-public.
PiperOrigin-RevId: 403451624
2021-10-18 15:31:13 -04:00
serniebanders
5844d3c134 [Button] Update icon state on Drawable state change.
Resolves: https://github.com/material-components/material-components-android/issues/2322

Follows pattern in View.drawableStateChanged() where drawable properties have states manually set.

PiperOrigin-RevId: 400754477
2021-10-05 09:04:56 -04:00
pfthomas
7729ad4dff [M3][Button] Update button res-public
PiperOrigin-RevId: 395994178
2021-09-16 09:54:19 -07:00
conradchen
fae2d9120f [M3][Snackbar] Remove redundant style settings
PiperOrigin-RevId: 395568908
2021-09-15 12:19:28 -07:00
conradchen
cf395d5729 [M3][Snackbar] Internal change
PiperOrigin-RevId: 395480037
2021-09-08 17:40:46 -04:00
Victor Cervantes
153fdee2f6 [MaterialButton] Material button lollipop shape fix
Resolves https://github.com/material-components/material-components-android/pull/2331
Resolves https://github.com/material-components/material-components-android/issues/1797

GIT_ORIGIN_REV_ID=cd176426395bf93f701c623c00947384aabf0706
PiperOrigin-RevId: 393405994
2021-08-27 17:29:19 -04:00
conradchen
2901012af5 [M3][DatePicker] Create M3 styles
PiperOrigin-RevId: 392982386
2021-08-26 14:43:23 -04:00
pfthomas
6bfa5842b9 [M3][Button] Create M3 styles
PiperOrigin-RevId: 392680177
2021-08-24 15:51:48 -04:00
conradchen
456f135627 [Button] Fix progress indicator is not shown when set as the icon
MaterialButton is using TextViewCompat.setCompoundDrawablesRelative() under the hood to implement setIcon() operation. TextViewCompat won't call its compound drawables' setVisible() method, on which we rely to start progress indicator drawables automatically.

Calls setVisible() explicitly to start progressing.

Also adds a demo to catalog.

Resolves https://github.com/material-components/material-components-android/issues/2095

PiperOrigin-RevId: 383483364
2021-07-08 15:58:13 +00:00
raajkumars
c5c7a74cef [MaterialButton] Updated Material Button style to set the preferred maximum width to 320dp.
PiperOrigin-RevId: 371151853
2021-04-29 14:53:13 -04:00
raajkumars
95da70589c [Catalog][Dialog] Removed full width button style and related dialog themes. Updated catalog dialog demo to showcase how to create dialogs with full width buttons.
PiperOrigin-RevId: 371146951
2021-04-29 14:52:19 -04:00
raajkumars
cd9e6204d8 [Dialog] Added support for full width buttons in dialogs.
PiperOrigin-RevId: 368853063
2021-04-16 18:21:25 -04:00
raajkumars
82333cf59d Internal change
PiperOrigin-RevId: 368487188
2021-04-16 17:46:18 -04:00
raajkumars
7939c171df [MaterialButton] Updated Material Button style to set the preferred maximum width to 320dp.
PiperOrigin-RevId: 368242141
2021-04-13 14:25:05 -04:00
Material Design Team
891d009058 Automated g4 rollback of changelist 367493781
PiperOrigin-RevId: 367522778
2021-04-08 21:29:13 -04:00
raajkumars
d61903470b [MaterialButton] Updated Material Button style to set the preferred maximum width to 320dp.
PiperOrigin-RevId: 367493781
2021-04-08 20:45:57 -04:00
marianomartin
ffb2ad14ff [MaterialButtonToggleGroup] Fixed issues with uncheck and check methods
This unifies the check handling logic so that calling check/uncheck is not treated differently than checking the buttons through touch input

Resolves https://github.com/material-components/material-components-android/issues/2133

PiperOrigin-RevId: 365077462
2021-03-25 14:50:26 -04:00
dniz
25bf03ea2a [Docs] Remove broken @link from MaterialButton Javadoc
PiperOrigin-RevId: 356506184
2021-02-17 06:40:30 -08:00
hunterstich
fe58a4c81e [Button] Updated custom background warning message to be more informative.
Resolves https://github.com/material-components/material-components-android/issues/1803

PiperOrigin-RevId: 337894750
2020-10-19 11:47:05 -07:00
Gabriele Mariotti
391d1f8ac5 [Snackbar] Changed dimens according to spec
Resolves https://github.com/material-components/material-components-android/pull/1711
Resolves https://github.com/material-components/material-components-android/issues/1721

GIT_ORIGIN_REV_ID=c039075b65833724b59ecdfde1ba70ed8ae5b8eb
Co-authored-by: pekingme <pekingme@gmail.com>
PiperOrigin-RevId: 333292492
2020-09-23 12:08:37 -07:00
Aidan Pieper
70d659db60 [MaterialButtonToggleGroup] Fixed margins on MaterialButtonToggleGroup when changing orientations
Resolves https://github.com/material-components/material-components-android/pull/1521

Co-authored-by: ymarian <38727469+ymarian@users.noreply.github.com>
GIT_ORIGIN_REV_ID=c87c9ec3258c52fd3e6e2824b8dca2823b9500a5
PiperOrigin-RevId: 323781705
2020-07-29 10:38:35 -04:00
marianomartin
f837cb76ab [MaterialButton] Support setting vertical insets programatically
Resolves https://github.com/material-components/material-components-android/issues/526

PiperOrigin-RevId: 323450357
2020-07-28 10:28:38 -04:00
marianomartin
049ad022a6 Delete components build.gradle files
PiperOrigin-RevId: 320944144
2020-07-15 09:38:31 -07:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
Rafael Wolf de Goes
b39845a452 Automated g4 rollback of changelist 314782767
PiperOrigin-RevId: 316867631
2020-06-17 18:40:38 -07:00
connieshi
15c048c0fa [MaterialButtonToggleGroup] Do not update the checked state of any child buttons during onPressedChanged callback.
Resolves https://github.com/material-components/material-components-android/issues/1365

PiperOrigin-RevId: 314798502
2020-06-05 14:51:21 -04:00
Rafael Wolf de Goes
1171418c2b Automated g4 rollback of changelist 314715132
PiperOrigin-RevId: 314782767
2020-06-05 14:49:43 -04:00