From 1c46bbd6eb2f7fdd2020991dffcebd1299ee9801 Mon Sep 17 00:00:00 2001 From: dhruvkumarparmar Date: Sun, 11 Feb 2024 16:33:09 -0500 Subject: [PATCH 1/5] DhruvkumarParmar-TODO Load Preference i have updated the code for the TODO Load Preference --- .../opentracks/viewmodels/SensorStatisticsViewHolder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java index eb2600050..ab38e45ef 100644 --- a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java +++ b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java @@ -42,7 +42,8 @@ public void onChanged(UnitSystem unitSystem, RecordingData data) { } //TODO Loads preference every time - HeartRateZones zones = PreferencesUtils.getHeartRateZones(); + + //HeartRateZones zones = PreferencesUtils.getHeartRateZones(); int textColor; if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) { textColor = zones.getTextColorForZone(getContext(), sensorDataSet.getHeartRate().first); From 7c9422de1c432f270f52cb1ee7bf130745974d33 Mon Sep 17 00:00:00 2001 From: dhruvkumarparmar Date: Sun, 11 Feb 2024 23:22:24 -0500 Subject: [PATCH 2/5] Update SensorStatisticsViewHolder.java --- .../opentracks/viewmodels/SensorStatisticsViewHolder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java index ab38e45ef..937c1d13a 100644 --- a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java +++ b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java @@ -41,9 +41,8 @@ public void onChanged(UnitSystem unitSystem, RecordingData data) { valueAndUnit = StringUtils.getHeartRateParts(getContext(), null); } - //TODO Loads preference every time - - //HeartRateZones zones = PreferencesUtils.getHeartRateZones(); + // Load heart rate zones preference every time + HeartRateZones zones = PreferencesUtils.getHeartRateZones(); int textColor; if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) { textColor = zones.getTextColorForZone(getContext(), sensorDataSet.getHeartRate().first); @@ -59,6 +58,7 @@ public void onChanged(UnitSystem unitSystem, RecordingData data) { getBinding().statsValue.setTextColor(textColor); } + } public static class SensorCadence extends SensorStatisticsViewHolder { From cb179205e7b31c4979ba81fbabd78f9942d7be3d Mon Sep 17 00:00:00 2001 From: dhruvkumarparmar Date: Sun, 11 Feb 2024 23:29:03 -0500 Subject: [PATCH 3/5] DhruvkumarParmar-Load heart rate zones preference every time I have updated the code for SensorStatisticsViewHolder.java file in which i have Load heart rate zones preference every time --- .../opentracks/viewmodels/SensorStatisticsViewHolder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java index 937c1d13a..06ec60649 100644 --- a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java +++ b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java @@ -41,7 +41,7 @@ public void onChanged(UnitSystem unitSystem, RecordingData data) { valueAndUnit = StringUtils.getHeartRateParts(getContext(), null); } - // Load heart rate zones preference every time + // Load heart rate zones preference every time. HeartRateZones zones = PreferencesUtils.getHeartRateZones(); int textColor; if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) { From 2ddac3e218f88273d87f49d85b80c9727a2907dc Mon Sep 17 00:00:00 2001 From: dhruvkumarparmar Date: Sun, 11 Feb 2024 23:36:22 -0500 Subject: [PATCH 4/5] DhruvkumarParmar-Load heart rate zones preference every time I have updated the code for SensorStatisticsViewHolder.java file in which i have Load heart rate zones preference every time --- .../SensorStatisticsViewHolder.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java index 06ec60649..17090218a 100644 --- a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java +++ b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java @@ -29,6 +29,7 @@ public void configureUI(DataField dataField) { public static class SensorHeartRate extends SensorStatisticsViewHolder { @Override + public void onChanged(UnitSystem unitSystem, RecordingData data) { SensorDataSet sensorDataSet = data.sensorDataSet(); String sensorName = getContext().getString(R.string.value_unknown); @@ -58,7 +59,35 @@ public void onChanged(UnitSystem unitSystem, RecordingData data) { getBinding().statsValue.setTextColor(textColor); } - + // public void onChanged(UnitSystem unitSystem, RecordingData data) { +// SensorDataSet sensorDataSet = data.sensorDataSet(); +// String sensorName = getContext().getString(R.string.value_unknown); +// +// Pair valueAndUnit; +// if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) { +// valueAndUnit = StringUtils.getHeartRateParts(getContext(), sensorDataSet.getHeartRate().first); +// sensorName = sensorDataSet.getHeartRate().second; +// } else { +// valueAndUnit = StringUtils.getHeartRateParts(getContext(), null); +// } +// +// //TODO Loads preference every time +// HeartRateZones zones = PreferencesUtils.getHeartRateZones(); +// int textColor; +// if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) { +// textColor = zones.getTextColorForZone(getContext(), sensorDataSet.getHeartRate().first); +// } else { +// textColor = zones.getTextColorForZone(getContext(), null); +// } +// +// getBinding().statsValue.setText(valueAndUnit.first); +// getBinding().statsUnit.setText(valueAndUnit.second); +// getBinding().statsDescriptionMain.setText(R.string.stats_sensors_heart_rate); +// +// getBinding().statsDescriptionSecondary.setText(sensorName); +// +// getBinding().statsValue.setTextColor(textColor); +// } } public static class SensorCadence extends SensorStatisticsViewHolder { From 0cd66bed66761909ed0107154ff186ec82d06a6a Mon Sep 17 00:00:00 2001 From: dhruvkumarparmar Date: Sun, 11 Feb 2024 23:38:36 -0500 Subject: [PATCH 5/5] DhruvkumarParmar-Load heart rate zones preference every time removed the commented code and put the heart rate zones preference inside onChanged method --- .../SensorStatisticsViewHolder.java | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java index 17090218a..976f264a4 100644 --- a/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java +++ b/src/main/java/de/dennisguse/opentracks/viewmodels/SensorStatisticsViewHolder.java @@ -59,35 +59,7 @@ public void onChanged(UnitSystem unitSystem, RecordingData data) { getBinding().statsValue.setTextColor(textColor); } - // public void onChanged(UnitSystem unitSystem, RecordingData data) { -// SensorDataSet sensorDataSet = data.sensorDataSet(); -// String sensorName = getContext().getString(R.string.value_unknown); -// -// Pair valueAndUnit; -// if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) { -// valueAndUnit = StringUtils.getHeartRateParts(getContext(), sensorDataSet.getHeartRate().first); -// sensorName = sensorDataSet.getHeartRate().second; -// } else { -// valueAndUnit = StringUtils.getHeartRateParts(getContext(), null); -// } -// -// //TODO Loads preference every time -// HeartRateZones zones = PreferencesUtils.getHeartRateZones(); -// int textColor; -// if (sensorDataSet != null && sensorDataSet.getHeartRate() != null) { -// textColor = zones.getTextColorForZone(getContext(), sensorDataSet.getHeartRate().first); -// } else { -// textColor = zones.getTextColorForZone(getContext(), null); -// } -// -// getBinding().statsValue.setText(valueAndUnit.first); -// getBinding().statsUnit.setText(valueAndUnit.second); -// getBinding().statsDescriptionMain.setText(R.string.stats_sensors_heart_rate); -// -// getBinding().statsDescriptionSecondary.setText(sensorName); -// -// getBinding().statsValue.setTextColor(textColor); -// } + } public static class SensorCadence extends SensorStatisticsViewHolder {