material-components / material-components/material-components-android
[MaterialTimePicker] Add Input validation
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 17.4k
- Fork
- 3.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Is your feature request related to a problem? Please describe.
Many times, apps need users to select a date+time in the past/future. MaterialDatePicker solves this problem by having the option to add constraints with a validator. TimePicker doesn't allow any such option.
Describe the solution you'd like
An addConstraints implementation for MaterialTimePicker. I understand that it won't be possible to simply extend CalendarConstraints for this because the time picker is only concerned with time but an option to add constraints in the form of (say) constraintBefore(int hour, int minute) and constraintAfter(int hour, int minute) can be added.
Describe alternatives you've considered
The present alternative to this I am using is to manually check the time from the TimePicker and reset the time if it doesn't fall within the required constraints. (Say I only allow time to be selected in the past, but user has entered a future time. I reset the displayed time to the current time). But this leaves room for a bad UX where the user can get confused or not even realize their selected time has been changed.
Additional context
An example implementation can be this library I found on Github
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.