Merge pull request #11142 from osmandapp/IndexOutOfBoundsException
IndexOutOfBoundsException
This commit is contained in:
commit
eb5d46d441
1 changed files with 20 additions and 19 deletions
|
@ -82,25 +82,26 @@ public class TrackEditCard extends BaseCard {
|
||||||
}
|
}
|
||||||
GpxUiHelper.updateGpxInfoView(view, title, gpxInfo, dataItem, false, app);
|
GpxUiHelper.updateGpxInfoView(view, title, gpxInfo, dataItem, false, app);
|
||||||
|
|
||||||
if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null && routeParams.getSelectedSegment() != -1) {
|
if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null)
|
||||||
TextView distanceView = view.findViewById(R.id.distance);
|
if (routeParams.getSelectedSegment() != -1 && gpxFile.getNonEmptySegmentsCount() > routeParams.getSelectedSegment()) {
|
||||||
TextView timeView = view.findViewById(R.id.time);
|
TextView distanceView = view.findViewById(R.id.distance);
|
||||||
ImageView timeIcon = view.findViewById(R.id.time_icon);
|
TextView timeView = view.findViewById(R.id.time);
|
||||||
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false);
|
ImageView timeIcon = view.findViewById(R.id.time_icon);
|
||||||
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false);
|
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false);
|
||||||
List<GPXUtilities.TrkSegment> segments = gpxFile.getNonEmptyTrkSegments(false);
|
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false);
|
||||||
GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment());
|
List<GPXUtilities.TrkSegment> segments = gpxFile.getNonEmptyTrkSegments(false);
|
||||||
double distance = TrackSelectSegmentAdapter.getDistance(segment);
|
GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment());
|
||||||
long time = TrackSelectSegmentAdapter.getSegmentTime(segment);
|
double distance = TrackSelectSegmentAdapter.getDistance(segment);
|
||||||
boolean timeAvailable = time != 1;
|
long time = TrackSelectSegmentAdapter.getSegmentTime(segment);
|
||||||
if (timeAvailable) {
|
boolean timeAvailable = time != 1;
|
||||||
timeView.setText(Algorithms.formatDuration((int) (time / 1000),
|
if (timeAvailable) {
|
||||||
app.accessibilityEnabled()));
|
timeView.setText(Algorithms.formatDuration((int) (time / 1000),
|
||||||
}
|
app.accessibilityEnabled()));
|
||||||
AndroidUiHelper.updateVisibility(timeView, timeAvailable);
|
}
|
||||||
AndroidUiHelper.updateVisibility(timeIcon, timeAvailable);
|
AndroidUiHelper.updateVisibility(timeView, timeAvailable);
|
||||||
distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
AndroidUiHelper.updateVisibility(timeIcon, timeAvailable);
|
||||||
}
|
distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
||||||
|
}
|
||||||
|
|
||||||
ImageButton editButton = view.findViewById(R.id.show_on_map);
|
ImageButton editButton = view.findViewById(R.id.show_on_map);
|
||||||
editButton.setVisibility(View.VISIBLE);
|
editButton.setVisibility(View.VISIBLE);
|
||||||
|
|
Loading…
Reference in a new issue