MaterialDayPicker icon indicating copy to clipboard operation
MaterialDayPicker copied to clipboard

Add enable or disabled touch mode or add busy mode with an icon

Open mahbub-java opened this issue 5 years ago • 3 comments

After selected a day, we may need to add a network request that work asynchronously to pull some data from database for selected day. So we have to wait some time to load. Suppose, If user can again select another day in that period in single mode, we can't properly predict which day select previously or which data actually come, unless manually checking with some variable. It will be smart, if we manually disable selection for some time or a loading an icon and enable again manually when task was complete. Currently system setEnabled does not work.

mahbub-java avatar Oct 17 '20 22:10 mahbub-java

You should be able to disable selection using the following method:

materialDayPicker.disableAllDays()

When the network request finishes you can re-enable selection using:

materialDayPicker.enableAllDays()

If you want to only enable specific days you can do this instead:

materialDayPicker.enabledDays(daysToEnable = listOf(...))

gantonious avatar Oct 17 '20 22:10 gantonious

Ok thanks for quick response. But in my scenario, I already disable Sunday, when first load day picker. Because weekly off day has to matter in my app. I already set disabled Sunday color RED to understand the user. User can select other 6 day, But in every selection they have to wait network data. I can't disable by materialDayPicker.disableAllDays(), because it will showed all RED color. So they will confuse with weekly off day. So I need a loading symbol or anything to wait in particularly selected day.

mahbub-java avatar Oct 17 '20 22:10 mahbub-java

Thanks for explaining. I see the issue you have for your use-case. I suppose we would want a way to disable the entire control and darken each toogle using the setEnabled method like you're suggesting.

I'm not actively working on enhancements to this library right now however if you would like to add this feature I would be happy to review your pull request and release a new version of the library.

gantonious avatar Oct 17 '20 22:10 gantonious