Fab open map to track

This commit is contained in:
PavelRatushny 2017-08-15 10:28:16 +03:00
parent 98cff00597
commit 643abea7bc
3 changed files with 14 additions and 3 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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;
}
}
}