Open wpt menu from TrackMenuFragment

This commit is contained in:
Vitaliy 2021-02-08 17:38:21 +02:00
parent 2f74a497d0
commit d01ff166d1
2 changed files with 11 additions and 1 deletions

View file

@ -828,7 +828,9 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
@Override @Override
protected void onHeaderClick() { protected void onHeaderClick() {
updateMenuState(); if (getCurrentMenuState() == MenuState.HEADER_ONLY) {
updateMenuState();
}
} }
private void adjustMapPosition(int y) { private void adjustMapPosition(int y) {

View file

@ -26,6 +26,8 @@ import net.osmand.AndroidUtils;
import net.osmand.Collator; import net.osmand.Collator;
import net.osmand.GPXUtilities.WptPt; import net.osmand.GPXUtilities.WptPt;
import net.osmand.OsmAndCollator; import net.osmand.OsmAndCollator;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup; import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
@ -173,6 +175,12 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O
@Override @Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
GpxDisplayItem item = adapter.getChild(groupPosition, childPosition);
if (item != null && item.locationStart != null) {
LatLon location = new LatLon(item.locationStart.lat, item.locationStart.lon);
PointDescription description = new PointDescription(PointDescription.POINT_TYPE_WPT, item.name);
mapActivity.getContextMenu().show(location, description, item.locationStart);
}
return true; return true;
} }