162 Commits

Author SHA1 Message Date
Felipe Roriz
4ccb052d2b [MaterialDatePicker] Added a DateValidator for a bounded range.
Resolves https://github.com/material-components/material-components-android/pull/972

GIT_ORIGIN_REV_ID=29cbbd569f5284f0bdf4cc1bdad60f93f92856eb

Co-authored-by: ymarian <38727469+ymarian@users.noreply.github.com>
PiperOrigin-RevId: 295810824
2020-02-18 18:03:44 -05:00
cketcham
1bc4f60d81 Handle single tap for Slider in scrollable container
PiperOrigin-RevId: 295160709
2020-02-14 17:13:07 -05:00
onats1
89e0e5628e [Date Picker] Created a date validator class to handle resctrictions from previous dates until the current date.
Resolves https://github.com/material-components/material-components-android/pull/946

GIT_ORIGIN_REV_ID=442df27d6bd2d7c01de471328ba3a44eff82660d

Co-authored-by: ymarian <38727469+ymarian@users.noreply.github.com>
PiperOrigin-RevId: 294982034
2020-02-13 13:57:28 -08:00
cketcham
767915868d Fix Slider rounding error caused by floats
PiperOrigin-RevId: 294686381
2020-02-13 10:24:03 -05:00
cketcham
340cdea60d Add a11y support to Slider
This includes support for Range slider when there is more than one thumb. Each thumb can receive focus and behaves as if it was it's own SeekBar.

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

PiperOrigin-RevId: 294681995
2020-02-13 10:23:18 -05:00
isabellekim
55200c3a8f Fix ExtendedFloatingActionButton to be WRAP_CONTENT when extended so that it will resizes on setText().
Resolves https://github.com/material-components/material-components-android/issues/449

PiperOrigin-RevId: 294261399
2020-02-10 17:29:35 -05:00
cketcham
9de1c97979 Add RTL support for Slider
PiperOrigin-RevId: 294114681
2020-02-10 10:01:30 -05:00
Guillermo Mazzola
7ef37a05dd [BottomSheetBehavior] Resolving behavior_expandedOffset as a dimen
Using an integer will remain allowed, however using a dimen will be preferred.

Resolves https://github.com/material-components/material-components-android/pull/836

GIT_ORIGIN_REV_ID=4a02d95855569a076e5ee7a682ea5e8c9988eab9
PiperOrigin-RevId: 293623878
2020-02-06 17:25:57 -05:00
cketcham
4c99e53db4 Add support for D pad and keyboard control for Slider
This adds support for selecting an active thumb as well as changing the value of the currently selected thumb.

https://github.com/material-components/material-components-android/issues/827

PiperOrigin-RevId: 293008598
2020-02-04 17:30:25 -05:00
Material Design Team
77ad9c3855 Migrate static imports of org.mockito.Matchers to org.mockito.ArgumentMatchers
The former is deprecated and replaced by the latter in Mockito 2.

PiperOrigin-RevId: 292563187
2020-01-31 13:48:10 -05:00
cketcham
99932525e9 Improve handling of touch input for Slider with multiple thumbs
This changes the logic of picking the correct thumb on touch down. The closest thumb will be picked unless there are two thumbs in the same spot. In that case it will wait for enough movement in the x direction to determine which thumb to pick.

