53 Commits

Author SHA1 Message Date
Material Design Team
f843ab0f1f [Date Picker] Avoid re-creating text input picker fragment on configuration changes
Addresses an issue where the input text view was losing entered text and cursor position during configuration changes.

PiperOrigin-RevId: 769580976
2025-06-10 19:32:18 +00:00
pubiqq
bc2fdeadaf [Internal] Prefer platform methods to compat ones
Resolves https://github.com/material-components/material-components-android/pull/4532

GIT_ORIGIN_REV_ID=180dec736f2521579e483317a4d537629d8f247b
PiperOrigin-RevId: 715494344
2025-01-15 18:06:07 +00:00
leticiars
8932a81ea4 [DatePicker] Update header layout to include horizontal insets so that buttons are not overlapped by navigation system UI in fullscreen mode.
Resolves https://github.com/material-components/material-components-android/issues/3956

PiperOrigin-RevId: 675552238
2024-09-19 15:01:06 +00:00
pfthomas
6617342f03 [DatePicker] Make picker not final and expose onPositiveButtonClick and onNegativeButtonClick
Resolves https://github.com/material-components/material-components-android/issues/1688

PiperOrigin-RevId: 651106986
2024-07-10 19:26:51 +00:00
pubiqq
510881a469 [Internal] Stop using deprecated androidx.core.view.* methods
Resolves https://github.com/material-components/material-components-android/pull/4117

GIT_ORIGIN_REV_ID=dd157e8360c2511810496693cec1616fce578655
PiperOrigin-RevId: 632284856
2024-05-13 17:37:38 +00:00
hunterstich
a00ee50907 [DatePicker] Added builder methods for customizing the positive and negative button content descriptions
Resolves https://github.com/material-components/material-components-android/issues/3595

PiperOrigin-RevId: 572929926
2023-10-12 11:05:22 -07:00
rightnao
e3b255b3a0 [Docs] Crosslink github docs in javadocs
PiperOrigin-RevId: 546393704
2023-07-11 19:37:37 +00:00
pfthomas
4d8043453e [MaterialDatePicker] Allow client app to access user selected inputMode
Resolves https://github.com/material-components/material-components-android/pull/3414

PiperOrigin-RevId: 539713099
2023-06-14 15:13:51 +00:00
pfthomas
f4d0f5653a [MaterialDatePicker] a11y/i18n alignment
Resolves https://github.com/material-components/material-components-android/issues/3343

PiperOrigin-RevId: 526657661
2023-04-24 15:30:28 -04:00
pekingme
7b2c19b273 [DatePicker] Made dialog container color configurable in xml style.
PiperOrigin-RevId: 520113790
2023-03-29 19:04:50 +00:00
pfthomas
2cef555994 [MaterialDatePicker] Fix NPE
PiperOrigin-RevId: 504263005
2023-01-24 17:03:54 +00:00
pfthomas
cd5246f49e [MaterialDatePicker][a11y] Improve date input validation feedback follow up
PiperOrigin-RevId: 498167309
2022-12-29 00:21:20 -05:00
pfthomas
e1688f3d19 [MaterialDatePicker][a11y] Improve date input validation feedback
Resolves https://github.com/material-components/material-components-android/issues/2223

Add `TextInputLayout.setErrorAccessibilityLiveRegion` and `TextInputLayout.getErrorAccessibilityLiveRegion` to allow controlling the way the TextInputLayout error is announced.

Example:

```
textInputLayout.setErrorAccessibilityLiveRegion(ViewCompat.ACCESSIBILITY_LIVE_REGION_NONE);
```

PiperOrigin-RevId: 497323465
2022-12-29 00:19:00 -05:00
hunterstich
276c1171b0 [DatePicker] Exposed method to set a custom formatter for text input fields.
Resolves https://github.com/material-components/material-components-android/issues/3039

PiperOrigin-RevId: 485128314
2022-11-01 05:23:20 -07:00
pfthomas
5c5b1e8258 [MaterialDatePicker][a11y] Improve date selection announcements
- improve selection announcement for both single and range date selectors
- properly announce start date when partially selected range

