-
Notifications
You must be signed in to change notification settings - Fork 8
Listeners and Callbacks
Jean Luis Urena edited this page Aug 20, 2018
·
1 revision
Essential and required otherwise an IllegalStateException
will be thrown. It is used to load the events into the calendar. A List of events needs to be returned.
weekview.setWeekViewLoader(new WeekView.WeekViewLoader() {
@NonNull
public List<? extends WeekViewEvent> onWeekViewLoad() {
// return a List of WeekViewEvents.
}
});
Triggered when clicking on an event. Passes in a WeekView event and a RectF of the event.
weekview.setOnEventClickListener(new WeekView.EventClickListener() {
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
// Do something with the event
}
});
Triggered when long pressing on an event. Passes in a WeekView event and a RectF of the event.
weekview.setEventLongPressListener(new WeekView.EventLongPressListener() {
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
// Do something with the event on long press
}
});
Triggered when an empty view is clicked. Passes in a DayTime object.
weekview.setEmptyViewClickListener(new WeekView.EmptyViewClickListener() {
@Override
public void onEmptyViewClicked(DayTime date) {
// Do something with the view clicked
}
});
Triggered when an empty view is long pressed. Passes in a DayTime object.
weekview.setEmptyViewLongPressListener(new WeekView.EmptyViewLongPressListener() {
@Override
public void onEmptyViewLongPress(DayTime date) {
// Do something with the view long pressed
}
});
Triggered when clicked to add an event. Passes in start and end DayTime objects.
weekview.setAddEventClickListener(new WeekView.AddEventClickListener() {
@Override
public void setAddEventClickListener(DayTime startTime, DayTime endTime) {
// Do something with the times.
}
});
Triggered when dropping a view into the calendar. Passes in the dropped view and the measured day and time coordinates. DropListener must be enabled by calling enableDropListener()
weekview.enableDropListener();
weekview.setDropListener(new WeekView.DropListener() {
@Override
public void onDrop(View view, DayTime date) {
// Do something with the dropped view
}
});