From 8a59bfe127fac273200bc38a91328dc9655fe52a Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 24 Sep 2020 11:07:28 +0300 Subject: [PATCH 1/5] Use a new arrow for track direction --- .../views/layers/geometry/GpxGeometryWay.java | 4 +-- .../geometry/GpxGeometryWayContext.java | 2 +- .../layers/geometry/GpxGeometryWayDrawer.java | 36 ++++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java index 76bee7cdf2..24d49df0b1 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java @@ -132,7 +132,7 @@ public class GpxGeometryWay extends GeometryWay { - private static final float DIRECTION_ARROW_CIRCLE_MULTIPLIER = 1.5f; - public GpxGeometryWayDrawer(GpxGeometryWayContext context) { super(context); } @@ -33,16 +30,23 @@ public class GpxGeometryWayDrawer extends GeometryWayDrawer arrowsWayStyle.getTrackWidth()) { - Paint paint = context.getPaintIcon(); - paint.setColor(arrowsWayStyle.getTrackColor()); - paint.setStrokeWidth(arrowWidth * DIRECTION_ARROW_CIRCLE_MULTIPLIER); - canvas.drawPoint(x, y, paint); - } + float newWidth = arrowsWayStyle.getTrackWidth() / 2f; + float paintH2 = bitmap.getHeight() / 2f; + float paintW2 = newWidth / 2f; + + Matrix matrix = getMatrix(); + matrix.reset(); + matrix.postScale(newWidth / bitmap.getWidth(), 1); + matrix.postRotate((float) angle, paintW2, paintH2); + matrix.postTranslate(x - paintW2, y - paintH2); + + Paint paint = context.getPaintIconCustom(); + Integer pointColor = style.getPointColor(); + paint.setColorFilter(new PorterDuffColorFilter(pointColor, PorterDuff.Mode.SRC_IN)); + canvas.drawBitmap(bitmap, matrix, paint); } - super.draw(canvas, context); } } -} +} \ No newline at end of file From 54b99404a7748688403daee90e3de140915e68e6 Mon Sep 17 00:00:00 2001 From: sergosm Date: Thu, 24 Sep 2020 11:29:08 +0300 Subject: [PATCH 2/5] '.gpx' extension --- .../SaveAsNewTrackBottomSheetDialogFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java index 231182be8b..64eee7f8ee 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java @@ -298,7 +298,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial if (folderName != null && !dir.getName().equals(folderName)) { source = new File(dir, folderName); } - source = new File(source, fileName + IndexConstants.GPX_FILE_EXT); + source = new File(source, fileName); return source; } From ef343e5423a50e9e63bf7e0484a5a5e95963a0bb Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 24 Sep 2020 13:47:22 +0200 Subject: [PATCH 3/5] Fix issue --- .../SaveAsNewTrackBottomSheetDialogFragment.java | 2 +- .../osmand/plus/routepreparationmenu/ChooseRouteFragment.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java index 64eee7f8ee..231182be8b 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java @@ -298,7 +298,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial if (folderName != null && !dir.getName().equals(folderName)) { source = new File(dir, folderName); } - source = new File(source, fileName); + source = new File(source, fileName + IndexConstants.GPX_FILE_EXT); return source; } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java index 004f5c4d2b..407f65295f 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java @@ -487,7 +487,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date()); fileName = FileUtils.createUniqueFileName(app, suggestedName, IndexConstants.GPX_INDEX_DIR, GPX_FILE_EXT); } else { - fileName = new File(paramsBuilder.getFile().path).getName(); + fileName = AndroidUtils.trimExtension(new File(paramsBuilder.getFile().path).getName()); } SaveAsNewTrackBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(), ChooseRouteFragment.this, null, fileName, From 8d70ba97feafb05b235f269d2a31236c2fe2d8cb Mon Sep 17 00:00:00 2001 From: max-klaus Date: Thu, 24 Sep 2020 15:18:07 +0300 Subject: [PATCH 4/5] Fix multi context menu npe --- .../net/osmand/plus/mapcontextmenu/MenuTitleController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java index 523ce5fef4..f676c5812e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java @@ -25,8 +25,8 @@ public abstract class MenuTitleController { private AddressLookupRequest addressLookupRequest; - protected String searchAddressStr; - protected String addressNotFoundStr; + protected String searchAddressStr = ""; + protected String addressNotFoundStr = ""; @Nullable public abstract MapActivity getMapActivity(); From 32218bb48192e155adf2326425fbb011a06b4bc9 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Thu, 24 Sep 2020 15:32:08 +0300 Subject: [PATCH 5/5] Fix SelectFileBottomSheet npe --- .../osmand/plus/measurementtool/SelectFileBottomSheet.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java b/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java index d808f8f5e6..31502bea57 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java @@ -215,7 +215,9 @@ public class SelectFileBottomSheet extends BottomSheetBehaviourDialogFragment { private void sortFileList() { List gpxInfoList = gpxInfoMap.get(selectedFolder); - sortSelected(gpxInfoList); + if (gpxInfoList != null) { + sortSelected(gpxInfoList); + } adapter.setGpxInfoList(gpxInfoList != null ? gpxInfoList : new ArrayList()); }