feat: show number of retrieved measurements

This commit is contained in:
Fabian Christoffel
2023-07-04 14:17:58 +02:00
parent 813cd4703e
commit b32ed5f528
2 changed files with 20 additions and 2 deletions

View File

@@ -177,7 +177,6 @@ class KirbyDevice(
override var rssi: Int? = null
private fun addMeasurement(characteristic: BluetoothGattCharacteristic) {
if (characteristic.service.uuid == DEMO_SERVICE_UUID && characteristic.uuid == DEMO_CHAR_UUID) {
val payload = decodeDemoPayload(characteristic.value)
@@ -211,7 +210,21 @@ class KirbyDevice(
return emptyList()
}
val latest = measurements.last()
return demoPayloadToMeasurements(latest)
val result = mutableListOf<Measurement>(object : Measurement {
override fun getLabel(): String {
return "Index"
}
override fun getIcon(): Int {
return R.drawable.baseline_numbers_24
}
override fun getFormattedValue(): String {
return measurements.size.toString()
}
})
result.addAll(demoPayloadToMeasurements(latest))
return result
}
override fun getActions(): List<Action> {

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20.5,10L21,8h-4l1,-4h-2l-1,4h-4l1,-4h-2L9,8H5l-0.5,2h4l-1,4h-4L3,16h4l-1,4h2l1,-4h4l-1,4h2l1,-4h4l0.5,-2h-4l1,-4H20.5zM13.5,14h-4l1,-4h4L13.5,14z"/>
</vector>