]>
Commit | Line | Data |
---|---|---|
1 | package ro.ieval.unical; | |
2 | import android.content.Context; | |
3 | import android.view.LayoutInflater; | |
4 | import android.view.View; | |
5 | import android.view.ViewGroup; | |
6 | import android.widget.ArrayAdapter; | |
7 | import android.widget.TextView; | |
8 | ||
9 | ||
10 | public class EventAdapter extends ArrayAdapter<EventRowContainer> { | |
11 | private final EventRowContainer[] values; | |
12 | private final Context context; | |
13 | public EventAdapter(Context context,EventRowContainer[] values) { | |
14 | super(context,R.layout.event_row_layout,values); | |
15 | this.context=context; | |
16 | this.values=values; | |
17 | } | |
18 | ||
19 | @Override | |
20 | public View getView(int position, View convertView, ViewGroup parent) { | |
21 | LayoutInflater inflater = (LayoutInflater) context | |
22 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
23 | View rowView = inflater.inflate(R.layout.event_row_layout, parent, false); | |
24 | TextView title = (TextView) rowView.findViewById(R.id.smalleventtitle); | |
25 | TextView dstart = (TextView) rowView.findViewById(R.id.smalldatestart); | |
26 | TextView dend = (TextView) rowView.findViewById(R.id.smalldateend); | |
27 | title.setText(values[position].name); | |
28 | dstart.setText(values[position].dtstart.toString()); | |
29 | dend.setText(values[position].dtend.toString()); | |
30 | ||
31 | return rowView; | |
32 | } | |
33 | } |