PiperOrigin-RevId: 482581175
2022-10-21 16:27:31 +00:00
pfthomas
32f111817f [MaterialDatePicker] Enable auto-sizing of the date selection text
PiperOrigin-RevId: 481169899
2022-10-17 20:01:10 +00:00
Material Design Team
44cc9b745c Add @CanIgnoreReturnValue to some APIs that return this.
PiperOrigin-RevId: 468721442
2022-08-22 15:22:27 -04:00
dsn5ft
be650c4f57 [MaterialDatePicker] Add initialize() method to DayViewDecorator to better support configuration changes
Fixes an issue where compound drawables using resource qualifiers like -land will have the wrong value on rotation

PiperOrigin-RevId: 466776776
2022-08-11 12:52:12 -04:00
dsn5ft
debe22e397 [MaterialDatePicker] Refactor header styling to allow for multiline title with description text
PiperOrigin-RevId: 465538100
2022-08-05 20:02:57 +00:00
dsn5ft
bca0f2ea8e [MaterialDatePicker] Add support for decorating day views and a demo for circle indicators
Resolves https://github.com/material-components/material-components-android/issues/2854

PiperOrigin-RevId: 463608089
2022-07-28 17:39:54 -04:00
conradchen
c6a654c7dd [DatePicker] Fix edge-to-edge mode being applied multiple times
When the date picker goes back from background to foreground, the onStart() method will be called and make enableEdgeToEdge() be called again. This will make it incorrectly use the header height and top padding already adjusted with system inset as the original height and padding, and thus add the inset multiple times.

Creates a flag to only enable edge-to-edge once to fix the issue.

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

PiperOrigin-RevId: 440110562
2022-04-07 11:44:38 -04:00
conradchen
be6050a23c [DatePicker] Always go edge-to-edge in fullscreen mode
Resolves https://github.com/material-components/material-components-android/issues/1966

PiperOrigin-RevId: 432296692
2022-03-04 13:06:17 -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
Gabriele Mariotti
b2fbacecd4 [MaterialDatePicker] added methods to use custom text for positive and negative button
Resolves https://github.com/material-components/material-components-android/pull/1607

GIT_ORIGIN_REV_ID=75093200ddeae117ae57a3e89e28d109f520ec8d
PiperOrigin-RevId: 407376627
2021-11-04 10:53:04 -04:00
Orthae
8fda897e1d [MaterialDatePicker] Fix excessive whitespace
Resolves https://github.com/material-components/material-components-android/pull/2162
Resolves https://github.com/material-components/material-components-android/issues/2161

GIT_ORIGIN_REV_ID=9d272c4563f354bedcb0342957ebb2207bceecdf
PiperOrigin-RevId: 394235301
2021-09-01 17:06:14 -04:00
conradchen
cb5d622f13 [DatePicker] Avoid NPE caused by getSelection() before created
Resolves https://github.com/material-components/material-components-android/issues/2169

PiperOrigin-RevId: 381325077
2021-06-28 13:00:18 -07:00
conradchen
eb7b11478b [DatePicker] Fix opening at the selected date in the end month
When the selected date is in the end month, the UTC timestamp of it
will be larger than the end month's, which cause us incorrectly
treat the selected date as invalid.

Fixes the logic by consistently use Month as the time unit to do
comparison.

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

PiperOrigin-RevId: 381280448
2021-06-28 12:56:36 -07:00
Material Design Team
ffcf70adde [DatePicker] Changes to allow the MaterialCalendar to exist inside a scrollable view.
PiperOrigin-RevId: 336952059
2020-10-15 13:23:12 -07:00
dniz
5507687b19 [DatePicker] Updated default selection-based openAt logic to consider valid calendar constraints
Fixes crash where default selection is outside of calendar constraints bounds. With this commit, in that case we now show the default selection date in the header, but the user can still only choose a new date within the constraints.

Follow-up to:
- https://github.com/material-components/material-components-android/pull/1651
- https://github.com/material-components/material-components-android/issues/1199

PiperOrigin-RevId: 332455279
2020-09-18 14:02:24 -07:00
Gabriele Mariotti
193ce2dc48 [DatePicker] Changed openAt to default based on selection, if not provided
Resolves https://github.com/material-components/material-components-android/pull/1651

