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

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

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

revision 237 by torben, Sat Aug 8 19:02:20 2009 UTC revision 485 by torben, Thu Oct 29 11:48:28 2009 UTC
# Line 7  import android.view.LayoutInflater; Line 7  import android.view.LayoutInflater;
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 {
# Line 57  public class DepartureListAdapter extend Line 58  public class DepartureListAdapter extend
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                            
64                            int iconID;
65                            if (station.getStatus().toLowerCase().indexOf("aflyst") > -1 ||
66                                            station.getNote().toLowerCase().indexOf("aflyst") > -1 ) {
67                                    iconID = R.drawable.warn20;
68                            } else {
69                                    iconID = R.drawable.info20;
70                            }
71                                    
72                            image.setImageResource( iconID );
73                    }
74                    
75                    ImageView typeIcon = (ImageView) root.findViewById(R.id.TypeIcon);
76                    String trainNumber = station.getTrainNumber().trim();
77                    String code = trainNumber.split(" ")[0];
78                    
79                    
80                    
81                    if ( code.equalsIgnoreCase("ra")) { //RA = regionaltog arriva
82                            typeIcon.setImageResource(R.drawable.re);
83                    } else if ( code.equalsIgnoreCase("re")) { //RE=Regionaltog
84                            typeIcon.setImageResource(R.drawable.re);
85                    } else if ( code.equalsIgnoreCase("l")) { //L=Lyn
86                            typeIcon.setImageResource(R.drawable.lyn);
87                    } else if ( code.equalsIgnoreCase("ic")) { // IC=Intercity
88                            typeIcon.setImageResource(R.drawable.ic);
89                    } else if ( code.equalsIgnoreCase("pp")) { // PP=Privatbaner (eg. odderbanen eller LokalBanen)
90                            typeIcon.setImageResource(R.drawable.pp);
91                    } else if ( code.equalsIgnoreCase("ør")) { // ØR=Øresundstog
92                            typeIcon.setImageResource(R.drawable.or);
93                    } else if ( code.equalsIgnoreCase("ec")) { // EC=EuroCity
94                            typeIcon.setImageResource(R.drawable.ec);
95                    } else if ( code.equalsIgnoreCase("sj")) { // SJ=Svenska Jernbaner
96                            typeIcon.setImageResource(R.drawable.sj);
97                    } else if ( code.equalsIgnoreCase("a") ) {
98                            typeIcon.setImageResource(R.drawable.stog_a); //S-Tog: A banen #00b5f1
99                    } else if ( code.equalsIgnoreCase("b") ) {
100                            typeIcon.setImageResource(R.drawable.stog_b); //S-Tog:B banen #5aba52
101                    } else if ( code.equalsIgnoreCase("bx") ) {
102                            typeIcon.setImageResource(R.drawable.stog_bx); //S-Tog:Bx banen #a4d17d
103                    } else if ( code.equalsIgnoreCase("c") ) {
104                            typeIcon.setImageResource(R.drawable.stog_c); //S-Tog:C banen #f89734
105                    } else if ( code.equalsIgnoreCase("e") ) {
106                            typeIcon.setImageResource(R.drawable.stog_e); //S-Tog:E banen #837eba
107                    } else if ( code.equalsIgnoreCase("f") ) {
108                            typeIcon.setImageResource(R.drawable.stog_f); //S-Tog:F banen #ffc32d
109                    } else if ( code.equalsIgnoreCase("h") ) {
110                            typeIcon.setImageResource(R.drawable.stog_h); //S-Tog:H banen #f05737
111                    }  else {
112                            typeIcon.setImageResource(R.drawable.unknown);
113                    }              
114                    
115                                    
116                  return root;                  return root;
117          }          }

Legend:
Removed from v.237  
changed lines
  Added in v.485

  ViewVC Help
Powered by ViewVC 1.1.20