Comments (8)
Hey @samiro, right now there isn't a way to disable individual days, only minimum and maximum dates can be set. I don't see this feature being a priority right now, unless it becomes popular.
As always, pull requests are welcome, but I would advise waiting for events (see #3) to be implemented so we can have a similar APIs.
from material-calendarview.
Ok. Thank you very much.
from material-calendarview.
+1
from material-calendarview.
+1
from material-calendarview.
I just wanted to point out to anyone that's interested in this feature, that I managed to implement this functionality buy implementing onDateChanged, keeping track of the currently selected date and re-setting the currently selected date if the newly selected date should be disabled. The other thing that I had to do was implement a DayViewDecorator which set the disabled day's background to the same color as the calendar background.
from material-calendarview.
Thanks for the suggestion @jsa-nic!
from material-calendarview.
Released in 0.6.0. Disabling days was added to the decorator system.
from material-calendarview.
@dandc87 Can you provide an example for disabling certain dates?
I was trying to do as proposed here
ArrayList<CalendarDay> enabledDates = new ArrayList<>();
enabledDates.add(new CalendarDay(new Date(2017, 8, 25)));
enabledDates.add(new CalendarDay(new Date(2017, 8, 26)));
enabledDates.add(new CalendarDay(new Date(2017, 8, 27)));
enabledDates.add(new CalendarDay(new Date(2017, 8, 28)));
enabledDates.add(new CalendarDay(new Date(2017, 8, 29)));
enabledDates.add(new CalendarDay(new Date(2017, 8, 30)));
enabledDates.add(new CalendarDay(new Date(2017, 9, 1)));
enabledDates.add(new CalendarDay(new Date(2017, 9, 10)));
enabledDates.add(new CalendarDay(new Date(2017, 9, 11)));
enabledDates.add(new CalendarDay(new Date(2017, 9, 13)));
enabledDates.add(new CalendarDay(new Date(2017, 9, 16)));
enabledDates.add(new CalendarDay(new Date(2017, 9, 19)));
mcv.addDecorator(new DayEnableDecorator(enabledDates));
public class DayEnableDecorator implements DayViewDecorator {
private HashSet<CalendarDay> dates;
public DayEnableDecorator(Collection<CalendarDay> dates) {
this.dates = new HashSet<>(dates);
}
@Override
public boolean shouldDecorate(CalendarDay day) {
return dates.contains(day);
}
@Override
public void decorate(DayViewFacade view) {
view.setDaysDisabled(false);
}
}
However, it doesn't work and it seems like CalendarDay() is deprecated.
Any help would be appreciated.
from material-calendarview.
Related Issues (20)
- isInRange() not working properly
- color decoration function. HOT 1
- Can only add Version 1.4.3
- Saving and accessing decorators
- first time initialize the calendar, selected circle will expand to parent width and height HOT 1
- LTR && RTL
- that possible to add multiple spans? HOT 1
- Can I add labels on dates? HOT 1
- How to increase height of row to display more info
- I want to disable RTL. HOT 1
- How to change the background
- MVC not rendering on xml design view, messed up HOT 5
- Why selector drawable doesn't work?
- on CalendarMode.WEEKS i want to show two week
- Labelling Calendar with Events
- The problem that addspan of DayViewDecorator is not maintained when the month changes
- Can't control the accessibility of each day number HOT 2
- Selected Date Not Working
- Using material-calendarview in jetpack compose HOT 1
- Multiple dot span to one date HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-calendarview.