1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

Fix temperature preferences

This commit is contained in:
José Rebelo 2024-02-18 22:11:08 +00:00
parent f5b46b295b
commit 99dc218cd1
5 changed files with 47 additions and 4 deletions

View File

@ -51,7 +51,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.TemperatureSample; import nodomain.freeyourgadget.gadgetbridge.model.TemperatureSample;
public class TemperatureChartFragment extends AbstractChartFragment<TemperatureChartFragment.TemperatureChartsData> { public class TemperatureChartFragment extends AbstractChartFragment<TemperatureChartFragment.TemperatureChartsData> {
protected static final Logger LOG = LoggerFactory.getLogger(ActivitySleepChartFragment.class); protected static final Logger LOG = LoggerFactory.getLogger(TemperatureChartFragment.class);
private LineChart mTemperatureChart; private LineChart mTemperatureChart;
private int BACKGROUND_COLOR; private int BACKGROUND_COLOR;

View File

@ -281,6 +281,31 @@ public class TestDeviceCoordinator extends AbstractDeviceCoordinator {
return supports(getTestDevice(), TestFeature.ACTIVITY_TRACKING); return supports(getTestDevice(), TestFeature.ACTIVITY_TRACKING);
} }
@Override
public boolean supportsSleepMeasurement() {
return supports(getTestDevice(), TestFeature.SLEEP_MEASUREMENT);
}
@Override
public boolean supportsStepCounter() {
return supports(getTestDevice(), TestFeature.STEP_COUNTER);
}
@Override
public boolean supportsSpeedzones() {
return supports(getTestDevice(), TestFeature.SPEEDZONES);
}
@Override
public boolean supportsActivityTabs() {
return supports(getTestDevice(), TestFeature.ACTIVITY_TABS);
}
@Override
public boolean supportsTemperatureMeasurement() {
return supports(getTestDevice(), TestFeature.TEMPERATURE_MEASUREMENT);
}
@Override @Override
public boolean supportsActivityTracks() { public boolean supportsActivityTracks() {
return supports(getTestDevice(), TestFeature.ACTIVITY_TRACKS); return supports(getTestDevice(), TestFeature.ACTIVITY_TRACKS);

View File

@ -18,6 +18,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.test;
public enum TestFeature { public enum TestFeature {
ACTIVITY_DATA_FETCHING, ACTIVITY_DATA_FETCHING,
ACTIVITY_TABS,
ACTIVITY_TRACKING, ACTIVITY_TRACKING,
ACTIVITY_TRACKS, ACTIVITY_TRACKS,
ALARM_DESCRIPTION, ALARM_DESCRIPTION,
@ -54,12 +55,16 @@ public enum TestFeature {
REMINDERS, REMINDERS,
RGB_LED_COLOR, RGB_LED_COLOR,
SCREENSHOTS, SCREENSHOTS,
SLEEP_MEASUREMENT,
SLEEP_RESPIRATORY_RATE, SLEEP_RESPIRATORY_RATE,
SMART_WAKEUP, SMART_WAKEUP,
SMART_WAKEUP_INTERVAL, SMART_WAKEUP_INTERVAL,
SMART_WAKEUP_FORCED_SLOT, SMART_WAKEUP_FORCED_SLOT,
SPEEDZONES,
SPO2, SPO2,
STEP_COUNTER,
STRESS_MEASUREMENT, STRESS_MEASUREMENT,
TEMPERATURE_MEASUREMENT,
UNICODE_EMOJIS, UNICODE_EMOJIS,
WATCHFACE_MANAGEMENT, WATCHFACE_MANAGEMENT,
WEATHER, WEATHER,

View File

@ -19,7 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.test.samples;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.Collections; import java.util.ArrayList;
import java.util.List; import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.TimeSampleProvider;
@ -30,8 +30,19 @@ public class TestTemperatureSampleProvider implements TimeSampleProvider<Tempera
@NonNull @NonNull
@Override @Override
public List<TemperatureSample> getAllSamples(final long timestampFrom, final long timestampTo) { public List<TemperatureSample> getAllSamples(final long timestampFrom, final long timestampTo) {
// TODO fake samples final List<TemperatureSample> samples = new ArrayList<>();
return Collections.emptyList();
int temp = TestDeviceRand.randInt(timestampFrom, 33, 40);
for (long ts = timestampFrom; ts < timestampTo; ts += 120 * 60 * 1000L) {
if (TestDeviceRand.randBool(ts, 0.3f)) {
samples.add(new TestTemperatureSample(ts, temp));
}
temp += TestDeviceRand.randInt(ts, 33 - temp, 40 - temp);
break;
}
return samples;
} }
@Override @Override

View File

@ -2994,6 +2994,7 @@
<item>@string/stats_title</item> <item>@string/stats_title</item>
<item>@string/liveactivity_live_activity</item> <item>@string/liveactivity_live_activity</item>
<item>@string/pref_header_spo2</item> <item>@string/pref_header_spo2</item>
<item>@string/menuitem_temperature</item>
</string-array> </string-array>
<string-array name="pref_charts_tabs_values"> <string-array name="pref_charts_tabs_values">
@ -3007,6 +3008,7 @@
<item>@string/p_speed_zones</item> <item>@string/p_speed_zones</item>
<item>@string/p_live_stats</item> <item>@string/p_live_stats</item>
<item>@string/p_spo2</item> <item>@string/p_spo2</item>
<item>@string/p_temperature</item>
</string-array> </string-array>
<string-array name="pref_charts_tabs_items_default"> <string-array name="pref_charts_tabs_items_default">