LoopDialog -> ui
This commit is contained in:
parent
db8f853805
commit
0f67f62384
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="key_insulin_button_increment_1" translatable="false">insulin_button_increment_1</string>
|
||||
<string name="key_insulin_button_increment_2" translatable="false">insulin_button_increment_2</string>
|
||||
<string name="key_insulin_button_increment_3" translatable="false">insulin_button_increment_3</string>
|
||||
|
||||
<!-- DateUtil-->
|
||||
<string name="minago">%1$d m ago</string>
|
||||
<string name="minago_long">%1$d minutes ago</string>
|
||||
|
|
|
@ -190,9 +190,6 @@
|
|||
<activity
|
||||
android:name=".plugins.general.maintenance.activities.LogSettingActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name="info.nightscout.plugins.source.activities.RequestDexcomPermissionActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<uses-library
|
||||
android:name="org.apache.http.legacy"
|
||||
|
|
|
@ -8,7 +8,6 @@ import info.nightscout.androidaps.activities.PreferencesActivity
|
|||
import info.nightscout.androidaps.activities.SingleFragmentActivity
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
|
||||
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
|
||||
import info.nightscout.plugins.source.activities.RequestDexcomPermissionActivity
|
||||
import info.nightscout.androidaps.setupwizard.SetupWizardActivity
|
||||
|
||||
@Module
|
||||
|
@ -20,7 +19,6 @@ abstract class ActivitiesModule {
|
|||
@ContributesAndroidInjector abstract fun contributeMainActivity(): MainActivity
|
||||
@ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity
|
||||
@ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity
|
||||
@ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity
|
||||
@ContributesAndroidInjector abstract fun contributesSetupWizardActivity(): SetupWizardActivity
|
||||
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.di
|
|||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.activities.MyPreferenceFragment
|
||||
import info.nightscout.androidaps.dialogs.LoopDialog
|
||||
import info.nightscout.androidaps.dialogs.NtpProgressDialog
|
||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||
import info.nightscout.androidaps.plugins.aps.OpenAPSFragment
|
||||
|
@ -35,7 +34,6 @@ abstract class FragmentsModule {
|
|||
|
||||
@ContributesAndroidInjector abstract fun contributesEditQuickWizardDialog(): EditQuickWizardDialog
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog
|
||||
@ContributesAndroidInjector abstract fun contributesObjectivesExamDialog(): ObjectivesExamDialog
|
||||
@ContributesAndroidInjector abstract fun contributesWizardDialog(): WizardDialog
|
||||
@ContributesAndroidInjector abstract fun contributesNtpProgressDialog(): NtpProgressDialog
|
||||
|
|
|
@ -7,6 +7,7 @@ import info.nightscout.androidaps.interfaces.IobCobCalculator
|
|||
import info.nightscout.androidaps.interfaces.Sensitivity
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.Overview
|
||||
import info.nightscout.interfaces.constraints.Objectives
|
||||
import info.nightscout.interfaces.constraints.Safety
|
||||
import info.nightscout.interfaces.insulin.Insulin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
|
@ -187,6 +188,8 @@ class PluginStore @Inject constructor(
|
|||
|
||||
override val activeIobCobCalculator: IobCobCalculator
|
||||
get() = getSpecificPluginsListByInterface(IobCobCalculator::class.java).first() as IobCobCalculator
|
||||
override val activeObjectives: Objectives?
|
||||
get() = getSpecificPluginsListByInterface(Objectives::class.java).firstOrNull() as Objectives
|
||||
|
||||
override val activeNsClient: NsClient?
|
||||
get() = getTheOneEnabledInArray(getSpecificPluginsListByInterface(NsClient::class.java), PluginType.SYNC) as NsClient?
|
||||
|
|
|
@ -17,6 +17,13 @@ import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Obje
|
|||
import info.nightscout.androidaps.plugins.constraints.objectives.objectives.Objective9
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Objectives
|
||||
import info.nightscout.interfaces.constraints.Objectives.Companion.AUTOSENS_OBJECTIVE
|
||||
import info.nightscout.interfaces.constraints.Objectives.Companion.AUTO_OBJECTIVE
|
||||
import info.nightscout.interfaces.constraints.Objectives.Companion.FIRST_OBJECTIVE
|
||||
import info.nightscout.interfaces.constraints.Objectives.Companion.MAXBASAL_OBJECTIVE
|
||||
import info.nightscout.interfaces.constraints.Objectives.Companion.MAXIOB_ZERO_CL_OBJECTIVE
|
||||
import info.nightscout.interfaces.constraints.Objectives.Companion.SMB_OBJECTIVE
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.plugin.PluginDescription
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
|
@ -45,24 +52,10 @@ class ObjectivesPlugin @Inject constructor(
|
|||
.shortName(R.string.objectives_shortname)
|
||||
.description(R.string.description_objectives),
|
||||
aapsLogger, rh, injector
|
||||
), Constraints {
|
||||
), Constraints, Objectives {
|
||||
|
||||
var objectives: MutableList<Objective> = ArrayList()
|
||||
|
||||
companion object {
|
||||
|
||||
const val FIRST_OBJECTIVE = 0
|
||||
@Suppress("unused") const val USAGE_OBJECTIVE = 1
|
||||
@Suppress("unused") const val EXAM_OBJECTIVE = 2
|
||||
@Suppress("unused") const val OPENLOOP_OBJECTIVE = 3
|
||||
@Suppress("unused") const val MAXBASAL_OBJECTIVE = 4
|
||||
const val MAXIOB_ZERO_CL_OBJECTIVE = 5
|
||||
@Suppress("unused") const val MAXIOB_OBJECTIVE = 6
|
||||
const val AUTOSENS_OBJECTIVE = 7
|
||||
const val SMB_OBJECTIVE = 8
|
||||
const val AUTO_OBJECTIVE = 9
|
||||
}
|
||||
|
||||
public override fun onStart() {
|
||||
super.onStart()
|
||||
setupObjectives()
|
||||
|
@ -155,4 +148,6 @@ class ObjectivesPlugin @Inject constructor(
|
|||
value.set(aapsLogger, false, rh.gs(R.string.objectivenotstarted, AUTO_OBJECTIVE + 1), this)
|
||||
return value
|
||||
}
|
||||
|
||||
override fun isAccomplished(index: Int) = objectives[Objectives.MAXIOB_OBJECTIVE].isAccomplished
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.constraints.objectives.objectives
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.text.util.Linkify
|
||||
import android.widget.CheckBox
|
||||
import android.widget.TextView
|
||||
|
@ -9,11 +8,10 @@ import androidx.annotation.StringRes
|
|||
import androidx.fragment.app.FragmentActivity
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import java.util.*
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.floor
|
||||
|
||||
|
|
|
@ -30,9 +30,6 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.LoopDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.TempTargetDialog
|
||||
import info.nightscout.androidaps.dialogs.WizardDialog
|
||||
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
|
||||
import info.nightscout.androidaps.events.EventNewBG
|
||||
|
@ -111,6 +108,9 @@ import info.nightscout.shared.utils.DateUtil
|
|||
import info.nightscout.ui.dialogs.CalibrationDialog
|
||||
import info.nightscout.ui.dialogs.CarbsDialog
|
||||
import info.nightscout.ui.dialogs.InsulinDialog
|
||||
import info.nightscout.ui.dialogs.LoopDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.TempTargetDialog
|
||||
import info.nightscout.ui.dialogs.TreatmentDialog
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
|
|
|
@ -9,7 +9,6 @@ import androidx.appcompat.app.AppCompatActivity
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.data.ProfileSealed
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
|
@ -40,6 +39,7 @@ import info.nightscout.interfaces.AndroidPermission
|
|||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.constraints.Objectives
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.interfaces.utils.HardLimits
|
||||
|
@ -49,6 +49,7 @@ import info.nightscout.plugins.sync.nsShared.events.EventNSClientStatus
|
|||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -439,8 +440,8 @@ class SWDefinition @Inject constructor(
|
|||
SWFragment(injector, this)
|
||||
.add(ObjectivesFragment())
|
||||
)
|
||||
.validator { objectivesPlugin.objectives[ObjectivesPlugin.FIRST_OBJECTIVE].isStarted }
|
||||
.visibility { !objectivesPlugin.objectives[ObjectivesPlugin.FIRST_OBJECTIVE].isStarted && config.APS }
|
||||
.validator { objectivesPlugin.objectives[Objectives.FIRST_OBJECTIVE].isStarted }
|
||||
.visibility { !objectivesPlugin.objectives[Objectives.FIRST_OBJECTIVE].isStarted && config.APS }
|
||||
|
||||
private fun swDefinitionFull() { // List all the screens here
|
||||
add(screenSetupWizard)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="key_objectiveusedisconnect" translatable="false">ObjectivesDisconnectUsed</string>
|
||||
<string name="key_objectiveusereconnect" translatable="false">ObjectivesReconnectUsed</string>
|
||||
<string name="key_objectiveuseactions" translatable="false">ObjectivesActionsUsed</string>
|
||||
<string name="key_objectiveuseloop" translatable="false">ObjectivesLoopUsed</string>
|
||||
<string name="key_objectiveusescale" translatable="false">ObjectivesScaleUsed</string>
|
||||
|
|
|
@ -101,9 +101,6 @@
|
|||
<string name="configbuilder_bgsource">BG Source</string>
|
||||
<string name="configbuilder_bgsource_description">Where should AAPS gain it\'s data from?</string>
|
||||
<string name="apsmode_title">APS Mode</string>
|
||||
<string name="closedloop">Closed Loop</string>
|
||||
<string name="openloop">Open Loop</string>
|
||||
<string name="lowglucosesuspend">Low Glucose Suspend</string>
|
||||
<string name="openloop_newsuggestion">New suggestion available</string>
|
||||
<string name="carbssuggestion">Carbs Suggestion</string>
|
||||
<string name="carb_time_label">Carb time</string>
|
||||
|
@ -210,24 +207,12 @@
|
|||
<string name="patient_name">Patient name</string>
|
||||
<string name="patient_name_summary">Please provide patient name or nickname to differentiate among multiple setups</string>
|
||||
<string name="key_i_understand" translatable="false">I_understand</string>
|
||||
<string name="suspendloopfor1h">Suspend loop for 1h</string>
|
||||
<string name="suspendloopfor2h">Suspend loop for 2h</string>
|
||||
<string name="suspendloopfor3h">Suspend loop for 3h</string>
|
||||
<string name="suspendloopfor10h">Suspend loop for 10 h</string>
|
||||
<string name="disconnectpump">Disconnect pump</string>
|
||||
<string name="disconnectpumpfor15m">Disconnect pump for 15 min</string>
|
||||
<string name="disconnectpumpfor30m">Disconnect pump for 30 min</string>
|
||||
<string name="disconnectpumpfor1h">Disconnect pump for 1 h</string>
|
||||
<string name="disconnectpumpfor2h">Disconnect pump for 2 h</string>
|
||||
<string name="disconnectpumpfor3h">Disconnect pump for 3 h</string>
|
||||
<string name="duration15m">15 mins</string>
|
||||
<string name="duration30m">30 mins</string>
|
||||
<string name="duration1h">1 hour</string>
|
||||
<string name="duration2h">2 hours</string>
|
||||
<string name="duration3h">3 hours</string>
|
||||
<string name="duration10h">10 hours</string>
|
||||
<string name="resume">Resume</string>
|
||||
<string name="reconnect">Reconnect Pump</string>
|
||||
<string name="restartingapp">Exiting application to apply settings.</string>
|
||||
<string name="configbuilder_insulin_description">Which type of insulin are you using?</string>
|
||||
<string name="key_usesuperbolus" translatable="false">key_usersuperbolus</string>
|
||||
|
@ -497,7 +482,6 @@
|
|||
<string name="miscellaneous">Miscellaneous</string>
|
||||
<string name="nav_logsettings">Log settings</string>
|
||||
<string name="resettodefaults">Reset to defaults</string>
|
||||
<string name="key_aps_mode" translatable="false">aps_mode</string>
|
||||
<string name="setupwizard_preferred_aps_mode">Preferred APS mode</string>
|
||||
<string name="sendlogfiles">Send today\'s log files to developers along with this time. Unexpected situation.</string>
|
||||
<string name="loop_openmode_min_change">Minimal request change [%]</string>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.interfaces
|
||||
|
||||
import info.nightscout.interfaces.Overview
|
||||
import info.nightscout.interfaces.constraints.Objectives
|
||||
import info.nightscout.interfaces.constraints.Safety
|
||||
import info.nightscout.interfaces.insulin.Insulin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
|
@ -66,6 +67,11 @@ interface ActivePlugin {
|
|||
*/
|
||||
val activeIobCobCalculator: IobCobCalculator
|
||||
|
||||
/**
|
||||
* Objectives plugin
|
||||
*/
|
||||
val activeObjectives: Objectives?
|
||||
|
||||
/**
|
||||
* Currently selected NsClient plugin
|
||||
*/
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
<string name="key_ns_receive_temp_target" translatable="false">ns_receive_temp_target</string>
|
||||
<string name="key_objectiveuseprofileswitch" translatable="false">ObjectivesProfileSwitchUsed</string>
|
||||
<string name="key_objectiveusetemptarget" translatable="false">ObjectivesTempTargetUsed</string>
|
||||
<string name="key_objectiveusedisconnect" translatable="false">ObjectivesDisconnectUsed</string>
|
||||
<string name="key_objectiveusereconnect" translatable="false">ObjectivesReconnectUsed</string>
|
||||
<string name="key_aps_mode" translatable="false">aps_mode</string>
|
||||
|
||||
<!-- General-->
|
||||
<string name="refresh">Refresh</string>
|
||||
|
@ -259,6 +262,10 @@
|
|||
<string name="prime_fill">Prime/Fill</string>
|
||||
<string name="overview_insulin_label">Insulin</string>
|
||||
<string name="stoptemptarget">Stop temp target</string>
|
||||
<string name="closedloop">Closed Loop</string>
|
||||
<string name="openloop">Open Loop</string>
|
||||
<string name="lowglucosesuspend">Low Glucose Suspend</string>
|
||||
<string name="confirm">Confirm</string>
|
||||
|
||||
<!-- Constraints-->
|
||||
<string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string>
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
<string name="short_status_tdd">TDD: %1$.2f</string>
|
||||
<string name="short_status_reservoir">Reser.: %1$.2f U</string>
|
||||
<string name="short_status_battery">Batt.: %1$d%%</string>
|
||||
<string name="confirm">Confirm</string>
|
||||
<string name="mute_alert">Mute</string>
|
||||
<string name="release_software_version">Release software version</string>
|
||||
<string name="ui_processor_software_version">UI processor software version</string>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package info.nightscout.interfaces.constraints
|
||||
|
||||
interface Objectives {
|
||||
companion object {
|
||||
|
||||
const val FIRST_OBJECTIVE = 0
|
||||
@Suppress("unused") const val USAGE_OBJECTIVE = 1
|
||||
@Suppress("unused") const val EXAM_OBJECTIVE = 2
|
||||
@Suppress("unused") const val OPENLOOP_OBJECTIVE = 3
|
||||
@Suppress("unused") const val MAXBASAL_OBJECTIVE = 4
|
||||
const val MAXIOB_ZERO_CL_OBJECTIVE = 5
|
||||
@Suppress("unused") const val MAXIOB_OBJECTIVE = 6
|
||||
const val AUTOSENS_OBJECTIVE = 7
|
||||
const val SMB_OBJECTIVE = 8
|
||||
const val AUTO_OBJECTIVE = 9
|
||||
}
|
||||
|
||||
fun isAccomplished(index: Int): Boolean
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<application>
|
||||
<activity
|
||||
android:name="info.nightscout.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity"
|
||||
android:name=".general.smsCommunicator.activities.SmsCommunicatorOtpActivity"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity" />
|
||||
|
@ -18,6 +18,9 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".source.activities.RequestDexcomPermissionActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<service
|
||||
android:name=".sync.nsclient.services.NSClientService"
|
||||
|
|
|
@ -13,6 +13,7 @@ import info.nightscout.plugins.source.NSClientSourcePlugin
|
|||
import info.nightscout.plugins.source.PoctechPlugin
|
||||
import info.nightscout.plugins.source.TomatoPlugin
|
||||
import info.nightscout.plugins.source.XdripPlugin
|
||||
import info.nightscout.plugins.source.activities.RequestDexcomPermissionActivity
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
||||
|
@ -30,4 +31,6 @@ abstract class SourceModule {
|
|||
@ContributesAndroidInjector abstract fun contributesTomatoWorker(): TomatoPlugin.TomatoWorker
|
||||
@ContributesAndroidInjector abstract fun contributesEversenseWorker(): EversensePlugin.EversenseWorker
|
||||
@ContributesAndroidInjector abstract fun contributesAidexWorker(): AidexPlugin.AidexWorker
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity
|
||||
}
|
|
@ -22,6 +22,7 @@ import info.nightscout.ui.dialogs.CareDialog
|
|||
import info.nightscout.ui.dialogs.ExtendedBolusDialog
|
||||
import info.nightscout.ui.dialogs.FillDialog
|
||||
import info.nightscout.ui.dialogs.InsulinDialog
|
||||
import info.nightscout.ui.dialogs.LoopDialog
|
||||
import info.nightscout.ui.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.ui.dialogs.ProfileViewerDialog
|
||||
import info.nightscout.ui.dialogs.TempBasalDialog
|
||||
|
@ -45,6 +46,7 @@ abstract class UiModule {
|
|||
@ContributesAndroidInjector abstract fun contributesProfileSwitchDialog(): ProfileSwitchDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTempBasalDialog(): TempBasalDialog
|
||||
@ContributesAndroidInjector abstract fun contributesTempTargetDialog(): TempTargetDialog
|
||||
@ContributesAndroidInjector abstract fun contributesLoopDialog(): LoopDialog
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
|
||||
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
package info.nightscout.ui.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
|
@ -11,8 +11,6 @@ import android.view.Window
|
|||
import android.view.WindowManager
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import dagger.android.support.DaggerDialogFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.DialogLoopBinding
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.interfaces.ActivePlugin
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
|
@ -20,21 +18,19 @@ import info.nightscout.androidaps.interfaces.Constraints
|
|||
import info.nightscout.androidaps.interfaces.Loop
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.database.entities.OfflineEvent
|
||||
import info.nightscout.database.entities.UserEntry.Action
|
||||
import info.nightscout.database.entities.UserEntry.Sources
|
||||
import info.nightscout.database.entities.UserEntry
|
||||
import info.nightscout.database.entities.ValueWithUnit
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransaction
|
||||
import info.nightscout.database.impl.transactions.InsertAndCancelCurrentOfflineEventTransaction
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.constraints.Objectives
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.plugin.PluginType
|
||||
import info.nightscout.interfaces.pump.defs.PumpDescription
|
||||
|
@ -50,6 +46,8 @@ import info.nightscout.shared.interfaces.ResourceHelper
|
|||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.ui.R
|
||||
import info.nightscout.ui.databinding.DialogLoopBinding
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
@ -71,7 +69,6 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
@Inject lateinit var uel: UserEntryLogger
|
||||
@Inject lateinit var dateUtil: DateUtil
|
||||
@Inject lateinit var repository: AppRepository
|
||||
@Inject lateinit var objectivePlugin: ObjectivesPlugin
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var activityNames: ActivityNames
|
||||
|
||||
|
@ -162,7 +159,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
aapsLogger.debug("UpdateGUI from $from")
|
||||
val pumpDescription: PumpDescription = activePlugin.activePump.pumpDescription
|
||||
val closedLoopAllowed = constraintChecker.isClosedLoopAllowed(Constraint(true))
|
||||
val closedLoopAllowed2 = objectivePlugin.objectives[ObjectivesPlugin.MAXIOB_OBJECTIVE].isAccomplished
|
||||
val closedLoopAllowed2 = activePlugin.activeObjectives?.isAccomplished(Objectives.MAXIOB_OBJECTIVE) ?: false
|
||||
val lgsEnabled = constraintChecker.isLgsAllowed(Constraint(true))
|
||||
val apsMode = sp.getString(R.string.key_aps_mode, "open")
|
||||
val pump = activePlugin.activePump
|
||||
|
@ -182,7 +179,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
binding.overviewPump.visibility = View.GONE
|
||||
}
|
||||
|
||||
loop.isDisconnected -> {
|
||||
loop.isDisconnected -> {
|
||||
binding.overviewLoop.visibility = View.GONE
|
||||
binding.overviewSuspend.visibility = View.GONE
|
||||
binding.overviewPump.visibility = View.VISIBLE
|
||||
|
@ -191,7 +188,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
binding.overviewReconnect.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
!(loop as PluginBase).isEnabled() -> {
|
||||
!(loop as PluginBase).isEnabled() -> {
|
||||
binding.overviewLoop.visibility = View.VISIBLE
|
||||
binding.overviewEnable.visibility = View.VISIBLE
|
||||
binding.overviewDisable.visibility = View.GONE
|
||||
|
@ -200,7 +197,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
binding.overviewReconnect.visibility = View.GONE
|
||||
}
|
||||
|
||||
loop.isSuspended -> {
|
||||
loop.isSuspended -> {
|
||||
binding.overviewLoop.visibility = View.GONE
|
||||
binding.overviewSuspend.visibility = View.VISIBLE
|
||||
binding.overviewSuspendHeader.text = rh.gs(R.string.resumeloop)
|
||||
|
@ -284,28 +281,28 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
fun onClick(v: View): Boolean {
|
||||
when (v.id) {
|
||||
R.id.overview_closeloop -> {
|
||||
uel.log(Action.CLOSED_LOOP_MODE, Sources.LoopDialog)
|
||||
uel.log(UserEntry.Action.CLOSED_LOOP_MODE, UserEntry.Sources.LoopDialog)
|
||||
sp.putString(R.string.key_aps_mode, "closed")
|
||||
rxBus.send(EventPreferenceChange(rh.gs(R.string.closedloop)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_lgsloop -> {
|
||||
uel.log(Action.LGS_LOOP_MODE, Sources.LoopDialog)
|
||||
uel.log(UserEntry.Action.LGS_LOOP_MODE, UserEntry.Sources.LoopDialog)
|
||||
sp.putString(R.string.key_aps_mode, "lgs")
|
||||
rxBus.send(EventPreferenceChange(rh.gs(R.string.lowglucosesuspend)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_openloop -> {
|
||||
uel.log(Action.OPEN_LOOP_MODE, Sources.LoopDialog)
|
||||
uel.log(UserEntry.Action.OPEN_LOOP_MODE, UserEntry.Sources.LoopDialog)
|
||||
sp.putString(R.string.key_aps_mode, "open")
|
||||
rxBus.send(EventPreferenceChange(rh.gs(R.string.lowglucosesuspend)))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_disable -> {
|
||||
uel.log(Action.LOOP_DISABLED, Sources.LoopDialog)
|
||||
uel.log(UserEntry.Action.LOOP_DISABLED, UserEntry.Sources.LoopDialog)
|
||||
(loop as PluginBase).setPluginEnabled(PluginType.LOOP, false)
|
||||
(loop as PluginBase).setFragmentVisible(PluginType.LOOP, false)
|
||||
configBuilder.storeSettings("DisablingLoop")
|
||||
|
@ -328,7 +325,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_enable -> {
|
||||
uel.log(Action.LOOP_ENABLED, Sources.LoopDialog)
|
||||
uel.log(UserEntry.Action.LOOP_ENABLED, UserEntry.Sources.LoopDialog)
|
||||
(loop as PluginBase).setPluginEnabled(PluginType.LOOP, true)
|
||||
(loop as PluginBase).setFragmentVisible(PluginType.LOOP, true)
|
||||
configBuilder.storeSettings("EnablingLoop")
|
||||
|
@ -343,7 +340,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_resume, R.id.overview_reconnect -> {
|
||||
uel.log(if (v.id == R.id.overview_resume) Action.RESUME else Action.RECONNECT, Sources.LoopDialog)
|
||||
uel.log(if (v.id == R.id.overview_resume) UserEntry.Action.RESUME else UserEntry.Action.RECONNECT, UserEntry.Sources.LoopDialog)
|
||||
disposable += repository.runTransactionForResult(CancelCurrentOfflineEventIfAnyTransaction(dateUtil.now()))
|
||||
.subscribe({ result ->
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
|
||||
|
@ -363,28 +360,28 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
}
|
||||
|
||||
R.id.overview_suspend_1h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
uel.log(UserEntry.Action.SUSPEND, UserEntry.Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
loop.suspendLoop(T.hours(1).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_2h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
uel.log(UserEntry.Action.SUSPEND, UserEntry.Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
loop.suspendLoop(T.hours(2).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_3h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
uel.log(UserEntry.Action.SUSPEND, UserEntry.Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
loop.suspendLoop(T.hours(3).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
}
|
||||
|
||||
R.id.overview_suspend_10h -> {
|
||||
uel.log(Action.SUSPEND, Sources.LoopDialog, ValueWithUnit.Hour(10))
|
||||
uel.log(UserEntry.Action.SUSPEND, UserEntry.Sources.LoopDialog, ValueWithUnit.Hour(10))
|
||||
loop.suspendLoop(T.hours(10).mins().toInt())
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
return true
|
||||
|
@ -392,7 +389,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_disconnect_15m -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(15))
|
||||
uel.log(UserEntry.Action.DISCONNECT, UserEntry.Sources.LoopDialog, ValueWithUnit.Minute(15))
|
||||
loop.goToZeroTemp(T.mins(15).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
|
@ -401,7 +398,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_disconnect_30m -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Minute(30))
|
||||
uel.log(UserEntry.Action.DISCONNECT, UserEntry.Sources.LoopDialog, ValueWithUnit.Minute(30))
|
||||
loop.goToZeroTemp(T.mins(30).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
|
@ -410,7 +407,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_disconnect_1h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
uel.log(UserEntry.Action.DISCONNECT, UserEntry.Sources.LoopDialog, ValueWithUnit.Hour(1))
|
||||
loop.goToZeroTemp(T.hours(1).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
|
@ -420,7 +417,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_disconnect_2h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
uel.log(UserEntry.Action.DISCONNECT, UserEntry.Sources.LoopDialog, ValueWithUnit.Hour(2))
|
||||
loop.goToZeroTemp(T.hours(2).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
|
@ -429,7 +426,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
|
||||
R.id.overview_disconnect_3h -> {
|
||||
profileFunction.getProfile()?.let { profile ->
|
||||
uel.log(Action.DISCONNECT, Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
uel.log(UserEntry.Action.DISCONNECT, UserEntry.Sources.LoopDialog, ValueWithUnit.Hour(3))
|
||||
loop.goToZeroTemp(T.hours(3).mins().toInt(), profile, OfflineEvent.Reason.DISCONNECT_PUMP)
|
||||
rxBus.send(EventRefreshOverview("suspend_menu"))
|
||||
}
|
||||
|
@ -461,7 +458,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
ToastUtils.warnToast(ctx, R.string.dialog_canceled)
|
||||
dismiss()
|
||||
}
|
||||
protectionCheck.queryProtection(activity, BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
|
||||
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, { queryingProtection = false }, cancelFail, cancelFail)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,9 +59,6 @@
|
|||
<string name="record_insulin_cartridge_change">Record insulin cartridge change</string>
|
||||
|
||||
<!-- InsulinDialog -->
|
||||
<string name="key_insulin_button_increment_1" translatable="false">insulin_button_increment_1</string>
|
||||
<string name="key_insulin_button_increment_2" translatable="false">insulin_button_increment_2</string>
|
||||
<string name="key_insulin_button_increment_3" translatable="false">insulin_button_increment_3</string>
|
||||
<string name="do_not_bolus_record_only">Do not bolus, record only</string>
|
||||
<string name="bolus_recorded_only">Bolus will be recorded only (not delivered by pump)</string>
|
||||
|
||||
|
@ -69,6 +66,20 @@
|
|||
<string name="reuse_profile_pct_hours">Reuse %1$d%% %2$dh</string>
|
||||
<string name="timeshift_label">Time shift</string>
|
||||
|
||||
<!-- LoopDialog -->
|
||||
<string name="suspendloopfor1h">Suspend loop for 1h</string>
|
||||
<string name="suspendloopfor2h">Suspend loop for 2h</string>
|
||||
<string name="suspendloopfor3h">Suspend loop for 3h</string>
|
||||
<string name="suspendloopfor10h">Suspend loop for 10 h</string>
|
||||
<string name="disconnectpump">Disconnect pump</string>
|
||||
<string name="disconnectpumpfor15m">Disconnect pump for 15 min</string>
|
||||
<string name="disconnectpumpfor30m">Disconnect pump for 30 min</string>
|
||||
<string name="disconnectpumpfor1h">Disconnect pump for 1 h</string>
|
||||
<string name="disconnectpumpfor2h">Disconnect pump for 2 h</string>
|
||||
<string name="disconnectpumpfor3h">Disconnect pump for 3 h</string>
|
||||
<string name="resume">Resume</string>
|
||||
<string name="reconnect">Reconnect Pump</string>
|
||||
|
||||
<!-- Treatments -->
|
||||
<string name="no_records_available">No records available</string>
|
||||
<string name="calculation_short">Calc</string>
|
||||
|
|
Loading…
Reference in a new issue