prolificinteractive / material-calendarview

A Material design back port of Android's CalendarView
https://prolificinteractive.github.io/material-calendarview/
MIT License
5.91k stars 1.32k forks source link

How to decorate EventDecorator with title from string array depend on day #1088

Closed burzua closed 3 years ago

burzua commented 3 years ago

I have class:

public class MasterSchedule { @SerializedName("date") private String mDate; @SerializedName("time_begin") private String mTimeBegin; @SerializedName("time_end") private String mTimeEnd;

public String getmDate() {
    return mDate;
}
public void setmDate (String date) {
    mDate = date;
}

public String getmTimeBegin() {
    return mTimeBegin.substring(0,2);
}
public void setmTimeBegin (String timebegin) {
    mTimeBegin = timebegin;
}

public String getmTimeEnd() {

    return mTimeEnd.substring(0,2);
}
public void setmTimeEnd (String timeend) {
    mTimeEnd = timeend;
}

}

From server i have response:

List masterschedule = new Gson().fromJson(response, new TypeToken<List>(){}.getType());

I'm succesfuly send Dates to Calendar to set selected dates:

for (int i=0; i< masterschedule.size();i++) { try { Date date = new SimpleDateFormat("yyyy-MM-dd").parse(masterschedule.get(i).getmDate()); calendarview.setDateSelected(date,true);

                } catch (ParseException e) {
                    e.printStackTrace();
                }

     }

Problem is: i don't know how to send to calendar's eventdecorator for each date own eventdecorator title text from masterschedule title is: String title = masterschedule.get(index).getmTimeBegin() + "-" + masterschedule.get(index).getmTimeEnd() Screenshot 2021-01-18 at 17 59 08 where is text "bobo" must be timeshchedule for each day