material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[MaterialDatePicker] I'm not able to prevent dismiss when I choose a wrong date interval

Open PieroSilvestri opened this issue 3 years ago • 5 comments

The component cannot prevent auto dismiss when I click on positive button. I'm not able to override setOnClickListener for the confirm_button.

PieroSilvestri avatar Jul 19 '22 15:07 PieroSilvestri

Hi @munsra, can you specify the component name? I assume you're talking about MaterialDatePicker?

paulfthomas avatar Jul 20 '22 15:07 paulfthomas

Yes, this one: MaterialDatePicker.Builder<Pair<Long, Long>> builderRange = MaterialDatePicker.Builder.dateRangePicker();

PieroSilvestri avatar Jul 20 '22 15:07 PieroSilvestri

Can you explain what's your use scenario? Why do you want to prevent auto dismiss?

drchen avatar Jul 25 '22 18:07 drchen

For example if I need to validate a Date Range, I need to show to the user and error message in order to let him to re-insert a new range without closing the popup.

So click on confirm --> if data range is invalid --> try again without closing the popup

PieroSilvestri avatar Jul 26 '22 08:07 PieroSilvestri

Thanks for the info. I think that makes sense. : )

drchen avatar Jul 26 '22 16:07 drchen