GIT_ORIGIN_REV_ID=09bf7a4ddb3cba2e55efaab45f09765e7910544b
PiperOrigin-RevId: 330938479
2020-09-10 11:15:59 -04:00
Material Design Team
431e092649 [DatePicker] Made some MaterialCalendar related methods/classes public, but still restricted.
PiperOrigin-RevId: 326494150
2020-08-13 16:53:54 -04:00
dniz
5bd64f42d3 [DatePicker] Updated text input mode to respect custom theme res id
Resolves https://github.com/material-components/material-components-android/issues/966

PiperOrigin-RevId: 322809365
2020-07-27 13:17:42 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
dniz
7965098849 [MaterialDatePicker] Disable positive button when invalid or incomplete dates are selected
Resolves https://github.com/material-components/material-components-android/issues/1270
Resolves https://github.com/material-components/material-components-android/pull/1271

PiperOrigin-RevId: 313390751
2020-05-27 13:59:38 -04:00
dniz
0bdb2cbdbd [MaterialDatePicker] Make customDatePicker method public but restricted for now
PiperOrigin-RevId: 312495780
2020-05-20 17:11:37 -04:00
dniz
d854e78d54 [MaterialDatePicker] Hide customDatePicker method since DateSelector API is not exposed yet. We will consider exposing this method and the DateSelector APIs in 1.3.
PiperOrigin-RevId: 312332065
2020-05-19 18:49:32 -04:00
raajkumars
2023df01b3 Renamed Month.today() to Month.current() to make it obvious that this method returns the first moment of the current month and not the first moment of the current day.
PiperOrigin-RevId: 310417056
2020-05-08 14:43:12 -04:00
hunterstich
a265520e42 [MaterialDatePicker] Update datepicker drawable resources to use material_ prefix.
Resolves https://github.com/material-components/material-components-android/issues/1166

PiperOrigin-RevId: 305078908
2020-04-06 13:26:41 -07:00
Material Design Team
e6e9a07f4b Automated g4 rollback of changelist 305014223
PiperOrigin-RevId: 305017071
2020-04-06 12:47:42 -07:00
hunterstich
2ac7fb75df [MaterialDatePicker] Prefix drawables with mtrl_ to avoid client confliects.
Resolves https://github.com/material-components/material-components-android/issues/1166

PiperOrigin-RevId: 305014223
2020-04-06 12:34:43 -07:00
marianomartin
5706775bfd Expose customDatePicker so people don't have to limit to range or
single date.

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

PiperOrigin-RevId: 297875559
2020-02-28 15:12:40 -05:00
marianomartin
33733bd331 Remove {@link Month}`s from javadocs
PiperOrigin-RevId: 292335010
2020-01-31 11:11:22 -05:00
zkovar
0e6c21d3c0 [MaterialDatePicker] Ability to Start Picker in MaterialTextInputPicker Mode
Resolves https://github.com/material-components/material-components-android/pull/867
Resolves https://github.com/material-components/material-components-android/issues/865

GIT_ORIGIN_REV_ID=de3f50710c06d17331d366eb9b4d240ec205a1f8
Co-authored-by: pekingme <pekingme@gmail.com>
PiperOrigin-RevId: 289676795
2020-01-14 11:00:51 -08:00
dniz
4e0a016d07 Update MaterialDatePicker to read colorSurface from correct context
Fixes issue where colorSurface from materialCalendarTheme is ignored

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

PiperOrigin-RevId: 286194512
2019-12-18 15:55:09 -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
ldjesper
fe56e2ecc7 Allow setting of MaterialDatePicker title via CharSequence plus JavaDoc updates
PiperOrigin-RevId: 268445763
2019-09-12 14:03:01 -04:00
ldjesper
cdcccfbc5c Fix missing ok and cancel in landscape MaterialDatePicker
We make the middle pane scrollable in cases where things just will not fit

PiperOrigin-RevId: 268301091
2019-09-12 14:01:19 -04:00
ldjesper
54bf4cbb82 Fix NPE from MaterialDatePicker rotation when MaterialCalendar is not visible.
calendar.getCurrentMonth() is nullable so we check before accessing

PiperOrigin-RevId: 268290292
2019-09-12 14:00:30 -04:00
ldjesper
d78d93577f Remove Month from the public API
PiperOrigin-RevId: 268242042
2019-09-12 13:57:19 -04:00