1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 03:37:03 +01:00

Garmin: Parse strength training workout sets

This commit is contained in:
José Rebelo 2024-08-28 13:43:12 +01:00
parent 9321e470d7
commit 12ecfa0c4e
20 changed files with 121 additions and 23 deletions

View File

@ -422,7 +422,7 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
private void makeSummaryContent(BaseActivitySummary item) { private void makeSummaryContent(BaseActivitySummary item) {
final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator(); final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(gbDevice); final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(gbDevice, this);
//make view of data from summaryData of item //make view of data from summaryData of item
String units = GBApplication.getPrefs().getString(SettingsActivity.PREF_MEASUREMENT_SYSTEM, GBApplication.getContext().getString(R.string.p_unit_metric)); String units = GBApplication.getPrefs().getString(SettingsActivity.PREF_MEASUREMENT_SYSTEM, GBApplication.getContext().getString(R.string.p_unit_metric));

View File

@ -40,7 +40,6 @@ import java.util.concurrent.TimeUnit;
import de.greenrobot.dao.query.QueryBuilder; import de.greenrobot.dao.query.QueryBuilder;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler; import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper; import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
@ -52,7 +51,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryJsonSummary; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryJsonSummary;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser;
import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils; import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils;
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
import nodomain.freeyourgadget.gadgetbridge.util.FormatUtils; import nodomain.freeyourgadget.gadgetbridge.util.FormatUtils;
import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.GB;
@ -205,7 +203,7 @@ public class ActivitySummariesAdapter extends AbstractActivityListingAdapter<Bas
} }
} }
final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(device); final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(device, getContext());
final ActivitySummaryJsonSummary activitySummaryJsonSummary = new ActivitySummaryJsonSummary(summaryParser, sportitem); final ActivitySummaryJsonSummary activitySummaryJsonSummary = new ActivitySummaryJsonSummary(summaryParser, sportitem);
JSONObject summarySubdata = activitySummaryJsonSummary.getSummaryData(false); JSONObject summarySubdata = activitySummaryJsonSummary.getSummaryData(false);

View File

@ -58,7 +58,6 @@ import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabi
import nodomain.freeyourgadget.gadgetbridge.capabilities.widgets.WidgetManager; import nodomain.freeyourgadget.gadgetbridge.capabilities.widgets.WidgetManager;
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler; import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper; import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
import nodomain.freeyourgadget.gadgetbridge.entities.AlarmDao; import nodomain.freeyourgadget.gadgetbridge.entities.AlarmDao;
import nodomain.freeyourgadget.gadgetbridge.entities.BatteryLevelDao; import nodomain.freeyourgadget.gadgetbridge.entities.BatteryLevelDao;
import nodomain.freeyourgadget.gadgetbridge.entities.CyclingSample; import nodomain.freeyourgadget.gadgetbridge.entities.CyclingSample;
@ -277,7 +276,7 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
@Override @Override
@Nullable @Nullable
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) { public ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context) {
return null; return null;
} }

View File