PiperOrigin-RevId: 292353858
2020-01-31 11:13:06 -05:00
marianomartin
e56b141dd5 [MaterialButtonToggleGroup] SelectionRequired attribute doesn`t enforce checkedButtonId to be a valid id (returns -1)
Resolves https://github.com/material-components/material-components-android/issues/956

PiperOrigin-RevId: 292334820
2020-01-31 11:10:08 -05:00
cketcham
a6e28bef76 Add support for multiple Slider thumbs
Resolves https://github.com/material-components/material-components-android/issues/916

PiperOrigin-RevId: 292135289
2020-01-29 16:14:10 -05:00
marianomartin
401b99e099 [Chip] Double emission on check state change when selectionRequired is used
Resolves https://github.com/material-components/material-components-android/issues/952

PiperOrigin-RevId: 291922419
2020-01-28 16:11:38 -05:00
cketcham
9e4ff3009f Refactor handling of the thumb position to prepare for multiple thumb support
PiperOrigin-RevId: 289482135
2020-01-13 15:05:21 -08:00
haodong
fa4dc3d038 Fixed crash with NullPointerException when set value before laid out in Slider.
PiperOrigin-RevId: 288945151
2020-01-10 09:07:35 -08:00
Material Design Team
253cdc2114 Add CollectionInfos and CollectionItemInfos to ChipGroup and Chip for accessibility.
PiperOrigin-RevId: 288944549
2020-01-10 09:05:36 -08:00
haodong
9bbcd2d7ae Fixed no OnChangeListener fires when value changed with single click.
Fixed set same values triggering listener.

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

PiperOrigin-RevId: 288608132
2020-01-08 11:57:33 -08:00
Material Design Team
4389a18128 Add CollectionInfos and CollectionItemInfos to MaterialButtonToggleGroup and MaterialButton for accessibility.
PiperOrigin-RevId: 286922716
2019-12-23 15:43:46 -05:00
marianomartin
d49fff38ef Add a StaticLayoutCompat class that supports Max Lines
PiperOrigin-RevId: 286223820
2019-12-18 15:56:04 -05:00
cketcham
282250136c Fix test failures caused by the @Config annotation overriding the application theme
It looks like there's no guarantee that the context defined on the Application will be used by the Activity, so it's better to set the theme on the Activity itself.

PiperOrigin-RevId: 285241791
2019-12-12 16:09:02 -05:00
haodong
6694175a5f Fixed getDayCopy utility function in UtcDates for DatePicker.
- was copying year/month/date fields between Calendar objects in different time zones.
- convert input Calendar object into a Calendar object in UTC, then copy year/month/date fields to the return Calendar object.

PiperOrigin-RevId: 284597830
2019-12-10 07:22:59 -05:00
connieshi
186884701d Call themeApplicationContext inside createToggleGroupWithButtons because the order of @Before method calls is not deterministic.
PiperOrigin-RevId: 284244654
2019-12-10 07:18:55 -05:00
Zhaonian Luan
be8fb0f1ff [MaterialButtonToggleGroup] Clean up
Resolves https://github.com/material-components/material-components-android/pull/796

Co-authored-by: wcshi <38438920+wcshi@users.noreply.github.com>

GIT_ORIGIN_REV_ID=77f2471c1fbd9b44a8df1d252a41d582ddcbee0f
PiperOrigin-RevId: 284044596
2019-12-08 14:18:17 -05:00
haodong
77ce281f04 Fixed MaterialDatePicker todayInUtcMilliseconds method.
- Used UtcDates to return the UTC milliseconds of today in local timezone.
- Previous method is replaced with thisMonthInUtcMilliseconds, which fits its function better.
Resolves https://github.com/material-components/material-components-android/issues/778

PiperOrigin-RevId: 283981946
2019-12-05 15:58:26 -05:00
marianomartin
58190deb21 [Slider] Cannot set stepSize < 1.0
Resolves https://github.com/material-components/material-components-android/issues/704

PiperOrigin-RevId: 282783034
2019-12-02 17:31:47 -05:00
marianomartin
a4b90321e3 Add selection required option to MaterialButtonToggleGroup
Setting selectionRequired = true. Makes it so that the last option on the Group cannot be unselected. Similar to how a Text Alignment toggle works.

PiperOrigin-RevId: 281366158
2019-11-20 14:36:15 -05:00
marianomartin
573efa4b2f Add selection required option to ChipGroup
Resolves https://github.com/material-components/material-components-android/issues/651

PiperOrigin-RevId: 281274404
2019-11-19 10:31:43 -08:00
dniz
7f043206c0 Update ElevationOverlayProvider compositeOverlay() to preserve original background color alpha
PiperOrigin-RevId: 278625128
2019-11-06 10:17:01 -05:00
haodong
7708ca4db1 Automated g4 rollback of changelist 277103254
PiperOrigin-RevId: 277545348
2019-11-01 13:28:40 -07:00
haodong
5db6b5f2f8 Automated g4 rollback of changelist 275944003
PiperOrigin-RevId: 277103254
2019-11-01 13:28:40 -07:00
marianomartin
9fc1377755 [MaterialButtonToggleGroup] Fix corners after changing view visibility
People might want to set some of the buttons to GONE, this cl makes sure
the shape appearances remain coherent after doing so dynamically.

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

PiperOrigin-RevId: 276508915
2019-11-01 13:28:40 -07:00
haodong
8c8eaac2b1 Automated g4 rollback of changelist 275859720
PiperOrigin-RevId: 275944003
2019-11-01 13:28:40 -07:00
haodong
69e399f9c4 Updated TextInputLayout to support empty string as error message.
PiperOrigin-RevId: 275859720
2019-11-01 13:28:40 -07:00
cketcham
786ee8ba87 Fix failing test by adding AppCompat theme
PiperOrigin-RevId: 275535752
2019-11-01 13:28:40 -07:00
Chaoyang0201
632675e1a8 [BadgeDrawable] add horizontal and vertical offset to control position
Resolves https://github.com/material-components/material-components-android/pull/638
Resolves https://github.com/material-components/material-components-android/issues/630

Co-authored-by: wcshi <connieshi@google.com>

GIT_ORIGIN_REV_ID=511c955a11e05fdc0848c74938c4c194da22826e
PiperOrigin-RevId: 275522709
2019-11-01 13:28:23 -07:00
marianomartin
115313c0c0 Expose a class for themeoverlay in style
This moves functionality from ThemeEnforcement into a stand alone class.

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

PiperOrigin-RevId: 275481343
2019-10-21 10:24:19 -04:00
raajkumars
b72c7e7818 Updated MaterialTextView unit tests to use AppCompat theme.
PiperOrigin-RevId: 275034760
2019-10-21 10:23:35 -04:00
Mattia Pagini
a05b3a5c79 [ChipGroup] Added a method to get the selected ids
Resolves https://github.com/material-components/material-components-android/pull/667

GIT_ORIGIN_REV_ID=185fec8087c2a9c7186a2565330c797dd994dfb8
PiperOrigin-RevId: 274013304
2019-10-10 15:54:45 -04:00
marianomartin
24ab59af6c Support orientation VERTICAL in MaterialButtonToggleGroup
Resolves https://github.com/material-components/material-components-android/issues/476

PiperOrigin-RevId: 273514626
2019-10-08 10:35:08 -04:00
marianomartin
a405dd9664 Change MaterialButtonToggleGroup to extend LinearLayout
PiperOrigin-RevId: 272989081
2019-10-04 20:39:01 -04:00
ldjesper
294f12498d Rename setCornerRadius to setAllCornerSizes
PiperOrigin-RevId: 272959729
2019-10-04 20:08:43 -04:00
cketcham
0547d2a06b Uncouple CornerSize from CornerTreatment
This allows for more easily updating the CornerSize independently from the CornerTreatment and makes it possible to create different types of CornerSizes such as percentage based corners. However, this means corner sizes can be different depending on the bounds of the shape, so the bounds need to be provided. MaterialShapeDrawable has bounds and the ShapeAppearanceModel, so there are new convenience methods there which return the current corner size for the current bounds of the drawable.

PiperOrigin-RevId: 272908508
2019-10-04 15:23:16 -04:00
Sam
a610215b77 [MaterialButton] Fixed issue 531 by removing unnecessary calls to set compound drawables
Resolves https://github.com/material-components/material-components-android/pull/589

GIT_ORIGIN_REV_ID=3f167e1a3f5a369fc3bfda152f28b80c3cb25181
PiperOrigin-RevId: 270331104
2019-09-24 12:17:58 -04:00
dniz
bcd8a55e30 Update ElevationOverlayProvider overlayView parameter to be @NonNull
PiperOrigin-RevId: 269364084
2019-09-18 14:16:49 -04:00
connieshi
a6106e12b2 When a chip's close icon is purely decorative (i.e. no onCloseIconClickLisetener is set), avoid setting custom accessibility delegate.
PiperOrigin-RevId: 268904579
2019-09-18 14:03:37 -04:00
marianomartin
a4138293df Internal cleanup
PiperOrigin-RevId: 268507643
2019-09-12 14:12:53 -04:00
connieshi
d4d0e7f5e9 Update badge gravity enum values to use Gravity values. Add unit test.
PiperOrigin-RevId: 268485092
2019-09-12 14:09:30 -04:00
ldjesper
d78d93577f Remove Month from the public API
PiperOrigin-RevId: 268242042
2019-09-12 13:57:19 -04:00
ldjesper
38e01beb1d MaterialDatePicker forces UTC
PiperOrigin-RevId: 267992416
2019-09-12 13:52:21 -04:00