Show Suspend & resume button in the same place and don't show suspend button when the Pod is suspended

This commit is contained in:
Bart Sopers 2020-08-26 14:57:40 +02:00
parent 5a7c14fb2e
commit 908c666d5f
2 changed files with 14 additions and 13 deletions

View file

@ -394,7 +394,8 @@ class OmnipodFragment : DaggerFragment() {
}
private fun updateSuspendDeliveryButton() {
if (aapsOmnipodManager.isSuspendDeliveryButtonEnabled) {
// If the Pod is currently suspended, we show the Resume delivery button instead.
if (aapsOmnipodManager.isSuspendDeliveryButtonEnabled && !(podStateManager.isPodRunning && podStateManager.isSuspended)) {
omnipod_button_suspend_delivery.visibility = View.VISIBLE
omnipod_button_suspend_delivery.isEnabled = podStateManager.isPodRunning && !podStateManager.isSuspended && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
} else {

View file

@ -714,18 +714,6 @@
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/omnipod_button_resume_delivery"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_local_activate"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_resume_delivery"
android:visibility="gone" />
<Button
android:id="@+id/omnipod_button_refresh_status"
style="@style/ButtonSmallFontStyle"
@ -794,6 +782,18 @@
android:text="@string/omnipod_suspend_delivery_short"
android:visibility="gone" />
<Button
android:id="@+id/omnipod_button_resume_delivery"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_local_activate"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_resume_delivery"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>