@ -60,11 +60,9 @@ import nodomain.freeyourgadget.gadgetbridge.model.SleepRespiratoryRateSample;
import nodomain.freeyourgadget.gadgetbridge.model.Spo2Sample; import nodomain.freeyourgadget.gadgetbridge.model.Spo2Sample;
import nodomain.freeyourgadget.gadgetbridge.model.StressSample; import nodomain.freeyourgadget.gadgetbridge.model.StressSample;
import nodomain.freeyourgadget.gadgetbridge.model.TemperatureSample; import nodomain.freeyourgadget.gadgetbridge.model.TemperatureSample;
import nodomain.freeyourgadget.gadgetbridge.model.TimeSample;
import nodomain.freeyourgadget.gadgetbridge.model.WeightSample; import nodomain.freeyourgadget.gadgetbridge.model.WeightSample;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.ServiceDeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.ServiceDeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.SleepAsAndroidSender;
/** /**
* This interface is implemented at least once for every supported gadget device. * This interface is implemented at least once for every supported gadget device.
@ -367,7 +365,7 @@ public interface DeviceCoordinator {
* *
* @return * @return
*/ */
ActivitySummaryParser getActivitySummaryParser(final GBDevice device); ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context);
/** /**
* Returns true if this device/coordinator supports installing files like firmware, * Returns true if this device/coordinator supports installing files like firmware,

View File

@ -191,7 +191,7 @@ public class CmfWatchProCoordinator extends AbstractBLEDeviceCoordinator {
@Nullable @Nullable
@Override @Override
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) { public ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context) {
return new CmfWorkoutSummaryParser(device); return new CmfWorkoutSummaryParser(device);
} }

View File

@ -102,8 +102,8 @@ public abstract class GarminCoordinator extends AbstractBLEDeviceCoordinator {
@Nullable @Nullable
@Override @Override
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) { public ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context) {
return new GarminWorkoutParser(); return new GarminWorkoutParser(context);
} }
@Override @Override

View File

@ -2,6 +2,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.garmin;
import static nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryEntries.*; import static nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryEntries.*;
import android.content.Context;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -11,7 +13,10 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.TimeUnit;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.entities.BaseActivitySummary; import nodomain.freeyourgadget.gadgetbridge.entities.BaseActivitySummary;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityPoint; import nodomain.freeyourgadget.gadgetbridge.model.ActivityPoint;
@ -23,17 +28,26 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.enums.Gar
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitPhysiologicalMetrics; import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitPhysiologicalMetrics;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitRecord; import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitRecord;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitSession; import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitSession;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitSet;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitSport; import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitSport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitTimeInZone; import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages.FitTimeInZone;
import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils;
public class GarminWorkoutParser implements ActivitySummaryParser { public class GarminWorkoutParser implements ActivitySummaryParser {
private static final Logger LOG = LoggerFactory.getLogger(GarminWorkoutParser.class); private static final Logger LOG = LoggerFactory.getLogger(GarminWorkoutParser.class);
private final Context context;
private final List<FitTimeInZone> timesInZone = new ArrayList<>(); private final List<FitTimeInZone> timesInZone = new ArrayList<>();
private final List<ActivityPoint> activityPoints = new ArrayList<>(); private final List<ActivityPoint> activityPoints = new ArrayList<>();
private FitSession session = null; private FitSession session = null;
private FitSport sport = null; private FitSport sport = null;
private FitPhysiologicalMetrics physiologicalMetrics = null; private FitPhysiologicalMetrics physiologicalMetrics = null;
private final List<FitSet> sets = new ArrayList<>();
public GarminWorkoutParser(final Context context) {
this.context = context;
}
@Override @Override
public BaseActivitySummary parseBinaryData(final BaseActivitySummary summary, final boolean forDetails) { public BaseActivitySummary parseBinaryData(final BaseActivitySummary summary, final boolean forDetails) {
@ -84,6 +98,7 @@ public class GarminWorkoutParser implements ActivitySummaryParser {
session = null; session = null;
sport = null; sport = null;
physiologicalMetrics = null; physiologicalMetrics = null;
sets.clear();
} }
public boolean handleRecord(final RecordData record) { public boolean handleRecord(final RecordData record) {
@ -111,6 +126,9 @@ public class GarminWorkoutParser implements ActivitySummaryParser {
} else if (record instanceof FitTimeInZone) { } else if (record instanceof FitTimeInZone) {
LOG.trace("Time in zone: {}", record); LOG.trace("Time in zone: {}", record);
timesInZone.add((FitTimeInZone) record); timesInZone.add((FitTimeInZone) record);
} else if (record instanceof FitSet) {
LOG.trace("Set: {}", record);
sets.add((FitSet) record);
} else { } else {
return false; return false;
} }
@ -198,6 +216,40 @@ public class GarminWorkoutParser implements ActivitySummaryParser {
} }
} }
if (!sets.isEmpty()) {
final boolean isMetric = GBApplication.getPrefs().isMetricUnits();
int i = 1;
for (final FitSet set : sets) {
if (set.getSetType() != null && set.getDuration() != null && set.getSetType() == 1) {
final StringBuilder sb = new StringBuilder();
if (set.getRepetitions() != null) {
if (set.getWeight() != null) {
if (isMetric) {
sb.append(context.getString(R.string.workout_set_repetitions_weight_kg, set.getRepetitions(), set.getWeight()));
} else {
sb.append(context.getString(R.string.workout_set_repetitions_weight_lbs, set.getRepetitions(), set.getWeight() * 2.2046226f));
}
} else {
sb.append(context.getString(R.string.workout_set_repetitions, set.getRepetitions()));
}
sb.append(", ");
}
sb.append(DateTimeUtils.formatDurationHoursMinutes(set.getDuration().longValue(), TimeUnit.SECONDS));
summaryData.add(
SETS,
context.getString(R.string.workout_set_i, i),
sb.toString()
);
i++;
}
}
}
summary.setSummaryData(summaryData.toString()); summary.setSummaryData(summaryData.toString());
} }

View File

@ -181,7 +181,7 @@ public abstract class HuamiCoordinator extends AbstractBLEDeviceCoordinator {
} }
@Override @Override
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) { public ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context) {
return new HuamiActivitySummaryParser(); return new HuamiActivitySummaryParser();
} }

View File

@ -296,7 +296,7 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
} }
@Override @Override
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) { public ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context) {
return new ZeppOsActivitySummaryParser(); return new ZeppOsActivitySummaryParser();
} }

View File

@ -182,8 +182,8 @@ public class TestDeviceCoordinator extends AbstractDeviceCoordinator {
@Nullable @Nullable
@Override @Override
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) { public ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context) {
return supportsActivityTracks() ? new TestActivitySummaryParser() : super.getActivitySummaryParser(device); return supportsActivityTracks() ? new TestActivitySummaryParser() : super.getActivitySummaryParser(device, context);
} }
@Override @Override

View File

@ -20,6 +20,7 @@ import static nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi.Xiaomi
import android.app.Activity; import android.app.Activity;
import android.bluetooth.le.ScanFilter; import android.bluetooth.le.ScanFilter;
import android.content.Context;
import android.os.ParcelUuid; import android.os.ParcelUuid;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -167,7 +168,7 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
@Nullable @Nullable
@Override @Override
public ActivitySummaryParser getActivitySummaryParser(final GBDevice device) { public ActivitySummaryParser getActivitySummaryParser(final GBDevice device, final Context context) {
return new WorkoutSummaryParser(); return new WorkoutSummaryParser();
} }

View File

@ -31,9 +31,20 @@ public class ActivitySummaryData extends JSONObject {
private static final Logger LOG = LoggerFactory.getLogger(FitImporter.class); private static final Logger LOG = LoggerFactory.getLogger(FitImporter.class);
public void add(final String key, final float value, final String unit) { public void add(final String key, final float value, final String unit) {
add(null, key, value, unit);
}
public void add(final String key, final String value) {
add(null, key, value);
}
public void add(final String group, final String key, final float value, final String unit) {
if (value > 0) { if (value > 0) {
try { try {
final JSONObject innerData = new JSONObject(); final JSONObject innerData = new JSONObject();
if (group != null) {
innerData.put("group", group);
}
innerData.put("value", value); innerData.put("value", value);
innerData.put("unit", unit); innerData.put("unit", unit);
put(key, innerData); put(key, innerData);
@ -43,10 +54,13 @@ public class ActivitySummaryData extends JSONObject {
} }
} }
public void add(final String key, final String value) { public void add(final String group, final String key, final String value) {
if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) { if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) {
try { try {
final JSONObject innerData = new JSONObject(); final JSONObject innerData = new JSONObject();
if (group != null) {
innerData.put("group", group);
}
innerData.put("value", value); innerData.put("value", value);
innerData.put("unit", "string"); innerData.put("unit", "string");
put(key, innerData); put(key, innerData);

View File

@ -112,6 +112,8 @@ public class ActivitySummaryEntries {
public static final String CYCLING_POWER_MIN = "cyclingPowerMin"; public static final String CYCLING_POWER_MIN = "cyclingPowerMin";
public static final String CYCLING_POWER_MAX = "cyclingPowerMax"; public static final String CYCLING_POWER_MAX = "cyclingPowerMax";
public static final String SETS = "workoutSets";
public static final String UNIT_BPM = "bpm"; public static final String UNIT_BPM = "bpm";
public static final String UNIT_CM = "cm"; public static final String UNIT_CM = "cm";
public static final String UNIT_UNIX_EPOCH_SECONDS = "unix_epoch_seconds"; public static final String UNIT_UNIX_EPOCH_SECONDS = "unix_epoch_seconds";

View File

@ -193,6 +193,8 @@ public class ActivitySummaryJsonSummary {
} }
return defaultGroup; return defaultGroup;
} }
/** @noinspection ArraysAsListWithZeroOrOneArgument*/
private JSONObject createActivitySummaryGroups(){ private JSONObject createActivitySummaryGroups(){
final Map<String, List<String>> groupDefinitions = new LinkedHashMap<String, List<String>>() {{ final Map<String, List<String>> groupDefinitions = new LinkedHashMap<String, List<String>>() {{
// NB: Default group Activity must be present in this definition, otherwise it wouldn't // NB: Default group Activity must be present in this definition, otherwise it wouldn't
@ -237,6 +239,8 @@ public class ActivitySummaryJsonSummary {
FORE_FOOT_LANDINGS, MID_FOOT_LANDINGS, BACK_FOOT_LANDINGS, FORE_FOOT_LANDINGS, MID_FOOT_LANDINGS, BACK_FOOT_LANDINGS,
EVERSION_ANGLE_AVG, EVERSION_ANGLE_MAX EVERSION_ANGLE_AVG, EVERSION_ANGLE_MAX
)); ));
put(SETS, Arrays.asList(
));
}}; }};
return new JSONObject(groupDefinitions); return new JSONObject(groupDefinitions);

