Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/middleware/AsyncDataDownload.java
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | protected Object doInBackground(String... params) { | ||||
stopID=params[0]; //(it's a Palina) | stopID=params[0]; //(it's a Palina) | ||||
else if(lastSearchedBusStop!=null) | else if(lastSearchedBusStop!=null) | ||||
stopID = lastSearchedBusStop.ID; //(it's a Palina) | stopID = lastSearchedBusStop.ID; //(it's a Palina) | ||||
else { | else { | ||||
publishProgress(Fetcher.Result.QUERY_TOO_SHORT); | publishProgress(Fetcher.Result.QUERY_TOO_SHORT); | ||||
return null; | return null; | ||||
} | } | ||||
//Skip the FiveTAPIFetcher for the Metro Stops because it shows incomprehensible arrival times | //Skip the FiveTAPIFetcher for the Metro Stops because it shows incomprehensible arrival times | ||||
try { | |||||
if(f instanceof FiveTAPIFetcher && Integer.parseInt(stopID)>= 8200) | if (f instanceof FiveTAPIFetcher && Integer.parseInt(stopID) >= 8200) | ||||
continue; | continue; | ||||
} catch (NumberFormatException ex){ | |||||
Log.e(DEBUG_TAG, "The stop number is not a valid integer, expect failures"); | |||||
} | |||||
p= f.ReadArrivalTimesAll(stopID,res); | p= f.ReadArrivalTimesAll(stopID,res); | ||||
publishProgress(res.get()); | publishProgress(res.get()); | ||||
//if (res.get()!= Fetcher.Result.OK) | //if (res.get()!= Fetcher.Result.OK) | ||||
Log.d(DEBUG_TAG, "Arrivals fetcher: "+f+"\n\tProgress: "+res.get()); | Log.d(DEBUG_TAG, "Arrivals fetcher: "+f+"\n\tProgress: "+res.get()); | ||||
if(f instanceof FiveTAPIFetcher){ | if(f instanceof FiveTAPIFetcher){ | ||||
AtomicReference<Fetcher.Result> gres = new AtomicReference<>(); | AtomicReference<Fetcher.Result> gres = new AtomicReference<>(); | ||||
Show All 15 Lines | protected Object doInBackground(String... params) { | ||||
// searched and it's the same | // searched and it's the same | ||||
String sn = lastSearchedBusStop.getStopDisplayName(); | String sn = lastSearchedBusStop.getStopDisplayName(); | ||||
if(sn != null) { | if(sn != null) { | ||||
// "merge" Stop over Palina and we're good to go | // "merge" Stop over Palina and we're good to go | ||||
p.mergeNameFrom(lastSearchedBusStop); | p.mergeNameFrom(lastSearchedBusStop); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
p.mergeDuplicateRoutes(0); | |||||
result = p; | result = p; | ||||
//TODO: find a way to avoid overloading the user with toasts | //TODO: find a way to avoid overloading the user with toasts | ||||
break; | break; | ||||
case STOPS: | case STOPS: | ||||
StopsFinderByName finder = (StopsFinderByName) r.getAndMoveForward(); | StopsFinderByName finder = (StopsFinderByName) r.getAndMoveForward(); | ||||
List<Stop> resultList= finder.FindByName(params[0], this.res); //it's a List<Stop> | List<Stop> resultList= finder.FindByName(params[0], this.res); //it's a List<Stop> | ||||
Log.d(TAG,"Using the StopFinderByName: "+finder.getClass()); | Log.d(TAG,"Using the StopFinderByName: "+finder.getClass()); | ||||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register