1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Make heart rate measurement intervals configurable per-device

This commit is contained in:
José Rebelo 2022-08-25 10:07:23 +01:00 committed by Gitea
parent c1e8a57a22
commit b21ffaa528
12 changed files with 258 additions and 105 deletions

View File

@ -51,6 +51,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.CalBlacklistActivity;
import nodomain.freeyourgadget.gadgetbridge.activities.ConfigureWorldClocks;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
@ -349,79 +350,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp
});
}
final Preference enableHeartrateSleepSupport = findPreference(PREF_HEARTRATE_USE_FOR_SLEEP_DETECTION);
if (enableHeartrateSleepSupport != null) {
enableHeartrateSleepSupport.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newVal) {
GBApplication.deviceService(device).onEnableHeartRateSleepSupport(Boolean.TRUE.equals(newVal));
return true;
}
});
}
addPreferenceHandlerFor(PREF_HEARTRATE_ALERT_HIGH_THRESHOLD);
addPreferenceHandlerFor(PREF_HEARTRATE_ALERT_LOW_THRESHOLD);
final ListPreference heartrateMeasurementInterval = findPreference(PREF_HEARTRATE_MEASUREMENT_INTERVAL);
final ListPreference heartrateAlertHigh = findPreference(PREF_HEARTRATE_ALERT_HIGH_THRESHOLD);
final ListPreference heartrateAlertLow = findPreference(PREF_HEARTRATE_ALERT_LOW_THRESHOLD);
// Newer devices that have low alert threshold can only use it if measurement interval is smart (-1) or 1 minute
final boolean hrAlertsNeedSmartOrOne = heartrateAlertHigh != null && heartrateAlertLow != null && heartrateMeasurementInterval != null;
if (hrAlertsNeedSmartOrOne) {
final boolean hrMonitoringIsSmartOrOne = heartrateMeasurementInterval.getValue().equals("60") ||
heartrateMeasurementInterval.getValue().equals("-1");
heartrateAlertHigh.setEnabled(hrMonitoringIsSmartOrOne);
heartrateAlertLow.setEnabled(hrMonitoringIsSmartOrOne);
}
if (heartrateMeasurementInterval != null) {
final SwitchPreference activityMonitoring = findPreference(PREF_HEARTRATE_ACTIVITY_MONITORING);
final SwitchPreference heartrateAlertEnabled = findPreference(PREF_HEARTRATE_ALERT_ENABLED);
final SwitchPreference stressMonitoring = findPreference(PREF_HEARTRATE_STRESS_MONITORING);
heartrateMeasurementInterval.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(final Preference preference, final Object newVal) {
GBApplication.deviceService(device).onSetHeartRateMeasurementInterval(Integer.parseInt((String) newVal));
final boolean isMeasurementIntervalEnabled = !newVal.equals("0");
if (activityMonitoring != null) {
activityMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
if (heartrateAlertEnabled != null) {
heartrateAlertEnabled.setEnabled(isMeasurementIntervalEnabled);
}
if (hrAlertsNeedSmartOrOne) {
// Same as above, check if smart or 1 minute
final boolean hrMonitoringIsSmartOrOne = newVal.equals("60") || newVal.equals("-1");
heartrateAlertHigh.setEnabled(hrMonitoringIsSmartOrOne);
heartrateAlertLow.setEnabled(hrMonitoringIsSmartOrOne);
}
if (stressMonitoring != null && !hrAlertsNeedSmartOrOne) {
// Newer devices (that have hrAlertsNeedSmartOrOne) also don't need HR monitoring for stress monitoring
stressMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
return true;
}
});
final boolean isMeasurementIntervalEnabled = !heartrateMeasurementInterval.getValue().equals("0");
if (activityMonitoring != null) {
activityMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
if (heartrateAlertEnabled != null) {
heartrateAlertEnabled.setEnabled(isMeasurementIntervalEnabled);
}
if (stressMonitoring != null && !hrAlertsNeedSmartOrOne) {
// Newer devices (that have hrAlertsNeedSmartOrOne) also don't need HR monitoring for stress monitoring
stressMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
}
addPreferenceHandlerFor(PREF_SWIPE_UNLOCK);
addPreferenceHandlerFor(PREF_MI2_DATEFORMAT);
@ -828,6 +757,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, InputType.TYPE_CLASS_NUMBER);
new PasswordCapabilityImpl().registerPreferences(getContext(), coordinator.getPasswordCapability(), this);
new HeartRateCapability().registerPreferences(getContext(), coordinator.getHeartRateMeasurementIntervals(), this);
String deviceActionsFellSleepSelection = prefs.getString(PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION, PREF_DEVICE_ACTION_SELECTION_OFF);
final Preference deviceActionsFellSleep = findPreference(PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION);
@ -1018,6 +948,11 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp
}
}
@Override
public GBDevice getDevice() {
return device;
}
/**
* Keys of preferences which should print its values as a summary below the preference name.
*/