View File

@ -81,11 +81,12 @@ public class FitImporter {
private final Map<Integer, Integer> unknownRecords = new HashMap<>(); private final Map<Integer, Integer> unknownRecords = new HashMap<>();
private FitFileId fileId = null; private FitFileId fileId = null;
private final GarminWorkoutParser workoutParser = new GarminWorkoutParser(); private final GarminWorkoutParser workoutParser;
public FitImporter(final Context context, final GBDevice gbDevice) { public FitImporter(final Context context, final GBDevice gbDevice) {
this.context = context; this.context = context;
this.gbDevice = gbDevice; this.gbDevice = gbDevice;
this.workoutParser = new GarminWorkoutParser(context);
} }
/** @noinspection StatementWithEmptyBody*/ /** @noinspection StatementWithEmptyBody*/

View File

@ -259,9 +259,12 @@ public class GlobalFITMessage {
)); ));
public static GlobalFITMessage SET = new GlobalFITMessage(225, "SET", Arrays.asList( public static GlobalFITMessage SET = new GlobalFITMessage(225, "SET", Arrays.asList(
new FieldDefinitionPrimitive(0, BaseType.UINT32, "duration"), new FieldDefinitionPrimitive(0, BaseType.UINT32, "duration", 1000, 0), // seconds
new FieldDefinitionPrimitive(3, BaseType.UINT16, "repetitions"),
new FieldDefinitionPrimitive(4, BaseType.UINT16, "weight", 16, 0), // kg
new FieldDefinitionPrimitive(5, BaseType.UINT8, "set_type"), // 1 active 0 rest new FieldDefinitionPrimitive(5, BaseType.UINT8, "set_type"), // 1 active 0 rest
new FieldDefinitionPrimitive(6, BaseType.UINT32, "start_time", FieldDefinitionFactory.FIELD.TIMESTAMP), new FieldDefinitionPrimitive(6, BaseType.UINT32, "start_time", FieldDefinitionFactory.FIELD.TIMESTAMP),
new FieldDefinitionPrimitive(7, BaseType.UINT16, "category"),
new FieldDefinitionPrimitive(10, BaseType.UINT16, "message_index"), new FieldDefinitionPrimitive(10, BaseType.UINT16, "message_index"),
new FieldDefinitionPrimitive(254, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP) new FieldDefinitionPrimitive(254, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP)
)); ));

