17 |
|
|
18 |
@Override |
@Override |
19 |
public boolean isEnabled(int position) { |
public boolean isEnabled(int position) { |
20 |
return ( timetable.entries.get(position).getStationId() != -1 ); |
return ( timetable.entries.get(position).getStationEntry() != null ); |
21 |
} |
} |
22 |
|
|
23 |
public TimetableListAdapter(Context context) { |
public TimetableListAdapter(Context context) { |
50 |
return position; |
return position; |
51 |
} |
} |
52 |
|
|
53 |
|
String getTranslated(String str) { |
54 |
|
if (str == null) |
55 |
|
return str; |
56 |
|
|
57 |
|
str = str.replace("Aflyst", context.getString(R.string.timetablelist_cancel) ); |
58 |
|
return str; |
59 |
|
} |
60 |
|
|
61 |
@Override |
@Override |
62 |
public View getView(int position, View convertView, ViewGroup parent) { |
public View getView(int position, View convertView, ViewGroup parent) { |
63 |
TimetableEntry entry = timetable.entries.get(position); |
TimetableEntry entry = timetable.entries.get(position); |
65 |
View root = inflater.inflate(R.layout.timetablerow , parent, false); |
View root = inflater.inflate(R.layout.timetablerow , parent, false); |
66 |
|
|
67 |
TextView station = (TextView) root.findViewById(R.id.Station); |
TextView station = (TextView) root.findViewById(R.id.Station); |
68 |
station.setText(entry.getStation()); |
station.setText( entry.getStation() ); |
69 |
|
|
70 |
TextView arrival = (TextView) root.findViewById(R.id.Arrival); |
TextView arrival = (TextView) root.findViewById(R.id.Arrival); |
71 |
arrival.setText(entry.getArrival()); |
arrival.setText( getTranslated(entry.getArrival()) ); |
72 |
|
|
73 |
TextView departure = (TextView) root.findViewById(R.id.Departure); |
TextView departure = (TextView) root.findViewById(R.id.Departure); |
74 |
departure.setText(entry.getDeparture()); |
departure.setText( getTranslated(entry.getDeparture()) ); |
75 |
|
|
76 |
|
|
77 |
if (entry.isCurrent()) { |
if (entry.isCurrent()) { |