hide also the connection quality field. fix string formatting

This commit is contained in:
Andrei Vereha 2021-07-31 14:57:46 +02:00
parent b6d41e7d73
commit 24eecda1c0
2 changed files with 7 additions and 6 deletions

View file

@ -169,6 +169,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
}
if (buildHelper.isEngineeringMode()) {
bluetoothStatusBinding.deliveryStatus.visibility = View.VISIBLE
bluetoothStatusBinding.connectionQuality.visibility = View.VISIBLE
}
}
@ -240,10 +241,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
}
val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100
val successPercentageString = String.format("%.2f %", podStateManager.connectionSuccessRatio())
val connectionQuality =
val successPercentageString = String.format("%.2f %%", podStateManager.connectionSuccessRatio())
val quality =
"${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString"
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = connectionQuality
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
val connectionStatsColor = when {
connectionSuccessPercentage > 90 ->
Color.WHITE

View file

@ -79,9 +79,11 @@
</LinearLayout>
<LinearLayout
android:id="@+id/connectionQuality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
@ -112,7 +114,6 @@
android:gravity="start"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:text="{fa-bluetooth-b} "
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
@ -153,7 +154,6 @@
android:gravity="start"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:text="{fa-bluetooth-b} "
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>