View File

@ -21,8 +21,18 @@ public class FitSet extends RecordData {
} }
@Nullable @Nullable
public Long getDuration() { public Double getDuration() {
return (Long) getFieldByNumber(0); return (Double) getFieldByNumber(0);
}
@Nullable
public Integer getRepetitions() {
return (Integer) getFieldByNumber(3);
}
@Nullable
public Float getWeight() {
return (Float) getFieldByNumber(4);
} }
@Nullable @Nullable
@ -35,6 +45,11 @@ public class FitSet extends RecordData {
return (Long) getFieldByNumber(6); return (Long) getFieldByNumber(6);
} }
@Nullable
public Integer getCategory() {
return (Integer) getFieldByNumber(7);
}
@Nullable @Nullable
public Integer getMessageIndex() { public Integer getMessageIndex() {
return (Integer) getFieldByNumber(10); return (Integer) getFieldByNumber(10);

View File

@ -75,7 +75,7 @@ public class FetchSportsSummaryOperation extends AbstractFetchOperation {
} }
final DeviceCoordinator coordinator = getDevice().getDeviceCoordinator(); final DeviceCoordinator coordinator = getDevice().getDeviceCoordinator();
final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(getDevice()); final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(getDevice(), getContext());
BaseActivitySummary summary = new BaseActivitySummary(); BaseActivitySummary summary = new BaseActivitySummary();
summary.setStartTime(getLastStartTimestamp().getTime()); // due to a bug this has to be set summary.setStartTime(getLastStartTimestamp().getTime()); // due to a bug this has to be set

View File

@ -36,6 +36,8 @@ import java.util.Date;
import java.util.Locale; import java.util.Locale;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -184,4 +186,8 @@ public class GBPrefs extends Prefs {
public LocalTime getNotificationTimesEnd() { public LocalTime getNotificationTimesEnd() {
return getLocalTime("notification_times_end", "22:00"); return getLocalTime("notification_times_end", "22:00");
} }
public boolean isMetricUnits() {
return getString(SettingsActivity.PREF_MEASUREMENT_SYSTEM, "metric").equals("metric");
}
} }

View File

@ -2180,6 +2180,11 @@
<string name="cyclingPowerAverage">Average cycling power</string> <string name="cyclingPowerAverage">Average cycling power</string>
<string name="cyclingPowerMin">Min cycling power</string> <string name="cyclingPowerMin">Min cycling power</string>
<string name="cyclingPowerMax">Max cycling power</string> <string name="cyclingPowerMax">Max cycling power</string>
<string name="workoutSets">Sets</string>
<string name="workout_set_i">Set %1d</string>
<string name="workout_set_repetitions">%1d x</string>
<string name="workout_set_repetitions_weight_kg">%1d x %2$.2f kg</string>
<string name="workout_set_repetitions_weight_lbs">%1d x %2$.2f lbs</string>
<!-- activity summary units--> <!-- activity summary units-->
<string name="meters">m</string> <string name="meters">m</string>
<string name="cm">cm</string> <string name="cm">cm</string>