From ccfcd2622ecad17bbdc35d4732a06745d9b62c51 Mon Sep 17 00:00:00 2001 From: Shivam Date: Tue, 10 Oct 2023 22:57:28 -0400 Subject: [PATCH 1/5] fix: Use of isEmpty() to check whether or not collection is empty --- src/main/java/de/dennisguse/opentracks/chart/ChartView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/chart/ChartView.java b/src/main/java/de/dennisguse/opentracks/chart/ChartView.java index a9ab2ce08..b8abe6825 100644 --- a/src/main/java/de/dennisguse/opentracks/chart/ChartView.java +++ b/src/main/java/de/dennisguse/opentracks/chart/ChartView.java @@ -854,7 +854,7 @@ private void drawPointer(Canvas canvas) { break; } } - if (firstChartValueSeries != null && chartPoints.size() > 0) { + if (firstChartValueSeries != null && !chartPoints.isEmpty()) { int dx = getX(maxX) - pointer.getIntrinsicWidth() / 2; double value = firstChartValueSeries.extractDataFromChartPoint(last); int dy = getY(firstChartValueSeries, value) - pointer.getIntrinsicHeight(); From 285cea77cb561c1dab95eb44055abaad89ca7b0f Mon Sep 17 00:00:00 2001 From: Sharon C <54977773+SecretAgentShh@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:08:24 -0400 Subject: [PATCH 2/5] Update ChartFragment.java Added @Override for method. --- src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java b/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java index bea47c7fe..c8d37a72e 100644 --- a/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java +++ b/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java @@ -185,7 +185,7 @@ public void clearTrackPoints() { }); } } - + @Override public void onSampledInTrackPoint(@NonNull TrackPoint trackPoint, @NonNull TrackStatistics trackStatistics) { if (isResumed()) { ChartPoint point = new ChartPoint(trackStatistics, trackPoint, trackPoint.getSpeed(), chartByDistance, viewBinding.chartView.getUnitSystem()); From 83928a7df07c89be0a2f0c04796664da440d60f5 Mon Sep 17 00:00:00 2001 From: Priyansh Bhuva <49712877+prjbhuva@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:06:02 -0400 Subject: [PATCH 3/5] Renamed the "markers" object at line 775 to "xAxisMarkers" as it was hiding the fielding at line 92. --- .../de/dennisguse/opentracks/chart/ChartView.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/chart/ChartView.java b/src/main/java/de/dennisguse/opentracks/chart/ChartView.java index a9ab2ce08..3e83c08ca 100644 --- a/src/main/java/de/dennisguse/opentracks/chart/ChartView.java +++ b/src/main/java/de/dennisguse/opentracks/chart/ChartView.java @@ -772,16 +772,16 @@ private double getXAxisInterval() { } private List getXAxisMarkerPositions(double interval) { - List markers = new ArrayList<>(); - markers.add(0d); + List xAxisMarkers = new ArrayList<>(); + xAxisMarkers.add(0d); for (int i = 1; i * interval < maxX; i++) { - markers.add(i * interval); + xAxisMarkers.add(i * interval); } - if (markers.size() < 2) { - markers.add(maxX); + if (xAxisMarkers.size() < 2) { + xAxisMarkers.add(maxX); } - return markers; + return xAxisMarkers; } /** From 6e8ec7a3acd01585f94e34e5ea3495ff7b48f6c2 Mon Sep 17 00:00:00 2001 From: Sharon C <54977773+SecretAgentShh@users.noreply.github.com> Date: Wed, 11 Oct 2023 22:59:49 -0400 Subject: [PATCH 4/5] Update ChartFragment.java Revoked update --- src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java b/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java index c8d37a72e..5fb1e2091 100644 --- a/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java +++ b/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java @@ -185,7 +185,7 @@ public void clearTrackPoints() { }); } } - @Override + public void onSampledInTrackPoint(@NonNull TrackPoint trackPoint, @NonNull TrackStatistics trackStatistics) { if (isResumed()) { ChartPoint point = new ChartPoint(trackStatistics, trackPoint, trackPoint.getSpeed(), chartByDistance, viewBinding.chartView.getUnitSystem()); From b82dca25bae6c784c98bd8864deeef155616dbd6 Mon Sep 17 00:00:00 2001 From: Sharon C <54977773+SecretAgentShh@users.noreply.github.com> Date: Thu, 12 Oct 2023 01:19:59 -0400 Subject: [PATCH 5/5] Added @Override --- src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java b/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java index 5fb1e2091..c8d37a72e 100644 --- a/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java +++ b/src/main/java/de/dennisguse/opentracks/chart/ChartFragment.java @@ -185,7 +185,7 @@ public void clearTrackPoints() { }); } } - + @Override public void onSampledInTrackPoint(@NonNull TrackPoint trackPoint, @NonNull TrackStatistics trackStatistics) { if (isResumed()) { ChartPoint point = new ChartPoint(trackStatistics, trackPoint, trackPoint.getSpeed(), chartByDistance, viewBinding.chartView.getUnitSystem());