IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException: Index: 3, Size: 2 at java.util.ArrayList.get(ArrayList.java:437) at net.osmand.plus.routepreparationmenu.cards.TrackEditCard.updateContent(TrackEditCard.java:92)
This commit is contained in:
parent
64336f85de
commit
44e7bf18df
1 changed files with 22 additions and 19 deletions
|
@ -82,25 +82,28 @@ 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)
|
||||||
TextView distanceView = view.findViewById(R.id.distance);
|
if (routeParams != null)
|
||||||
TextView timeView = view.findViewById(R.id.time);
|
if (routeParams.getSelectedSegment() != -1)
|
||||||
ImageView timeIcon = view.findViewById(R.id.time_icon);
|
if (gpxFile.getNonEmptySegmentsCount() > routeParams.getSelectedSegment()) {
|
||||||
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false);
|
TextView distanceView = view.findViewById(R.id.distance);
|
||||||
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false);
|
TextView timeView = view.findViewById(R.id.time);
|
||||||
List<GPXUtilities.TrkSegment> segments = gpxFile.getNonEmptyTrkSegments(false);
|
ImageView timeIcon = view.findViewById(R.id.time_icon);
|
||||||
GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment());
|
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false);
|
||||||
double distance = TrackSelectSegmentAdapter.getDistance(segment);
|
AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false);
|
||||||
long time = TrackSelectSegmentAdapter.getSegmentTime(segment);
|
List<GPXUtilities.TrkSegment> segments = gpxFile.getNonEmptyTrkSegments(false);
|
||||||
boolean timeAvailable = time != 1;
|
GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment());
|
||||||
if (timeAvailable) {
|
double distance = TrackSelectSegmentAdapter.getDistance(segment);
|
||||||
timeView.setText(Algorithms.formatDuration((int) (time / 1000),
|
long time = TrackSelectSegmentAdapter.getSegmentTime(segment);
|
||||||
app.accessibilityEnabled()));
|
boolean timeAvailable = time != 1;
|
||||||
}
|
if (timeAvailable) {
|
||||||
AndroidUiHelper.updateVisibility(timeView, timeAvailable);
|
timeView.setText(Algorithms.formatDuration((int) (time / 1000),
|
||||||
AndroidUiHelper.updateVisibility(timeIcon, timeAvailable);
|
app.accessibilityEnabled()));
|
||||||
distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app));
|
}
|
||||||
}
|
AndroidUiHelper.updateVisibility(timeView, timeAvailable);
|
||||||
|
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