use of com.junjunguo.pocketmaps.util.LightSensor in project PocketMaps by junjunguo.
the class NaviEngine method setNavigating.
public void setNavigating(Activity activity, boolean active) {
this.active = active;
if (active && lightSensor == null) {
lightSensor = new LightSensor(activity);
} else if ((!active) && lightSensor != null) {
lightSensor.cleanup(activity);
lightSensor = null;
}
if (naviVoice == null) {
naviVoice = new NaviVoice(activity.getApplicationContext());
}
if (active == false) {
MapHandler.getMapHandler().setCustomPointIcon(R.drawable.ic_my_location_dark_24dp);
if (pos != null) {
GeoPoint curPos = new GeoPoint(pos.getLatitude(), pos.getLongitude());
MapHandler.getMapHandler().centerPointOnMap(curPos, BEST_NAVI_ZOOM, 0, 0);
}
NaviDebugSimulator.getSimu().setSimuRun(false);
return;
}
MapHandler.getMapHandler().setCustomPointIcon(R.drawable.ic_navigation_black_24dp);
naviVoiceSpoken = false;
uiJob = UiJob.Nothing;
initFields(activity);
instructions = Navigator.getNavigator().getGhResponse().getInstructions();
resetNewInstruction();
if (instructions.size() > 0) {
startDebugSimulator(activity, false);
}
}
Aggregations