From 64cff1f5770f752a48e170a9cf879fb09a0c1990 Mon Sep 17 00:00:00 2001 From: yashvadaria Date: Sat, 18 Nov 2023 22:40:34 -0500 Subject: [PATCH 1/9] Changed AggregatedStatics with the Elevation Gain (UI + Controller) --- build.gradle | 4 +-- .../AggregatedStatisticsAdapter.java | 20 +++++++++-- .../res/layout/aggregated_stats_list_item.xml | 35 ++++++++++++++++++- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 8823dc5fd..01dc59700 100644 --- a/build.gradle +++ b/build.gradle @@ -21,8 +21,8 @@ apply plugin: 'org.sonarqube' sonarqube { properties { - property "sonar.projectName", "Group 8 SOEN 6431" - property "sonar.projectKey", "Group-8-SOEN-6431" + property "sonar.projectName", "Group 11 SOEN 6431" + property "sonar.projectKey", "Group-11-SOEN-6431" property "sonar.host.url", "http://localhost:9000" property "sonar.login", "sqp_7f8adc6706b839b752be96c5d687384252602ab5" } diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index 9cb2e7c8f..f8a148bb2 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -20,6 +20,7 @@ import de.dennisguse.opentracks.data.models.SpeedFormatter; import de.dennisguse.opentracks.settings.PreferencesUtils; import de.dennisguse.opentracks.settings.UnitSystem; +import de.dennisguse.opentracks.stats.TrackStatistics; import de.dennisguse.opentracks.util.StringUtils; public class AggregatedStatisticsAdapter extends RecyclerView.Adapter { @@ -48,6 +49,9 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi String type = aggregatedStatistic.getActivityTypeLocalized(); if (ActivityType.findByLocalizedString(context, type).isShowSpeedPreferred()) { viewHolder.setSpeed(aggregatedStatistic); + viewHolder.setElevation(aggregatedStatistic); + + } else { viewHolder.setPace(aggregatedStatistic); } @@ -89,6 +93,10 @@ private class ViewHolder extends RecyclerView.ViewHolder { private final TextView maxSpeedUnit; private final TextView maxSpeedLabel; + private final TextView elevationGain; + private final TextView elevationLabel; + private final TextView elevationUnit; + private UnitSystem unitSystem = UnitSystem.defaultUnitSystem(); private boolean reportSpeed; @@ -100,15 +108,23 @@ public ViewHolder(View view) { distance = view.findViewById(R.id.aggregated_stats_distance); distanceUnit = view.findViewById(R.id.aggregated_stats_distance_unit); time = view.findViewById(R.id.aggregated_stats_time); - avgSpeed = view.findViewById(R.id.aggregated_stats_avg_rate); avgSpeedUnit = view.findViewById(R.id.aggregated_stats_avg_rate_unit); avgSpeedLabel = view.findViewById(R.id.aggregated_stats_avg_rate_label); maxSpeed = view.findViewById(R.id.aggregated_stats_max_rate); maxSpeedUnit = view.findViewById(R.id.aggregated_stats_max_rate_unit); maxSpeedLabel = view.findViewById(R.id.aggregated_stats_max_rate_label); - } + elevationGain = view.findViewById(R.id.aggregated_stats_elevation_gain); + elevationLabel = view.findViewById(R.id.aggregated_stats_elevation_gain_label); + elevationUnit = view.findViewById(R.id.aggregated_stats_elevation_gain_unit); + + elevationLabel.setText("Elevation Gain"); + elevationUnit.setText("ft"); + } + public void setElevation(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { + elevationGain.setText(aggregatedStatistic.getTrackStatistics().getTotalAltitudeGain().toString()); + } public void setSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { setCommonValues(aggregatedStatistic); diff --git a/src/main/res/layout/aggregated_stats_list_item.xml b/src/main/res/layout/aggregated_stats_list_item.xml index 7b148cb0f..99087e414 100644 --- a/src/main/res/layout/aggregated_stats_list_item.xml +++ b/src/main/res/layout/aggregated_stats_list_item.xml @@ -66,6 +66,7 @@ app:layout_constraintTop_toTopOf="@+id/aggregated_stats_type_label" tools:text="(1)" /> + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/aggregated_stats_elevation_gain_label" /> \ No newline at end of file From 327b3389e63e669258679cb03e79776cc3495259 Mon Sep 17 00:00:00 2001 From: alekhya-2000 Date: Sun, 19 Nov 2023 19:06:21 -0500 Subject: [PATCH 2/9] Created Aggregated stats in settings and implemented for elevation gain --- src/.DS_Store | Bin 0 -> 6148 bytes src/main/.DS_Store | Bin 0 -> 8196 bytes src/main/java/.DS_Store | Bin 0 -> 6148 bytes src/main/java/de/.DS_Store | Bin 0 -> 6148 bytes src/main/java/de/dennisguse/.DS_Store | Bin 0 -> 8196 bytes .../java/de/dennisguse/opentracks/.DS_Store | Bin 0 -> 8196 bytes .../AggregatedStatsSettingsFragment.java | 23 ++++++++++++++++ .../settings/MainSettingsFragment.java | 5 ++++ .../opentracks/settings/PreferencesUtils.java | 9 +++++++ .../opentracks/settings/SettingsActivity.java | 2 ++ .../de/dennisguse/opentracks/ui/.DS_Store | Bin 0 -> 6148 bytes .../AggregatedStatisticsAdapter.java | 20 +++++++------- src/main/res/.DS_Store | Bin 0 -> 6148 bytes src/main/res/values/settings.xml | 4 +++ src/main/res/values/strings.xml | 5 ++++ src/main/res/xml/settings.xml | 6 +++++ .../res/xml/settings_aggregated_stats.xml | 25 ++++++++++++++++++ 17 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 src/.DS_Store create mode 100644 src/main/.DS_Store create mode 100644 src/main/java/.DS_Store create mode 100644 src/main/java/de/.DS_Store create mode 100644 src/main/java/de/dennisguse/.DS_Store create mode 100644 src/main/java/de/dennisguse/opentracks/.DS_Store create mode 100644 src/main/java/de/dennisguse/opentracks/settings/AggregatedStatsSettingsFragment.java create mode 100644 src/main/java/de/dennisguse/opentracks/ui/.DS_Store create mode 100644 src/main/res/.DS_Store create mode 100644 src/main/res/xml/settings_aggregated_stats.xml diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..125d765cc36113d51073171429c3e4a7d8a4ffd1 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O0O({Y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OLlZNvQlA9|EHD|I%;W==`7kllDe9|NjP-GRL+6 literal 0 HcmV?d00001 diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..eaf3024af8516fb924ffdf171518aee82133b181 GIT binary patch literal 6148 zcmeHKQA@)x5Kgw~GKSCxg*^s*9k`7#9ln%0|9};JP?;?)TCB}jJNGaKebztZFY)(y zm!#ly&mwXM$#<8#OPUXwOBiF^TSR@v9LAV{hR9LbA~?L&RkOi}9OnpA6@vaA&eFvC z{yN~d*I2~jaGB4(et%x{dLO)2Z|v+gMN_oJo&Ttoei0Ol+zaM6Xk99mhLs+KS4q5_ zI{RlTD}p48=Q<&YVhFjtPO?ZXJ+;W9T<7}6AzGp}bvmonasQ+%M}zUYD_7$|uPcY6 z;d$g5Cg=(HwN&0kkAlai={z*bU=sKXY@A^Q9#GH1fsO)S}YBM2ZWncK$FVt6N8&{ z7?(EAwOAT7>5S`@VII43^?2cWbr_dAoN?D6^~3-%u*pE(m=4zebNFSpKJqtH$RY-a zfq%vTZ%q7&2b;3B^~d(G)=Fsi&`>b0LG4T8FTM!j1v21Gh1z;-$>_1+3^nWv;Z$Vr|B{+QS(1tY64a;^**r<3#EYZ{@i%W0g~_bddgrBbWox@?RjrzJ=RU~HosDK` z(jQH4uy-kCHOPOB-pz3yURTl)uxrx(M==qZ*jnothko|0XI1-wFI?cAQ-X&lLT z4Dq72s39Z@PN>dfTDp6G4QJld;oQEP5uA? literal 0 HcmV?d00001 diff --git a/src/main/java/de/dennisguse/.DS_Store b/src/main/java/de/dennisguse/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..cfe91c46eda21f2eb46c99727a9cbdd22f168488 GIT binary patch literal 8196 zcmeHMYitx%6u#fIz)U;PDHN#V78a@!aU(61mWSZd7J1X!ZD}dUc6Mik3DcRfGrL7= zV`E}a@e%!Hd?o(UXe4TU5dEp*BkB)D4aWEbHBl3ziT*J$(R1g{5@>0Ri7}#cleuT^ zd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Xz63_<$^0yl^DD|i)W@fyzIExe6) z@F70Jd3=IT3G83v0xn^u0>XP{Lm0o$2jSvC-mzWh2c* zNx)SJSrf1Sw_p4F|2&qFD2hN7fg2?PsNOcPt%tlR{{*OXjMv(6>W@(8jnA7FG%%ro rPvP>Q94C6^ABJ=t4|U0qP76vJYXAF(fQnzz(fJ>p{~U=o+xh=5W5dU- literal 0 HcmV?d00001 diff --git a/src/main/java/de/dennisguse/opentracks/settings/AggregatedStatsSettingsFragment.java b/src/main/java/de/dennisguse/opentracks/settings/AggregatedStatsSettingsFragment.java new file mode 100644 index 000000000..ede8f270e --- /dev/null +++ b/src/main/java/de/dennisguse/opentracks/settings/AggregatedStatsSettingsFragment.java @@ -0,0 +1,23 @@ +package de.dennisguse.opentracks.settings; + +import android.os.Bundle; + +import androidx.preference.PreferenceFragmentCompat; + +import de.dennisguse.opentracks.BuildConfig; +import de.dennisguse.opentracks.R; + +public class AggregatedStatsSettingsFragment extends PreferenceFragmentCompat { + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + addPreferencesFromResource(R.xml.settings_aggregated_stats); + } + + @Override + public void onStart() { + super.onStart(); + ((SettingsActivity) getActivity()).getSupportActionBar().setTitle(R.string.settings_aggregated_stats); + findPreference(getString(R.string.settings_aggregated_stats_key)); + } +} diff --git a/src/main/java/de/dennisguse/opentracks/settings/MainSettingsFragment.java b/src/main/java/de/dennisguse/opentracks/settings/MainSettingsFragment.java index f2fd0bfbf..16157f543 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/MainSettingsFragment.java +++ b/src/main/java/de/dennisguse/opentracks/settings/MainSettingsFragment.java @@ -49,6 +49,11 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { ((SettingsActivity) getActivity()).openScreen(getString(R.string.settings_api_key)); return true; }); + + findPreference(getString(R.string.settings_aggregated_stats_key)).setOnPreferenceClickListener(preference -> { + ((SettingsActivity) getActivity()).openScreen(getString(R.string.settings_aggregated_stats_key)); + return true; + }); } @Override diff --git a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java index 2df14dd95..192bf533d 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java +++ b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java @@ -451,6 +451,15 @@ public static void setVoiceAnnounceAverageHeartRate(boolean value) { setBoolean(R.string.voice_announce_average_heart_rate_key, value); } + public static boolean shouldElevationGain() { + return getBoolean(R.string.aggregated_stats_package_key, false); + } + + @VisibleForTesting + public static void setElevationGain(boolean value) { + setBoolean(R.string.aggregated_stats_package_key, value); + } + public static Distance getRecordingDistanceInterval() { return Distance.of(getInt(R.string.recording_distance_interval_key, getRecordingDistanceIntervalDefaultInternal())); } diff --git a/src/main/java/de/dennisguse/opentracks/settings/SettingsActivity.java b/src/main/java/de/dennisguse/opentracks/settings/SettingsActivity.java index 2f22e0d45..4d30563eb 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/SettingsActivity.java +++ b/src/main/java/de/dennisguse/opentracks/settings/SettingsActivity.java @@ -94,6 +94,8 @@ private PreferenceFragmentCompat getPreferenceScreen(String key) { fragment = new ImportExportSettingsFragment(); } else if (key.equals(getString(R.string.settings_api_key))) { fragment = new PublicAPISettingsFragment(); + } else if (key.equals(getString(R.string.settings_aggregated_stats_key))) { + fragment = new AggregatedStatsSettingsFragment(); } return fragment; diff --git a/src/main/java/de/dennisguse/opentracks/ui/.DS_Store b/src/main/java/de/dennisguse/opentracks/ui/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..28a20b109bb44e28d45450696302cfb33f8fc983 GIT binary patch literal 6148 zcmeHKQA@)x5WZ~Fb%?MBg*^s*9XQ>Xh%aT%KVU^4RAy_-EY?QW&OMAlpY;#g^}qyyqGLYIrPI1SaLr^acR z=~&NnI5np>s5hq5y-vF+yX~D>Q%?7HTTR*Nc4o7hv$?f>a6Gt8?o#z=NEY}#YFW29 zhbOFjdA$$bC{0v4#F+Vb^KlrN0cL<1_{$8~J7PS}Y9e ztpf}CeWd;hAqm#$E { @@ -49,9 +50,9 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi String type = aggregatedStatistic.getActivityTypeLocalized(); if (ActivityType.findByLocalizedString(context, type).isShowSpeedPreferred()) { viewHolder.setSpeed(aggregatedStatistic); - viewHolder.setElevation(aggregatedStatistic); - - + if(shouldElevationGain()) { + viewHolder.setElevation(aggregatedStatistic); + } } else { viewHolder.setPace(aggregatedStatistic); } @@ -114,13 +115,14 @@ public ViewHolder(View view) { maxSpeed = view.findViewById(R.id.aggregated_stats_max_rate); maxSpeedUnit = view.findViewById(R.id.aggregated_stats_max_rate_unit); maxSpeedLabel = view.findViewById(R.id.aggregated_stats_max_rate_label); - elevationGain = view.findViewById(R.id.aggregated_stats_elevation_gain); - elevationLabel = view.findViewById(R.id.aggregated_stats_elevation_gain_label); - elevationUnit = view.findViewById(R.id.aggregated_stats_elevation_gain_unit); - - elevationLabel.setText("Elevation Gain"); - elevationUnit.setText("ft"); + if(shouldElevationGain()) { + elevationGain = view.findViewById(R.id.aggregated_stats_elevation_gain); + elevationLabel = view.findViewById(R.id.aggregated_stats_elevation_gain_label); + elevationUnit = view.findViewById(R.id.aggregated_stats_elevation_gain_unit); + elevationLabel.setText("Elevation Gain"); + elevationUnit.setText("ft"); + } } public void setElevation(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { elevationGain.setText(aggregatedStatistic.getTrackStatistics().getTotalAltitudeGain().toString()); diff --git a/src/main/res/.DS_Store b/src/main/res/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f4ef853dbb2df3c125298d9e5476c87767965f1f GIT binary patch literal 6148 zcmeHK%}T>S5T0$TrijpkLXQhx3)WiugO^b23mDOZN=<0dV9ZL>AE6X-))(?gd>&_Z zw_tc&*(uCjFbBy zQo({Z8-61L^zBw*1U^JCg!%9H9Nb4?GANf{L?)YCSzUA1oOS2YyHR6r;17mL%kQ7l z>O`q1n9cp*H0+H#h0Q}15BxCh^>skl?V-!XSr~WKxTS`1H_@@4*>LhszEdbpCiUG$ zN!BXOX-Q6+m2yc|Yt`vA?`&=F92|FUqq|r=8X^UrIV~F&XYhoRxtvB`KaNy<258@RwzzqB;21KsywOg2yt*r~m wQLUAzSEwZ9ml}Kv!HF)#=u4%zh^htck|v0*#nd2LQ20kc)4&5W@U0BI0>9aZl>h($ literal 0 HcmV?d00001 diff --git a/src/main/res/values/settings.xml b/src/main/res/values/settings.xml index 2148a83d0..b63b107f8 100644 --- a/src/main/res/values/settings.xml +++ b/src/main/res/values/settings.xml @@ -23,6 +23,8 @@ settingsImportExport + settingsAggregatedStats + settingsReset @@ -286,6 +288,8 @@ settingsAPI apiPackageKey apiEnabledKey + AggregatedStatsPackageKey + false false apiDashboardEnabledKey false diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 6b16d3ffa..444c8494c 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -449,6 +449,11 @@ limitations under the License. Nautical (NM, ft) Preferred units + + Aggregated Stats + Choose your own stats + Elevation Gain + Public API Remote control and statistics API for other apps diff --git a/src/main/res/xml/settings.xml b/src/main/res/xml/settings.xml index 69cb5e7e7..9cd1901cb 100644 --- a/src/main/res/xml/settings.xml +++ b/src/main/res/xml/settings.xml @@ -56,6 +56,12 @@ android:summary="@string/settings_api_summary" android:title="@string/settings_api_title" /> + + + + + + + + + + + + + + + + + + \ No newline at end of file From 626b908a672162d0002845b8619b040524a2297d Mon Sep 17 00:00:00 2001 From: alekhya-2000 <54909278+alekhya-2000@users.noreply.github.com> Date: Sun, 19 Nov 2023 19:55:36 -0500 Subject: [PATCH 3/9] Update AggregatedStatisticsAdapter.java --- .../aggregatedStatistics/AggregatedStatisticsAdapter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index bf80046c4..e08f12d02 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -94,9 +94,9 @@ private class ViewHolder extends RecyclerView.ViewHolder { private final TextView maxSpeedUnit; private final TextView maxSpeedLabel; - private final TextView elevationGain; - private final TextView elevationLabel; - private final TextView elevationUnit; + private final TextView elevationGain = null; + private final TextView elevationLabel = null; + private final TextView elevationUnit = null; private UnitSystem unitSystem = UnitSystem.defaultUnitSystem(); private boolean reportSpeed; From c6653e0b9d74446bd1a4581c0fbdef4eea5fab36 Mon Sep 17 00:00:00 2001 From: alekhya-2000 <54909278+alekhya-2000@users.noreply.github.com> Date: Sun, 19 Nov 2023 20:07:36 -0500 Subject: [PATCH 4/9] Update AggregatedStatisticsAdapter.java --- .../aggregatedStatistics/AggregatedStatisticsAdapter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index e08f12d02..80b5ca94b 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -94,9 +94,9 @@ private class ViewHolder extends RecyclerView.ViewHolder { private final TextView maxSpeedUnit; private final TextView maxSpeedLabel; - private final TextView elevationGain = null; - private final TextView elevationLabel = null; - private final TextView elevationUnit = null; + private TextView elevationGain = null; + private TextView elevationLabel = null; + private TextView elevationUnit = null; private UnitSystem unitSystem = UnitSystem.defaultUnitSystem(); private boolean reportSpeed; From 6cb2ea516bb45f85343fee407f9c78d8d1afd576 Mon Sep 17 00:00:00 2001 From: yashvadaria Date: Mon, 20 Nov 2023 18:52:05 -0500 Subject: [PATCH 5/9] Exception for null value --- .../ui/aggregatedStatistics/AggregatedStatisticsAdapter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index f8a148bb2..83dc21069 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -123,7 +123,11 @@ public ViewHolder(View view) { } public void setElevation(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { + if(aggregatedStatistic.getTrackStatistics().getTotalAltitudeGain()==null) + elevationGain.setText("0.0"); + else elevationGain.setText(aggregatedStatistic.getTrackStatistics().getTotalAltitudeGain().toString()); + System.out.println(); } public void setSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { setCommonValues(aggregatedStatistic); From 042d75ce5f58a795a7b1d0cb2e7413aae467527f Mon Sep 17 00:00:00 2001 From: raghavmanchanda2 Date: Thu, 23 Nov 2023 14:31:28 -0500 Subject: [PATCH 6/9] [Issue-258][SubTask-3][Add toggle Distance in the aggregated stats option under settings][Fixed ByRaghav-40276920] --- .../opentracks/settings/PreferencesUtils.java | 10 ++++++ .../AggregatedStatisticsAdapter.java | 32 +++++++++++++++++++ src/main/res/values/settings.xml | 1 + .../res/xml/settings_aggregated_stats.xml | 4 +++ 4 files changed, 47 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java index 192bf533d..af171efd3 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java +++ b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java @@ -460,6 +460,16 @@ public static void setElevationGain(boolean value) { setBoolean(R.string.aggregated_stats_package_key, value); } + public static boolean shouldDistance() { + Log.d("myLogs", String.valueOf(R.string.distance_preference_key)); + return getBoolean(R.string.distance_preference_key, false); + } + + @VisibleForTesting + public static void setDistance(boolean value) { + setBoolean(R.string.distance_preference_key, value); + } + public static Distance getRecordingDistanceInterval() { return Distance.of(getInt(R.string.recording_distance_interval_key, getRecordingDistanceIntervalDefaultInternal())); } diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index 0ee06cd4c..1d5c29fc2 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -1,6 +1,7 @@ package de.dennisguse.opentracks.ui.aggregatedStatistics; import android.content.Context; +import android.util.Log; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; @@ -23,6 +24,7 @@ import de.dennisguse.opentracks.stats.TrackStatistics; import de.dennisguse.opentracks.util.StringUtils; import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldElevationGain; +import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldDistance; public class AggregatedStatisticsAdapter extends RecyclerView.Adapter { @@ -53,6 +55,14 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi if(shouldElevationGain()) { viewHolder.setElevation(aggregatedStatistic); } + if(shouldDistance()) { + Log.d("myLogs", "ShouldDistance is called"); + viewHolder.setDistance(aggregatedStatistic, true); + } + else { + Log.d("myLogs", "Inside Else"); + viewHolder.setDistance(aggregatedStatistic, false); + } } else { viewHolder.setPace(aggregatedStatistic); } @@ -131,6 +141,28 @@ public void setElevation(AggregatedStatistics.AggregatedStatistic aggregatedStat elevationGain.setText(aggregatedStatistic.getTrackStatistics().getTotalAltitudeGain().toString()); System.out.println(); } + + public void setDistance(AggregatedStatistics.AggregatedStatistic aggregatedStatistic, Boolean visibility) { + if(visibility) { + if (aggregatedStatistic.getTrackStatistics().getTotalDistance() == null) { + Log.d("myLogs", "aggregate value is null"); + distance.setText("0.0"); + } else { + Log.d("myLogs", "Visibility true, setting value in else"); + Pair parts = DistanceFormatter.Builder() + .setUnit(unitSystem) + .build(context).getDistanceParts(aggregatedStatistic.getTrackStatistics().getTotalDistance()); + distance.setText(parts.first); + distanceUnit.setText(parts.second); + } + } + else{ + Log.d("myLogs", "Visibility is false"); + distance.setText(""); + distanceUnit.setText(""); + } + } + public void setSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { setCommonValues(aggregatedStatistic); diff --git a/src/main/res/values/settings.xml b/src/main/res/values/settings.xml index b63b107f8..8243c56f5 100644 --- a/src/main/res/values/settings.xml +++ b/src/main/res/values/settings.xml @@ -290,6 +290,7 @@ apiEnabledKey AggregatedStatsPackageKey false + DistancePreferenceKey false apiDashboardEnabledKey false diff --git a/src/main/res/xml/settings_aggregated_stats.xml b/src/main/res/xml/settings_aggregated_stats.xml index 15b09bc83..9eeb1b5dc 100644 --- a/src/main/res/xml/settings_aggregated_stats.xml +++ b/src/main/res/xml/settings_aggregated_stats.xml @@ -14,6 +14,10 @@ android:title="@string/settings_aggregated_stats"> android:defaultValue="false" android:key="@string/aggregated_stats_package_key" android:title="@string/settings_elevation_gain" /> + From 70780644b38f2b3d0f59b52fce2a135a69d64422 Mon Sep 17 00:00:00 2001 From: bhavyabugude Date: Thu, 23 Nov 2023 15:57:40 -0500 Subject: [PATCH 7/9] =?UTF-8?q?Issue=20259-=20Subtask=204:=20Add=20toggle?= =?UTF-8?q?=20=E2=80=9CMax=20Speed=E2=80=9D=20in=20the=20aggregated=20stat?= =?UTF-8?q?s=20option=20under=20settings.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opentracks/settings/PreferencesUtils.java | 9 ++++++ .../AggregatedStatisticsAdapter.java | 29 +++++++++++++++++++ src/main/res/values/settings.xml | 1 + .../res/xml/settings_aggregated_stats.xml | 4 +++ 4 files changed, 43 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java index af171efd3..2dceb27a8 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java +++ b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java @@ -470,6 +470,15 @@ public static void setDistance(boolean value) { setBoolean(R.string.distance_preference_key, value); } + public static boolean shouldMaxSpeed() { + return getBoolean(R.string.max_speed_preference_key, false); + } + + @VisibleForTesting + public static void setMaxSpeed(boolean value) { + setBoolean(R.string.distance_preference_key, value); + } + public static Distance getRecordingDistanceInterval() { return Distance.of(getInt(R.string.recording_distance_interval_key, getRecordingDistanceIntervalDefaultInternal())); } diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index 1d5c29fc2..fcabf66e6 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -25,6 +25,7 @@ import de.dennisguse.opentracks.util.StringUtils; import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldElevationGain; import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldDistance; +import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldMaxSpeed; public class AggregatedStatisticsAdapter extends RecyclerView.Adapter { @@ -63,6 +64,12 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi Log.d("myLogs", "Inside Else"); viewHolder.setDistance(aggregatedStatistic, false); } + if(shouldMaxSpeed()) { + viewHolder.setMaxSpeed(aggregatedStatistic, true); + } + else { + viewHolder.setMaxSpeed(aggregatedStatistic, false); + } } else { viewHolder.setPace(aggregatedStatistic); } @@ -163,6 +170,28 @@ public void setDistance(AggregatedStatistics.AggregatedStatistic aggregatedStati } } + public void setMaxSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic, Boolean visibility) { + SpeedFormatter formatter = SpeedFormatter.Builder().setUnit(unitSystem).setReportSpeedOrPace(reportSpeed).build(context); + if(visibility){ + if(aggregatedStatistic.getTrackStatistics().getMaxSpeed() ==null) + maxSpeed.setText("0.0"); + + else + { + Pair parts = formatter.getSpeedParts(aggregatedStatistic.getTrackStatistics().getMaxSpeed()); + maxSpeed.setText(parts.first); + maxSpeedUnit.setText(parts.second); + maxSpeedLabel.setText(context.getString(R.string.stats_max_speed)); + } + } + else{ + maxSpeed.setText(""); + maxSpeedUnit.setText(""); + maxSpeedLabel.setText(""); + } + + } + public void setSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { setCommonValues(aggregatedStatistic); diff --git a/src/main/res/values/settings.xml b/src/main/res/values/settings.xml index 8243c56f5..e53b6ee7d 100644 --- a/src/main/res/values/settings.xml +++ b/src/main/res/values/settings.xml @@ -291,6 +291,7 @@ AggregatedStatsPackageKey false DistancePreferenceKey + MaxSpeedPreferenceKey false apiDashboardEnabledKey false diff --git a/src/main/res/xml/settings_aggregated_stats.xml b/src/main/res/xml/settings_aggregated_stats.xml index 9eeb1b5dc..9be87de54 100644 --- a/src/main/res/xml/settings_aggregated_stats.xml +++ b/src/main/res/xml/settings_aggregated_stats.xml @@ -18,6 +18,10 @@ android:title="@string/settings_aggregated_stats"> android:defaultValue="false" android:key="@string/distance_preference_key" android:title="@string/stats_distance" /> + From 534d6d37a03697c1d923954a602f122b46d1a337 Mon Sep 17 00:00:00 2001 From: udisha0606 Date: Sun, 26 Nov 2023 16:22:21 -0500 Subject: [PATCH 8/9] Added toggle for moving speed --- .../opentracks/settings/PreferencesUtils.java | 8 ++++++ .../AggregatedStatisticsAdapter.java | 28 +++++++++++++++++++ src/main/res/values/settings.xml | 2 ++ .../res/xml/settings_aggregated_stats.xml | 5 ++++ 4 files changed, 43 insertions(+) diff --git a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java index 2dceb27a8..8eb01895c 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java +++ b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java @@ -479,6 +479,14 @@ public static void setMaxSpeed(boolean value) { setBoolean(R.string.distance_preference_key, value); } + public static boolean shouldMovingSpeed() { + return getBoolean(R.string.moving_speed_preference_key, false); + } + + @VisibleForTesting + public static void setMovingSpeed(boolean value) { + setBoolean(R.string.moving_speed_preference_key, value); + } public static Distance getRecordingDistanceInterval() { return Distance.of(getInt(R.string.recording_distance_interval_key, getRecordingDistanceIntervalDefaultInternal())); } diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index fcabf66e6..68f5a44ce 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -26,6 +26,8 @@ import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldElevationGain; import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldDistance; import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldMaxSpeed; +import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldMovingSpeed; +import static de.dennisguse.opentracks.settings.PreferencesUtils.setMovingSpeed; public class AggregatedStatisticsAdapter extends RecyclerView.Adapter { @@ -70,6 +72,12 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi else { viewHolder.setMaxSpeed(aggregatedStatistic, false); } + if(shouldMovingSpeed()){ + viewHolder.setMovingSpeed(aggregatedStatistic, true); + } + else { + viewHolder.setMovingSpeed(aggregatedStatistic, false); + } } else { viewHolder.setPace(aggregatedStatistic); } @@ -192,6 +200,26 @@ public void setMaxSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStati } + public void setMovingSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic, Boolean visibility) { + SpeedFormatter formatter = SpeedFormatter.Builder().setUnit(unitSystem).setReportSpeedOrPace(reportSpeed).build(context); + if(visibility){ + if(aggregatedStatistic.getTrackStatistics().getMaxSpeed() ==null) + avgSpeed.setText("0.0"); + else + { + Pair parts = formatter.getSpeedParts(aggregatedStatistic.getTrackStatistics().getMaxSpeed()); + avgSpeed.setText(parts.first); + avgSpeedUnit.setText(parts.second); + avgSpeedLabel.setText(context.getString(R.string.stats_max_speed)); + } + } + else{ + avgSpeed.setText(""); + avgSpeedUnit.setText(""); + avgSpeedLabel.setText(""); + } + + } public void setSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { setCommonValues(aggregatedStatistic); diff --git a/src/main/res/values/settings.xml b/src/main/res/values/settings.xml index e53b6ee7d..4af511fce 100644 --- a/src/main/res/values/settings.xml +++ b/src/main/res/values/settings.xml @@ -292,6 +292,8 @@ false DistancePreferenceKey MaxSpeedPreferenceKey + MovingSpeedPreferenceKey + Moving Speed false apiDashboardEnabledKey false diff --git a/src/main/res/xml/settings_aggregated_stats.xml b/src/main/res/xml/settings_aggregated_stats.xml index 9be87de54..23f067632 100644 --- a/src/main/res/xml/settings_aggregated_stats.xml +++ b/src/main/res/xml/settings_aggregated_stats.xml @@ -23,6 +23,11 @@ android:title="@string/settings_aggregated_stats"> android:key="@string/max_speed_preference_key" android:title="@string/stats_max_speed" /> + + From c8317e9c9eb3fdbb1fe0610c29a38bd74d23e5d6 Mon Sep 17 00:00:00 2001 From: khushaliparmar Date: Sun, 26 Nov 2023 19:06:42 -0500 Subject: [PATCH 9/9] Added toggle for moving time --- .../opentracks/settings/PreferencesUtils.java | 4 ++++ .../AggregatedStatisticsAdapter.java | 23 ++++++++++++++++++- src/main/res/values/settings.xml | 4 ++++ .../res/xml/settings_aggregated_stats.xml | 13 +++++++---- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java index 8eb01895c..828599258 100644 --- a/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java +++ b/src/main/java/de/dennisguse/opentracks/settings/PreferencesUtils.java @@ -487,6 +487,10 @@ public static boolean shouldMovingSpeed() { public static void setMovingSpeed(boolean value) { setBoolean(R.string.moving_speed_preference_key, value); } + public static boolean shouldMovingTime() { + return getBoolean(R.string.moving_time_preference_key, false); + } + public static Distance getRecordingDistanceInterval() { return Distance.of(getInt(R.string.recording_distance_interval_key, getRecordingDistanceIntervalDefaultInternal())); } diff --git a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java index 68f5a44ce..add67c6fc 100644 --- a/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java +++ b/src/main/java/de/dennisguse/opentracks/ui/aggregatedStatistics/AggregatedStatisticsAdapter.java @@ -27,7 +27,7 @@ import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldDistance; import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldMaxSpeed; import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldMovingSpeed; -import static de.dennisguse.opentracks.settings.PreferencesUtils.setMovingSpeed; +import static de.dennisguse.opentracks.settings.PreferencesUtils.shouldMovingTime; public class AggregatedStatisticsAdapter extends RecyclerView.Adapter { @@ -78,6 +78,12 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi else { viewHolder.setMovingSpeed(aggregatedStatistic, false); } + if(shouldMovingTime()){ + viewHolder.setMovingTime(aggregatedStatistic, true); + } + else { + viewHolder.setMovingTime(aggregatedStatistic, false); + } } else { viewHolder.setPace(aggregatedStatistic); } @@ -219,6 +225,21 @@ public void setMovingSpeed(AggregatedStatistics.AggregatedStatistic aggregatedSt avgSpeedLabel.setText(""); } + } + public void setMovingTime(AggregatedStatistics.AggregatedStatistic aggregatedStatistic, Boolean visibility) { + SpeedFormatter formatter = SpeedFormatter.Builder().setUnit(unitSystem).setReportSpeedOrPace(reportSpeed).build(context); + if(visibility){ + if(aggregatedStatistic.getTrackStatistics().getMaxSpeed() ==null) + time.setText("0.0"); + else + { + time.setText(StringUtils.formatElapsedTime(aggregatedStatistic.getTrackStatistics().getMovingTime())); + } + } + else{ + time.setText(""); + } + } public void setSpeed(AggregatedStatistics.AggregatedStatistic aggregatedStatistic) { setCommonValues(aggregatedStatistic); diff --git a/src/main/res/values/settings.xml b/src/main/res/values/settings.xml index 4af511fce..066f6ecf4 100644 --- a/src/main/res/values/settings.xml +++ b/src/main/res/values/settings.xml @@ -294,6 +294,10 @@ MaxSpeedPreferenceKey MovingSpeedPreferenceKey Moving Speed + MovingTimePreferenceKey + Average Moving Time + + false apiDashboardEnabledKey false diff --git a/src/main/res/xml/settings_aggregated_stats.xml b/src/main/res/xml/settings_aggregated_stats.xml index 23f067632..6693c8f4c 100644 --- a/src/main/res/xml/settings_aggregated_stats.xml +++ b/src/main/res/xml/settings_aggregated_stats.xml @@ -22,11 +22,14 @@ android:title="@string/settings_aggregated_stats"> android:defaultValue="false" android:key="@string/max_speed_preference_key" android:title="@string/stats_max_speed" /> - - + +