use of com.junjunguo.pocketmaps.activities.MapActivity in project PocketMaps by junjunguo.
the class NaviDebugSimulator method runDelayed.
private void runDelayed(final Activity activity, final Location pLoc, final Location lastLoc, final int index) {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (debug_simulator_from_tracking && !Tracking.getTracking().isTracking()) {
debug_simulator_run = false;
}
if (!debug_simulator_run) {
return;
}
GeoPoint p = debug_simulator_points.get(index);
int newIndex = checkDistance(index, p);
p = checkP;
final MapActivity cur = ((MapActivity) activity);
pLoc.setLatitude(p.getLatitude());
pLoc.setLongitude(p.getLongitude());
float bearing = lastLoc.bearingTo(pLoc);
lastLoc.set(pLoc);
pLoc.setBearing(bearing);
pLoc.setSpeed(5.55f);
cur.onLocationChanged(pLoc);
log("Update position for Debug purpose! Lat=" + pLoc.getLatitude() + " Lon=" + pLoc.getLongitude());
if (debug_simulator_points.size() > newIndex) {
runDelayed(activity, pLoc, lastLoc, newIndex);
}
}
}, 2000);
}
Aggregations