Open synced context menu from markers

This commit is contained in:
PavelRatushny 2017-11-20 18:46:52 +02:00
parent 4c13657382
commit fd3249d42a
2 changed files with 36 additions and 3 deletions

View file

@ -13,7 +13,10 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import net.osmand.Location;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
@ -60,8 +63,22 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
return;
}
MapMarker marker = adapter.getItem(pos);
WptPt wptPt = marker.wptPt;
FavouritePoint favouritePoint = marker.favouritePoint;
Object objectToShow;
PointDescription pointDescription;
if (wptPt != null) {
pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, wptPt.name);
objectToShow = wptPt;
} else if (favouritePoint != null) {
pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, favouritePoint.getName());
objectToShow = favouritePoint;
} else {
pointDescription = marker.getPointDescription(mapActivity);
objectToShow = marker;
}
mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(),
15, marker.getPointDescription(mapActivity), true, marker);
15, pointDescription, true, objectToShow);
MapActivity.launchMapActivityMoveToTop(mapActivity);
((DialogFragment) getParentFragment()).dismiss();
}

View file

@ -23,8 +23,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import net.osmand.Location;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.data.PointDescription;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
@ -224,8 +226,22 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
Object item = adapter.getItem(pos);
if (item instanceof MapMarker) {
MapMarker marker = (MapMarker) item;
WptPt wptPt = marker.wptPt;
FavouritePoint favouritePoint = marker.favouritePoint;
Object objectToShow;
PointDescription pointDescription;
if (wptPt != null) {
pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, wptPt.name);
objectToShow = wptPt;
} else if (favouritePoint != null) {
pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, favouritePoint.getName());
objectToShow = favouritePoint;
} else {
pointDescription = marker.getPointDescription(mapActivity);
objectToShow = marker;
}
mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(),
15, marker.getPointDescription(mapActivity), true, marker);
15, pointDescription, true, objectToShow);
MapActivity.launchMapActivityMoveToTop(mapActivity);
((DialogFragment) getParentFragment()).dismiss();
}