diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt index 2a0b523200..2cdd860ce3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt @@ -63,7 +63,8 @@ class OverviewData @Inject constructor( BG, IOB_COB, SENSITIVITY, - GRAPH + GRAPH, + PUMPSTATUS } var rangeToDisplay = 6 // for graph @@ -72,6 +73,7 @@ class OverviewData @Inject constructor( var endTime: Long = 0 fun reset() { + pumpStatus = "" calcProgress = "" lastBg = null temporaryBasal = null @@ -122,6 +124,12 @@ class OverviewData @Inject constructor( endTime = toTime } + /* + * PUMP STATUS + */ + + var pumpStatus: String = "" + /* * CALC PROGRESS */ diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index e02b359db6..e38310b1ba 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -61,7 +61,11 @@ import info.nightscout.androidaps.plugins.source.DexcomPlugin import info.nightscout.androidaps.plugins.source.XdripPlugin import info.nightscout.androidaps.queue.CommandQueue import info.nightscout.androidaps.skins.SkinProvider -import info.nightscout.androidaps.utils.* +import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.DefaultValueHelper +import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.ToastUtils +import info.nightscout.androidaps.utils.TrendCalculator import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck @@ -73,6 +77,7 @@ import info.nightscout.androidaps.utils.wizard.QuickWizard import io.reactivex.disposables.CompositeDisposable import io.reactivex.rxkotlin.plusAssign import java.util.* +import java.util.concurrent.TimeUnit import javax.inject.Inject import kotlin.collections.ArrayList import kotlin.math.abs @@ -159,8 +164,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList skinProvider.activeSkin().preProcessLandscapeOverviewLayout(dm, view, landscape, resourceHelper.gb(R.bool.isTablet), smallHeight) binding.nsclientLayout.visibility = config.NSCLIENT.toVisibility() - binding.loopPumpStatusLayout.pumpStatus.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder)) - binding.notifications.setHasFixedSize(false) binding.notifications.layoutManager = LinearLayoutManager(view.context) axisWidth = if (dm.densityDpi <= 120) 3 else if (dm.densityDpi <= 160) 10 else if (dm.densityDpi <= 320) 35 else if (dm.densityDpi <= 420) 50 else if (dm.densityDpi <= 560) 70 else 80 @@ -189,10 +192,10 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList prepareGraphsIfNeeded(overviewMenus.setting.size) overviewMenus.setupChartMenu(binding.graphsLayout.chartMenuButton) - binding.loopPumpStatusLayout.activeProfile.setOnClickListener(this) - binding.loopPumpStatusLayout.activeProfile.setOnLongClickListener(this) - binding.loopPumpStatusLayout.tempTarget.setOnClickListener(this) - binding.loopPumpStatusLayout.tempTarget.setOnLongClickListener(this) + binding.activeProfile.setOnClickListener(this) + binding.activeProfile.setOnLongClickListener(this) + binding.tempTarget.setOnClickListener(this) + binding.tempTarget.setOnLongClickListener(this) binding.buttonsLayout.acceptTempButton.setOnClickListener(this) binding.buttonsLayout.treatmentButton.setOnClickListener(this) binding.buttonsLayout.wizardButton.setOnClickListener(this) @@ -204,7 +207,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList binding.buttonsLayout.quickWizardButton.setOnLongClickListener(this) binding.infoLayout.apsMode.setOnClickListener(this) binding.infoLayout.apsMode.setOnLongClickListener(this) - binding.loopPumpStatusLayout.activeProfile.setOnLongClickListener(this) + binding.activeProfile.setOnLongClickListener(this) } @Synchronized @@ -245,10 +248,14 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList .toObservable(EventNewOpenLoopNotification::class.java) .observeOn(aapsSchedulers.io) .subscribe({ scheduleUpdateGUI("EventNewOpenLoopNotification") }, fabricPrivacy::logException)) - disposable.add(rxBus + disposable += rxBus .toObservable(EventPumpStatusChanged::class.java) .observeOn(aapsSchedulers.main) - .subscribe({ updatePumpStatus(it) }, fabricPrivacy::logException)) + .delay (30, TimeUnit.MILLISECONDS, aapsSchedulers.main) + .subscribe({ + overviewData.pumpStatus = it.getStatus(resourceHelper) + updateGUI("EventPumpStatusChanged", OverviewData.Property.PUMPSTATUS) + }, fabricPrivacy::logException) refreshLoop = Runnable { overviewPlugin.refreshLoop("refreshLoop") @@ -406,18 +413,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList } } - private fun updatePumpStatus(event: EventPumpStatusChanged) { - val status = event.getStatus(resourceHelper) - if (status != "") { - binding.loopPumpStatusLayout.pumpStatus.text = status - binding.loopPumpStatusLayout.pumpStatusLayout.visibility = View.VISIBLE - binding.loopPumpStatusLayout.loopLayout.visibility = View.GONE - } else { - binding.loopPumpStatusLayout.pumpStatusLayout.visibility = View.GONE - binding.loopPumpStatusLayout.loopLayout.visibility = View.VISIBLE - } - } - @SuppressLint("SetTextI18n") private fun processButtonsVisibility() { val lastBG = iobCobCalculator.ads.lastBg() @@ -600,14 +595,11 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList // if (what != OverviewData.Property.CALC_PROGRESS) // aapsLogger.debug(LTag.UI, "UpdateGui $from $what") if (profileFunction.getProfile() == null) { - binding.loopPumpStatusLayout.pumpStatus.setText(R.string.noprofileset) - binding.loopPumpStatusLayout.pumpStatusLayout.visibility = View.VISIBLE - binding.loopPumpStatusLayout.loopLayout.visibility = View.GONE + binding.activeProfile.setText(R.string.noprofileset) + binding.activeProfile.setBackgroundColor(resourceHelper.gc(R.color.errorAlertBackground)) return } binding.notifications.let { notificationStore.updateNotifications(it) } - binding.loopPumpStatusLayout.pumpStatusLayout.visibility = View.GONE - binding.loopPumpStatusLayout.loopLayout.visibility = View.VISIBLE val units = profileFunction.getUnits() val pump = activePlugin.activePump @@ -658,9 +650,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList else resourceHelper.gc(R.color.ribbonTextDefault) } ?: resourceHelper.gc(R.color.ribbonTextDefault) - binding.loopPumpStatusLayout.activeProfile.text = profileFunction.getProfileNameWithRemainingTime() - binding.loopPumpStatusLayout.activeProfile.setBackgroundColor(profileBackgroundColor) - binding.loopPumpStatusLayout.activeProfile.setTextColor(profileTextColor) + binding.activeProfile.text = profileFunction.getProfileNameWithRemainingTime() + binding.activeProfile.setBackgroundColor(profileBackgroundColor) + binding.activeProfile.setTextColor(profileTextColor) } OverviewData.Property.TEMPORARY_BASAL -> { @@ -721,9 +713,9 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList if (overviewData.temporaryTarget?.isInProgress(dateUtil) == false) overviewData.temporaryTarget = null val tempTarget = overviewData.temporaryTarget if (tempTarget != null) { - binding.loopPumpStatusLayout.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextWarning)) - binding.loopPumpStatusLayout.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.ribbonWarning)) - binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(tempTarget.lowTarget, tempTarget.highTarget, GlucoseUnit.MGDL, units) + " " + dateUtil.untilString(tempTarget.end, resourceHelper) + binding.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextWarning)) + binding.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.ribbonWarning)) + binding.tempTarget.text = Profile.toTargetRangeString(tempTarget.lowTarget, tempTarget.highTarget, GlucoseUnit.MGDL, units) + " " + dateUtil.untilString(tempTarget.end, resourceHelper) } else { // If the target is not the same as set in the profile then oref has overridden it profileFunction.getProfile()?.let { profile -> @@ -731,13 +723,13 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList if (targetUsed != 0.0 && abs(profile.getTargetMgdl() - targetUsed) > 0.01) { aapsLogger.debug("Adjusted target. Profile: ${profile.getTargetMgdl()} APS: $targetUsed") - binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(targetUsed, targetUsed, GlucoseUnit.MGDL, units) - binding.loopPumpStatusLayout.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextWarning)) - binding.loopPumpStatusLayout.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.tempTargetBackground)) + binding.tempTarget.text = Profile.toTargetRangeString(targetUsed, targetUsed, GlucoseUnit.MGDL, units) + binding.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextWarning)) + binding.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.tempTargetBackground)) } else { - binding.loopPumpStatusLayout.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextDefault)) - binding.loopPumpStatusLayout.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.ribbonDefault)) - binding.loopPumpStatusLayout.tempTarget.text = Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), GlucoseUnit.MGDL, units) + binding.tempTarget.setTextColor(resourceHelper.gc(R.color.ribbonTextDefault)) + binding.tempTarget.setBackgroundColor(resourceHelper.gc(R.color.ribbonDefault)) + binding.tempTarget.text = Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), GlucoseUnit.MGDL, units) } } } @@ -832,6 +824,12 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList String.format(Locale.ENGLISH, "%.0f%%", autosensData.autosensResult.ratio * 100) } ?: "" } + + OverviewData.Property.PUMPSTATUS -> { + val status = overviewData.pumpStatus + binding.pumpStatus.text = status + binding.pumpStatusLayout.visibility = (status != "").toVisibility() + } } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt index c5c0c35757..24433dfadc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewPlugin.kt @@ -135,16 +135,22 @@ class OverviewPlugin @Inject constructor( .toObservable(EventLoopInvoked::class.java) .observeOn(aapsSchedulers.io) .subscribe({ overviewData.preparePredictions("EventLoopInvoked") }, fabricPrivacy::logException) - disposable.add(rxBus + disposable += rxBus .toObservable(EventNewBasalProfile::class.java) .observeOn(aapsSchedulers.io) - .subscribe({ loadProfile("EventNewBasalProfile") }, fabricPrivacy::logException)) - disposable.add(rxBus + .subscribe({ loadProfile("EventNewBasalProfile") }, fabricPrivacy::logException) + disposable += rxBus .toObservable(EventAutosensCalculationFinished::class.java) .observeOn(aapsSchedulers.io) .subscribe({ if (it.cause !is EventCustomCalculationFinished) refreshLoop("EventAutosensCalculationFinished") - }, fabricPrivacy::logException)) + }, fabricPrivacy::logException) + disposable += rxBus + .toObservable(EventPumpStatusChanged::class.java) + .observeOn(aapsSchedulers.io) + .subscribe({ + overviewData.pumpStatus = it.getStatus(resourceHelper) + }, fabricPrivacy::logException) Thread { loadAll("onResume") }.start() } diff --git a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt index 34b64b8501..6de611c276 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt @@ -135,6 +135,7 @@ class QueueThread internal constructor( aapsLogger.debug(LTag.PUMPQUEUE, "disconnected") return } else { + rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.WAITING_FOR_DISCONNECTION)) aapsLogger.debug(LTag.PUMPQUEUE, "waiting for disconnect") SystemClock.sleep(1000) } diff --git a/app/src/main/res/layout/actions_fragment.xml b/app/src/main/res/layout/actions_fragment.xml index 98e3976d97..7d43edb857 100644 --- a/app/src/main/res/layout/actions_fragment.xml +++ b/app/src/main/res/layout/actions_fragment.xml @@ -273,7 +273,7 @@ style="@style/ButtonSmallFontStyle" android:layout_width="0dp" android:layout_height="wrap_content" - android:drawableTop="@drawable/ic_danarhistory" + android:drawableTop="@drawable/ic_pump_history" android:paddingLeft="0dp" android:paddingRight="0dp" android:text="@string/nav_historybrowser" diff --git a/app/src/main/res/layout/actions_fragment_lowres.xml b/app/src/main/res/layout/actions_fragment_lowres.xml index bf90751f8d..689277d9d7 100644 --- a/app/src/main/res/layout/actions_fragment_lowres.xml +++ b/app/src/main/res/layout/actions_fragment_lowres.xml @@ -273,7 +273,7 @@ style="@style/ButtonSmallFontStyle" android:layout_width="0dp" android:layout_height="wrap_content" - android:drawableTop="@drawable/ic_danarhistory" + android:drawableTop="@drawable/ic_pump_history" android:paddingLeft="0dp" android:paddingRight="0dp" android:text="@string/nav_historybrowser" diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index 149fa2c9ce..f37998f4e3 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -10,8 +10,7 @@ android:id="@+id/top_part_scrollbar" android:layout_width="wrap_content" android:layout_height="0dp" - android:layout_weight="1" - tools:ignore="UselessParent"> + android:layout_weight="1"> - + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/overview_loop_pumpstatus_layout.xml b/app/src/main/res/layout/overview_loop_pumpstatus_layout.xml deleted file mode 100644 index 0a6288d429..0000000000 --- a/app/src/main/res/layout/overview_loop_pumpstatus_layout.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/events/EventPumpStatusChanged.kt b/core/src/main/java/info/nightscout/androidaps/events/EventPumpStatusChanged.kt index 0b9ce7ebf0..e65a7fe6e5 100644 --- a/core/src/main/java/info/nightscout/androidaps/events/EventPumpStatusChanged.kt +++ b/core/src/main/java/info/nightscout/androidaps/events/EventPumpStatusChanged.kt @@ -10,6 +10,7 @@ class EventPumpStatusChanged : EventStatus { CONNECTED, HANDSHAKING, PERFORMING, + WAITING_FOR_DISCONNECTION, DISCONNECTING, DISCONNECTED } @@ -46,12 +47,13 @@ class EventPumpStatusChanged : EventStatus { // status for startup wizard override fun getStatus(resourceHelper: ResourceHelper): String { return when (status) { - Status.CONNECTING -> String.format(resourceHelper.gs(R.string.connectingfor), secondsElapsed) - Status.HANDSHAKING -> resourceHelper.gs(R.string.handshaking) - Status.CONNECTED -> resourceHelper.gs(R.string.connected) - Status.PERFORMING -> performingAction - Status.DISCONNECTING -> resourceHelper.gs(R.string.disconnecting) - Status.DISCONNECTED -> "" + Status.CONNECTING -> String.format(resourceHelper.gs(R.string.connectingfor), secondsElapsed) + Status.HANDSHAKING -> resourceHelper.gs(R.string.handshaking) + Status.CONNECTED -> resourceHelper.gs(R.string.connected) + Status.PERFORMING -> performingAction + Status.WAITING_FOR_DISCONNECTION -> resourceHelper.gs(R.string.waiting_for_disconnection) + Status.DISCONNECTING -> resourceHelper.gs(R.string.disconnecting) + Status.DISCONNECTED -> "" } } } diff --git a/core/src/main/res/drawable/ic_danarhistory.xml b/core/src/main/res/drawable/ic_pump_history.xml similarity index 100% rename from core/src/main/res/drawable/ic_danarhistory.xml rename to core/src/main/res/drawable/ic_pump_history.xml diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 694164b776..ead398c2a6 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -12,7 +12,7 @@ #66000000 - #00695c + #505050 #303030 diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index b2bd4ac0b6..512cfec8eb 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -81,6 +81,7 @@ Connected Disconnected Disconnecting + Waiting for disconnection AndroidAPS started %1$.1f U %1$.2f U @@ -289,6 +290,8 @@ Loop NS Record + Reading pump history + Pump icon Connection timed out diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt index ca509d3caf..d8b660e9d6 100644 --- a/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt +++ b/dana/src/main/java/info/nightscout/androidaps/dana/DanaFragment.kt @@ -64,6 +64,8 @@ class DanaFragment : DaggerFragment() { private val loopHandler = Handler(Looper.getMainLooper()) private lateinit var refreshLoop: Runnable + private var pumpStatus = "" + private var pumpStatusIcon = "{fa-bluetooth-b}" private var _binding: DanarFragmentBinding? = null @@ -87,10 +89,8 @@ class DanaFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - binding.danaPumpstatus.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder)) - binding.history.setOnClickListener { startActivity(Intent(context, DanaHistoryActivity::class.java)) } - binding.viewprofile.setOnClickListener { + binding.viewProfile.setOnClickListener { val profile = danaPump.createConvertedProfile()?.getDefaultProfileJson() ?: return@setOnClickListener val profileName = danaPump.createConvertedProfile()?.getDefaultProfileName() @@ -152,31 +152,25 @@ class DanaFragment : DaggerFragment() { .toObservable(EventPumpStatusChanged::class.java) .observeOn(aapsSchedulers.main) .subscribe({ - when (it.status) { + pumpStatusIcon = when (it.status) { EventPumpStatusChanged.Status.CONNECTING -> - @Suppress("SetTextI18n") - binding.btconnection.text = "{fa-bluetooth-b spin} ${it.secondsElapsed}s" + "{fa-bluetooth-b spin} ${it.secondsElapsed}s" EventPumpStatusChanged.Status.CONNECTED -> - @Suppress("SetTextI18n") - binding.btconnection.text = "{fa-bluetooth}" + "{fa-bluetooth}" EventPumpStatusChanged.Status.DISCONNECTED -> - @Suppress("SetTextI18n") - binding.btconnection.text = "{fa-bluetooth-b}" + "{fa-bluetooth-b}" - else -> { - } - } - if (it.getStatus(resourceHelper) != "") { - binding.danaPumpstatus.text = it.getStatus(resourceHelper) - binding.danaPumpstatuslayout.visibility = View.VISIBLE - } else { - binding.danaPumpstatuslayout.visibility = View.GONE + else -> + "{fa-bluetooth-b}" } + binding.btconnection.text = pumpStatusIcon + pumpStatus = it.getStatus(resourceHelper) + binding.pumpStatus.text = pumpStatus + binding.pumpStatusLayout.visibility = (pumpStatus != "").toVisibility() }, fabricPrivacy::logException) - binding.danaPumpstatus.text = "" - binding.danaPumpstatuslayout.visibility = View.GONE - @Suppress("SetTextI18n") - binding.btconnection.text = "{fa-bluetooth-b}" + + pumpStatus = "" + pumpStatusIcon = "{fa-bluetooth-b}" updateGUI() } @@ -185,6 +179,8 @@ class DanaFragment : DaggerFragment() { super.onPause() disposable.clear() loopHandler.removeCallbacks(refreshLoop) + pumpStatus = "" + pumpStatusIcon = "{fa-bluetooth-b}" } @Synchronized @@ -197,6 +193,11 @@ class DanaFragment : DaggerFragment() { @Synchronized fun updateGUI() { if (_binding == null) return + binding.btconnection.text = pumpStatusIcon + binding.pumpStatus.text = pumpStatus + binding.pumpStatusLayout.visibility = (pumpStatus != "").toVisibility() + binding.queue.text = commandQueue.spannedStatus() + binding.queueStatusLayout.visibility = (commandQueue.spannedStatus().toString() != "").toVisibility() val pump = danaPump val plugin: Pump = activePlugin.activePump if (pump.lastConnection != 0L) { @@ -225,18 +226,9 @@ class DanaFragment : DaggerFragment() { warnColors.setColorInverse(binding.reservoir, pump.reservoirRemainingUnits, 50.0, 20.0) binding.battery.text = "{fa-battery-" + pump.batteryRemaining / 25 + "}" warnColors.setColorInverse(binding.battery, pump.batteryRemaining.toDouble(), 51.0, 26.0) - binding.iob.text = resourceHelper.gs(R.string.formatinsulinunits, pump.iob) binding.firmware.text = resourceHelper.gs(R.string.dana_model, pump.modelFriendlyName(), pump.hwModel, pump.protocol, pump.productCode) - binding.basalstep.text = pump.basalStep.toString() - binding.bolusstep.text = pump.bolusStep.toString() + binding.basalBolusStep.text = pump.basalStep.toString() + "/" + pump.bolusStep.toString() binding.serialNumber.text = pump.serialNumber - val status = commandQueue.spannedStatus() - if (status.toString() == "") { - binding.queue.visibility = View.GONE - } else { - binding.queue.visibility = View.VISIBLE - binding.queue.text = status - } val icon = if (danaPump.pumpType() == PumpType.DANA_I) R.drawable.ic_dana_i else R.drawable.ic_dana_rs binding.danaIcon.setImageDrawable(context?.let { ContextCompat.getDrawable(it, icon) }) //hide user options button if not an RS pump or old firmware diff --git a/dana/src/main/res/layout/danar_fragment.xml b/dana/src/main/res/layout/danar_fragment.xml index 7fa180c672..eeb1a1f853 100644 --- a/dana/src/main/res/layout/danar_fragment.xml +++ b/dana/src/main/res/layout/danar_fragment.xml @@ -1,704 +1,20 @@ - + tools:context="info.nightscout.androidaps.dana.DanaFragment" + android:orientation="vertical"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="0dp" + android:paddingTop="5dp" + android:layout_weight="1"> -