Add variables

This commit is contained in:
PavelRatushny 2017-07-28 12:24:07 +03:00
parent 48e3798dde
commit 5f07cd9638

View file

@ -278,18 +278,20 @@ public class TrackSegmentFragment extends OsmAndListFragment {
imageView.setOnClickListener(new View.OnClickListener() { imageView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
WptPt pointToShow = getGpx() != null ? getGpx().findPointToShow() : null; GpxDataItem gpxDataItem = getGpxDataItem();
GPXFile gpx = getGpx();
WptPt pointToShow = gpx != null ? gpx.findPointToShow() : null;
if (pointToShow != null) { if (pointToShow != null) {
LatLon location = new LatLon(pointToShow.getLatitude(), LatLon location = new LatLon(pointToShow.getLatitude(),
pointToShow.getLongitude()); pointToShow.getLongitude());
final OsmandSettings settings = app.getSettings(); final OsmandSettings settings = app.getSettings();
String trackName = ""; String trackName = "";
if (getGpx().showCurrentTrack) { if (gpx.showCurrentTrack) {
trackName = getString(R.string.shared_string_currently_recording_track); trackName = getString(R.string.shared_string_currently_recording_track);
} else if (getGpxDataItem() != null) { } else if (gpxDataItem != null) {
trackName = getGpxDataItem().getFile().getName(); trackName = gpxDataItem.getFile().getName();
} else if (getGpx() != null) { } else {
trackName = getGpx().path; trackName = gpx.path;
} }
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
settings.getLastKnownMapZoom(), settings.getLastKnownMapZoom(),