You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've done the code before where it says to decorate the cellview by checking the date. However, I'm gettin the same cells coloured on each month... I don't know why. Please see my code below
private class BookedDayDecorator implements CalendarCellDecorator {
private ArrayList<CalendarModel> mData;
public BookedDayDecorator(ArrayList<CalendarModel> calendarModel) {
this.mData = calendarModel;
}
@Override
public void decorate(CalendarCellView cellView, Date date) {
for (int i = 0; i < mData.size(); i++) {
if (cellView.isCurrentMonth()) {
if (MyFunctions.getDateFromString(mData.get(i).getStarts_at()).compareTo(date) * date.compareTo(MyFunctions.getDateFromString(mData.get(i).getEnds_at())) >= 0) {
if (mData.get(i).getType().equals("booking")) {
int purpleColor = Color.parseColor("#7a00ff");
cellView.setBackgroundColor(purpleColor);
cellView.getDayOfMonthTextView().setTextColor(Color.WHITE);
cellView.getDayOfMonthTextView().setTypeface(cellView.getDayOfMonthTextView().getTypeface(), Typeface.BOLD);
} else if (mData.get(i).getType().equals("block")) {
cellView.setBackground(getResources().getDrawable(R.drawable.bgnd_blocked_day));
cellView.getDayOfMonthTextView().setTextColor(Color.WHITE);
cellView.getDayOfMonthTextView().setTypeface(cellView.getDayOfMonthTextView().getTypeface(), Typeface.BOLD);
} else {
Date today = new Date();
if (date.before(today)) {
cellView.getDayOfMonthTextView().setTypeface(cellView.getDayOfMonthTextView().getTypeface(), Typeface.BOLD);
cellView.setAlpha(0.3f);
} else {
cellView.setBackgroundColor(Color.WHITE);
cellView.getDayOfMonthTextView().setTextColor(getResources().getColor(R.color.dark_gray));
}
}
}
}
}
}
}
See attached screenshot as well. Any help would be appreciated
The text was updated successfully, but these errors were encountered:
I've done the code before where it says to decorate the cellview by checking the date. However, I'm gettin the same cells coloured on each month... I don't know why. Please see my code below
See attached screenshot as well. Any help would be appreciated
The text was updated successfully, but these errors were encountered: