Add Disconnect Bloc when Loop is suspended or disabled

This commit is contained in:
Philoul 2021-08-25 09:00:13 +02:00
parent 0918880415
commit 69839b5395

View file

@ -160,6 +160,8 @@ class LoopDialog : DaggerDialogFragment() {
val apsMode = sp.getString(R.string.key_aps_mode, "open") val apsMode = sp.getString(R.string.key_aps_mode, "open")
val pump = activePlugin.activePump val pump = activePlugin.activePump
binding.overviewDisconnect15m.visibility = pumpDescription.tempDurationStep15mAllowed.toVisibility()
binding.overviewDisconnect30m.visibility = pumpDescription.tempDurationStep30mAllowed.toVisibility()
when { when {
pump.isSuspended() -> { pump.isSuspended() -> {
binding.overviewLoop.visibility = View.GONE binding.overviewLoop.visibility = View.GONE
@ -178,7 +180,8 @@ class LoopDialog : DaggerDialogFragment() {
binding.overviewEnable.visibility = View.VISIBLE binding.overviewEnable.visibility = View.VISIBLE
binding.overviewDisable.visibility = View.GONE binding.overviewDisable.visibility = View.GONE
binding.overviewSuspend.visibility = View.GONE binding.overviewSuspend.visibility = View.GONE
binding.overviewPump.visibility = View.GONE binding.overviewPump.visibility = View.VISIBLE
binding.overviewReconnect.visibility = View.GONE
} }
loopPlugin.isDisconnected -> { loopPlugin.isDisconnected -> {
@ -187,8 +190,6 @@ class LoopDialog : DaggerDialogFragment() {
binding.overviewPump.visibility = View.VISIBLE binding.overviewPump.visibility = View.VISIBLE
binding.overviewPumpHeader.text = resourceHelper.gs(R.string.reconnect) binding.overviewPumpHeader.text = resourceHelper.gs(R.string.reconnect)
binding.overviewDisconnectButtons.visibility = View.VISIBLE binding.overviewDisconnectButtons.visibility = View.VISIBLE
binding.overviewDisconnect15m.visibility = pumpDescription.tempDurationStep15mAllowed.toVisibility()
binding.overviewDisconnect30m.visibility = pumpDescription.tempDurationStep30mAllowed.toVisibility()
binding.overviewReconnect.visibility = View.VISIBLE binding.overviewReconnect.visibility = View.VISIBLE
} }
@ -198,7 +199,8 @@ class LoopDialog : DaggerDialogFragment() {
binding.overviewSuspendHeader.text = resourceHelper.gs(R.string.resumeloop) binding.overviewSuspendHeader.text = resourceHelper.gs(R.string.resumeloop)
binding.overviewSuspendButtons.visibility = View.VISIBLE binding.overviewSuspendButtons.visibility = View.VISIBLE
binding.overviewResume.visibility = View.VISIBLE binding.overviewResume.visibility = View.VISIBLE
binding.overviewPump.visibility = View.GONE binding.overviewPump.visibility = View.VISIBLE
binding.overviewReconnect.visibility = View.GONE
} }
else -> { else -> {
@ -231,8 +233,6 @@ class LoopDialog : DaggerDialogFragment() {
binding.overviewPump.visibility = View.VISIBLE binding.overviewPump.visibility = View.VISIBLE
binding.overviewPumpHeader.text = resourceHelper.gs(R.string.disconnectpump) binding.overviewPumpHeader.text = resourceHelper.gs(R.string.disconnectpump)
binding.overviewDisconnectButtons.visibility = View.VISIBLE binding.overviewDisconnectButtons.visibility = View.VISIBLE
binding.overviewDisconnect15m.visibility = pumpDescription.tempDurationStep15mAllowed.toVisibility()
binding.overviewDisconnect30m.visibility = pumpDescription.tempDurationStep30mAllowed.toVisibility()
binding.overviewReconnect.visibility = View.GONE binding.overviewReconnect.visibility = View.GONE
} }