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

[MaterialDatePicker] OnSelectionChangedListener and DateSelector are not accessible.

Open kevintorch opened this issue 5 years ago • 7 comments
trafficstars

Description: Trying to implement custom DateSelector. but it shows error as

"com.google.android.material.datepicker.OnSelectionChangedListener' is not public in 'com.google.android.material.datepicker'. Cannot be accessed from outside package"

and

"DateSelector can only be accessed from within the same library group (groupId=com.google.android.material)"

Expected behavior: Basically I want the same behavior as SingleDateSelector or RangeDateSelector

Material Library version: 1.3.0-alpha02

kevintorch avatar Sep 15 '20 07:09 kevintorch

Maybe DateSelector should be opened and everyone should be able to implement a custom one if needed. Obviously the builder should have an additional MaterialDatePicker.Builder.withPicker(customDateSelector);

I don't know if implementing a new custom DateSelector it's an "easy" task...

matpag avatar Sep 15 '20 10:09 matpag

Maybe DateSelector should be opened and everyone should be able to implement a custom one if needed. Obviously the builder should have an additional MaterialDatePicker.Builder.withPicker(customDateSelector);

I don't know if implementing a new custom DateSelector it's an "easy" task...

Actually it has MaterialDatePicker.Builder.customSelector(DateSelector) method. but it's no use.

and second, it's not that difficult to implement a custom DateSelector. I've seen the classes

kevintorch avatar Sep 15 '20 10:09 kevintorch

You are right, it's this, https://github.com/material-components/material-components-android/blob/22973ff10305397bfc72fed41684175fee8aeefb/lib/java/com/google/android/material/datepicker/MaterialDatePicker.java#L546-L550 but it's Library Group restricted as everything else.

and second, it's not that difficult to implement a custom DateSelector. I've seen the classes

Nice to know 👍

matpag avatar Sep 15 '20 10:09 matpag

I have the same issue. I need to listen on selection changes and need to add custom logic forDateSelector:isSelectionComplete but 🤷‍♂️ no possible at the moment.

AleksandarAleksiev avatar Sep 18 '20 19:09 AleksandarAleksiev

E.g this could be used to implement optional range selection

lsuski avatar Sep 23 '20 07:09 lsuski

Hello everyone, actually I have the same issue. I need to listen on selection changes and need to disable some dates when first date is selected but no possible at the moment. I hope they add a listener.

saoudiabderraouf avatar Sep 09 '21 22:09 saoudiabderraouf

Still not fixed :(

sme-shyl001 avatar Apr 25 '24 11:04 sme-shyl001