Merge pull request #4128 from osmandapp/pavel_branch

Fix bugs
This commit is contained in:
vshcherb 2017-07-19 11:52:02 +02:00 committed by GitHub
commit b94d781c56
2 changed files with 26 additions and 24 deletions

View file

@ -528,9 +528,10 @@ public class GpxSelectionHelper {
public void processPoints() { public void processPoints() {
update(); update();
this.processedPointsToDisplay = gpxFile.proccessPoints(); this.processedPointsToDisplay = gpxFile.proccessPoints();
if (this.processedPointsToDisplay.isEmpty()) { List<TrkSegment> processedRoutePointsToDisplay = gpxFile.processRoutePoints();
this.processedPointsToDisplay = gpxFile.processRoutePoints(); if (!processedRoutePointsToDisplay.isEmpty()) {
routePoints = !this.processedPointsToDisplay.isEmpty(); this.processedPointsToDisplay.addAll(processedRoutePointsToDisplay);
routePoints = !processedRoutePointsToDisplay.isEmpty();
} }
} }

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,17 +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) {
LatLon location = new LatLon(generalDisplayItem.locationStart.lat, WptPt pointToShow = getGpx() != null ? getGpx().findPointToShow() : null;
generalDisplayItem.locationStart.lon); if (pointToShow != null) {
final OsmandSettings settings = app.getSettings(); LatLon location = new LatLon(pointToShow.getLatitude(),
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), pointToShow.getLongitude());
settings.getLastKnownMapZoom(), final OsmandSettings settings = app.getSettings();
new PointDescription(PointDescription.POINT_TYPE_WPT, generalDisplayItem.name), settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
false, settings.getLastKnownMapZoom(),
getRect() new PointDescription(PointDescription.POINT_TYPE_WPT, getGpxDataItem().getFile().getName()),
); false,
getRect()
);
MapActivity.launchMapActivityMoveToTop(getActivity()); MapActivity.launchMapActivityMoveToTop(getActivity());
}
} }
}); });
final View splitColorView = headerView.findViewById(R.id.split_color_view); final View splitColorView = headerView.findViewById(R.id.split_color_view);
@ -489,15 +491,17 @@ public class TrackSegmentFragment extends OsmAndListFragment {
} }
public void updateSplitView() { public void updateSplitView() {
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked(), false); if (getGpx() != null) {
final List<GpxDisplayGroup> groups = getDisplayGroups(); SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked(), false);
if (groups.size() > 0) { final List<GpxDisplayGroup> groups = getDisplayGroups();
updateSplit(groups, ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked() ? sf : null); if (groups.size() > 0) {
if (getGpxDataItem() != null) { updateSplit(groups, ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked() ? sf : null);
updateSplitInDatabase(); if (getGpxDataItem() != null) {
updateSplitInDatabase();
}
} }
updateSplitIntervalView(headerView.findViewById(R.id.split_interval_view));
} }
updateSplitIntervalView(headerView.findViewById(R.id.split_interval_view));
} }
private void refreshTrackBitmap() { private void refreshTrackBitmap() {
@ -856,9 +860,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) {