move Loop to plugins
This commit is contained in:
parent
232b44b153
commit
562870723e
|
@ -121,7 +121,7 @@
|
|||
</receiver>
|
||||
|
||||
<!-- Receive ignore 5m, 15m, 30m requests for carb notifications -->
|
||||
<receiver android:name=".plugins.aps.loop.CarbSuggestionReceiver" />
|
||||
<receiver android:name="info.nightscout.plugins.aps.loop.CarbSuggestionReceiver" />
|
||||
|
||||
<!-- Auto start -->
|
||||
<receiver
|
||||
|
|
|
@ -23,7 +23,7 @@ import info.nightscout.androidaps.danar.DanaRPlugin
|
|||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
||||
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
||||
|
|
|
@ -11,7 +11,7 @@ import info.nightscout.androidaps.implementations.ActivityNamesImpl
|
|||
import info.nightscout.androidaps.interfaces.stats.DexcomTirCalculator
|
||||
import info.nightscout.androidaps.interfaces.stats.TddCalculator
|
||||
import info.nightscout.androidaps.interfaces.stats.TirCalculator
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImpl
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.di
|
|||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.activities.MyPreferenceFragment
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopFragment
|
||||
import info.nightscout.plugins.aps.loop.LoopFragment
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderFragment
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment
|
||||
import info.nightscout.androidaps.plugins.general.overview.OverviewFragment
|
||||
|
|
|
@ -10,7 +10,7 @@ import info.nightscout.androidaps.danar.DanaRPlugin
|
|||
import info.nightscout.androidaps.danars.DanaRSPlugin
|
||||
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
|
||||
import info.nightscout.androidaps.plugin.general.openhumans.OpenHumansUploaderPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.androidaps.plugins.general.dataBroadcaster.DataBroadcastPlugin
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
|
||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.androidaps.di
|
|||
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.aps.loop.CarbSuggestionReceiver
|
||||
import info.nightscout.plugins.aps.loop.CarbSuggestionReceiver
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBluetoothStateReceiver
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkBroadcastReceiver
|
||||
import info.nightscout.androidaps.receivers.AutoStartReceiver
|
||||
|
|
|
@ -26,7 +26,7 @@ import javax.inject.Inject
|
|||
|
||||
class ActivityNamesImpl @Inject constructor() : ActivityNames {
|
||||
|
||||
override val mainActivityClass: Class<*> = MainActivity::class.java
|
||||
override val mainActivity: Class<*> = MainActivity::class.java
|
||||
override val tddStatsActivity: Class<*> = TDDStatsActivity::class.java
|
||||
override val historyBrowseActivity: Class<*> = HistoryBrowseActivity::class.java
|
||||
override val errorHelperActivity: Class<*> = ErrorHelperActivity::class.java
|
||||
|
|
|
@ -34,7 +34,7 @@ import info.nightscout.androidaps.events.EventNewBG
|
|||
import info.nightscout.androidaps.extensions.directionToIcon
|
||||
import info.nightscout.androidaps.extensions.valueToUnitsString
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
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
|
||||
|
|
|
@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.general.wear
|
|||
import android.content.Context
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
|
||||
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataHandlerMobile
|
||||
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataLayerListenerServiceMobileHelper
|
||||
|
|
|
@ -17,6 +17,7 @@ class ConfigImpl @Inject constructor() : Config {
|
|||
override val PUMPDRIVERS = BuildConfig.FLAVOR == "full" || BuildConfig.FLAVOR == "pumpcontrol"
|
||||
override val FLAVOR = BuildConfig.FLAVOR
|
||||
override val VERSION_NAME = BuildConfig.VERSION_NAME
|
||||
override val BUILD_VERSION = BuildConfig.BUILDVERSION
|
||||
override val DEBUG = BuildConfig.DEBUG
|
||||
|
||||
override val currentDeviceModelString =
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="aps_modeArray">
|
||||
<item>@string/closedloop</item>
|
||||
<item>@string/openloop</item>
|
||||
<item>@string/lowglucosesuspend</item>
|
||||
</string-array>
|
||||
<string-array name="aps_modeValues" translatable="false">
|
||||
<item>closed</item>
|
||||
<item>open</item>
|
||||
<item>lgs</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="unitsArray">
|
||||
<item>mg/dL</item>
|
||||
<item>mmol/L</item>
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
<string name="reset_db_confirm">Do you really want to reset the databases?</string>
|
||||
<string name="nav_exit">Exit</string>
|
||||
<string name="description_config_builder">Used for configuring the active plugins</string>
|
||||
<string name="description_loop">Activate or deactivate the implementation triggering the loop.</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="description_sensitivity_aaps">Sensitivity is calculated the same way like Oref0, but you can specify timeframe to the past. Minimal carb absorption is calculated from max carb absorption time from preferences.</string>
|
||||
|
@ -65,16 +64,10 @@
|
|||
<string name="configbuilder_constraints_description">Which constraints are applied?</string>
|
||||
<string name="configbuilder_loop">Loop</string>
|
||||
<string name="configbuilder_loop_description">Use this to activate AAPS\' loop integration.</string>
|
||||
<string name="loop_aps_label">APS</string>
|
||||
<string name="loop_constraintsprocessed_label">After processed constraints</string>
|
||||
<string name="loop_tbrsetbypump_label">Temp basal set by pump</string>
|
||||
<string name="noapsselected">NO APS SELECTED OR PROVIDED RESULT</string>
|
||||
<string name="constraints_violation">Constraints violation</string>
|
||||
<string name="changeyourinput">Change your input!</string>
|
||||
<string name="configbuilder_bgsource">BG Source</string>
|
||||
<string name="configbuilder_bgsource_description">Where should AAPS gain it\'s data from?</string>
|
||||
<string name="openloop_newsuggestion">New suggestion available</string>
|
||||
<string name="carbssuggestion">Carbs Suggestion</string>
|
||||
<string name="profile_label">Profile</string>
|
||||
<string name="configbuilder_nightscoutversion_label">Nightscout version:</string>
|
||||
<string name="exported">Preferences exported</string>
|
||||
|
@ -115,7 +108,6 @@
|
|||
<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="pumpNotInitialized">Pump not initialized!</string>
|
||||
<string name="units">Units</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>
|
||||
|
@ -127,7 +119,6 @@
|
|||
<string name="ongoingnotificaction">Ongoing Notification</string>
|
||||
<string name="old_data">OLD DATA</string>
|
||||
<string name="configbuilder_shortname">CONF</string>
|
||||
<string name="loop_shortname">LOOP</string>
|
||||
<string name="overview_shortname">HOME</string>
|
||||
<string name="treatments_shortname">TREAT</string>
|
||||
<string name="wear_shortname">WEAR</string>
|
||||
|
@ -179,7 +170,6 @@
|
|||
<string name="sensitivityweightedaverage">Sensitivity WeightedAverage</string>
|
||||
<string name="notloadedplugins">Not all profiles loaded!</string>
|
||||
<string name="valuesnotstored">Values not stored!</string>
|
||||
<string name="key_smb_enable_carbs_suggestions_threshold" translatable="false">smb_enable_carbs_suggestions_threshold</string>
|
||||
<string name="invalid">INVALID</string>
|
||||
<string name="default_temptargets">Default Temp-Targets</string>
|
||||
<string name="eatingsoon_duration">eatingsoon duration</string>
|
||||
|
@ -220,9 +210,6 @@
|
|||
<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="ignore5m">Ignore 5m</string>
|
||||
<string name="ignore15m">Ignore 15m</string>
|
||||
<string name="ignore30m">Ignore 30m</string>
|
||||
<string name="wear_notifysmb_title">Notify on SMB</string>
|
||||
<string name="wear_notifysmb_summary">Show SMB on the watch like a standard bolus.</string>
|
||||
<string name="wear_predictions_summary">Show the predictions on the watchface.</string>
|
||||
|
@ -232,7 +219,6 @@
|
|||
<string name="allow_automated_crash_reporting">Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service.</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="loop_smbsetbypump_label">SMB set by pump</string>
|
||||
<string name="overview_show_activity">Activity</string>
|
||||
<string name="overview_show_bgi">Blood Glucose Impact</string>
|
||||
<string name="overview_show_sensitivity">Sensitivity</string>
|
||||
|
@ -241,8 +227,6 @@
|
|||
<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="smb_frequency_exceeded">A bolus was delivered within the last 3 minutes, skipping SMB</string>
|
||||
<string name="basal_set_correctly">Basal set correctly</string>
|
||||
<string name="iobcobcalculator" translatable="false">IobCobCalculator</string>
|
||||
<string name="absorption_cutoff_title">Meal max absorption time [h]</string>
|
||||
<string name="absorption_cutoff_summary">Time at which any meal is considered absorbed. Remaining carbs will be cut off.</string>
|
||||
|
@ -311,8 +295,6 @@
|
|||
<string name="resettodefaults">Reset to defaults</string>
|
||||
<string name="setupwizard_preferred_aps_mode">Preferred APS mode</string>
|
||||
<string name="sendlogfiles">Send today\'s log files to developers along with this time. Unexpected situation.</string>
|
||||
<string name="loop_openmode_min_change">Minimal request change [%]</string>
|
||||
<string name="loop_openmode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</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>
|
||||
|
@ -327,10 +309,6 @@
|
|||
<string name="key_wear_detailed_delta" translatable="false">wear_detailed_delta</string>
|
||||
<string name="chartmenu">Chart menu</string>
|
||||
<string name="databroadcaster" translatable="false">Data Broadcaster</string>
|
||||
<string name="loop_smbrequest_time_label">SMB request time</string>
|
||||
<string name="loop_smbexecution_time_label">SMB execution time</string>
|
||||
<string name="loop_tbrrequest_time_label">Temp basal request time</string>
|
||||
<string name="loop_tbrexecution_time_label">Temp basal execution time</string>
|
||||
<string name="overview_show_predictions">Predictions</string>
|
||||
<string name="overview_show_treatments">Treatments</string>
|
||||
<string name="overview_show_deviationslope">Deviation slope</string>
|
||||
|
|
|
@ -19,6 +19,8 @@ import info.nightscout.interfaces.profile.ProfileFunction
|
|||
import info.nightscout.interfaces.pump.defs.PumpDescription
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.plugins.aps.loop.LoopFragment
|
||||
import info.nightscout.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.plugins.configBuilder.RunningConfiguration
|
||||
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
|
|
|
@ -9,6 +9,7 @@ interface Config {
|
|||
val PUMPDRIVERS: Boolean
|
||||
val FLAVOR: String
|
||||
val VERSION_NAME: String
|
||||
val BUILD_VERSION: String
|
||||
val DEBUG: Boolean
|
||||
val currentDeviceModelString : String
|
||||
val appName: Int
|
||||
|
|
|
@ -11,7 +11,7 @@ import androidx.fragment.app.FragmentManager
|
|||
*/
|
||||
interface ActivityNames {
|
||||
|
||||
val mainActivityClass: Class<*>
|
||||
val mainActivity: Class<*>
|
||||
val tddStatsActivity: Class<*>
|
||||
val historyBrowseActivity: Class<*>
|
||||
val errorHelperActivity: Class<*>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.aps.loop
|
||||
package info.nightscout.plugins.aps.loop
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.aps.loop
|
||||
package info.nightscout.plugins.aps.loop
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
|
@ -12,15 +12,15 @@ import android.view.ViewGroup
|
|||
import androidx.core.view.MenuProvider
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.LoopFragmentBinding
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
import info.nightscout.core.fabric.FabricPrivacy
|
||||
import info.nightscout.core.pump.toHtml
|
||||
import info.nightscout.interfaces.aps.Loop
|
||||
import info.nightscout.interfaces.constraints.Constraint
|
||||
import info.nightscout.interfaces.utils.HtmlHelper
|
||||
import info.nightscout.plugins.R
|
||||
import info.nightscout.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
import info.nightscout.plugins.databinding.LoopFragmentBinding
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.bus.RxBus
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
|
@ -73,7 +73,7 @@ class LoopFragment : DaggerFragment(), MenuProvider {
|
|||
}
|
||||
|
||||
override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
|
||||
menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.run_now)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
|
||||
menu.setGroupDividerEnabled(true)
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.aps.loop
|
||||
package info.nightscout.plugins.aps.loop
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.NotificationChannel
|
||||
|
@ -12,17 +12,11 @@ import android.os.HandlerThread
|
|||
import android.os.SystemClock
|
||||
import androidx.core.app.NotificationCompat
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.BuildConfig
|
||||
import info.nightscout.androidaps.MainActivity
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
||||
import info.nightscout.androidaps.extensions.convertedToAbsolute
|
||||
import info.nightscout.androidaps.extensions.convertedToPercent
|
||||
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
import info.nightscout.androidaps.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
|
||||
import info.nightscout.androidaps.receivers.ReceiverStatusStore
|
||||
|
@ -58,6 +52,10 @@ import info.nightscout.interfaces.queue.Callback
|
|||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.HardLimits
|
||||
import info.nightscout.plugins.R
|
||||
import info.nightscout.plugins.aps.loop.events.EventLoopSetLastRunGui
|
||||
import info.nightscout.plugins.aps.loop.events.EventLoopUpdateGui
|
||||
import info.nightscout.plugins.aps.loop.events.EventNewOpenLoopNotification
|
||||
import info.nightscout.plugins.configBuilder.RunningConfiguration
|
||||
import info.nightscout.plugins.pump.virtual.VirtualPumpPlugin
|
||||
import info.nightscout.plugins.sync.nsclient.extensions.buildDeviceStatus
|
||||
|
@ -87,7 +85,7 @@ class LoopPlugin @Inject constructor(
|
|||
private val aapsSchedulers: AapsSchedulers,
|
||||
private val rxBus: RxBus,
|
||||
private val sp: SP,
|
||||
config: Config,
|
||||
private val config: Config,
|
||||
private val constraintChecker: Constraints,
|
||||
rh: ResourceHelper,
|
||||
private val profileFunction: ProfileFunction,
|
||||
|
@ -253,7 +251,7 @@ class LoopPlugin @Inject constructor(
|
|||
|
||||
// Check if we have any result
|
||||
if (apsResult == null) {
|
||||
rxBus.send(EventLoopSetLastRunGui(rh.gs(R.string.noapsselected)))
|
||||
rxBus.send(EventLoopSetLastRunGui(rh.gs(R.string.no_aps_selected)))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -299,7 +297,7 @@ class LoopPlugin @Inject constructor(
|
|||
buildDeviceStatus(
|
||||
dateUtil, this, iobCobCalculator, profileFunction,
|
||||
activePlugin.activePump, receiverStatusStore, runningConfiguration,
|
||||
BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION
|
||||
config.VERSION_NAME + "-" + config.BUILD_VERSION
|
||||
)?.also {
|
||||
repository.insert(it)
|
||||
}
|
||||
|
@ -345,7 +343,7 @@ class LoopPlugin @Inject constructor(
|
|||
val actionIgnore30m = NotificationCompat.Action(R.drawable.ic_notif_aaps, rh.gs(R.string.ignore30m, "Ignore 30m"), pendingIntent30m)
|
||||
val builder = NotificationCompat.Builder(context, CHANNEL_ID)
|
||||
builder.setSmallIcon(R.drawable.notif_icon)
|
||||
.setContentTitle(rh.gs(R.string.carbssuggestion))
|
||||
.setContentTitle(rh.gs(R.string.carbs_suggestion))
|
||||
.setContentText(resultAfterConstraints.carbsRequiredText)
|
||||
.setAutoCancel(true)
|
||||
.setPriority(Notification.IMPORTANCE_HIGH)
|
||||
|
@ -430,7 +428,7 @@ class LoopPlugin @Inject constructor(
|
|||
if (resultAfterConstraints.isChangeRequested && allowNotification) {
|
||||
val builder = NotificationCompat.Builder(context, CHANNEL_ID)
|
||||
builder.setSmallIcon(R.drawable.notif_icon)
|
||||
.setContentTitle(rh.gs(R.string.openloop_newsuggestion))
|
||||
.setContentTitle(rh.gs(R.string.open_loop_new_suggestion))
|
||||
.setContentText(resultAfterConstraints.toString())
|
||||
.setAutoCancel(true)
|
||||
.setPriority(Notification.IMPORTANCE_HIGH)
|
||||
|
@ -458,14 +456,14 @@ class LoopPlugin @Inject constructor(
|
|||
|
||||
private fun presentSuggestion(builder: NotificationCompat.Builder) {
|
||||
// Creates an explicit intent for an Activity in your app
|
||||
val resultIntent = Intent(context, MainActivity::class.java)
|
||||
val resultIntent = Intent(context, activityNames.mainActivity)
|
||||
|
||||
// The stack builder object will contain an artificial back stack for the
|
||||
// started Activity.
|
||||
// This ensures that navigating backward from the Activity leads out of
|
||||
// your application to the Home screen.
|
||||
val stackBuilder = TaskStackBuilder.create(context)
|
||||
stackBuilder.addParentStack(MainActivity::class.java)
|
||||
stackBuilder.addParentStack(activityNames.mainActivity)
|
||||
// Adds the Intent that starts the Activity to the top of the stack
|
||||
stackBuilder.addNextIntent(resultIntent)
|
||||
val resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
|
@ -492,7 +490,7 @@ class LoopPlugin @Inject constructor(
|
|||
rxBus.send(
|
||||
EventMobileToWear(
|
||||
EventData.OpenLoopRequest(
|
||||
rh.gs(R.string.openloop_newsuggestion),
|
||||
rh.gs(R.string.open_loop_new_suggestion),
|
||||
it.constraintsProcessed.toString(),
|
||||
EventData.OpenLoopRequestConfirmed(dateUtil.now())
|
||||
)
|
||||
|
@ -515,7 +513,7 @@ class LoopPlugin @Inject constructor(
|
|||
buildDeviceStatus(
|
||||
dateUtil, this@LoopPlugin, iobCobCalculator, profileFunction,
|
||||
activePlugin.activePump, receiverStatusStore, runningConfiguration,
|
||||
BuildConfig.VERSION_NAME + "-" + BuildConfig.BUILDVERSION
|
||||
config.VERSION_NAME + "-" + config.BUILD_VERSION
|
||||
)?.also {
|
||||
repository.insert(it)
|
||||
}
|
||||
|
@ -540,8 +538,8 @@ class LoopPlugin @Inject constructor(
|
|||
}
|
||||
val pump = activePlugin.activePump
|
||||
if (!pump.isInitialized()) {
|
||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: " + rh.gs(R.string.pumpNotInitialized))
|
||||
callback?.result(PumpEnactResult(injector).comment(R.string.pumpNotInitialized).enacted(false).success(false))?.run()
|
||||
aapsLogger.debug(LTag.APS, "applyAPSRequest: " + rh.gs(R.string.pump_not_initialized))
|
||||
callback?.result(PumpEnactResult(injector).comment(R.string.pump_not_initialized).enacted(false).success(false))?.run()
|
||||
return
|
||||
}
|
||||
if (pump.isSuspended()) {
|
||||
|
@ -640,8 +638,8 @@ class LoopPlugin @Inject constructor(
|
|||
return
|
||||
}
|
||||
if (!pump.isInitialized()) {
|
||||
aapsLogger.debug(LTag.APS, "applySMBRequest: " + rh.gs(R.string.pumpNotInitialized))
|
||||
callback?.result(PumpEnactResult(injector).comment(R.string.pumpNotInitialized).enacted(false).success(false))?.run()
|
||||
aapsLogger.debug(LTag.APS, "applySMBRequest: " + rh.gs(R.string.pump_not_initialized))
|
||||
callback?.result(PumpEnactResult(injector).comment(R.string.pump_not_initialized).enacted(false).success(false))?.run()
|
||||
return
|
||||
}
|
||||
if (pump.isSuspended()) {
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.aps.loop.events
|
||||
package info.nightscout.plugins.aps.loop.events
|
||||
|
||||
import info.nightscout.rx.events.EventUpdateGui
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.aps.loop.events
|
||||
package info.nightscout.plugins.aps.loop.events
|
||||
|
||||
import info.nightscout.rx.events.EventUpdateGui
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.aps.loop.events
|
||||
package info.nightscout.plugins.aps.loop.events
|
||||
|
||||
import info.nightscout.rx.events.Event
|
||||
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
|
@ -3,7 +3,7 @@
|
|||
android:id="@+id/swipeRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".plugins.aps.loop.LoopFragment">
|
||||
tools:context=".aps.loop.LoopFragment">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -27,7 +27,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/openapsma_last_run_label"
|
||||
android:text="@string/last_run_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/openapsma_request_label"
|
||||
android:text="@string/request_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -175,7 +175,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/loop_constraintsprocessed_label"
|
||||
android:text="@string/loop_constraints_processed_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -271,7 +271,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/loop_tbrrequest_time_label"
|
||||
android:text="@string/loop_tbr_request_time_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -319,7 +319,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/loop_tbrexecution_time_label"
|
||||
android:text="@string/loop_tbr_execution_time_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -367,7 +367,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/loop_tbrsetbypump_label"
|
||||
android:text="@string/loop_tbr_set_by_pump_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -415,7 +415,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/loop_smbrequest_time_label"
|
||||
android:text="@string/loop_smb_request_time_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -463,7 +463,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/loop_smbexecution_time_label"
|
||||
android:text="@string/loop_smb_execution_time_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
@ -511,7 +511,7 @@
|
|||
android:layout_weight="2"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:text="@string/loop_smbsetbypump_label"
|
||||
android:text="@string/loop_smb_set_by_pump_label"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textSize="14sp" />
|
||||
|
|
@ -59,4 +59,15 @@
|
|||
<item>@string/key_pregnant</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="aps_modeArray">
|
||||
<item>@string/closedloop</item>
|
||||
<item>@string/openloop</item>
|
||||
<item>@string/lowglucosesuspend</item>
|
||||
</string-array>
|
||||
<string-array name="aps_modeValues" translatable="false">
|
||||
<item>closed</item>
|
||||
<item>open</item>
|
||||
<item>lgs</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
|
@ -564,4 +564,34 @@
|
|||
<string name="largedisplay_description">Large display</string>
|
||||
<string name="skin">Skin</string>
|
||||
|
||||
<!-- Loop -->
|
||||
<string name="key_smb_enable_carbs_suggestions_threshold" translatable="false">smb_enable_carbs_suggestions_threshold</string>
|
||||
|
||||
<string name="executing">Executing</string>
|
||||
<string name="run_now">Run now</string>
|
||||
<string name="smb_frequency_exceeded">A bolus was delivered within the last 3 minutes, skipping SMB</string>
|
||||
<string name="pump_not_initialized">Pump not initialized!</string>
|
||||
<string name="loop_shortname">LOOP</string>
|
||||
<string name="description_loop">Activate or deactivate the implementation triggering the loop.</string>
|
||||
<string name="no_aps_selected">NO APS SELECTED OR PROVIDED RESULT</string>
|
||||
<string name="ignore5m">Ignore 5m</string>
|
||||
<string name="ignore15m">Ignore 15m</string>
|
||||
<string name="ignore30m">Ignore 30m</string>
|
||||
<string name="carbs_suggestion">Carbs Suggestion</string>
|
||||
<string name="open_loop_new_suggestion">New suggestion available</string>
|
||||
<string name="basal_set_correctly">Basal set correctly</string>
|
||||
<string name="last_run_label">Last run</string>
|
||||
<string name="loop_aps_label">APS</string>
|
||||
<string name="request_label">Request</string>
|
||||
<string name="loop_constraints_processed_label">After processed constraints</string>
|
||||
<string name="constraints">Constraints</string>
|
||||
<string name="loop_tbr_request_time_label">Temp basal request time</string>
|
||||
<string name="loop_tbr_execution_time_label">Temp basal execution time</string>
|
||||
<string name="loop_tbr_set_by_pump_label">Temp basal set by pump</string>
|
||||
<string name="loop_smb_request_time_label">SMB request time</string>
|
||||
<string name="loop_smb_execution_time_label">SMB execution time</string>
|
||||
<string name="loop_smb_set_by_pump_label">SMB set by pump</string>
|
||||
<string name="loop_open_mode_min_change">Minimal request change [%]</string>
|
||||
<string name="loop_open_mode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string>
|
||||
|
||||
</resources>
|
|
@ -17,14 +17,14 @@
|
|||
|
||||
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
|
||||
android:defaultValue="20"
|
||||
android:dialogMessage="@string/loop_openmode_min_change_summary"
|
||||
android:dialogMessage="@string/loop_open_mode_min_change_summary"
|
||||
android:digits="0123456789"
|
||||
android:inputType="number"
|
||||
android:key="@string/key_loop_openmode_min_change"
|
||||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/loop_openmode_min_change"
|
||||
android:title="@string/loop_open_mode_min_change"
|
||||
validate:maxNumber="50"
|
||||
validate:minNumber="0"
|
||||
validate:testType="numericRange" />
|
|
@ -107,7 +107,7 @@ class Widget : AppWidgetProvider() {
|
|||
val alpha = sp.getInt(WidgetConfigureActivity.PREF_PREFIX_KEY + appWidgetId, WidgetConfigureActivity.DEFAULT_OPACITY)
|
||||
|
||||
// Create an Intent to launch MainActivity when clicked
|
||||
val intent = Intent(context, activityNames.mainActivityClass).also { it.action = intentAction }
|
||||
val intent = Intent(context, activityNames.mainActivity).also { it.action = intentAction }
|
||||
val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
// Widgets allow click handlers to only launch pending intents
|
||||
views.setOnClickPendingIntent(R.id.widget_layout, pendingIntent)
|
||||
|
|
Loading…
Reference in a new issue