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() {
update();
this.processedPointsToDisplay = gpxFile.proccessPoints();
if (this.processedPointsToDisplay.isEmpty()) {
this.processedPointsToDisplay = gpxFile.processRoutePoints();
routePoints = !this.processedPointsToDisplay.isEmpty();
List<TrkSegment> processedRoutePointsToDisplay = gpxFile.processRoutePoints();
if (!processedRoutePointsToDisplay.isEmpty()) {
this.processedPointsToDisplay.addAll(processedRoutePointsToDisplay);
routePoints = !processedRoutePointsToDisplay.isEmpty();
}
}

View file

@ -134,7 +134,6 @@ public class TrackSegmentFragment extends OsmAndListFragment {
private int defPointColor;
private Paint paintIcon;
private Bitmap pointSmall;
private GpxDisplayItem generalDisplayItem;
private ImageView imageView;
private RotatedTileBox rotatedTileBox;
@ -279,17 +278,20 @@ public class TrackSegmentFragment extends OsmAndListFragment {
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LatLon location = new LatLon(generalDisplayItem.locationStart.lat,
generalDisplayItem.locationStart.lon);
final OsmandSettings settings = app.getSettings();
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
settings.getLastKnownMapZoom(),
new PointDescription(PointDescription.POINT_TYPE_WPT, generalDisplayItem.name),
false,
getRect()
);
WptPt pointToShow = getGpx() != null ? getGpx().findPointToShow() : null;
if (pointToShow != null) {
LatLon location = new LatLon(pointToShow.getLatitude(),
pointToShow.getLongitude());
final OsmandSettings settings = app.getSettings();
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
settings.getLastKnownMapZoom(),
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);
@ -489,15 +491,17 @@ public class TrackSegmentFragment extends OsmAndListFragment {
}
public void updateSplitView() {
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked(), false);
final List<GpxDisplayGroup> groups = getDisplayGroups();
if (groups.size() > 0) {
updateSplit(groups, ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked() ? sf : null);
if (getGpxDataItem() != null) {
updateSplitInDatabase();
if (getGpx() != null) {
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked(), false);
final List<GpxDisplayGroup> groups = getDisplayGroups();
if (groups.size() > 0) {
updateSplit(groups, ((SwitchCompat)headerView.findViewById(R.id.showOnMapToggle)).isChecked() ? sf : null);
if (getGpxDataItem() != null) {
updateSplitInDatabase();
}
}
updateSplitIntervalView(headerView.findViewById(R.id.split_interval_view));
}
updateSplitIntervalView(headerView.findViewById(R.id.split_interval_view));
}
private void refreshTrackBitmap() {
@ -856,9 +860,6 @@ public class TrackSegmentFragment extends OsmAndListFragment {
pager = (WrapContentHeightViewPager) row.findViewById(R.id.pager);
}
GpxDisplayItem item = getItem(position);
if (position == 0) {
generalDisplayItem = item;
}
if (item != null) {
pager.setAdapter(new GPXItemPagerAdapter(tabLayout, item));
if (create) {