1 |
package dk.thoerup.traininfo; |
package dk.thoerup.traininfo; |
2 |
|
|
3 |
import android.content.Context; |
import android.content.Context; |
4 |
|
import android.util.Log; |
5 |
import android.view.LayoutInflater; |
import android.view.LayoutInflater; |
6 |
import android.view.View; |
import android.view.View; |
7 |
import android.view.ViewGroup; |
import android.view.ViewGroup; |
51 |
return position; |
return position; |
52 |
} |
} |
53 |
|
|
54 |
|
String getTranslated(String str) { |
55 |
|
if (str == null) |
56 |
|
return str; |
57 |
|
|
58 |
|
str = str.replace("Aflyst", context.getString(R.string.timetablelist_cancel) ); |
59 |
|
return str; |
60 |
|
} |
61 |
|
|
62 |
@Override |
@Override |
63 |
public View getView(int position, View convertView, ViewGroup parent) { |
public View getView(int position, View convertView, ViewGroup parent) { |
64 |
TimetableEntry entry = timetable.entries.get(position); |
TimetableEntry entry = timetable.entries.get(position); |
66 |
View root = inflater.inflate(R.layout.timetablerow , parent, false); |
View root = inflater.inflate(R.layout.timetablerow , parent, false); |
67 |
|
|
68 |
TextView station = (TextView) root.findViewById(R.id.Station); |
TextView station = (TextView) root.findViewById(R.id.Station); |
69 |
station.setText(entry.getStation()); |
station.setText( entry.getStation() ); |
70 |
|
|
71 |
TextView arrival = (TextView) root.findViewById(R.id.Arrival); |
TextView arrival = (TextView) root.findViewById(R.id.Arrival); |
72 |
arrival.setText(entry.getArrival()); |
arrival.setText( getTranslated(entry.getArrival()) ); |
73 |
|
|
74 |
TextView departure = (TextView) root.findViewById(R.id.Departure); |
TextView departure = (TextView) root.findViewById(R.id.Departure); |
75 |
departure.setText(entry.getDeparture()); |
departure.setText( getTranslated(entry.getDeparture()) ); |
76 |
|
|
77 |
|
|
78 |
if (entry.isCurrent()) { |
if (entry.isCurrent()) { |