Fix #11031
This commit is contained in:
parent
130a2889c3
commit
a6bc3b9691
1 changed files with 23 additions and 13 deletions
|
@ -8,15 +8,6 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||
|
@ -39,6 +30,15 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class GpxBlockStatisticsBuilder {
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(GpxBlockStatisticsBuilder.class);
|
||||
|
@ -116,13 +116,23 @@ public class GpxBlockStatisticsBuilder {
|
|||
|
||||
public void initItems() {
|
||||
GPXFile gpxFile = getGPXFile();
|
||||
GpxDisplayItem gpxDisplayItem = getDisplayItem(gpxFile);
|
||||
if (app == null || gpxFile == null) {
|
||||
return;
|
||||
}
|
||||
GPXTrackAnalysis analysis = null;
|
||||
boolean withoutGaps = true;
|
||||
if (gpxFile.equals(app.getSavingTrackHelper().getCurrentGpx())) {
|
||||
GPXFile currentGpx = app.getSavingTrackHelper().getCurrentTrack().getGpxFile();
|
||||
analysis = currentGpx.getAnalysis(0);
|
||||
withoutGaps = !selectedGpxFile.isJoinSegments()
|
||||
&& (Algorithms.isEmpty(currentGpx.tracks) || currentGpx.tracks.get(0).generalTrack);
|
||||
} else {
|
||||
GpxDisplayItem gpxDisplayItem = getDisplayItem(gpxFile);
|
||||
if (gpxDisplayItem != null) {
|
||||
analysis = gpxDisplayItem.analysis;
|
||||
withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack();
|
||||
}
|
||||
}
|
||||
if (analysis != null) {
|
||||
float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
|
||||
float timeSpan = withoutGaps ? analysis.timeSpanWithoutGaps : analysis.timeSpan;
|
||||
|
|
Loading…
Reference in a new issue