parent
e4e1af3829
commit
abc408bc27
2 changed files with 56 additions and 0 deletions
|
@ -171,6 +171,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
|
||||||
}
|
}
|
||||||
podInfoBinding.omnipodCommonOverviewLotNumberLayout.visibility = View.GONE
|
podInfoBinding.omnipodCommonOverviewLotNumberLayout.visibility = View.GONE
|
||||||
podInfoBinding.omnipodCommonOverviewPodUniqueIdLayout.visibility = View.GONE
|
podInfoBinding.omnipodCommonOverviewPodUniqueIdLayout.visibility = View.GONE
|
||||||
|
@ -251,6 +252,21 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
private fun updateBluetoothStatus() {
|
private fun updateBluetoothStatus() {
|
||||||
bluetoothStatusBinding.omnipodDashBluetoothAddress.text = podStateManager.bluetoothAddress
|
bluetoothStatusBinding.omnipodDashBluetoothAddress.text = podStateManager.bluetoothAddress
|
||||||
?: PLACEHOLDER
|
?: PLACEHOLDER
|
||||||
|
|
||||||
|
val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100
|
||||||
|
val successPercentageString = String.format("%.2f %%", connectionSuccessPercentage)
|
||||||
|
val quality =
|
||||||
|
"${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString"
|
||||||
|
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
|
||||||
|
val connectionStatsColor = when {
|
||||||
|
connectionSuccessPercentage > 90 ->
|
||||||
|
Color.WHITE
|
||||||
|
connectionSuccessPercentage > 60 ->
|
||||||
|
Color.YELLOW
|
||||||
|
else ->
|
||||||
|
Color.RED
|
||||||
|
}
|
||||||
|
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor)
|
||||||
bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let {
|
bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let {
|
||||||
podStateManager.deliveryStatus.toString()
|
podStateManager.deliveryStatus.toString()
|
||||||
} ?: PLACEHOLDER
|
} ?: PLACEHOLDER
|
||||||
|
|
|
@ -77,6 +77,46 @@
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/connectionQuality"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.5"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:text="@string/omnipod_dash_overview_bluetooth_connection_quality"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingStart="2dp"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
|
android:text=":"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
|
<com.joanzapata.iconify.widget.IconTextView
|
||||||
|
android:id="@+id/omnipod_dash_bluetooth_connection_quality"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="start"
|
||||||
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/deliveryStatus"
|
android:id="@+id/deliveryStatus"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue