Search in sources :

Example 1 with Event

use of com.github.sundeepk.compactcalendarview.domain.Event in project CompactCalendarView by SundeepK.

the class CompactCalendarControllerTest method testItRemovesEvent.

@Test
public void testItRemovesEvent() {
    Event event = getSingleEvents(0, 30, 1433701251000L).get(0);
    underTest.removeEvent(event);
    verify(eventsContainer).removeEvent(event);
    verifyNoMoreInteractions(eventsContainer);
}
Also used : MotionEvent(android.view.MotionEvent) Event(com.github.sundeepk.compactcalendarview.domain.Event) Test(org.junit.Test)

Example 2 with Event

use of com.github.sundeepk.compactcalendarview.domain.Event in project CompactCalendarView by SundeepK.

the class CompactCalendarController method drawSingleEvent.

private void drawSingleEvent(Canvas canvas, float xPosition, float yPosition, List<Event> eventsList) {
    Event event = eventsList.get(0);
    drawEventIndicatorCircle(canvas, xPosition, yPosition, event.getColor());
}
Also used : MotionEvent(android.view.MotionEvent) Event(com.github.sundeepk.compactcalendarview.domain.Event)

Example 3 with Event

use of com.github.sundeepk.compactcalendarview.domain.Event in project CompactCalendarView by SundeepK.

the class CompactCalendarHelper method getSingleEvents.

//generate one event per a day for a month
public static List<Event> getSingleEvents(int start, int days, long timeStamp, int color) {
    Calendar currentCalender = Calendar.getInstance(Locale.getDefault());
    List<Event> events = new ArrayList<>();
    for (int i = start; i < days; i++) {
        setDateTime(timeStamp, currentCalender, i);
        events.add(new Event(color, currentCalender.getTimeInMillis()));
    }
    return events;
}
Also used : Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) Event(com.github.sundeepk.compactcalendarview.domain.Event)

Example 4 with Event

use of com.github.sundeepk.compactcalendarview.domain.Event in project CompactCalendarView by SundeepK.

the class CompactCalendarHelper method getMultipleEventsForEachDayAsMap.

public static Map<Long, List<Event>> getMultipleEventsForEachDayAsMap(int start, int days, long timeStamp) {
    Calendar currentCalender = Calendar.getInstance(Locale.getDefault());
    Map<Long, List<Event>> epochMillisToEvents = new HashMap<>();
    for (int i = start; i < days; i++) {
        setDateTime(timeStamp, currentCalender, i);
        List<Event> eventList = new ArrayList<>();
        List<Event> events = Arrays.asList(new Event(Color.BLUE, currentCalender.getTimeInMillis()), new Event(Color.RED, currentCalender.getTimeInMillis() + 3600 * 1000), new Event(Color.RED, currentCalender.getTimeInMillis() + (3600 * 2) * 1000), new Event(Color.RED, currentCalender.getTimeInMillis() + (3600 * 3) * 1000));
        eventList.addAll(events);
        epochMillisToEvents.put(currentCalender.getTimeInMillis(), eventList);
    }
    return epochMillisToEvents;
}
Also used : HashMap(java.util.HashMap) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) Event(com.github.sundeepk.compactcalendarview.domain.Event) List(java.util.List) ArrayList(java.util.ArrayList)

Example 5 with Event

use of com.github.sundeepk.compactcalendarview.domain.Event in project CompactCalendarView by SundeepK.

the class CompactCalendarHelper method getDayEventWith2EventsPerDay.

public static List<Events> getDayEventWith2EventsPerDay(int start, int days, long timeStamp) {
    Calendar currentCalender = Calendar.getInstance(Locale.getDefault());
    List<Events> events = new ArrayList<>();
    for (int i = start; i < days; i++) {
        setDateTime(timeStamp, currentCalender, i);
        List<Event> eventList = new ArrayList<>();
        eventList.add(new Event(Color.BLUE, currentCalender.getTimeInMillis()));
        eventList.add(new Event(Color.RED, currentCalender.getTimeInMillis() + 3600 * 1000));
        Events eventsObject = new Events(currentCalender.getTimeInMillis(), eventList);
        events.add(eventsObject);
    }
    return events;
}
Also used : Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) Event(com.github.sundeepk.compactcalendarview.domain.Event)

Aggregations

Event (com.github.sundeepk.compactcalendarview.domain.Event)23 Test (org.junit.Test)12 ArrayList (java.util.ArrayList)8 MotionEvent (android.view.MotionEvent)5 Calendar (java.util.Calendar)5 Date (java.util.Date)3 List (java.util.List)3 Paint (android.graphics.Paint)2 View (android.view.View)1 ArrayAdapter (android.widget.ArrayAdapter)1 Button (android.widget.Button)1 ListView (android.widget.ListView)1 CompactCalendarHelper.getMultipleEventsForEachDayAsMap (com.github.sundeepk.compactcalendarview.CompactCalendarHelper.getMultipleEventsForEachDayAsMap)1 CompactCalendarView (com.github.sundeepk.compactcalendarview.CompactCalendarView)1 SimpleDateFormat (java.text.SimpleDateFormat)1 HashMap (java.util.HashMap)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Random (java.util.Random)1 TimeZone (java.util.TimeZone)1