material-components / material-components/material-components-android
[MaterialDatePicker] Ability to reset selected day
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I am using MaterialDatePicker ('com.google.android.material:material:1.8.0') and I just realized that there is no way to reset the selected date to the MaterialDatePicker.Builder after being built of course. The issue comes after the following steps: the user opens the datepicker, selects a date, taps on one of the buttons or dismisses the dialog, reopens it again - the selected day stays where it left off. It would be nice to open again a new dialog with a non-selected date. However, after rotation the opened and selected datePicker, and then dismissing it and opening again - the date is unselected as it should be.
**Describe alternatives you've considered**
Before that I used CalendarView with public method setDate() which allowed me to handle this issue.
https://developer.android.com/reference/android/widget/CalendarView#setDate(long)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading MaterialDatePicker and MaterialDatePicker.Builder, focusing on how the selected day is retained when the dialog is reopened. Add a way to reset or clear that selection after building, and verify that reopening the picker shows no selected date while rotation state restoration continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100