[TIMOB-28353] Android: Update Date/Time picker dialogs to use material theme
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-03-05T15:56:43.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 10.0.0 |
| Components | Android |
| Labels | DatePicker, android, breaking-change, dialog, material-theme, picker |
| Reporter | Joshua Quick |
| Assignee | Joshua Quick |
| Created | 2021-02-13T03:17:12.000+0000 |
| Updated | 2021-03-05T15:56:43.000+0000 |
Description
*Summary:*
We should replace our usage of the native Java [DatePickerDialog](https://developer.android.com/reference/android/app/DatePickerDialog) and [TimePickerDialog](https://developer.android.com/reference/android/app/TimePickerDialog) with the material [MaterialDatePicker](https://developer.android.com/reference/com/google/android/material/datepicker/MaterialDatePicker) and [MaterialTimePicker](https://developer.android.com/reference/com/google/android/material/timepicker/MaterialTimePicker) respectively.
https://material.io/components/date-pickers
https://material.io/components/time-pickers
This effects the following Titanium APIs:
* [Ti.UI.Picker.showDatePickerDialog()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Picker-method-showDatePickerDialog)
* [Ti.UI.Picker.showTimePickerDialog()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Picker-method-showTimePickerDialog)
*Date Dialog Test:*
The date dialog can be tested with the [^DateDialogTest.js], which will display what's shown below.
!DateDialog-Android-Light.png|thumbnail! !DateDialog-Android-Dark.png|thumbnail!
*Time Dialog Test:*
The time dialog can be tested with the [^TimeDialogTest.js], which will display what's shown below.
!TimeDialog-Android-Light.png|thumbnail! !TimeDialog-Android-Dark.png|thumbnail!
*Breaking-Change:*
The app must use a "Theme.MaterialComponents" based theme or else an exception will occur. So, app's using a custom theme based from "Theme.AppCompat" or similar will crash. This is normal and the exception will state that the theme will need to change.
Attachments
| File | Date | Size |
|---|---|---|
| DateDialog-Android-Dark.png | 2021-02-23T02:56:47.000+0000 | 456185 |
| DateDialog-Android-Light.png | 2021-02-23T02:56:47.000+0000 | 461739 |
| DateDialogTest.js | 2021-02-23T02:56:25.000+0000 | 918 |
| TimeDialog-Android-Dark.png | 2021-02-23T03:01:03.000+0000 | 452494 |
| TimeDialog-Android-Light.png | 2021-02-23T03:01:06.000+0000 | 460698 |
| TimeDialogTest.js | 2021-02-23T03:01:35.000+0000 | 624 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/12353
FR Passed
merged to master and 10_0_X for 10.0.0 release target.