--- android/TrainInfo/src/dk/thoerup/traininfo/DepartureListAdapter.java 2009/08/09 17:46:09 244 +++ android/TrainInfo/src/dk/thoerup/traininfo/DepartureListAdapter.java 2009/08/10 16:58:22 253 @@ -59,10 +59,30 @@ ((TextView) root.findViewById(R.id.Destination)).setText(station.getDestination()); if (station.getStatus().length() > 0 || station.getNote().length() > 0) { - ImageView image = (ImageView) root.findViewById(R.id.Icon); + ImageView image = (ImageView) root.findViewById(R.id.InfoIcon); image.setImageResource(R.drawable.info20); } + ImageView typeIcon = (ImageView) root.findViewById(R.id.TypeIcon); + String trainNumber = station.getTrainNumber(); + if (trainNumber.length() >= 2) { + if ( trainNumber.substring(0, 2).equalsIgnoreCase("ra")) { //ra = regionaltog arriva + typeIcon.setImageResource(R.drawable.retog); + } else if ( trainNumber.substring(0, 2).equalsIgnoreCase("re")) { + typeIcon.setImageResource(R.drawable.retog); + } else if (trainNumber.substring(0,1).equalsIgnoreCase("l")) { + typeIcon.setImageResource(R.drawable.lyntog); + } else if (trainNumber.substring(0,2).equalsIgnoreCase("ic")) { + typeIcon.setImageResource(R.drawable.ictog); + } else if (trainNumber.substring(0,2).equalsIgnoreCase("pp")) { + typeIcon.setImageResource(R.drawable.pptog); + } + } else { + //if each line needs seperate icons, switch on the first(and only( character + typeIcon.setImageResource(R.drawable.stog); + } + + return root; }