Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/fragments/NearbyStopsFragment.java
Show First 20 Lines • Show All 502 Lines • ▼ Show 20 Lines | class ArrivalsManager implements FiveTAPIVolleyRequest.ResponseListener, Response.ErrorListener{ | ||||
public void onResponse(Palina result, QueryType type) { | public void onResponse(Palina result, QueryType type) { | ||||
//counter for requests | //counter for requests | ||||
activeRequestCount--; | activeRequestCount--; | ||||
reqSuccessCount++; | reqSuccessCount++; | ||||
final Palina palinaInMap = mStops.get(result.ID); | final Palina palinaInMap = mStops.get(result.ID); | ||||
//palina cannot be null here | //palina cannot be null here | ||||
//sorry for the brutal crash when it happens | |||||
if(palinaInMap == null) throw new IllegalStateException("Cannot get the palina from the map"); | if(palinaInMap == null) throw new IllegalStateException("Cannot get the palina from the map"); | ||||
//necessary to split the Arrivals and Details cases | //necessary to split the Arrivals and Details cases | ||||
switch (type){ | switch (type){ | ||||
case ARRIVALS: | case ARRIVALS: | ||||
palinaInMap.addInfoFromRoutes(result.queryAllRoutes()); | palinaInMap.addInfoFromRoutes(result.queryAllRoutes()); | ||||
final List<Route> possibleRoutes = routesToAdd.get(result.ID); | final List<Route> possibleRoutes = routesToAdd.get(result.ID); | ||||
if(possibleRoutes!=null) { | if(possibleRoutes!=null) { | ||||
palinaInMap.addInfoFromRoutes(possibleRoutes); | palinaInMap.addInfoFromRoutes(possibleRoutes); | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | class FragmentLocationListener implements AppLocationManager.LocationRequester{ | ||||
float accuracy = location.getAccuracy(); | float accuracy = location.getAccuracy(); | ||||
if(accuracy<60 && canStartDBQuery) { | if(accuracy<60 && canStartDBQuery) { | ||||
distance = 20; | distance = 20; | ||||
final Bundle msgBundle = new Bundle(); | final Bundle msgBundle = new Bundle(); | ||||
msgBundle.putParcelable(BUNDLE_LOCATION,location); | msgBundle.putParcelable(BUNDLE_LOCATION,location); | ||||
getLoaderManager().restartLoader(LOADER_ID,msgBundle,callbacks); | getLoaderManager().restartLoader(LOADER_ID,msgBundle,callbacks); | ||||
} | } | ||||
lastUpdateTime = System.currentTimeMillis(); | lastUpdateTime = System.currentTimeMillis(); | ||||
Log.d("LocationListener","can start loader "+ canStartDBQuery); | Log.d("BusTO: NearbyLocationListener","can start loader "+ canStartDBQuery); | ||||
} | } | ||||
@Override | @Override | ||||
public void onLocationStatusChanged(int status) { | public void onLocationStatusChanged(int status) { | ||||
switch(status){ | switch(status){ | ||||
case AppLocationManager.LOCATION_GPS_AVAILABLE: | case AppLocationManager.LOCATION_GPS_AVAILABLE: | ||||
messageTextView.setVisibility(View.GONE); | messageTextView.setVisibility(View.GONE); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 63 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