material-components / material-components/material-components-android
[MaterialTimePicker] Add a neutral button with customizable text similar to TimePickerDialog
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.**
Currently we have a use case where we use the Android TimePickerDialog. The issue is that the keypad icon that gives the ability to the users to switch the time input mode from clock to manual using the keyboard is only available from Android 8.0 and above. Since our app minSdk version is API 24, the keypad icon is not available to devices running Android lower than 8.0. We would really like to use the MaterialTimePicker in order to provide the same UI experience to all supported devices. The problem is that we currently use the Android TimePickerDialog's neutral button with text "Now" to give the ability to the user to choose the current time, and switching to MaterialTimePicker would cause a loss of functionality since there is no neutral button.
**Describe the solution you'd like**
It would be great if there was a public setter for the buttons on MaterialTimePicker similar to TimePickerDialog
timeDialog.setButton(DialogInterface.BUTTON_NEUTRAL, "Now")
**Describe alternatives you've considered**
At this point the alternatives for us is to continue using the older TimePickerDialog.
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 at the MaterialTimePicker API and compare the requested behavior with Android TimePickerDialog.setButton(DialogInterface.BUTTON_NEUTRAL, "Now"). Confirm that a public neutral-button API can customize its text and support the current-time use case across the app's supported API levels.
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
- 48/100