117 Commits

Author SHA1 Message Date
pfthomas
be8e4e2d9a [MaterialDatePicker] Improve error formatting
PiperOrigin-RevId: 459495629
2022-07-07 12:30:40 -07:00
pfthomas
91a2550afd [DatePicker] Migrate to new shape system
PiperOrigin-RevId: 448057183
2022-05-12 17:15:26 -04:00
pfthomas
85c40a6a51 [MaterialDatePicker] Internal change
PiperOrigin-RevId: 448042520
2022-05-11 15:00:27 -04:00
pubiqq
5d6678cc66 [MaterialDatePicker] Hide the keyboard when switching to calendar mode
Resolves https://github.com/material-components/material-components-android/pull/2688
Resolves https://github.com/material-components/material-components-android/issues/2687

GIT_ORIGIN_REV_ID=686526aa049eadb08ded72ca9eb0b60027358756
PiperOrigin-RevId: 447819486
2022-05-11 09:41:38 -04:00
dsn5ft
8c775cb418 [i18n][Date/Time Picker] Update date and time picker translation strings
Resolves https://github.com/material-components/material-components-android/issues/2655
Resolves https://github.com/material-components/material-components-android/pull/2656

PiperOrigin-RevId: 445930808
2022-05-02 11:44:04 -04:00
pubiqq
7109aa4b8b [i18n][Date/Time Picker] Use regular strings instead of @android:string/* which can have translation issues
Resolves https://github.com/material-components/material-components-android/issues/2655
Resolves https://github.com/material-components/material-components-android/pull/2656

PiperOrigin-RevId: 444574063
2022-04-26 12:02:43 -04:00
conradchen
431e291b01 [Translation] Update string translations
PiperOrigin-RevId: 443191056
2022-04-20 17:19:02 -04:00
pfthomas
1ad4682fee Automated g4 rollback of changelist 437775591
PiperOrigin-RevId: 442829220
2022-04-19 12:39:30 -04:00
pfthomas
c23daec8b1 [MaterialDatePicker][a11y] Make picker header focusable to improve TalkBack response
PiperOrigin-RevId: 440375456
2022-04-11 11:13:40 -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
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
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
pfthomas
94cd532bd1 [DatePicker] Start align edit icon in landscape
PiperOrigin-RevId: 426402283
2022-02-04 13:43:51 -08:00
conradchen
e7bc947cd5 [DatePicker] Replace fragment container with FragmentContainerView
As suggested in https://developer.android.com/reference/androidx/fragment/app/FragmentContainerView

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

PiperOrigin-RevId: 416323969
2021-12-14 14:54:29 -05: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
conradchen
fba1a341c3 [M3][DatePicker] Fix M3 date picker styles
Some attributes were wrongly added to the styles. We need to remove them to make the color correct.

PiperOrigin-RevId: 409241943
2021-11-16 12:33:57 -05:00
leticiars
9b5356f2fe [DatePicker] Wrapped text fields from range picker selection in a ScrollView so their heights don't change in landscape mode.
PiperOrigin-RevId: 408333813
2021-11-10 15:57:22 -05: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
dsn5ft
9ae56ceedd [Javadocs] Remove all broken attr links from Javadocs
PiperOrigin-RevId: 404246710
2021-10-20 19:06:18 +00:00
conradchen
cde684ab42 [DatePicker][TimePicker] Replace confirm button strings
On certain Android devices it seems the framework string @android:string/ok is not available. Replaces the usage of the strings with Material specific strings.

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

PiperOrigin-RevId: 400814492
2021-10-05 09:05:36 -04:00
conradchen
ca09b7b04b [M3][DatePicker] Fix month naviation button alignment
With MaterialButton, if we want an icon to be center aligned when there's no text, we need to set icon padding to 0dp and icon gravity to text-start or text-end. Updates the M3 style to make the icon center aligned.

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

PiperOrigin-RevId: 400242967
2021-10-04 20:20:19 +00:00
conradchen
6626eed5c1 [M3][DatePicker] Update date picker dev doc with M3 themes/styles
Also adds missed text appearance attribute.

PiperOrigin-RevId: 396396263
2021-09-16 11:33:23 -07:00
conradchen
83e73de6b8 [M3][DatePicker] Update date picker title typography
PiperOrigin-RevId: 396385304
2021-09-16 11:32:42 -07: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
2901012af5 [M3][DatePicker] Create M3 styles
PiperOrigin-RevId: 392982386
2021-08-26 14:43:23 -04:00
dsn5ft
5d940f1ff8 [M3][Catalog] Update Catalog theme(s) to Material3 and fix Material3 date/time picker theme overlays
PiperOrigin-RevId: 391581833
2021-08-23 09:17:02 -07:00
dsn5ft
57e3bc02fa [i18n] Updated some string translations for date picker, time picker, and text field
PiperOrigin-RevId: 389899697
2021-08-10 21:08:28 -07:00
pfthomas
47868d884e [DatePicker] Date selector hint incorrectly localized
PiperOrigin-RevId: 387066584
2021-07-29 14:28:10 -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
conradchen
281688a2f2 [DatePicker] Fix DatePicker crashes and and potential issue of range selection
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
2021-06-15 21:56:07 -07:00
conradchen
37f0ca1a97 [MaterialDatePicker] Make calendar day of week label stying more flexible
PiperOrigin-RevId: 372976792
2021-05-11 12:56:55 -04:00
haodong
0d0c90b9ef Updated string translations.
PiperOrigin-RevId: 354978993
2021-02-01 11:03:44 -08: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
marianomartin
bec2de92ac [DatePicker] Fixed day of week adapter localization for APIs before O
Resolves https://github.com/material-components/material-components-android/issues/1948

PiperOrigin-RevId: 350474335
2021-01-07 12:06:34 -05:00
hunterstich
6ad8301fb6 [I18n] Update string translations
PiperOrigin-RevId: 340622036
2020-11-04 11:22:36 -05: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
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
d82742695c [DatePicker] Update header title strings to match spec
PiperOrigin-RevId: 334794175
2020-10-01 11:27:11 -04: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
dniz
af375eb31a [DatePicker] Added string translations for i18n / l10n
Resolves https://github.com/material-components/material-components-android/issues/761
Resolves https://github.com/material-components/material-components-android/issues/868
Resolves https://github.com/material-components/material-components-android/issues/1216
Resolves https://github.com/material-components/material-components-android/issues/1353
Resolves https://github.com/material-components/material-components-android/issues/1764

PiperOrigin-RevId: 334440771
2020-09-29 16:39:24 -04:00
dniz
2f9c2b0491 [Cleanup] Fix formatting of copyrights in xml
PiperOrigin-RevId: 334423264
2020-09-29 16:34:51 -04: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
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
ea763862b4 [MaterialDatePicker] Fixed the filled range with RTL layout
Resolves https://github.com/material-components/material-components-android/pull/1731

GIT_ORIGIN_REV_ID=6be1c14b2f4a93d180ffe1f760cec5f277f03613
PiperOrigin-RevId: 332245028
2020-09-17 11:10:37 -07:00