Hide track after wpt was displayed

This commit is contained in:
Alexey Kulish 2018-05-30 23:58:01 +03:00
parent b8bef71db7
commit eea8f13b10
2 changed files with 14 additions and 3 deletions

View file

@ -422,7 +422,7 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
} }
} }
private boolean isGpxFileSelected(GPXFile gpxFile) { public boolean isGpxFileSelected(GPXFile gpxFile) {
return gpxFile != null && return gpxFile != null &&
((gpxFile.showCurrentTrack && app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null) || ((gpxFile.showCurrentTrack && app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null) ||
(gpxFile.path != null && app.getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path) != null)); (gpxFile.path != null && app.getSelectedGpxHelper().getSelectedFileByPath(gpxFile.path) != null));

View file

@ -633,8 +633,19 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
} }
updateSelectionMode(actionMode); updateSelectionMode(actionMode);
} else { } else {
if (item.group.getGpx() != null) { GPXFile gpx = item.group.getGpx();
app.getSelectedGpxHelper().setGpxFileToDisplay(item.group.getGpx()); if (gpx != null) {
TrackActivity trackActivity = getTrackActivity();
if (trackActivity != null && fragmentAdapter != null) {
boolean gpxFileSelected = fragmentAdapter.isGpxFileSelected(gpx);
if (!gpxFileSelected) {
Intent intent = trackActivity.getIntent();
if (intent != null) {
intent.putExtra(TrackActivity.SHOW_TEMPORARILY, true);
}
}
}
app.getSelectedGpxHelper().setGpxFileToDisplay(gpx);
} }
final OsmandSettings settings = app.getSettings(); final OsmandSettings settings = app.getSettings();
LatLon location = new LatLon(item.locationStart.lat, item.locationStart.lon); LatLon location = new LatLon(item.locationStart.lat, item.locationStart.lon);