fix Actions buttons visibility
This commit is contained in:
parent
d9b8a32aea
commit
b2b1485c27
1 changed files with 10 additions and 13 deletions
|
@ -18,9 +18,9 @@ import info.nightscout.androidaps.events.*
|
||||||
import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity
|
import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity
|
||||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||||
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
|
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
|
@ -192,17 +192,15 @@ class ActionsFragment : DaggerFragment() {
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun updateGui() {
|
fun updateGui() {
|
||||||
actions_profileswitch?.visibility = (activePlugin.activeProfileInterface.profile != null).toVisibility()
|
|
||||||
|
|
||||||
val profile = profileFunction.getProfile()
|
val profile = profileFunction.getProfile()
|
||||||
val pump = activePlugin.activePump
|
val pump = activePlugin.activePump
|
||||||
|
|
||||||
actions_temptarget?.visibility = (profile != null).toVisibility()
|
actions_profileswitch?.visibility = (
|
||||||
actions_historybrowser.visibility = (profile != null).toVisibility()
|
activePlugin.activeProfileInterface.profile != null &&
|
||||||
|
pump.pumpDescription.isSetBasalProfileCapable &&
|
||||||
val basalProfileEnabled = buildHelper.isEngineeringModeOrRelease() && pump.pumpDescription.isSetBasalProfileCapable
|
pump.isInitialized &&
|
||||||
|
!pump.isSuspended).toVisibility()
|
||||||
actions_profileswitch?.visibility = if (!basalProfileEnabled || !pump.isInitialized || pump.isSuspended) View.GONE else View.VISIBLE
|
|
||||||
|
|
||||||
if (!pump.pumpDescription.isExtendedBolusCapable || !pump.isInitialized || pump.isSuspended || pump.isFakingTempsByExtendedBoluses) {
|
if (!pump.pumpDescription.isExtendedBolusCapable || !pump.isInitialized || pump.isSuspended || pump.isFakingTempsByExtendedBoluses) {
|
||||||
actions_extendedbolus?.visibility = View.GONE
|
actions_extendedbolus?.visibility = View.GONE
|
||||||
|
@ -236,12 +234,11 @@ class ActionsFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actions_fill?.visibility =
|
actions_historybrowser.visibility = (profile != null).toVisibility()
|
||||||
if (!pump.pumpDescription.isRefillingCapable || !pump.isInitialized || pump.isSuspended) View.GONE
|
actions_fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized && !pump.isSuspended).toVisibility()
|
||||||
else View.VISIBLE
|
actions_temptarget?.visibility = (profile != null && config.APS).toVisibility()
|
||||||
|
|
||||||
actions_temptarget?.visibility = config.APS.toVisibility()
|
|
||||||
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
|
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
|
||||||
|
|
||||||
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, careportal_pbage, null)
|
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, careportal_pbage, null)
|
||||||
checkPumpCustomActions()
|
checkPumpCustomActions()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue