From 643abea7bce47f3bacde4a129ddda66f35fdf8f2 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Tue, 15 Aug 2017 10:28:16 +0300 Subject: [PATCH] Fab open map to track --- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 2 ++ OsmAnd/src/net/osmand/plus/activities/TrackActivity.java | 6 ++++-- .../osmand/plus/views/AddGpxPointBottomSheetHelper.java | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 24a0d625e9..1d7d3e212b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -937,6 +937,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven mapView.fitRectToMap(qr.left, qr.right, qr.top, qr.bottom, (int) qr.width(), (int) qr.height(), 0); } else if (toShow instanceof NewGpxPoint) { NewGpxPoint newGpxPoint = (NewGpxPoint) toShow; + QuadRect qr = newGpxPoint.getRect(); + mapView.fitRectToMap(qr.left, qr.right, qr.top, qr.bottom, (int) qr.width(), (int) qr.height(), 0); getMapLayers().getContextMenuLayer().enterAddGpxPointMode(newGpxPoint); } else if (toShow instanceof NewGpxLine) { NewGpxLine newGpxLine = (NewGpxLine) toShow; diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index b848b69551..829bcc4c7b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -31,7 +31,7 @@ import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.myplaces.SplitSegmentFragment; import net.osmand.plus.myplaces.TrackPointFragment; import net.osmand.plus.myplaces.TrackSegmentFragment; -import net.osmand.plus.views.AddGpxPointBottomSheetHelper; +import net.osmand.plus.views.AddGpxPointBottomSheetHelper.NewGpxPoint; import net.osmand.plus.views.controls.PagerSlidingTabStrip; import java.io.File; @@ -99,12 +99,14 @@ public class TrackActivity extends TabActivity { final OsmandSettings settings = app.getSettings(); GPXFile gpx = getGpx(); LatLon location = settings.getLastKnownMapLocation(); + QuadRect rect = getRect(); + NewGpxPoint newGpxPoint = new NewGpxPoint(gpx, pointDescription, rect); if (gpx != null && location != null) { settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), settings.getLastKnownMapZoom(), pointDescription, false, - new AddGpxPointBottomSheetHelper.NewGpxPoint(gpx, pointDescription)); + newGpxPoint); MapActivity.launchMapActivityMoveToTop(this); } diff --git a/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java b/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java index fa242d42cf..f2fc81faa7 100644 --- a/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java +++ b/OsmAnd/src/net/osmand/plus/views/AddGpxPointBottomSheetHelper.java @@ -8,6 +8,7 @@ import android.widget.TextView; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; +import net.osmand.data.QuadRect; import net.osmand.data.RotatedTileBox; import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.IconsCache; @@ -143,10 +144,12 @@ public class AddGpxPointBottomSheetHelper implements OnDismissListener { public static class NewGpxPoint { private PointDescription pointDescription; private GPXFile gpx; + private QuadRect rect; - public NewGpxPoint(GPXFile gpx, PointDescription pointDescription) { + public NewGpxPoint(GPXFile gpx, PointDescription pointDescription, QuadRect rect) { this.gpx = gpx; this.pointDescription = pointDescription; + this.rect = rect; } public GPXFile getGpx() { @@ -156,5 +159,9 @@ public class AddGpxPointBottomSheetHelper implements OnDismissListener { public PointDescription getPointDescription() { return pointDescription; } + + public QuadRect getRect() { + return rect; + } } }