From a824030c902a41882e98839fea032f7ccdfc1635 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Mon, 10 Jun 2013 00:26:30 +0300 Subject: [PATCH] Remove EventRowContainer and add colour to the event list --- src/ro/ieval/unical/EventAdapter.java | 16 +++++++++------- src/ro/ieval/unical/EventListActivity.java | 10 ++-------- src/ro/ieval/unical/EventRowContainer.java | 18 ------------------ 3 files changed, 11 insertions(+), 33 deletions(-) delete mode 100644 src/ro/ieval/unical/EventRowContainer.java diff --git a/src/ro/ieval/unical/EventAdapter.java b/src/ro/ieval/unical/EventAdapter.java index 35245d0..73f29fb 100644 --- a/src/ro/ieval/unical/EventAdapter.java +++ b/src/ro/ieval/unical/EventAdapter.java @@ -1,4 +1,6 @@ package ro.ieval.unical; +import java.util.Date; + import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; @@ -9,10 +11,10 @@ import android.widget.ImageView; import android.widget.TextView; -public class EventAdapter extends ArrayAdapter { - private final EventRowContainer[] values; +public class EventAdapter extends ArrayAdapter { + private final Event[] values; private final Context context; - public EventAdapter(Context context,EventRowContainer[] values) { + public EventAdapter(Context context,Event[] values) { super(context,R.layout.event_row_layout,values); this.context=context; this.values=values; @@ -27,10 +29,10 @@ public class EventAdapter extends ArrayAdapter { TextView dstart = (TextView) rowView.findViewById(R.id.smalldatestart); TextView dend = (TextView) rowView.findViewById(R.id.smalldateend); ImageView header = (ImageView) rowView.findViewById(R.id.rowHeader); - header.setBackgroundColor(Color.CYAN); - title.setText(values[position].name); - dstart.setText(values[position].dtstart.toString()); - dend.setText(values[position].dtend.toString()); + header.setBackgroundColor(values[position].eventColour); + title.setText(values[position].title); + dstart.setText(new Date(values[position].dtstart).toString()); + dend.setText(new Date(values[position].dtend).toString()); return rowView; } diff --git a/src/ro/ieval/unical/EventListActivity.java b/src/ro/ieval/unical/EventListActivity.java index 58fc8b2..18fa49d 100644 --- a/src/ro/ieval/unical/EventListActivity.java +++ b/src/ro/ieval/unical/EventListActivity.java @@ -25,14 +25,8 @@ public class EventListActivity extends Activity { final Event events[]=Event.getAllEvents(getBaseContext()); final ListView lv = (ListView) findViewById(R.id.eventlist); Arrays.sort(events,new EventComparator()); - - EventRowContainer r[]=new EventRowContainer[events.length]; - for(int i=0; i