Fix crash when tap on image in gpx overview

This commit is contained in:
PavelRatushny 2017-07-17 12:38:30 +03:00
parent 3767523c1e
commit d1de1e9be7

View file

@ -134,7 +134,6 @@ public class TrackSegmentFragment extends OsmAndListFragment {
private int defPointColor; private int defPointColor;
private Paint paintIcon; private Paint paintIcon;
private Bitmap pointSmall; private Bitmap pointSmall;
private GpxDisplayItem generalDisplayItem;
private ImageView imageView; private ImageView imageView;
private RotatedTileBox rotatedTileBox; private RotatedTileBox rotatedTileBox;
@ -279,12 +278,12 @@ 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) {
LatLon location = new LatLon(generalDisplayItem.locationStart.lat, LatLon location = new LatLon(getGpx().findPointToShow().getLatitude(),
generalDisplayItem.locationStart.lon); getGpx().findPointToShow().getLongitude());
final OsmandSettings settings = app.getSettings(); final OsmandSettings settings = app.getSettings();
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
settings.getLastKnownMapZoom(), settings.getLastKnownMapZoom(),
new PointDescription(PointDescription.POINT_TYPE_WPT, generalDisplayItem.name), new PointDescription(PointDescription.POINT_TYPE_WPT, getGpxDataItem().getFile().getName()),
false, false,
getRect() getRect()
); );
@ -856,9 +855,6 @@ public class TrackSegmentFragment extends OsmAndListFragment {
pager = (WrapContentHeightViewPager) row.findViewById(R.id.pager); pager = (WrapContentHeightViewPager) row.findViewById(R.id.pager);
} }
GpxDisplayItem item = getItem(position); GpxDisplayItem item = getItem(position);
if (position == 0) {
generalDisplayItem = item;
}
if (item != null) { if (item != null) {
pager.setAdapter(new GPXItemPagerAdapter(tabLayout, item)); pager.setAdapter(new GPXItemPagerAdapter(tabLayout, item));
if (create) { if (create) {