Sensor: add temperature.

Fixes #2241.
This commit is contained in:
Dennis Guse
2026-01-04 09:56:44 +01:00
parent 738201c1c2
commit 54844b9a9a
36 changed files with 435 additions and 44 deletions
@@ -274,6 +274,10 @@ public class PreferencesUtils {
return getString(R.string.settings_sensor_bluetooth_heart_rate_key, getBluetoothSensorAddressNone());
}
public static String getBluetoothTemperatureSensorAddress() {
return getString(R.string.settings_sensor_bluetooth_temperature_key, getBluetoothSensorAddressNone());
}
public static String getBluetoothCyclingCadenceSensorAddress() {
return getString(R.string.settings_sensor_bluetooth_cycling_cadence_key, getBluetoothSensorAddressNone());
}
@@ -830,7 +834,8 @@ public class PreferencesUtils {
R.array.stats_custom_layout_fields_default_value_17,
R.array.stats_custom_layout_fields_default_value_18,
R.array.stats_custom_layout_fields_default_value_19,
R.array.stats_custom_layout_fields_default_value_20
R.array.stats_custom_layout_fields_default_value_20,
R.array.stats_custom_layout_fields_default_value_21
).map(id -> resources.obtainTypedArray(id))
.toList();
}
@@ -0,0 +1,35 @@
package de.dennisguse.opentracks.settings.bluetooth;
import android.content.Context;
import android.util.AttributeSet;
import androidx.preference.PreferenceDialogFragmentCompat;
import java.util.List;
import de.dennisguse.opentracks.sensors.BluetoothHandlerTemperature;
public class BluetoothLeTemperaturePreference extends BluetoothLeSensorPreference {
public BluetoothLeTemperaturePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public BluetoothLeTemperaturePreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public BluetoothLeTemperaturePreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BluetoothLeTemperaturePreference(Context context) {
super(context);
}
@Override
public PreferenceDialogFragmentCompat createInstance() {
return BluetoothLeSensorPreferenceDialog
.newInstance(getKey(), List.of(BluetoothHandlerTemperature.TEMPERATURE));
}
}