24 Commits

Author SHA1 Message Date
Material Design Team
757f9f3db1 [DatePicker][A11y] Fix TAB keyboard trap and add DPAD month navigation.
This change fixes a keyboard trap in MaterialDatePicker where the TAB key focus was stuck within the month grid. TAB navigation is now limited to the days within the current month, allowing focus to move out of the picker.

For navigating between months, this change introduces DPAD (left/right arrow key) navigation. When on the first or last valid day of the month, the arrow keys will navigate to the previous or next month.

This CL also prevents keyboard focus from landing on disabled dates. Since GridView does not natively support skipping disabled items, custom logic has been added to find and focus on the nearest valid day during keyboard navigation.

Finally, a bug that caused focus to incorrectly jump to a previous, non-visible month during TAB navigation has been fixed. This was caused by RecyclerView's view-recycling mechanism. The solution ensures that only the currently visible month is focusable, preventing focus from moving to off-screen months.

PiperOrigin-RevId: 834271529
2025-11-19 08:41:58 -08:00
Material Design Team
a207114c60 [DatePicker] Add MonthAdapter helpers for finding enabled days
This change introduces helper methods to `MonthAdapter` to allow callers to identify days that are enabled according to the `CalendarConstraints`.

PiperOrigin-RevId: 826466043
2025-10-31 21:09:45 +00:00
pfthomas
29b59c21f5 [MaterialDatePicker] Add getTextColor to DayViewDecorator
PiperOrigin-RevId: 527265648
2023-04-26 16:19:16 -04: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
2f9844b34a [MaterialDatePicker][a11y] Announce start/end dates
PiperOrigin-RevId: 481152229
2022-10-17 20:00:14 +00:00
pfthomas
c6539f2390 [MaterialDatePicker][a11y] Announce current year and day
PiperOrigin-RevId: 479303709
2022-10-06 17:53:53 +00:00
pfthomas
be8b8d44de [MaterialDatePicker][a11y] Announce selection
PiperOrigin-RevId: 478026835
2022-10-03 19:13:28 +00:00
pfthomas
7bc5689789 [MaterialDatePicker] Add method to specify a content description to decorated views
PiperOrigin-RevId: 474622363
2022-09-16 13:56:02 -04:00
dsn5ft
24201b4246 [MaterialDatePicker] Add ability to customize background color to DayViewDecorator
Resolves https://github.com/material-components/material-components-android/issues/2881

PiperOrigin-RevId: 464841873
2022-08-04 14:32:40 -04: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
pfthomas
85c40a6a51 [MaterialDatePicker] Internal change
PiperOrigin-RevId: 448042520
2022-05-11 15:00:27 -04:00
pfthomas
1ad4682fee Automated g4 rollback of changelist 437775591
PiperOrigin-RevId: 442829220
2022-04-19 12:39:30 -04:00
jeremymuhia
ffb64c1643 [DatePicker] expand the touch area of a month's days
PiperOrigin-RevId: 437775591
2022-03-30 15:11:10 +00:00
raajkumars
a1ec73beb8 [MaterialDatePicker] Fix for issue that causes the month view not to expand to show all days in a month.
Resolves https://github.com/material-components/material-components-android/issues/1676

PiperOrigin-RevId: 436812359
2022-03-28 15:56:44 +00:00
hunterstich
db42490dde [DatePicker] Fixed incorrect date being selected on scrollable months.
Resolves https://github.com/material-components/material-components-android/issues/1973

PiperOrigin-RevId: 351396382
2021-01-12 18:37:48 -05:00
Mika
00e33202a5 [DatePicker] Fix NullPointerException on MonthAdapter.updateSelectedState(MonthAda…
Resolves https://github.com/material-components/material-components-android/pull/1944
Resolves https://github.com/material-components/material-components-android/issues/1943

GIT_ORIGIN_REV_ID=d02d6307ea08ea505ea6535ce909e7d1b268847b
PiperOrigin-RevId: 350783859
2021-01-08 13:50:58 -05:00
marianomartin
3e79942871 [DatePicker] Localized numbers in month
Resolves https://github.com/material-components/material-components-android/issues/1948

PiperOrigin-RevId: 350567674
2021-01-07 12:10:44 -05:00
dniz
8f455c0b90 [DatePicker] Fixed issue where default selection date would visually stay selected when choosing different date
PiperOrigin-RevId: 334167845
2020-09-28 11:49:51 -07:00
Material Design Team
b12c5c5b00 [DatePicker] Speed up calendar performance by only updating certain views when a day is clicked, instead of recreating and redrawing all of them.
PiperOrigin-RevId: 325850735
2020-08-11 14:39:26 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -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
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
ldjesper
38e01beb1d MaterialDatePicker forces UTC
PiperOrigin-RevId: 267992416
2019-09-12 13:52:21 -04:00
ldjesper
72d54c653c Change picker package to com.google.android.material.datepicker
PiperOrigin-RevId: 267004501
2019-09-04 18:07:59 -04:00