diff --git a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt
index a34a0d999b..414637f9cf 100644
--- a/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt
+++ b/app/src/main/java/info/nightscout/androidaps/implementations/ActivityNamesImpl.kt
@@ -15,6 +15,7 @@ import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.ui.activities.BolusProgressHelperActivity
import info.nightscout.ui.activities.ErrorHelperActivity
import info.nightscout.ui.activities.TDDStatsActivity
+import info.nightscout.ui.dialogs.BolusProgressDialog
import info.nightscout.ui.dialogs.CareDialog
import info.nightscout.ui.dialogs.ExtendedBolusDialog
import info.nightscout.ui.dialogs.FillDialog
@@ -104,4 +105,11 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
}
.show(fragmentManager, "CareDialog")
}
+ override fun runBolusProgressDialog(fragmentManager: FragmentManager, insulin: Double, id: Long) {
+ BolusProgressDialog().also {
+ it.setInsulin(insulin)
+ it.setId(id)
+ it.show(fragmentManager, "BolusProgress")
+ }
+ }
}
\ No newline at end of file
diff --git a/core/core-main/build.gradle b/core/core-main/build.gradle
index 3f6a2adf58..bb4a98a5ee 100644
--- a/core/core-main/build.gradle
+++ b/core/core-main/build.gradle
@@ -29,7 +29,6 @@ dependencies {
api "androidx.activity:activity-ktx:$activity_version"
api "androidx.appcompat:appcompat:$appcompat_version"
- api 'androidx.biometric:biometric:1.1.0'
api "com.google.dagger:dagger-android:$dagger_version"
api "com.google.dagger:dagger-android-support:$dagger_version"
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt
index fb7c471eeb..19b482e9ff 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt
+++ b/core/core-main/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt
@@ -32,7 +32,7 @@ class VersionCheckerUtils @Inject constructor(
private val dateUtil: DateUtil
) {
- fun isConnected(): Boolean = receiverStatusStore.isConnected
+ private fun isConnected(): Boolean = receiverStatusStore.isConnected
fun triggerCheckVersion() {
@@ -73,7 +73,7 @@ class VersionCheckerUtils @Inject constructor(
aapsLogger.debug(LTag.CORE, "Github master version not checked. No connectivity")
@Suppress("SameParameterValue")
- fun compareWithCurrentVersion(newVersion: String?, currentVersion: String) {
+ internal fun compareWithCurrentVersion(newVersion: String?, currentVersion: String) {
val newVersionElements = newVersion.toNumberList()
val currentVersionElements = currentVersion.toNumberList()
@@ -146,7 +146,7 @@ class VersionCheckerUtils @Inject constructor(
return digits.toIntArray()
}
- fun findVersion(file: String?): String? {
+ internal fun findVersion(file: String?): String? {
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
return file?.lines()?.filter { regex.matches(it) }?.firstNotNullOfOrNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
}
@@ -161,8 +161,9 @@ class VersionCheckerUtils @Inject constructor(
fun String.numericVersionPart(): String =
"(((\\d+)\\.)+(\\d+))(\\D(.*))?".toRegex().matchEntire(this)?.groupValues?.getOrNull(1)
?: ""
-
+/*
@Suppress("unused") fun findVersion(file: String?): String? {
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
return file?.lines()?.filter { regex.matches(it) }?.firstNotNullOfOrNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
}
+*/
\ No newline at end of file
diff --git a/core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt b/core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt
index 83e35b26d2..fdc55b8080 100644
--- a/core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt
+++ b/core/core-main/src/main/java/info/nightscout/core/di/CoreFragmentsModule.kt
@@ -2,7 +2,6 @@ package info.nightscout.core.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
-import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.dialogs.ErrorDialog
import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
import info.nightscout.core.ui.elements.SingleClickButton
@@ -12,7 +11,6 @@ import info.nightscout.core.ui.elements.SingleClickButton
abstract class CoreFragmentsModule {
@ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
- @ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog
@ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog
@ContributesAndroidInjector abstract fun contributesSingleClickButton(): SingleClickButton
diff --git a/core/core-main/src/main/res/values/strings.xml b/core/core-main/src/main/res/values/strings.xml
index c138750f01..73c0133dbc 100644
--- a/core/core-main/src/main/res/values/strings.xml
+++ b/core/core-main/src/main/res/values/strings.xml
@@ -30,7 +30,6 @@
Please wait…
Mute
Reload
- STOP PRESSED
Stop
Carbs
Invalid profile!
diff --git a/implementation/build.gradle b/implementation/build.gradle
index 2098509b31..4b88255674 100644
--- a/implementation/build.gradle
+++ b/implementation/build.gradle
@@ -26,4 +26,8 @@ dependencies {
implementation project(':core:utils')
implementation project(':core:ui')
implementation project(':ui')
+
+ // Protection
+ api 'androidx.biometric:biometric:1.1.0'
+
}
\ No newline at end of file
diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt
index 959e81647a..815d1c1cd0 100644
--- a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt
@@ -10,7 +10,6 @@ import androidx.appcompat.app.AppCompatActivity
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.ProfileSealed
-import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.extensions.getCustomizedName
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
@@ -625,10 +624,11 @@ class CommandQueueImplementation @Inject constructor(
private fun showBolusProgressDialog(detailedBolusInfo: DetailedBolusInfo) {
if (detailedBolusInfo.context != null) {
- val bolusProgressDialog = BolusProgressDialog()
- bolusProgressDialog.setInsulin(detailedBolusInfo.insulin)
- bolusProgressDialog.setId(detailedBolusInfo.id)
- bolusProgressDialog.show((detailedBolusInfo.context as AppCompatActivity).supportFragmentManager, "BolusProgress")
+ activityNames.runBolusProgressDialog(
+ (detailedBolusInfo.context as AppCompatActivity).supportFragmentManager,
+ detailedBolusInfo.insulin,
+ detailedBolusInfo.id
+ )
} else {
val i = Intent()
i.putExtra("insulin", detailedBolusInfo.insulin)
diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt
index 5ca229e2e8..18a42fe940 100644
--- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt
+++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt
@@ -1,10 +1,10 @@
package info.nightscout.implementation.queue.commands
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
import info.nightscout.implementation.R
import info.nightscout.interfaces.plugin.ActivePlugin
+import info.nightscout.interfaces.pump.BolusProgressData
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.interfaces.queue.Callback
@@ -27,7 +27,7 @@ class CommandBolus(
override fun execute() {
val r = activePlugin.activePump.deliverTreatment(detailedBolusInfo)
if (r.success) carbsRunnable.run()
- BolusProgressDialog.bolusEnded = true
+ BolusProgressData.bolusEnded = true
rxBus.send(EventDismissBolusProgressIfRunning(r, detailedBolusInfo.id))
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")
callback?.result(r)?.run()
diff --git a/interfaces/src/main/java/info/nightscout/interfaces/pump/BolusProgressData.kt b/interfaces/src/main/java/info/nightscout/interfaces/pump/BolusProgressData.kt
new file mode 100644
index 0000000000..053aca2594
--- /dev/null
+++ b/interfaces/src/main/java/info/nightscout/interfaces/pump/BolusProgressData.kt
@@ -0,0 +1,6 @@
+package info.nightscout.interfaces.pump
+
+object BolusProgressData {
+ var bolusEnded = false
+ var stopPressed = false
+}
\ No newline at end of file
diff --git a/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt b/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt
index 27f8469cdc..d3c3006940 100644
--- a/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt
+++ b/interfaces/src/main/java/info/nightscout/interfaces/ui/ActivityNames.kt
@@ -33,7 +33,7 @@ interface ActivityNames {
fun runTempTargetDialog(fragmentManager: FragmentManager)
fun runExtendedBolusDialog(fragmentManager: FragmentManager)
fun runFillDialog(fragmentManager: FragmentManager)
-
+ fun runBolusProgressDialog(fragmentManager: FragmentManager, insulin: Double, id: Long)
enum class Mode(val i: Int) {
RUNNING_PROFILE(1),
CUSTOM_PROFILE(2),
diff --git a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt b/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt
index 6ff549f96c..e3900874e1 100644
--- a/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt
+++ b/plugins/main/src/main/java/info/nightscout/plugins/constraints/objectives/dialogs/NtpProgressDialog.kt
@@ -7,8 +7,8 @@ import android.view.View
import android.view.ViewGroup
import dagger.android.support.DaggerDialogFragment
import info.nightscout.core.main.R
-import info.nightscout.core.main.databinding.DialogBolusprogressBinding
import info.nightscout.core.utils.fabric.FabricPrivacy
+import info.nightscout.plugins.databinding.DialogNtpProgressBinding
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNtpStatus
@@ -32,7 +32,7 @@ class NtpProgressDialog : DaggerDialogFragment() {
private var state: String? = null
private var percent = 0
- private var _binding: DialogBolusprogressBinding? = null
+ private var _binding: DialogNtpProgressBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
@@ -45,7 +45,7 @@ class NtpProgressDialog : DaggerDialogFragment() {
state = savedInstanceState?.getString("state", null)
percent = savedInstanceState?.getInt("percent", 0) ?: 0
- _binding = DialogBolusprogressBinding.inflate(inflater, container, false)
+ _binding = DialogNtpProgressBinding.inflate(inflater, container, false)
return binding.root
}
diff --git a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt
index 510d039413..0551f61879 100644
--- a/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt
+++ b/plugins/main/src/main/java/info/nightscout/plugins/pump/virtual/VirtualPumpPlugin.kt
@@ -4,7 +4,6 @@ import android.os.SystemClock
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
-import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
@@ -17,6 +16,7 @@ import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.profile.ProfileFunction
+import info.nightscout.interfaces.pump.BolusProgressData
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
import info.nightscout.interfaces.pump.PumpEnactResult
@@ -191,11 +191,11 @@ open class VirtualPumpPlugin @Inject constructor(
bolusingEvent.percent = min((delivering / detailedBolusInfo.insulin * 100).toInt(), 100)
rxBus.send(bolusingEvent)
delivering += 0.1
- if (BolusProgressDialog.stopPressed)
+ if (BolusProgressData.stopPressed)
return PumpEnactResult(injector)
.success(false)
.enacted(false)
- .comment(rh.gs(R.string.stoppressed))
+ .comment(rh.gs(R.string.stop))
}
SystemClock.sleep(200)
bolusingEvent.status = rh.gs(R.string.bolusdelivered, detailedBolusInfo.insulin)
diff --git a/plugins/main/src/main/res/layout/dialog_ntp_progress.xml b/plugins/main/src/main/res/layout/dialog_ntp_progress.xml
new file mode 100644
index 0000000000..34a8db1d5b
--- /dev/null
+++ b/plugins/main/src/main/res/layout/dialog_ntp_progress.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
index 5412a38b62..1fb7826c28 100644
--- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
+++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRKorean/services/DanaRKoreanExecutionService.java
@@ -36,7 +36,6 @@ import info.nightscout.androidaps.danar.comm.MsgSettingShippingInfo;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
-import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.interfaces.Constants;
import info.nightscout.interfaces.constraints.Constraints;
@@ -44,6 +43,7 @@ import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.plugin.ActivePlugin;
import info.nightscout.interfaces.profile.Profile;
import info.nightscout.interfaces.profile.ProfileFunction;
+import info.nightscout.interfaces.pump.BolusProgressData;
import info.nightscout.interfaces.pump.PumpEnactResult;
import info.nightscout.interfaces.pump.PumpSync;
import info.nightscout.interfaces.pump.defs.PumpType;
@@ -259,7 +259,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
public boolean bolus(double amount, int carbs, long carbTimeStamp, final EventOverviewBolusProgress.Treatment t) {
if (!isConnected()) return false;
- if (BolusProgressDialog.Companion.getStopPressed()) return false;
+ if (BolusProgressData.INSTANCE.getStopPressed()) return false;
danaPump.setBolusingTreatment(t);
danaPump.setBolusDone(false);
diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
index 5ae46913e6..16c402ecbc 100644
--- a/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
+++ b/pump/danar/src/main/java/info/nightscout/androidaps/danaRv2/services/DanaRv2ExecutionService.java
@@ -48,13 +48,13 @@ import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
-import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.interfaces.Constants;
import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.plugin.ActivePlugin;
import info.nightscout.interfaces.profile.Profile;
import info.nightscout.interfaces.profile.ProfileFunction;
+import info.nightscout.interfaces.pump.BolusProgressData;
import info.nightscout.interfaces.pump.Pump;
import info.nightscout.interfaces.pump.PumpEnactResult;
import info.nightscout.interfaces.pump.PumpSync;
@@ -330,7 +330,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public boolean bolus(final double amount, int carbs, long carbtime, final EventOverviewBolusProgress.Treatment t) {
if (!isConnected()) return false;
- if (BolusProgressDialog.Companion.getStopPressed()) return false;
+ if (BolusProgressData.INSTANCE.getStopPressed()) return false;
rxBus.send(new EventPumpStatusChanged(rh.gs(R.string.startingbolus)));
danaPump.setBolusingTreatment(t);
diff --git a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
index 4d3a4041d4..e719b1ab8c 100644
--- a/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
+++ b/pump/danar/src/main/java/info/nightscout/androidaps/danar/services/DanaRExecutionService.java
@@ -43,12 +43,12 @@ import info.nightscout.androidaps.danar.comm.MsgStatus;
import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
-import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.interfaces.Constants;
import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.profile.Profile;
import info.nightscout.interfaces.profile.ProfileFunction;
+import info.nightscout.interfaces.pump.BolusProgressData;
import info.nightscout.interfaces.pump.PumpEnactResult;
import info.nightscout.interfaces.pump.PumpSync;
import info.nightscout.interfaces.pump.defs.PumpType;
@@ -265,7 +265,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
public boolean bolus(double amount, int carbs, long carbTimeStamp, final EventOverviewBolusProgress.Treatment t) {
if (!isConnected()) return false;
- if (BolusProgressDialog.Companion.getStopPressed()) return false;
+ if (BolusProgressData.INSTANCE.getStopPressed()) return false;
danaPump.setBolusingTreatment(t);
danaPump.setBolusDone(false);
diff --git a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt
index 1b1ab31857..b1d0a5bf80 100644
--- a/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt
+++ b/pump/danars/src/main/java/info/nightscout/androidaps/danars/services/DanaRSService.kt
@@ -54,7 +54,6 @@ import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionGetUserOption
import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionSetPumpTime
import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionSetPumpUTCAndTimeZone
import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionSetUserOption
-import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.Constants
@@ -63,6 +62,7 @@ import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.profile.ProfileFunction
+import info.nightscout.interfaces.pump.BolusProgressData
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.queue.Callback
@@ -293,7 +293,7 @@ class DanaRSService : DaggerService() {
fun bolus(insulin: Double, carbs: Int, carbTime: Long, t: EventOverviewBolusProgress.Treatment): Boolean {
if (!isConnected) return false
- if (BolusProgressDialog.stopPressed) return false
+ if (BolusProgressData.stopPressed) return false
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.startingbolus)))
val preferencesSpeed = sp.getInt(R.string.key_danars_bolusspeed, 0)
danaPump.bolusDone = false
diff --git a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt
index 9b500bb549..0cb070b32b 100644
--- a/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt
+++ b/pump/diaconn/src/main/java/info/nightscout/androidaps/diaconn/service/DiaconnG8Service.kt
@@ -44,7 +44,6 @@ import info.nightscout.androidaps.diaconn.packet.TempBasalSettingPacket
import info.nightscout.androidaps.diaconn.packet.TimeInquirePacket
import info.nightscout.androidaps.diaconn.packet.TimeSettingPacket
import info.nightscout.androidaps.diaconn.pumplog.PumplogUtil
-import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.core.utils.fabric.FabricPrivacy
@@ -54,6 +53,7 @@ import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.profile.ProfileFunction
+import info.nightscout.interfaces.pump.BolusProgressData
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpType
@@ -446,7 +446,7 @@ class DiaconnG8Service : DaggerService() {
fun bolus(insulin: Double, carbs: Int, carbTime: Long, t: EventOverviewBolusProgress.Treatment): Boolean {
if (!isConnected) return false
- if (BolusProgressDialog.stopPressed) return false
+ if (BolusProgressData.stopPressed) return false
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.startingbolus)))
// bolus speed setting
diff --git a/ui/src/main/java/info/nightscout/ui/activities/BolusProgressHelperActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/BolusProgressHelperActivity.kt
index e58ca33420..048f205d5b 100644
--- a/ui/src/main/java/info/nightscout/ui/activities/BolusProgressHelperActivity.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/BolusProgressHelperActivity.kt
@@ -2,7 +2,7 @@ package info.nightscout.ui.activities
import android.os.Bundle
import info.nightscout.androidaps.activities.DialogAppCompatActivity
-import info.nightscout.androidaps.dialogs.BolusProgressDialog
+import info.nightscout.ui.dialogs.BolusProgressDialog
class BolusProgressHelperActivity : DialogAppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
diff --git a/ui/src/main/java/info/nightscout/ui/di/UiModule.kt b/ui/src/main/java/info/nightscout/ui/di/UiModule.kt
index 6dacdebb0f..2719a916fc 100644
--- a/ui/src/main/java/info/nightscout/ui/di/UiModule.kt
+++ b/ui/src/main/java/info/nightscout/ui/di/UiModule.kt
@@ -16,6 +16,7 @@ import info.nightscout.ui.activities.fragments.TreatmentsProfileSwitchFragment
import info.nightscout.ui.activities.fragments.TreatmentsTempTargetFragment
import info.nightscout.ui.activities.fragments.TreatmentsTemporaryBasalsFragment
import info.nightscout.ui.activities.fragments.TreatmentsUserEntryFragment
+import info.nightscout.ui.dialogs.BolusProgressDialog
import info.nightscout.ui.dialogs.CalibrationDialog
import info.nightscout.ui.dialogs.CarbsDialog
import info.nightscout.ui.dialogs.CareDialog
@@ -54,6 +55,7 @@ abstract class UiModule {
@ContributesAndroidInjector abstract fun contributesTempBasalDialog(): TempBasalDialog
@ContributesAndroidInjector abstract fun contributesTempTargetDialog(): TempTargetDialog
@ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog
+ @ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/BolusProgressDialog.kt
similarity index 91%
rename from core/core-main/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt
rename to ui/src/main/java/info/nightscout/ui/dialogs/BolusProgressDialog.kt
index 6231dede3d..4125073744 100644
--- a/core/core-main/src/main/java/info/nightscout/androidaps/dialogs/BolusProgressDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/BolusProgressDialog.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.dialogs
+package info.nightscout.ui.dialogs
import android.os.Bundle
import android.os.SystemClock
@@ -12,9 +12,9 @@ import info.nightscout.androidaps.activities.DialogAppCompatActivity
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
import info.nightscout.core.main.R
-import info.nightscout.core.main.databinding.DialogBolusprogressBinding
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources
+import info.nightscout.interfaces.pump.BolusProgressData
import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
@@ -23,6 +23,7 @@ import info.nightscout.rx.events.EventPumpStatusChanged
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
+import info.nightscout.ui.databinding.DialogBolusprogressBinding
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
@@ -38,15 +39,9 @@ class BolusProgressDialog : DaggerDialogFragment() {
private val disposable = CompositeDisposable()
- companion object {
-
- var bolusEnded = false
- var stopPressed = false
- }
-
private var running = true
private var amount = 0.0
- var id: Long = 0L
+ private var id: Long = 0L
private var state: String? = null
private var helpActivity: DialogAppCompatActivity? = null
@@ -57,7 +52,7 @@ class BolusProgressDialog : DaggerDialogFragment() {
fun setInsulin(amount: Double): BolusProgressDialog {
this.amount = amount
- bolusEnded = false
+ BolusProgressData.bolusEnded = false
return this
}
@@ -92,15 +87,15 @@ class BolusProgressDialog : DaggerDialogFragment() {
binding.title.text = rh.gs(R.string.goingtodeliver, amount)
binding.stop.setOnClickListener {
aapsLogger.debug(LTag.UI, "Stop bolus delivery button pressed")
- stopPressed = true
- binding.stoppressed.visibility = View.VISIBLE
+ BolusProgressData.stopPressed = true
+ binding.stopPressed.visibility = View.VISIBLE
binding.stop.visibility = View.INVISIBLE
uel.log(Action.CANCEL_BOLUS, Sources.Overview, state)
commandQueue.cancelAllBoluses(id)
}
binding.progressbar.max = 100
binding.status.text = state
- stopPressed = false
+ BolusProgressData.stopPressed = false
}
override fun onStart() {
@@ -112,9 +107,9 @@ class BolusProgressDialog : DaggerDialogFragment() {
super.onResume()
aapsLogger.debug(LTag.UI, "onResume")
if (!commandQueue.bolusInQueue())
- bolusEnded = true
+ BolusProgressData.bolusEnded = true
- if (bolusEnded) dismiss()
+ if (BolusProgressData.bolusEnded) dismiss()
else running = true
disposable += rxBus
@@ -153,7 +148,7 @@ class BolusProgressDialog : DaggerDialogFragment() {
} catch (e: IllegalStateException) {
// dialog not running yet. onResume will try again. Set bolusEnded to make extra
// sure onResume will catch this
- bolusEnded = true
+ BolusProgressData.bolusEnded = true
aapsLogger.error("Unhandled exception", e)
}
helpActivity?.finish()
@@ -183,7 +178,7 @@ class BolusProgressDialog : DaggerDialogFragment() {
aapsLogger.debug(LTag.UI, "scheduleDismiss")
Thread {
SystemClock.sleep(5000)
- bolusEnded = true
+ BolusProgressData.bolusEnded = true
activity?.runOnUiThread {
if (running) {
aapsLogger.debug(LTag.UI, "executing")
diff --git a/core/core-main/src/main/res/layout/dialog_bolusprogress.xml b/ui/src/main/res/layout/dialog_bolusprogress.xml
similarity index 95%
rename from core/core-main/src/main/res/layout/dialog_bolusprogress.xml
rename to ui/src/main/res/layout/dialog_bolusprogress.xml
index d34e8eab99..386ef81516 100644
--- a/core/core-main/src/main/res/layout/dialog_bolusprogress.xml
+++ b/ui/src/main/res/layout/dialog_bolusprogress.xml
@@ -4,7 +4,7 @@
style="@style/StyleDialog"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="info.nightscout.androidaps.dialogs.BolusProgressDialog">
+ tools:context=".dialogs.BolusProgressDialog">
Basal rate
+
+ STOP PRESSED
+
Explain import issues…
Import issues details