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

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/provider/XmlStationProvider.java

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

revision 391 by torben, Sat Oct 3 10:55:43 2009 UTC revision 564 by torben, Thu Jan 28 09:16:33 2010 UTC
# Line 28  public class XmlStationProvider implemen Line 28  public class XmlStationProvider implemen
28    
29          @Override          @Override
30          public boolean lookupStations(Location location) {          public boolean lookupStations(Location location) {
31                  String url = XmlUtil.SERVICE_BASE + "/LocateStations?latitude=" + location.getLatitude() + "&longitude=" + location.getLongitude();                  String url = XmlUtil.SERVICE_BASE + "/LocateStations?latitude=" + (float)location.getLatitude() + "&longitude=" + (float)location.getLongitude();
32                  Log.i("url", url);                  Log.i("url", url);
33                  return lookupStationsWorker(url);                  return lookupStationsWorker(url);
34          }          }
35                    
36          @Override          @Override
37          public boolean lookupStations(String name) {                      public boolean lookupStationsByName(String name) {              
38                                    
39          //      String url = XmlUtil.SERVICE_BASE + "/LocateStations?name=" + Uri.encode(name);          //      String url = XmlUtil.SERVICE_BASE + "/LocateStations?name=" + Uri.encode(name);
40                  String url = "";                  String url = "";
# Line 50  public class XmlStationProvider implemen Line 50  public class XmlStationProvider implemen
50          }          }
51                    
52                    
53            @Override
54            public boolean lookupStationsByIds(String ids) {
55                    String url = "";
56                    url = XmlUtil.SERVICE_BASE + "/LocateStations?list=" + ids;
57                    
58                    Log.i("url", url);
59                    return lookupStationsWorker(url);
60            }
61    
62    
63          public boolean lookupStationsWorker(String url) {          public boolean lookupStationsWorker(String url) {
64                  boolean success = false;                  boolean success = false;
65    
# Line 99  public class XmlStationProvider implemen Line 109  public class XmlStationProvider implemen
109                                                                                    
110                                          if (nodeName.equals("calcdist"))                                          if (nodeName.equals("calcdist"))
111                                                  station.setDistance( (int) Double.parseDouble(content) );                                                  station.setDistance( (int) Double.parseDouble(content) );
112                                            
113                                            if (nodeName.equals("address"))
114                                                    station.setAddress( content );
115                                            
116                                            if (nodeName.equals("regional"))
117                                                    station.setRegional( Boolean.parseBoolean(content) );
118                                            
119                                            if (nodeName.equals("strain"))
120                                                    station.setSTrain( Boolean.parseBoolean(content) );
121                                            
122                                            if (nodeName.equals("metro"))
123                                                    station.setMetro( Boolean.parseBoolean(content) );
124    
125                                  }                                  }
126                                  stations.add(station);                                                            stations.add(station);                          

Legend:
Removed from v.391  
changed lines
  Added in v.564

  ViewVC Help
Powered by ViewVC 1.1.20