7 |
import android.view.View; |
import android.view.View; |
8 |
import android.view.ViewGroup; |
import android.view.ViewGroup; |
9 |
import android.widget.BaseAdapter; |
import android.widget.BaseAdapter; |
10 |
|
import android.widget.ImageView; |
11 |
import android.widget.TextView; |
import android.widget.TextView; |
12 |
|
|
13 |
public class DepartureListAdapter extends BaseAdapter { |
public class DepartureListAdapter extends BaseAdapter { |
58 |
((TextView) root.findViewById(R.id.Time)).setText(station.getTime()); |
((TextView) root.findViewById(R.id.Time)).setText(station.getTime()); |
59 |
((TextView) root.findViewById(R.id.Destination)).setText(station.getDestination()); |
((TextView) root.findViewById(R.id.Destination)).setText(station.getDestination()); |
60 |
|
|
61 |
|
if (station.getStatus().length() > 0 || station.getNote().length() > 0) { |
62 |
|
ImageView image = (ImageView) root.findViewById(R.id.InfoIcon); |
63 |
|
image.setImageResource(R.drawable.info20); |
64 |
|
} |
65 |
|
|
66 |
|
ImageView typeIcon = (ImageView) root.findViewById(R.id.TypeIcon); |
67 |
|
String trainNumber = station.getTrainNumber() + " "; //Ugly hack: Append space do simplify icon selection code |
68 |
|
|
69 |
|
if ( trainNumber.substring(0, 2).equalsIgnoreCase("ra")) { //ra = regionaltog arriva |
70 |
|
typeIcon.setImageResource(R.drawable.re); |
71 |
|
} else if ( trainNumber.substring(0, 2).equalsIgnoreCase("re")) { |
72 |
|
typeIcon.setImageResource(R.drawable.re); |
73 |
|
} else if ( trainNumber.substring(0,1).equalsIgnoreCase("l")) { |
74 |
|
typeIcon.setImageResource(R.drawable.lyn); |
75 |
|
} else if ( trainNumber.substring(0,2).equalsIgnoreCase("ic")) { |
76 |
|
typeIcon.setImageResource(R.drawable.ic); |
77 |
|
} else if ( trainNumber.substring(0,2).equalsIgnoreCase("pp")) { |
78 |
|
typeIcon.setImageResource(R.drawable.pp); |
79 |
|
} else if ( trainNumber.substring(0,2).equalsIgnoreCase("Ør")) { |
80 |
|
typeIcon.setImageResource(R.drawable.or); |
81 |
|
} else if ( trainNumber.equalsIgnoreCase("a ") ) { |
82 |
|
typeIcon.setImageResource(R.drawable.stog_a); //S-Tog: A banen #00b5f1 |
83 |
|
} else if ( trainNumber.equalsIgnoreCase("b ") ) { |
84 |
|
typeIcon.setImageResource(R.drawable.stog_b); //S-Tog:B banen #5aba52 |
85 |
|
} else if ( trainNumber.equalsIgnoreCase("bx ") ) { |
86 |
|
typeIcon.setImageResource(R.drawable.stog_bx); //S-Tog:Bx banen #a4d17d |
87 |
|
} else if ( trainNumber.equalsIgnoreCase("c ") ) { |
88 |
|
typeIcon.setImageResource(R.drawable.stog_c); //S-Tog:C banen #f89734 |
89 |
|
} else if ( trainNumber.equalsIgnoreCase("e ") ) { |
90 |
|
typeIcon.setImageResource(R.drawable.stog_e); //S-Tog:E banen #837eba |
91 |
|
} else if ( trainNumber.equalsIgnoreCase("f ") ) { |
92 |
|
typeIcon.setImageResource(R.drawable.stog_f); //S-Tog:F banen #ffc32d |
93 |
|
} else if ( trainNumber.equalsIgnoreCase("h ") ) { |
94 |
|
typeIcon.setImageResource(R.drawable.stog_h); //S-Tog:H banen #f05737 |
95 |
|
} else { |
96 |
|
typeIcon.setImageResource(R.drawable.unknown); |
97 |
|
} |
98 |
|
//Mangler: SJ=Sverige?, EC, |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
return root; |
return root; |
103 |
} |
} |