7 |
import android.view.View; |
import android.view.View; |
8 |
import android.view.ViewGroup; |
import android.view.ViewGroup; |
9 |
import android.widget.BaseAdapter; |
import android.widget.BaseAdapter; |
10 |
|
import android.widget.TextView; |
11 |
|
|
12 |
public class TimetableListAdapter extends BaseAdapter { |
public class TimetableListAdapter extends BaseAdapter { |
13 |
|
|
15 |
LayoutInflater inflater; |
LayoutInflater inflater; |
16 |
Context context; |
Context context; |
17 |
|
|
18 |
|
@Override |
19 |
|
public boolean isEnabled(int position) { |
20 |
|
return false; |
21 |
|
} |
22 |
|
|
23 |
public TimetableListAdapter(Context context) { |
public TimetableListAdapter(Context context) { |
24 |
super(); |
super(); |
25 |
this.context = context; |
this.context = context; |
52 |
|
|
53 |
@Override |
@Override |
54 |
public View getView(int position, View convertView, ViewGroup parent) { |
public View getView(int position, View convertView, ViewGroup parent) { |
55 |
// TODO Auto-generated method stub |
TimetableBean timetableBean = timetable.get(position); |
56 |
return null; |
|
57 |
|
View root = inflater.inflate(R.layout.timetablerow , parent, false); |
58 |
|
|
59 |
|
TextView station = (TextView) root.findViewById(R.id.Station); |
60 |
|
station.setText(timetableBean.getStation()); |
61 |
|
|
62 |
|
TextView arrival = (TextView) root.findViewById(R.id.Arrival); |
63 |
|
arrival.setText(timetableBean.getArrival()); |
64 |
|
|
65 |
|
TextView departure = (TextView) root.findViewById(R.id.Departure); |
66 |
|
departure.setText(timetableBean.getDeparture()); |
67 |
|
|
68 |
|
|
69 |
|
if (timetableBean.isCurrent()) { |
70 |
|
final int bgcolor = 0xFFFFFFFF; |
71 |
|
final int fgcolor = 0xFF000000; |
72 |
|
|
73 |
|
station.setTextColor(fgcolor); |
74 |
|
arrival.setTextColor(fgcolor); |
75 |
|
departure.setTextColor(fgcolor); |
76 |
|
root.setBackgroundColor(bgcolor); |
77 |
|
} |
78 |
|
|
79 |
|
return root; |
80 |
} |
} |
81 |
|
|
82 |
} |
} |