From 7981e750f77f4ada2058ce9faf820f6595a35d2c Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Thu, 14 Mar 2019 16:15:22 +0200 Subject: [PATCH] pull request fixes to Issue #6140 & #6222 (cherry picked from commit c0ba5bdcfd52c6e832cbe0b1ee4cf90960b3ae1e) --- .../measurementtool/MeasurementToolFragment.java | 13 ++++++++++++- OsmAnd/src/net/osmand/plus/views/GPXLayer.java | 4 ++-- gradle.properties | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index f922548fa5..51e7111ecd 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -414,7 +414,18 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { @Override public void onClick(View v) { if (editingCtx.getPointsCount() > 0) { - addToGpx(mapActivity); + if (newGpxData!=null && newGpxData.getActionType() + == NewGpxData.ActionType.EDIT_SEGMENT && editingCtx.isInSnapToRoadMode()) { + if (mapActivity != null && measurementLayer != null) { + if (editingCtx.getPointsCount() > 0) { + openSaveAsNewTrackMenu(mapActivity); + } else { + Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show(); + } + } + } else { + addToGpx(mapActivity); + } } else { Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show(); } diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index 041038daa2..2f532636be 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -100,7 +100,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex private Paint paintTextIcon; private OsmandRenderer osmandRenderer; - + private int hsh; private GPXFile gpx; private ContextMenuLayer contextMenuLayer; @@ -217,7 +217,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex private int updatePaints(int color, boolean routePoints, boolean currentTrack, DrawSettings nightMode, RotatedTileBox tileBox) { RenderingRulesStorage rrs = view.getApplication().getRendererRegistry().getCurrentSelectedRenderer(); final boolean isNight = nightMode != null && nightMode.isNightMode(); - int hsh = calculateHash(rrs, routePoints, isNight, tileBox.getMapDensity(), tileBox.getZoom(), + hsh = calculateHash(rrs, routePoints, isNight, tileBox.getMapDensity(), tileBox.getZoom(), view.getSettings().getCustomRenderProperty(CURRENT_TRACK_COLOR_ATTR).get(), view.getSettings().getCustomRenderProperty(CURRENT_TRACK_WIDTH_ATTR).get()); if (hsh != cachedHash) { diff --git a/gradle.properties b/gradle.properties index 3bb8ab935d..5230a4c9b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit