move Overview plugin

This commit is contained in:
Milos Kozak 2022-11-27 13:50:03 +01:00
parent 3427820eda
commit 3892a174ea
73 changed files with 404 additions and 350 deletions

View file

@ -69,7 +69,7 @@
android:name=".activities.PreferencesActivity"
android:exported="false" />
<activity
android:name=".plugins.general.overview.activities.QuickWizardListActivity"
android:name="info.nightscout.plugins.general.overview.activities.QuickWizardListActivity"
android:exported="false"
android:theme="@style/AppTheme">
<intent-filter>

View file

@ -13,15 +13,15 @@ import com.jjoe64.graphview.GraphView
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityHistorybrowseBinding
import info.nightscout.androidaps.plugins.general.overview.OverviewMenus
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.core.activities.NoSplashAppCompatActivity
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.core.workflow.CalculationWorkflow
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.plugins.general.overview.OverviewMenus
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewGraph
import info.nightscout.plugins.general.overview.graphData.GraphData
import info.nightscout.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.events.EventAutosensCalculationFinished

View file

@ -6,7 +6,7 @@ import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
import info.nightscout.plugins.general.overview.activities.QuickWizardListActivity
import info.nightscout.ui.activities.SingleFragmentActivity
@Module

View file

@ -52,6 +52,7 @@ import javax.inject.Singleton
// Gradle modules
AutomationModule::class,
AutomationModule.Bindings::class,
ApsModule::class,
ConfigurationModule::class,
ConfigurationModule.Bindings::class,

View file