View File

@ -19,6 +19,8 @@ package nodomain.freeyourgadget.gadgetbridge.activities.devicesettings;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
/**
* A device-specific preference handler, that allows for {@link nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator}s to register
* their own preferences dynamically.
@ -61,4 +63,11 @@ public interface DeviceSpecificSettingsHandler {
* @param editTypeFlags the edit type {@link android.text.InputType} flags.
*/
void setInputTypeFor(final String preferenceKey, final int editTypeFlags);
/**
* Get the device associated with this {@link DeviceSpecificSettingsHandler}.
*
* @return the {@link GBDevice}.
*/
GBDevice getDevice();
}

View File

@ -0,0 +1,158 @@
/* Copyright (C) 2022 José Rebelo
This file is part of Gadgetbridge.
Gadgetbridge is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gadgetbridge is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.capabilities;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HEARTRATE_ACTIVITY_MONITORING;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HEARTRATE_ALERT_ENABLED;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HEARTRATE_ALERT_HIGH_THRESHOLD;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HEARTRATE_ALERT_LOW_THRESHOLD;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HEARTRATE_MEASUREMENT_INTERVAL;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HEARTRATE_STRESS_MONITORING;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HEARTRATE_USE_FOR_SLEEP_DETECTION;
import android.content.Context;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsHandler;
public class HeartRateCapability {
public enum MeasurementInterval {
OFF(0, R.string.off),
SMART(-1, R.string.smart),
MINUTES_1(60, R.string.interval_one_minute),
MINUTES_5(300, R.string.interval_five_minutes),
MINUTES_10(600, R.string.interval_ten_minutes),
MINUTES_15(900, R.string.interval_fifteen_minutes),
MINUTES_30(1800, R.string.interval_thirty_minutes),
MINUTES_45(2700, R.string.interval_forty_five_minutes),
HOUR_1(3600, R.string.interval_one_hour),
;
private final int intervalSeconds;
private final int label;
MeasurementInterval(final int intervalSeconds, final int label) {
this.intervalSeconds = intervalSeconds;
this.label = label;
}
public int getIntervalSeconds() {
return intervalSeconds;
}
public int getLabel() {
return label;
}
public String getLabel(final Context context) {
return context.getString(label);
}
}
public void registerPreferences(final Context context, final List<MeasurementInterval> intervals, final DeviceSpecificSettingsHandler handler) {
final Preference enableHeartrateSleepSupport = handler.findPreference(PREF_HEARTRATE_USE_FOR_SLEEP_DETECTION);
if (enableHeartrateSleepSupport != null) {
enableHeartrateSleepSupport.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newVal) {
GBApplication.deviceService(handler.getDevice()).onEnableHeartRateSleepSupport(Boolean.TRUE.equals(newVal));
return true;
}
});
}
handler.addPreferenceHandlerFor(PREF_HEARTRATE_ALERT_HIGH_THRESHOLD);
handler.addPreferenceHandlerFor(PREF_HEARTRATE_ALERT_LOW_THRESHOLD);
final ListPreference heartrateMeasurementInterval = handler.findPreference(PREF_HEARTRATE_MEASUREMENT_INTERVAL);
final ListPreference heartrateAlertHigh = handler.findPreference(PREF_HEARTRATE_ALERT_HIGH_THRESHOLD);
final ListPreference heartrateAlertLow = handler.findPreference(PREF_HEARTRATE_ALERT_LOW_THRESHOLD);
// Newer devices that have low alert threshold can only use it if measurement interval is smart (-1) or 1 minute
final boolean hrAlertsNeedSmartOrOne = heartrateAlertHigh != null && heartrateAlertLow != null && heartrateMeasurementInterval != null;
if (hrAlertsNeedSmartOrOne) {
final boolean hrMonitoringIsSmartOrOne = heartrateMeasurementInterval.getValue().equals("60") ||
heartrateMeasurementInterval.getValue().equals("-1");
heartrateAlertHigh.setEnabled(hrMonitoringIsSmartOrOne);
heartrateAlertLow.setEnabled(hrMonitoringIsSmartOrOne);
}
if (heartrateMeasurementInterval != null) {
// Set the measurement intervals dynamically, as per the device's capability
final CharSequence[] entries = new CharSequence[intervals.size()];
final CharSequence[] values = new CharSequence[intervals.size()];
for (int i = 0; i < intervals.size(); i++) {
entries[i] = intervals.get(i).getLabel(context);
values[i] = String.valueOf(intervals.get(i).getIntervalSeconds());
}
heartrateMeasurementInterval.setEntries(entries);
heartrateMeasurementInterval.setEntryValues(values);
final SwitchPreference activityMonitoring = handler.findPreference(PREF_HEARTRATE_ACTIVITY_MONITORING);
final SwitchPreference heartrateAlertEnabled = handler.findPreference(PREF_HEARTRATE_ALERT_ENABLED);
final SwitchPreference stressMonitoring = handler.findPreference(PREF_HEARTRATE_STRESS_MONITORING);
heartrateMeasurementInterval.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(final Preference preference, final Object newVal) {
GBApplication.deviceService(handler.getDevice()).onSetHeartRateMeasurementInterval(Integer.parseInt((String) newVal));
final boolean isMeasurementIntervalEnabled = !newVal.equals("0");
if (activityMonitoring != null) {
activityMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
if (heartrateAlertEnabled != null) {
heartrateAlertEnabled.setEnabled(isMeasurementIntervalEnabled);
}
if (hrAlertsNeedSmartOrOne) {
// Same as above, check if smart or 1 minute
final boolean hrMonitoringIsSmartOrOne = newVal.equals("60") || newVal.equals("-1");
heartrateAlertHigh.setEnabled(hrMonitoringIsSmartOrOne);
heartrateAlertLow.setEnabled(hrMonitoringIsSmartOrOne);
}
if (stressMonitoring != null && !hrAlertsNeedSmartOrOne) {
// Newer devices (that have hrAlertsNeedSmartOrOne) also don't need HR monitoring for stress monitoring
stressMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
return true;
}
});
final boolean isMeasurementIntervalEnabled = !heartrateMeasurementInterval.getValue().equals("0");
if (activityMonitoring != null) {
activityMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
if (heartrateAlertEnabled != null) {
heartrateAlertEnabled.setEnabled(isMeasurementIntervalEnabled);
}
if (stressMonitoring != null && !hrAlertsNeedSmartOrOne) {
// Newer devices (that have hrAlertsNeedSmartOrOne) also don't need HR monitoring for stress monitoring
stressMonitoring.setEnabled(isMeasurementIntervalEnabled);
}
}
}
}

View File

@ -31,14 +31,13 @@ import java.util.ArrayList;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsHandler;
public class PasswordCapabilityImpl {
public static final String PREF_PASSWORD = "pref_password";
public static final String PREF_PASSWORD_ENABLED = "pref_password_enabled";
public static enum Mode {
public enum Mode {
NONE,
NUMBERS_4_DIGITS_1_TO_4,
NUMBERS_6,

View File

@ -32,14 +32,17 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import de.greenrobot.dao.query.QueryBuilder;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
@ -343,4 +346,16 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
public PasswordCapabilityImpl.Mode getPasswordCapability() {
return PasswordCapabilityImpl.Mode.NONE;
}
@Override
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
return Arrays.asList(
HeartRateCapability.MeasurementInterval.OFF,
HeartRateCapability.MeasurementInterval.MINUTES_1,
HeartRateCapability.MeasurementInterval.MINUTES_5,
HeartRateCapability.MeasurementInterval.MINUTES_10,
HeartRateCapability.MeasurementInterval.MINUTES_30,
HeartRateCapability.MeasurementInterval.HOUR_1
);
}
}

View File

@ -28,11 +28,13 @@ import android.os.Build;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -448,4 +450,6 @@ public interface DeviceCoordinator {
boolean supportsPowerOff();
PasswordCapabilityImpl.Mode getPasswordCapability();
List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals();
}

View File

@ -26,7 +26,11 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
@ -147,4 +151,15 @@ public class MiBand4Coordinator extends HuamiCoordinator {
public PasswordCapabilityImpl.Mode getPasswordCapability() {
return PasswordCapabilityImpl.Mode.NUMBERS_4_DIGITS_1_TO_4;
}
@Override
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
return Arrays.asList(
HeartRateCapability.MeasurementInterval.OFF,
HeartRateCapability.MeasurementInterval.MINUTES_1,
HeartRateCapability.MeasurementInterval.MINUTES_5,
HeartRateCapability.MeasurementInterval.MINUTES_10,
HeartRateCapability.MeasurementInterval.MINUTES_30
);
}
}

View File

@ -26,7 +26,11 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
@ -160,4 +164,15 @@ public class MiBand5Coordinator extends HuamiCoordinator {
public int getBondingStyle() {
return BONDING_STYLE_REQUIRE_KEY;
}
@Override
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
return Arrays.asList(
HeartRateCapability.MeasurementInterval.OFF,
HeartRateCapability.MeasurementInterval.MINUTES_1,
HeartRateCapability.MeasurementInterval.MINUTES_5,
HeartRateCapability.MeasurementInterval.MINUTES_10,
HeartRateCapability.MeasurementInterval.MINUTES_30
);
}
}

View File

@ -10,6 +10,10 @@ import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import java.util.Arrays;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
@ -146,4 +150,15 @@ public class MiBand6Coordinator extends HuamiCoordinator {
public PasswordCapabilityImpl.Mode getPasswordCapability() {
return PasswordCapabilityImpl.Mode.NUMBERS_6;
}
@Override
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
return Arrays.asList(
HeartRateCapability.MeasurementInterval.OFF,
HeartRateCapability.MeasurementInterval.MINUTES_1,
HeartRateCapability.MeasurementInterval.MINUTES_5,
HeartRateCapability.MeasurementInterval.MINUTES_10,
HeartRateCapability.MeasurementInterval.MINUTES_30
);
}
}

View File

@ -25,14 +25,15 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.entities.AbstractActivitySample;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
@ -139,4 +140,15 @@ public class MiBand7Coordinator extends Huami2021Coordinator {
public PasswordCapabilityImpl.Mode getPasswordCapability() {
return PasswordCapabilityImpl.Mode.NUMBERS_6;
}
@Override
public List<HeartRateCapability.MeasurementInterval> getHeartRateMeasurementIntervals() {
return Arrays.asList(
HeartRateCapability.MeasurementInterval.OFF,
HeartRateCapability.MeasurementInterval.SMART,
HeartRateCapability.MeasurementInterval.MINUTES_1,
HeartRateCapability.MeasurementInterval.MINUTES_10,
HeartRateCapability.MeasurementInterval.MINUTES_30
);
}
}

View File

@ -1742,37 +1742,13 @@
</string-array>
<string-array name="prefs_heartrate_measurement_interval">
<!-- This will be filled dynamically by HeartRateCapability -->
<item name="0">@string/off</item>
<item name="60">@string/interval_one_minute</item>
<item name="300">@string/interval_five_minutes</item>
<item name="600">@string/interval_ten_minutes</item>
<item name="1800">@string/interval_thirty_minutes</item>
<item name="3600">@string/interval_one_hour</item>
</string-array>
<string-array name="prefs_heartrate_measurement_interval_values">
<!-- This will be filled dynamically by HeartRateCapability -->
<item>0</item>
<item>60</item>
<item>300</item>
<item>600</item>
<item>1800</item>
<item>3600</item>
</string-array>
<string-array name="prefs_heartrate_measurement_interval_with_smart">
<item name="0">@string/off</item>
<item name="-1">@string/smart</item>
<item name="60">@string/interval_one_minute</item>
<item name="600">@string/interval_ten_minutes</item>
<item name="1800">@string/interval_thirty_minutes</item>
</string-array>
<string-array name="prefs_heartrate_measurement_interval_with_smart_values">
<item>0</item>
<item>-1</item>
<item>60</item>
<item>600</item>
<item>1800</item>
</string-array>
<string-array name="prefs_miband_heartrate_alert_threshold">

View File

@ -30,8 +30,8 @@
<ListPreference
android:defaultValue="0"
android:entries="@array/prefs_heartrate_measurement_interval_with_smart"
android:entryValues="@array/prefs_heartrate_measurement_interval_with_smart_values"
android:entries="@array/prefs_heartrate_measurement_interval"
android:entryValues="@array/prefs_heartrate_measurement_interval_values"
android:icon="@drawable/ic_heartrate"
android:key="heartrate_measurement_interval"
android:summary="%s"