package amai.org.conventions.events.adapters;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import amai.org.conventions.R;
import amai.org.conventions.events.activities.EventsTimeSlot;
import amai.org.conventions.utils.Dates;

public class FreeTimeSlotViewHolder extends RecyclerView.ViewHolder {
	private TextView textView;

	public FreeTimeSlotViewHolder(View view) {
		super(view);
		textView = (TextView) view.findViewById(R.id.small_text);
	}

	public void setModel(EventsTimeSlot slot) {
		textView.setText(textView.getContext().getString(R.string.free_time,
				Dates.toHumanReadableTimeDuration(slot.getEndTime().getTime() - slot.getStartTime().getTime())));
	}
}

@@ -157,30 +157,99 @@
 ort 
-amai.org.conventions.R
+java.util.Date;%0A%0Aimport amai.org.conventions.R;%0Aimport amai.org.conventions.ThemeAttributes
 ;%0Aim
@@ -617,16 +617,92 @@
 slot) %7B%0A
+%09%09Date startTime = slot.getStartTime();%0A%09%09Date endTime = slot.getEndTime();%0A
 %09%09textVi
@@ -806,69 +806,515 @@
 ion(
-slot
+endTime.getTime() - startTime
 .get
-End
 Time()
-.getTime() - slot.getStartTime().getTime()))
+)));%0A%0A%09%09// Set color according to started/during/passed%0A%09%09int color;%0A%09%09if (!startTime.before(Dates.now())) %7B%0A%09%09%09color = ThemeAttributes.getColor(itemView.getContext(), R.attr.eventTypeNotStartedColor);%0A%09%09%7D else if (endTime.before(Dates.now())) %7B%0A%09%09%09color = ThemeAttributes.getColor(itemView.getContext(), R.attr.eventTypeEndedColor);%0A%09%09%7D else %7B%0A%09%09%09color = ThemeAttributes.getColor(itemView.getContext(), R.attr.eventTypeCurrentColor);%0A%09%09%7D%0A%09%09textView.setTextColor(color
 );%0A%09

Set free time slot text color according to before/during/after