@ -9,43 +9,13 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.implementations.ActivityNamesImpl
import info.nightscout.androidaps.implementations.ConfigImpl
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
import info.nightscout.implementation.profile.ProfileFunctionImpl
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefsImpl
import info.nightscout.androidaps.workflow.CalculationWorkflowImpl
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.core.workflow.CalculationWorkflow
import info.nightscout.database.impl.AppRepository
import info.nightscout.implementation.constraints.ConstraintsImpl
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.autotune.Autotune
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.maintenance.ImportExportPrefs
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
import info.nightscout.interfaces.storage.FileStorage
import info.nightscout.interfaces.storage.Storage
import info.nightscout.interfaces.sync.DataSyncSelector
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.plugins.aps.loop.LoopPlugin
import info.nightscout.plugins.general.autotune.AutotunePlugin
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.plugins.sync.nsclient.DataSyncSelectorImplementation
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil
import javax.inject.Singleton
@Suppress("unused")
@Module(
@ -73,27 +43,6 @@ open class AppModule {
return plugins.toList().sortedBy { it.first }.map { it.second }
}
@Provides
@Singleton
fun provideStorage(): Storage = FileStorage()
@Provides
@Singleton
fun provideProfileFunction(
aapsLogger: AAPSLogger, sp: SP, rxBus: RxBus, rh:
ResourceHelper, activePlugin:
ActivePlugin, repository: AppRepository, dateUtil: DateUtil, config: Config, hardLimits: HardLimits,
aapsSchedulers: AapsSchedulers, fabricPrivacy: FabricPrivacy, processedDeviceStatusData: ProcessedDeviceStatusData
): ProfileFunction =
ProfileFunctionImpl(
aapsLogger, sp, rxBus, rh, activePlugin, repository, dateUtil,
config, hardLimits, aapsSchedulers, fabricPrivacy, processedDeviceStatusData
)
@Provides
@Singleton
internal fun provideConstraints(activePlugin: ActivePlugin): Constraints = ConstraintsImpl(activePlugin)
@Module
interface AppBindings {
@ -101,13 +50,7 @@ open class AppModule {
@Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector
@Binds fun bindConfigInterface(config: ConfigImpl): Config
@Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder
@Binds fun bindImportExportPrefsInterface(importExportPrefs: ImportExportPrefsImpl): ImportExportPrefs
@Binds fun bindLoopInterface(loopPlugin: LoopPlugin): Loop
@Binds fun bindAutotuneInterface(autotunePlugin: AutotunePlugin): Autotune
@Binds fun bindIobCobCalculatorInterface(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculator
@Binds fun bindSmsCommunicatorInterface(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicator
@Binds fun bindDataSyncSelectorInterface(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector
@Binds fun bindActivityNamesInterface(activityNames: ActivityNamesImpl): ActivityNames
@Binds fun bindCalculationWorkflowInterface(calculationWorkflow: CalculationWorkflowImpl): CalculationWorkflow
}

View file

@ -3,10 +3,10 @@ package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.activities.MyPreferenceFragment
import info.nightscout.configuration.configBuilder.ConfigBuilderFragment
import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment
import info.nightscout.androidaps.plugins.general.overview.OverviewFragment
import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog
import info.nightscout.configuration.configBuilder.ConfigBuilderFragment
import info.nightscout.plugins.general.overview.OverviewFragment
import info.nightscout.plugins.general.overview.dialogs.EditQuickWizardDialog
import info.nightscout.plugins.general.wear.WearFragment
@Module

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.plugins.general.overview.graphData.GraphData
import info.nightscout.plugins.general.overview.notifications.NotificationWithAction
@Module

View file

@ -8,9 +8,7 @@ import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
@ -18,22 +16,21 @@ import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.automation.AutomationPlugin
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.plugins.aps.loop.LoopPlugin
import info.nightscout.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.plugins.aps.openAPSSMBDynamicISF.OpenAPSSMBDynamicISFPlugin
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
import info.nightscout.plugins.constraints.dstHelper.DstHelperPlugin
import info.nightscout.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.plugins.constraints.safety.SafetyPlugin
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
import info.nightscout.plugins.constraints.storage.StorageConstraintPlugin
import info.nightscout.plugins.constraints.versionChecker.VersionCheckerPlugin
import info.nightscout.plugins.general.actions.ActionsPlugin
import info.nightscout.plugins.general.autotune.AutotunePlugin
import info.nightscout.plugins.general.dataBroadcaster.DataBroadcastPlugin
import info.nightscout.plugins.general.food.FoodPlugin
import info.nightscout.plugins.general.overview.OverviewPlugin
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin
import info.nightscout.plugins.general.wear.WearPlugin

View file

@ -20,13 +20,18 @@ import info.nightscout.ui.activities.ErrorHelperActivity
import info.nightscout.ui.activities.SingleFragmentActivity
import info.nightscout.ui.activities.TDDStatsActivity
import info.nightscout.ui.dialogs.BolusProgressDialog
import info.nightscout.ui.dialogs.CalibrationDialog
import info.nightscout.ui.dialogs.CarbsDialog
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
import info.nightscout.ui.dialogs.TempTargetDialog
import info.nightscout.ui.dialogs.TreatmentDialog
import info.nightscout.ui.dialogs.WizardDialog
import javax.inject.Inject
@ -52,16 +57,22 @@ class ActivityNamesImpl @Inject constructor(
ctx.startActivity(i)
}
override fun runWizard(fragmentManager: FragmentManager, carbs: Int, name: String) {
override fun runWizardDialog(fragmentManager: FragmentManager, carbs: Int?, name: String?) {
WizardDialog().also { dialog ->
dialog.arguments = Bundle().also { bundle ->
bundle.putDouble("carbs_input", carbs.toDouble())
bundle.putString("notes_input", " $name - ${carbs}g")
carbs?.let { bundle.putDouble("carbs_input", carbs.toDouble())}
name?.let {bundle.putString("notes_input", " $name - ${carbs}g") }
}
}.show(fragmentManager, "Food Item")
}
override fun runLoopDialog(fragmentManager: FragmentManager, showOkCancel: Int) {
LoopDialog()
.also { it.arguments = Bundle().also { bundle -> bundle.putInt("showOkCancel", showOkCancel) } }
.show(fragmentManager, "LoopDialog")
}
override fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String?) {
ProfileSwitchDialog()
.also { it.arguments = Bundle().also { bundle -> bundle.putString("profileName", profileName) } }
@ -73,6 +84,26 @@ class ActivityNamesImpl @Inject constructor(
.show(fragmentManager, "TempBasalDialog")
}
override fun runTreatmentDialog(fragmentManager: FragmentManager) {
TreatmentDialog()
.show(fragmentManager, "TreatmentDialog")
}
override fun runInsulinDialog(fragmentManager: FragmentManager) {
InsulinDialog()
.show(fragmentManager, "InsulinDialog")
}
override fun runCalibrationDialog(fragmentManager: FragmentManager) {
CalibrationDialog()
.show(fragmentManager, "CalibrationDialog")
}
override fun runCarbsDialog(fragmentManager: FragmentManager) {
CarbsDialog()
.show(fragmentManager, "CarbsDialog")
}
override fun runTempTargetDialog(fragmentManager: FragmentManager) {
TempTargetDialog()
.show(fragmentManager, "TempTargetDialog")

View file

@ -10,7 +10,6 @@ import com.jjoe64.graphview.series.BarGraphSeries
import com.jjoe64.graphview.series.LineGraphSeries
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.general.overview.OverviewMenus
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensDataObject
import info.nightscout.core.graph.OverviewData
import info.nightscout.core.graph.data.DataPointWithLabelInterface
@ -31,6 +30,7 @@ import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.iob.IobTotal
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.utils.DecimalFormatter
import info.nightscout.plugins.general.overview.OverviewMenus
import info.nightscout.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger

View file

@ -5,7 +5,6 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.general.overview.OverviewMenus
import info.nightscout.core.graph.OverviewData
import info.nightscout.core.graph.data.DataPointWithLabelInterface
import info.nightscout.core.graph.data.GlucoseValueDataPoint
@ -14,9 +13,10 @@ import info.nightscout.core.utils.receivers.DataWorkerStorage
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.plugins.general.overview.OverviewMenus
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.utils.T

View file

@ -4,9 +4,9 @@ import android.content.Context
import androidx.work.Worker
import androidx.work.WorkerParameters
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph
import info.nightscout.core.workflow.CalculationWorkflow
import info.nightscout.plugins.general.overview.OverviewPlugin
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewGraph
import info.nightscout.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
import info.nightscout.rx.bus.RxBus
import javax.inject.Inject

View file

@ -4,9 +4,9 @@ import android.content.Context
import androidx.work.Worker
import androidx.work.WorkerParameters
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewIobCob
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewSensitivity
import info.nightscout.plugins.general.overview.OverviewPlugin
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewIobCob
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewSensitivity
import info.nightscout.rx.bus.RxBus
import javax.inject.Inject

View file

@ -37,13 +37,8 @@
<string name="nav_resetdb">Reset Databases</string>
<string name="reset_db_confirm">Do you really want to reset the databases?</string>
<string name="nav_exit">Exit</string>
<string name="description_overview">Displays the current state of your loop and buttons for most common actions</string>
<string name="description_persistent_notification">Shows an ongoing notification with a short overview of what your loop is doing</string>
<string name="delta">Delta</string>
<string name="overview">Overview</string>
<string name="treatments">Treatments</string>
<string name="constraints_violation">Constraints violation</string>
<string name="changeyourinput">Change your input!</string>
<string name="profile_label">Profile</string>
<string name="configbuilder_nightscoutversion_label">Nightscout version:</string>
<string name="exported">Preferences exported</string>
@ -64,35 +59,13 @@
<string name="master_password_will_be_replaced">As a result of successful import current master password WILL BE REPLACED with that old master password!</string>
<string name="save">Save</string>
<string name="reloadprofile">Reload profile</string>
<string name="quickwizardsettings">QuickWizard settings</string>
<string name="overview_editquickwizard_buttontext">Button text:</string>
<string name="overview_editquickwizard_carbs">Carbs:</string>
<string name="overview_editquickwizard_valid">Valid:</string>
<string name="overview_editquickwizardlistactivity_add">Add</string>
<string name="overview_quickwizard_item_edit_button">Edit</string>
<string name="correctionbous">Corr</string>
<string name="ns_upload_only">(DANGEROUS TO DISABLE) NS upload only</string>
<string name="ns_upload_only_summary">NS upload only (disabled sync). Not effective on SGV unless a local source like xDrip+ is selected. Not effective on Profiles while NS-Profiles is used.\n!!! WARNING !!! Disabling this option may cause malfunctions and insulin overdose if any of your component (AAPS, NS, xDrip+) is wrong configured. Carefully watch if data displayed by AAPS match the pump state!</string>
<string name="prefs_range_title">Range for Visualization</string>
<string name="prefs_range_summary">High and low mark for the charts in Overview and Smartwatch</string>
<string name="low_mark">LOW mark</string>
<string name="high_mark">HIGH mark</string>
<string name="wear">Wear</string>
<string name="ongoingnotificaction">Ongoing Notification</string>
<string name="old_data">OLD DATA</string>
<string name="overview_shortname">HOME</string>
<string name="treatments_shortname">TREAT</string>
<string name="short_tabtitles">Shorten tab titles</string>
<string name="restartingapp">Exiting application to apply settings.</string>
<string name="enablesuperbolus">Enable superbolus in wizard</string>
<string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string>
<string name="prediction_shortname">PRED</string>
<string name="basal_shortname">BAS</string>
<string name="deviation_shortname">DEV</string>
<string name="activity_shortname">ACT</string>
<string name="bgi_shortname">-BGI</string>
<string name="abs_insulin_shortname">ABS</string>
<string name="devslope_shortname">DEVSLOPE</string>
<string name="nav_about">About</string>
<string name="smscommunicator_missingphonestatepermission">Missing phone state permission</string>
<string name="ns_alarm_options">Alarm options</string>
@ -104,70 +77,19 @@
<string name="ns_announcements">Create notifications from NS announcements</string>
<string name="ns_alarm_stale_data_value_label">Stale data threshold [min]</string>
<string name="ns_alarm_urgent_stale_data_value_label">Urgent stale data threshold [min]</string>
<string name="openaps">OpenAPS</string>
<string name="uploader">Uploader</string>
<string name="keep_screen_on_title">Keep screen on</string>
<string name="keep_screen_on_summary">Prevent Android to turn screen off. It will consume lot of energy when not plugged to power outlet.</string>
<string name="sensitivity_warning">By turning on Autosense feature remember to enter all eated carbs. Otherwise carbs deviations will be identified wrong as sensitivity change !!</string>
<string name="notloadedplugins">Not all profiles loaded!</string>
<string name="valuesnotstored">Values not stored!</string>
<string name="invalid">INVALID</string>
<string name="default_temptargets">Default Temp-Targets</string>
<string name="eatingsoon_duration">eatingsoon duration</string>
<string name="eatingsoon_target">eatingsoon target</string>
<string name="activity_duration">activity duration</string>
<string name="activity_target">activity target</string>
<string name="hypo_duration">hypo duration</string>
<string name="hypo_target">hypo target</string>
<string name="gradually_increase_notification_volume">Gradually increase the volume for alerts and notifications</string>
<string name="localalertsettings_title">Local alerts</string>
<string name="enable_missed_bg_readings_alert">Alert if no BG data is received</string>
<string name="enable_pump_unreachable_alert">Alert if pump is unreachable</string>
<string name="pump_unreachable_threshold">Pump unreachable threshold [min]</string>
<string name="enable_carbs_req_alert">Alert if carbs are required</string>
<string name="overview_editquickwizard_usebg">BG calculation</string>
<string name="overview_editquickwizard_usebolusiob">Bolus IOB calculation</string>
<string name="overview_editquickwizard_usebasaliob">Basal IOB calculation</string>
<string name="overview_editquickwizard_usetrend">Trend calculation</string>
<string name="overview_editquickwizard_usesuperbolus">Superbolus calculation</string>
<string name="positiveonly">Positive only</string>
<string name="negativeonly">Negative only</string>
<string name="overview_editquickwizard_usecob">COB calculation</string>
<string name="overview_editquickwizard_usetemptarget">Temporary target calculation</string>
<string name="overview_editquickwizard_usepercentage">Percentage calculation</string>
<string name="overview_buttons_selection">Buttons</string>
<string name="key_show_calibration_button" translatable="false">show_calibration_button</string>
<string name="key_show_cgm_button" translatable="false">show_cgm_button</string>
<string name="key_show_carbs_button" translatable="false">show_carbs_button</string>
<string name="key_show_wizard_button" translatable="false">show_wizard_button</string>
<string name="key_show_insulin_button" translatable="false">show_insulin_button</string>
<string name="key_show_treatment_button" translatable="false">show_treatment_button</string>
<string name="show_calibration_button_summary">Sends a calibration to xDrip+ or open BYODA calibration dialog</string>
<string name="show_cgm_button_summary">Opens xDrip+ or BYODA, back buttons returns to AAPS</string>
<string name="carb_increment_button_message">Number of carbs to add when button is pressed</string>
<string name="insulin_increment_button_message">Amount of insulin to add when button is pressed</string>
<string name="error_starting_cgm">Could not launch CGM application. Make sure it is installed.</string>
<string name="g5appnotdetected">Please update your Dexcom app to supported version</string>
<string name="dexcom_app_not_installed">Dexcom app is not installed.</string>
<string name="overview_show_activity">Activity</string>
<string name="overview_show_bgi">Blood Glucose Impact</string>
<string name="overview_show_sensitivity">Sensitivity</string>
<string name="overview_show_deviations">Deviations</string>
<string name="overview_show_cob">Carbs On Board</string>
<string name="overview_show_iob">Insulin On Board</string>
<string name="overview_show_basals">Basals</string>
<string name="engineering_mode_enabled">Engineering mode enabled</string>
<string name="overview_show_notes_field_in_dialogs_title">Show notes field in treatment dialogs</string>
<string name="firstinsulinincrement">First insulin increment</string>
<string name="secondinsulinincrement">Second insulin increment</string>
<string name="thirdinsulinincrement">Third insulin increment</string>
<string name="firstcarbsincrement">First carbs increment</string>
<string name="secondcarbsincrement">Second carbs increment</string>
<string name="thirdcarbsincrement">Third carbs increment</string>
<string name="cgm">CGM</string>
<string name="open_navigation">Open navigation</string>
<string name="close_navigation">Close navigation</string>
<string name="key_keep_screen_on" translatable="false">keep_screen_on</string>
<string name="remove_items">Remove items</string>
<string name="sort_items">Sort items</string>
<string name="error_adding_treatment_title">Treatment data incomplete</string>
@ -188,49 +110,27 @@
<string name="miscellaneous">Miscellaneous</string>
<string name="nav_logsettings">Log settings</string>
<string name="resettodefaults">Reset to defaults</string>
<string name="key_short_tabtitles" translatable="false">short_tabtitles</string>
<string name="profile_total">== ∑ %1$s U</string>
<string name="deliverpartofboluswizard">Bolus wizard performs calculation but only this part of calculated insulin is delivered. Useful with SMB algorithm.</string>
<string name="unitsnosemicolon">Units</string>
<string name="show_removed">Show removed</string>
<string name="clearqueueconfirm">Clear queue? All data in queue will be lost!</string>
<string name="chartmenu">Chart menu</string>
<string name="overview_show_predictions">Predictions</string>
<string name="overview_show_treatments">Treatments</string>
<string name="overview_show_deviationslope">Deviation slope</string>
<string name="key_graphconfig" translatable="false">graphconfig</string>
<string name="authorizationfailed">Authorization failed</string>
<string name="overview_show_absinsulin">Absolute insulin</string>
<string name="copytolocalprofile_invalid">Unable to create profile. Profile is invalid.</string>
<string name="cta_dont_kill_my_app_info">Don\'t kill my app?</string>
<string name="time_to_eat">Time to eat!\nRun Bolus wizard and do calculation again.</string>
<string name="enablebolusreminder">Enable bolus reminder</string>
<string name="enablebolusreminder_summary">Use reminder to bolus later with wizard ("post-bolus")</string>
<string name="fabric_upload_disabled">Crash logs upload disabled!</string>
<string name="graph_menu_divider_header">Graph</string>
<string name="clear_filter">Clear filter</string>
<string name="cannula">Cannula</string>
<string name="email_address">Email address</string>
<string name="data_status">BG data status</string>
<string name="remove_bg_readings">Remove BG readings</string>
<string name="identification_not_set">Identification not set in dev mode</string>
<string name="a11y_dialog">dialog</string>
<string name="not_available_full">Not available</string>
<!-- WEAR OS-->
<string name="overview_editquickwizard_show_on_device">Show entry on device:</string>
<string name="wear_unknown_action_string">Unknown action command:</string>
<string name="overview_editquickwizard_percentage">Percentage</string>
<string name="app_default">Application default</string>
<string name="remove_selected_items">Remove selected items</string>
<string name="count_selected">%1$d selected</string>
<string name="sort_label">Sort</string>
<string name="graph_scale">Graph scale</string>
<string name="device_all">All</string>
<string name="device_phone">Phone</string>
<string name="device_watch">Watch</string>
<string name="a11y_only_on_watch">only on watch</string>
<string name="a11y_only_on_phone">only on phone</string>
<string name="a11y_drag_and_drop_handle">drag and drop handle</string>
<string name="search">Search</string>
<string name="database_cleanup">Database cleanup</string>

View file

@ -59,7 +59,7 @@
<string name="loading">Loading …</string>
<string name="notes_label">Notes</string>
<string name="remove_button">Remove</string>
<string name="addnew">Add new</string>
<string name="add_new">Add new</string>
<string name="addnew_above">Add new above</string>
<string name="wrong_pump_data">Data is coming from different pump. Change pump driver to reset pump state.</string>
<string name="bg_label">BG</string>

View file

@ -0,0 +1,6 @@
package info.nightscout.interfaces.automation
interface Automation {
fun userEvents(): List<AutomationEvent>
fun processEvent(someEvent: AutomationEvent)
}

View file

@ -0,0 +1,8 @@
package info.nightscout.interfaces.automation
interface AutomationEvent {
var isEnabled: Boolean
var title: String
fun canRun(): Boolean
fun preconditionCanRun() : Boolean
}

View file

@ -0,0 +1,9 @@
package info.nightscout.interfaces.bgQualityCheck
import androidx.annotation.DrawableRes
interface BgQualityCheck {
var message: String
@DrawableRes fun icon(): Int
fun stateDescription(): String
}

View file

@ -28,9 +28,14 @@ interface ActivityNames {
* @param soundId sound resource. if == 0 alarm is not started
*/
fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int = 0)
fun runWizard(fragmentManager: FragmentManager, carbs: Int, name: String)
fun runWizardDialog(fragmentManager: FragmentManager, carbs: Int? = null, name: String? = null)
fun runLoopDialog(fragmentManager: FragmentManager, showOkCancel: Int)
fun runProfileSwitchDialog(fragmentManager: FragmentManager, profileName: String? = null)
fun runTempBasalDialog(fragmentManager: FragmentManager)
fun runTreatmentDialog(fragmentManager: FragmentManager)
fun runInsulinDialog(fragmentManager: FragmentManager)
fun runCalibrationDialog(fragmentManager: FragmentManager)
fun runCarbsDialog(fragmentManager: FragmentManager)
fun runTempTargetDialog(fragmentManager: FragmentManager)
fun runExtendedBolusDialog(fragmentManager: FragmentManager)
fun runFillDialog(fragmentManager: FragmentManager)

View file

@ -26,6 +26,9 @@
<string name="snooze">Snooze</string>
<string name="virtual_pump">Virtual Pump</string>
<string name="constraints">Constraints</string>
<string name="superbolus">Superbolus</string>
<string name="pump_paused">Pump paused</string>
<string name="and">And</string>
<!-- Pumps -->
<string name="battery_label">Battery</string>

View file

@ -1,10 +1,7 @@
package info.nightscout.implementation
import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.BolusTimer
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.automation.AutomationEvent
import info.nightscout.automation.AutomationEventObject
import info.nightscout.automation.AutomationPlugin
import info.nightscout.automation.actions.ActionAlarm
import info.nightscout.automation.elements.Comparator
@ -12,6 +9,9 @@ import info.nightscout.automation.elements.InputDelta
import info.nightscout.automation.triggers.TriggerBg
import info.nightscout.automation.triggers.TriggerConnector
import info.nightscout.automation.triggers.TriggerDelta
import info.nightscout.interfaces.BolusTimer
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.shared.interfaces.ResourceHelper
import java.text.DecimalFormat
import javax.inject.Inject
import javax.inject.Singleton
@ -24,7 +24,7 @@ class BolusTimerImpl @Inject constructor(
) : BolusTimer {
override fun scheduleAutomationEventBolusReminder() {
val event = AutomationEvent(injector).apply {
val event = AutomationEventObject(injector).apply {
title = rh.gs(R.string.bolus_reminder)
readOnly = true
systemAction = true
@ -47,7 +47,7 @@ class BolusTimerImpl @Inject constructor(
}
override fun removeAutomationEventBolusReminder() {
val event = AutomationEvent(injector).apply {
val event = AutomationEventObject(injector).apply {
title = rh.gs(R.string.bolus_reminder)
}
automationPlugin.removeIfExists(event)

View file

@ -1,11 +1,7 @@
package info.nightscout.implementation
import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.CarbTimer
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.utils.TimerUtil
import info.nightscout.automation.AutomationEvent
import info.nightscout.automation.AutomationEventObject
import info.nightscout.automation.AutomationPlugin
import info.nightscout.automation.actions.ActionAlarm
import info.nightscout.automation.elements.Comparator
@ -13,6 +9,10 @@ import info.nightscout.automation.elements.InputDelta
import info.nightscout.automation.triggers.TriggerBg
import info.nightscout.automation.triggers.TriggerConnector
import info.nightscout.automation.triggers.TriggerDelta
import info.nightscout.interfaces.CarbTimer
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.utils.TimerUtil
import info.nightscout.shared.interfaces.ResourceHelper
import java.text.DecimalFormat
import javax.inject.Inject
import javax.inject.Singleton
@ -37,7 +37,7 @@ class CarbTimerImpl @Inject constructor(
* Create new Automation event to alarm when is time to eat
*/
override fun scheduleAutomationEventEatReminder() {
val event = AutomationEvent(injector).apply {
val event = AutomationEventObject(injector).apply {
title = rh.gs(R.string.bolus_advisor)
readOnly = true
systemAction = true
@ -94,7 +94,7 @@ class CarbTimerImpl @Inject constructor(
* Remove Automation event
*/
override fun removeAutomationEventEatReminder() {
val event = AutomationEvent(injector).apply {
val event = AutomationEventObject(injector).apply {
title = rh.gs(R.string.bolus_advisor)
}
automationPlugin.removeIfExists(event)

View file

@ -15,11 +15,13 @@ import info.nightscout.implementation.TrendCalculatorImpl
import info.nightscout.implementation.UserEntryLoggerImpl
import info.nightscout.implementation.XDripBroadcastImpl
import info.nightscout.implementation.androidNotification.NotificationHolderImpl
import info.nightscout.implementation.constraints.ConstraintsImpl
import info.nightscout.implementation.db.PersistenceLayerImpl
import info.nightscout.implementation.logging.LoggerUtilsImpl
import info.nightscout.implementation.maintenance.PrefFileListProviderImpl
import info.nightscout.implementation.overview.OverviewDataImpl
import info.nightscout.implementation.plugin.PluginStore
import info.nightscout.implementation.profile.ProfileFunctionImpl
import info.nightscout.implementation.profile.ProfileInstantiatorImpl
import info.nightscout.implementation.profile.ProfileStoreObject
import info.nightscout.implementation.profiling.ProfilerImpl
@ -36,6 +38,7 @@ import info.nightscout.implementation.resources.ResourceHelperImpl
import info.nightscout.implementation.stats.DexcomTirCalculatorImpl
import info.nightscout.implementation.stats.TddCalculatorImpl
import info.nightscout.implementation.stats.TirCalculatorImpl
import info.nightscout.implementation.storage.FileStorage
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.BolusTimer
import info.nightscout.interfaces.CarbTimer
@ -43,12 +46,14 @@ import info.nightscout.interfaces.LocalAlertUtils
import info.nightscout.interfaces.NotificationHolder
import info.nightscout.interfaces.Translator
import info.nightscout.interfaces.XDripBroadcast
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.db.PersistenceLayer
import info.nightscout.interfaces.logging.LoggerUtils
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.maintenance.PrefFileListProvider
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.profile.ProfileInstantiator
import info.nightscout.interfaces.profiling.Profiler
import info.nightscout.interfaces.protection.PasswordCheck
@ -62,6 +67,7 @@ import info.nightscout.interfaces.queue.CommandQueue
import info.nightscout.interfaces.stats.DexcomTirCalculator
import info.nightscout.interfaces.stats.TddCalculator
import info.nightscout.interfaces.stats.TirCalculator
import info.nightscout.interfaces.storage.Storage
import info.nightscout.interfaces.ui.IconsProvider
import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.interfaces.utils.TrendCalculator
@ -112,5 +118,8 @@ abstract class ImplementationModule {
@Binds fun bindIconsProviderInterface(iconsProvider: IconsProviderImplementation): IconsProvider
@Binds fun bindNotificationHolderInterface(notificationHolder: NotificationHolderImpl): NotificationHolder
@Binds fun bindCommandQueue(commandQueue: CommandQueueImplementation): CommandQueue
@Binds fun bindsConstraints(constraintsImpl: ConstraintsImpl): Constraints
@Binds fun bindsProfileFunction(profileFunctionImpl: ProfileFunctionImpl): ProfileFunction
@Binds fun bindsStorage(fileStorage: FileStorage): Storage
}
}

View file

@ -1,10 +1,12 @@
package info.nightscout.interfaces.storage
package info.nightscout.implementation.storage
import info.nightscout.interfaces.storage.Storage
import java.io.File
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class FileStorage : Storage {
class FileStorage @Inject constructor(): Storage {
override fun getFileContents(file: File): String {
return file.readText()

View file

@ -7,8 +7,6 @@
<string name="missed_bg_readings">Missed BG readings</string>
<string name="time_to_eat">Time to eat</string>
<string name="enable_bolus_advisor">Enable bolus advisor</string>
<string name="enable_bolus_advisor_summary">Use reminder to start eating later instead of wizard result during high glycemia ("pre-bolus")</string>
<string name="time_to_bolus">Time to bolus!\nRun Bolus wizard and do calculation again.</string>
<string name="executing_right_now">Command is executed right now</string>
<string name="basal_value_below_minimum">Basal value below minimum. Profile not set!</string>

View file

@ -51,7 +51,6 @@
<string name="timeout_during_handshake">Timeout during handshake - reset bluetooth</string>
<string name="pump_stopped">Pump stopped</string>
<string name="pump_started">Pump started</string>
<string name="pump_paused">Pump paused</string>
<string name="short_status_last_connected">Last conn: %1$d min ago</string>
<string name="short_status_tbr">TBR: %1$d%% for %2$d / %3$d min</string>
<string name="short_status_extended">Extended: %1$.2f / %2$.2f U for %3$d min</string>

View file

@ -1,18 +1,29 @@
package info.nightscout.plugins.aps.di
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.interfaces.autotune.Autotune
import info.nightscout.plugins.aps.OpenAPSFragment
import info.nightscout.plugins.di.AutotuneModule
import info.nightscout.plugins.general.autotune.AutotunePlugin
@Module(
includes = [
AutotuneModule::class,
AlgModule::class
AlgModule::class,
ApsModule.Bindings::class
]
)
@Suppress("unused")
abstract class ApsModule {
@ContributesAndroidInjector abstract fun contributesOpenAPSFragment(): OpenAPSFragment
@Module
interface Bindings {
@Binds fun bindAutotuneInterface(autotunePlugin: AutotunePlugin): Autotune
}
}

View file

@ -1,4 +1,4 @@
package info.nightscout.plugins.di
package info.nightscout.plugins.aps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector

View file

@ -1,25 +1,26 @@
package info.nightscout.automation
import dagger.android.HasAndroidInjector
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.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.interfaces.automation.AutomationEvent
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import org.json.JSONArray
import org.json.JSONObject
import javax.inject.Inject
class AutomationEvent(private val injector: HasAndroidInjector) {
class AutomationEventObject(private val injector: HasAndroidInjector) : AutomationEvent {
@Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var dateUtil: DateUtil
var title: String = ""
var isEnabled = true
override var title: String = ""
override var isEnabled = true
var position = -1
var systemAction: Boolean = false // true = generated by AAPS, false = entered by user
var readOnly: Boolean = false // removing, editing disabled
@ -35,7 +36,10 @@ class AutomationEvent(private val injector: HasAndroidInjector) {
injector.androidInjector().inject(this)
}
fun getPreconditions(): TriggerConnector {
override fun canRun() : Boolean = trigger.shouldRun()
override fun preconditionCanRun() : Boolean = getPreconditions().shouldRun()
internal fun getPreconditions(): TriggerConnector {
val trigger = TriggerConnector(injector, TriggerConnector.Type.AND)
for (action in actions) {
action.precondition?.let { trigger.list.add(it) }
@ -72,7 +76,7 @@ class AutomationEvent(private val injector: HasAndroidInjector) {
.toString()
}
fun fromJSON(data: String, position: Int): AutomationEvent {
fun fromJSON(data: String, position: Int): AutomationEventObject {
val d = JSONObject(data)
title = d.optString("title", "")
isEnabled = d.optBoolean("enabled", true)

View file

@ -66,7 +66,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener, MenuProvider {
private var disposable: CompositeDisposable = CompositeDisposable()
private lateinit var eventListAdapter: EventListAdapter
private lateinit var actionHelper: ActionModeHelper<AutomationEvent>
private lateinit var actionHelper: ActionModeHelper<AutomationEventObject>
private val itemTouchHelper = ItemTouchHelper(SimpleItemTouchHelperCallback())
private var _binding: AutomationFragmentBinding? = null
@ -286,7 +286,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener, MenuProvider {
}
}
private fun getConfirmationText(selectedItems: SparseArray<AutomationEvent>): String {
private fun getConfirmationText(selectedItems: SparseArray<AutomationEventObject>): String {
if (selectedItems.size() == 1) {
val event = selectedItems.valueAt(0)
return rh.gs(R.string.removerecord) + " " + event.title
@ -294,7 +294,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener, MenuProvider {
return rh.gs(R.string.confirm_remove_multiple_items, selectedItems.size())
}
private fun removeSelected(selectedItems: SparseArray<AutomationEvent>) {
private fun removeSelected(selectedItems: SparseArray<AutomationEventObject>) {
activity?.let { activity ->
OKDialog.showConfirmation(activity, rh.gs(R.string.removerecord), getConfirmationText(selectedItems), Runnable {
selectedItems.forEach { _, event ->
@ -311,7 +311,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener, MenuProvider {
actionHelper.finish()
EditEventDialog().also {
it.arguments = Bundle().apply {
putString("event", AutomationEvent(injector).toJSON())
putString("event", AutomationEventObject(injector).toJSON())
putInt("position", -1) // New event
}
}.show(childFragmentManager, "EditEventDialog")

View file

@ -42,6 +42,8 @@ import info.nightscout.automation.triggers.TriggerWifiSsid
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.automation.Automation
import info.nightscout.interfaces.automation.AutomationEvent
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase
@ -98,13 +100,13 @@ class AutomationPlugin @Inject constructor(
.preferencesId(R.xml.pref_automation)
.description(R.string.automation_description),
aapsLogger, rh, injector
) {
), Automation {
private var disposable: CompositeDisposable = CompositeDisposable()
private val keyAutomationEvents = "AUTOMATION_EVENTS"
private val automationEvents = ArrayList<AutomationEvent>()
private val automationEvents = ArrayList<AutomationEventObject>()
var executionLog: MutableList<String> = ArrayList()
var btConnects: MutableList<EventBTChange> = ArrayList()
@ -202,14 +204,14 @@ class AutomationPlugin @Inject constructor(
val array = JSONArray(data)
for (i in 0 until array.length()) {
val o = array.getJSONObject(i)
val event = AutomationEvent(injector).fromJSON(o.toString(), i)
val event = AutomationEventObject(injector).fromJSON(o.toString(), i)
automationEvents.add(event)
}
} catch (e: JSONException) {
e.printStackTrace()
}
else
automationEvents.add(AutomationEvent(injector).fromJSON(event, 0))
automationEvents.add(AutomationEventObject(injector).fromJSON(event, 0))
}
internal fun processActions() {
@ -259,8 +261,9 @@ class AutomationPlugin @Inject constructor(
storeToSP() // save last run time
}
fun processEvent(event: AutomationEvent) {
if (event.trigger.shouldRun() && event.getPreconditions().shouldRun()) {
override fun processEvent(someEvent: AutomationEvent) {
val event = someEvent as AutomationEventObject
if (event.canRun() && event.preconditionCanRun()) {
val actions = event.actions
for (action in actions) {
action.title = event.title
@ -296,14 +299,14 @@ class AutomationPlugin @Inject constructor(
}
@Synchronized
fun add(event: AutomationEvent) {
fun add(event: AutomationEventObject) {
automationEvents.add(event)
event.position = automationEvents.size - 1
rxBus.send(EventAutomationDataChanged())
}
@Synchronized
fun addIfNotExists(event: AutomationEvent) {
fun addIfNotExists(event: AutomationEventObject) {
for (e in automationEvents) {
if (event.title == e.title) return
}
@ -322,7 +325,7 @@ class AutomationPlugin @Inject constructor(
}
@Synchronized
fun set(event: AutomationEvent, index: Int) {
fun set(event: AutomationEventObject, index: Int) {
automationEvents[index] = event
rxBus.send(EventAutomationDataChanged())
}
@ -349,7 +352,7 @@ class AutomationPlugin @Inject constructor(
Collections.swap(automationEvents, fromPosition, toPosition)
}
fun userEvents(): List<AutomationEvent> {
override fun userEvents(): List<AutomationEvent> {
val list = mutableListOf<AutomationEvent>()
val iterator = synchronized(this) { automationEvents.toMutableList().iterator() }
while (iterator.hasNext()) {

View file

@ -1,9 +1,11 @@
package info.nightscout.automation.di
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.automation.AutomationEvent
import info.nightscout.automation.AutomationEventObject
import info.nightscout.automation.AutomationFragment
import info.nightscout.automation.AutomationPlugin
import info.nightscout.automation.actions.Action
import info.nightscout.automation.actions.ActionAlarm
import info.nightscout.automation.actions.ActionCarePortalEvent
@ -45,6 +47,7 @@ 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.interfaces.automation.Automation
@Module
@Suppress("unused")
@ -57,7 +60,7 @@ abstract class AutomationModule {
@ContributesAndroidInjector abstract fun contributesEditActionDialog(): EditActionDialog
@ContributesAndroidInjector abstract fun contributesEditEventDialog(): EditEventDialog
@ContributesAndroidInjector abstract fun contributesEditTriggerDialog(): EditTriggerDialog
@ContributesAndroidInjector abstract fun automationEventInjector(): AutomationEvent
@ContributesAndroidInjector abstract fun automationEventInjector(): AutomationEventObject
@ContributesAndroidInjector abstract fun triggerInjector(): Trigger
@ContributesAndroidInjector abstract fun triggerAutosensValueInjector(): TriggerAutosensValue
@ -95,4 +98,10 @@ abstract class AutomationModule {
@ContributesAndroidInjector abstract fun actionStartTempTargetInjector(): ActionStartTempTarget
@ContributesAndroidInjector abstract fun actionStopTempTargetInjector(): ActionStopTempTarget
@ContributesAndroidInjector abstract fun actionDummyInjector(): ActionDummy
@Module
interface Bindings {
@Binds fun bindAutomation(automationPlugin: AutomationPlugin): Automation
}
}

View file

@ -10,7 +10,7 @@ import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.HasAndroidInjector
import info.nightscout.automation.AutomationEvent
import info.nightscout.automation.AutomationEventObject
import info.nightscout.automation.AutomationPlugin
import info.nightscout.automation.R
import info.nightscout.automation.actions.Action
@ -38,7 +38,7 @@ class EditEventDialog : BaseDialog() {
@Inject lateinit var automationPlugin: AutomationPlugin
private var actionListAdapter: ActionListAdapter? = null
private lateinit var event: AutomationEvent
private lateinit var event: AutomationEventObject
private var position: Int = -1
private var disposable: CompositeDisposable = CompositeDisposable()
@ -53,11 +53,11 @@ class EditEventDialog : BaseDialog() {
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
event = AutomationEvent(injector)
event = AutomationEventObject(injector)
// load data from bundle
(savedInstanceState ?: arguments)?.let { bundle ->
position = bundle.getInt("position", -1)
bundle.getString("event")?.let { event = AutomationEvent(injector).fromJSON(it, position) }
bundle.getString("event")?.let { event = AutomationEventObject(injector).fromJSON(it, position) }
}
onCreateViewGeneral()

View file

@ -44,7 +44,6 @@
<string name="temptargetcomparedmmol">Temp Target %1$s %2$.1f %3$s</string>
<string name="percentagecompared">Profile pct %1$s %2$d</string>
<string name="iobcompared">IOB %1$s %2$.1f</string>
<string name="and">And</string>
<string name="or">Or</string>
<string name="xor">Exclusive or</string>
<string name="atspecifiedtime">At %1$s</string>

View file

@ -26,7 +26,7 @@ class AutomationEventTest : TestBase() {
var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector {
if (it is AutomationEvent) {
if (it is AutomationEventObject) {
it.aapsLogger = aapsLogger
}
if (it is Action) {
@ -44,7 +44,7 @@ class AutomationEventTest : TestBase() {
@Test
fun testCloneEvent() {
// create test object
val event = AutomationEvent(injector)
val event = AutomationEventObject(injector)
event.title = "Test"
event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest.oneItem)) as TriggerConnector
event.addAction(ActionLoopEnable(injector))
@ -55,7 +55,7 @@ class AutomationEventTest : TestBase() {
Assert.assertEquals(eventJsonExpected, event.toJSON())
// clone
val clone = AutomationEvent(injector).fromJSON(eventJsonExpected, 1)
val clone = AutomationEventObject(injector).fromJSON(eventJsonExpected, 1)
// check title
Assert.assertEquals(event.title, clone.title)
@ -74,7 +74,7 @@ class AutomationEventTest : TestBase() {
@Test
fun hasStopProcessing() {
val event = AutomationEvent(injector)
val event = AutomationEventObject(injector)
event.title = "Test"
event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest.oneItem)) as TriggerConnector
Assert.assertFalse(event.hasStopProcessing())

View file

@ -2,7 +2,9 @@ package info.nightscout.configuration.di
import dagger.Binds
import dagger.Module
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
import info.nightscout.configuration.configBuilder.RunningConfigurationImpl
import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.configBuilder.RunningConfiguration
@Module(
@ -16,5 +18,6 @@ open class ConfigurationModule {
interface Bindings {
@Binds fun bindRunningConfiguration(runningConfigurationImpl: RunningConfigurationImpl): RunningConfiguration
@Binds fun bindConfigBuilderInterface(configBuilderPlugin: ConfigBuilderPlugin): ConfigBuilder
}
}

View file

@ -2,8 +2,16 @@ package info.nightscout.plugins.di
import dagger.Binds
import dagger.Module
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.nsclient.NSSettingsStatus
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
import info.nightscout.interfaces.sync.DataSyncSelector
import info.nightscout.plugins.aps.loop.LoopPlugin
import info.nightscout.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.plugins.sync.nsclient.DataSyncSelectorImplementation
import info.nightscout.plugins.sync.nsclient.data.NSSettingsStatusImpl
import info.nightscout.plugins.sync.nsclient.data.ProcessedDeviceStatusDataImpl
@ -33,5 +41,9 @@ abstract class PluginsModule {
@Binds fun bindProcessedDeviceStatusData(processedDeviceStatusDataImpl: ProcessedDeviceStatusDataImpl): ProcessedDeviceStatusData
@Binds fun bindNSSettingsStatus(nsSettingsStatusImpl: NSSettingsStatusImpl): NSSettingsStatus
@Binds fun bindSmsCommunicator(smsCommunicatorPlugin: SmsCommunicatorPlugin): SmsCommunicator
@Binds fun bindIobCobCalculator(iobCobCalculatorPlugin: IobCobCalculatorPlugin): IobCobCalculator
@Binds fun bindLoop(loopPlugin: LoopPlugin): Loop
@Binds fun bindDataSyncSelectorInterface(dataSyncSelectorImplementation: DataSyncSelectorImplementation): DataSyncSelector
}
}

View file

@ -12,7 +12,6 @@ import android.widget.ArrayAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.core.ui.UIRunnable
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.utils.fabric.FabricPrivacy
@ -21,6 +20,7 @@ import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InvalidateFoodTransaction
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.protection.ProtectionCheck
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.plugins.R
@ -224,7 +224,7 @@ class FoodFragment : DaggerFragment() {
val food = v.tag as Food
activity?.let { activity ->
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
if (isAdded) activityNames.runWizard(childFragmentManager, food.carbs, food.name)
if (isAdded) activityNames.runWizardDialog(childFragmentManager, food.carbs, food.name)
})
}
}

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview
package info.nightscout.plugins.general.overview
import android.annotation.SuppressLint
import android.app.NotificationManager
@ -27,18 +27,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.jjoe64.graphview.GraphView
import dagger.android.HasAndroidInjector
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.extensions.directionToIcon
import info.nightscout.androidaps.extensions.valueToUnitsString
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.EventUpdateOverviewGraph
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewIobCob
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewSensitivity
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.automation.AutomationPlugin
import info.nightscout.core.graph.OverviewData
import info.nightscout.core.iob.displayText
import info.nightscout.core.profile.ProfileSealed
@ -56,10 +47,15 @@ import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.aps.VariableSensitivityResult
import info.nightscout.interfaces.automation.Automation
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.nsclient.NSSettingsStatus
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.profile.DefaultValueHelper
@ -70,16 +66,20 @@ import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.interfaces.utils.TrendCalculator
import info.nightscout.plugins.R
import info.nightscout.plugins.aps.loop.events.EventNewOpenLoopNotification
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
import info.nightscout.plugins.databinding.OverviewFragmentBinding
import info.nightscout.plugins.general.overview.activities.QuickWizardListActivity
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewCalcProgress
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewGraph
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewIobCob
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewSensitivity
import info.nightscout.plugins.general.overview.graphData.GraphData
import info.nightscout.plugins.general.overview.notifications.NotificationStore
import info.nightscout.plugins.general.overview.notifications.events.EventUpdateOverviewNotification
import info.nightscout.plugins.skins.SkinProvider
import info.nightscout.plugins.source.DexcomPlugin
import info.nightscout.plugins.source.XdripPlugin
import info.nightscout.interfaces.nsclient.NSSettingsStatus
import info.nightscout.interfaces.nsclient.ProcessedDeviceStatusData
import info.nightscout.plugins.ui.StatusLightHandler
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
@ -101,14 +101,6 @@ import info.nightscout.shared.extensions.toVisibility
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
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 info.nightscout.ui.dialogs.WizardDialog
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.Locale
@ -150,8 +142,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
@Inject lateinit var repository: AppRepository
@Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider
@Inject lateinit var overviewData: OverviewData
@Inject lateinit var automationPlugin: AutomationPlugin
@Inject lateinit var bgQualityCheckPlugin: BgQualityCheckPlugin
@Inject lateinit var automation: Automation
@Inject lateinit var bgQualityCheck: BgQualityCheck
@Inject lateinit var activityNames: ActivityNames
private val disposable = CompositeDisposable()
@ -375,28 +367,28 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
R.id.treatment_button -> protectionCheck.queryProtection(
activity,
ProtectionCheck.Protection.BOLUS,
UIRunnable { if (isAdded) TreatmentDialog().show(childFragmentManager, "Overview") })
UIRunnable { if (isAdded) activityNames.runTreatmentDialog(childFragmentManager) })
R.id.wizard_button -> protectionCheck.queryProtection(
activity,
ProtectionCheck.Protection.BOLUS,
UIRunnable { if (isAdded) WizardDialog().show(childFragmentManager, "Overview") })
UIRunnable { if (isAdded) activityNames.runWizardDialog(childFragmentManager) })
R.id.insulin_button -> protectionCheck.queryProtection(
activity,
ProtectionCheck.Protection.BOLUS,
UIRunnable { if (isAdded) InsulinDialog().show(childFragmentManager, "Overview") })
UIRunnable { if (isAdded) activityNames.runInsulinDialog(childFragmentManager) })
R.id.quick_wizard_button -> protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable { if (isAdded) onClickQuickWizard() })
R.id.carbs_button -> protectionCheck.queryProtection(
activity,
ProtectionCheck.Protection.BOLUS,
UIRunnable { if (isAdded) CarbsDialog().show(childFragmentManager, "Overview") })
UIRunnable { if (isAdded) activityNames.runCarbsDialog(childFragmentManager) })
R.id.temp_target -> protectionCheck.queryProtection(
activity,
ProtectionCheck.Protection.BOLUS,
UIRunnable { if (isAdded) TempTargetDialog().show(childFragmentManager, "Overview") })
UIRunnable { if (isAdded) activityNames.runTempTargetDialog(childFragmentManager) })
R.id.active_profile -> {
activityNames.runProfileViewerDialog(
@ -419,7 +411,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
R.id.calibration_button -> {
if (xdripPlugin.isEnabled()) {
CalibrationDialog().show(childFragmentManager, "CalibrationDialog")
activityNames.runCalibrationDialog(childFragmentManager)
} else if (dexcomPlugin.isEnabled()) {
try {
dexcomMediator.findDexcomPackageName()?.let {
@ -431,7 +423,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
}
?: ToastUtils.infoToast(activity, rh.gs(R.string.dexcom_app_not_installed))
} catch (e: ActivityNotFoundException) {
ToastUtils.infoToast(activity, rh.gs(R.string.g5appnotdetected))
ToastUtils.infoToast(activity, rh.gs(R.string.dexcom_app_not_detected))
}
}
}
@ -461,9 +453,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
R.id.aps_mode -> {
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
if (isAdded) LoopDialog().also { dialog ->
dialog.arguments = Bundle().also { it.putInt("showOkCancel", 1) }
}.show(childFragmentManager, "Overview")
if (isAdded) activityNames.runLoopDialog(childFragmentManager, 1)
})
}
}
@ -494,9 +484,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
R.id.aps_mode -> {
activity?.let { activity ->
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
LoopDialog().also { dialog ->
dialog.arguments = Bundle().also { it.putInt("showOkCancel", 0) }
}.show(childFragmentManager, "Overview")
activityNames.runLoopDialog(childFragmentManager, 0)
})
}
}
@ -508,7 +496,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
protectionCheck.queryProtection(
activity,
ProtectionCheck.Protection.BOLUS,
UIRunnable { ProfileSwitchDialog().show(childFragmentManager, "ProfileSwitchDialog") })
UIRunnable { activityNames.runProfileSwitchDialog(childFragmentManager) })
}
}
@ -528,7 +516,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val carbsAfterConstraints = constraintChecker.applyCarbsConstraints(Constraint(quickWizardEntry.carbs())).value()
activity?.let {
if (abs(wizard.insulinAfterConstraints - wizard.calculatedTotalInsulin) >= pump.pumpDescription.pumpType.determineCorrectBolusStepSize(wizard.insulinAfterConstraints) || carbsAfterConstraints != quickWizardEntry.carbs()) {
OKDialog.show(it, rh.gs(R.string.treatmentdeliveryerror), rh.gs(R.string.constraints_violation) + "\n" + rh.gs(R.string.changeyourinput))
OKDialog.show(it, rh.gs(R.string.treatmentdeliveryerror), rh.gs(R.string.constraints_violation) + "\n" + rh.gs(R.string.change_your_input))
return
}
wizard.confirmAndExecute(it)
@ -571,7 +559,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
_binding ?: return@runOnUiThread
if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && (loop as PluginBase).isEnabled()) {
binding.buttonsLayout.acceptTempButton.visibility = View.VISIBLE
binding.buttonsLayout.acceptTempButton.text = "${rh.gs(R.string.setbasalquestion)}\n${lastRun!!.constraintsProcessed}"
binding.buttonsLayout.acceptTempButton.text = "${rh.gs(R.string.set_basal_question)}\n${lastRun!!.constraintsProcessed}"
} else {
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
}
@ -610,10 +598,10 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
// Automation buttons
binding.buttonsLayout.userButtonsLayout.removeAllViews()
val events = automationPlugin.userEvents()
val events = automation.userEvents()
if (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null)
for (event in events)
if (event.isEnabled && event.trigger.shouldRun())
if (event.isEnabled && event.canRun())
context?.let { context ->
SingleClickButton(context, null, R.attr.customBtnStyle).also {
it.setTextColor(rh.gac(context, R.attr.treatmentButton))
@ -625,7 +613,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
it.text = event.title
it.setOnClickListener {
OKDialog.showConfirmation(context, rh.gs(R.string.run_question, event.title), { handler.post { automationPlugin.processEvent(event) } })
OKDialog.showConfirmation(context, rh.gs(R.string.run_question, event.title), { handler.post { automation.processEvent(event) } })
}
binding.buttonsLayout.userButtonsLayout.addView(it)
}
@ -644,7 +632,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
binding.infoLayout.apsMode.stateDescription = rh.gs(stringRes)
} else {
binding.infoLayout.apsMode.contentDescription = rh.gs(R.string.apsmode_title) + " " + rh.gs(stringRes)
binding.infoLayout.apsMode.contentDescription = rh.gs(R.string.aps_mode_title) + " " + rh.gs(stringRes)
}
}
@ -830,13 +818,13 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
binding.infoLayout.timeAgo.contentDescription = dateUtil.minAgoLong(rh, lastBg?.timestamp)
binding.infoLayout.timeAgoShort.text = "(" + dateUtil.minAgoShort(lastBg?.timestamp) + ")"
val qualityIcon = bgQualityCheckPlugin.icon()
val qualityIcon = bgQualityCheck.icon()
if (qualityIcon != 0) {
binding.infoLayout.bgQuality.visibility = View.VISIBLE
binding.infoLayout.bgQuality.setImageResource(qualityIcon)
binding.infoLayout.bgQuality.contentDescription = rh.gs(R.string.a11y_bg_quality) + " " + bgQualityCheckPlugin.stateDescription()
binding.infoLayout.bgQuality.contentDescription = rh.gs(R.string.a11y_bg_quality) + " " + bgQualityCheck.stateDescription()
binding.infoLayout.bgQuality.setOnClickListener {
context?.let { context -> OKDialog.show(context, rh.gs(R.string.data_status), bgQualityCheckPlugin.message) }
context?.let { context -> OKDialog.show(context, rh.gs(R.string.data_status), bgQualityCheck.message) }
}
} else {
binding.infoLayout.bgQuality.visibility = View.GONE
@ -916,7 +904,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
insulinAge.visibility = isPatchPump.not().toVisibility()
batteryLayout.visibility = (!isPatchPump || pump.pumpDescription.useHardwareLink).toVisibility()
pbAge.visibility = (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()).toVisibility()
val useBatteryLevel = (pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin)
val useBatteryLevel = (pump.model() == PumpType.OMNIPOD_EROS)
|| (pump.model() != PumpType.ACCU_CHEK_COMBO && pump.model() != PumpType.OMNIPOD_DASH)
batteryLevel.visibility = useBatteryLevel.toVisibility()
statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility()
@ -1118,7 +1106,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val request = loop.lastRun?.request
val isfMgdl = profile?.getIsfMgdl()
val variableSens =
if (config.APS && request is info.nightscout.plugins.aps.openAPSSMB.DetermineBasalResultSMB) request.variableSens ?: 0.0
if (config.APS && request is VariableSensitivityResult) request.variableSens ?: 0.0
else if (config.NSCLIENT) JsonHelper.safeGetDouble(processedDeviceStatusData.getAPSResult(injector).json, "variable_sens")
else 0.0

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview
package info.nightscout.plugins.general.overview
import android.content.Context
import android.text.SpannableString
@ -11,10 +11,10 @@ import androidx.annotation.AttrRes
import androidx.annotation.StringRes
import androidx.appcompat.widget.PopupMenu
import com.google.gson.Gson
import info.nightscout.androidaps.R
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.aps.Loop
import info.nightscout.plugins.R
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRefreshOverview
import info.nightscout.rx.events.EventScale
@ -39,14 +39,14 @@ class OverviewMenus @Inject constructor(
PRE(R.string.overview_show_predictions, R.attr.predictionColor, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.prediction_shortname),
TREAT(R.string.overview_show_treatments, R.attr.cobColor, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.treatments_shortname),
BAS(R.string.overview_show_basals, R.attr.basal, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.basal_shortname),
ABS(R.string.overview_show_absinsulin, R.attr.iobColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.abs_insulin_shortname),
ABS(R.string.overview_show_abs_insulin, R.attr.iobColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.abs_insulin_shortname),
IOB(R.string.overview_show_iob, R.attr.iobColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.iob),
COB(R.string.overview_show_cob, R.attr.cobColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.cob),
DEV(R.string.overview_show_deviations, R.attr.bgiColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.deviation_shortname),
BGI(R.string.overview_show_bgi, R.attr.bgiColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.bgi_shortname),
SEN(R.string.overview_show_sensitivity, R.attr.ratioColor, R.attr.menuTextColorInverse, primary = false, secondary = true, shortnameId = R.string.sensitivity_shortname),
ACT(R.string.overview_show_activity, R.attr.activityColor, R.attr.menuTextColor, primary = true, secondary = false, shortnameId = R.string.activity_shortname),
DEVSLOPE(R.string.overview_show_deviationslope, R.attr.devSlopePosColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.devslope_shortname)
DEVSLOPE(R.string.overview_show_deviation_slope, R.attr.devSlopePosColor, R.attr.menuTextColor, primary = false, secondary = true, shortnameId = R.string.devslope_shortname)
}
companion object {
@ -72,13 +72,13 @@ class OverviewMenus @Inject constructor(
@Synchronized
private fun storeGraphConfig() {
val sts = Gson().toJson(_setting)
sp.putString(R.string.key_graphconfig, sts)
sp.putString(R.string.key_graph_config, sts)
aapsLogger.debug(sts)
}
@Synchronized
fun loadGraphConfig() {
val sts = sp.getString(R.string.key_graphconfig, "")
val sts = sp.getString(R.string.key_graph_config, "")
if (sts.isNotEmpty()) {
_setting = Gson().fromJson(sts, Array<Array<Boolean>>::class.java).toMutableList()
// reset when new CharType added

View file

@ -1,18 +1,16 @@
package info.nightscout.androidaps.plugins.general.overview
package info.nightscout.plugins.general.overview
import android.content.Context
import androidx.annotation.StringRes
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.extensions.putDouble
import info.nightscout.androidaps.extensions.putInt
import info.nightscout.androidaps.extensions.putString
import info.nightscout.androidaps.extensions.storeDouble
import info.nightscout.androidaps.extensions.storeInt
import info.nightscout.androidaps.extensions.storeString
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewCalcProgress
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.graph.OverviewData
import info.nightscout.core.ui.dialogs.OKDialog
@ -22,6 +20,8 @@ import info.nightscout.interfaces.Overview
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.plugins.R
import info.nightscout.plugins.general.overview.events.EventUpdateOverviewCalcProgress
import info.nightscout.plugins.general.overview.notifications.NotificationStore
import info.nightscout.plugins.general.overview.notifications.NotificationWithAction
import info.nightscout.plugins.general.overview.notifications.events.EventUpdateOverviewNotification

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.activities
package info.nightscout.plugins.general.overview.activities
import android.annotation.SuppressLint
import android.os.Bundle
@ -14,11 +14,6 @@ import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.OverviewQuickwizardlistActivityBinding
import info.nightscout.androidaps.databinding.OverviewQuickwizardlistItemBinding
import info.nightscout.androidaps.plugins.general.overview.dialogs.EditQuickWizardDialog
import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.utils.ActionModeHelper
@ -28,6 +23,11 @@ import info.nightscout.core.wizard.QuickWizardEntry
import info.nightscout.interfaces.dragHelpers.ItemTouchHelperAdapter
import info.nightscout.interfaces.dragHelpers.OnStartDragListener
import info.nightscout.interfaces.dragHelpers.SimpleItemTouchHelperCallback
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.OverviewQuickwizardlistActivityBinding
import info.nightscout.plugins.databinding.OverviewQuickwizardlistItemBinding
import info.nightscout.plugins.general.overview.dialogs.EditQuickWizardDialog
import info.nightscout.plugins.general.overview.events.EventQuickWizardChange
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.extensions.toVisibility

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.dialogs
package info.nightscout.plugins.general.overview.dialogs
import android.os.Bundle
import android.text.format.DateFormat
@ -10,14 +10,14 @@ import android.view.WindowManager
import com.google.android.material.timepicker.MaterialTimePicker
import com.google.android.material.timepicker.TimeFormat
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.OverviewEditquickwizardDialogBinding
import info.nightscout.androidaps.plugins.general.overview.events.EventQuickWizardChange
import info.nightscout.androidaps.utils.extensions.selectedItemPosition
import info.nightscout.androidaps.utils.extensions.setEnableForChildren
import info.nightscout.androidaps.utils.extensions.setSelection
import info.nightscout.core.wizard.QuickWizard
import info.nightscout.core.wizard.QuickWizardEntry
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.OverviewEditquickwizardDialogBinding
import info.nightscout.plugins.general.overview.events.EventQuickWizardChange
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.SafeParse
@ -36,8 +36,8 @@ class EditQuickWizardDialog : DaggerDialogFragment(), View.OnClickListener {
@Inject lateinit var sp: SP
var position = -1
var fromSeconds: Int = 0
var toSeconds: Int = 0
private var fromSeconds: Int = 0
private var toSeconds: Int = 0
private var _binding: OverviewEditquickwizardDialogBinding? = null

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.events
package info.nightscout.plugins.general.overview.events
import info.nightscout.rx.events.Event

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.events
package info.nightscout.plugins.general.overview.events
import info.nightscout.rx.events.Event

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.events
package info.nightscout.plugins.general.overview.events
import info.nightscout.rx.events.Event

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.events
package info.nightscout.plugins.general.overview.events
import info.nightscout.rx.events.Event

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.events
package info.nightscout.plugins.general.overview.events
import info.nightscout.rx.events.Event

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.plugins.general.overview.graphData
package info.nightscout.plugins.general.overview.graphData
import android.content.Context
import android.graphics.DashPathEffect
@ -8,7 +8,6 @@ import com.jjoe64.graphview.series.DataPoint
import com.jjoe64.graphview.series.LineGraphSeries
import com.jjoe64.graphview.series.Series
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.core.graph.OverviewData
import info.nightscout.core.graph.data.BolusDataPoint
import info.nightscout.core.graph.data.EffectiveProfileSwitchDataPoint
@ -19,6 +18,7 @@ import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.utils.Round
import info.nightscout.plugins.R
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper
import javax.inject.Inject

View file

@ -13,7 +13,7 @@
android:layout_height="wrap_content"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:text="@string/setbasalquestion"
android:text="@string/set_basal_question"
android:textColor="?attr/acceptTempButtonColor"
android:visibility="gone" />

View file

@ -4,7 +4,7 @@
style="@style/StyleDialog"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".plugins.general.overview.dialogs.EditQuickWizardDialog">
tools:context="info.nightscout.plugins.general.overview.dialogs.EditQuickWizardDialog">
<LinearLayout
android:layout_width="match_parent"
@ -30,7 +30,7 @@
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:text="@string/quickwizardsettings"
android:text="@string/quickwizard_settings"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
@ -40,7 +40,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:labelFor="@+id/button_edit"
android:text="@string/overview_editquickwizard_buttontext"
android:text="@string/overview_edit_quickwizard_button_text"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<EditText
@ -55,7 +55,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:labelFor="@+id/carbs_edit"
android:text="@string/overview_editquickwizard_carbs"
android:text="@string/overview_edit_quickwizard_carbs"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<EditText
@ -75,7 +75,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="@string/overview_editquickwizard_valid"
android:text="@string/overview_edit_quickwizard_valid"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView
@ -112,7 +112,7 @@
android:id="@+id/device_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizard_show_on_device"
android:text="@string/overview_edit_quickwizard_show_on_device"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioGroup
@ -141,7 +141,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizard_usebg"
android:text="@string/overview_edit_quickwizard_use_bg"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioGroup
@ -165,7 +165,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizard_usebolusiob"
android:text="@string/overview_edit_quickwizard_use_bolus_iob"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioGroup
@ -189,7 +189,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizard_usebasaliob"
android:text="@string/overview_edit_quickwizard_use_basal_iob"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioGroup
@ -211,12 +211,12 @@
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/positiveonly" />
android:text="@string/positive_only" />
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/negativeonly" />
android:text="@string/negative_only" />
</RadioGroup>
@ -249,7 +249,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizard_usetrend"
android:text="@string/overview_edit_quickwizard_use_trend"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioGroup
@ -271,19 +271,19 @@
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/positiveonly" />
android:text="@string/positive_only" />
<RadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/negativeonly" />
android:text="@string/negative_only" />
</RadioGroup>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizard_usesuperbolus"
android:text="@string/overview_edit_quickwizard_use_superbolus"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioGroup
@ -358,7 +358,7 @@
android:id="@+id/percentage_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/overview_editquickwizard_percentage"
android:text="@string/overview_edit_quickwizard_percentage"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<EditText

View file

@ -191,7 +191,7 @@
android:layout_marginBottom="-4dp"
android:visibility="gone"
app:srcCompat="@drawable/ic_loop_closed"
android:contentDescription="@string/apsmode_title" />
android:contentDescription="@string/aps_mode_title" />
<TextView
android:id="@+id/aps_mode_text"

View file

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".plugins.general.overview.activities.QuickWizardListActivity">
tools:context="info.nightscout.plugins.general.overview.activities.QuickWizardListActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
@ -19,7 +19,7 @@
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:clickable="true"
android:contentDescription="@string/addnew"
android:contentDescription="@string/add_new"
android:focusable="true"
android:src="@drawable/ic_add_black_24dp"
tools:ignore="RelativeOverlap" />

View file

@ -108,7 +108,7 @@
android:layout_gravity="top"
android:paddingStart="10dp"
android:paddingEnd="5dp"
android:text="@string/overview_editquickwizard_valid"
android:text="@string/overview_edit_quickwizard_valid"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<TextView

View file

@ -254,8 +254,16 @@
<string name="treatmentssafety_title">Treatments safety</string>
<!-- Overview -->
<string name="key_show_calibration_button" translatable="false">show_calibration_button</string>
<string name="key_show_cgm_button" translatable="false">show_cgm_button</string>
<string name="key_show_carbs_button" translatable="false">show_carbs_button</string>
<string name="key_show_wizard_button" translatable="false">show_wizard_button</string>
<string name="key_show_insulin_button" translatable="false">show_insulin_button</string>
<string name="key_show_treatment_button" translatable="false">show_treatment_button</string>
<string name="key_statuslights_copy_ns" translatable="false">statuslights_copy_ns</string>
<string name="key_statuslights_overview_advanced" translatable="false">statuslights_overview_advanced</string>
<string name="key_keep_screen_on" translatable="false">keep_screen_on</string>
<string name="key_short_tabtitles" translatable="false">short_tabtitles</string>
<string name="copy_existing_values">Copy NS settings (if exists)?</string>
<string name="key_show_statuslights" translatable="false">show_statuslights</string>
@ -296,10 +304,112 @@
<string name="a11y_bg_quality">blood glucose quality</string>
<string name="a11y_blood_glucose">blood glucose</string>
<string name="a11y_bg_outdated">outdated</string>
<string name="apsmode_title">APS Mode</string>
<string name="setbasalquestion">Accept new temp basal:</string>
<string name="aps_mode_title">APS Mode</string>
<string name="set_basal_question">Accept new temp basal:</string>
<string name="overview_cgm">CGM</string>
<string name="quickwizard">QuickWizard</string>
<string name="a11y_only_on_watch">only on watch</string>
<string name="a11y_only_on_phone">only on phone</string>
<string name="overview">Overview</string>
<string name="overview_shortname">HOME</string>
<string name="description_overview">Displays the current state of your loop and buttons for most common actions</string>
<string name="overview_editquickwizard_usecob">COB calculation</string>
<string name="overview_editquickwizard_usetemptarget">Temporary target calculation</string>
<string name="overview_editquickwizard_usepercentage">Percentage calculation</string>
<string name="overview_buttons_selection">Buttons</string>
<string name="show_calibration_button_summary">Sends a calibration to xDrip+ or open BYODA calibration dialog</string>
<string name="show_cgm_button_summary">Opens xDrip+ or BYODA, back buttons returns to AAPS</string>
<string name="dexcom_app_not_installed">Dexcom app is not installed.</string>
<string name="dexcom_app_not_detected">Please update your Dexcom app to supported version</string>
<string name="error_starting_cgm">Could not launch CGM application. Make sure it is installed.</string>
<string name="not_available_full">Not available</string>
<string name="constraints_violation">Constraints violation</string>
<string name="change_your_input">Change your input!</string>
<string name="openaps">OpenAPS</string>
<string name="uploader">Uploader</string>
<string name="data_status">BG data status</string>
<string name="quickwizard_settings">QuickWizard settings</string>
<string name="overview_edit_quickwizard_button_text">Button text:</string>
<string name="overview_edit_quickwizard_carbs">Carbs:</string>
<string name="overview_edit_quickwizard_valid">Valid:</string>
<string name="overview_edit_quickwizard_list_activity_add">Add</string>
<string name="overview_quickwizard_item_edit_button">Edit</string>
<string name="overview_edit_quickwizard_show_on_device">Show entry on device:</string>
<string name="overview_edit_quickwizard_use_bg">BG calculation</string>
<string name="overview_edit_quickwizard_use_bolus_iob">Bolus IOB calculation</string>
<string name="overview_edit_quickwizard_use_basal_iob">Basal IOB calculation</string>
<string name="overview_edit_quickwizard_use_trend">Trend calculation</string>
<string name="overview_edit_quickwizard_use_superbolus">Superbolus calculation</string>
<string name="overview_edit_quickwizard_percentage">Percentage</string>
<string name="device_all">All</string>
<string name="device_phone">Phone</string>
<string name="device_watch">Watch</string>
<string name="positive_only">Positive only</string>
<string name="negative_only">Negative only</string>
<string name="app_default">Application default</string>
<string name="a11y_drag_and_drop_handle">drag and drop handle</string>
<string name="keep_screen_on_title">Keep screen on</string>
<string name="keep_screen_on_summary">Prevent Android to turn screen off. It will consume lot of energy when not plugged to power outlet.</string>
<string name="treatments">Treatments</string>
<string name="carb_increment_button_message">Number of carbs to add when button is pressed</string>
<string name="insulin_increment_button_message">Amount of insulin to add when button is pressed</string>
<string name="firstinsulinincrement">First insulin increment</string>
<string name="secondinsulinincrement">Second insulin increment</string>
<string name="thirdinsulinincrement">Third insulin increment</string>
<string name="firstcarbsincrement">First carbs increment</string>
<string name="secondcarbsincrement">Second carbs increment</string>
<string name="thirdcarbsincrement">Third carbs increment</string>
<string name="cgm">CGM</string>
<string name="default_temptargets">Default Temp-Targets</string>
<string name="eatingsoon_duration">eatingsoon duration</string>
<string name="eatingsoon_target">eatingsoon target</string>
<string name="activity_duration">activity duration</string>
<string name="activity_target">activity target</string>
<string name="hypo_duration">hypo duration</string>
<string name="hypo_target">hypo target</string>
<string name="fill_bolus_title">Fill/Prime standard insulin amounts</string>
<string name="button1">Button 1</string>
<string name="button2">Button 2</string>
<string name="button3">Button 3</string>
<string name="prefs_range_title">Range for Visualization</string>
<string name="prefs_range_summary">High and low mark for the charts in Overview and Smartwatch</string>
<string name="low_mark">LOW mark</string>
<string name="high_mark">HIGH mark</string>
<string name="short_tabtitles">Shorten tab titles</string>
<string name="overview_show_notes_field_in_dialogs_title">Show notes field in treatment dialogs</string>
<string name="deliverpartofboluswizard">Bolus wizard performs calculation but only this part of calculated insulin is delivered. Useful with SMB algorithm.</string>
<string name="enable_bolus_advisor">Enable bolus advisor</string>
<string name="enable_bolus_advisor_summary">Use reminder to start eating later instead of wizard result during high glycemia ("pre-bolus")</string>
<string name="enablesuperbolus">Enable superbolus in wizard</string>
<string name="enablesuperbolus_summary">Enable superbolus functionality in wizard. Do not enable until you learn what it really does. IT MAY CAUSE INSULIN OVERDOSE IF USED BLINDLY!</string>
<string name="enablebolusreminder">Enable bolus reminder</string>
<string name="enablebolusreminder_summary">Use reminder to bolus later with wizard ("post-bolus")</string>
<!-- OverviewMenu-->
<string name="key_graph_config" translatable="false">graphconfig</string>
<string name="overview_show_predictions">Predictions</string>
<string name="overview_show_treatments">Treatments</string>
<string name="overview_show_deviation_slope">Deviation slope</string>
<string name="overview_show_activity">Activity</string>
<string name="overview_show_bgi">Blood Glucose Impact</string>
<string name="overview_show_sensitivity">Sensitivity</string>
<string name="overview_show_deviations">Deviations</string>
<string name="overview_show_cob">Carbs On Board</string>
<string name="overview_show_iob">Insulin On Board</string>
<string name="overview_show_basals">Basals</string>
<string name="overview_show_abs_insulin">Absolute insulin</string>
<string name="prediction_shortname">PRED</string>
<string name="basal_shortname">BAS</string>
<string name="deviation_shortname">DEV</string>
<string name="activity_shortname">ACT</string>
<string name="bgi_shortname">-BGI</string>
<string name="abs_insulin_shortname">ABS</string>
<string name="devslope_shortname">DEVSLOPE</string>
<string name="treatments_shortname">TREAT</string>
<string name="sensitivity_shortname">SENS</string>
<string name="graph_scale">Graph scale</string>
<string name="graph_menu_divider_header">Graph</string>
<!-- NSClient -->
<string name="key_ns_client_autoscroll" translatable="false">ns_client_autoscroll</string>

View file

@ -13,7 +13,7 @@
android:entries="@array/aps_modeArray"
android:entryValues="@array/aps_modeValues"
android:key="@string/key_aps_mode"
android:title="@string/apsmode_title" />
android:title="@string/aps_mode_title" />
<info.nightscout.core.validators.ValidatingEditTextPreference
android:defaultValue="20"

View file

@ -138,7 +138,7 @@
<Preference
android:key="quickwizard"
android:title="@string/quickwizardsettings">
android:title="@string/quickwizard_settings">
<intent android:action="info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity" />
</Preference>

View file

@ -1,7 +1,9 @@
package info.nightscout.plugins.constraints.bgQualityCheck
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.iob.IobCobCalculator
@ -43,7 +45,7 @@ class BgQualityCheckPlugin @Inject constructor(
.showInList(false)
.pluginName(R.string.bg_quality),
aapsLogger, rh, injector
), Constraints {
), Constraints, BgQualityCheck {
private var disposable: CompositeDisposable = CompositeDisposable()
@ -68,7 +70,7 @@ class BgQualityCheckPlugin @Inject constructor(
}
var state: State = State.UNKNOWN
var message: String = ""
override var message: String = ""
// Fallback to LGS if BG values are doubled
override fun applyMaxIOBConstraints(maxIob: Constraint<Double>): Constraint<Double> =
@ -100,7 +102,7 @@ class BgQualityCheckPlugin @Inject constructor(
}
}
fun icon(): Int =
@DrawableRes override fun icon(): Int =
when (state) {
State.UNKNOWN -> 0
State.FIVE_MIN_DATA -> 0
@ -108,7 +110,7 @@ class BgQualityCheckPlugin @Inject constructor(
State.DOUBLED -> R.drawable.ic_baseline_warning_24_red
}
fun stateDescription(): String =
override fun stateDescription(): String =
when (state) {
State.RECALCULATED -> rh.gs(R.string.a11y_bg_quality_recalculated)
State.DOUBLED -> rh.gs(R.string.a11y_bg_quality_doubles)

View file

@ -2,7 +2,9 @@ package info.nightscout.plugins.support.di
import dagger.Binds
import dagger.Module
import info.nightscout.interfaces.bgQualityCheck.BgQualityCheck
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
import info.nightscout.plugins.constraints.bgQualityCheck.BgQualityCheckPlugin
import info.nightscout.plugins.constraints.versionChecker.VersionCheckerUtilsImpl
@Module(
@ -17,5 +19,6 @@ abstract class PluginsSupportModule {
interface Bindings {
@Binds fun bindProcessedDeviceStatusData(versionCheckerUtils: VersionCheckerUtilsImpl): VersionCheckerUtils
@Binds fun bindBgQualityCheck(bgQualityCheck: BgQualityCheckPlugin): BgQualityCheck
}
}

View file

@ -16,7 +16,9 @@ import info.nightscout.shared.utils.T
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.ArgumentMatchers.any
import org.mockito.Mock
import org.mockito.Mockito.anyInt
import org.mockito.Mockito.`when`
class BgQualityCheckPluginTest : TestBase() {
@ -46,6 +48,8 @@ class BgQualityCheckPluginTest : TestBase() {
dateUtil
)
`when`(iobCobCalculator.ads).thenReturn(autosensDataStore)
`when`(rh.gs(anyInt())).thenReturn("")
`when`(rh.gs(anyInt(), any(), any())).thenReturn("")
}
@Test

View file

@ -41,15 +41,10 @@
<string name="format_bg_isf">%1$s ISF: %2$.1f</string>
<string name="format_cob_ic">%1$.1fg IC: %2$.1f</string>
<string name="format_carbs_ic">%1$.0fg IC: %2$.1f</string>
<string name="superbolus">Superbolus</string>
<string name="treatments_wizard_total_label">Total</string>
<!-- FillDialog -->
<string name="fill_warning">Please make sure the amount matches the specification of your infusion set!</string>
<string name="fill_bolus_title">Fill/Prime standard insulin amounts</string>
<string name="button1">Button 1</string>
<string name="button2">Button 2</string>
<string name="button3">Button 3</string>
<string name="record_pump_site_change">Record pump site change</string>
<string name="record_insulin_cartridge_change">Record insulin cartridge change</string>