package com.alexstyl.specialdates.search;

import com.alexstyl.specialdates.contact.Contact;
import com.alexstyl.specialdates.date.ContactEvent;
import com.alexstyl.specialdates.events.peopleevents.EventType;

import java.util.ArrayList;
import java.util.List;

final class ContactEventViewModelFactory {

    private final ContactEventLabelCreator eventLabelCreator;

    ContactEventViewModelFactory(ContactEventLabelCreator eventLabelCreator) {
        this.eventLabelCreator = eventLabelCreator;
    }

    List<ContactEventViewModel> createViewModelFrom(List<ContactWithEvents> contactEvents) {
        List<ContactEventViewModel> models = new ArrayList<>();
        for (ContactWithEvents contactEvent : contactEvents) {

            Contact contact = contactEvent.getContact();

            for (ContactEvent event : contactEvent.getEvents()) {
                String eventLabel = eventLabelCreator.createFor(event);
                int variant = getVariationFor(event);
                ContactEventViewModel viewModel = new ContactEventViewModel(contact, eventLabel, colorOf(event.getType()), variant);
                models.add(viewModel);
            }
        }
        return models;
    }

    private int colorOf(EventType type) {
        return 0;
    }

    private int getVariationFor(ContactEvent event) {
        return (int) event.getContact().getContactID();
    }
}

@@ -175,37 +175,28 @@
 tes.
-events.peopleevents.EventType
+upcoming.EventColors
 ;%0A%0Ai
@@ -1042,62 +1042,197 @@
 del(
-contact, eventLabel, colorOf(event.getType()), variant
+%0A                        contact,%0A                        eventLabel,%0A                        EventColors.INSTANCE.colorOf(event.getType()),%0A                        variant%0A                
 );%0A 
@@ -1327,75 +1327,8 @@
  %7D%0A%0A
-    private int colorOf(EventType type) %7B%0A        return 0;%0A    %7D%0A%0A
     

Use EventColors to pass the right event color