From 27c4cc95c96834cca91b7cac1f121777a0e10001 Mon Sep 17 00:00:00 2001 From: a0z Date: Fri, 22 Nov 2024 18:55:39 +0100 Subject: [PATCH] Calories: remove total goal --- .../activities/DashboardFragment.java | 21 ------- .../charts/CaloriesDailyFragment.java | 13 +---- .../DashboardCaloriesGoalWidget.java | 58 ------------------- .../gadgetbridge/model/ActivityUser.java | 13 +---- .../gadgetbridge/util/DashboardUtils.java | 11 +--- app/src/main/res/layout/fragment_calories.xml | 50 ++++++---------- app/src/main/res/values/arrays.xml | 3 - app/src/main/res/values/strings.xml | 2 - app/src/main/res/xml/about_user.xml | 11 +--- 9 files changed, 21 insertions(+), 161 deletions(-) delete mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/dashboard/DashboardCaloriesGoalWidget.java diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardFragment.java index bb1404734..9c5ad257b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardFragment.java @@ -68,7 +68,6 @@ import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardActive import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardBodyEnergyWidget; import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardCalendarActivity; import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardCaloriesTotalSegmentedWidget; -import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardCaloriesGoalWidget; import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardDistanceWidget; import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardGoalsWidget; import nodomain.freeyourgadget.gadgetbridge.activities.dashboard.DashboardHrvWidget; @@ -313,9 +312,6 @@ public class DashboardFragment extends Fragment implements MenuProvider { case "vo2max": widget = DashboardVO2MaxAnyWidget.newInstance(dashboardData); break; - case "calories": - widget = DashboardCaloriesGoalWidget.newInstance(dashboardData); - break; case "calories_active": widget = DashboardCaloriesActiveGoalWidget.newInstance(dashboardData); break; @@ -388,7 +384,6 @@ public class DashboardFragment extends Fragment implements MenuProvider { private int activeCaloriesTotal; private float activeCaloriesGoalFactor; private int caloriesTotal; - private float caloriesGoalFactor; private long sleepTotalMinutes; private float sleepGoalFactor; private float distanceTotalMeters; @@ -400,9 +395,7 @@ public class DashboardFragment extends Fragment implements MenuProvider { public void clear() { restingCaloriesTotal = 0; activeCaloriesTotal = 0; - activeCaloriesGoalFactor = 0; caloriesTotal = 0; - caloriesGoalFactor = 0; stepsTotal = 0; stepsGoalFactor = 0; sleepTotalMinutes = 0; @@ -420,9 +413,7 @@ public class DashboardFragment extends Fragment implements MenuProvider { stepsGoalFactor == 0 && restingCaloriesTotal == 0 && activeCaloriesTotal == 0 && - activeCaloriesGoalFactor == 0 && caloriesTotal == 0 && - caloriesGoalFactor == 0 && sleepTotalMinutes == 0 && sleepGoalFactor == 0 && distanceTotalMeters == 0 && @@ -499,18 +490,6 @@ public class DashboardFragment extends Fragment implements MenuProvider { return activeCaloriesGoalFactor; } - public synchronized int getCaloriesTotal() { - if (caloriesTotal == 0) - caloriesTotal = getRestingCaloriesTotal() + getActiveCaloriesTotal(); - return caloriesTotal; - } - - public synchronized float getCaloriesGoalFactor() { - if (caloriesGoalFactor == 0) - caloriesGoalFactor = DashboardUtils.getCaloriesGoalFactor(this); - return caloriesGoalFactor; - } - public void put(final String key, final Serializable value) { genericData.put(key, value); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/CaloriesDailyFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/CaloriesDailyFragment.java index 6689e62d0..5ceb31f42 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/CaloriesDailyFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/CaloriesDailyFragment.java @@ -33,7 +33,6 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample; import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser; import nodomain.freeyourgadget.gadgetbridge.model.RestingMetabolicRateSample; -import nodomain.freeyourgadget.gadgetbridge.model.TimeSample; public class CaloriesDailyFragment extends AbstractChartFragment { @@ -44,13 +43,10 @@ public class CaloriesDailyFragment extends AbstractChartFragment 1) goalFactor = 1; - - return goalFactor; - } - - public static float getCaloriesGoalFactor(DashboardFragment.DashboardData dashboardData) { ActivityUser activityUser = new ActivityUser(); int caloriesGoal = activityUser.getCaloriesBurntGoal(); - float goalFactor = (float) (getRestingCaloriesTotal(dashboardData) + getActiveCaloriesTotal(dashboardData)) / caloriesGoal; + float goalFactor = (float) getActiveCaloriesTotal(dashboardData) / caloriesGoal; if (goalFactor > 1) goalFactor = 1; return goalFactor; diff --git a/app/src/main/res/layout/fragment_calories.xml b/app/src/main/res/layout/fragment_calories.xml index c58fa802a..4de7fbf30 100644 --- a/app/src/main/res/layout/fragment_calories.xml +++ b/app/src/main/res/layout/fragment_calories.xml @@ -52,7 +52,24 @@ android:text="@string/active" android:textSize="12sp" /> + + + + - - - - - - - - - - diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 554e16cac..7b0f3fc67 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -4279,7 +4279,6 @@ @string/menuitem_vo2_max @string/vo2max_running @string/vo2max_cycling - @string/menuitem_calories_goal @string/menuitem_calories_active_goal @string/menuitem_calories_segmented @@ -4299,7 +4298,6 @@ vo2max vo2max_running vo2max_cycling - calories calories_active calories_segmented @@ -4315,7 +4313,6 @@ stress_segmented hrv vo2max - calories calories_active calories_segmented diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b8d13efb0..6edc25dd1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -938,7 +938,6 @@ Average Active Active goal - Total goal Total burnt Goal Blood pressure @@ -1948,7 +1947,6 @@ Stress (breakdown) Calories(segmented) Calories goal(active) - Calories goal(total) PAI Heart Rate SpO2 diff --git a/app/src/main/res/xml/about_user.xml b/app/src/main/res/xml/about_user.xml index 0564ad35a..18c6d059e 100644 --- a/app/src/main/res/xml/about_user.xml +++ b/app/src/main/res/xml/about_user.xml @@ -86,19 +86,10 @@ - -