Automation module cleanup
This commit is contained in:
parent
6cc8ac96cb
commit
2325df48d2
|
@ -6,7 +6,15 @@ import android.content.SharedPreferences
|
||||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.annotation.XmlRes
|
import androidx.annotation.XmlRes
|
||||||
import androidx.preference.*
|
import androidx.preference.EditTextPreference
|
||||||
|
import androidx.preference.ListPreference
|
||||||
|
import androidx.preference.Preference
|
||||||
|
import androidx.preference.PreferenceCategory
|
||||||
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import androidx.preference.PreferenceGroup
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
import androidx.preference.PreferenceScreen
|
||||||
|
import androidx.preference.size
|
||||||
import dagger.android.support.AndroidSupportInjection
|
import dagger.android.support.AndroidSupportInjection
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||||
|
@ -20,23 +28,22 @@ import info.nightscout.androidaps.interfaces.Config
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
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.ResourceHelper
|
||||||
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploader
|
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploader
|
||||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
||||||
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.general.autotune.AutotunePlugin
|
import info.nightscout.androidaps.plugins.general.autotune.AutotunePlugin
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
|
||||||
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
|
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
|
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
|
||||||
import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||||
|
@ -45,12 +52,23 @@ import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
|
||||||
import info.nightscout.androidaps.plugins.source.*
|
import info.nightscout.androidaps.plugins.source.AidexPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.DexcomPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.EversensePlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.GlimpPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.GlunovoPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.IntelligoPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.PoctechPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.TomatoPlugin
|
||||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
|
import info.nightscout.androidaps.utils.alertDialogs.OKDialog.show
|
||||||
import info.nightscout.androidaps.utils.protection.PasswordCheck
|
import info.nightscout.androidaps.utils.protection.PasswordCheck
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionType.*
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionType.BIOMETRIC
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionType.CUSTOM_PASSWORD
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionType.CUSTOM_PIN
|
||||||
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck.ProtectionType.NONE
|
||||||
|
import info.nightscout.automation.AutomationPlugin
|
||||||
|
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||||
|
import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin
|
||||||
import info.nightscout.shared.SafeParse
|
import info.nightscout.shared.SafeParse
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -5,7 +5,6 @@ import dagger.Component
|
||||||
import dagger.android.AndroidInjectionModule
|
import dagger.android.AndroidInjectionModule
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import info.nightscout.androidaps.MainApp
|
import info.nightscout.androidaps.MainApp
|
||||||
import info.nightscout.androidaps.automation.di.AutomationModule
|
|
||||||
import info.nightscout.androidaps.combo.di.ComboModule
|
import info.nightscout.androidaps.combo.di.ComboModule
|
||||||
import info.nightscout.androidaps.dana.di.DanaHistoryModule
|
import info.nightscout.androidaps.dana.di.DanaHistoryModule
|
||||||
import info.nightscout.androidaps.dana.di.DanaModule
|
import info.nightscout.androidaps.dana.di.DanaModule
|
||||||
|
@ -23,6 +22,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.dagger.EopatchModule
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
|
import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.di.OmnipodDashModule
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.di.OmnipodDashModule
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule
|
||||||
|
import info.nightscout.automation.di.AutomationModule
|
||||||
import info.nightscout.implementation.di.CommandQueueModule
|
import info.nightscout.implementation.di.CommandQueueModule
|
||||||
import info.nightscout.plugins.di.InsulinModule
|
import info.nightscout.plugins.di.InsulinModule
|
||||||
import info.nightscout.plugins.di.SMSCommunicatorModule
|
import info.nightscout.plugins.di.SMSCommunicatorModule
|
||||||
|
|
|
@ -28,13 +28,6 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesFragment
|
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesFragment
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog
|
import info.nightscout.androidaps.plugins.constraints.objectives.activities.ObjectivesExamDialog
|
||||||
import info.nightscout.androidaps.plugins.general.actions.ActionsFragment
|
import info.nightscout.androidaps.plugins.general.actions.ActionsFragment
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationFragment
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.ChooseActionDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.ChooseOperationDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.ChooseTriggerDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditActionDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditTriggerDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.autotune.AutotuneFragment
|
import info.nightscout.androidaps.plugins.general.autotune.AutotuneFragment
|
||||||
import info.nightscout.androidaps.plugins.general.food.FoodFragment
|
import info.nightscout.androidaps.plugins.general.food.FoodFragment
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment
|
import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment
|
||||||
|
@ -55,7 +48,6 @@ abstract class FragmentsModule {
|
||||||
@ContributesAndroidInjector abstract fun contributesPreferencesFragment(): MyPreferenceFragment
|
@ContributesAndroidInjector abstract fun contributesPreferencesFragment(): MyPreferenceFragment
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesActionsFragment(): ActionsFragment
|
@ContributesAndroidInjector abstract fun contributesActionsFragment(): ActionsFragment
|
||||||
@ContributesAndroidInjector abstract fun contributesAutomationFragment(): AutomationFragment
|
|
||||||
@ContributesAndroidInjector abstract fun contributesAutotuneFragment(): AutotuneFragment
|
@ContributesAndroidInjector abstract fun contributesAutotuneFragment(): AutotuneFragment
|
||||||
@ContributesAndroidInjector abstract fun contributesBGSourceFragment(): BGSourceFragment
|
@ContributesAndroidInjector abstract fun contributesBGSourceFragment(): BGSourceFragment
|
||||||
|
|
||||||
|
@ -83,17 +75,11 @@ abstract class FragmentsModule {
|
||||||
@ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment
|
@ContributesAndroidInjector abstract fun contributesVirtualPumpFragment(): VirtualPumpFragment
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
|
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesEditActionDialog(): EditActionDialog
|
|
||||||
@ContributesAndroidInjector abstract fun contributesEditEventDialog(): EditEventDialog
|
|
||||||
@ContributesAndroidInjector abstract fun contributesEditTriggerDialog(): EditTriggerDialog
|
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog
|
@ContributesAndroidInjector abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun contributesExtendedBolusDialog(): ExtendedBolusDialog
|
@ContributesAndroidInjector abstract fun contributesExtendedBolusDialog(): ExtendedBolusDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesFillDialog(): FillDialog
|
@ContributesAndroidInjector abstract fun contributesFillDialog(): FillDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesChooseActionDialog(): ChooseActionDialog
|
|
||||||
@ContributesAndroidInjector abstract fun contributesChooseTriggerDialog(): ChooseTriggerDialog
|
|
||||||
@ContributesAndroidInjector abstract fun contributesChooseOperationDialog(): ChooseOperationDialog
|
|
||||||
@ContributesAndroidInjector abstract fun contributesInsulinDialog(): InsulinDialog
|
@ContributesAndroidInjector abstract fun contributesInsulinDialog(): InsulinDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog
|
@ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog
|
||||||
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): ObjectivesExamDialog
|
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): ObjectivesExamDialog
|
||||||
|
|
|
@ -24,7 +24,6 @@ import info.nightscout.androidaps.plugins.constraints.signatureVerifier.Signatur
|
||||||
import info.nightscout.androidaps.plugins.constraints.storage.StorageConstraintPlugin
|
import info.nightscout.androidaps.plugins.constraints.storage.StorageConstraintPlugin
|
||||||
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerPlugin
|
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin
|
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.general.autotune.AutotunePlugin
|
import info.nightscout.androidaps.plugins.general.autotune.AutotunePlugin
|
||||||
import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin
|
import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.food.FoodPlugin
|
import info.nightscout.androidaps.plugins.general.food.FoodPlugin
|
||||||
|
@ -32,15 +31,10 @@ import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
|
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
|
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
|
||||||
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.general.themes.ThemeSwitcherPlugin
|
import info.nightscout.androidaps.plugins.general.themes.ThemeSwitcherPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
|
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
|
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
|
||||||
import info.nightscout.plugins.insulin.InsulinLyumjevPlugin
|
|
||||||
import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin
|
|
||||||
import info.nightscout.plugins.insulin.InsulinOrefRapidActingPlugin
|
|
||||||
import info.nightscout.plugins.insulin.InsulinOrefUltraRapidActingPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
|
||||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin
|
||||||
|
@ -53,7 +47,23 @@ import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
||||||
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
|
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin
|
||||||
import info.nightscout.androidaps.plugins.source.*
|
import info.nightscout.androidaps.plugins.source.AidexPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.DexcomPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.GlimpPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.GlunovoPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.IntelligoPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.MM640gPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.NSClientSourcePlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.PoctechPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.RandomBgPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.TomatoPlugin
|
||||||
|
import info.nightscout.androidaps.plugins.source.XdripPlugin
|
||||||
|
import info.nightscout.automation.AutomationPlugin
|
||||||
|
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||||
|
import info.nightscout.plugins.insulin.InsulinLyumjevPlugin
|
||||||
|
import info.nightscout.plugins.insulin.InsulinOrefFreePeakPlugin
|
||||||
|
import info.nightscout.plugins.insulin.InsulinOrefRapidActingPlugin
|
||||||
|
import info.nightscout.plugins.insulin.InsulinOrefUltraRapidActingPlugin
|
||||||
import javax.inject.Qualifier
|
import javax.inject.Qualifier
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
|
|
@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Dismiss
|
||||||
import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService
|
import info.nightscout.androidaps.plugins.general.persistentNotification.DummyService
|
||||||
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataLayerListenerServiceMobile
|
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataLayerListenerServiceMobile
|
||||||
import info.nightscout.androidaps.services.AlarmSoundService
|
import info.nightscout.androidaps.services.AlarmSoundService
|
||||||
import info.nightscout.androidaps.services.LocationService
|
import info.nightscout.automation.services.LocationService
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
|
|
@ -16,9 +16,9 @@ import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ActivityNames
|
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.Constraints
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
|
||||||
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.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
@ -28,7 +28,7 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BO
|
||||||
import info.nightscout.shared.SafeParse
|
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.LinkedList
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
@ -55,8 +55,10 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
savedInstanceState.putDouble("duration", binding.duration.value)
|
savedInstanceState.putDouble("duration", binding.duration.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
onCreateViewGeneral()
|
onCreateViewGeneral()
|
||||||
_binding = DialogExtendedbolusBinding.inflate(inflater, container, false)
|
_binding = DialogExtendedbolusBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
|
@ -69,13 +71,17 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
val maxInsulin = constraintChecker.getMaxExtendedBolusAllowed().value()
|
val maxInsulin = constraintChecker.getMaxExtendedBolusAllowed().value()
|
||||||
val extendedStep = pumpDescription.extendedBolusStep
|
val extendedStep = pumpDescription.extendedBolusStep
|
||||||
binding.insulin.setParams(savedInstanceState?.getDouble("insulin")
|
binding.insulin.setParams(
|
||||||
?: extendedStep, extendedStep, maxInsulin, extendedStep, DecimalFormat("0.00"), false, binding.okcancel.ok)
|
savedInstanceState?.getDouble("insulin")
|
||||||
|
?: extendedStep, extendedStep, maxInsulin, extendedStep, DecimalFormat("0.00"), false, binding.okcancel.ok
|
||||||
|
)
|
||||||
|
|
||||||
val extendedDurationStep = pumpDescription.extendedBolusDurationStep
|
val extendedDurationStep = pumpDescription.extendedBolusDurationStep
|
||||||
val extendedMaxDuration = pumpDescription.extendedBolusMaxDuration
|
val extendedMaxDuration = pumpDescription.extendedBolusMaxDuration
|
||||||
binding.duration.setParams(savedInstanceState?.getDouble("duration")
|
binding.duration.setParams(
|
||||||
?: extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, DecimalFormat("0"), false, binding.okcancel.ok)
|
savedInstanceState?.getDouble("duration")
|
||||||
|
?: extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, DecimalFormat("0"), false, binding.okcancel.ok
|
||||||
|
)
|
||||||
binding.insulinLabel.labelFor = binding.insulin.editTextId
|
binding.insulinLabel.labelFor = binding.insulin.editTextId
|
||||||
binding.durationLabel.labelFor = binding.duration.editTextId
|
binding.durationLabel.labelFor = binding.duration.editTextId
|
||||||
}
|
}
|
||||||
|
@ -98,9 +104,11 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, rh.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
OKDialog.showConfirmation(activity, rh.gs(R.string.extended_bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||||
uel.log(Action.EXTENDED_BOLUS, Sources.ExtendedBolusDialog,
|
uel.log(
|
||||||
|
Action.EXTENDED_BOLUS, Sources.ExtendedBolusDialog,
|
||||||
ValueWithUnit.Insulin(insulinAfterConstraint),
|
ValueWithUnit.Insulin(insulinAfterConstraint),
|
||||||
ValueWithUnit.Minute(durationInMinutes))
|
ValueWithUnit.Minute(durationInMinutes)
|
||||||
|
)
|
||||||
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
@ -120,7 +128,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ActivityNames
|
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.Constraints
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
|
||||||
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
|
||||||
|
@ -34,7 +34,7 @@ import info.nightscout.shared.SafeParse
|
||||||
import info.nightscout.shared.logging.LTag
|
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.LinkedList
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
@ -62,8 +62,10 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
savedInstanceState.putDouble("fill_insulin_amount", binding.fillInsulinamount.value)
|
savedInstanceState.putDouble("fill_insulin_amount", binding.fillInsulinamount.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
onCreateViewGeneral()
|
onCreateViewGeneral()
|
||||||
_binding = DialogFillBinding.inflate(inflater, container, false)
|
_binding = DialogFillBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
|
@ -74,8 +76,10 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
val maxInsulin = constraintChecker.getMaxBolusAllowed().value()
|
val maxInsulin = constraintChecker.getMaxBolusAllowed().value()
|
||||||
val bolusStep = activePlugin.activePump.pumpDescription.bolusStep
|
val bolusStep = activePlugin.activePump.pumpDescription.bolusStep
|
||||||
binding.fillInsulinamount.setParams(savedInstanceState?.getDouble("fill_insulin_amount")
|
binding.fillInsulinamount.setParams(
|
||||||
?: 0.0, 0.0, maxInsulin, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), true, binding.okcancel.ok)
|
savedInstanceState?.getDouble("fill_insulin_amount")
|
||||||
|
?: 0.0, 0.0, maxInsulin, bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), true, binding.okcancel.ok
|
||||||
|
)
|
||||||
val amount1 = sp.getDouble("fill_button1", 0.3)
|
val amount1 = sp.getDouble("fill_button1", 0.3)
|
||||||
if (amount1 > 0) {
|
if (amount1 > 0) {
|
||||||
binding.fillPresetButton1.visibility = View.VISIBLE
|
binding.fillPresetButton1.visibility = View.VISIBLE
|
||||||
|
@ -141,36 +145,44 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
if (insulinAfterConstraints > 0) {
|
if (insulinAfterConstraints > 0) {
|
||||||
uel.log(Action.PRIME_BOLUS, Sources.FillDialog,
|
uel.log(Action.PRIME_BOLUS, Sources.FillDialog,
|
||||||
notes,
|
notes,
|
||||||
ValueWithUnit.Insulin(insulinAfterConstraints).takeIf { insulinAfterConstraints != 0.0 })
|
ValueWithUnit.Insulin(insulinAfterConstraints))
|
||||||
requestPrimeBolus(insulinAfterConstraints, notes)
|
requestPrimeBolus(insulinAfterConstraints, notes)
|
||||||
}
|
}
|
||||||
if (siteChange) {
|
if (siteChange) {
|
||||||
uel.log(Action.SITE_CHANGE, Sources.FillDialog,
|
uel.log(
|
||||||
|
Action.SITE_CHANGE, Sources.FillDialog,
|
||||||
notes,
|
notes,
|
||||||
ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
|
ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
|
||||||
ValueWithUnit.TherapyEventType(TherapyEvent.Type.CANNULA_CHANGE))
|
ValueWithUnit.TherapyEventType(TherapyEvent.Type.CANNULA_CHANGE)
|
||||||
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
|
)
|
||||||
|
disposable += repository.runTransactionForResult(
|
||||||
|
InsertIfNewByTimestampTherapyEventTransaction(
|
||||||
timestamp = eventTime,
|
timestamp = eventTime,
|
||||||
type = TherapyEvent.Type.CANNULA_CHANGE,
|
type = TherapyEvent.Type.CANNULA_CHANGE,
|
||||||
note = notes,
|
note = notes,
|
||||||
glucoseUnit = TherapyEvent.GlucoseUnit.MGDL
|
glucoseUnit = TherapyEvent.GlucoseUnit.MGDL
|
||||||
)).subscribe(
|
)
|
||||||
|
).subscribe(
|
||||||
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") } },
|
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") } },
|
||||||
{ aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) }
|
{ aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (insulinChange) {
|
if (insulinChange) {
|
||||||
// add a second for case of both checked
|
// add a second for case of both checked
|
||||||
uel.log(Action.RESERVOIR_CHANGE, Sources.FillDialog,
|
uel.log(
|
||||||
|
Action.RESERVOIR_CHANGE, Sources.FillDialog,
|
||||||
notes,
|
notes,
|
||||||
ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
|
ValueWithUnit.Timestamp(eventTime).takeIf { eventTimeChanged },
|
||||||
ValueWithUnit.TherapyEventType(TherapyEvent.Type.INSULIN_CHANGE))
|
ValueWithUnit.TherapyEventType(TherapyEvent.Type.INSULIN_CHANGE)
|
||||||
disposable += repository.runTransactionForResult(InsertIfNewByTimestampTherapyEventTransaction(
|
)
|
||||||
|
disposable += repository.runTransactionForResult(
|
||||||
|
InsertIfNewByTimestampTherapyEventTransaction(
|
||||||
timestamp = eventTime + 1000,
|
timestamp = eventTime + 1000,
|
||||||
type = TherapyEvent.Type.INSULIN_CHANGE,
|
type = TherapyEvent.Type.INSULIN_CHANGE,
|
||||||
note = notes,
|
note = notes,
|
||||||
glucoseUnit = TherapyEvent.GlucoseUnit.MGDL
|
glucoseUnit = TherapyEvent.GlucoseUnit.MGDL
|
||||||
)).subscribe(
|
)
|
||||||
|
).subscribe(
|
||||||
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") } },
|
{ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted therapy event $it") } },
|
||||||
{ aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) }
|
{ aapsLogger.error(LTag.DATABASE, "Error while saving therapy event", it) }
|
||||||
)
|
)
|
||||||
|
@ -208,7 +220,7 @@ class FillDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,24 @@ import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTe
|
||||||
import info.nightscout.androidaps.databinding.DialogInsulinBinding
|
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.ActivePlugin
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
|
import info.nightscout.androidaps.interfaces.BolusTimer
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
import info.nightscout.androidaps.interfaces.Constraints
|
||||||
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
|
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.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.extensions.toSignedString
|
import info.nightscout.androidaps.utils.extensions.toSignedString
|
||||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||||
|
@ -33,7 +46,7 @@ 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
|
||||||
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.abs
|
import kotlin.math.abs
|
||||||
|
@ -96,8 +109,10 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
savedInstanceState.putDouble("amount", binding.amount.value)
|
savedInstanceState.putDouble("amount", binding.amount.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
onCreateViewGeneral()
|
onCreateViewGeneral()
|
||||||
_binding = DialogInsulinBinding.inflate(inflater, container, false)
|
_binding = DialogInsulinBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
|
@ -112,17 +127,23 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
}
|
}
|
||||||
val maxInsulin = constraintChecker.getMaxBolusAllowed().value()
|
val maxInsulin = constraintChecker.getMaxBolusAllowed().value()
|
||||||
|
|
||||||
binding.time.setParams(savedInstanceState?.getDouble("time")
|
binding.time.setParams(
|
||||||
?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher)
|
savedInstanceState?.getDouble("time")
|
||||||
binding.amount.setParams(savedInstanceState?.getDouble("amount")
|
?: 0.0, -12 * 60.0, 12 * 60.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, textWatcher
|
||||||
?: 0.0, 0.0, maxInsulin, activePlugin.activePump.pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.okcancel.ok, textWatcher)
|
)
|
||||||
|
binding.amount.setParams(
|
||||||
|
savedInstanceState?.getDouble("amount")
|
||||||
|
?: 0.0, 0.0, maxInsulin, activePlugin.activePump.pumpDescription.bolusStep, DecimalFormatter.pumpSupportedBolusFormat(activePlugin.activePump), false, binding.okcancel.ok, textWatcher
|
||||||
|
)
|
||||||
|
|
||||||
val plus05Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT).toSignedString(activePlugin.activePump)
|
val plus05Text = sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT).toSignedString(activePlugin.activePump)
|
||||||
binding.plus05.text = plus05Text
|
binding.plus05.text = plus05Text
|
||||||
binding.plus05.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus05Text
|
binding.plus05.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus05Text
|
||||||
binding.plus05.setOnClickListener {
|
binding.plus05.setOnClickListener {
|
||||||
binding.amount.value = max(0.0, binding.amount.value
|
binding.amount.value = max(
|
||||||
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT))
|
0.0, binding.amount.value
|
||||||
|
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT)
|
||||||
|
)
|
||||||
validateInputs()
|
validateInputs()
|
||||||
binding.amount.announceValue()
|
binding.amount.announceValue()
|
||||||
}
|
}
|
||||||
|
@ -130,8 +151,10 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
binding.plus10.text = plus10Text
|
binding.plus10.text = plus10Text
|
||||||
binding.plus10.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus10Text
|
binding.plus10.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus10Text
|
||||||
binding.plus10.setOnClickListener {
|
binding.plus10.setOnClickListener {
|
||||||
binding.amount.value = max(0.0, binding.amount.value
|
binding.amount.value = max(
|
||||||
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT))
|
0.0, binding.amount.value
|
||||||
|
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT)
|
||||||
|
)
|
||||||
validateInputs()
|
validateInputs()
|
||||||
binding.amount.announceValue()
|
binding.amount.announceValue()
|
||||||
}
|
}
|
||||||
|
@ -139,8 +162,10 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
binding.plus20.text = plus20Text
|
binding.plus20.text = plus20Text
|
||||||
binding.plus20.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus20Text
|
binding.plus20.contentDescription = rh.gs(R.string.overview_insulin_label) + " " + plus20Text
|
||||||
binding.plus20.setOnClickListener {
|
binding.plus20.setOnClickListener {
|
||||||
binding.amount.value = max(0.0, binding.amount.value
|
binding.amount.value = max(
|
||||||
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT))
|
0.0, binding.amount.value
|
||||||
|
+ sp.getDouble(rh.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT)
|
||||||
|
)
|
||||||
validateInputs()
|
validateInputs()
|
||||||
binding.amount.announceValue()
|
binding.amount.announceValue()
|
||||||
}
|
}
|
||||||
|
@ -180,8 +205,10 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
val eatingSoonTTDuration = defaultValueHelper.determineEatingSoonTTDuration()
|
val eatingSoonTTDuration = defaultValueHelper.determineEatingSoonTTDuration()
|
||||||
val eatingSoonTT = defaultValueHelper.determineEatingSoonTT()
|
val eatingSoonTT = defaultValueHelper.determineEatingSoonTT()
|
||||||
if (eatingSoonChecked)
|
if (eatingSoonChecked)
|
||||||
actions.add(rh.gs(R.string.temp_target_short) + ": " + (DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, eatingSoonTTDuration) + ")")
|
actions.add(
|
||||||
.formatColor(context, rh, R.attr.tempTargetConfirmation))
|
rh.gs(R.string.temp_target_short) + ": " + (DecimalFormatter.to1Decimal(eatingSoonTT) + " " + unitLabel + " (" + rh.gs(R.string.format_mins, eatingSoonTTDuration) + ")")
|
||||||
|
.formatColor(context, rh, R.attr.tempTargetConfirmation)
|
||||||
|
)
|
||||||
|
|
||||||
val timeOffset = binding.time.value.toInt()
|
val timeOffset = binding.time.value.toInt()
|
||||||
val time = dateUtil.now() + T.mins(timeOffset.toLong()).msecs()
|
val time = dateUtil.now() + T.mins(timeOffset.toLong()).msecs()
|
||||||
|
@ -196,18 +223,22 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
OKDialog.showConfirmation(activity, rh.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
OKDialog.showConfirmation(activity, rh.gs(R.string.bolus), HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions)), {
|
||||||
if (eatingSoonChecked) {
|
if (eatingSoonChecked) {
|
||||||
uel.log(Action.TT, Sources.InsulinDialog,
|
uel.log(
|
||||||
|
Action.TT, Sources.InsulinDialog,
|
||||||
notes,
|
notes,
|
||||||
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
|
ValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.EATING_SOON),
|
||||||
ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units.asText),
|
ValueWithUnit.fromGlucoseUnit(eatingSoonTT, units.asText),
|
||||||
ValueWithUnit.Minute(eatingSoonTTDuration))
|
ValueWithUnit.Minute(eatingSoonTTDuration)
|
||||||
disposable += repository.runTransactionForResult(InsertAndCancelCurrentTemporaryTargetTransaction(
|
)
|
||||||
|
disposable += repository.runTransactionForResult(
|
||||||
|
InsertAndCancelCurrentTemporaryTargetTransaction(
|
||||||
timestamp = System.currentTimeMillis(),
|
timestamp = System.currentTimeMillis(),
|
||||||
duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
|
duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
|
||||||
reason = TemporaryTarget.Reason.EATING_SOON,
|
reason = TemporaryTarget.Reason.EATING_SOON,
|
||||||
lowTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits()),
|
lowTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits()),
|
||||||
highTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits())
|
highTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits())
|
||||||
)).subscribe({ result ->
|
)
|
||||||
|
).subscribe({ result ->
|
||||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
|
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
|
||||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
|
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
|
||||||
}, {
|
}, {
|
||||||
|
@ -223,7 +254,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
detailedBolusInfo.timestamp = time
|
detailedBolusInfo.timestamp = time
|
||||||
if (recordOnlyChecked) {
|
if (recordOnlyChecked) {
|
||||||
uel.log(Action.BOLUS, Sources.InsulinDialog,
|
uel.log(Action.BOLUS, Sources.InsulinDialog,
|
||||||
rh.gs(R.string.record) + if (notes.isNotEmpty()) ": " + notes else "",
|
rh.gs(R.string.record) + if (notes.isNotEmpty()) ": $notes" else "",
|
||||||
ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.record)),
|
ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.record)),
|
||||||
ValueWithUnit.Insulin(insulinAfterConstraints),
|
ValueWithUnit.Insulin(insulinAfterConstraints),
|
||||||
ValueWithUnit.Minute(timeOffset).takeIf { timeOffset != 0 })
|
ValueWithUnit.Minute(timeOffset).takeIf { timeOffset != 0 })
|
||||||
|
@ -235,9 +266,11 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
if (timeOffset == 0)
|
if (timeOffset == 0)
|
||||||
bolusTimer.removeAutomationEventBolusReminder()
|
bolusTimer.removeAutomationEventBolusReminder()
|
||||||
} else {
|
} else {
|
||||||
uel.log(Action.BOLUS, Sources.InsulinDialog,
|
uel.log(
|
||||||
|
Action.BOLUS, Sources.InsulinDialog,
|
||||||
notes,
|
notes,
|
||||||
ValueWithUnit.Insulin(insulinAfterConstraints))
|
ValueWithUnit.Insulin(insulinAfterConstraints)
|
||||||
|
)
|
||||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
@ -265,7 +298,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
import info.nightscout.androidaps.interfaces.ConfigBuilder
|
import info.nightscout.androidaps.interfaces.ConfigBuilder
|
||||||
import info.nightscout.androidaps.interfaces.Constraint
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraints
|
||||||
import info.nightscout.androidaps.interfaces.Loop
|
import info.nightscout.androidaps.interfaces.Loop
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
import info.nightscout.androidaps.interfaces.PluginType
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
@ -37,7 +38,6 @@ import info.nightscout.androidaps.interfaces.PumpDescription
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
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.interfaces.Constraints
|
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
@ -457,7 +457,7 @@ class LoopDialog : DaggerDialogFragment() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.Config
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
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.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.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
|
@ -35,14 +35,13 @@ 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 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.collections.ArrayList
|
|
||||||
|
|
||||||
class ProfileSwitchDialog : DialogFragmentWithDate() {
|
class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
|
|
||||||
|
@ -257,7 +256,7 @@ class ProfileSwitchDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,16 @@ import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
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.extensions.formatColor
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.interfaces.ActivityNames
|
||||||
|
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
import info.nightscout.androidaps.interfaces.Constraints
|
||||||
|
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.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
@ -24,7 +31,7 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BO
|
||||||
import info.nightscout.shared.SafeParse
|
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.LinkedList
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
@ -151,7 +158,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,32 +10,32 @@ import com.google.common.base.Joiner
|
||||||
import com.google.common.collect.Lists
|
import com.google.common.collect.Lists
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
|
||||||
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.ValueWithUnit
|
|
||||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||||
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.CancelCurrentTemporaryTargetIfAnyTransaction
|
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
||||||
import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
|
import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
|
||||||
import info.nightscout.androidaps.databinding.DialogTemptargetBinding
|
import info.nightscout.androidaps.databinding.DialogTemptargetBinding
|
||||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
import info.nightscout.androidaps.interfaces.Constraints
|
||||||
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
|
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.utils.DefaultValueHelper
|
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
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.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 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
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class TempTargetDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ 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
|
||||||
|
import info.nightscout.androidaps.interfaces.Constraints
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
|
||||||
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
|
||||||
|
@ -36,7 +36,7 @@ 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
|
||||||
import java.util.*
|
import java.util.LinkedList
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,23 @@ import info.nightscout.androidaps.extensions.formatColor
|
||||||
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.extensions.valueToUnits
|
import info.nightscout.androidaps.extensions.valueToUnits
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.interfaces.Constraint
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
import info.nightscout.androidaps.interfaces.Constraints
|
||||||
import info.nightscout.androidaps.utils.*
|
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.plugins.bus.RxBus
|
||||||
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.androidaps.utils.DecimalFormatter
|
||||||
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
import info.nightscout.androidaps.utils.Round
|
||||||
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
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.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
import info.nightscout.androidaps.utils.wizard.BolusWizard
|
import info.nightscout.androidaps.utils.wizard.BolusWizard
|
||||||
import info.nightscout.shared.SafeParse
|
import info.nightscout.shared.SafeParse
|
||||||
|
@ -105,7 +115,7 @@ class WizardDialog : DaggerDialogFragment() {
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
aapsLogger.debug(LTag.APS, "Dialog opened: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog opened: ${this.javaClass.simpleName}")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(savedInstanceState: Bundle) {
|
override fun onSaveInstanceState(savedInstanceState: Bundle) {
|
||||||
|
@ -189,7 +199,7 @@ class WizardDialog : DaggerDialogFragment() {
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
wizard?.confirmAndExecute(context)
|
wizard?.confirmAndExecute(context)
|
||||||
}
|
}
|
||||||
aapsLogger.debug(LTag.APS, "Dialog ok pressed: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog ok pressed: ${this.javaClass.simpleName}")
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
@ -200,7 +210,7 @@ class WizardDialog : DaggerDialogFragment() {
|
||||||
binding.iobCheckboxIcon.setOnClickListener { binding.iobCheckbox.isChecked = !binding.iobCheckbox.isChecked; processIobCheckBox(); }
|
binding.iobCheckboxIcon.setOnClickListener { binding.iobCheckbox.isChecked = !binding.iobCheckbox.isChecked; processIobCheckBox(); }
|
||||||
// cancel button
|
// cancel button
|
||||||
binding.okcancel.cancel.setOnClickListener {
|
binding.okcancel.cancel.setOnClickListener {
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled: ${this.javaClass.simpleName}")
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
// checkboxes
|
// checkboxes
|
||||||
|
@ -512,7 +522,7 @@ class WizardDialog : DaggerDialogFragment() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
val cancelFail = {
|
val cancelFail = {
|
||||||
queryingProtection = false
|
queryingProtection = false
|
||||||
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.name}")
|
aapsLogger.debug(LTag.APS, "Dialog canceled on resume protection: ${this.javaClass.simpleName}")
|
||||||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,13 @@ import info.nightscout.androidaps.database.entities.ProfileSwitch
|
||||||
import info.nightscout.androidaps.database.transactions.InsertOrUpdateProfileSwitch
|
import info.nightscout.androidaps.database.transactions.InsertOrUpdateProfileSwitch
|
||||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
||||||
import info.nightscout.androidaps.extensions.fromConstant
|
import info.nightscout.androidaps.extensions.fromConstant
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileStore
|
||||||
|
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.nsclient.data.DeviceStatusData
|
import info.nightscout.androidaps.plugins.general.nsclient.data.DeviceStatusData
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
@ -42,7 +48,7 @@ class ProfileFunctionImpl @Inject constructor(
|
||||||
private val deviceStatusData: DeviceStatusData
|
private val deviceStatusData: DeviceStatusData
|
||||||
) : ProfileFunction {
|
) : ProfileFunction {
|
||||||
|
|
||||||
var cache = ConcurrentHashMap<Long, Profile?>()
|
private var cache = ConcurrentHashMap<Long, Profile?>()
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
|
@ -177,7 +183,7 @@ class ProfileFunctionImpl @Inject constructor(
|
||||||
val profileStore = activePlugin.activeProfileSource.profile ?: return false
|
val profileStore = activePlugin.activeProfileSource.profile ?: return false
|
||||||
val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) ?: return false
|
val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) ?: return false
|
||||||
val validity = ProfileSealed.PS(ps).isValid(
|
val validity = ProfileSealed.PS(ps).isValid(
|
||||||
rh.gs(info.nightscout.androidaps.automation.R.string.careportal_profileswitch),
|
rh.gs(info.nightscout.automation.R.string.careportal_profileswitch),
|
||||||
activePlugin.activePump,
|
activePlugin.activePump,
|
||||||
config,
|
config,
|
||||||
rh,
|
rh,
|
||||||
|
|
|
@ -76,7 +76,6 @@ import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotifi
|
||||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
|
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
import info.nightscout.androidaps.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
|
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
|
||||||
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
|
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
|
||||||
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewCalcProgress
|
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewCalcProgress
|
||||||
|
@ -103,6 +102,7 @@ import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
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.androidaps.utils.wizard.QuickWizard
|
import info.nightscout.androidaps.utils.wizard.QuickWizard
|
||||||
|
import info.nightscout.automation.AutomationPlugin
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import info.nightscout.shared.weardata.EventData
|
import info.nightscout.shared.weardata.EventData
|
||||||
|
|
|
@ -9,7 +9,7 @@ apply from: "${project.rootDir}/core/android_module_dependencies.gradle"
|
||||||
apply from: "${project.rootDir}/core/test_dependencies.gradle"
|
apply from: "${project.rootDir}/core/test_dependencies.gradle"
|
||||||
apply from: "${project.rootDir}/core/jacoco_global.gradle"
|
apply from: "${project.rootDir}/core/jacoco_global.gradle"
|
||||||
android {
|
android {
|
||||||
namespace 'info.nightscout.androidaps.automation'
|
namespace 'info.nightscout.automation'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<application>
|
<application>
|
||||||
<service
|
<service
|
||||||
android:name="info.nightscout.androidaps.services.LocationService"
|
android:name=".services.LocationService"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
|
||||||
|
|
||||||
class EventAutomationAddAction(val action: Action) : Event()
|
|
|
@ -1,6 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
|
||||||
|
|
||||||
class EventAutomationUpdateAction(val action: Action, val position: Int) : Event()
|
|
|
@ -1,6 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
|
||||||
|
|
||||||
class EventAutomationUpdateTrigger(val trigger: TriggerConnector) : Event()
|
|
|
@ -1,6 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
|
||||||
|
|
||||||
class EventTriggerClone(val trigger: Trigger) : Event()
|
|
|
@ -1,6 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
|
||||||
|
|
||||||
class EventTriggerRemove(val trigger: Trigger) : Event()
|
|
|
@ -1,17 +1,16 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation
|
package info.nightscout.automation
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.ActionStopProcessing
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy
|
|
||||||
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.automation.actions.Action
|
||||||
|
import info.nightscout.automation.actions.ActionDummy
|
||||||
|
import info.nightscout.automation.actions.ActionStopProcessing
|
||||||
|
import info.nightscout.automation.triggers.TriggerConnector
|
||||||
|
import info.nightscout.automation.triggers.TriggerDummy
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.*
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AutomationEvent(private val injector: HasAndroidInjector) {
|
class AutomationEvent(private val injector: HasAndroidInjector) {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation
|
package info.nightscout.automation
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -23,19 +23,12 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationEventItemBinding
|
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationFragmentBinding
|
|
||||||
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.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
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.automation.dialogs.EditEventDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
|
||||||
import info.nightscout.androidaps.utils.ActionModeHelper
|
import info.nightscout.androidaps.utils.ActionModeHelper
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.HtmlHelper
|
import info.nightscout.androidaps.utils.HtmlHelper
|
||||||
|
@ -44,6 +37,12 @@ import info.nightscout.androidaps.utils.dragHelpers.ItemTouchHelperAdapter
|
||||||
import info.nightscout.androidaps.utils.dragHelpers.OnStartDragListener
|
import info.nightscout.androidaps.utils.dragHelpers.OnStartDragListener
|
||||||
import info.nightscout.androidaps.utils.dragHelpers.SimpleItemTouchHelperCallback
|
import info.nightscout.androidaps.utils.dragHelpers.SimpleItemTouchHelperCallback
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
import info.nightscout.automation.databinding.AutomationEventItemBinding
|
||||||
|
import info.nightscout.automation.databinding.AutomationFragmentBinding
|
||||||
|
import info.nightscout.automation.dialogs.EditEventDialog
|
||||||
|
import info.nightscout.automation.events.EventAutomationDataChanged
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateGui
|
||||||
|
import info.nightscout.automation.triggers.TriggerConnector
|
||||||
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 javax.inject.Inject
|
import javax.inject.Inject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation
|
package info.nightscout.automation
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
@ -6,25 +6,57 @@ import android.os.HandlerThread
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.events.EventBTChange
|
import info.nightscout.androidaps.events.EventBTChange
|
||||||
import info.nightscout.androidaps.events.EventChargingState
|
import info.nightscout.androidaps.events.EventChargingState
|
||||||
import info.nightscout.androidaps.events.EventLocationChange
|
|
||||||
import info.nightscout.androidaps.events.EventNetworkChange
|
import info.nightscout.androidaps.events.EventNetworkChange
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.interfaces.Config
|
||||||
import info.nightscout.androidaps.interfaces.Constraints
|
import info.nightscout.androidaps.interfaces.Constraints
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.*
|
import info.nightscout.androidaps.interfaces.Loop
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
|
import info.nightscout.androidaps.interfaces.PluginDescription
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.*
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.services.LocationServiceHelper
|
|
||||||
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.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
import info.nightscout.automation.actions.Action
|
||||||
|
import info.nightscout.automation.actions.ActionAlarm
|
||||||
|
import info.nightscout.automation.actions.ActionCarePortalEvent
|
||||||
|
import info.nightscout.automation.actions.ActionNotification
|
||||||
|
import info.nightscout.automation.actions.ActionProfileSwitch
|
||||||
|
import info.nightscout.automation.actions.ActionProfileSwitchPercent
|
||||||
|
import info.nightscout.automation.actions.ActionRunAutotune
|
||||||
|
import info.nightscout.automation.actions.ActionSendSMS
|
||||||
|
import info.nightscout.automation.actions.ActionStartTempTarget
|
||||||
|
import info.nightscout.automation.actions.ActionStopProcessing
|
||||||
|
import info.nightscout.automation.actions.ActionStopTempTarget
|
||||||
|
import info.nightscout.automation.events.EventAutomationDataChanged
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateGui
|
||||||
|
import info.nightscout.automation.events.EventLocationChange
|
||||||
|
import info.nightscout.automation.services.LocationServiceHelper
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
|
import info.nightscout.automation.triggers.TriggerAutosensValue
|
||||||
|
import info.nightscout.automation.triggers.TriggerBTDevice
|
||||||
|
import info.nightscout.automation.triggers.TriggerBg
|
||||||
|
import info.nightscout.automation.triggers.TriggerBolusAgo
|
||||||
|
import info.nightscout.automation.triggers.TriggerCOB
|
||||||
|
import info.nightscout.automation.triggers.TriggerConnector
|
||||||
|
import info.nightscout.automation.triggers.TriggerDelta
|
||||||
|
import info.nightscout.automation.triggers.TriggerIob
|
||||||
|
import info.nightscout.automation.triggers.TriggerLocation
|
||||||
|
import info.nightscout.automation.triggers.TriggerProfilePercent
|
||||||
|
import info.nightscout.automation.triggers.TriggerPumpLastConnection
|
||||||
|
import info.nightscout.automation.triggers.TriggerRecurringTime
|
||||||
|
import info.nightscout.automation.triggers.TriggerTempTarget
|
||||||
|
import info.nightscout.automation.triggers.TriggerTempTargetValue
|
||||||
|
import info.nightscout.automation.triggers.TriggerTime
|
||||||
|
import info.nightscout.automation.triggers.TriggerTimeRange
|
||||||
|
import info.nightscout.automation.triggers.TriggerWifiSsid
|
||||||
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.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
@ -33,7 +65,7 @@ import io.reactivex.rxjava3.kotlin.plusAssign
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.*
|
import java.util.Collections
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@ -82,7 +114,7 @@ class AutomationPlugin @Inject constructor(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val event =
|
const val event =
|
||||||
"{\"title\":\"Low\",\"enabled\":true,\"trigger\":\"{\\\"type\\\":\\\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector\\\",\\\"data\\\":{\\\"connectorType\\\":\\\"AND\\\",\\\"triggerList\\\":[\\\"{\\\\\\\"type\\\\\\\":\\\\\\\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerBg\\\\\\\",\\\\\\\"data\\\\\\\":{\\\\\\\"bg\\\\\\\":4,\\\\\\\"comparator\\\\\\\":\\\\\\\"IS_LESSER\\\\\\\",\\\\\\\"units\\\\\\\":\\\\\\\"mmol\\\\\\\"}}\\\",\\\"{\\\\\\\"type\\\\\\\":\\\\\\\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDelta\\\\\\\",\\\\\\\"data\\\\\\\":{\\\\\\\"value\\\\\\\":-0.1,\\\\\\\"units\\\\\\\":\\\\\\\"mmol\\\\\\\",\\\\\\\"deltaType\\\\\\\":\\\\\\\"DELTA\\\\\\\",\\\\\\\"comparator\\\\\\\":\\\\\\\"IS_LESSER\\\\\\\"}}\\\"]}}\",\"actions\":[\"{\\\"type\\\":\\\"info.nightscout.androidaps.plugins.general.automation.actions.ActionStartTempTarget\\\",\\\"data\\\":{\\\"value\\\":8,\\\"units\\\":\\\"mmol\\\",\\\"durationInMinutes\\\":60}}\"]}"
|
"{\"title\":\"Low\",\"enabled\":true,\"trigger\":\"{\\\"type\\\":\\\"TriggerConnector\\\",\\\"data\\\":{\\\"connectorType\\\":\\\"AND\\\",\\\"triggerList\\\":[\\\"{\\\\\\\"type\\\\\\\":\\\\\\\"TriggerBg\\\\\\\",\\\\\\\"data\\\\\\\":{\\\\\\\"bg\\\\\\\":4,\\\\\\\"comparator\\\\\\\":\\\\\\\"IS_LESSER\\\\\\\",\\\\\\\"units\\\\\\\":\\\\\\\"mmol\\\\\\\"}}\\\",\\\"{\\\\\\\"type\\\\\\\":\\\\\\\"TriggerDelta\\\\\\\",\\\\\\\"data\\\\\\\":{\\\\\\\"value\\\\\\\":-0.1,\\\\\\\"units\\\\\\\":\\\\\\\"mmol\\\\\\\",\\\\\\\"deltaType\\\\\\\":\\\\\\\"DELTA\\\\\\\",\\\\\\\"comparator\\\\\\\":\\\\\\\"IS_LESSER\\\\\\\"}}\\\"]}}\",\"actions\":[\"{\\\"type\\\":\\\"ActionStartTempTarget\\\",\\\"data\\\":{\\\"value\\\":8,\\\"units\\\":\\\"mmol\\\",\\\"durationInMinutes\\\":60}}\"]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.androidaps.queue.Callback
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -43,48 +43,33 @@ abstract class Action(val injector: HasAndroidInjector) {
|
||||||
val obj = JSONObject(a.toJSON())
|
val obj = JSONObject(a.toJSON())
|
||||||
val type = obj.getString("type")
|
val type = obj.getString("type")
|
||||||
val data = obj.getJSONObject("data")
|
val data = obj.getJSONObject("data")
|
||||||
if (type == javaClass.name) fromJSON(data.toString())
|
if (type == javaClass.simpleName) fromJSON(data.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun instantiate(obj: JSONObject): Action? {
|
fun instantiate(obj: JSONObject): Action? {
|
||||||
try {
|
try {
|
||||||
val type = obj.getString("type")
|
var type = obj.getString("type")
|
||||||
val data = if (obj.has("data")) obj.getJSONObject("data") else JSONObject()
|
val data = if (obj.has("data")) obj.getJSONObject("data") else JSONObject()
|
||||||
|
// stripe off package name
|
||||||
|
val dotIndex = type.lastIndexOf('.')
|
||||||
|
if (dotIndex > 0) type = type.substring(dotIndex + 1)
|
||||||
return when (type) {
|
return when (type) {
|
||||||
ActionAlarm::class.java.name, // backward compatibility
|
|
||||||
ActionAlarm::class.java.simpleName -> ActionAlarm(injector).fromJSON(data.toString())
|
ActionAlarm::class.java.simpleName -> ActionAlarm(injector).fromJSON(data.toString())
|
||||||
ActionCarePortalEvent::class.java.name,
|
|
||||||
ActionCarePortalEvent::class.java.simpleName -> ActionCarePortalEvent(injector).fromJSON(data.toString())
|
ActionCarePortalEvent::class.java.simpleName -> ActionCarePortalEvent(injector).fromJSON(data.toString())
|
||||||
ActionDummy::class.java.name,
|
|
||||||
ActionDummy::class.java.simpleName -> ActionDummy(injector).fromJSON(data.toString())
|
ActionDummy::class.java.simpleName -> ActionDummy(injector).fromJSON(data.toString())
|
||||||
ActionLoopDisable::class.java.name,
|
|
||||||
ActionLoopDisable::class.java.simpleName -> ActionLoopDisable(injector).fromJSON(data.toString())
|
ActionLoopDisable::class.java.simpleName -> ActionLoopDisable(injector).fromJSON(data.toString())
|
||||||
ActionLoopEnable::class.java.name,
|
|
||||||
ActionLoopEnable::class.java.simpleName -> ActionLoopEnable(injector).fromJSON(data.toString())
|
ActionLoopEnable::class.java.simpleName -> ActionLoopEnable(injector).fromJSON(data.toString())
|
||||||
ActionLoopResume::class.java.name,
|
|
||||||
ActionLoopResume::class.java.simpleName -> ActionLoopResume(injector).fromJSON(data.toString())
|
ActionLoopResume::class.java.simpleName -> ActionLoopResume(injector).fromJSON(data.toString())
|
||||||
ActionLoopSuspend::class.java.name,
|
|
||||||
ActionLoopSuspend::class.java.simpleName -> ActionLoopSuspend(injector).fromJSON(data.toString())
|
ActionLoopSuspend::class.java.simpleName -> ActionLoopSuspend(injector).fromJSON(data.toString())
|
||||||
ActionNotification::class.java.name,
|
|
||||||
ActionNotification::class.java.simpleName -> ActionNotification(injector).fromJSON(data.toString())
|
ActionNotification::class.java.simpleName -> ActionNotification(injector).fromJSON(data.toString())
|
||||||
ActionProfileSwitch::class.java.name,
|
|
||||||
ActionProfileSwitch::class.java.simpleName -> ActionProfileSwitch(injector).fromJSON(data.toString())
|
ActionProfileSwitch::class.java.simpleName -> ActionProfileSwitch(injector).fromJSON(data.toString())
|
||||||
ActionProfileSwitchPercent::class.java.name,
|
|
||||||
ActionProfileSwitchPercent::class.java.simpleName -> ActionProfileSwitchPercent(injector).fromJSON(data.toString())
|
ActionProfileSwitchPercent::class.java.simpleName -> ActionProfileSwitchPercent(injector).fromJSON(data.toString())
|
||||||
ActionRunAutotune::class.java.name,
|
|
||||||
ActionRunAutotune::class.java.simpleName -> ActionRunAutotune(injector).fromJSON(data.toString())
|
ActionRunAutotune::class.java.simpleName -> ActionRunAutotune(injector).fromJSON(data.toString())
|
||||||
ActionSendSMS::class.java.name,
|
|
||||||
ActionSendSMS::class.java.simpleName -> ActionSendSMS(injector).fromJSON(data.toString())
|
ActionSendSMS::class.java.simpleName -> ActionSendSMS(injector).fromJSON(data.toString())
|
||||||
ActionStartTempTarget::class.java.name,
|
|
||||||
ActionStartTempTarget::class.java.simpleName -> ActionStartTempTarget(injector).fromJSON(data.toString())
|
ActionStartTempTarget::class.java.simpleName -> ActionStartTempTarget(injector).fromJSON(data.toString())
|
||||||
ActionStopTempTarget::class.java.name,
|
|
||||||
ActionStopTempTarget::class.java.simpleName -> ActionStopTempTarget(injector).fromJSON(data.toString())
|
ActionStopTempTarget::class.java.simpleName -> ActionStopTempTarget(injector).fromJSON(data.toString())
|
||||||
else -> throw ClassNotFoundException(type)
|
else -> throw ClassNotFoundException(type)
|
||||||
}
|
}
|
||||||
//val clazz = Class.forName(type).kotlin
|
|
||||||
//return (clazz.primaryConstructor?.call(injector) as Action).fromJSON(data?.toString()
|
|
||||||
// ?: "")
|
|
||||||
//return (clazz.newInstance() as Action).fromJSON(data?.toString() ?: "")
|
|
||||||
} catch (e: ClassNotFoundException) {
|
} catch (e: ClassNotFoundException) {
|
||||||
aapsLogger.error("Unhandled exception", e)
|
aapsLogger.error("Unhandled exception", e)
|
||||||
} catch (e: InstantiationException) {
|
} catch (e: InstantiationException) {
|
|
@ -1,19 +1,19 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputString
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.TimerUtil
|
import info.nightscout.androidaps.utils.TimerUtil
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputString
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class ActionAlarm(injector: HasAndroidInjector) : Action(injector) {
|
||||||
override fun toJSON(): String {
|
override fun toJSON(): String {
|
||||||
val data = JSONObject().put("text", text.value)
|
val data = JSONObject().put("text", text.value)
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
|
@ -11,18 +10,19 @@ 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.extensions.fromConstant
|
import info.nightscout.androidaps.extensions.fromConstant
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputCarePortalMenu
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDuration
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputString
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
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.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputCarePortalMenu
|
||||||
|
import info.nightscout.automation.elements.InputDuration
|
||||||
|
import info.nightscout.automation.elements.InputString
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
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
|
||||||
|
@ -93,7 +93,7 @@ class ActionCarePortalEvent(injector: HasAndroidInjector) : Action(injector) {
|
||||||
.put("note", note.value)
|
.put("note", note.value)
|
||||||
.put("durationInMinutes", duration.value)
|
.put("durationInMinutes", duration.value)
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
|
@ -1,8 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
@ -15,6 +14,7 @@ import info.nightscout.androidaps.interfaces.PluginType
|
||||||
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.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
|
import info.nightscout.automation.R
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ActionLoopDisable(injector: HasAndroidInjector) : Action(injector) {
|
class ActionLoopDisable(injector: HasAndroidInjector) : Action(injector) {
|
|
@ -1,8 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
@ -14,6 +13,7 @@ import info.nightscout.androidaps.interfaces.PluginType
|
||||||
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.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
|
import info.nightscout.automation.R
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ActionLoopEnable(injector: HasAndroidInjector) : Action(injector) {
|
class ActionLoopEnable(injector: HasAndroidInjector) : Action(injector) {
|
|
@ -1,8 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
|
@ -11,11 +10,12 @@ import info.nightscout.androidaps.database.transactions.CancelCurrentOfflineEven
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.interfaces.ConfigBuilder
|
import info.nightscout.androidaps.interfaces.ConfigBuilder
|
||||||
import info.nightscout.androidaps.interfaces.Loop
|
import info.nightscout.androidaps.interfaces.Loop
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
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.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
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 javax.inject.Inject
|
import javax.inject.Inject
|
|
@ -1,9 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
@ -12,11 +11,12 @@ import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.interfaces.Loop
|
import info.nightscout.androidaps.interfaces.Loop
|
||||||
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.automation.elements.InputDuration
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputDuration
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class ActionLoopSuspend(injector: HasAndroidInjector) : Action(injector) {
|
||||||
override fun toJSON(): String {
|
override fun toJSON(): String {
|
||||||
val data = JSONObject().put("minutes", minutes.getMinutes())
|
val data = JSONObject().put("minutes", minutes.getMinutes())
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,21 +1,21 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
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.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputString
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
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.notifications.NotificationUserMessage
|
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationUserMessage
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputString
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
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 org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -45,7 +45,7 @@ class ActionNotification(injector: HasAndroidInjector) : Action(injector) {
|
||||||
override fun toJSON(): String {
|
override fun toJSON(): String {
|
||||||
val data = JSONObject().put("text", text.value)
|
val data = JSONObject().put("text", text.value)
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||||
|
@ -11,12 +10,13 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputProfileName
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputProfileName
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -78,7 +78,7 @@ class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) {
|
||||||
override fun toJSON(): String {
|
override fun toJSON(): String {
|
||||||
val data = JSONObject().put("profileToSwitchTo", inputProfileName.value)
|
val data = JSONObject().put("profileToSwitchTo", inputProfileName.value)
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,23 +1,23 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
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.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDuration
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputPercent
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerProfilePercent
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputDuration
|
||||||
|
import info.nightscout.automation.elements.InputPercent
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.triggers.TriggerProfilePercent
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -71,7 +71,7 @@ class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector
|
||||||
.put("percentage", pct.value)
|
.put("percentage", pct.value)
|
||||||
.put("durationInMinutes", duration.value)
|
.put("durationInMinutes", duration.value)
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,21 +1,20 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
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.Autotune
|
import info.nightscout.androidaps.interfaces.Autotune
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDuration
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputProfileName
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputDuration
|
||||||
|
import info.nightscout.automation.elements.InputProfileName
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -76,7 +75,7 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
|
||||||
.put("profileToTune", inputProfileName.value)
|
.put("profileToTune", inputProfileName.value)
|
||||||
.put("tunedays", daysBack.value)
|
.put("tunedays", daysBack.value)
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.interfaces.SmsCommunicator
|
import info.nightscout.androidaps.interfaces.SmsCommunicator
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputString
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputString
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class ActionSendSMS(injector: HasAndroidInjector) : Action(injector) {
|
||||||
override fun toJSON(): String {
|
override fun toJSON(): String {
|
||||||
val data = JSONObject().put("text", text.value)
|
val data = JSONObject().put("text", text.value)
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,10 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
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,16 +17,17 @@ import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
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.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.ComparatorExists
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDuration
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputTempTarget
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerTempTarget
|
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.ComparatorExists
|
||||||
|
import info.nightscout.automation.elements.InputDuration
|
||||||
|
import info.nightscout.automation.elements.InputTempTarget
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.triggers.TriggerTempTarget
|
||||||
import info.nightscout.shared.logging.LTag
|
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
|
||||||
|
@ -93,7 +93,7 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
|
||||||
.put("units", value.units.asText)
|
.put("units", value.units.asText)
|
||||||
.put("durationInMinutes", duration.getMinutes())
|
.put("durationInMinutes", duration.getMinutes())
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", data)
|
.put("data", data)
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
|
import info.nightscout.automation.R
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class ActionStopProcessing(injector: HasAndroidInjector) : Action(injector) {
|
class ActionStopProcessing(injector: HasAndroidInjector) : Action(injector) {
|
||||||
|
@ -22,7 +22,7 @@ class ActionStopProcessing(injector: HasAndroidInjector) : Action(injector) {
|
||||||
|
|
||||||
override fun toJSON(): String {
|
override fun toJSON(): String {
|
||||||
return JSONObject()
|
return JSONObject()
|
||||||
.put("type", this.javaClass.name)
|
.put("type", this.javaClass.simpleName)
|
||||||
.put("data", JsonObject())
|
.put("data", JsonObject())
|
||||||
.toString()
|
.toString()
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.actions
|
package info.nightscout.automation.actions
|
||||||
|
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.UserEntry
|
import info.nightscout.androidaps.database.entities.UserEntry
|
||||||
|
@ -10,6 +9,7 @@ import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTa
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.automation.R
|
||||||
import info.nightscout.shared.logging.LTag
|
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
|
|
@ -1,15 +1,62 @@
|
||||||
package info.nightscout.androidaps.automation.di
|
package info.nightscout.automation.di
|
||||||
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
|
import info.nightscout.automation.AutomationEvent
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.*
|
import info.nightscout.automation.AutomationFragment
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.*
|
import info.nightscout.automation.actions.Action
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.*
|
import info.nightscout.automation.actions.ActionAlarm
|
||||||
|
import info.nightscout.automation.actions.ActionCarePortalEvent
|
||||||
|
import info.nightscout.automation.actions.ActionDummy
|
||||||
|
import info.nightscout.automation.actions.ActionLoopDisable
|
||||||
|
import info.nightscout.automation.actions.ActionLoopEnable
|
||||||
|
import info.nightscout.automation.actions.ActionLoopResume
|
||||||
|
import info.nightscout.automation.actions.ActionLoopSuspend
|
||||||
|
import info.nightscout.automation.actions.ActionNotification
|
||||||
|
import info.nightscout.automation.actions.ActionProfileSwitch
|
||||||
|
import info.nightscout.automation.actions.ActionProfileSwitchPercent
|
||||||
|
import info.nightscout.automation.actions.ActionRunAutotune
|
||||||
|
import info.nightscout.automation.actions.ActionSendSMS
|
||||||
|
import info.nightscout.automation.actions.ActionStartTempTarget
|
||||||
|
import info.nightscout.automation.actions.ActionStopProcessing
|
||||||
|
import info.nightscout.automation.actions.ActionStopTempTarget
|
||||||
|
import info.nightscout.automation.dialogs.ChooseActionDialog
|
||||||
|
import info.nightscout.automation.dialogs.ChooseOperationDialog
|
||||||
|
import info.nightscout.automation.dialogs.ChooseTriggerDialog
|
||||||
|
import info.nightscout.automation.dialogs.EditActionDialog
|
||||||
|
import info.nightscout.automation.dialogs.EditEventDialog
|
||||||
|
import info.nightscout.automation.dialogs.EditTriggerDialog
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
|
import info.nightscout.automation.triggers.TriggerAutosensValue
|
||||||
|
import info.nightscout.automation.triggers.TriggerBTDevice
|
||||||
|
import info.nightscout.automation.triggers.TriggerBg
|
||||||
|
import info.nightscout.automation.triggers.TriggerBolusAgo
|
||||||
|
import info.nightscout.automation.triggers.TriggerCOB
|
||||||
|
import info.nightscout.automation.triggers.TriggerConnector
|
||||||
|
import info.nightscout.automation.triggers.TriggerDelta
|
||||||
|
import info.nightscout.automation.triggers.TriggerDummy
|
||||||
|
import info.nightscout.automation.triggers.TriggerIob
|
||||||
|
import info.nightscout.automation.triggers.TriggerLocation
|
||||||
|
import info.nightscout.automation.triggers.TriggerProfilePercent
|
||||||
|
import info.nightscout.automation.triggers.TriggerPumpLastConnection
|
||||||
|
import info.nightscout.automation.triggers.TriggerRecurringTime
|
||||||
|
import info.nightscout.automation.triggers.TriggerTempTarget
|
||||||
|
import info.nightscout.automation.triggers.TriggerTempTargetValue
|
||||||
|
import info.nightscout.automation.triggers.TriggerTime
|
||||||
|
import info.nightscout.automation.triggers.TriggerTimeRange
|
||||||
|
import info.nightscout.automation.triggers.TriggerWifiSsid
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
abstract class AutomationModule {
|
abstract class AutomationModule {
|
||||||
|
|
||||||
|
@ContributesAndroidInjector abstract fun contributesAutomationFragment(): AutomationFragment
|
||||||
|
@ContributesAndroidInjector abstract fun contributesChooseActionDialog(): ChooseActionDialog
|
||||||
|
@ContributesAndroidInjector abstract fun contributesChooseTriggerDialog(): ChooseTriggerDialog
|
||||||
|
@ContributesAndroidInjector abstract fun contributesChooseOperationDialog(): ChooseOperationDialog
|
||||||
|
@ContributesAndroidInjector abstract fun contributesEditActionDialog(): EditActionDialog
|
||||||
|
@ContributesAndroidInjector abstract fun contributesEditEventDialog(): EditEventDialog
|
||||||
|
@ContributesAndroidInjector abstract fun contributesEditTriggerDialog(): EditTriggerDialog
|
||||||
@ContributesAndroidInjector abstract fun automationEventInjector(): AutomationEvent
|
@ContributesAndroidInjector abstract fun automationEventInjector(): AutomationEvent
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun triggerInjector(): Trigger
|
@ContributesAndroidInjector abstract fun triggerInjector(): Trigger
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.dialogs
|
package info.nightscout.automation.dialogs
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -6,13 +6,13 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationDialogChooseActionBinding
|
|
||||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
import info.nightscout.automation.AutomationPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
import info.nightscout.automation.actions.Action
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationAddAction
|
import info.nightscout.automation.databinding.AutomationDialogChooseActionBinding
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
|
import info.nightscout.automation.events.EventAutomationAddAction
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateGui
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.reflect.full.primaryConstructor
|
import kotlin.reflect.full.primaryConstructor
|
||||||
|
|
||||||
|
@ -30,8 +30,10 @@ class ChooseActionDialog : DialogFragmentWithDate() {
|
||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
// restore checked radio button
|
// restore checked radio button
|
||||||
savedInstanceState?.let { bundle ->
|
savedInstanceState?.let { bundle ->
|
||||||
checkedIndex = bundle.getInt("checkedIndex")
|
checkedIndex = bundle.getInt("checkedIndex")
|
|
@ -1,14 +1,14 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.dialogs
|
package info.nightscout.automation.dialogs
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationDialogChooseOperationBinding
|
|
||||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.databinding.AutomationDialogChooseOperationBinding
|
||||||
|
import info.nightscout.automation.triggers.TriggerConnector
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ChooseOperationDialog : DialogFragmentWithDate() {
|
class ChooseOperationDialog : DialogFragmentWithDate() {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.dialogs
|
package info.nightscout.automation.dialogs
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -6,10 +6,10 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationDialogChooseTriggerBinding
|
|
||||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
import info.nightscout.automation.AutomationPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
import info.nightscout.automation.databinding.AutomationDialogChooseTriggerBinding
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.reflect.full.primaryConstructor
|
import kotlin.reflect.full.primaryConstructor
|
||||||
|
|
||||||
|
@ -32,8 +32,10 @@ class ChooseTriggerDialog : DialogFragmentWithDate() {
|
||||||
fun onClick(newTriggerObject: Trigger)
|
fun onClick(newTriggerObject: Trigger)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
// restore checked radio button
|
// restore checked radio button
|
||||||
savedInstanceState?.let { bundle ->
|
savedInstanceState?.let { bundle ->
|
||||||
checkedIndex = bundle.getInt("checkedIndex")
|
checkedIndex = bundle.getInt("checkedIndex")
|
|
@ -1,16 +1,16 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.dialogs
|
package info.nightscout.automation.dialogs
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationDialogActionBinding
|
|
||||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
import info.nightscout.automation.actions.Action
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy
|
import info.nightscout.automation.actions.ActionDummy
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateAction
|
import info.nightscout.automation.databinding.AutomationDialogActionBinding
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateAction
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -28,8 +28,10 @@ class EditActionDialog : DialogFragmentWithDate() {
|
||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
// load data from bundle
|
// load data from bundle
|
||||||
(savedInstanceState ?: arguments)?.let { bundle ->
|
(savedInstanceState ?: arguments)?.let { bundle ->
|
||||||
actionPosition = bundle.getInt("actionPosition", -1)
|
actionPosition = bundle.getInt("actionPosition", -1)
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.dialogs
|
package info.nightscout.automation.dialogs
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -10,22 +10,22 @@ import android.widget.TextView
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationDialogEventBinding
|
|
||||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.extensions.toVisibility
|
import info.nightscout.androidaps.extensions.toVisibility
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.actions.Action
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationAddAction
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateAction
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateTrigger
|
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
import info.nightscout.automation.AutomationEvent
|
||||||
|
import info.nightscout.automation.AutomationPlugin
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.actions.Action
|
||||||
|
import info.nightscout.automation.databinding.AutomationDialogEventBinding
|
||||||
|
import info.nightscout.automation.events.EventAutomationAddAction
|
||||||
|
import info.nightscout.automation.events.EventAutomationDataChanged
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateAction
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateGui
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateTrigger
|
||||||
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 javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -50,8 +50,10 @@ class EditEventDialog : DialogFragmentWithDate() {
|
||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(
|
||||||
savedInstanceState: Bundle?): View {
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
event = AutomationEvent(injector)
|
event = AutomationEvent(injector)
|
||||||
// load data from bundle
|
// load data from bundle
|
||||||
(savedInstanceState ?: arguments)?.let { bundle ->
|
(savedInstanceState ?: arguments)?.let { bundle ->
|
|
@ -1,22 +1,22 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.dialogs
|
package info.nightscout.automation.dialogs
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.databinding.AutomationDialogEditTriggerBinding
|
|
||||||
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateTrigger
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventTriggerChanged
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventTriggerClone
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventTriggerRemove
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy
|
|
||||||
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.automation.databinding.AutomationDialogEditTriggerBinding
|
||||||
|
import info.nightscout.automation.events.EventAutomationUpdateTrigger
|
||||||
|
import info.nightscout.automation.events.EventTriggerChanged
|
||||||
|
import info.nightscout.automation.events.EventTriggerClone
|
||||||
|
import info.nightscout.automation.events.EventTriggerRemove
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
|
import info.nightscout.automation.triggers.TriggerConnector
|
||||||
|
import info.nightscout.automation.triggers.TriggerDummy
|
||||||
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 org.json.JSONObject
|
import org.json.JSONObject
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -7,8 +7,8 @@ import android.widget.ArrayAdapter
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class Comparator(private val rh: ResourceHelper) : Element() {
|
class Comparator(private val rh: ResourceHelper) : Element() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -7,8 +7,8 @@ import android.widget.ArrayAdapter
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class ComparatorConnect(private val rh: ResourceHelper) : Element() {
|
class ComparatorConnect(private val rh: ResourceHelper) : Element() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -7,8 +7,8 @@ import android.widget.ArrayAdapter
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class ComparatorExists(private val rh: ResourceHelper, var value: Compare = Compare.EXISTS) : Element() {
|
class ComparatorExists(private val rh: ResourceHelper, var value: Compare = Compare.EXISTS) : Element() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||||
|
import info.nightscout.automation.R
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class InputBg(profileFunction: ProfileFunction) : Element() {
|
class InputBg(profileFunction: ProfileFunction) : Element() {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.Button
|
import android.widget.Button
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -8,9 +8,9 @@ import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class InputCarePortalMenu(private val rh: ResourceHelper) : Element() {
|
class InputCarePortalMenu(private val rh: ResourceHelper) : Element() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
@ -12,10 +12,10 @@ import androidx.fragment.app.FragmentManager
|
||||||
import com.google.android.material.datepicker.MaterialDatePicker
|
import com.google.android.material.datepicker.MaterialDatePicker
|
||||||
import com.google.android.material.timepicker.MaterialTimePicker
|
import com.google.android.material.timepicker.MaterialTimePicker
|
||||||
import com.google.android.material.timepicker.TimeFormat
|
import com.google.android.material.timepicker.TimeFormat
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import java.util.*
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import java.util.Calendar
|
||||||
|
|
||||||
class InputDateTime(private val rh: ResourceHelper, private val dateUtil: DateUtil, var value: Long = dateUtil.now()) : Element() {
|
class InputDateTime(private val rh: ResourceHelper, private val dateUtil: DateUtil, var value: Long = dateUtil.now()) : Element() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -7,9 +7,9 @@ import android.widget.ArrayAdapter
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||||
|
import info.nightscout.automation.R
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class InputDelta(private val rh: ResourceHelper) : Element() {
|
class InputDelta(private val rh: ResourceHelper) : Element() {
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||||
|
import info.nightscout.automation.R
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class InputDouble() : Element() {
|
class InputDouble() : Element() {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -6,9 +6,8 @@ import android.widget.AdapterView
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import java.util.*
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class InputDropdownMenu(private val rh: ResourceHelper) : Element() {
|
class InputDropdownMenu(private val rh: ResourceHelper) : Element() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.utils.ui.MinutesNumberPicker
|
import info.nightscout.androidaps.utils.ui.MinutesNumberPicker
|
||||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||||
|
import info.nightscout.automation.R
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class InputDuration(
|
class InputDuration(
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||||
|
import info.nightscout.automation.R
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class InputInsulin() : Element() {
|
class InputInsulin() : Element() {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -7,8 +7,8 @@ import android.widget.ArrayAdapter
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class InputLocationMode(private val rh: ResourceHelper) : Element() {
|
class InputLocationMode(private val rh: ResourceHelper) : Element() {
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class InputLocationMode(private val rh: ResourceHelper) : Element() {
|
||||||
|
|
||||||
var value: Mode = Mode.INSIDE
|
var value: Mode = Mode.INSIDE
|
||||||
|
|
||||||
constructor(rh: ResourceHelper, value: InputLocationMode.Mode) : this(rh) {
|
constructor(rh: ResourceHelper, value: Mode) : this(rh) {
|
||||||
this.value = value
|
this.value = value
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||||
|
import info.nightscout.automation.R
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class InputPercent() : Element() {
|
class InputPercent() : Element() {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -6,11 +6,11 @@ import android.widget.AdapterView
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.Spinner
|
import android.widget.Spinner
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class InputProfileName(private val rh: ResourceHelper, private val activePlugin: ActivePlugin, val name: String = "", val addActive: Boolean = false) : Element() {
|
class InputProfileName(private val rh: ResourceHelper, private val activePlugin: ActivePlugin, val name: String = "", private val addActive: Boolean = false) : Element() {
|
||||||
|
|
||||||
var value: String = name
|
var value: String = name
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.androidaps.utils.ui.NumberPicker
|
import info.nightscout.androidaps.utils.ui.NumberPicker
|
||||||
|
import info.nightscout.automation.R
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class InputTempTarget(profileFunction: ProfileFunction) : Element() {
|
class InputTempTarget(profileFunction: ProfileFunction) : Element() {
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
@ -11,12 +11,12 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import com.google.android.material.timepicker.MaterialTimePicker
|
import com.google.android.material.timepicker.MaterialTimePicker
|
||||||
import com.google.android.material.timepicker.TimeFormat
|
import com.google.android.material.timepicker.TimeFormat
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.MidnightTime
|
import info.nightscout.androidaps.utils.MidnightTime
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.automation.R
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
|
||||||
class InputTime(private val rh: ResourceHelper, private val dateUtil: DateUtil) : Element() {
|
class InputTime(private val rh: ResourceHelper, private val dateUtil: DateUtil) : Element() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
@ -12,12 +12,12 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import com.google.android.material.timepicker.MaterialTimePicker
|
import com.google.android.material.timepicker.MaterialTimePicker
|
||||||
import com.google.android.material.timepicker.TimeFormat
|
import com.google.android.material.timepicker.TimeFormat
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.MidnightTime
|
import info.nightscout.androidaps.utils.MidnightTime
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.automation.R
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
|
||||||
class InputTimeRange(private val rh: ResourceHelper, private val dateUtil: DateUtil) : Element() {
|
class InputTimeRange(private val rh: ResourceHelper, private val dateUtil: DateUtil) : Element() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.utils.ui.WeekdayPicker
|
import info.nightscout.androidaps.utils.ui.WeekdayPicker
|
||||||
import java.util.*
|
import info.nightscout.automation.R
|
||||||
|
import java.util.Calendar
|
||||||
|
|
||||||
class InputWeekDay : Element() {
|
class InputWeekDay : Element() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
|
@ -1,10 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.Gravity
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import info.nightscout.androidaps.automation.R
|
import info.nightscout.automation.R
|
||||||
|
|
||||||
class LayoutBuilder {
|
class LayoutBuilder {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.elements
|
package info.nightscout.automation.elements
|
||||||
|
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.triggers.Trigger
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
|
|
||||||
class StaticLabel(private val rh: ResourceHelper) : Element() {
|
class StaticLabel(private val rh: ResourceHelper) : Element() {
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
import info.nightscout.automation.actions.Action
|
||||||
|
|
||||||
|
class EventAutomationAddAction(val action: Action) : Event()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
import info.nightscout.androidaps.events.Event
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
import info.nightscout.automation.actions.Action
|
||||||
|
|
||||||
|
class EventAutomationUpdateAction(val action: Action, val position: Int) : Event()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
import info.nightscout.androidaps.events.Event
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
import info.nightscout.automation.triggers.TriggerConnector
|
||||||
|
|
||||||
|
class EventAutomationUpdateTrigger(val trigger: TriggerConnector) : Event()
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
|
||||||
class EventLocationChange(var location: Location) : Event()
|
class EventLocationChange(var location: Location) : Event()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.events
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
import info.nightscout.androidaps.events.Event
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
|
|
||||||
|
class EventTriggerClone(val trigger: Trigger) : Event()
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.automation.events
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.events.Event
|
||||||
|
import info.nightscout.automation.triggers.Trigger
|
||||||
|
|
||||||
|
class EventTriggerRemove(val trigger: Trigger) : Event()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.services
|
package info.nightscout.automation.services
|
||||||
|
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||||
|
@ -8,5 +8,6 @@ import javax.inject.Singleton
|
||||||
@OpenForTesting
|
@OpenForTesting
|
||||||
@Singleton
|
@Singleton
|
||||||
class LastLocationDataContainer @Inject constructor() {
|
class LastLocationDataContainer @Inject constructor() {
|
||||||
|
|
||||||
var lastLocation: Location? = null
|
var lastLocation: Location? = null
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
@file:Suppress("PrivatePropertyName")
|
@file:Suppress("PrivatePropertyName")
|
||||||
|
|
||||||
package info.nightscout.androidaps.services
|
package info.nightscout.automation.services
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.app.Notification
|
import android.app.Notification
|
||||||
|
@ -16,16 +16,16 @@ import android.os.IBinder
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import com.google.android.gms.location.LocationServices
|
import com.google.android.gms.location.LocationServices
|
||||||
import dagger.android.DaggerService
|
import dagger.android.DaggerService
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.events.EventAppExit
|
import info.nightscout.androidaps.events.EventAppExit
|
||||||
import info.nightscout.androidaps.events.EventLocationChange
|
|
||||||
import info.nightscout.androidaps.interfaces.NotificationHolder
|
import info.nightscout.androidaps.interfaces.NotificationHolder
|
||||||
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.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.rx.AapsSchedulers
|
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.events.EventLocationChange
|
||||||
|
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 javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -106,7 +106,11 @@ class LocationService : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get last location once until we get regular update
|
// Get last location once until we get regular update
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(
|
||||||
|
this,
|
||||||
|
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||||
|
) == PackageManager.PERMISSION_GRANTED
|
||||||
|
) {
|
||||||
LocationServices.getFusedLocationProviderClient(this).lastLocation.addOnSuccessListener {
|
LocationServices.getFusedLocationProviderClient(this).lastLocation.addOnSuccessListener {
|
||||||
lastLocationDataContainer.lastLocation = it
|
lastLocationDataContainer.lastLocation = it
|
||||||
}
|
}
|
||||||
|
@ -138,7 +142,8 @@ class LocationService : DaggerService() {
|
||||||
} catch (ex: IllegalArgumentException) {
|
} catch (ex: IllegalArgumentException) {
|
||||||
aapsLogger.error(LTag.LOCATION, "network provider does not exist", ex)
|
aapsLogger.error(LTag.LOCATION, "network provider does not exist", ex)
|
||||||
}
|
}
|
||||||
disposable.add(rxBus
|
disposable.add(
|
||||||
|
rxBus
|
||||||
.toObservable(EventAppExit::class.java)
|
.toObservable(EventAppExit::class.java)
|
||||||
.observeOn(aapsSchedulers.io)
|
.observeOn(aapsSchedulers.io)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
|
@ -151,7 +156,11 @@ class LocationService : DaggerService() {
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
try {
|
try {
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||||
|
this,
|
||||||
|
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||||
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
locationListener?.let { locationManager?.removeUpdates(it) }
|
locationListener?.let { locationManager?.removeUpdates(it) }
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.services
|
package info.nightscout.automation.services
|
||||||
|
|
||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.ContextWrapper
|
import android.content.ContextWrapper
|
||||||
|
@ -9,21 +9,21 @@ import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
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.IobCobCalculator
|
import info.nightscout.androidaps.interfaces.IobCobCalculator
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.ChooseTriggerDialog
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventTriggerChanged
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventTriggerClone
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.events.EventTriggerRemove
|
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
|
||||||
import info.nightscout.androidaps.services.LastLocationDataContainer
|
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
|
||||||
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.dialogs.ChooseTriggerDialog
|
||||||
|
import info.nightscout.automation.events.EventTriggerChanged
|
||||||
|
import info.nightscout.automation.events.EventTriggerClone
|
||||||
|
import info.nightscout.automation.events.EventTriggerRemove
|
||||||
|
import info.nightscout.automation.services.LastLocationDataContainer
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -80,49 +80,32 @@ abstract class Trigger(val injector: HasAndroidInjector) {
|
||||||
|
|
||||||
fun instantiate(obj: JSONObject): Trigger {
|
fun instantiate(obj: JSONObject): Trigger {
|
||||||
try {
|
try {
|
||||||
val type = obj.getString("type")
|
var type = obj.getString("type")
|
||||||
val data = obj.getJSONObject("data")
|
val data = obj.getJSONObject("data")
|
||||||
//val clazz = Class.forName(type).kotlin
|
// stripe off package name
|
||||||
//return (clazz.primaryConstructor?.call(injector) as Trigger).fromJSON(data?.toString() ?: "")
|
val dotIndex = type.lastIndexOf('.')
|
||||||
|
if (dotIndex > 0) type = type.substring(dotIndex + 1)
|
||||||
return when (type) {
|
return when (type) {
|
||||||
TriggerAutosensValue::class.java.name, // backward compatibility
|
|
||||||
TriggerAutosensValue::class.java.simpleName -> TriggerAutosensValue(injector).fromJSON(data.toString())
|
TriggerAutosensValue::class.java.simpleName -> TriggerAutosensValue(injector).fromJSON(data.toString())
|
||||||
TriggerBg::class.java.name,
|
|
||||||
TriggerBg::class.java.simpleName -> TriggerBg(injector).fromJSON(data.toString())
|
TriggerBg::class.java.simpleName -> TriggerBg(injector).fromJSON(data.toString())
|
||||||
TriggerBolusAgo::class.java.name,
|
|
||||||
TriggerBolusAgo::class.java.simpleName -> TriggerBolusAgo(injector).fromJSON(data.toString())
|
TriggerBolusAgo::class.java.simpleName -> TriggerBolusAgo(injector).fromJSON(data.toString())
|
||||||
TriggerBTDevice::class.java.name,
|
|
||||||
TriggerBTDevice::class.java.simpleName -> TriggerBTDevice(injector).fromJSON(data.toString())
|
TriggerBTDevice::class.java.simpleName -> TriggerBTDevice(injector).fromJSON(data.toString())
|
||||||
TriggerIob::class.java.name,
|
|
||||||
TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString())
|
TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString())
|
||||||
TriggerCOB::class.java.name,
|
|
||||||
TriggerCOB::class.java.simpleName -> TriggerCOB(injector).fromJSON(data.toString())
|
TriggerCOB::class.java.simpleName -> TriggerCOB(injector).fromJSON(data.toString())
|
||||||
TriggerConnector::class.java.name,
|
|
||||||
TriggerConnector::class.java.simpleName -> TriggerConnector(injector).fromJSON(data.toString())
|
TriggerConnector::class.java.simpleName -> TriggerConnector(injector).fromJSON(data.toString())
|
||||||
TriggerDelta::class.java.name,
|
|
||||||
TriggerDelta::class.java.simpleName -> TriggerDelta(injector).fromJSON(data.toString())
|
TriggerDelta::class.java.simpleName -> TriggerDelta(injector).fromJSON(data.toString())
|
||||||
TriggerDummy::class.java.name,
|
|
||||||
TriggerDummy::class.java.simpleName -> TriggerDummy(injector).fromJSON(data.toString())
|
TriggerDummy::class.java.simpleName -> TriggerDummy(injector).fromJSON(data.toString())
|
||||||
TriggerIob::class.java.name,
|
|
||||||
TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString())
|
TriggerIob::class.java.simpleName -> TriggerIob(injector).fromJSON(data.toString())
|
||||||
TriggerLocation::class.java.name,
|
|
||||||
TriggerLocation::class.java.simpleName -> TriggerLocation(injector).fromJSON(data.toString())
|
TriggerLocation::class.java.simpleName -> TriggerLocation(injector).fromJSON(data.toString())
|
||||||
TriggerProfilePercent::class.java.name,
|
|
||||||
TriggerProfilePercent::class.java.simpleName -> TriggerProfilePercent(injector).fromJSON(data.toString())
|
TriggerProfilePercent::class.java.simpleName -> TriggerProfilePercent(injector).fromJSON(data.toString())
|
||||||
TriggerPumpLastConnection::class.java.name,
|
|
||||||
TriggerPumpLastConnection::class.java.simpleName -> TriggerPumpLastConnection(injector).fromJSON(data.toString())
|
TriggerPumpLastConnection::class.java.simpleName -> TriggerPumpLastConnection(injector).fromJSON(data.toString())
|
||||||
TriggerRecurringTime::class.java.name,
|
|
||||||
TriggerRecurringTime::class.java.simpleName -> TriggerRecurringTime(injector).fromJSON(data.toString())
|
TriggerRecurringTime::class.java.simpleName -> TriggerRecurringTime(injector).fromJSON(data.toString())
|
||||||
TriggerTempTarget::class.java.name,
|
|
||||||
TriggerTempTarget::class.java.simpleName -> TriggerTempTarget(injector).fromJSON(data.toString())
|
TriggerTempTarget::class.java.simpleName -> TriggerTempTarget(injector).fromJSON(data.toString())
|
||||||
TriggerTempTargetValue::class.java.name,
|
|
||||||
TriggerTempTargetValue::class.java.simpleName -> TriggerTempTargetValue(injector).fromJSON(data.toString())
|
TriggerTempTargetValue::class.java.simpleName -> TriggerTempTargetValue(injector).fromJSON(data.toString())
|
||||||
TriggerTime::class.java.name,
|
|
||||||
TriggerTime::class.java.simpleName -> TriggerTime(injector).fromJSON(data.toString())
|
TriggerTime::class.java.simpleName -> TriggerTime(injector).fromJSON(data.toString())
|
||||||
TriggerTimeRange::class.java.name,
|
|
||||||
TriggerTimeRange::class.java.simpleName -> TriggerTimeRange(injector).fromJSON(data.toString())
|
TriggerTimeRange::class.java.simpleName -> TriggerTimeRange(injector).fromJSON(data.toString())
|
||||||
TriggerWifiSsid::class.java.name,
|
|
||||||
TriggerWifiSsid::class.java.simpleName -> TriggerWifiSsid(injector).fromJSON(data.toString())
|
TriggerWifiSsid::class.java.simpleName -> TriggerWifiSsid(injector).fromJSON(data.toString())
|
||||||
|
|
||||||
else -> TriggerConnector(injector)
|
else -> TriggerConnector(injector)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
|
@ -1,21 +1,22 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDouble
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputDouble
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
class TriggerAutosensValue(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerAutosensValue(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
|
|
||||||
private val minValue = (sp.getDouble(R.string.key_openapsama_autosens_min, 0.7) * 100).toInt()
|
private val minValue = (sp.getDouble(R.string.key_openapsama_autosens_min, 0.7) * 100).toInt()
|
||||||
private val maxValue = (sp.getDouble(R.string.key_openapsama_autosens_max, 1.2) * 100).toInt()
|
private val maxValue = (sp.getDouble(R.string.key_openapsama_autosens_max, 1.2) * 100).toInt()
|
||||||
private val step = 1.0
|
private val step = 1.0
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.bluetooth.BluetoothManager
|
import android.bluetooth.BluetoothManager
|
||||||
|
@ -9,15 +9,15 @@ import android.widget.LinearLayout
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.events.EventBTChange
|
import info.nightscout.androidaps.events.EventBTChange
|
||||||
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.ComparatorConnect
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDropdownMenu
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.ToastUtils
|
import info.nightscout.androidaps.utils.ToastUtils
|
||||||
|
import info.nightscout.automation.AutomationPlugin
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.ComparatorConnect
|
||||||
|
import info.nightscout.automation.elements.InputDropdownMenu
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
|
@ -1,19 +1,19 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputBg
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputBg
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerBg(injector: HasAndroidInjector) : Trigger(injector) {
|
|
@ -1,19 +1,19 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
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.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDuration
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputDuration
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class TriggerBolusAgo(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerBolusAgo(injector: HasAndroidInjector) : Trigger(injector) {
|
|
@ -1,17 +1,17 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDouble
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetDouble
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputDouble
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class TriggerCOB(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cobInfo.displayCob != null && comparator.value.check(cobInfo.displayCob!!, cob.value)) {
|
if (comparator.value.check(cobInfo.displayCob!!, cob.value)) {
|
||||||
aapsLogger.debug(LTag.AUTOMATION, "Ready for execution: " + friendlyDescription())
|
aapsLogger.debug(LTag.AUTOMATION, "Ready for execution: " + friendlyDescription())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
@ -9,15 +9,14 @@ import android.widget.TextView
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.ChooseOperationDialog
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||||
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
||||||
import info.nightscout.androidaps.utils.ui.VerticalTextView
|
import info.nightscout.androidaps.utils.ui.VerticalTextView
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.dialogs.ChooseOperationDialog
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class TriggerConnector(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerConnector(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.Constants
|
import info.nightscout.androidaps.Constants
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
import info.nightscout.androidaps.interfaces.GlucoseUnit
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDelta
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDelta.DeltaType
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputDelta
|
||||||
|
import info.nightscout.automation.elements.InputDelta.DeltaType
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
@ -15,9 +15,7 @@ class TriggerDummy(injector: HasAndroidInjector, val shouldRun: Boolean = false)
|
||||||
throw NotImplementedError("An operation is not implemented")
|
throw NotImplementedError("An operation is not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fromJSON(data: String): Trigger {
|
override fun fromJSON(data: String): Trigger = TriggerDummy(injector)
|
||||||
throw NotImplementedError("An operation is not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun friendlyName(): Int {
|
override fun friendlyName(): Int {
|
||||||
throw NotImplementedError("An operation is not implemented")
|
throw NotImplementedError("An operation is not implemented")
|
|
@ -1,19 +1,20 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputInsulin
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputInsulin
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class TriggerIob(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerIob(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
|
|
||||||
var insulin = InputInsulin()
|
var insulin = InputInsulin()
|
||||||
var comparator: Comparator = Comparator(rh)
|
var comparator: Comparator = Comparator(rh)
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.location.Location
|
import android.location.Location
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.*
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputButton
|
||||||
|
import info.nightscout.automation.elements.InputDouble
|
||||||
|
import info.nightscout.automation.elements.InputLocationMode
|
||||||
|
import info.nightscout.automation.elements.InputString
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
|
@ -47,7 +53,8 @@ class TriggerLocation(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
if (modeSelected.value == InputLocationMode.Mode.INSIDE && calculatedDistance <= distance.value ||
|
if (modeSelected.value == InputLocationMode.Mode.INSIDE && calculatedDistance <= distance.value ||
|
||||||
modeSelected.value == InputLocationMode.Mode.OUTSIDE && calculatedDistance > distance.value ||
|
modeSelected.value == InputLocationMode.Mode.OUTSIDE && calculatedDistance > distance.value ||
|
||||||
modeSelected.value == InputLocationMode.Mode.GOING_IN && calculatedDistance <= distance.value && lastMode == InputLocationMode.Mode.OUTSIDE ||
|
modeSelected.value == InputLocationMode.Mode.GOING_IN && calculatedDistance <= distance.value && lastMode == InputLocationMode.Mode.OUTSIDE ||
|
||||||
modeSelected.value == InputLocationMode.Mode.GOING_OUT && calculatedDistance > distance.value && lastMode == InputLocationMode.Mode.INSIDE) {
|
modeSelected.value == InputLocationMode.Mode.GOING_OUT && calculatedDistance > distance.value && lastMode == InputLocationMode.Mode.INSIDE
|
||||||
|
) {
|
||||||
aapsLogger.debug(LTag.AUTOMATION, "Ready for execution: " + friendlyDescription())
|
aapsLogger.debug(LTag.AUTOMATION, "Ready for execution: " + friendlyDescription())
|
||||||
lastMode = currentMode(calculatedDistance)
|
lastMode = currentMode(calculatedDistance)
|
||||||
return true
|
return true
|
|
@ -1,17 +1,17 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.data.ProfileSealed
|
import info.nightscout.androidaps.data.ProfileSealed
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputPercent
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputPercent
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class TriggerProfilePercent(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerProfilePercent(injector: HasAndroidInjector) : Trigger(injector) {
|
|
@ -1,17 +1,17 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputDuration
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetInt
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetInt
|
||||||
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
import info.nightscout.androidaps.utils.JsonHelper.safeGetString
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.Comparator
|
||||||
|
import info.nightscout.automation.elements.InputDuration
|
||||||
|
import info.nightscout.automation.elements.LabelWithElement
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class TriggerPumpLastConnection(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerPumpLastConnection(injector: HasAndroidInjector) : Trigger(injector) {
|
|
@ -1,19 +1,20 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.interfaces.Profile
|
import info.nightscout.androidaps.interfaces.Profile
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputTime
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.InputWeekDay
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
import info.nightscout.androidaps.utils.MidnightTime
|
import info.nightscout.androidaps.utils.MidnightTime
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.InputTime
|
||||||
|
import info.nightscout.automation.elements.InputWeekDay
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
import java.util.Objects
|
||||||
|
|
||||||
class TriggerRecurringTime(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerRecurringTime(injector: HasAndroidInjector) : Trigger(injector) {
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers
|
package info.nightscout.automation.triggers
|
||||||
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.google.common.base.Optional
|
import com.google.common.base.Optional
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.automation.R
|
|
||||||
import info.nightscout.androidaps.database.ValueWrapper
|
import info.nightscout.androidaps.database.ValueWrapper
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.ComparatorExists
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
|
|
||||||
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
|
|
||||||
import info.nightscout.androidaps.utils.JsonHelper
|
import info.nightscout.androidaps.utils.JsonHelper
|
||||||
|
import info.nightscout.automation.R
|
||||||
|
import info.nightscout.automation.elements.ComparatorExists
|
||||||
|
import info.nightscout.automation.elements.LayoutBuilder
|
||||||
|
import info.nightscout.automation.elements.StaticLabel
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class TriggerTempTarget(injector: HasAndroidInjector) : Trigger(injector) {
|
class TriggerTempTarget(injector: HasAndroidInjector) : Trigger(injector) {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue