Merge branch 'r3.3' into azimuth_6345

# Conflicts:
#	OsmAnd/res/values/strings.xml
This commit is contained in:
madwasp79 2019-03-20 13:19:08 +02:00
commit e1f1550c5d
9 changed files with 53 additions and 72 deletions

View file

@ -92,7 +92,7 @@ public class TransportRoutingConfiguration {
maxRouteTime = router.getIntAttribute("maxRouteTime", maxRouteTime); maxRouteTime = router.getIntAttribute("maxRouteTime", maxRouteTime);
finishTimeSeconds = router.getIntAttribute("delayForAlternativesRoutes", finishTimeSeconds); finishTimeSeconds = router.getIntAttribute("delayForAlternativesRoutes", finishTimeSeconds);
String mn = params.get("max_num_changes"); 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; walkSpeed = router.getFloatAttribute("minDefaultSpeed", this.walkSpeed * 3.6f) / 3.6f;
defaultTravelSpeed = router.getFloatAttribute("maxDefaultSpeed", this.defaultTravelSpeed * 3.6f) / 3.6f; defaultTravelSpeed = router.getFloatAttribute("maxDefaultSpeed", this.defaultTravelSpeed * 3.6f) / 3.6f;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View file

@ -15,6 +15,7 @@
<string name="shared_string_milliradians">Milliradians</string> <string name="shared_string_milliradians">Milliradians</string>
<string name="angular_measeurement">Angular measurement units</string> <string name="angular_measeurement">Angular measurement units</string>
<string name="angular_measeurement_descr">Change what azimuth is measured in.</string> <string name="angular_measeurement_descr">Change what azimuth is measured in.</string>
<string name="quick_action_day_night_mode">%s mode</string>
<string name="avoid_pt_types_descr">Select a public transport types you want to avoid during navigation:</string> <string name="avoid_pt_types_descr">Select a public transport types you want to avoid during navigation:</string>
<string name="avoid_pt_types">Avoid transport types…</string> <string name="avoid_pt_types">Avoid transport types…</string>
<string name="shared_string_walk">Walk</string> <string name="shared_string_walk">Walk</string>

View file

@ -63,11 +63,6 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
.setOnClickListener(new View.OnClickListener() { .setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
TargetPoint start = targetPointsHelper.getPointToStart();
if (start != null) {
targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(), start.getLongitude()),
false, 0, start.getOriginalPointDescription());
}
targetPointsHelper.setStartPoint(latLon, true, name); targetPointsHelper.setStartPoint(latLon, true, name);
dismiss(); dismiss();
} }

View file

@ -7,6 +7,7 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.DayNightMode;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickAction;
@ -20,23 +21,10 @@ public class DayNightModeAction extends QuickAction {
@Override @Override
public void execute(MapActivity activity) { public void execute(MapActivity activity) {
switch (activity.getMyApplication().getSettings().DAYNIGHT_MODE.get()){ if (activity.getMyApplication().getDaynightHelper().isNightMode()) {
case DAY: { activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT); } else {
break; activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
}
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;
}
} }
} }
@ -44,33 +32,28 @@ public class DayNightModeAction extends QuickAction {
public void drawUI(ViewGroup parent, MapActivity activity) { public void drawUI(ViewGroup parent, MapActivity activity) {
View view = LayoutInflater.from(parent.getContext()) View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.quick_action_with_text, parent, false); .inflate(R.layout.quick_action_with_text, parent, false);
((TextView) view.findViewById(R.id.text)) ((TextView) view.findViewById(R.id.text))
.setText(R.string.quick_action_switch_day_night_descr); .setText(R.string.quick_action_switch_day_night_descr);
parent.addView(view); parent.addView(view);
} }
@Override @Override
public int getIconRes(Context context) { public int getIconRes(Context context) {
if(context instanceof MapActivity) { if (context instanceof MapActivity
switch (((MapActivity) context).getMyApplication().getSettings().DAYNIGHT_MODE.get()) { && ((MapActivity) context).getMyApplication().getDaynightHelper().isNightMode()) {
case NIGHT: { return R.drawable.ic_action_map_day;
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;
}
}
} }
return R.drawable.ic_action_map_day; return R.drawable.ic_action_map_night;
} }
@Override @Override
public String getActionText(OsmandApplication application) { 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));
}
} }
} }

View file

@ -73,6 +73,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
private boolean isLayerOn; private boolean isLayerOn;
private boolean nightMode; private boolean nightMode;
private boolean currentWidgetState;
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) { public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
this.mapActivity = activity; this.mapActivity = activity;
@ -199,35 +200,36 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
return quickActionsWidget.getVisibility() == View.VISIBLE; return quickActionsWidget.getVisibility() == View.VISIBLE;
} }
/** /**
* @param showWidget * @param showWidget
* @return true, if state was changed * @return true, if state was changed
*/ */
public boolean setLayerState(boolean showWidget) { public boolean setLayerState(boolean showWidget) {
if (isWidgetVisible() == showWidget) // check if state change is needed currentWidgetState = showWidget;
return false; if (isWidgetVisible() == showWidget) // check if state change is needed
return false;
updateQuickActionButton(showWidget); updateQuickActionButton(showWidget);
if (settings.DO_NOT_USE_ANIMATIONS.get()) { if (settings.DO_NOT_USE_ANIMATIONS.get()) {
quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE); quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
} else { } else {
animateWidget(showWidget); animateWidget(showWidget);
} }
mapActivity.updateStatusBarColor(); mapActivity.updateStatusBarColor();
if (!showWidget) { if (!showWidget) {
quitMovingMarker(); quitMovingMarker();
quickActionRegistry.setUpdatesListener(null); quickActionRegistry.setUpdatesListener(null);
quickActionsWidget.setSelectionListener(null); quickActionsWidget.setSelectionListener(null);
} else { } else {
enterMovingMode(mapActivity.getMapView().getCurrentRotatedTileBox()); enterMovingMode(mapActivity.getMapView().getCurrentRotatedTileBox());
quickActionsWidget.setActions(quickActionRegistry.getFilteredQuickActions()); quickActionsWidget.setActions(quickActionRegistry.getFilteredQuickActions());
quickActionRegistry.setUpdatesListener(MapQuickActionLayer.this); quickActionRegistry.setUpdatesListener(MapQuickActionLayer.this);
quickActionsWidget.setSelectionListener(MapQuickActionLayer.this); quickActionsWidget.setSelectionListener(MapQuickActionLayer.this);
} }
return true; return true;
} }
private void animateWidget(final boolean show) { private void animateWidget(final boolean show) {
AnimatorSet set = new AnimatorSet(); AnimatorSet set = new AnimatorSet();
@ -370,19 +372,19 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
return py <= quickActionsWidget.getHeight(); return py <= quickActionsWidget.getHeight();
} }
@Override @Override
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) { public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
boolean nightMode = settings != null && settings.isNightMode(); boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
if (isInMovingMarkerMode()) { if (isInMovingMarkerMode()) {
canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight()); canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
contextMarker.draw(canvas); contextMarker.draw(canvas);
} }
if (this.nightMode != nightMode) { if (this.nightMode != nightMode) {
this.nightMode = nightMode; this.nightMode = nightMode;
updateQuickActionButton(isWidgetVisible()); updateQuickActionButton(currentWidgetState);
} }
setupQuickActionBtnVisibility(); setupQuickActionBtnVisibility();
} }
private void setupQuickActionBtnVisibility() { private void setupQuickActionBtnVisibility() {
MapContextMenu contextMenu = mapActivity.getContextMenu(); MapContextMenu contextMenu = mapActivity.getContextMenu();