--- android/TrainInfo/src/dk/thoerup/traininfo/DepartureListAdapter.java 2009/10/29 19:27:29 490 +++ android/TrainInfo/src/dk/thoerup/traininfo/DepartureListAdapter.java 2009/11/06 06:58:29 499 @@ -5,7 +5,6 @@ import java.util.Map; import android.content.Context; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -63,14 +62,7 @@ public View getView(int position, View convertView, ViewGroup parent) { DepartureBean station = departures.get(position); - - View root; - if (convertView == null || convertView.getId() != R.id.DepartureRow ) { - root = inflater.inflate(R.layout.departurerow , parent, false); - } else { - root = convertView; - } - + View root = inflater.inflate(R.layout.departurerow , parent, false); ((TextView) root.findViewById(R.id.Time)).setText(station.getTime()); ((TextView) root.findViewById(R.id.Destination)).setText(station.getDestination()); @@ -78,10 +70,14 @@ if (station.getStatus().length() > 0 || station.getNote().length() > 0) { ImageView image = (ImageView) root.findViewById(R.id.InfoIcon); + String status = station.getStatus().toLowerCase(); + String note = station.getNote().toLowerCase(); + int iconID; - if (station.getStatus().toLowerCase().indexOf("aflyst") > -1 || - station.getNote().toLowerCase().indexOf("aflyst") > -1 ) { + if (status.indexOf("aflyst") > -1 || note.indexOf("aflyst") > -1 ) { iconID = R.drawable.warn20; + } else if (note.indexOf("kører kun til") > -1 || note.indexOf("afgår fra") > -1) { //If these strings are present, the train only covers part of the line + iconID = R.drawable.warnyellow20; } else { iconID = R.drawable.info20; }