]>
Commit | Line | Data |
---|---|---|
ecee6932 | 1 | package ro.ieval.unical; |
a824030c MG |
2 | import java.util.Date; |
3 | ||
ecee6932 PT |
4 | import android.content.Context; |
5 | import android.view.LayoutInflater; | |
6 | import android.view.View; | |
7 | import android.view.ViewGroup; | |
8 | import android.widget.ArrayAdapter; | |
9 | import android.widget.TextView; | |
10 | ||
11 | ||
a824030c MG |
12 | public class EventAdapter extends ArrayAdapter<Event> { |
13 | private final Event[] values; | |
ecee6932 | 14 | private final Context context; |
1786431d | 15 | |
c9b1e441 | 16 | public EventAdapter(final Context context, final Event[] values) {//NOPMD |
ecee6932 PT |
17 | super(context,R.layout.event_row_layout,values); |
18 | this.context=context; | |
19 | this.values=values; | |
20 | } | |
070d3ab2 | 21 | |
ecee6932 | 22 | @Override |
1786431d | 23 | public View getView(final int position, final View convertView, final ViewGroup parent) { |
8a08d036 MG |
24 | final LayoutInflater inflater = (LayoutInflater) context |
25 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
26 | final View rowView = inflater.inflate(R.layout.event_row_layout, parent, false); | |
27 | final TextView title = (TextView) rowView.findViewById(R.id.smalleventtitle); | |
28 | final TextView dstart = (TextView) rowView.findViewById(R.id.smalldatestart); | |
29 | final TextView dend = (TextView) rowView.findViewById(R.id.smalldateend); | |
30 | final View header = rowView.findViewById(R.id.rowHeader); | |
31 | header.setBackgroundColor(values[position].eventColour); | |
32 | title.setText(values[position].title); | |
33 | dstart.setText(new Date(values[position].dtstart).toString()); | |
34 | dend.setText(new Date(values[position].dtend).toString()); | |
070d3ab2 | 35 | |
8a08d036 | 36 | return rowView; |
ecee6932 PT |
37 | } |
38 | } |