From 869e423c93efc7b7d670ab405649c89ccc53c43f Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:29:18 -0400 Subject: [PATCH 01/24] Chore[COMP354-87]: Branch changes --- .../opentracks/util/IntentDashboardUtils.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java index f5dfdbc9b..06c77ab21 100644 --- a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java +++ b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java @@ -12,6 +12,9 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; +import org.json.JSONException; +import org.json.JSONObject; + import java.util.ArrayList; import java.util.Map; import java.util.Set; @@ -38,6 +41,8 @@ public class IntentDashboardUtils { private static final String ACTION_DASHBOARD = "Intent.OpenTracks-Dashboard"; private static final String ACTION_DASHBOARD_PAYLOAD = ACTION_DASHBOARD + ".Payload"; + private static final String ACTION_DASHBOARD_OVERALL_SKI_PAYLOAD = ACTION_DASHBOARD + ".Overall-Ski-Payload"; + private static final String ACTION_DASHBOARD_OVERALL_SKI_URIS = ACTION_DASHBOARD + ".Overall-Ski-URIs"; public static final TrackFileFormat[] SHOW_ON_MAP_TRACK_FILE_FORMATS = new TrackFileFormat[] { TrackFileFormat.KMZ_WITH_TRACKDETAIL_AND_SENSORDATA_AND_PICTURES, @@ -184,6 +189,55 @@ public static void startDashboard(Context context, boolean isRecording, @Nullabl } } + public static void startOverallSeasonDashboard(Context context, String seasonIDList) throws JSONException { + /* + * The call to this util method would likely be defined in a new view page through an options + * menu callback event. + * + * One such possibility would be in the aggregated stats page where a ski group could have + * a map icon similar to the one in recorded track details. + */ + + /* + * Here is where we'd use our service functions to get the metrics required for OSM to be able + * render runs as well as showcase the accumulated stats (Num. runs, KMs covered, vert, ...). + * + * It would also inform us on what local db connection strings to pass over. + */ + + // Would need to populate this with data once the service functions are created + JSONObject overallSeasonStatsJSONPayload = new JSONObject(); + overallSeasonStatsJSONPayload.put("Seasons", new Object()); + // ... + + ArrayList uris = new ArrayList<>(); + uris.add(0, Uri.withAppendedPath(Uri.parse("{Some URI...}"), seasonIDList)); + // ... + + Intent intent = new Intent(ACTION_DASHBOARD); + intent.putExtra(EXTRAS_PROTOCOL_VERSION, CURRENT_VERSION); + intent.putExtra(ACTION_DASHBOARD_OVERALL_SKI_PAYLOAD, overallSeasonStatsJSONPayload.toString()); + intent.putParcelableArrayListExtra(ACTION_DASHBOARD_OVERALL_SKI_URIS, uris); + intent.putExtra(EXTRAS_SHOULD_KEEP_SCREEN_ON, PreferencesUtils.shouldKeepScreenOn()); + intent.putExtra(EXTRAS_SHOW_WHEN_LOCKED, PreferencesUtils.shouldShowStatsOnLockscreen()); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + + // Here we'd have to know what connection strings we are passing over to allow OSM to read data + ClipData clipData = ClipData.newRawUri(null, uris.get(0)); + clipData.addItem(new ClipData.Item(uris.get(1))); + // ... + intent.setClipData(clipData); + + Log.i(TAG, "[IntentDashboardUtils/startOverallSeasonDashboard] -- Starting Overall Ski Season activity with generic intent."); + + try { + context.startActivity(intent); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "[IntentDashboardUtils/startOverallSeasonDashboard] -- Dashboard not installed; cannot start it."); + Toast.makeText(context, R.string.show_on_dashboard_not_installed, Toast.LENGTH_SHORT).show(); + } + } + /** * Send intent to show tracks on a map (needs an another app) to support specific trackFileFormat. * From 1359d816bcdaaa227d9a42fd75af8cd905adb198 Mon Sep 17 00:00:00 2001 From: Kpytoo Date: Thu, 21 Mar 2024 12:44:15 -0400 Subject: [PATCH 02/24] Created a SeasonalStatistics class concerning service functions that will aggregate overall season stats. --- .../opentracks/stats/SeasonalStatistics.java | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java diff --git a/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java new file mode 100644 index 000000000..7e7d5bd8d --- /dev/null +++ b/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java @@ -0,0 +1,98 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package de.dennisguse.opentracks.stats; + + +import de.dennisguse.opentracks.data.models.Distance; +import de.dennisguse.opentracks.data.models.Speed; + +public class SeasonalStatistics { + + // The total number of runs in a season. + private int totalRunsSeason; + + // The total number of days skied in a season. + private int totalSkiDaysSeason; + + // The total distance skied (consider all tracks) in a season. + private Distance totalTrackDistanceSeason; + + // The total distance covered while in vertical descents in a season. + private Distance totalVerticalDescentSeason; + + // The average speed in a season. + private Speed avgSpeedSeason; + + // The slope percentage in a season. + private double slopePercentageSeason; + + + + public int getTotalRunsSeason(){ + return this.totalRunsSeason; + } + + public void setTotalRunsSeason(int totalRunsSeason){ + this.totalRunsSeason = totalRunsSeason; + } + + + public int getTotalSkiDaysSeason(){ + return this.totalSkiDaysSeason; + } + + public void setTotalSkiDaysSeason(int totalSkiDaysSeason){ + this.totalSkiDaysSeason = totalSkiDaysSeason; + } + + + public Distance getTotalTrackDistanceSeason(){ + return this.totalTrackDistanceSeason; + } + + public void setTotalTrackDistanceSeason(Distance totalTrackDistanceSeason){ + this.totalTrackDistanceSeason = totalTrackDistanceSeason; + } + + + public Distance getTotalVerticalDescentSeasonSeason(){ + return this.totalVerticalDescentSeason; + } + + public void setTotalVerticalDescentSeason(Distance totalVerticalDescentSeason){ + this.totalVerticalDescentSeason = totalVerticalDescentSeason; + } + + + public Speed getAvgSpeedSeason(){ + return this.avgSpeedSeason; + } + + public void setAvgSpeedSeason(Speed avgSpeedSeason){ + this.avgSpeedSeason = avgSpeedSeason; + } + + + public double getSlopePercentageSeason(){ + return this.slopePercentageSeason; + } + + public void setSlopePercentageSeason(double slopePercentageSeason){ + this.slopePercentageSeason = slopePercentageSeason; + } + +} From 4373b10f330c4682f0e43134aa59795569f76d09 Mon Sep 17 00:00:00 2001 From: Kpytoo Date: Thu, 21 Mar 2024 17:49:53 -0400 Subject: [PATCH 03/24] Merged SeasonalStatistics.java into TrackStatistics.java --- .../opentracks/stats/SeasonalStatistics.java | 98 ------------------- .../opentracks/stats/TrackStatistics.java | 74 ++++++++++++++ 2 files changed, 74 insertions(+), 98 deletions(-) delete mode 100644 src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java diff --git a/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java deleted file mode 100644 index 7e7d5bd8d..000000000 --- a/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package de.dennisguse.opentracks.stats; - - -import de.dennisguse.opentracks.data.models.Distance; -import de.dennisguse.opentracks.data.models.Speed; - -public class SeasonalStatistics { - - // The total number of runs in a season. - private int totalRunsSeason; - - // The total number of days skied in a season. - private int totalSkiDaysSeason; - - // The total distance skied (consider all tracks) in a season. - private Distance totalTrackDistanceSeason; - - // The total distance covered while in vertical descents in a season. - private Distance totalVerticalDescentSeason; - - // The average speed in a season. - private Speed avgSpeedSeason; - - // The slope percentage in a season. - private double slopePercentageSeason; - - - - public int getTotalRunsSeason(){ - return this.totalRunsSeason; - } - - public void setTotalRunsSeason(int totalRunsSeason){ - this.totalRunsSeason = totalRunsSeason; - } - - - public int getTotalSkiDaysSeason(){ - return this.totalSkiDaysSeason; - } - - public void setTotalSkiDaysSeason(int totalSkiDaysSeason){ - this.totalSkiDaysSeason = totalSkiDaysSeason; - } - - - public Distance getTotalTrackDistanceSeason(){ - return this.totalTrackDistanceSeason; - } - - public void setTotalTrackDistanceSeason(Distance totalTrackDistanceSeason){ - this.totalTrackDistanceSeason = totalTrackDistanceSeason; - } - - - public Distance getTotalVerticalDescentSeasonSeason(){ - return this.totalVerticalDescentSeason; - } - - public void setTotalVerticalDescentSeason(Distance totalVerticalDescentSeason){ - this.totalVerticalDescentSeason = totalVerticalDescentSeason; - } - - - public Speed getAvgSpeedSeason(){ - return this.avgSpeedSeason; - } - - public void setAvgSpeedSeason(Speed avgSpeedSeason){ - this.avgSpeedSeason = avgSpeedSeason; - } - - - public double getSlopePercentageSeason(){ - return this.slopePercentageSeason; - } - - public void setSlopePercentageSeason(double slopePercentageSeason){ - this.slopePercentageSeason = slopePercentageSeason; - } - -} diff --git a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java index 41fa6d8e7..7b5ac71a8 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java @@ -61,6 +61,26 @@ public class TrackStatistics { // The average heart rate seen on this track private HeartRate avgHeartRate = null; + + // The total number of runs in a season. + private int totalRunsSeason; + + // The total number of days skied in a season. + private int totalSkiDaysSeason; + + // The total distance skied (consider all tracks) in a season. + private Distance totalTrackDistanceSeason; + + // The total distance covered while in vertical descents in a season. + private Distance totalVerticalDescentSeason; + + // The average speed in a season. + private Speed avgSpeedSeason; + + // The slope percentage in a season. + private double slopePercentageSeason; + + private boolean isIdle; public TrackStatistics() { @@ -375,6 +395,60 @@ public void addTotalAltitudeLoss(float loss_m) { totalAltitudeLoss_m += loss_m; } + + public int getTotalRunsSeason(){ + return this.totalRunsSeason; + } + + public void setTotalRunsSeason(int totalRunsSeason){ + this.totalRunsSeason = totalRunsSeason; + } + + + public int getTotalSkiDaysSeason(){ + return this.totalSkiDaysSeason; + } + + public void setTotalSkiDaysSeason(int totalSkiDaysSeason){ + this.totalSkiDaysSeason = totalSkiDaysSeason; + } + + + public Distance getTotalTrackDistanceSeason(){ + return this.totalTrackDistanceSeason; + } + + public void setTotalTrackDistanceSeason(Distance totalTrackDistanceSeason){ + this.totalTrackDistanceSeason = totalTrackDistanceSeason; + } + + + public Distance getTotalVerticalDescentSeasonSeason(){ + return this.totalVerticalDescentSeason; + } + + public void setTotalVerticalDescentSeason(Distance totalVerticalDescentSeason){ + this.totalVerticalDescentSeason = totalVerticalDescentSeason; + } + + + public Speed getAvgSpeedSeason(){ + return this.avgSpeedSeason; + } + + public void setAvgSpeedSeason(Speed avgSpeedSeason){ + this.avgSpeedSeason = avgSpeedSeason; + } + + + public double getSlopePercentageSeason(){ + return this.slopePercentageSeason; + } + + public void setSlopePercentageSeason(double slopePercentageSeason){ + this.slopePercentageSeason = slopePercentageSeason; + } + @Override public boolean equals(Object o) { if (this == o) return true; From d6b9d4b82157ed50b6703dfd785139adb5eacc35 Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:45:33 -0400 Subject: [PATCH 04/24] Revert "Merged SeasonalStatistics.java into TrackStatistics.java" This reverts commit 4373b10f330c4682f0e43134aa59795569f76d09. --- .../opentracks/stats/SeasonalStatistics.java | 98 +++++++++++++++++++ .../opentracks/stats/TrackStatistics.java | 74 -------------- 2 files changed, 98 insertions(+), 74 deletions(-) create mode 100644 src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java diff --git a/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java new file mode 100644 index 000000000..7e7d5bd8d --- /dev/null +++ b/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java @@ -0,0 +1,98 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package de.dennisguse.opentracks.stats; + + +import de.dennisguse.opentracks.data.models.Distance; +import de.dennisguse.opentracks.data.models.Speed; + +public class SeasonalStatistics { + + // The total number of runs in a season. + private int totalRunsSeason; + + // The total number of days skied in a season. + private int totalSkiDaysSeason; + + // The total distance skied (consider all tracks) in a season. + private Distance totalTrackDistanceSeason; + + // The total distance covered while in vertical descents in a season. + private Distance totalVerticalDescentSeason; + + // The average speed in a season. + private Speed avgSpeedSeason; + + // The slope percentage in a season. + private double slopePercentageSeason; + + + + public int getTotalRunsSeason(){ + return this.totalRunsSeason; + } + + public void setTotalRunsSeason(int totalRunsSeason){ + this.totalRunsSeason = totalRunsSeason; + } + + + public int getTotalSkiDaysSeason(){ + return this.totalSkiDaysSeason; + } + + public void setTotalSkiDaysSeason(int totalSkiDaysSeason){ + this.totalSkiDaysSeason = totalSkiDaysSeason; + } + + + public Distance getTotalTrackDistanceSeason(){ + return this.totalTrackDistanceSeason; + } + + public void setTotalTrackDistanceSeason(Distance totalTrackDistanceSeason){ + this.totalTrackDistanceSeason = totalTrackDistanceSeason; + } + + + public Distance getTotalVerticalDescentSeasonSeason(){ + return this.totalVerticalDescentSeason; + } + + public void setTotalVerticalDescentSeason(Distance totalVerticalDescentSeason){ + this.totalVerticalDescentSeason = totalVerticalDescentSeason; + } + + + public Speed getAvgSpeedSeason(){ + return this.avgSpeedSeason; + } + + public void setAvgSpeedSeason(Speed avgSpeedSeason){ + this.avgSpeedSeason = avgSpeedSeason; + } + + + public double getSlopePercentageSeason(){ + return this.slopePercentageSeason; + } + + public void setSlopePercentageSeason(double slopePercentageSeason){ + this.slopePercentageSeason = slopePercentageSeason; + } + +} diff --git a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java index 7b5ac71a8..41fa6d8e7 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java @@ -61,26 +61,6 @@ public class TrackStatistics { // The average heart rate seen on this track private HeartRate avgHeartRate = null; - - // The total number of runs in a season. - private int totalRunsSeason; - - // The total number of days skied in a season. - private int totalSkiDaysSeason; - - // The total distance skied (consider all tracks) in a season. - private Distance totalTrackDistanceSeason; - - // The total distance covered while in vertical descents in a season. - private Distance totalVerticalDescentSeason; - - // The average speed in a season. - private Speed avgSpeedSeason; - - // The slope percentage in a season. - private double slopePercentageSeason; - - private boolean isIdle; public TrackStatistics() { @@ -395,60 +375,6 @@ public void addTotalAltitudeLoss(float loss_m) { totalAltitudeLoss_m += loss_m; } - - public int getTotalRunsSeason(){ - return this.totalRunsSeason; - } - - public void setTotalRunsSeason(int totalRunsSeason){ - this.totalRunsSeason = totalRunsSeason; - } - - - public int getTotalSkiDaysSeason(){ - return this.totalSkiDaysSeason; - } - - public void setTotalSkiDaysSeason(int totalSkiDaysSeason){ - this.totalSkiDaysSeason = totalSkiDaysSeason; - } - - - public Distance getTotalTrackDistanceSeason(){ - return this.totalTrackDistanceSeason; - } - - public void setTotalTrackDistanceSeason(Distance totalTrackDistanceSeason){ - this.totalTrackDistanceSeason = totalTrackDistanceSeason; - } - - - public Distance getTotalVerticalDescentSeasonSeason(){ - return this.totalVerticalDescentSeason; - } - - public void setTotalVerticalDescentSeason(Distance totalVerticalDescentSeason){ - this.totalVerticalDescentSeason = totalVerticalDescentSeason; - } - - - public Speed getAvgSpeedSeason(){ - return this.avgSpeedSeason; - } - - public void setAvgSpeedSeason(Speed avgSpeedSeason){ - this.avgSpeedSeason = avgSpeedSeason; - } - - - public double getSlopePercentageSeason(){ - return this.slopePercentageSeason; - } - - public void setSlopePercentageSeason(double slopePercentageSeason){ - this.slopePercentageSeason = slopePercentageSeason; - } - @Override public boolean equals(Object o) { if (this == o) return true; From 8adaeca77988d0dd3920370298bd455d636d698e Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Fri, 22 Mar 2024 12:12:53 -0400 Subject: [PATCH 05/24] Task[COMP354-87]: Use new class for aggregated stats --- .../dennisguse/opentracks/util/IntentDashboardUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java index 06c77ab21..384fc33cb 100644 --- a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java +++ b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java @@ -29,6 +29,7 @@ import de.dennisguse.opentracks.data.tables.TracksColumns; import de.dennisguse.opentracks.io.file.TrackFileFormat; import de.dennisguse.opentracks.settings.PreferencesUtils; +import de.dennisguse.opentracks.stats.SeasonalStatistics; /** * Create an {@link Intent} to request showing tracks on a Map or a Dashboard. @@ -205,10 +206,12 @@ public static void startOverallSeasonDashboard(Context context, String seasonIDL * It would also inform us on what local db connection strings to pass over. */ + // Retrieve the singleton (when it's put in place) + SeasonalStatistics allTimeStats = new SeasonalStatistics(); + // Would need to populate this with data once the service functions are created JSONObject overallSeasonStatsJSONPayload = new JSONObject(); - overallSeasonStatsJSONPayload.put("Seasons", new Object()); - // ... + overallSeasonStatsJSONPayload.put("All-Time Overall Stats", allTimeStats); ArrayList uris = new ArrayList<>(); uris.add(0, Uri.withAppendedPath(Uri.parse("{Some URI...}"), seasonIDList)); From 64bb84574302e9a23da47ce92317f9b333bfbe2c Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Fri, 22 Mar 2024 12:58:17 -0400 Subject: [PATCH 06/24] Feat[COMP354-87]: Integrate a rudimentary map event handler --- .../AggregatedStatisticsActivity.java | 20 ++++++++++++++++++- src/main/res/menu/aggregated_statistics.xml | 12 ++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java index 04c0a23f3..d4c9d150d 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java @@ -1,6 +1,7 @@ package de.dennisguse.opentracks.ui.aggregatedStatistics; import android.os.Bundle; +import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -9,6 +10,8 @@ import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; +import org.json.JSONException; + import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; @@ -19,9 +22,10 @@ import de.dennisguse.opentracks.data.TrackSelection; import de.dennisguse.opentracks.data.models.Track; import de.dennisguse.opentracks.databinding.AggregatedStatsBinding; +import de.dennisguse.opentracks.util.IntentDashboardUtils; public class AggregatedStatisticsActivity extends AbstractActivity implements FilterDialogFragment.FilterDialogListener { - + private static final String TAG = AggregatedStatisticsActivity.class.getSimpleName(); public static final String EXTRA_TRACK_IDS = "track_ids"; static final String STATE_ARE_FILTERS_APPLIED = "areFiltersApplied"; @@ -36,6 +40,7 @@ public class AggregatedStatisticsActivity extends AbstractActivity implements Fi private boolean areFiltersApplied; private MenuItem filterItem; private MenuItem clearFilterItem; + private MenuItem mapItem; @Override protected void onCreate(Bundle savedInstanceState) { @@ -94,6 +99,7 @@ public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.aggregated_statistics, menu); clearFilterItem = menu.findItem(R.id.aggregated_statistics_clear_filter); filterItem = menu.findItem(R.id.aggregated_statistics_filter); + mapItem = menu.findItem(R.id.aggregated_statistics_map); setMenuVisibility(areFiltersApplied); return super.onCreateOptionsMenu(menu); } @@ -113,6 +119,18 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) { return true; } + if (item.getItemId() == R.id.aggregated_statistics_map) { + try { + IntentDashboardUtils.startOverallSeasonDashboard(this, ""); + return true; + } + catch (JSONException exc) { + Log.e(TAG, + "[AggregatedStatisticsActivity/onOptionsItemSelected] -- A handled error" + + " occurred involving JSON: " + exc.getMessage()); + } + } + return super.onOptionsItemSelected(item); } diff --git a/src/main/res/menu/aggregated_statistics.xml b/src/main/res/menu/aggregated_statistics.xml index 4767247bc..f617644d9 100644 --- a/src/main/res/menu/aggregated_statistics.xml +++ b/src/main/res/menu/aggregated_statistics.xml @@ -1,12 +1,18 @@ - + + android:title="@string/menu_filter" + app:showAsAction="always" /> Date: Fri, 22 Mar 2024 16:49:48 -0400 Subject: [PATCH 07/24] Renamed SeasonalStatistics.java and its seasonal variables into OverallStatistics.java and its corresponding named variables. --- .../opentracks/stats/OverallStatistics.java | 98 +++++++++++++++++++ .../opentracks/stats/SeasonalStatistics.java | 98 ------------------- 2 files changed, 98 insertions(+), 98 deletions(-) create mode 100644 src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java delete mode 100644 src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java diff --git a/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java new file mode 100644 index 000000000..c058e2d2f --- /dev/null +++ b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java @@ -0,0 +1,98 @@ +/* + * Copyright 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package de.dennisguse.opentracks.stats; + + +import de.dennisguse.opentracks.data.models.Distance; +import de.dennisguse.opentracks.data.models.Speed; + +public class OverallStatistics { + + // The total number of all-time runs. + private int totalRunsOverall; + + // The total number of all-time days skied. + private int totalSkiDaysOverall; + + // The total all-time distance skied (consider all tracks). + private Distance totalTrackDistanceOverall; + + // The total all-time distance covered while in vertical descents. + private Distance totalVerticalDescentOverall; + + // The average all-time speed. + private Speed avgSpeedOverall; + + // The all-time slope percentage. + private double slopePercentageOverall; + + + + public int getTotalRunsOverall(){ + return this.totalRunsOverall; + } + + public void setTotalRunsOverall(int totalRunsOverall){ + this.totalRunsOverall = totalRunsOverall; + } + + + public int getTotalSkiDaysOverall(){ + return this.totalSkiDaysOverall; + } + + public void setTotalSkiDaysOverall(int totalSkiDaysOverall){ + this.totalSkiDaysOverall = totalSkiDaysOverall; + } + + + public Distance getTotalTrackDistanceOverall(){ + return this.totalTrackDistanceOverall; + } + + public void setTotalTrackDistanceOverall(Distance totalTrackDistanceOverall){ + this.totalTrackDistanceOverall = totalTrackDistanceOverall; + } + + + public Distance getTotalVerticalDescentOverall(){ + return this.totalVerticalDescentOverall; + } + + public void setTotalVerticalDescentOverall(Distance totalVerticalDescentOverall){ + this.totalVerticalDescentOverall = totalVerticalDescentOverall; + } + + + public Speed getAvgSpeedOverall(){ + return this.avgSpeedOverall; + } + + public void setAvgSpeedOverall(Speed avgSpeedOverall){ + this.avgSpeedOverall = avgSpeedOverall; + } + + + public double getSlopePercentageOverall(){ + return this.slopePercentageOverall; + } + + public void setSlopePercentageOverall(double slopePercentageOverall){ + this.slopePercentageOverall = slopePercentageOverall; + } + +} diff --git a/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java deleted file mode 100644 index 7e7d5bd8d..000000000 --- a/src/main/java/de/dennisguse/opentracks/stats/SeasonalStatistics.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package de.dennisguse.opentracks.stats; - - -import de.dennisguse.opentracks.data.models.Distance; -import de.dennisguse.opentracks.data.models.Speed; - -public class SeasonalStatistics { - - // The total number of runs in a season. - private int totalRunsSeason; - - // The total number of days skied in a season. - private int totalSkiDaysSeason; - - // The total distance skied (consider all tracks) in a season. - private Distance totalTrackDistanceSeason; - - // The total distance covered while in vertical descents in a season. - private Distance totalVerticalDescentSeason; - - // The average speed in a season. - private Speed avgSpeedSeason; - - // The slope percentage in a season. - private double slopePercentageSeason; - - - - public int getTotalRunsSeason(){ - return this.totalRunsSeason; - } - - public void setTotalRunsSeason(int totalRunsSeason){ - this.totalRunsSeason = totalRunsSeason; - } - - - public int getTotalSkiDaysSeason(){ - return this.totalSkiDaysSeason; - } - - public void setTotalSkiDaysSeason(int totalSkiDaysSeason){ - this.totalSkiDaysSeason = totalSkiDaysSeason; - } - - - public Distance getTotalTrackDistanceSeason(){ - return this.totalTrackDistanceSeason; - } - - public void setTotalTrackDistanceSeason(Distance totalTrackDistanceSeason){ - this.totalTrackDistanceSeason = totalTrackDistanceSeason; - } - - - public Distance getTotalVerticalDescentSeasonSeason(){ - return this.totalVerticalDescentSeason; - } - - public void setTotalVerticalDescentSeason(Distance totalVerticalDescentSeason){ - this.totalVerticalDescentSeason = totalVerticalDescentSeason; - } - - - public Speed getAvgSpeedSeason(){ - return this.avgSpeedSeason; - } - - public void setAvgSpeedSeason(Speed avgSpeedSeason){ - this.avgSpeedSeason = avgSpeedSeason; - } - - - public double getSlopePercentageSeason(){ - return this.slopePercentageSeason; - } - - public void setSlopePercentageSeason(double slopePercentageSeason){ - this.slopePercentageSeason = slopePercentageSeason; - } - -} From dd9eb0fd807791964cde640e188c0fcb29d85c6a Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Fri, 22 Mar 2024 19:36:50 -0400 Subject: [PATCH 08/24] Fix[COMP354-87]: Update references --- .../de/dennisguse/opentracks/util/IntentDashboardUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java index 384fc33cb..d533c09dd 100644 --- a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java +++ b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java @@ -29,7 +29,7 @@ import de.dennisguse.opentracks.data.tables.TracksColumns; import de.dennisguse.opentracks.io.file.TrackFileFormat; import de.dennisguse.opentracks.settings.PreferencesUtils; -import de.dennisguse.opentracks.stats.SeasonalStatistics; +import de.dennisguse.opentracks.stats.OverallStatistics; /** * Create an {@link Intent} to request showing tracks on a Map or a Dashboard. @@ -207,7 +207,7 @@ public static void startOverallSeasonDashboard(Context context, String seasonIDL */ // Retrieve the singleton (when it's put in place) - SeasonalStatistics allTimeStats = new SeasonalStatistics(); + OverallStatistics allTimeStats = new OverallStatistics(); // Would need to populate this with data once the service functions are created JSONObject overallSeasonStatsJSONPayload = new JSONObject(); From 685f3b396d7f800513c3115f0320b558bbe34ad4 Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Fri, 22 Mar 2024 19:38:59 -0400 Subject: [PATCH 09/24] Task[COMP354-87]: Showcase data pushed in logs --- .../de/dennisguse/opentracks/util/IntentDashboardUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java index d533c09dd..edbb8fd24 100644 --- a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java +++ b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java @@ -217,6 +217,10 @@ public static void startOverallSeasonDashboard(Context context, String seasonIDL uris.add(0, Uri.withAppendedPath(Uri.parse("{Some URI...}"), seasonIDList)); // ... + Log.i(TAG, overallSeasonStatsJSONPayload.toString()); + + Log.i(TAG, uris.toString()); + Intent intent = new Intent(ACTION_DASHBOARD); intent.putExtra(EXTRAS_PROTOCOL_VERSION, CURRENT_VERSION); intent.putExtra(ACTION_DASHBOARD_OVERALL_SKI_PAYLOAD, overallSeasonStatsJSONPayload.toString()); From 581577a944438657d41107d188cdbda8a4a15429 Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Fri, 22 Mar 2024 19:44:23 -0400 Subject: [PATCH 10/24] Feat[COMP354-87]: Default constructors until actual impls ready --- .../opentracks/stats/OverallStatistics.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java index c058e2d2f..7ef21723d 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java @@ -21,6 +21,28 @@ import de.dennisguse.opentracks.data.models.Speed; public class OverallStatistics { + public OverallStatistics() { + this.totalRunsOverall = 50; + this.totalSkiDaysOverall = 25; + this.totalTrackDistanceOverall = Distance.ofKilometer(500); + this.totalVerticalDescentOverall = Distance.ofMM(100); + this.avgSpeedOverall = Speed.ofKMH(40); + this.slopePercentageOverall = .66; + } + + public OverallStatistics(int totalRunsOverall, + int totalSkiDaysOverall, + Distance totalTrackDistanceOverall, + Distance totalVerticalDescentOverall, + Speed avgSpeedOverall, + double slopePercentageOverall) { + this.totalRunsOverall = totalRunsOverall; + this.totalSkiDaysOverall = totalSkiDaysOverall; + this.totalTrackDistanceOverall = totalTrackDistanceOverall; + this.totalVerticalDescentOverall = totalVerticalDescentOverall; + this.avgSpeedOverall = avgSpeedOverall; + this.slopePercentageOverall = slopePercentageOverall; + } // The total number of all-time runs. private int totalRunsOverall; From 826222739ef4bb2184c584fe91e3a55510ab62b1 Mon Sep 17 00:00:00 2001 From: Tristan Lafleur <70395022+Trim0500@users.noreply.github.com> Date: Fri, 22 Mar 2024 20:21:51 -0400 Subject: [PATCH 11/24] Fix[COMP354-87]: Update JSON payload --- .../opentracks/util/IntentDashboardUtils.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java index edbb8fd24..d24bc1b89 100644 --- a/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java +++ b/src/main/java/de/dennisguse/opentracks/util/IntentDashboardUtils.java @@ -211,15 +211,23 @@ public static void startOverallSeasonDashboard(Context context, String seasonIDL // Would need to populate this with data once the service functions are created JSONObject overallSeasonStatsJSONPayload = new JSONObject(); - overallSeasonStatsJSONPayload.put("All-Time Overall Stats", allTimeStats); + overallSeasonStatsJSONPayload.put("Total Runs", allTimeStats.getTotalRunsOverall()); + overallSeasonStatsJSONPayload.put("Total Days", allTimeStats.getTotalSkiDaysOverall()); + overallSeasonStatsJSONPayload.put("Total Track Distance", allTimeStats.getTotalTrackDistanceOverall().distance_m()); + overallSeasonStatsJSONPayload.put("Total Vert", allTimeStats.getTotalVerticalDescentOverall().distance_m()); + overallSeasonStatsJSONPayload.put("Average Speed", allTimeStats.getAvgSpeedOverall().toKMH()); + overallSeasonStatsJSONPayload.put("Average Slope %", allTimeStats.getSlopePercentageOverall()); ArrayList uris = new ArrayList<>(); uris.add(0, Uri.withAppendedPath(Uri.parse("{Some URI...}"), seasonIDList)); + uris.add(1, Uri.withAppendedPath(Uri.parse("{Some other URI...}"), seasonIDList)); // ... - Log.i(TAG, overallSeasonStatsJSONPayload.toString()); + Log.i(TAG, "[IntentDashboardUtils/startOverallSeasonDashboard] -- JSON Payload:\n" + + overallSeasonStatsJSONPayload.toString(4)); - Log.i(TAG, uris.toString()); + Log.i(TAG, "[IntentDashboardUtils/startOverallSeasonDashboard] -- Database connections" + + "Payload:\n" + uris); Intent intent = new Intent(ACTION_DASHBOARD); intent.putExtra(EXTRAS_PROTOCOL_VERSION, CURRENT_VERSION); From dee709af87b11649fc188c4da9052fa69c5711ca Mon Sep 17 00:00:00 2001 From: DanielCheishvili <60618343+DanielCheishvili@users.noreply.github.com> Date: Sat, 23 Mar 2024 12:56:41 -0400 Subject: [PATCH 12/24] Created mockup data in order to display on the stats view --- .../opentracks/stats/MockupData.java | 48 +++++++++++++++++++ .../AggregatedStatistics.java | 7 ++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/dennisguse/opentracks/stats/MockupData.java diff --git a/src/main/java/de/dennisguse/opentracks/stats/MockupData.java b/src/main/java/de/dennisguse/opentracks/stats/MockupData.java new file mode 100644 index 000000000..167bb1c35 --- /dev/null +++ b/src/main/java/de/dennisguse/opentracks/stats/MockupData.java @@ -0,0 +1,48 @@ +package de.dennisguse.opentracks.stats; + +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; + +import de.dennisguse.opentracks.data.models.*; + +public class MockupData { + + public List getTrackStatistics() { + List trackStatisticsArray = new ArrayList<>(); + trackStatisticsArray.add(createTrackStatistics(1000, 100, 10, 100, 10, 10, 100, 100, 10, 10, 100, 10, 100, 10, 10, false)); + trackStatisticsArray.add(createTrackStatistics(2000, 200, 20, 200, 20, 20, 200, 200, 20, 20, 200, 20, 200, 20, 20, true)); + + return trackStatisticsArray; + } + + private TrackStatistics createTrackStatistics( + double totalDistanceValue,long totalTime,double maxSpeedValue,double maxAltitudeValue,float totalAltLossValue, + float totalAltGainValue,long totalMovingTimeValue, int heartRate, long avgSpeedSeason, double slopePercentageSeason, + double totalVerticalDescentSeasonValue,int totalRunsSeasonValue, int totalSkiDaysSeasonValue, + double totalTrackingDistance,double minAltitude,boolean isIdle) { + + TrackStatistics trackStatistics = new TrackStatistics(); + trackStatistics.setTotalDistance(Distance.of(totalDistanceValue)); + trackStatistics.setTotalTime(Duration.ofSeconds(totalTime)); + trackStatistics.setMaxSpeed(new Speed(maxSpeedValue)); + trackStatistics.setMaxAltitude(maxAltitudeValue); + trackStatistics.setTotalAltitudeLoss(totalAltLossValue); + trackStatistics.setTotalAltitudeGain(totalAltGainValue); + trackStatistics.setMovingTime(Duration.ofSeconds(totalMovingTimeValue)); + trackStatistics.setAverageHeartRate(new HeartRate(heartRate)); + trackStatistics.setAvgSpeedSeason(new Speed(avgSpeedSeason)); + trackStatistics.setSlopePercentageSeason(slopePercentageSeason); + trackStatistics.setStartTime(Instant.now()); + trackStatistics.setStopTime(Instant.now()); + trackStatistics.setTotalVerticalDescentSeason(Distance.of(totalVerticalDescentSeasonValue)); + trackStatistics.setTotalRunsSeason(totalRunsSeasonValue); + trackStatistics.setTotalSkiDaysSeason(totalSkiDaysSeasonValue); + trackStatistics.setTotalTrackDistanceSeason(Distance.of(totalTrackingDistance)); + trackStatistics.setMinAltitude(minAltitude); + trackStatistics.setIdle(isIdle); + + return trackStatistics; + } +} diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java index 8de17659d..3876bf241 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java @@ -8,7 +8,9 @@ import java.util.List; import java.util.Map; +import de.dennisguse.opentracks.data.models.Speed; import de.dennisguse.opentracks.data.models.Track; +import de.dennisguse.opentracks.stats.MockupData; import de.dennisguse.opentracks.stats.TrackStatistics; public class AggregatedStatistics { @@ -21,7 +23,10 @@ public AggregatedStatistics(@NonNull List tracks) { for (Track track : tracks) { aggregate(track); } - + MockupData mockupData = new MockupData(); + List trackStatistics = mockupData.getTrackStatistics(); + int getTotalRuns = trackStatistics.get(0).getTotalRunsSeason(); + int getTotalRuns2 = trackStatistics.get(1).getTotalRunsSeason(); dataList.addAll(dataMap.values()); dataList.sort((o1, o2) -> { if (o1.getCountTracks() == o2.getCountTracks()) { From db1c3f4ce51e1cc3758deedb118aca8229d6e6a6 Mon Sep 17 00:00:00 2001 From: DanielCheishvili <60618343+DanielCheishvili@users.noreply.github.com> Date: Sat, 23 Mar 2024 13:38:31 -0400 Subject: [PATCH 13/24] Modified TrackStatistics class --- .../opentracks/stats/TrackStatistics.java | 69 +++++++++++++++++++ .../AggregatedStatistics.java | 4 +- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java index 41fa6d8e7..a9b74c4dd 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java @@ -44,6 +44,23 @@ public class TrackStatistics { // The min and max altitude (meters) seen on this track. private final ExtremityMonitor altitudeExtremities = new ExtremityMonitor(); + // The total number of runs in a season. + private int totalRunsSeason; + + // The total number of days skied in a season. + private int totalSkiDaysSeason; + + // The total distance skied (consider all tracks) in a season. + private Distance totalTrackDistanceSeason; + + // The total distance covered while in vertical descents in a season. + private Distance totalVerticalDescentSeason; + + // The average speed in a season. + private Speed avgSpeedSeason; + + // The slope percentage in a season. + private double slopePercentageSeason; // The track start time. private Instant startTime; // The track stop time. @@ -366,6 +383,58 @@ public Float getTotalAltitudeLoss() { public void setTotalAltitudeLoss(Float totalAltitudeLoss_m) { this.totalAltitudeLoss_m = totalAltitudeLoss_m; } + public int getTotalRunsSeason(){ + return this.totalRunsSeason; + } + + public void setTotalRunsSeason(int totalRunsSeason){ + this.totalRunsSeason = totalRunsSeason; + } + + + public int getTotalSkiDaysSeason(){ + return this.totalSkiDaysSeason; + } + + public void setTotalSkiDaysSeason(int totalSkiDaysSeason){ + this.totalSkiDaysSeason = totalSkiDaysSeason; + } + + + public Distance getTotalTrackDistanceSeason(){ + return this.totalTrackDistanceSeason; + } + + public void setTotalTrackDistanceSeason(Distance totalTrackDistanceSeason){ + this.totalTrackDistanceSeason = totalTrackDistanceSeason; + } + + + public Distance getTotalVerticalDescentSeasonSeason(){ + return this.totalVerticalDescentSeason; + } + + public void setTotalVerticalDescentSeason(Distance totalVerticalDescentSeason){ + this.totalVerticalDescentSeason = totalVerticalDescentSeason; + } + + + public Speed getAvgSpeedSeason(){ + return this.avgSpeedSeason; + } + + public void setAvgSpeedSeason(Speed avgSpeedSeason){ + this.avgSpeedSeason = avgSpeedSeason; + } + + + public double getSlopePercentageSeason(){ + return this.slopePercentageSeason; + } + + public void setSlopePercentageSeason(double slopePercentageSeason){ + this.slopePercentageSeason = slopePercentageSeason; + } @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public void addTotalAltitudeLoss(float loss_m) { diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java index 3876bf241..63fc94796 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatistics.java @@ -25,8 +25,8 @@ public AggregatedStatistics(@NonNull List tracks) { } MockupData mockupData = new MockupData(); List trackStatistics = mockupData.getTrackStatistics(); - int getTotalRuns = trackStatistics.get(0).getTotalRunsSeason(); - int getTotalRuns2 = trackStatistics.get(1).getTotalRunsSeason(); + //int getTotalRuns = trackStatistics.get(0).getTotalRunsSeason(); + //int getTotalRuns2 = trackStatistics.get(1).getTotalRunsSeason(); dataList.addAll(dataMap.values()); dataList.sort((o1, o2) -> { if (o1.getCountTracks() == o2.getCountTracks()) { From e0c38acc562ee03c2b174d21c6ac590dfc79d75f Mon Sep 17 00:00:00 2001 From: Tanu Patel Date: Sat, 23 Mar 2024 15:35:34 -0400 Subject: [PATCH 14/24] intial xml file added --- src/main/res/layout/stats.xml | 282 ++++++++++++++++++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 src/main/res/layout/stats.xml diff --git a/src/main/res/layout/stats.xml b/src/main/res/layout/stats.xml new file mode 100644 index 000000000..30cf8105b --- /dev/null +++ b/src/main/res/layout/stats.xml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 0f6c59797f9e8e29df81cc168c8de6b0f5256a14 Mon Sep 17 00:00:00 2001 From: Tanu Patel Date: Sat, 23 Mar 2024 18:45:19 -0400 Subject: [PATCH 15/24] fixed errors --- src/main/res/layout/stats.xml | 350 ++++++++++++++++++++-------------- 1 file changed, 212 insertions(+), 138 deletions(-) diff --git a/src/main/res/layout/stats.xml b/src/main/res/layout/stats.xml index 30cf8105b..1cb52806f 100644 --- a/src/main/res/layout/stats.xml +++ b/src/main/res/layout/stats.xml @@ -12,271 +12,345 @@ android:id="@+id/SkiTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginStart="129dp" + android:layout_marginTop="32dp" + android:layout_marginEnd="129dp" android:text="Ski Resorts" android:textAlignment="center" android:textColor="#A43F20" android:textSize="20sp" android:textStyle="bold" - tools:layout_editor_absoluteX="129dp" - tools:layout_editor_absoluteY="16dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" tools:text="Ski Season Stats" /> + android:layout_marginStart="67dp" + android:text="#value#" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/LongestTrackId" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/MostRunsId" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/mostRunsId" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView5" /> + android:layout_marginTop="1dp" + android:layout_marginEnd="67dp" + android:text="#value#" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView4" /> + android:layout_marginEnd="60dp" + android:text="#value#" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/AvgSpeedId" /> + android:layout_marginStart="67dp" + android:text="#value#" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView7" /> + android:layout_marginTop="2dp" + android:layout_marginEnd="60dp" + android:text="#value#" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/AvgSlopeId" /> + android:layout_marginStart="183dp" + android:layout_marginEnd="177dp" + android:text="#value#" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/FavoriteLiftId" /> + android:layout_marginStart="183dp" + android:layout_marginTop="1dp" + android:layout_marginEnd="177dp" + android:text="#value#" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/FiveMostUsedLiftsId" /> + android:layout_marginEnd="78dp" + android:text="#value#" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/StepestTestId" /> + android:layout_marginStart="67dp" + android:layout_marginTop="1dp" + android:text="#value#" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/TallestTrackId" /> + android:layout_marginStart="180dp" + android:layout_marginTop="1dp" + android:layout_marginEnd="180dp" + android:text="#value#" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/MostCommonResortsId" /> + + + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/OverallRecordsTitle" /> + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/mostCommonResortsId" /> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/totalRunsId" /> + android:layout_marginTop="10dp" + android:layout_marginEnd="52dp" + android:text="Avg Speed" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/totalVertId" /> + android:layout_marginStart="42dp" + android:layout_marginTop="8dp" + android:text="Total Track Dist." + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/skiDaysId" /> + android:layout_marginTop="10dp" + android:layout_marginEnd="54dp" + android:text="Avg Slope" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/avgSpeedId" /> + android:layout_marginStart="168dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="167dp" + android:text="Favorite Lift" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView2" /> + android:layout_marginStart="154dp" + android:layout_marginTop="23dp" + android:layout_marginEnd="146dp" + android:text="5 Most Used Lifts" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/favoriteLiftId" /> + android:layout_marginStart="137dp" + android:layout_marginTop="36dp" + android:layout_marginEnd="127dp" + android:text="Most Common Resorts" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/fiveUsedLiftsId" /> + android:layout_marginStart="46dp" + android:layout_marginTop="303dp" + android:text="Longest Track" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/totalTrackDistId" /> + android:layout_marginTop="8dp" + android:layout_marginEnd="44dp" + android:text="Most Runs in a Day" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView3" /> + android:layout_marginStart="47dp" + android:layout_marginTop="30dp" + android:text="Tallest Track" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/longestTrackId" /> \ No newline at end of file From ee46dd06ed6fd7e9d794a9aa113c6ab59188ea9d Mon Sep 17 00:00:00 2001 From: Tanu Patel Date: Sat, 23 Mar 2024 19:50:08 -0400 Subject: [PATCH 16/24] temp stats page --- src/main/AndroidManifest.xml | 12 ++++++++++++ src/main/java/de/dennisguse/opentracks/Stats.java | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/main/java/de/dennisguse/opentracks/Stats.java diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index c0b67324d..18f4c278a 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -77,6 +77,17 @@ limitations under the License. android:supportsRtl="true" android:theme="@style/OpenTracksTheme"> + + + + + + + + + + + diff --git a/src/main/java/de/dennisguse/opentracks/Stats.java b/src/main/java/de/dennisguse/opentracks/Stats.java new file mode 100644 index 000000000..fb8008413 --- /dev/null +++ b/src/main/java/de/dennisguse/opentracks/Stats.java @@ -0,0 +1,14 @@ +package de.dennisguse.opentracks; + +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; + +public class Stats extends AppCompatActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.stats); // This line links stats.xml with this Activity. + + } +} From ca86880204a3cbca3a32aa6a6075f0beb1824669 Mon Sep 17 00:00:00 2001 From: DanielCheishvili <60618343+DanielCheishvili@users.noreply.github.com> Date: Sat, 23 Mar 2024 23:11:26 -0400 Subject: [PATCH 17/24] Binded data to the stats view --- src/main/AndroidManifest.xml | 25 ++++++---- .../opentracks/stats/TrackStatistics.java | 36 ++++++++++++++ .../StatisticsActivity.java | 48 +++++++++++++++++++ 3 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/StatisticsActivity.java diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 18f4c278a..e8ed9b71a 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -80,10 +80,10 @@ limitations under the License. - - - - + + + + @@ -111,10 +111,10 @@ limitations under the License. android:exported="true" android:launchMode="singleTop" android:theme="@style/SplashTheme"> - - - - + + + + + + + + + + + + diff --git a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java index a9b74c4dd..4a21f6d5b 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/TrackStatistics.java @@ -22,6 +22,7 @@ import java.time.Duration; import java.time.Instant; +import java.util.List; import de.dennisguse.opentracks.data.models.Altitude; import de.dennisguse.opentracks.data.models.Distance; @@ -444,6 +445,41 @@ public void addTotalAltitudeLoss(float loss_m) { totalAltitudeLoss_m += loss_m; } + public static TrackStatistics sumOfTotalStats(List trackStatistics) + { + TrackStatistics sum = new TrackStatistics(); + + int totalRuns = 0; + int totalSkiDays = 0; + Distance totalTrackDistance = Distance.of(0); + Distance totalVerticalDescent = Distance.of(0); + double totalAvgSpeed = 0; + double totalSlopePercentage = 0; + + for(TrackStatistics trackStat : trackStatistics) + { + totalRuns += trackStat.getTotalRunsSeason(); + totalSkiDays += trackStat.getTotalSkiDaysSeason(); + totalTrackDistance = totalTrackDistance.plus(trackStat.getTotalTrackDistanceSeason()); + totalVerticalDescent = totalVerticalDescent.plus(trackStat.getTotalVerticalDescentSeasonSeason()); + totalAvgSpeed += trackStat.getAvgSpeedSeason().speed_mps(); + totalSlopePercentage += trackStat.getSlopePercentageSeason(); + } + + int numTracks = trackStatistics.size(); + totalAvgSpeed /= numTracks; + totalSlopePercentage /= numTracks; + + sum.setTotalRunsSeason(totalRuns); + sum.setTotalSkiDaysSeason(totalSkiDays); + sum.setTotalTrackDistanceSeason(totalTrackDistance); + sum.setTotalVerticalDescentSeason(totalVerticalDescent); + sum.setAvgSpeedSeason(Speed.of(totalAvgSpeed)); + sum.setSlopePercentageSeason(totalSlopePercentage); + + return sum; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/StatisticsActivity.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/StatisticsActivity.java new file mode 100644 index 000000000..a86f72654 --- /dev/null +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/StatisticsActivity.java @@ -0,0 +1,48 @@ +package de.dennisguse.opentracks.ui.aggregatedStatistics; + +import android.os.Bundle; +import android.view.View; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import java.util.List; + +import de.dennisguse.opentracks.AbstractActivity; +import de.dennisguse.opentracks.R; +import de.dennisguse.opentracks.stats.MockupData; +import de.dennisguse.opentracks.stats.TrackStatistics; +import de.dennisguse.opentracks.databinding.StatsBinding; + +public class StatisticsActivity extends AppCompatActivity { + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.stats); + + MockupData mockupData = new MockupData(); + List trackStatistics = mockupData.getTrackStatistics(); + TrackStatistics summary = TrackStatistics.sumOfTotalStats(trackStatistics); + TextView totalDistance = findViewById(R.id.totalTrackDistId); + TextView totalVert = findViewById(R.id.totalVertId); + TextView skiDays = findViewById(R.id.skiDaysId); + TextView totalRuns = findViewById(R.id.totalRunsId); + TextView avgSpeed = findViewById(R.id.avgSpeedId); + TextView avgSlp = findViewById(R.id.avgSlopeId); + + totalDistance.setText((summary.getTotalTrackDistanceSeason().toM()) + "M"); + totalVert.setText(summary.getTotalVerticalDescentSeasonSeason().toM() + "M"); + skiDays.setText(String.valueOf(summary.getTotalSkiDaysSeason())); + totalRuns.setText(String.valueOf(summary.getTotalRunsSeason())); + avgSpeed.setText(summary.getAvgSpeedSeason().toKMH() + "KMH"); + avgSlp.setText((summary.getSlopePercentageSeason() + "%")); + + + + + } + + +} From c7bfeefd8ae6ca1aaf7e516851fffa58e06f8d74 Mon Sep 17 00:00:00 2001 From: Kpytoo Date: Sun, 24 Mar 2024 12:09:07 -0400 Subject: [PATCH 18/24] Created service functions for OverallStatistics --- .../opentracks/stats/OverallStatistics.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java index 7ef21723d..7066319b1 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java @@ -19,6 +19,9 @@ import de.dennisguse.opentracks.data.models.Distance; import de.dennisguse.opentracks.data.models.Speed; +import de.dennisguse.opentracks.data.models.Track; +import de.dennisguse.opentracks.stats.TrackStatistics; + public class OverallStatistics { public OverallStatistics() { @@ -117,4 +120,41 @@ public void setSlopePercentageOverall(double slopePercentageOverall){ this.slopePercentageOverall = slopePercentageOverall; } + + //The addToOverallStatistics() method is called whenever updating the overall + //statistics of a user. + public void addToOverallStatistics(TrackStatistics trackStatistics){ + calculateTotalRunsOverall(trackStatistics); + calculateTotalSkiDaysOverall(trackStatistics); + calculateTotalTrackDistanceOverall(trackStatistics); + calculateTotalVerticalDescentOverall(trackStatistics); + calculateAvgSpeedOverall(trackStatistics); + calculateSlopePercentageOverall(trackStatistics); + + } + private void calculateTotalRunsOverall(TrackStatistics trackStatistics){ + totalRunsOverall += trackStatistics.getTotalRunsSeason(); + } + + private void calculateTotalSkiDaysOverall(TrackStatistics trackStatistics){ + totalSkiDaysOverall += trackStatistics.getTotalSkiDaysSeason(); + } + + private void calculateTotalTrackDistanceOverall(TrackStatistics trackStatistics){ + totalTrackDistanceOverall.plus(trackStatistics.getTotalTrackDistanceSeason()); + } + + private void calculateTotalVerticalDescentOverall(TrackStatistics trackStatistics){ + totalVerticalDescentOverall.plus(trackStatistics.getTotalVerticalDescentSeasonSeason()); + } + + private void calculateAvgSpeedOverall(TrackStatistics trackStatistics){ + double tempAvgOverall = (Double.parseDouble(String.valueOf(avgSpeedOverall)) + Double.parseDouble(String.valueOf(trackStatistics.getAvgSpeedSeason())))/2; + avgSpeedOverall = new Speed(tempAvgOverall); + } + + private void calculateSlopePercentageOverall(TrackStatistics trackStatistics){ + slopePercentageOverall = (slopePercentageOverall + trackStatistics.getSlopePercentageSeason())/2; + + } } From 3f1438bd0bda18663783f6c2b670a1bc597182fc Mon Sep 17 00:00:00 2001 From: Zaid Minhas <61346884+ZaidMinhas@users.noreply.github.com> Date: Sun, 24 Mar 2024 14:08:25 -0400 Subject: [PATCH 19/24] Established a Singleton pattern for overall season service functions --- .../opentracks/stats/OverallStatistics.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java index 7066319b1..a02578644 100644 --- a/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java +++ b/src/main/java/de/dennisguse/opentracks/stats/OverallStatistics.java @@ -24,7 +24,11 @@ public class OverallStatistics { - public OverallStatistics() { + + // Static field that stores singleton instance + private static OverallStatistics instance; + + protected OverallStatistics() { this.totalRunsOverall = 50; this.totalSkiDaysOverall = 25; this.totalTrackDistanceOverall = Distance.ofKilometer(500); @@ -33,7 +37,7 @@ public OverallStatistics() { this.slopePercentageOverall = .66; } - public OverallStatistics(int totalRunsOverall, + protected OverallStatistics(int totalRunsOverall, int totalSkiDaysOverall, Distance totalTrackDistanceOverall, Distance totalVerticalDescentOverall, @@ -47,6 +51,22 @@ public OverallStatistics(int totalRunsOverall, this.slopePercentageOverall = slopePercentageOverall; } + // Static method that controls access to singleton instance + public static OverallStatistics getInstance(){ + if (instance == null){ + instance = new OverallStatistics(); + } + return instance; + } + + // Static method that controls access to singleton instance with parameters + public static OverallStatistics getInstance(int totalRunsOverall, int totalSkiDaysOverall, Distance totalTrackDistanceOverall, Distance totalVerticalDescentOverall, Speed avgSpeedOverall, double slopePercentageOverall){ + if (instance == null){ + instance = new OverallStatistics(totalRunsOverall, totalSkiDaysOverall, totalTrackDistanceOverall, totalVerticalDescentOverall, avgSpeedOverall, slopePercentageOverall); + } + return instance; + } + // The total number of all-time runs. private int totalRunsOverall; From 74447c26b518a660216b2ed5f8a3ba71e90cec31 Mon Sep 17 00:00:00 2001 From: Tanu Patel Date: Sun, 24 Mar 2024 18:10:24 -0400 Subject: [PATCH 20/24] Add button Link to page --- src/main/AndroidManifest.xml | 6 +----- .../AggregatedStatisticsActivity.java | 15 +++++++++++++++ .../{ => ui/aggregatedStatistics}/Stats.java | 4 +++- src/main/res/layout/aggregated_stats.xml | 6 ++++++ 4 files changed, 25 insertions(+), 6 deletions(-) rename src/main/java/de/dennisguse/opentracks/{ => ui/aggregatedStatistics}/Stats.java (78%) diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 18f4c278a..805c7d7c5 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -77,13 +77,9 @@ limitations under the License. android:supportsRtl="true" android:theme="@style/OpenTracksTheme"> - - - - - diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java index d4c9d150d..3d113cd19 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsActivity.java @@ -5,6 +5,8 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.widget.Button; +import android.content.Intent; import androidx.annotation.NonNull; import androidx.lifecycle.ViewModelProvider; @@ -42,6 +44,8 @@ public class AggregatedStatisticsActivity extends AbstractActivity implements Fi private MenuItem clearFilterItem; private MenuItem mapItem; + Button button1; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -70,6 +74,17 @@ protected void onCreate(Bundle savedInstanceState) { }); setSupportActionBar(viewBinding.bottomAppBarLayout.bottomAppBar); + + // add button to redirect to Overall statistics page. + button1 = (Button) (findViewById(R.id.StatsButtonId)); + + button1.setOnClickListener(new View.OnClickListener(){ + @Override + public void onClick(View view){ + Intent intent = new Intent(AggregatedStatisticsActivity.this, Stats.class); + startActivity(intent); + } + }); } private void checkListEmpty() { diff --git a/src/main/java/de/dennisguse/opentracks/Stats.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/Stats.java similarity index 78% rename from src/main/java/de/dennisguse/opentracks/Stats.java rename to src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/Stats.java index fb8008413..c2e47b1e7 100644 --- a/src/main/java/de/dennisguse/opentracks/Stats.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/Stats.java @@ -1,9 +1,11 @@ -package de.dennisguse.opentracks; +package de.dennisguse.opentracks.ui.aggregatedStatistics; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; +import de.dennisguse.opentracks.R; + public class Stats extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/src/main/res/layout/aggregated_stats.xml b/src/main/res/layout/aggregated_stats.xml index 9cc6d24f3..7e6092e73 100644 --- a/src/main/res/layout/aggregated_stats.xml +++ b/src/main/res/layout/aggregated_stats.xml @@ -14,6 +14,12 @@ android:layout_height="?attr/actionBarSize" app:navigationIcon="@drawable/ic_statistics_24dp" app:title="@string/menu_aggregated_statistics" /> + +