/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/TimetableListAdapter.java
ViewVC logotype

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/TimetableListAdapter.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1066 by torben, Thu Sep 16 15:32:42 2010 UTC revision 1551 by torben, Thu Jul 7 20:45:17 2011 UTC
# Line 17  public class TimetableListAdapter extend Line 17  public class TimetableListAdapter extend
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) {
# Line 50  public class TimetableListAdapter extend Line 50  public class TimetableListAdapter extend
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);
# Line 57  public class TimetableListAdapter extend Line 65  public class TimetableListAdapter extend
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()) {

Legend:
Removed from v.1066  
changed lines
  Added in v.1551

  ViewVC Help
Powered by ViewVC 1.1.20