commit
bab68baa99
1 changed files with 23 additions and 13 deletions
|
@ -8,15 +8,6 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
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.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||||
|
@ -39,6 +30,15 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
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 {
|
public class GpxBlockStatisticsBuilder {
|
||||||
|
|
||||||
private static final Log log = PlatformUtil.getLog(GpxBlockStatisticsBuilder.class);
|
private static final Log log = PlatformUtil.getLog(GpxBlockStatisticsBuilder.class);
|
||||||
|
@ -116,12 +116,22 @@ public class GpxBlockStatisticsBuilder {
|
||||||
|
|
||||||
public void initItems() {
|
public void initItems() {
|
||||||
GPXFile gpxFile = getGPXFile();
|
GPXFile gpxFile = getGPXFile();
|
||||||
GpxDisplayItem gpxDisplayItem = getDisplayItem(gpxFile);
|
if (app == null || gpxFile == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GPXTrackAnalysis analysis = null;
|
GPXTrackAnalysis analysis = null;
|
||||||
boolean withoutGaps = true;
|
boolean withoutGaps = true;
|
||||||
if (gpxDisplayItem != null) {
|
if (gpxFile.equals(app.getSavingTrackHelper().getCurrentGpx())) {
|
||||||
analysis = gpxDisplayItem.analysis;
|
GPXFile currentGpx = app.getSavingTrackHelper().getCurrentTrack().getGpxFile();
|
||||||
withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack();
|
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) {
|
if (analysis != null) {
|
||||||
float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
|
float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance;
|
||||||
|
|
Loading…
Reference in a new issue