mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
cherry pick from #5946: fix steps and distance device wheels become unsynced
(cherry picked from commit 5b182bf800)
This commit is contained in:
+3
-2
@@ -1465,6 +1465,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
int sleepGoalMinutes = activityUser.getSleepDurationGoal();
|
int sleepGoalMinutes = activityUser.getSleepDurationGoal();
|
||||||
int distanceGoal = activityUser.getDistanceGoalMeters() * 100;
|
int distanceGoal = activityUser.getDistanceGoalMeters() * 100;
|
||||||
int stepLength = activityUser.getStepLengthCm();
|
int stepLength = activityUser.getStepLengthCm();
|
||||||
|
int distanceForChart = distanceCm > 0 ? distanceCm : steps * stepLength;
|
||||||
double distanceMeters = (distanceCm > 0 ? distanceCm : steps * stepLength) * 0.01;
|
double distanceMeters = (distanceCm > 0 ? distanceCm : steps * stepLength) * 0.01;
|
||||||
String distanceFormatted = FormatUtils.getFormattedDistanceLabel(distanceMeters);
|
String distanceFormatted = FormatUtils.getFormattedDistanceLabel(distanceMeters);
|
||||||
|
|
||||||
@@ -1472,7 +1473,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
setChartsData(holder.TotalStepsChart, steps, stepGoal, context.getString(R.string.steps), NumberFormat.getInstance().format(steps), context);
|
setChartsData(holder.TotalStepsChart, steps, stepGoal, context.getString(R.string.steps), NumberFormat.getInstance().format(steps), context);
|
||||||
|
|
||||||
setUpChart(holder.TotalDistanceChart);
|
setUpChart(holder.TotalDistanceChart);
|
||||||
setChartsData(holder.TotalDistanceChart, steps * stepLength, distanceGoal, context.getString(R.string.distance), distanceFormatted, context);
|
setChartsData(holder.TotalDistanceChart, distanceForChart, distanceGoal, context.getString(R.string.distance), distanceFormatted, context);
|
||||||
|
|
||||||
setUpChart(holder.SleepTimeChart);
|
setUpChart(holder.SleepTimeChart);
|
||||||
setChartsData(holder.SleepTimeChart, sleep, sleepGoalMinutes, context.getString(R.string.prefs_activity_in_device_card_sleep_title), String.format("%1s", getHM(sleep)), context);
|
setChartsData(holder.SleepTimeChart, sleep, sleepGoalMinutes, context.getString(R.string.prefs_activity_in_device_card_sleep_title), String.format("%1s", getHM(sleep)), context);
|
||||||
@@ -1486,7 +1487,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
Hashtable<PieChart, Pair<Boolean, Integer>> activitiesStatusMiniCharts = new Hashtable<>();
|
Hashtable<PieChart, Pair<Boolean, Integer>> activitiesStatusMiniCharts = new Hashtable<>();
|
||||||
activitiesStatusMiniCharts.put(holder.TotalStepsChart, new Pair<>(showActivitySteps && steps > 0, ActivityChartsActivity.getChartsTabIndex("stepsweek", device, context)));
|
activitiesStatusMiniCharts.put(holder.TotalStepsChart, new Pair<>(showActivitySteps && steps > 0, ActivityChartsActivity.getChartsTabIndex("stepsweek", device, context)));
|
||||||
activitiesStatusMiniCharts.put(holder.SleepTimeChart, new Pair<>(showActivitySleep && sleep > 0, ActivityChartsActivity.getChartsTabIndex("sleep", device, context)));
|
activitiesStatusMiniCharts.put(holder.SleepTimeChart, new Pair<>(showActivitySleep && sleep > 0, ActivityChartsActivity.getChartsTabIndex("sleep", device, context)));
|
||||||
activitiesStatusMiniCharts.put(holder.TotalDistanceChart, new Pair<>(showActivityDistance && steps > 0, ActivityChartsActivity.getChartsTabIndex("activity", device, context)));
|
activitiesStatusMiniCharts.put(holder.TotalDistanceChart, new Pair<>(showActivityDistance && distanceForChart > 0, ActivityChartsActivity.getChartsTabIndex("activity", device, context)));
|
||||||
|
|
||||||
for (Map.Entry<PieChart, Pair<Boolean, Integer>> miniCharts : activitiesStatusMiniCharts.entrySet()) {
|
for (Map.Entry<PieChart, Pair<Boolean, Integer>> miniCharts : activitiesStatusMiniCharts.entrySet()) {
|
||||||
PieChart miniChart = miniCharts.getKey();
|
PieChart miniChart = miniCharts.getKey();
|
||||||
|
|||||||
Reference in New Issue
Block a user