diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java
index 0c447be793..2b26566cf0 100644
--- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java
+++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java
@@ -67,7 +67,7 @@ public class TransportRoutePlanner {
ctx.visitedRoutesCount++;
ctx.visitedSegments.put(segment.getId(), segment);
- if (segment.getDepth() > ctx.cfg.maxNumberOfChanges) {
+ if (segment.getDepth() > ctx.cfg.maxNumberOfChanges + 1) {
continue;
}
if (segment.distFromStart > finishTime + ctx.cfg.finishTimeSeconds ||
diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutingConfiguration.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutingConfiguration.java
index 4c71e5307f..6a0bf5cd1c 100644
--- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutingConfiguration.java
+++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutingConfiguration.java
@@ -18,7 +18,7 @@ public class TransportRoutingConfiguration {
public int walkChangeRadius = 300;
- public int maxNumberOfChanges = 4;
+ public int maxNumberOfChanges = 3;
public int finishTimeSeconds = 1200;
@@ -92,7 +92,7 @@ public class TransportRoutingConfiguration {
maxRouteTime = router.getIntAttribute("maxRouteTime", maxRouteTime);
finishTimeSeconds = router.getIntAttribute("delayForAlternativesRoutes", finishTimeSeconds);
String mn = params.get("max_num_changes");
- maxNumberOfChanges = RoutingConfiguration.parseSilentInt(mn, maxNumberOfChanges);
+ maxNumberOfChanges = (int) RoutingConfiguration.parseSilentFloat(mn, maxNumberOfChanges);
walkSpeed = router.getFloatAttribute("minDefaultSpeed", this.walkSpeed * 3.6f) / 3.6f;
defaultTravelSpeed = router.getFloatAttribute("maxDefaultSpeed", this.defaultTravelSpeed * 3.6f) / 3.6f;
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 4f57cc5cbe..17e8f45f6a 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -12,6 +12,7 @@
-->
Select public transport types to avoid for navigation:
+ %s mode
Avoid transport types…
Walk
The maximum length of tag \"%s\" is 255 characters. \nPlease shorten to continue.
diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java
index 4441573263..f48b590899 100644
--- a/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java
+++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/DayNightModeAction.java
@@ -7,6 +7,7 @@ import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
+import net.osmand.plus.OsmandSettings.DayNightMode;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.quickaction.QuickAction;
@@ -20,23 +21,10 @@ public class DayNightModeAction extends QuickAction {
@Override
public void execute(MapActivity activity) {
- switch (activity.getMyApplication().getSettings().DAYNIGHT_MODE.get()){
- case DAY: {
- activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
- break;
- }
- case NIGHT: {
- activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
- break;
- }
- case AUTO: {
- activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
- break;
- }
- case SENSOR: {
- activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
- break;
- }
+ if (activity.getMyApplication().getDaynightHelper().isNightMode()) {
+ activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
+ } else {
+ activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
}
}
@@ -44,33 +32,28 @@ public class DayNightModeAction extends QuickAction {
public void drawUI(ViewGroup parent, MapActivity activity) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.quick_action_with_text, parent, false);
-
((TextView) view.findViewById(R.id.text))
.setText(R.string.quick_action_switch_day_night_descr);
-
parent.addView(view);
}
@Override
public int getIconRes(Context context) {
- if(context instanceof MapActivity) {
- switch (((MapActivity) context).getMyApplication().getSettings().DAYNIGHT_MODE.get()) {
- case NIGHT: {
- return R.drawable.ic_action_map_night;
- }
- case AUTO: {
- return R.drawable.ic_action_map_sunst;
- }
- case SENSOR: {
- return R.drawable.ic_action_map_light_sensor;
- }
- }
+ if (context instanceof MapActivity
+ && ((MapActivity) context).getMyApplication().getDaynightHelper().isNightMode()) {
+ return R.drawable.ic_action_map_day;
}
- return R.drawable.ic_action_map_day;
+ return R.drawable.ic_action_map_night;
}
@Override
public String getActionText(OsmandApplication application) {
- return application.getSettings().DAYNIGHT_MODE.get().toHumanString(application) + " Mode";
+ if (application.getDaynightHelper().isNightMode()) {
+ return String.format(application.getString(R.string.quick_action_day_night_mode),
+ DayNightMode.DAY.toHumanString(application));
+ } else {
+ return String.format(application.getString(R.string.quick_action_day_night_mode),
+ DayNightMode.NIGHT.toHumanString(application));
+ }
}
}
diff --git a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java
index 69a64a7687..5e28f1d5b9 100644
--- a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java
@@ -73,6 +73,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
private boolean isLayerOn;
private boolean nightMode;
+ private boolean currentWidgetState;
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
this.mapActivity = activity;
@@ -199,35 +200,36 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
return quickActionsWidget.getVisibility() == View.VISIBLE;
}
- /**
- * @param showWidget
- * @return true, if state was changed
- */
- public boolean setLayerState(boolean showWidget) {
- if (isWidgetVisible() == showWidget) // check if state change is needed
- return false;
+ /**
+ * @param showWidget
+ * @return true, if state was changed
+ */
+ public boolean setLayerState(boolean showWidget) {
+ currentWidgetState = showWidget;
+ if (isWidgetVisible() == showWidget) // check if state change is needed
+ return false;
updateQuickActionButton(showWidget);
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
- quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
- } else {
+ quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
+ } else {
animateWidget(showWidget);
- }
- mapActivity.updateStatusBarColor();
+ }
+ mapActivity.updateStatusBarColor();
- if (!showWidget) {
- quitMovingMarker();
- quickActionRegistry.setUpdatesListener(null);
- quickActionsWidget.setSelectionListener(null);
- } else {
- enterMovingMode(mapActivity.getMapView().getCurrentRotatedTileBox());
- quickActionsWidget.setActions(quickActionRegistry.getFilteredQuickActions());
- quickActionRegistry.setUpdatesListener(MapQuickActionLayer.this);
- quickActionsWidget.setSelectionListener(MapQuickActionLayer.this);
- }
+ if (!showWidget) {
+ quitMovingMarker();
+ quickActionRegistry.setUpdatesListener(null);
+ quickActionsWidget.setSelectionListener(null);
+ } else {
+ enterMovingMode(mapActivity.getMapView().getCurrentRotatedTileBox());
+ quickActionsWidget.setActions(quickActionRegistry.getFilteredQuickActions());
+ quickActionRegistry.setUpdatesListener(MapQuickActionLayer.this);
+ quickActionsWidget.setSelectionListener(MapQuickActionLayer.this);
+ }
- return true;
- }
+ return true;
+ }
private void animateWidget(final boolean show) {
AnimatorSet set = new AnimatorSet();
@@ -370,19 +372,19 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
return py <= quickActionsWidget.getHeight();
}
- @Override
- public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
- boolean nightMode = settings != null && settings.isNightMode();
- if (isInMovingMarkerMode()) {
- canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
- contextMarker.draw(canvas);
- }
+ @Override
+ public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
+ boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
+ if (isInMovingMarkerMode()) {
+ canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
+ contextMarker.draw(canvas);
+ }
if (this.nightMode != nightMode) {
this.nightMode = nightMode;
- updateQuickActionButton(isWidgetVisible());
+ updateQuickActionButton(currentWidgetState);
}
- setupQuickActionBtnVisibility();
- }
+ setupQuickActionBtnVisibility();
+ }
private void setupQuickActionBtnVisibility() {
MapContextMenu contextMenu = mapActivity.getContextMenu();