Change animation settings
This commit is contained in:
parent
2d44c7933d
commit
da6ea256d1
3 changed files with 31 additions and 27 deletions
|
@ -270,18 +270,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
|||
routingHelper.setFinalAndCurrentLocation(settings.getPointToNavigate(), getLastKnownLocation(), routingHelper.getCurrentGPXRoute());
|
||||
}
|
||||
|
||||
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
try {
|
||||
service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, gpsListener);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(LogUtil.TAG, "GPS location provider not available"); //$NON-NLS-1$
|
||||
}
|
||||
// try to always ask for network provide : it is faster way to find location
|
||||
try {
|
||||
service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, networkListener);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(LogUtil.TAG, "Network location provider not available"); //$NON-NLS-1$
|
||||
}
|
||||
startLocationRequests();
|
||||
|
||||
if (settings != null && settings.isLastKnownMapLocation()) {
|
||||
LatLon l = settings.getLastKnownMapLocation();
|
||||
|
@ -321,6 +310,21 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
|||
mapView.refreshMap(true);
|
||||
}
|
||||
|
||||
public void startLocationRequests() {
|
||||
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
try {
|
||||
service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, gpsListener);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(LogUtil.TAG, "GPS location provider not available"); //$NON-NLS-1$
|
||||
}
|
||||
// try to always ask for network provide : it is faster way to find location
|
||||
try {
|
||||
service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, networkListener);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(LogUtil.TAG, "Network location provider not available"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private void notRestoreRoutingMode(){
|
||||
boolean changed = settings.APPLICATION_MODE.set(settings.PREV_APPLICATION_MODE.get());
|
||||
updateApplicationModeSettings();
|
||||
|
@ -1045,9 +1049,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
service.removeUpdates(gpsListener);
|
||||
service.removeUpdates(networkListener);
|
||||
stopLocationRequests();
|
||||
|
||||
SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
|
||||
sensorMgr.unregisterListener(this);
|
||||
|
@ -1069,6 +1071,12 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
|||
OsmandPlugin.onMapActivityPause(this);
|
||||
}
|
||||
|
||||
public void stopLocationRequests() {
|
||||
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
service.removeUpdates(gpsListener);
|
||||
service.removeUpdates(networkListener);
|
||||
}
|
||||
|
||||
public void updateApplicationModeSettings(){
|
||||
int currentMapRotation = settings.ROTATE_MAP.get();
|
||||
if(currentMapRotation == OsmandSettings.ROTATE_MAP_NONE){
|
||||
|
|
|
@ -29,7 +29,6 @@ public class RouteAnimation {
|
|||
|
||||
public void startStopRouteAnimation(final RoutingHelper routingHelper,
|
||||
final MapActivity ma) {
|
||||
final LocationManager mgr = (LocationManager) ma.getSystemService(Context.LOCATION_SERVICE);
|
||||
if (!isRouteAnimating()) {
|
||||
Builder builder = new AlertDialog.Builder(ma);
|
||||
builder.setTitle("Do you want to use existing GPX file?");
|
||||
|
@ -48,7 +47,7 @@ public class RouteAnimation {
|
|||
@Override
|
||||
public boolean processResult(GPXUtilities.GPXFile result) {
|
||||
GPXRouteParams prms = new RouteProvider.GPXRouteParams(result, false, ((OsmandApplication) ma.getApplication()).getSettings());
|
||||
mgr.removeUpdates(ma.getGpsListener());
|
||||
ma.stopLocationRequests();
|
||||
startAnimationThread(routingHelper, ma, prms.points, true, speedup.getProgress() + 1);
|
||||
return true;
|
||||
}
|
||||
|
@ -60,16 +59,14 @@ public class RouteAnimation {
|
|||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
mgr.removeUpdates(ma.getGpsListener());
|
||||
ma.stopLocationRequests();
|
||||
startAnimationThread(routingHelper, ma, new ArrayList<Location>(routingHelper.getCurrentRoute()), false, 1);
|
||||
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
} else {
|
||||
mgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, ma.getGpsListener());
|
||||
// stop the animation
|
||||
stop();
|
||||
ma.startLocationRequests();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
private static final int SHOW_ZOOM_LEVEL_MSG_ID = 3;
|
||||
private static final int SHOW_ZOOM_LEVEL_DELAY = 2000;
|
||||
//private static final float ZOOM_DELTA = 1;
|
||||
private static final float ZOOM_DELTA = OsmandMapTileView.ZOOM_DELTA_1;
|
||||
|
||||
|
||||
private OsmandMapTileView view;
|
||||
|
@ -310,11 +312,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
if (view.isZooming()) {
|
||||
activity.changeZoom(view.getZoom() + 2 );
|
||||
// activity.changeZoom(view.getFloatZoom() + 2 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
activity.changeZoom(view.getZoom() + 2 * ZOOM_DELTA);
|
||||
} else {
|
||||
activity.changeZoom(view.getZoom() + 1 );
|
||||
// activity.changeZoom(view.getFloatZoom() + 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
activity.changeZoom(view.getZoom() + 1 * ZOOM_DELTA);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -323,8 +323,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
zoomOutButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.changeZoom(view.getZoom() - 1 );
|
||||
// activity.changeZoom(view.getFloatZoom() - 1 * OsmandMapTileView.ZOOM_DELTA_1 );
|
||||
activity.changeZoom(view.getFloatZoom() - 1 * ZOOM_DELTA);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue