move activities to ui module
This commit is contained in:
parent
724587ad46
commit
fbeb03f322
45 changed files with 479 additions and 295 deletions
|
@ -7,25 +7,25 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
|
import info.nightscout.androidaps.databinding.DialogExtendedbolusBinding
|
||||||
|
import info.nightscout.androidaps.extensions.formatColor
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.shared.SafeParse
|
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
|
||||||
import info.nightscout.androidaps.extensions.formatColor
|
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.shared.SafeParse
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -41,6 +41,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var queryingProtection = false
|
private var queryingProtection = false
|
||||||
private var _binding: DialogExtendedbolusBinding? = null
|
private var _binding: DialogExtendedbolusBinding? = null
|
||||||
|
@ -103,7 +104,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,31 +7,31 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
import info.nightscout.androidaps.database.transactions.InsertIfNewByTimestampTherapyEventTransaction
|
||||||
import info.nightscout.androidaps.databinding.DialogFillBinding
|
import info.nightscout.androidaps.databinding.DialogFillBinding
|
||||||
|
import info.nightscout.androidaps.extensions.formatColor
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.shared.SafeParse
|
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
|
||||||
import info.nightscout.androidaps.extensions.formatColor
|
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.shared.SafeParse
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -48,6 +48,7 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var queryingProtection = false
|
private var queryingProtection = false
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
@ -194,7 +195,7 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
|
@ -21,7 +20,6 @@ import info.nightscout.androidaps.databinding.DialogInsulinBinding
|
||||||
import info.nightscout.androidaps.extensions.formatColor
|
import info.nightscout.androidaps.extensions.formatColor
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
|
@ -30,9 +28,8 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.extensions.toSignedString
|
import info.nightscout.androidaps.utils.extensions.toSignedString
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.interfaces.BolusTimer
|
|
||||||
import info.nightscout.shared.SafeParse
|
import info.nightscout.shared.SafeParse
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
@ -56,6 +53,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
@Inject lateinit var bolusTimer: BolusTimer
|
@Inject lateinit var bolusTimer: BolusTimer
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@ -243,7 +241,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
} else {
|
} else {
|
||||||
bolusTimer.removeAutomationEventBolusReminder()
|
bolusTimer.removeAutomationEventBolusReminder()
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.view.WindowManager
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import dagger.android.support.DaggerDialogFragment
|
import dagger.android.support.DaggerDialogFragment
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.OfflineEvent
|
import info.nightscout.androidaps.database.entities.OfflineEvent
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
|
@ -25,9 +24,17 @@ import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.extensions.runOnUiThread
|
import info.nightscout.androidaps.extensions.runOnUiThread
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.ConfigBuilder
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
|
import info.nightscout.androidaps.interfaces.Loop
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
|
@ -40,7 +47,8 @@ import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
|
@ -65,6 +73,7 @@ class LoopDialog : DaggerDialogFragment() {
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var objectivePlugin: ObjectivesPlugin
|
@Inject lateinit var objectivePlugin: ObjectivesPlugin
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var queryingProtection = false
|
private var queryingProtection = false
|
||||||
private var showOkCancel: Boolean = true
|
private var showOkCancel: Boolean = true
|
||||||
|
@ -345,7 +354,7 @@ class LoopDialog : DaggerDialogFragment() {
|
||||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,23 +7,21 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.databinding.DialogTempbasalBinding
|
import info.nightscout.androidaps.databinding.DialogTempbasalBinding
|
||||||
|
import info.nightscout.androidaps.extensions.formatColor
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.shared.SafeParse
|
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
|
||||||
import info.nightscout.androidaps.extensions.formatColor
|
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.shared.SafeParse
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -40,6 +38,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
@Inject lateinit var ctx: Context
|
@Inject lateinit var ctx: Context
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var queryingProtection = false
|
private var queryingProtection = false
|
||||||
private var isPercentPump = true
|
private var isPercentPump = true
|
||||||
|
@ -125,7 +124,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
val callback: Callback = object : Callback() {
|
val callback: Callback = object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,31 +8,31 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.interfaces.Config
|
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
|
import info.nightscout.androidaps.databinding.DialogTreatmentBinding
|
||||||
|
import info.nightscout.androidaps.extensions.formatColor
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.shared.SafeParse
|
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.extensions.formatColor
|
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.shared.SafeParse
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
@ -51,6 +51,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var queryingProtection = false
|
private var queryingProtection = false
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
@ -179,7 +180,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,11 +1,36 @@
|
||||||
package info.nightscout.androidaps.implementations
|
package info.nightscout.androidaps.implementations
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.annotation.RawRes
|
||||||
import info.nightscout.androidaps.MainActivity
|
import info.nightscout.androidaps.MainActivity
|
||||||
import info.nightscout.androidaps.interfaces.ActivityNames
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
|
import info.nightscout.androidaps.services.AlarmSoundService
|
||||||
|
import info.nightscout.ui.activities.BolusProgressHelperActivity
|
||||||
|
import info.nightscout.ui.activities.ErrorHelperActivity
|
||||||
|
import info.nightscout.ui.activities.TDDStatsActivity
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ActivityNamesImpl @Inject constructor() : ActivityNames {
|
class ActivityNamesImpl @Inject constructor() : ActivityNames {
|
||||||
|
|
||||||
override val mainActivityClass: Class<*>
|
override val mainActivityClass: Class<*>
|
||||||
get() = MainActivity::class.java
|
get() = MainActivity::class.java
|
||||||
|
|
||||||
|
override val tddStatsActivity: Class<*>
|
||||||
|
get() = TDDStatsActivity::class.java
|
||||||
|
|
||||||
|
override val errorHelperActivity: Class<*>
|
||||||
|
get() = ErrorHelperActivity::class.java
|
||||||
|
|
||||||
|
override val bolusProgressHelperActivity: Class<*>
|
||||||
|
get() = BolusProgressHelperActivity::class.java
|
||||||
|
|
||||||
|
override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) {
|
||||||
|
val i = Intent(ctx, errorHelperActivity)
|
||||||
|
i.putExtra(AlarmSoundService.SOUND_ID, soundId)
|
||||||
|
i.putExtra(AlarmSoundService.STATUS, status)
|
||||||
|
i.putExtra(AlarmSoundService.TITLE, title)
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
ctx.startActivity(i)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -16,7 +16,6 @@ import info.nightscout.androidaps.BuildConfig
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.MainActivity
|
import info.nightscout.androidaps.MainActivity
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
|
@ -36,6 +35,7 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||||
import info.nightscout.androidaps.extensions.convertedToPercent
|
import info.nightscout.androidaps.extensions.convertedToPercent
|
||||||
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.Config
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
|
@ -100,7 +100,8 @@ class LoopPlugin @Inject constructor(
|
||||||
private val dateUtil: DateUtil,
|
private val dateUtil: DateUtil,
|
||||||
private val uel: UserEntryLogger,
|
private val uel: UserEntryLogger,
|
||||||
private val repository: AppRepository,
|
private val repository: AppRepository,
|
||||||
private val runningConfiguration: RunningConfiguration
|
private val runningConfiguration: RunningConfiguration,
|
||||||
|
private val activityNames: ActivityNames
|
||||||
) : PluginBase(
|
) : PluginBase(
|
||||||
PluginDescription()
|
PluginDescription()
|
||||||
.mainType(PluginType.LOOP)
|
.mainType(PluginType.LOOP)
|
||||||
|
@ -678,7 +679,7 @@ class LoopPlugin @Inject constructor(
|
||||||
commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -686,7 +687,7 @@ class LoopPlugin @Inject constructor(
|
||||||
commandQueue.tempBasalPercent(0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
commandQueue.tempBasalPercent(0, durationInMinutes, true, profile, PumpSync.TemporaryBasalType.EMULATED_PUMP_SUSPEND, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -695,7 +696,7 @@ class LoopPlugin @Inject constructor(
|
||||||
commandQueue.cancelExtended(object : Callback() {
|
commandQueue.cancelExtended(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(context, result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -713,7 +714,7 @@ class LoopPlugin @Inject constructor(
|
||||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(context, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,15 +11,18 @@ import android.widget.LinearLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||||
import info.nightscout.androidaps.activities.TDDStatsActivity
|
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.ValueWrapper
|
import info.nightscout.androidaps.database.ValueWrapper
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.databinding.ActionsFragmentBinding
|
import info.nightscout.androidaps.databinding.ActionsFragmentBinding
|
||||||
import info.nightscout.androidaps.dialogs.*
|
import info.nightscout.androidaps.dialogs.CareDialog
|
||||||
|
import info.nightscout.androidaps.dialogs.ExtendedBolusDialog
|
||||||
|
import info.nightscout.androidaps.dialogs.FillDialog
|
||||||
|
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||||
|
import info.nightscout.androidaps.dialogs.TempBasalDialog
|
||||||
|
import info.nightscout.androidaps.dialogs.TempTargetDialog
|
||||||
import info.nightscout.androidaps.events.EventCustomActionsChanged
|
import info.nightscout.androidaps.events.EventCustomActionsChanged
|
||||||
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged
|
import info.nightscout.androidaps.events.EventInitializationChanged
|
||||||
|
@ -28,8 +31,15 @@ import info.nightscout.androidaps.events.EventTherapyEventChange
|
||||||
import info.nightscout.androidaps.extensions.toStringMedium
|
import info.nightscout.androidaps.extensions.toStringMedium
|
||||||
import info.nightscout.androidaps.extensions.toStringShort
|
import info.nightscout.androidaps.extensions.toStringShort
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
|
import info.nightscout.androidaps.interfaces.BuildHelper
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
|
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||||
|
import info.nightscout.androidaps.interfaces.Loop
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||||
|
@ -39,16 +49,15 @@ import info.nightscout.androidaps.skins.SkinProvider
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.interfaces.BuildHelper
|
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
|
||||||
import info.nightscout.androidaps.utils.ui.SingleClickButton
|
import info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
import info.nightscout.ui.activities.TDDStatsActivity
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import java.util.*
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ActionsFragment : DaggerFragment() {
|
class ActionsFragment : DaggerFragment() {
|
||||||
|
@ -73,6 +82,7 @@ class ActionsFragment : DaggerFragment() {
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var loop: Loop
|
@Inject lateinit var loop: Loop
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -137,7 +147,7 @@ class ActionsFragment : DaggerFragment() {
|
||||||
commandQueue.cancelExtended(object : Callback() {
|
commandQueue.cancelExtended(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -157,7 +167,7 @@ class ActionsFragment : DaggerFragment() {
|
||||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.text.Spanned
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
|
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
|
||||||
|
@ -19,23 +18,38 @@ import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.extensions.formatColor
|
import info.nightscout.androidaps.extensions.formatColor
|
||||||
import info.nightscout.androidaps.extensions.highValueToUnitsToString
|
import info.nightscout.androidaps.extensions.highValueToUnitsToString
|
||||||
import info.nightscout.androidaps.extensions.lowValueToUnitsToString
|
import info.nightscout.androidaps.extensions.lowValueToUnitsToString
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.androidaps.interfaces.BolusTimer
|
||||||
|
import info.nightscout.androidaps.interfaces.CarbTimer
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
|
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||||
|
import info.nightscout.androidaps.interfaces.Loop
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.Round
|
||||||
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.interfaces.BolusTimer
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import java.util.*
|
import java.util.LinkedList
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
@ -62,6 +76,7 @@ class BolusWizard @Inject constructor(
|
||||||
@Inject lateinit var bolusTimer: BolusTimer
|
@Inject lateinit var bolusTimer: BolusTimer
|
||||||
@Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider
|
@Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -388,7 +403,7 @@ class BolusWizard @Inject constructor(
|
||||||
commandQueue.bolus(this, object : Callback() {
|
commandQueue.bolus(this, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
} else
|
} else
|
||||||
carbTimer.scheduleAutomationEventEatReminder()
|
carbTimer.scheduleAutomationEventEatReminder()
|
||||||
}
|
}
|
||||||
|
@ -435,7 +450,7 @@ class BolusWizard @Inject constructor(
|
||||||
commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
commandQueue.tempBasalAbsolute(0.0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -443,7 +458,7 @@ class BolusWizard @Inject constructor(
|
||||||
commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
commandQueue.tempBasalPercent(0, 120, true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -474,7 +489,7 @@ class BolusWizard @Inject constructor(
|
||||||
commandQueue.bolus(this, object : Callback() {
|
commandQueue.bolus(this, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,7 +7,15 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.TestBase
|
import info.nightscout.androidaps.TestBase
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
|
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
|
@ -16,7 +24,6 @@ import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.receivers.ReceiverStatusStore
|
import info.nightscout.androidaps.receivers.ReceiverStatusStore
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
|
@ -44,6 +51,7 @@ class LoopPluginTest : TestBase() {
|
||||||
@Mock lateinit var dateUtil: DateUtil
|
@Mock lateinit var dateUtil: DateUtil
|
||||||
@Mock lateinit var runningConfiguration: RunningConfiguration
|
@Mock lateinit var runningConfiguration: RunningConfiguration
|
||||||
@Mock lateinit var config: Config
|
@Mock lateinit var config: Config
|
||||||
|
@Mock lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private lateinit var loopPlugin: LoopPlugin
|
private lateinit var loopPlugin: LoopPlugin
|
||||||
|
|
||||||
|
@ -51,7 +59,8 @@ class LoopPluginTest : TestBase() {
|
||||||
@Before fun prepareMock() {
|
@Before fun prepareMock() {
|
||||||
|
|
||||||
loopPlugin = LoopPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, config,
|
loopPlugin = LoopPlugin(injector, aapsLogger, aapsSchedulers, rxBus, sp, config,
|
||||||
constraintChecker, rh, profileFunction, context, commandQueue, activePlugin, virtualPumpPlugin, iobCobCalculator, receiverStatusStore, fabricPrivacy, dateUtil, uel, repository, runningConfiguration)
|
constraintChecker, rh, profileFunction, context, commandQueue, activePlugin, virtualPumpPlugin, iobCobCalculator, receiverStatusStore, fabricPrivacy, dateUtil, uel,
|
||||||
|
repository, runningConfiguration, activityNames)
|
||||||
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
|
`when`(activePlugin.activePump).thenReturn(virtualPumpPlugin)
|
||||||
`when`(context.getSystemService(Context.NOTIFICATION_SERVICE)).thenReturn(notificationManager)
|
`when`(context.getSystemService(Context.NOTIFICATION_SERVICE)).thenReturn(notificationManager)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,4 @@
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||||
|
|
||||||
<application android:supportsRtl="true">
|
|
||||||
<activity
|
|
||||||
android:name="info.nightscout.androidaps.activities.TDDStatsActivity"
|
|
||||||
android:exported="false" />
|
|
||||||
<activity
|
|
||||||
android:name="info.nightscout.androidaps.activities.BolusProgressHelperActivity"
|
|
||||||
android:exported="false"
|
|
||||||
android:theme="@style/Theme.MaterialComponents.Translucent" />
|
|
||||||
<activity
|
|
||||||
android:name="info.nightscout.androidaps.activities.ErrorHelperActivity"
|
|
||||||
android:exported="false"
|
|
||||||
android:theme="@style/Theme.MaterialComponents.Translucent" />
|
|
||||||
|
|
||||||
</application>
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -2,9 +2,6 @@ package info.nightscout.androidaps.di
|
||||||
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.BolusProgressHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.TDDStatsActivity
|
|
||||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
||||||
import info.nightscout.androidaps.dialogs.ErrorDialog
|
import info.nightscout.androidaps.dialogs.ErrorDialog
|
||||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
||||||
|
@ -16,10 +13,6 @@ import info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||||
abstract class CoreFragmentsModule {
|
abstract class CoreFragmentsModule {
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
|
@ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
|
|
||||||
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
|
|
||||||
@ContributesAndroidInjector abstract fun contributeErrorHelperActivity(): ErrorHelperActivity
|
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog
|
@ContributesAndroidInjector abstract fun contributesBolusProgressDialog(): BolusProgressDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog
|
@ContributesAndroidInjector abstract fun contributesErrorDialog(): ErrorDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesProfileViewerDialog(): ProfileViewerDialog
|
@ContributesAndroidInjector abstract fun contributesProfileViewerDialog(): ProfileViewerDialog
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.view.ViewGroup
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import dagger.android.support.DaggerDialogFragment
|
import dagger.android.support.DaggerDialogFragment
|
||||||
import info.nightscout.androidaps.activities.BolusProgressHelperActivity
|
import info.nightscout.androidaps.activities.DialogAppCompatActivity
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.core.databinding.DialogBolusprogressBinding
|
import info.nightscout.androidaps.core.databinding.DialogBolusprogressBinding
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
|
@ -50,7 +50,7 @@ class BolusProgressDialog : DaggerDialogFragment() {
|
||||||
private var amount = 0.0
|
private var amount = 0.0
|
||||||
var id: Long = 0L
|
var id: Long = 0L
|
||||||
private var state: String? = null
|
private var state: String? = null
|
||||||
private var helpActivity: BolusProgressHelperActivity? = null
|
private var helpActivity: DialogAppCompatActivity? = null
|
||||||
|
|
||||||
fun setId(id: Long): BolusProgressDialog {
|
fun setId(id: Long): BolusProgressDialog {
|
||||||
this.id = id
|
this.id = id
|
||||||
|
@ -63,7 +63,7 @@ class BolusProgressDialog : DaggerDialogFragment() {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setHelperActivity(activity: BolusProgressHelperActivity): BolusProgressDialog {
|
fun setHelperActivity(activity: DialogAppCompatActivity): BolusProgressDialog {
|
||||||
helpActivity = activity
|
helpActivity = activity
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import android.view.ViewGroup
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import dagger.android.support.DaggerDialogFragment
|
import dagger.android.support.DaggerDialogFragment
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
import info.nightscout.androidaps.activities.DialogAppCompatActivity
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.core.databinding.DialogErrorBinding
|
import info.nightscout.androidaps.core.databinding.DialogErrorBinding
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||||
|
@ -29,7 +29,7 @@ class ErrorDialog : DaggerDialogFragment() {
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
@Inject lateinit var ctx: Context
|
@Inject lateinit var ctx: Context
|
||||||
|
|
||||||
var helperActivity: ErrorHelperActivity? = null
|
var helperActivity: DialogAppCompatActivity? = null
|
||||||
var status: String = ""
|
var status: String = ""
|
||||||
var title: String = ""
|
var title: String = ""
|
||||||
var sound: Int = 0
|
var sound: Int = 0
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package info.nightscout.androidaps.interfaces
|
package info.nightscout.androidaps.interfaces
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.annotation.RawRes
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface to use activities located in different modules
|
||||||
|
* usage: startActivity(Intent(context, activityNames.xxxx))
|
||||||
|
*/
|
||||||
interface ActivityNames {
|
interface ActivityNames {
|
||||||
|
|
||||||
val mainActivityClass: Class<*>
|
val mainActivityClass: Class<*>
|
||||||
|
val tddStatsActivity: Class<*>
|
||||||
|
val errorHelperActivity: Class<*>
|
||||||
|
val bolusProgressHelperActivity: Class<*>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show ErrorHelperActivity and start alarm
|
||||||
|
* @param ctx Context
|
||||||
|
* @param status message inside dialog
|
||||||
|
* @param title title of dialog
|
||||||
|
* @param soundId sound resource. if == 0 alarm is not started
|
||||||
|
*/
|
||||||
|
fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0)
|
||||||
}
|
}
|
|
@ -9,12 +9,11 @@ import android.os.Handler
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import dagger.android.DaggerService
|
import dagger.android.DaggerService
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.interfaces.NotificationHolder
|
import info.nightscout.androidaps.interfaces.NotificationHolder
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.ln
|
import kotlin.math.ln
|
||||||
|
@ -32,6 +31,10 @@ class AlarmSoundService : DaggerService() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
const val SOUND_ID = "soundId"
|
||||||
|
const val STATUS = "status"
|
||||||
|
const val TITLE = "title"
|
||||||
|
|
||||||
private const val VOLUME_INCREASE_STEPS = 40 // Total number of steps to increase volume with
|
private const val VOLUME_INCREASE_STEPS = 40 // Total number of steps to increase volume with
|
||||||
private const val VOLUME_INCREASE_INITIAL_SILENT_TIME_MILLIS = 3_000L // Number of milliseconds that the notification should initially be silent
|
private const val VOLUME_INCREASE_INITIAL_SILENT_TIME_MILLIS = 3_000L // Number of milliseconds that the notification should initially be silent
|
||||||
private const val VOLUME_INCREASE_BASE_DELAY_MILLIS = 15_000 // Base delay between volume increments
|
private const val VOLUME_INCREASE_BASE_DELAY_MILLIS = 15_000 // Base delay between volume increments
|
||||||
|
@ -71,7 +74,7 @@ class AlarmSoundService : DaggerService() {
|
||||||
|
|
||||||
player?.let { if (it.isPlaying) it.stop() }
|
player?.let { if (it.isPlaying) it.stop() }
|
||||||
|
|
||||||
if (intent?.hasExtra(ErrorHelperActivity.SOUND_ID) == true) resourceId = intent.getIntExtra(ErrorHelperActivity.SOUND_ID, R.raw.error)
|
if (intent?.hasExtra(AlarmSoundService.SOUND_ID) == true) resourceId = intent.getIntExtra(AlarmSoundService.SOUND_ID, R.raw.error)
|
||||||
player = MediaPlayer()
|
player = MediaPlayer()
|
||||||
try {
|
try {
|
||||||
val afd = rh.openRawResourceFd(resourceId) ?: return START_NOT_STICKY
|
val afd = rh.openRawResourceFd(resourceId) ?: return START_NOT_STICKY
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.ServiceConnection
|
import android.content.ServiceConnection
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.interfaces.NotificationHolder
|
import info.nightscout.androidaps.interfaces.NotificationHolder
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
|
@ -70,7 +69,7 @@ class AlarmSoundServiceHelper @Inject constructor(
|
||||||
|
|
||||||
private fun getServiceIntent(context: Context, sound: Int): Intent {
|
private fun getServiceIntent(context: Context, sound: Int): Intent {
|
||||||
val alarm = Intent(context, AlarmSoundService::class.java)
|
val alarm = Intent(context, AlarmSoundService::class.java)
|
||||||
alarm.putExtra(ErrorHelperActivity.SOUND_ID, sound)
|
alarm.putExtra(AlarmSoundService.SOUND_ID, sound)
|
||||||
return alarm
|
return alarm
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,8 +6,6 @@ import android.os.SystemClock
|
||||||
import android.text.Spanned
|
import android.text.Spanned
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.BolusProgressHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
|
@ -22,6 +20,7 @@ import info.nightscout.androidaps.events.EventMobileToWear
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChanged
|
import info.nightscout.androidaps.events.EventProfileSwitchChanged
|
||||||
import info.nightscout.androidaps.extensions.getCustomizedName
|
import info.nightscout.androidaps.extensions.getCustomizedName
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.AndroidPermission
|
import info.nightscout.androidaps.interfaces.AndroidPermission
|
||||||
import info.nightscout.androidaps.interfaces.BuildHelper
|
import info.nightscout.androidaps.interfaces.BuildHelper
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
@ -93,7 +92,8 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
private val repository: AppRepository,
|
private val repository: AppRepository,
|
||||||
private val fabricPrivacy: FabricPrivacy,
|
private val fabricPrivacy: FabricPrivacy,
|
||||||
private val config: Config,
|
private val config: Config,
|
||||||
private val androidPermission: AndroidPermission
|
private val androidPermission: AndroidPermission,
|
||||||
|
private val activityNames: ActivityNames
|
||||||
) : CommandQueue {
|
) : CommandQueue {
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
@ -117,7 +117,7 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() {
|
setProfile(ProfileSealed.PS(it), it.interfaceIDs.nightscoutId != null, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.failedupdatebasalprofile), R.raw.boluserror)
|
activityNames.runAlarm(context, result.comment, rh.gs(R.string.failedupdatebasalprofile), R.raw.boluserror)
|
||||||
} else {
|
} else {
|
||||||
val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil)
|
val nonCustomized = ProfileSealed.PS(it).convertToNonCustomizedProfile(dateUtil)
|
||||||
EffectiveProfileSwitch(
|
EffectiveProfileSwitch(
|
||||||
|
@ -229,7 +229,7 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
val tempCommandQueue = CommandQueueImplementation(
|
val tempCommandQueue = CommandQueueImplementation(
|
||||||
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
injector, aapsLogger, rxBus, aapsSchedulers, rh,
|
||||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||||
buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission
|
buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission, activityNames
|
||||||
)
|
)
|
||||||
tempCommandQueue.readStatus(reason, callback)
|
tempCommandQueue.readStatus(reason, callback)
|
||||||
tempCommandQueue.disposable.clear()
|
tempCommandQueue.disposable.clear()
|
||||||
|
@ -631,7 +631,7 @@ class CommandQueueImplementation @Inject constructor(
|
||||||
val i = Intent()
|
val i = Intent()
|
||||||
i.putExtra("insulin", detailedBolusInfo.insulin)
|
i.putExtra("insulin", detailedBolusInfo.insulin)
|
||||||
i.putExtra("id", detailedBolusInfo.id)
|
i.putExtra("id", detailedBolusInfo.id)
|
||||||
i.setClass(context, BolusProgressHelperActivity::class.java)
|
i.setClass(context, activityNames.bolusProgressHelperActivity)
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
context.startActivity(i)
|
context.startActivity(i)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Context
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.implementation.R
|
|
||||||
import info.nightscout.androidaps.TestBaseWithProfile
|
import info.nightscout.androidaps.TestBaseWithProfile
|
||||||
import info.nightscout.androidaps.TestPumpPlugin
|
import info.nightscout.androidaps.TestPumpPlugin
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
|
@ -13,6 +12,7 @@ import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.ValueWrapper
|
import info.nightscout.androidaps.database.ValueWrapper
|
||||||
import info.nightscout.androidaps.database.entities.Bolus
|
import info.nightscout.androidaps.database.entities.Bolus
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.AndroidPermission
|
import info.nightscout.androidaps.interfaces.AndroidPermission
|
||||||
import info.nightscout.androidaps.interfaces.BuildHelper
|
import info.nightscout.androidaps.interfaces.BuildHelper
|
||||||
import info.nightscout.androidaps.interfaces.Config
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
|
@ -22,12 +22,13 @@ import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.queue.commands.*
|
import info.nightscout.androidaps.queue.commands.Command
|
||||||
|
import info.nightscout.androidaps.queue.commands.CustomCommand
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
import info.nightscout.implementation.R
|
||||||
import info.nightscout.implementation.queue.commands.CommandBolus
|
import info.nightscout.implementation.queue.commands.CommandBolus
|
||||||
import info.nightscout.implementation.queue.commands.CommandCustomCommand
|
import info.nightscout.implementation.queue.commands.CommandCustomCommand
|
||||||
import info.nightscout.implementation.queue.commands.CommandExtendedBolus
|
import info.nightscout.implementation.queue.commands.CommandExtendedBolus
|
||||||
|
@ -42,7 +43,7 @@ import org.junit.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.anyLong
|
import org.mockito.Mockito.anyLong
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
|
||||||
class CommandQueueImplementationTest : TestBaseWithProfile() {
|
class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
@Mock lateinit var powerManager: PowerManager
|
@Mock lateinit var powerManager: PowerManager
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
@Mock lateinit var fileListProvider: PrefFileListProvider
|
@Mock lateinit var activityNames: ActivityNames
|
||||||
@Mock lateinit var buildHelper: BuildHelper
|
@Mock lateinit var buildHelper: BuildHelper
|
||||||
@Mock lateinit var androidPermission: AndroidPermission
|
@Mock lateinit var androidPermission: AndroidPermission
|
||||||
|
|
||||||
|
@ -71,10 +72,11 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
repository: AppRepository,
|
repository: AppRepository,
|
||||||
fabricPrivacy: FabricPrivacy,
|
fabricPrivacy: FabricPrivacy,
|
||||||
config: Config,
|
config: Config,
|
||||||
androidPermission: AndroidPermission
|
androidPermission: AndroidPermission,
|
||||||
|
activityNames: ActivityNames
|
||||||
) : CommandQueueImplementation(
|
) : CommandQueueImplementation(
|
||||||
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction,
|
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker, profileFunction,
|
||||||
activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission
|
activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission, activityNames
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun notifyAboutNewCommand() {}
|
override fun notifyAboutNewCommand() {}
|
||||||
|
@ -119,7 +121,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||||
buildHelper, dateUtil,
|
buildHelper, dateUtil,
|
||||||
repository,
|
repository,
|
||||||
fabricPrivacy, config, androidPermission
|
fabricPrivacy, config, androidPermission, activityNames
|
||||||
)
|
)
|
||||||
testPumpPlugin = TestPumpPlugin(injector)
|
testPumpPlugin = TestPumpPlugin(injector)
|
||||||
|
|
||||||
|
@ -158,7 +160,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
||||||
constraintChecker, profileFunction, activePlugin, context, sp,
|
constraintChecker, profileFunction, activePlugin, context, sp,
|
||||||
buildHelper,
|
buildHelper,
|
||||||
dateUtil, repository,
|
dateUtil, repository,
|
||||||
fabricPrivacy, config, androidPermission
|
fabricPrivacy, config, androidPermission, activityNames
|
||||||
)
|
)
|
||||||
// start with empty queue
|
// start with empty queue
|
||||||
Assert.assertEquals(0, commandQueue.size())
|
Assert.assertEquals(0, commandQueue.size())
|
||||||
|
|
|
@ -8,6 +8,7 @@ import info.nightscout.androidaps.TestBaseWithProfile
|
||||||
import info.nightscout.androidaps.TestPumpPlugin
|
import info.nightscout.androidaps.TestPumpPlugin
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.AndroidPermission
|
import info.nightscout.androidaps.interfaces.AndroidPermission
|
||||||
import info.nightscout.androidaps.interfaces.BuildHelper
|
import info.nightscout.androidaps.interfaces.BuildHelper
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
|
@ -34,6 +35,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var repository: AppRepository
|
@Mock lateinit var repository: AppRepository
|
||||||
@Mock lateinit var buildHelper: BuildHelper
|
@Mock lateinit var buildHelper: BuildHelper
|
||||||
@Mock lateinit var androidPermission: AndroidPermission
|
@Mock lateinit var androidPermission: AndroidPermission
|
||||||
|
@Mock lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
val injector = HasAndroidInjector {
|
val injector = HasAndroidInjector {
|
||||||
AndroidInjector {
|
AndroidInjector {
|
||||||
|
@ -58,7 +60,7 @@ class QueueThreadTest : TestBaseWithProfile() {
|
||||||
commandQueue = CommandQueueImplementation(
|
commandQueue = CommandQueueImplementation(
|
||||||
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
|
injector, aapsLogger, rxBus, aapsSchedulers, rh, constraintChecker,
|
||||||
profileFunction, activePlugin, context, sp,
|
profileFunction, activePlugin, context, sp,
|
||||||
buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission
|
buildHelper, dateUtil, repository, fabricPrivacy, config, androidPermission, activityNames
|
||||||
)
|
)
|
||||||
|
|
||||||
val pumpDescription = PumpDescription()
|
val pumpDescription = PumpDescription()
|
||||||
|
|
|
@ -10,7 +10,6 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.activities.TDDStatsActivity
|
|
||||||
import info.nightscout.androidaps.dana.activities.DanaHistoryActivity
|
import info.nightscout.androidaps.dana.activities.DanaHistoryActivity
|
||||||
import info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity
|
import info.nightscout.androidaps.dana.activities.DanaUserOptionsActivity
|
||||||
import info.nightscout.androidaps.dana.databinding.DanarFragmentBinding
|
import info.nightscout.androidaps.dana.databinding.DanarFragmentBinding
|
||||||
|
@ -37,6 +36,7 @@ import info.nightscout.androidaps.utils.userEntry.UserEntryMapper.Sources
|
||||||
import info.nightscout.androidaps.utils.WarnColors
|
import info.nightscout.androidaps.utils.WarnColors
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.Dana
|
import info.nightscout.androidaps.interfaces.Dana
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
@ -59,6 +59,7 @@ class DanaFragment : DaggerFragment() {
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var uel: UserEntryLogger
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ class DanaFragment : DaggerFragment() {
|
||||||
|
|
||||||
}.show(childFragmentManager, "ProfileViewDialog")
|
}.show(childFragmentManager, "ProfileViewDialog")
|
||||||
}
|
}
|
||||||
binding.stats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) }
|
binding.stats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity)) }
|
||||||
binding.userOptions.setOnClickListener { startActivity(Intent(context, DanaUserOptionsActivity::class.java)) }
|
binding.userOptions.setOnClickListener { startActivity(Intent(context, DanaUserOptionsActivity::class.java)) }
|
||||||
binding.btConnectionLayout.setOnClickListener {
|
binding.btConnectionLayout.setOnClickListener {
|
||||||
aapsLogger.debug(LTag.PUMP, "Clicked connect to pump")
|
aapsLogger.debug(LTag.PUMP, "Clicked connect to pump")
|
||||||
|
|
|
@ -3,15 +3,14 @@ package info.nightscout.androidaps.dana.activities
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.dana.R
|
import info.nightscout.androidaps.dana.R
|
||||||
import info.nightscout.androidaps.dana.databinding.DanarUserOptionsActivityBinding
|
import info.nightscout.androidaps.dana.databinding.DanarUserOptionsActivityBinding
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged
|
import info.nightscout.androidaps.events.EventInitializationChanged
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
@ -32,6 +31,7 @@ class DanaUserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var commandQueue: CommandQueue
|
@Inject lateinit var commandQueue: CommandQueue
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class DanaUserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
commandQueue.setUserOptions(object : Callback() {
|
commandQueue.setUserOptions(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
|
activityNames.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,6 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector;
|
import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump;
|
import info.nightscout.androidaps.dana.DanaPump;
|
||||||
import info.nightscout.androidaps.dana.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.dana.events.EventDanaRNewStatus;
|
||||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin;
|
||||||
|
@ -50,19 +49,19 @@ import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
|
||||||
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
|
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
|
||||||
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
|
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
|
||||||
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
|
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
|
||||||
import info.nightscout.androidaps.interfaces.Profile;
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.dialogs.BolusProgressDialog;
|
||||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChanged;
|
import info.nightscout.androidaps.events.EventProfileSwitchChanged;
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames;
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue;
|
import info.nightscout.androidaps.interfaces.CommandQueue;
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
import info.nightscout.androidaps.interfaces.ProfileFunction;
|
||||||
import info.nightscout.androidaps.interfaces.Pump;
|
import info.nightscout.androidaps.interfaces.Pump;
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
import info.nightscout.androidaps.interfaces.PumpSync;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress;
|
||||||
|
@ -72,7 +71,8 @@ import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.queue.commands.Command;
|
import info.nightscout.androidaps.queue.commands.Command;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.T;
|
import info.nightscout.androidaps.utils.T;
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
|
|
||||||
public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
|
@ -91,6 +91,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
@Inject PumpSync pumpSync;
|
@Inject PumpSync pumpSync;
|
||||||
@Inject SP sp;
|
@Inject SP sp;
|
||||||
@Inject DateUtil dateUtil;
|
@Inject DateUtil dateUtil;
|
||||||
|
@Inject ActivityNames activityNames;
|
||||||
|
|
||||||
public DanaRv2ExecutionService() {
|
public DanaRv2ExecutionService() {
|
||||||
}
|
}
|
||||||
|
@ -194,7 +195,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
if (Math.abs(timeDiff) > 60 * 60 * 1.5) {
|
if (Math.abs(timeDiff) > 60 * 60 * 1.5) {
|
||||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds - large difference");
|
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds - large difference");
|
||||||
//If time-diff is very large, warn user until we can synchronize history readings properly
|
//If time-diff is very large, warn user until we can synchronize history readings properly
|
||||||
ErrorHelperActivity.Companion.runAlarm(context, rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error);
|
activityNames.runAlarm(context, rh.gs(R.string.largetimediff),
|
||||||
|
rh.gs(R.string.largetimedifftitle), R.raw.error);
|
||||||
|
|
||||||
//deinitialize pump
|
//deinitialize pump
|
||||||
danaPump.reset();
|
danaPump.reset();
|
||||||
|
@ -350,7 +352,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
||||||
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
|
mSerialIOThread.sendMessage(msgSetHistoryEntry_v2);
|
||||||
danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs());
|
danaPump.lastHistoryFetched = Math.min(danaPump.lastHistoryFetched, carbtime - T.Companion.mins(1).msecs());
|
||||||
if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.getFailed())
|
if (!msgSetHistoryEntry_v2.isReceived() || msgSetHistoryEntry_v2.getFailed())
|
||||||
ErrorHelperActivity.Companion.runAlarm(context, rh.gs(R.string.carbs_store_error)
|
activityNames.runAlarm(context, rh.gs(R.string.carbs_store_error)
|
||||||
, rh.gs(R.string.error), R.raw.boluserror);
|
, rh.gs(R.string.error), R.raw.boluserror);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.os.SystemClock
|
||||||
import dagger.android.DaggerService
|
import dagger.android.DaggerService
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.dana.DanaPump
|
import info.nightscout.androidaps.dana.DanaPump
|
||||||
import info.nightscout.androidaps.dana.comm.RecordTypes
|
import info.nightscout.androidaps.dana.comm.RecordTypes
|
||||||
import info.nightscout.androidaps.dana.events.EventDanaRNewStatus
|
import info.nightscout.androidaps.dana.events.EventDanaRNewStatus
|
||||||
|
@ -23,25 +22,25 @@ import info.nightscout.androidaps.events.EventInitializationChanged
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChanged
|
import info.nightscout.androidaps.events.EventProfileSwitchChanged
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
|
||||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||||
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.queue.commands.Command
|
import info.nightscout.androidaps.queue.commands.Command
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
|
@ -65,10 +64,9 @@ class DanaRSService : DaggerService() {
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
@Inject lateinit var danaRSPlugin: DanaRSPlugin
|
@Inject lateinit var danaRSPlugin: DanaRSPlugin
|
||||||
@Inject lateinit var danaPump: DanaPump
|
@Inject lateinit var danaPump: DanaPump
|
||||||
@Inject lateinit var danaRSMessageHashTable: DanaRSMessageHashTable
|
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var constraintChecker: ConstraintChecker
|
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||||
@Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
@Inject lateinit var bleComm: BLEComm
|
@Inject lateinit var bleComm: BLEComm
|
||||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||||
@Inject lateinit var pumpSync: PumpSync
|
@Inject lateinit var pumpSync: PumpSync
|
||||||
|
@ -162,7 +160,7 @@ class DanaRSService : DaggerService() {
|
||||||
if (abs(timeDiff) > 60 * 60 * 1.5) {
|
if (abs(timeDiff) > 60 * 60 * 1.5) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference")
|
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference")
|
||||||
//If time-diff is very large, warn user until we can synchronize history readings properly
|
//If time-diff is very large, warn user until we can synchronize history readings properly
|
||||||
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error)
|
activityNames.runAlarm(context, rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error)
|
||||||
|
|
||||||
//de-initialize pump
|
//de-initialize pump
|
||||||
danaPump.reset()
|
danaPump.reset()
|
||||||
|
@ -272,7 +270,7 @@ class DanaRSService : DaggerService() {
|
||||||
sendMessage(msgSetHistoryEntryV2)
|
sendMessage(msgSetHistoryEntryV2)
|
||||||
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
|
danaPump.lastHistoryFetched = min(danaPump.lastHistoryFetched, carbTime - T.mins(1).msecs())
|
||||||
if (!msgSetHistoryEntryV2.isReceived || msgSetHistoryEntryV2.failed)
|
if (!msgSetHistoryEntryV2.isReceived || msgSetHistoryEntryV2.failed)
|
||||||
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror)
|
activityNames.runAlarm(context, rh.gs(R.string.carbs_store_error), rh.gs(R.string.error), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
val bolusStart = System.currentTimeMillis()
|
val bolusStart = System.currentTimeMillis()
|
||||||
if (insulin > 0) {
|
if (insulin > 0) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.activities.TDDStatsActivity
|
|
||||||
import info.nightscout.androidaps.diaconn.activities.DiaconnG8HistoryActivity
|
import info.nightscout.androidaps.diaconn.activities.DiaconnG8HistoryActivity
|
||||||
import info.nightscout.androidaps.diaconn.activities.DiaconnG8UserOptionsActivity
|
import info.nightscout.androidaps.diaconn.activities.DiaconnG8UserOptionsActivity
|
||||||
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8FragmentBinding
|
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8FragmentBinding
|
||||||
|
@ -19,15 +18,16 @@ import info.nightscout.androidaps.events.EventInitializationChanged
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.events.EventTempBasalChange
|
import info.nightscout.androidaps.events.EventTempBasalChange
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.Pump
|
import info.nightscout.androidaps.interfaces.Pump
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.WarnColors
|
import info.nightscout.androidaps.utils.WarnColors
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
|
@ -49,6 +49,7 @@ class DiaconnG8Fragment : DaggerFragment() {
|
||||||
@Inject lateinit var warnColors: WarnColors
|
@Inject lateinit var warnColors: WarnColors
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ class DiaconnG8Fragment : DaggerFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
binding.history.setOnClickListener { startActivity(Intent(context, DiaconnG8HistoryActivity::class.java)) }
|
binding.history.setOnClickListener { startActivity(Intent(context, DiaconnG8HistoryActivity::class.java)) }
|
||||||
binding.stats.setOnClickListener { startActivity(Intent(context, TDDStatsActivity::class.java)) }
|
binding.stats.setOnClickListener { startActivity(Intent(context, activityNames.tddStatsActivity)) }
|
||||||
binding.userOptions.setOnClickListener { startActivity(Intent(context, DiaconnG8UserOptionsActivity::class.java)) }
|
binding.userOptions.setOnClickListener { startActivity(Intent(context, DiaconnG8UserOptionsActivity::class.java)) }
|
||||||
binding.btconnection.setOnClickListener {
|
binding.btconnection.setOnClickListener {
|
||||||
aapsLogger.debug(LTag.PUMP, "Clicked connect to pump")
|
aapsLogger.debug(LTag.PUMP, "Clicked connect to pump")
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
package info.nightscout.androidaps.diaconn.activities
|
package info.nightscout.androidaps.diaconn.activities
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||||
import info.nightscout.androidaps.diaconn.R
|
import info.nightscout.androidaps.diaconn.R
|
||||||
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8UserOptionsActivityBinding
|
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8UserOptionsActivityBinding
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
@ -31,6 +29,7 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var commandQueue: CommandQueue
|
@Inject lateinit var commandQueue: CommandQueue
|
||||||
@Inject lateinit var sp: SP
|
@Inject lateinit var sp: SP
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -152,7 +151,7 @@ class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() {
|
||||||
commandQueue.setUserOptions(object : Callback() {
|
commandQueue.setUserOptions(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
|
activityNames.runAlarm(context, result.comment, rh.gs(R.string.pumperror), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,26 +2,39 @@ package info.nightscout.androidaps.diaconn.service
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.bluetooth.*
|
import android.bluetooth.BluetoothAdapter
|
||||||
|
import android.bluetooth.BluetoothGatt
|
||||||
|
import android.bluetooth.BluetoothGattCallback
|
||||||
|
import android.bluetooth.BluetoothGattCharacteristic
|
||||||
|
import android.bluetooth.BluetoothGattDescriptor
|
||||||
|
import android.bluetooth.BluetoothGattService
|
||||||
|
import android.bluetooth.BluetoothManager
|
||||||
|
import android.bluetooth.BluetoothProfile
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||||
import info.nightscout.androidaps.diaconn.R
|
import info.nightscout.androidaps.diaconn.R
|
||||||
import info.nightscout.androidaps.diaconn.packet.*
|
import info.nightscout.androidaps.diaconn.packet.BatteryWarningReportPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BigLogInquireResponsePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.DiaconnG8Packet
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.DiaconnG8ResponseMessageHashTable
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.DiaconnG8SettingResponseMessageHashTable
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.InjectionBlockReportPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.InsulinLackReportPacket
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.extensions.notify
|
import info.nightscout.androidaps.extensions.notify
|
||||||
import info.nightscout.androidaps.extensions.waitMillis
|
import info.nightscout.androidaps.extensions.waitMillis
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import java.util.*
|
import java.util.UUID
|
||||||
import java.util.concurrent.ScheduledFuture
|
import java.util.concurrent.ScheduledFuture
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -36,6 +49,7 @@ class BLECommonService @Inject internal constructor(
|
||||||
private val diaconnG8ResponseMessageHashTable: DiaconnG8ResponseMessageHashTable,
|
private val diaconnG8ResponseMessageHashTable: DiaconnG8ResponseMessageHashTable,
|
||||||
private val diaconnG8SettingResponseMessageHashTable: DiaconnG8SettingResponseMessageHashTable,
|
private val diaconnG8SettingResponseMessageHashTable: DiaconnG8SettingResponseMessageHashTable,
|
||||||
private val diaconnG8Pump: DiaconnG8Pump,
|
private val diaconnG8Pump: DiaconnG8Pump,
|
||||||
|
private val activityNames: ActivityNames
|
||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -274,7 +288,7 @@ class BLECommonService @Inject internal constructor(
|
||||||
processedMessageByte = bytes
|
processedMessageByte = bytes
|
||||||
|
|
||||||
if (bluetoothGatt == null) {
|
if (bluetoothGatt == null) {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> IGNORING (NOT CONNECTED) " + message.friendlyName )
|
aapsLogger.debug(LTag.PUMPBTCOMM, ">>>>> IGNORING (NOT CONNECTED) " + message.friendlyName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,20 +338,20 @@ class BLECommonService @Inject internal constructor(
|
||||||
if (message is InjectionBlockReportPacket) {
|
if (message is InjectionBlockReportPacket) {
|
||||||
message.handleMessage(data)
|
message.handleMessage(data)
|
||||||
diaconnG8Pump.bolusBlocked = true
|
diaconnG8Pump.bolusBlocked = true
|
||||||
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.injectionblocked), rh.gs(R.string.injectionblocked), R.raw.boluserror)
|
activityNames.runAlarm(context, rh.gs(R.string.injectionblocked), rh.gs(R.string.injectionblocked), R.raw.boluserror)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// battery warning report
|
// battery warning report
|
||||||
if (message is BatteryWarningReportPacket) {
|
if (message is BatteryWarningReportPacket) {
|
||||||
message.handleMessage(data)
|
message.handleMessage(data)
|
||||||
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.needbatteryreplace), rh.gs(R.string.batterywarning), R.raw.boluserror)
|
activityNames.runAlarm(context, rh.gs(R.string.needbatteryreplace), rh.gs(R.string.batterywarning), R.raw.boluserror)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// insulin lack warning report
|
// insulin lack warning report
|
||||||
if (message is InsulinLackReportPacket) {
|
if (message is InsulinLackReportPacket) {
|
||||||
message.handleMessage(data)
|
message.handleMessage(data)
|
||||||
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.needinsullinreplace), rh.gs(R.string.insulinlackwarning), R.raw.boluserror)
|
activityNames.runAlarm(context, rh.gs(R.string.needinsullinreplace), rh.gs(R.string.insulinlackwarning), R.raw.boluserror)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.os.SystemClock
|
||||||
import dagger.android.DaggerService
|
import dagger.android.DaggerService
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
||||||
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
|
||||||
|
@ -18,7 +17,34 @@ import info.nightscout.androidaps.diaconn.api.DiaconnApiService
|
||||||
import info.nightscout.androidaps.diaconn.api.DiaconnLogUploader
|
import info.nightscout.androidaps.diaconn.api.DiaconnLogUploader
|
||||||
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryRecordDao
|
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryRecordDao
|
||||||
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8NewStatus
|
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8NewStatus
|
||||||
import info.nightscout.androidaps.diaconn.packet.*
|
import info.nightscout.androidaps.diaconn.packet.AppConfirmSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BasalLimitInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BasalSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BigAPSMainInfoInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BigLogInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BigMainInfoInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BolusSpeedInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.BolusSpeedSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.DiaconnG8Packet
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.DisplayTimeInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.DisplayTimeoutSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.IncarnationInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.InjectionBasalSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.InjectionCancelSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.InjectionExtendedBolusSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.InjectionSnackInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.InjectionSnackSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.LanguageInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.LanguageSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.LogStatusInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.SerialNumInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.SneckLimitInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.SoundInquirePacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.SoundSettingPacket
|
||||||
|
import info.nightscout.androidaps.diaconn.packet.TempBasalInquirePacket
|
||||||
|
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.diaconn.pumplog.PumplogUtil
|
||||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
||||||
import info.nightscout.androidaps.events.EventAppExit
|
import info.nightscout.androidaps.events.EventAppExit
|
||||||
|
@ -26,10 +52,12 @@ import info.nightscout.androidaps.events.EventInitializationChanged
|
||||||
import info.nightscout.androidaps.events.EventProfileSwitchChanged
|
import info.nightscout.androidaps.events.EventProfileSwitchChanged
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||||
|
@ -41,7 +69,6 @@ import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.queue.commands.Command
|
import info.nightscout.androidaps.queue.commands.Command
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
|
@ -68,7 +95,6 @@ class DiaconnG8Service : DaggerService() {
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
@Inject lateinit var diaconnG8Plugin: DiaconnG8Plugin
|
@Inject lateinit var diaconnG8Plugin: DiaconnG8Plugin
|
||||||
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
|
@Inject lateinit var diaconnG8Pump: DiaconnG8Pump
|
||||||
@Inject lateinit var diaconnG8ResponseMessageHashTable: DiaconnG8ResponseMessageHashTable
|
|
||||||
@Inject lateinit var activePlugin: ActivePlugin
|
@Inject lateinit var activePlugin: ActivePlugin
|
||||||
@Inject lateinit var constraintChecker: ConstraintChecker
|
@Inject lateinit var constraintChecker: ConstraintChecker
|
||||||
@Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
@Inject lateinit var detailedBolusInfoStorage: DetailedBolusInfoStorage
|
||||||
|
@ -79,6 +105,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var diaconnLogUploader: DiaconnLogUploader
|
@Inject lateinit var diaconnLogUploader: DiaconnLogUploader
|
||||||
@Inject lateinit var diaconnHistoryRecordDao: DiaconnHistoryRecordDao
|
@Inject lateinit var diaconnHistoryRecordDao: DiaconnHistoryRecordDao
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
private val mBinder: IBinder = LocalBinder()
|
private val mBinder: IBinder = LocalBinder()
|
||||||
|
@ -190,7 +217,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
if (abs(timeDiff) > 60 * 60 * 1.5) {
|
if (abs(timeDiff) > 60 * 60 * 1.5) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference")
|
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference")
|
||||||
//If time-diff is very large, warn user until we can synchronize history readings properly
|
//If time-diff is very large, warn user until we can synchronize history readings properly
|
||||||
ErrorHelperActivity.runAlarm(context, rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error)
|
activityNames.runAlarm(context, rh.gs(R.string.largetimediff), rh.gs(R.string.largetimedifftitle), R.raw.error)
|
||||||
|
|
||||||
//de-initialize pump
|
//de-initialize pump
|
||||||
diaconnG8Pump.reset()
|
diaconnG8Pump.reset()
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.os.IBinder
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity.Companion.runAlarm
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
|
@ -88,6 +87,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
private val medtronicHistoryData: MedtronicHistoryData,
|
private val medtronicHistoryData: MedtronicHistoryData,
|
||||||
private val rileyLinkServiceData: RileyLinkServiceData,
|
private val rileyLinkServiceData: RileyLinkServiceData,
|
||||||
private val serviceTaskExecutor: ServiceTaskExecutor,
|
private val serviceTaskExecutor: ServiceTaskExecutor,
|
||||||
|
private val activityNames: ActivityNames,
|
||||||
dateUtil: DateUtil,
|
dateUtil: DateUtil,
|
||||||
aapsSchedulers: AapsSchedulers,
|
aapsSchedulers: AapsSchedulers,
|
||||||
pumpSync: PumpSync,
|
pumpSync: PumpSync,
|
||||||
|
@ -626,7 +626,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Delivery Canceled after Bolus started.");
|
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Delivery Canceled after Bolus started.");
|
||||||
Thread {
|
Thread {
|
||||||
SystemClock.sleep(2000)
|
SystemClock.sleep(2000)
|
||||||
runAlarm(context, rh.gs(R.string.medtronic_cmd_cancel_bolus_not_supported), rh.gs(R.string.medtronic_warning), R.raw.boluserror)
|
activityNames.runAlarm(context, rh.gs(R.string.medtronic_cmd_cancel_bolus_not_supported), rh.gs(R.string.medtronic_warning), R.raw.boluserror)
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
val now = System.currentTimeMillis()
|
val now = System.currentTimeMillis()
|
||||||
|
@ -1182,7 +1182,7 @@ class MedtronicPumpPlugin @Inject constructor(
|
||||||
if (rileyLinkMedtronicService?.verifyConfiguration() == true) {
|
if (rileyLinkMedtronicService?.verifyConfiguration() == true) {
|
||||||
serviceTaskExecutor.startTask(WakeAndTuneTask(injector))
|
serviceTaskExecutor.startTask(WakeAndTuneTask(injector))
|
||||||
} else {
|
} else {
|
||||||
runAlarm(context, rh.gs(R.string.medtronic_error_operation_not_possible_no_configuration), rh.gs(R.string.medtronic_warning), R.raw.boluserror)
|
activityNames.runAlarm(context, rh.gs(R.string.medtronic_error_operation_not_possible_no_configuration), rh.gs(R.string.medtronic_warning), R.raw.boluserror)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.os.Handler
|
||||||
import android.os.HandlerThread
|
import android.os.HandlerThread
|
||||||
import android.text.format.DateFormat
|
import android.text.format.DateFormat
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity.Companion.runAlarm
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
|
@ -15,7 +14,17 @@ import info.nightscout.androidaps.events.EventTempBasalChange
|
||||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||||
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
||||||
import info.nightscout.androidaps.extensions.toStringFull
|
import info.nightscout.androidaps.extensions.toStringFull
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||||
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.Pump
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpPluginBase
|
||||||
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType
|
import info.nightscout.androidaps.plugins.common.ManufacturerType
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||||
|
@ -27,9 +36,22 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.*
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandDeactivatePod
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandDisableSuspendAlerts
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandHandleTimeChange
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandPlayTestBeep
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandResumeDelivery
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandSilenceAlerts
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandUpdateAlertConfiguration
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.OmnipodDashManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.*
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ActivationProgress
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertConfiguration
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertTrigger
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertType
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepRepetitionType
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.ResponseType
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.ResponseType
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.CommandConfirmed
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.CommandConfirmed
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||||
|
@ -61,7 +83,7 @@ import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
import java.util.*
|
import java.util.Date
|
||||||
import java.util.concurrent.CountDownLatch
|
import java.util.concurrent.CountDownLatch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -81,7 +103,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
private val aapsSchedulers: AapsSchedulers,
|
private val aapsSchedulers: AapsSchedulers,
|
||||||
private val fabricPrivacy: FabricPrivacy,
|
private val fabricPrivacy: FabricPrivacy,
|
||||||
private val dateUtil: DateUtil,
|
private val dateUtil: DateUtil,
|
||||||
|
private val activityNames: ActivityNames,
|
||||||
injector: HasAndroidInjector,
|
injector: HasAndroidInjector,
|
||||||
aapsLogger: AAPSLogger,
|
aapsLogger: AAPSLogger,
|
||||||
rh: ResourceHelper,
|
rh: ResourceHelper,
|
||||||
|
@ -1478,7 +1500,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showErrorDialog(message: String, sound: Int) {
|
private fun showErrorDialog(message: String, sound: Int) {
|
||||||
runAlarm(context, message, rh.gs(R.string.error), sound)
|
activityNames.runAlarm(context, message, rh.gs(R.string.error), sound)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showNotification(id: Int, message: String, urgency: Int, sound: Int?) {
|
private fun showNotification(id: Int, message: String, urgency: Int, sound: Int?) {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandPlayTestBeep
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandPlayTestBeep
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
|
||||||
|
@ -33,6 +33,7 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
@Inject lateinit var context: Context
|
@Inject lateinit var context: Context
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var podStateManager: OmnipodDashPodStateManager
|
@Inject lateinit var podStateManager: OmnipodDashPodStateManager
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -147,7 +148,7 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) {
|
private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) {
|
||||||
context.let {
|
context.let {
|
||||||
ErrorHelperActivity.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,11 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.BuildHelper
|
import info.nightscout.androidaps.interfaces.BuildHelper
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||||
|
@ -49,7 +48,8 @@ import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
import java.util.*
|
import java.util.Date
|
||||||
|
import java.util.TimeZone
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
@Inject lateinit var dateUtil: DateUtil
|
@Inject lateinit var dateUtil: DateUtil
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var pumpSync: PumpSync
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
@Inject lateinit var buildHelper: BuildHelper
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -677,7 +677,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
private fun displayErrorDialog(title: String, message: String, withSound: Boolean) {
|
private fun displayErrorDialog(title: String, message: String, withSound: Boolean) {
|
||||||
context?.let {
|
context?.let {
|
||||||
ErrorHelperActivity.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.eros;
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros;
|
||||||
|
|
||||||
|
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.convertedToAbsolute;
|
||||||
|
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.getPlannedRemainingMinutes;
|
||||||
|
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.toStringFull;
|
||||||
|
import static info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -29,7 +34,6 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector;
|
import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.events.EventAppExit;
|
import info.nightscout.androidaps.events.EventAppExit;
|
||||||
|
@ -37,6 +41,7 @@ import info.nightscout.androidaps.events.EventAppInitialized;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
import info.nightscout.androidaps.interfaces.ActivePlugin;
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames;
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue;
|
import info.nightscout.androidaps.interfaces.CommandQueue;
|
||||||
import info.nightscout.androidaps.interfaces.PluginDescription;
|
import info.nightscout.androidaps.interfaces.PluginDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PluginType;
|
import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
|
@ -46,9 +51,7 @@ import info.nightscout.androidaps.interfaces.Pump;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||||
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
import info.nightscout.androidaps.interfaces.PumpPluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
import info.nightscout.androidaps.interfaces.PumpSync;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalSchedule;
|
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
import info.nightscout.androidaps.plugins.common.ManufacturerType;
|
||||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType;
|
||||||
|
@ -81,6 +84,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.Al
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertSet;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.AlertSet;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.BeepConfigType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.BeepConfigType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.schedule.BasalSchedule;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.ErosPodStateManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.util.TimeUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.util.TimeUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosActiveAlertsChanged;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosActiveAlertsChanged;
|
||||||
|
@ -98,22 +102,19 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.androidaps.queue.commands.CustomCommand;
|
import info.nightscout.androidaps.queue.commands.CustomCommand;
|
||||||
|
import info.nightscout.androidaps.services.AlarmSoundService;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DecimalFormatter;
|
import info.nightscout.androidaps.utils.DecimalFormatter;
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||||
import info.nightscout.androidaps.utils.Round;
|
import info.nightscout.androidaps.utils.Round;
|
||||||
import info.nightscout.androidaps.utils.T;
|
import info.nightscout.androidaps.utils.T;
|
||||||
import info.nightscout.androidaps.utils.TimeChangeType;
|
import info.nightscout.androidaps.utils.TimeChangeType;
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
import io.reactivex.rxjava3.disposables.CompositeDisposable;
|
||||||
|
|
||||||
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.convertedToAbsolute;
|
|
||||||
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.getPlannedRemainingMinutes;
|
|
||||||
import static info.nightscout.androidaps.extensions.PumpStateExtensionKt.toStringFull;
|
|
||||||
import static info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants.BASAL_STEP_DURATION;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 23.04.18.
|
* Created by andy on 23.04.18.
|
||||||
*
|
*
|
||||||
|
@ -129,7 +130,6 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
private final ErosPodStateManager podStateManager;
|
private final ErosPodStateManager podStateManager;
|
||||||
private final RileyLinkServiceData rileyLinkServiceData;
|
private final RileyLinkServiceData rileyLinkServiceData;
|
||||||
private final AapsOmnipodErosManager aapsOmnipodErosManager;
|
private final AapsOmnipodErosManager aapsOmnipodErosManager;
|
||||||
private final ErosHistory erosHistory;
|
|
||||||
private final AapsOmnipodUtil aapsOmnipodUtil;
|
private final AapsOmnipodUtil aapsOmnipodUtil;
|
||||||
private final RileyLinkUtil rileyLinkUtil;
|
private final RileyLinkUtil rileyLinkUtil;
|
||||||
private final OmnipodAlertUtil omnipodAlertUtil;
|
private final OmnipodAlertUtil omnipodAlertUtil;
|
||||||
|
@ -147,6 +147,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
private final ServiceConnection serviceConnection;
|
private final ServiceConnection serviceConnection;
|
||||||
private final PumpType pumpType = PumpType.OMNIPOD_EROS;
|
private final PumpType pumpType = PumpType.OMNIPOD_EROS;
|
||||||
private final PumpSync pumpSync;
|
private final PumpSync pumpSync;
|
||||||
|
private final ActivityNames activityNames;
|
||||||
|
|
||||||
private final CompositeDisposable disposable = new CompositeDisposable();
|
private final CompositeDisposable disposable = new CompositeDisposable();
|
||||||
|
|
||||||
|
@ -176,7 +177,6 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
ActivePlugin activePlugin,
|
ActivePlugin activePlugin,
|
||||||
SP sp,
|
SP sp,
|
||||||
ErosPodStateManager podStateManager,
|
ErosPodStateManager podStateManager,
|
||||||
ErosHistory erosHistory,
|
|
||||||
AapsOmnipodErosManager aapsOmnipodErosManager,
|
AapsOmnipodErosManager aapsOmnipodErosManager,
|
||||||
CommandQueue commandQueue,
|
CommandQueue commandQueue,
|
||||||
FabricPrivacy fabricPrivacy,
|
FabricPrivacy fabricPrivacy,
|
||||||
|
@ -186,7 +186,8 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
RileyLinkUtil rileyLinkUtil,
|
RileyLinkUtil rileyLinkUtil,
|
||||||
OmnipodAlertUtil omnipodAlertUtil,
|
OmnipodAlertUtil omnipodAlertUtil,
|
||||||
ProfileFunction profileFunction,
|
ProfileFunction profileFunction,
|
||||||
PumpSync pumpSync
|
PumpSync pumpSync,
|
||||||
|
ActivityNames activityNames
|
||||||
) {
|
) {
|
||||||
super(new PluginDescription() //
|
super(new PluginDescription() //
|
||||||
.mainType(PluginType.PUMP) //
|
.mainType(PluginType.PUMP) //
|
||||||
|
@ -209,12 +210,12 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
this.podStateManager = podStateManager;
|
this.podStateManager = podStateManager;
|
||||||
this.rileyLinkServiceData = rileyLinkServiceData;
|
this.rileyLinkServiceData = rileyLinkServiceData;
|
||||||
this.aapsOmnipodErosManager = aapsOmnipodErosManager;
|
this.aapsOmnipodErosManager = aapsOmnipodErosManager;
|
||||||
this.erosHistory = erosHistory;
|
|
||||||
this.aapsOmnipodUtil = aapsOmnipodUtil;
|
this.aapsOmnipodUtil = aapsOmnipodUtil;
|
||||||
this.rileyLinkUtil = rileyLinkUtil;
|
this.rileyLinkUtil = rileyLinkUtil;
|
||||||
this.omnipodAlertUtil = omnipodAlertUtil;
|
this.omnipodAlertUtil = omnipodAlertUtil;
|
||||||
this.profileFunction = profileFunction;
|
this.profileFunction = profileFunction;
|
||||||
this.pumpSync = pumpSync;
|
this.pumpSync = pumpSync;
|
||||||
|
this.activityNames = activityNames;
|
||||||
|
|
||||||
pumpDescription = new PumpDescription(pumpType);
|
pumpDescription = new PumpDescription(pumpType);
|
||||||
|
|
||||||
|
@ -896,10 +897,10 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(aapsOmnipodErosManager.translateException(ex));
|
return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(aapsOmnipodErosManager.translateException(ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
Intent i = new Intent(context, activityNames.getErrorHelperActivity());
|
||||||
i.putExtra(ErrorHelperActivity.SOUND_ID, 0);
|
i.putExtra(AlarmSoundService.SOUND_ID, 0);
|
||||||
i.putExtra(ErrorHelperActivity.STATUS, rh.gs(R.string.omnipod_eros_pod_management_pulse_log_value) + ":\n" + result.toString());
|
i.putExtra(AlarmSoundService.STATUS, rh.gs(R.string.omnipod_eros_pod_management_pulse_log_value) + ":\n" + result.toString());
|
||||||
i.putExtra(ErrorHelperActivity.TITLE, rh.gs(R.string.omnipod_eros_pod_management_pulse_log));
|
i.putExtra(AlarmSoundService.TITLE, rh.gs(R.string.omnipod_eros_pod_management_pulse_log));
|
||||||
i.putExtra("clipboardContent", result.toString());
|
i.putExtra("clipboardContent", result.toString());
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
context.startActivity(i);
|
context.startActivity(i);
|
||||||
|
|
|
@ -14,16 +14,15 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector;
|
import dagger.android.HasAndroidInjector;
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity;
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.events.Event;
|
import info.nightscout.androidaps.events.Event;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||||
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
|
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames;
|
||||||
import info.nightscout.androidaps.interfaces.Profile;
|
import info.nightscout.androidaps.interfaces.Profile;
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync;
|
import info.nightscout.androidaps.interfaces.PumpSync;
|
||||||
import info.nightscout.shared.logging.AAPSLogger;
|
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
||||||
import info.nightscout.shared.logging.LTag;
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus;
|
import info.nightscout.androidaps.plugins.bus.RxBus;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
|
||||||
|
@ -79,8 +78,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.Om
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.AapsOmnipodUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.util.OmnipodAlertUtil;
|
||||||
import info.nightscout.androidaps.utils.T;
|
import info.nightscout.androidaps.utils.T;
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper;
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers;
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger;
|
||||||
|
import info.nightscout.shared.logging.LTag;
|
||||||
import info.nightscout.shared.sharedPreferences.SP;
|
import info.nightscout.shared.sharedPreferences.SP;
|
||||||
import io.reactivex.rxjava3.subjects.SingleSubject;
|
import io.reactivex.rxjava3.subjects.SingleSubject;
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ public class AapsOmnipodErosManager {
|
||||||
private final OmnipodAlertUtil omnipodAlertUtil;
|
private final OmnipodAlertUtil omnipodAlertUtil;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final PumpSync pumpSync;
|
private final PumpSync pumpSync;
|
||||||
|
private final ActivityNames activityNames;
|
||||||
|
|
||||||
private boolean basalBeepsEnabled;
|
private boolean basalBeepsEnabled;
|
||||||
private boolean bolusBeepsEnabled;
|
private boolean bolusBeepsEnabled;
|
||||||
|
@ -128,7 +129,8 @@ public class AapsOmnipodErosManager {
|
||||||
HasAndroidInjector injector,
|
HasAndroidInjector injector,
|
||||||
OmnipodAlertUtil omnipodAlertUtil,
|
OmnipodAlertUtil omnipodAlertUtil,
|
||||||
Context context,
|
Context context,
|
||||||
PumpSync pumpSync) {
|
PumpSync pumpSync,
|
||||||
|
ActivityNames activityNames) {
|
||||||
|
|
||||||
this.podStateManager = podStateManager;
|
this.podStateManager = podStateManager;
|
||||||
this.erosHistory = erosHistory;
|
this.erosHistory = erosHistory;
|
||||||
|
@ -141,6 +143,7 @@ public class AapsOmnipodErosManager {
|
||||||
this.omnipodAlertUtil = omnipodAlertUtil;
|
this.omnipodAlertUtil = omnipodAlertUtil;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.pumpSync = pumpSync;
|
this.pumpSync = pumpSync;
|
||||||
|
this.activityNames = activityNames;
|
||||||
|
|
||||||
delegate = new OmnipodManager(aapsLogger, aapsSchedulers, communicationService, podStateManager);
|
delegate = new OmnipodManager(aapsLogger, aapsSchedulers, communicationService, podStateManager);
|
||||||
|
|
||||||
|
@ -965,7 +968,7 @@ public class AapsOmnipodErosManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showErrorDialog(String message, Integer sound) {
|
private void showErrorDialog(String message, Integer sound) {
|
||||||
ErrorHelperActivity.Companion.runAlarm(context, message, rh.gs(R.string.error), sound);
|
activityNames.runAlarm(context, message, rh.gs(R.string.error), sound);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPodFaultNotification(FaultEventCode faultEventCode) {
|
private void showPodFaultNotification(FaultEventCode faultEventCode) {
|
||||||
|
|
|
@ -6,10 +6,11 @@ import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.HandlerThread
|
import android.os.HandlerThread
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
|
import info.nightscout.androidaps.interfaces.BuildHelper
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
|
||||||
|
@ -31,8 +32,6 @@ import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
|
||||||
import info.nightscout.androidaps.interfaces.BuildHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
|
@ -55,6 +54,7 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
@Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor
|
@Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
@Inject lateinit var buildHelper: BuildHelper
|
@Inject lateinit var buildHelper: BuildHelper
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||||
private val handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
private val handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper)
|
||||||
|
@ -69,7 +69,8 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
binding.buttonActivatePod.setOnClickListener {
|
binding.buttonActivatePod.setOnClickListener {
|
||||||
val type: PodActivationWizardActivity.Type = if (podStateManager.isPodInitialized
|
val type: PodActivationWizardActivity.Type = if (podStateManager.isPodInitialized
|
||||||
and podStateManager.activationProgress.isAtLeast(ActivationProgress.PRIMING_COMPLETED)) {
|
and podStateManager.activationProgress.isAtLeast(ActivationProgress.PRIMING_COMPLETED)
|
||||||
|
) {
|
||||||
PodActivationWizardActivity.Type.SHORT
|
PodActivationWizardActivity.Type.SHORT
|
||||||
} else {
|
} else {
|
||||||
PodActivationWizardActivity.Type.LONG
|
PodActivationWizardActivity.Type.LONG
|
||||||
|
@ -86,9 +87,9 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
binding.buttonDiscardPod.setOnClickListener {
|
binding.buttonDiscardPod.setOnClickListener {
|
||||||
OKDialog.showConfirmation(this,
|
OKDialog.showConfirmation(this,
|
||||||
rh.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation), Thread {
|
rh.gs(R.string.omnipod_common_pod_management_discard_pod_confirmation), Thread {
|
||||||
aapsOmnipodManager.discardPodState()
|
aapsOmnipodManager.discardPodState()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttonRileylinkStats.setOnClickListener {
|
binding.buttonRileylinkStats.setOnClickListener {
|
||||||
|
@ -111,7 +112,11 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
commandQueue.customCommand(CommandPlayTestBeep(), object : Callback() {
|
commandQueue.customCommand(CommandPlayTestBeep(), object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
displayErrorDialog(rh.gs(R.string.omnipod_common_warning), rh.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, rh.gs(R.string.omnipod_common_error_failed_to_play_test_beep), result.comment), false)
|
displayErrorDialog(
|
||||||
|
rh.gs(R.string.omnipod_common_warning),
|
||||||
|
rh.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, rh.gs(R.string.omnipod_common_error_failed_to_play_test_beep), result.comment),
|
||||||
|
false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -124,7 +129,11 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
commandQueue.customCommand(CommandReadPulseLog(), object : Callback() {
|
commandQueue.customCommand(CommandReadPulseLog(), object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
displayErrorDialog(rh.gs(R.string.omnipod_common_warning), rh.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, rh.gs(R.string.omnipod_eros_error_failed_to_read_pulse_log), result.comment), false)
|
displayErrorDialog(
|
||||||
|
rh.gs(R.string.omnipod_common_warning),
|
||||||
|
rh.gs(R.string.omnipod_common_two_strings_concatenated_by_colon, rh.gs(R.string.omnipod_eros_error_failed_to_read_pulse_log), result.comment),
|
||||||
|
false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -224,15 +233,17 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) {
|
private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) {
|
||||||
context.let {
|
context.let {
|
||||||
ErrorHelperActivity.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayNotConfiguredDialog() {
|
private fun displayNotConfiguredDialog() {
|
||||||
context.let {
|
context.let {
|
||||||
UIRunnable {
|
UIRunnable {
|
||||||
OKDialog.show(it, rh.gs(R.string.omnipod_common_warning),
|
OKDialog.show(
|
||||||
rh.gs(R.string.omnipod_eros_error_operation_not_possible_no_configuration), null)
|
it, rh.gs(R.string.omnipod_common_warning),
|
||||||
|
rh.gs(R.string.omnipod_eros_error_operation_not_possible_no_configuration), null
|
||||||
|
)
|
||||||
}.run()
|
}.run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
|
@ -56,7 +56,7 @@ import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import org.joda.time.Duration
|
import org.joda.time.Duration
|
||||||
import java.util.*
|
import java.util.TimeZone
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class OmnipodErosOverviewFragment : DaggerFragment() {
|
class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
@ -81,6 +81,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
@Inject lateinit var omnipodManager: AapsOmnipodErosManager
|
@Inject lateinit var omnipodManager: AapsOmnipodErosManager
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -243,7 +244,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
|
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + rh.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
|
||||||
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
|
else -> "{fa-bluetooth-b} " + rh.gs(resourceId)
|
||||||
}
|
}
|
||||||
rileyLinkStatusBinding.rileyLinkStatus.setTextColor( rh.gac(context, if (rileyLinkServiceState.isError || rileyLinkError != null) R.attr.warningColor else R.attr.defaultTextColor))
|
rileyLinkStatusBinding.rileyLinkStatus.setTextColor(rh.gac(context, if (rileyLinkServiceState.isError || rileyLinkError != null) R.attr.warningColor else R.attr.defaultTextColor))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateOmnipodStatus() {
|
private fun updateOmnipodStatus() {
|
||||||
|
@ -285,12 +286,14 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
podInfoBinding.timeOnPod.text = readableZonedTime(podStateManager.time)
|
podInfoBinding.timeOnPod.text = readableZonedTime(podStateManager.time)
|
||||||
podInfoBinding.timeOnPod.setTextColor(
|
podInfoBinding.timeOnPod.setTextColor(
|
||||||
rh.gac(context,
|
rh.gac(
|
||||||
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
context,
|
||||||
R.attr.warningColor
|
if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
||||||
} else {
|
R.attr.warningColor
|
||||||
R.attr.defaultTextColor
|
} else {
|
||||||
})
|
R.attr.defaultTextColor
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
val expiresAt = podStateManager.expiresAt
|
val expiresAt = podStateManager.expiresAt
|
||||||
if (expiresAt == null) {
|
if (expiresAt == null) {
|
||||||
|
@ -299,13 +302,15 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
|
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
|
||||||
podInfoBinding.podExpiryDate.setTextColor(
|
podInfoBinding.podExpiryDate.setTextColor(
|
||||||
rh.gac(context,
|
rh.gac(
|
||||||
if (DateTime.now().isAfter(expiresAt)) {
|
context,
|
||||||
R.attr.warningColor
|
if (DateTime.now().isAfter(expiresAt)) {
|
||||||
} else {
|
R.attr.warningColor
|
||||||
R.attr.defaultTextColor
|
} else {
|
||||||
}
|
R.attr.defaultTextColor
|
||||||
))
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (podStateManager.isPodFaulted) {
|
if (podStateManager.isPodFaulted) {
|
||||||
|
@ -338,12 +343,14 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
|
podInfoBinding.reservoir.text = rh.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
|
||||||
podInfoBinding.reservoir.setTextColor(
|
podInfoBinding.reservoir.setTextColor(
|
||||||
rh.gac(context,
|
rh.gac(
|
||||||
if (podStateManager.reservoirLevel < lowReservoirThreshold) {
|
context,
|
||||||
R.attr.warningColor
|
if (podStateManager.reservoirLevel < lowReservoirThreshold) {
|
||||||
} else {
|
R.attr.warningColor
|
||||||
R.attr.defaultTextColor
|
} else {
|
||||||
})
|
R.attr.defaultTextColor
|
||||||
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,12 +374,14 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
|
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
|
||||||
podInfoBinding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
|
podInfoBinding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
|
||||||
val lastConnectionColor =
|
val lastConnectionColor =
|
||||||
rh.gac(context,
|
rh.gac(
|
||||||
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
|
context,
|
||||||
R.attr.warningColor
|
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
|
||||||
} else {
|
R.attr.warningColor
|
||||||
R.attr.defaultTextColor
|
} else {
|
||||||
})
|
R.attr.defaultTextColor
|
||||||
|
}
|
||||||
|
)
|
||||||
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
||||||
} else {
|
} else {
|
||||||
podInfoBinding.lastConnection.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
podInfoBinding.lastConnection.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||||
|
@ -420,12 +429,14 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
val podStatusColor =
|
val podStatusColor =
|
||||||
rh.gac( context,
|
rh.gac(
|
||||||
if (!podStateManager.isPodActivationCompleted || podStateManager.isPodDead || podStateManager.isSuspended || (podStateManager.isPodRunning && !podStateManager.isBasalCertain)) {
|
context,
|
||||||
R.attr.warningColor
|
if (!podStateManager.isPodActivationCompleted || podStateManager.isPodDead || podStateManager.isSuspended || (podStateManager.isPodRunning && !podStateManager.isBasalCertain)) {
|
||||||
} else {
|
R.attr.warningColor
|
||||||
R.attr.defaultTextColor
|
} else {
|
||||||
})
|
R.attr.defaultTextColor
|
||||||
|
}
|
||||||
|
)
|
||||||
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,9 +484,9 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
val textColor: Int
|
val textColor: Int
|
||||||
text = rh.gs(R.string.omnipod_common_overview_temp_basal_value, amount, dateUtil.timeString(startTime.millis), minutesRunning, duration.standardMinutes)
|
text = rh.gs(R.string.omnipod_common_overview_temp_basal_value, amount, dateUtil.timeString(startTime.millis), minutesRunning, duration.standardMinutes)
|
||||||
if (podStateManager.isTempBasalCertain) {
|
if (podStateManager.isTempBasalCertain) {
|
||||||
textColor = rh.gac(context, R.attr.defaultTextColor)
|
textColor = rh.gac(context, R.attr.defaultTextColor)
|
||||||
} else {
|
} else {
|
||||||
textColor = rh.gac(context, R.attr.warningColor)
|
textColor = rh.gac(context, R.attr.warningColor)
|
||||||
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
text += " (" + rh.gs(R.string.omnipod_eros_uncertain) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +592,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
private fun displayErrorDialog(title: String, message: String, withSound: Boolean) {
|
private fun displayErrorDialog(title: String, message: String, withSound: Boolean) {
|
||||||
context?.let {
|
context?.let {
|
||||||
ErrorHelperActivity.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
activityNames.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,16 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.TestBase
|
import info.nightscout.androidaps.TestBase
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
import info.nightscout.androidaps.interfaces.PumpSync
|
import info.nightscout.androidaps.interfaces.PumpSync
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair
|
import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.ErosHistory
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
|
||||||
import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
|
import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import org.joda.time.tz.UTCProvider
|
import org.joda.time.tz.UTCProvider
|
||||||
|
@ -27,7 +27,6 @@ import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
import org.mockito.invocation.InvocationOnMock
|
import org.mockito.invocation.InvocationOnMock
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class OmnipodErosPumpPluginTest : TestBase() {
|
class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
@Mock lateinit var rh: ResourceHelper
|
@Mock lateinit var rh: ResourceHelper
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin
|
||||||
@Mock lateinit var aapsOmnipodErosManager: AapsOmnipodErosManager
|
@Mock lateinit var aapsOmnipodErosManager: AapsOmnipodErosManager
|
||||||
@Mock lateinit var erosHistory: ErosHistory
|
@Mock lateinit var activityNames: ActivityNames
|
||||||
@Mock lateinit var commandQueue: CommandQueue
|
@Mock lateinit var commandQueue: CommandQueue
|
||||||
@Mock lateinit var rileyLinkUtil: RileyLinkUtil
|
@Mock lateinit var rileyLinkUtil: RileyLinkUtil
|
||||||
@Mock lateinit var pumpSync: PumpSync
|
@Mock lateinit var pumpSync: PumpSync
|
||||||
|
@ -53,9 +52,9 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
// mock all the things
|
// mock all the things
|
||||||
val plugin = OmnipodErosPumpPlugin(
|
val plugin = OmnipodErosPumpPlugin(
|
||||||
injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null,
|
injector, aapsLogger, TestAapsSchedulers(), rxBusWrapper, null,
|
||||||
rh, activePlugin, null, null, erosHistory, aapsOmnipodErosManager, commandQueue,
|
rh, activePlugin, null, null, aapsOmnipodErosManager, commandQueue,
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
rileyLinkUtil, null, null, pumpSync
|
rileyLinkUtil, null, null, pumpSync, activityNames
|
||||||
)
|
)
|
||||||
val pumpState = PumpSync.PumpState(null, null, null, null, "")
|
val pumpState = PumpSync.PumpState(null, null, null, null, "")
|
||||||
`when`(pumpSync.expectedPumpState()).thenReturn(pumpState)
|
`when`(pumpSync.expectedPumpState()).thenReturn(pumpState)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<application>
|
<application android:supportsRtl="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".widget.WidgetConfigureActivity"
|
android:name=".widget.WidgetConfigureActivity"
|
||||||
|
@ -23,6 +23,19 @@
|
||||||
android:name="android.appwidget.provider"
|
android:name="android.appwidget.provider"
|
||||||
android:resource="@xml/widget_info" />
|
android:resource="@xml/widget_info" />
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".activities.TDDStatsActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name="info.nightscout.ui.activities.BolusProgressHelperActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.MaterialComponents.Translucent" />
|
||||||
|
<activity
|
||||||
|
android:name=".activities.ErrorHelperActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:theme="@style/Theme.MaterialComponents.Translucent" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.activities
|
package info.nightscout.ui.activities
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import info.nightscout.androidaps.activities.DialogAppCompatActivity
|
||||||
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
import info.nightscout.androidaps.dialogs.BolusProgressDialog
|
||||||
|
|
||||||
class BolusProgressHelperActivity : DialogAppCompatActivity() {
|
class BolusProgressHelperActivity : DialogAppCompatActivity() {
|
|
@ -1,13 +1,15 @@
|
||||||
package info.nightscout.androidaps.activities
|
package info.nightscout.ui.activities
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.annotation.RawRes
|
import androidx.annotation.RawRes
|
||||||
|
import info.nightscout.androidaps.activities.DialogAppCompatActivity
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
|
import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnouncementTransaction
|
||||||
import info.nightscout.androidaps.dialogs.ErrorDialog
|
import info.nightscout.androidaps.dialogs.ErrorDialog
|
||||||
|
import info.nightscout.androidaps.services.AlarmSoundService
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
|
@ -25,28 +27,12 @@ class ErrorHelperActivity : DialogAppCompatActivity() {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
val errorDialog = ErrorDialog()
|
val errorDialog = ErrorDialog()
|
||||||
errorDialog.helperActivity = this
|
errorDialog.helperActivity = this
|
||||||
errorDialog.status = intent.getStringExtra(STATUS) ?: ""
|
errorDialog.status = intent.getStringExtra(AlarmSoundService.STATUS) ?: ""
|
||||||
errorDialog.sound = intent.getIntExtra(SOUND_ID, R.raw.error)
|
errorDialog.sound = intent.getIntExtra(AlarmSoundService.SOUND_ID, R.raw.error)
|
||||||
errorDialog.title = intent.getStringExtra(TITLE)?: ""
|
errorDialog.title = intent.getStringExtra(AlarmSoundService.TITLE) ?: ""
|
||||||
errorDialog.show(supportFragmentManager, "Error")
|
errorDialog.show(supportFragmentManager, "Error")
|
||||||
|
|
||||||
if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true))
|
if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true))
|
||||||
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(intent.getStringExtra(STATUS) ?: "")).subscribe()
|
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(intent.getStringExtra(AlarmSoundService.STATUS) ?: "")).subscribe()
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
const val SOUND_ID = "soundId"
|
|
||||||
const val STATUS = "status"
|
|
||||||
const val TITLE = "title"
|
|
||||||
|
|
||||||
fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0) {
|
|
||||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
|
||||||
i.putExtra(SOUND_ID, soundId)
|
|
||||||
i.putExtra(STATUS, status)
|
|
||||||
i.putExtra(TITLE, title)
|
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
ctx.startActivity(i)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.androidaps.activities
|
package info.nightscout.ui.activities
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
@ -15,8 +14,8 @@ import android.widget.EditText
|
||||||
import android.widget.TableLayout
|
import android.widget.TableLayout
|
||||||
import android.widget.TableRow
|
import android.widget.TableRow
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.core.R
|
import info.nightscout.androidaps.core.R
|
||||||
import info.nightscout.androidaps.core.databinding.ActivityTddStatsBinding
|
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.TotalDailyDose
|
import info.nightscout.androidaps.database.entities.TotalDailyDose
|
||||||
import info.nightscout.androidaps.events.EventDanaRSyncStatus
|
import info.nightscout.androidaps.events.EventDanaRSyncStatus
|
||||||
|
@ -25,7 +24,6 @@ import info.nightscout.androidaps.extensions.total
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
@ -33,11 +31,13 @@ import info.nightscout.androidaps.utils.T
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.shared.SafeParse
|
import info.nightscout.shared.SafeParse
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
import info.nightscout.ui.databinding.ActivityTddStatsBinding
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import java.text.DateFormat
|
import java.text.DateFormat
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
@ -55,7 +55,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
||||||
private lateinit var binding: ActivityTddStatsBinding
|
private lateinit var binding: ActivityTddStatsBinding
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
lateinit var tbb: String
|
private lateinit var tbb: String
|
||||||
private var magicNumber = 0.0
|
private var magicNumber = 0.0
|
||||||
private var decimalFormat: DecimalFormat = DecimalFormat("0.000")
|
private var decimalFormat: DecimalFormat = DecimalFormat("0.000")
|
||||||
private var historyList: MutableList<TotalDailyDose> = mutableListOf()
|
private var historyList: MutableList<TotalDailyDose> = mutableListOf()
|
|
@ -2,6 +2,9 @@ package info.nightscout.ui.di
|
||||||
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
|
import info.nightscout.ui.activities.BolusProgressHelperActivity
|
||||||
|
import info.nightscout.ui.activities.ErrorHelperActivity
|
||||||
|
import info.nightscout.ui.activities.TDDStatsActivity
|
||||||
import info.nightscout.ui.dialogs.CalibrationDialog
|
import info.nightscout.ui.dialogs.CalibrationDialog
|
||||||
import info.nightscout.ui.dialogs.CarbsDialog
|
import info.nightscout.ui.dialogs.CarbsDialog
|
||||||
|
|
||||||
|
@ -11,4 +14,9 @@ abstract class UiModule {
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesCalibrationDialog(): CalibrationDialog
|
@ContributesAndroidInjector abstract fun contributesCalibrationDialog(): CalibrationDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog
|
@ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog
|
||||||
|
|
||||||
|
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
|
||||||
|
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
|
||||||
|
@ContributesAndroidInjector abstract fun contributeErrorHelperActivity(): ErrorHelperActivity
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,7 +8,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.google.common.base.Joiner
|
import com.google.common.base.Joiner
|
||||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
|
@ -18,23 +17,35 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
|
import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
|
||||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.extensions.formatColor
|
import info.nightscout.androidaps.extensions.formatColor
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.androidaps.interfaces.BolusTimer
|
||||||
|
import info.nightscout.androidaps.interfaces.CarbTimer
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
|
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.*
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.T
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.ui.R
|
import info.nightscout.ui.R
|
||||||
import info.nightscout.ui.databinding.DialogCarbsBinding
|
import info.nightscout.ui.databinding.DialogCarbsBinding
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.LinkedList
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
@ -54,6 +65,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
@Inject lateinit var commandQueue: CommandQueue
|
@Inject lateinit var commandQueue: CommandQueue
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||||
|
@Inject lateinit var activityNames: ActivityNames
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@ -367,7 +379,7 @@ class CarbsDialog : DialogFragmentWithDate() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
carbTimer.removeAutomationEventEatReminder()
|
carbTimer.removeAutomationEventEatReminder()
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ErrorHelperActivity.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
activityNames.runAlarm(ctx, result.comment, rh.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||||
} else if (sp.getBoolean(R.string.key_usebolusreminder, false) && remindBolus)
|
} else if (sp.getBoolean(R.string.key_usebolusreminder, false) && remindBolus)
|
||||||
bolusTimer.scheduleAutomationEventBolusReminder()
|
bolusTimer.scheduleAutomationEventBolusReminder()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
tools:context="info.nightscout.androidaps.activities.TDDStatsActivity">
|
tools:context="info.nightscout.ui.activities.TDDStatsActivity">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
Loading…
Reference in a new issue