30 Commits

Author SHA1 Message Date
Material Design Team
dcd9898640 [DatePicker] Cache isFullscreen state in MaterialCalendar
PiperOrigin-RevId: 836142198
2025-11-24 12:44:22 -08:00
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
787ad71352 [Date Picker][A11y] Replace deprecated announcement API with accessibility pane title
PiperOrigin-RevId: 771083111
2025-06-18 14:13:04 +00:00
Material Design Team
91e6a97a58 [DatePicker][A11y] Replace the deprecated announcement API used for month navigation
PiperOrigin-RevId: 760547908
2025-05-19 14:34:27 +00:00
Material Design Team
39dd3a4235 [DatePicker][A11y] Fix accessibility focus landing on first day of month after year selection
After selecting a year, accessibility focus now correctly returns to the calendar/year selection button instead of jumping to the first day of the month. Also disabled RecyclerView animations when TalkBack is enabled to prevent incorrect date announcements during transitions.

PiperOrigin-RevId: 745964584
2025-04-17 23:55:05 +00:00
Material Design Team
41f507977e [MaterialDatePicker] Fix DatePicker to use correct accessibility description for calendar/year view toggle button.
Change TalkBack announcement from
'month year. Tap to switch to year/calendar view. Double tap to activate'
to
'month year. Double tap to switch to year/calendar view'

PiperOrigin-RevId: 740445584
2025-03-26 16:18:47 +00:00
Material Design Team
71287c67dd [MaterialDatePicker][A11y] Disable next/prev button when the selected month is at the boundary
When user clicks on previous/next month button, the button will be disabled if the clicked month is at the boundary.

PiperOrigin-RevId: 738309727
2025-03-19 18:25:59 +00:00
pfthomas
c06ef1bc86 [DatePicker][a11y] Properly announce the change of selection between year/day
PiperOrigin-RevId: 675901350
2024-09-19 19:46:56 +00:00
Ga\u00ebtan Muller
b3fe6a7f61 [Cleanup] Remove redundant version checks for api <= 19.
Resolves https://github.com/material-components/material-components-android/pull/3849

GIT_ORIGIN_REV_ID=47bb2fcc8031740e5a7d4f741f1ada2af025e126
PiperOrigin-RevId: 632154861
2024-05-09 18:46:02 +00:00
pfthomas
c484ea7da2 [MaterialCalendar] Fix NPE
PiperOrigin-RevId: 502984835
2023-01-19 17:52:32 +00:00
pfthomas
dff70c062d [MaterialDatePicker][a11y] Improve TalkBack focus order when selecting a day
Make RecyclerView non-scrollable to allow focusing away from it instead of paginating to previous/next month.

PiperOrigin-RevId: 486936286
2022-11-09 22:14:37 +00:00
pubiqq
51b605412a [MaterialDatePicker] Hide month pagination from the year picker
Resolves https://github.com/material-components/material-components-android/pull/2875

GIT_ORIGIN_REV_ID=b8c071d568282f16f8d9b498f2bbcba11be800db
PiperOrigin-RevId: 465055372
2022-08-04 14:33:29 -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
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
conradchen
62e89933d6 [DatePicker] Fix wrong month title with certain months
The issue is caused by failing to correctly take the daylight saving time into account - internally we use UTC time to represent dates, however when generating month titles we try to calculate the time difference of the UTC time and the local time, which can result in off-by-one errors when the first day of the month is also the first day of the daylight saving time, e.g., April 1, 1979 in Poland.

Fixes this by always using UTC time to generate month titles. Also clears the relevant implementation for a little bit since context is actually not required when we only need to format years and months.

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

PiperOrigin-RevId: 413505587
2021-12-01 19:08:56 -05:00
Material Design Team
a487c89185 Internal change
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00: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
dniz
90929ee274 [MaterialDatePicker] Fixed overzealous smooth scrolling when horizontally swiping between months
Resolves https://github.com/material-components/material-components-android/issues/920

PiperOrigin-RevId: 337879242
2020-10-19 11:43:33 -07:00
dniz
98c7cd15ee [DatePicker] Fixed formatting of year month date pattern for year selection dropdown
PiperOrigin-RevId: 334616659
2020-09-30 17:00:29 -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
marianomartin
33733bd331 Remove {@link Month}`s from javadocs
PiperOrigin-RevId: 292335010
2020-01-31 11:11:22 -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
Nikita
b575fc78dd Improve scroll behavior of MaterialCalendar on low end devices
Resolves https://github.com/material-components/material-components-android/pull/711

GIT_ORIGIN_REV_ID=7808f83d1c4de45711aae4c5f1740506b5484c1c
PiperOrigin-RevId: 277201251
2019-11-01 13:28:40 -07:00
marianomartin
167663ae45 Internal cleanup
PiperOrigin-RevId: 268698913
2019-09-12 14:29:01 -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
ldjesper
72d54c653c Change picker package to com.google.android.material.datepicker
PiperOrigin-RevId: 267004501
2019-09-04 18:07:59 -04:00