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

View file

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