18 |
import android.util.Log; |
import android.util.Log; |
19 |
import dk.thoerup.traininfo.DepartureBean; |
import dk.thoerup.traininfo.DepartureBean; |
20 |
import dk.thoerup.traininfo.util.DownloadUtil; |
import dk.thoerup.traininfo.util.DownloadUtil; |
21 |
|
import dk.thoerup.traininfo.util.XmlUtil; |
22 |
|
|
23 |
public class XmlDepartureProvider extends DefaultHandler implements DepartureProvider { |
public class XmlDepartureProvider extends DefaultHandler implements DepartureProvider { |
24 |
|
|
66 |
departures = new ArrayList<DepartureBean>(); |
departures = new ArrayList<DepartureBean>(); |
67 |
try |
try |
68 |
{ |
{ |
69 |
//String url = "http://t-hoerup.dk/tog/xml_display.php?stationcode="+stationCode; |
|
70 |
String url = "http://app.t-hoerup.dk/TrainInfoService/DepartureServlet?format=xml&station=" + stationID; |
String url = XmlUtil.SERVICE_BASE + "/DepartureServlet?format=xml&station=" + stationID; |
71 |
Log.i("xmlurl",url); |
Log.i("xmlurl",url); |
72 |
String doc = DownloadUtil.getContentString(url, 45000, "ISO-8859-1"); |
String doc = DownloadUtil.getContentString(url, 45000, "ISO-8859-1"); |
73 |
|
|
93 |
CacheEntry entry = departureCache.get(station); |
CacheEntry entry = departureCache.get(station); |
94 |
|
|
95 |
if (entry != null) { |
if (entry != null) { |
96 |
return Collections.unmodifiableList(entry.departures); |
return entry.departures; |
97 |
} else { |
} else { |
98 |
return new ArrayList<DepartureBean>(); |
return new ArrayList<DepartureBean>(); |
99 |
} |
} |