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
GridView used to display days in months can be scrolled when there are more rows
than the space can contain. Usually this happens when a month spans over 6 rows. In this case, the position of the day in a month will not be the same as its corresponding view position in the grid view. This can cause:
1. Wrong day view being highlighted.
2. Crashes due to out-of-bound index. (The day position can be larger than view
counts due to invisible days.)
PiperOrigin-RevId: 379382943
- 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