diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index df917c1f79..ca9466e1ea 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -86,10 +86,6 @@
android:name=".activities.HistoryBrowseActivity"
android:exported="false"
android:theme="@style/AppTheme" />
-
Receive BG values from xDrip+.
Saves all treatments that were made
Monitor and control AAPS using your WearOS watch.
- Insulin:
- Carbs:
- IOB:
- Total IOB:
- Total IOB activity:
- Dur:
- Ratio:
- Ins:
- IOB:
- Total IOB:
- TT
- Corr
- Bolus IOB
Run now
VIRTUAL PUMP
Last run
@@ -136,7 +123,6 @@
Plugin is disabled
Constraints violation
Accept new temp basal:
- Treatment
Change your input!
BG Source
Where should AAPS gain it\'s data from?
@@ -148,7 +134,6 @@
New suggestion available
Carbs Suggestion
Unsupported version of Nightscout
- Basal IOB
Carb time
Profile
TempBasal
@@ -196,7 +181,6 @@
Valid:
Add
Edit
- Meal
Corr
Actions
(DANGEROUS TO DISABLE) NS upload only
@@ -225,8 +209,6 @@
Autosens data
Script debug
Use Autosens feature
- Refresh from NS
- Delete treatments in the future
ACT
CONF
LOOP
@@ -305,9 +287,6 @@
10 hours
Resume
Reconnect Pump
- 15min trend
- COB
- Superbolus
Log app start to NS
Exiting application to apply settings.
Which type of insulin are you using?
@@ -597,7 +576,6 @@
Virtual Pump Type
Pump Definition
Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s
- Wizard Settings
wearwizard_bg
wearwizard_tt
wearwizard_trend
@@ -644,9 +622,6 @@
Sensitivity raises target
When sensitivity is detected, raise the target glucose
keep_screen_on
- Remove AAPS started entries
- Show invalidated
- Hide invalidated
Remove items
Sort items
Stored settings found
@@ -673,8 +648,6 @@
NSClient malfunction. Consider NS and NSClient restart.
aps_mode
Preferred APS mode
- Total
- Calc
Send today\'s log files to developers along with this time. Unexpected situation.
Minimal request change [%]
Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%
@@ -725,10 +698,6 @@
Deliver this part of bolus wizard result [%]
Bolus wizard performs calculation but only this part of calculated insulin is delivered. Useful with SMB algorithm.
Increasing max basal value because setting is lower than your max basal in profile
- %1$s ISF: %2$.1f
- %1$.0fg IC: %2$.1f
- %1$.1fg IC: %2$.1f
- %1$d%%
Selected:
Units
wizard_calculation_visible
@@ -739,7 +708,6 @@
Select units you want to display values in
wear_detailediob
wear_showbgi
- Create new profile from this profile?
Lower value of in range area (display only)
Higher value of in range area (display only)
Invalid % entry
@@ -803,7 +771,6 @@
Chart menu
Clear filter
Cannula
- User entry
Use values of your largest food you usually eat\n
This identification will attached to crash reports so we can contact you in urgent cases. It\'s optional.
Email address
@@ -811,31 +778,24 @@
You can provide optional email address if you want to be notified about app crashes. This is not an automated service. You will be contacted by developers in dangerous situations.
Full synchronization
Full synchronization? It may take many hours and until finish you\'ll not see new data in NS.
- Prime
Synchronization
ns_upload
Profiles, boluses, carbs, temporary basals are uploaded to NS
Upload data to NS
Receive profile store
Synchronize profiles from NS profile editor
- ns_receive_temp_target
Receive temporary targets
Accept temporary targets entered through NS or NSClient
- ns_receive_profile_switch
- ns_receive_offline_event
Receive profile switches
Accept profile switches entered through NS or NSClient
Receive APS offline events
Accept APS Offline events entered through NS or NSClient
Receive TBR and EB
Accept TBR and EB entered through another instance
- ns_receive_insulin
Receive insulin
Accept insulin entered through NS or NSClient (it\'s not delivered, only calculated towards IOB)
- ns_receive_carbs
Receive carbs
Accept carbs entered through NS or NSClient
- ns_receive_therapy_events
ns_receive_tbr_eb
Receive therapy events
Accept therapy events (cannula, insulin, battery change etc) entered through NS or NSClient
@@ -896,22 +856,9 @@
Unknown action command:
Percentage
Application default
- Show invalidated / removed records
- Hide invalidated / removed records
- Refresh from Nightscout
Remove selected items
- Select for removal
- Profile changes
- Temp Targets
- Carbs and bolus
- Are you sure you want to remove %1$d items
- No records available
- Hide loop
- Show loop
%1$d selected
Sort
- Show loop records
- Hide loop records
Loop status
Graph scale
Profile 1
diff --git a/core/src/main/java/info/nightscout/androidaps/events/EventLocalProfileChanged.kt b/core/src/main/java/info/nightscout/androidaps/events/EventLocalProfileChanged.kt
new file mode 100644
index 0000000000..e9fabb399f
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/events/EventLocalProfileChanged.kt
@@ -0,0 +1,3 @@
+package info.nightscout.androidaps.events
+
+class EventLocalProfileChanged : Event()
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/events/EventNSClientRestart.kt b/core/src/main/java/info/nightscout/androidaps/events/EventNSClientRestart.kt
new file mode 100644
index 0000000000..c32e0025cb
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/events/EventNSClientRestart.kt
@@ -0,0 +1,3 @@
+package info.nightscout.androidaps.events
+
+class EventNSClientRestart : Event()
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventNewHistoryData.kt b/core/src/main/java/info/nightscout/androidaps/events/EventNewHistoryData.kt
similarity index 83%
rename from app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventNewHistoryData.kt
rename to core/src/main/java/info/nightscout/androidaps/events/EventNewHistoryData.kt
index da88729718..0755cf56e0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/events/EventNewHistoryData.kt
+++ b/core/src/main/java/info/nightscout/androidaps/events/EventNewHistoryData.kt
@@ -1,7 +1,6 @@
-package info.nightscout.androidaps.plugins.iob.iobCobCalculator.events
+package info.nightscout.androidaps.events
import info.nightscout.androidaps.database.entities.GlucoseValue
-import info.nightscout.androidaps.events.Event
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import java.text.DateFormat
diff --git a/core/src/main/java/info/nightscout/androidaps/events/EventTempTargetChange.kt b/core/src/main/java/info/nightscout/androidaps/events/EventTempTargetChange.kt
new file mode 100644
index 0000000000..2454f87a02
--- /dev/null
+++ b/core/src/main/java/info/nightscout/androidaps/events/EventTempTargetChange.kt
@@ -0,0 +1,3 @@
+package info.nightscout.androidaps.events
+
+class EventTempTargetChange : Event()
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventTherapyEventChange.kt b/core/src/main/java/info/nightscout/androidaps/events/EventTherapyEventChange.kt
similarity index 51%
rename from app/src/main/java/info/nightscout/androidaps/events/EventTherapyEventChange.kt
rename to core/src/main/java/info/nightscout/androidaps/events/EventTherapyEventChange.kt
index 5f671404cc..cb34164f5c 100644
--- a/app/src/main/java/info/nightscout/androidaps/events/EventTherapyEventChange.kt
+++ b/core/src/main/java/info/nightscout/androidaps/events/EventTherapyEventChange.kt
@@ -1,3 +1,3 @@
package info.nightscout.androidaps.events
-class EventTherapyEventChange : Event()
+class EventTherapyEventChange : Event()
\ No newline at end of file
diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileSource.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileSource.kt
index bba3402e19..a1937ea1bf 100644
--- a/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileSource.kt
+++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ProfileSource.kt
@@ -1,7 +1,38 @@
package info.nightscout.androidaps.interfaces
+import info.nightscout.androidaps.Constants
+import info.nightscout.androidaps.data.PureProfile
+import org.json.JSONArray
+
interface ProfileSource {
+ class SingleProfile {
+
+ var name: String? = null
+ var mgdl: Boolean = false
+ var dia: Double = Constants.defaultDIA
+ var ic: JSONArray? = null
+ var isf: JSONArray? = null
+ var basal: JSONArray? = null
+ var targetLow: JSONArray? = null
+ var targetHigh: JSONArray? = null
+
+ fun deepClone(): SingleProfile {
+ val sp = SingleProfile()
+ sp.name = name
+ sp.mgdl = mgdl
+ sp.dia = dia
+ sp.ic = JSONArray(ic.toString())
+ sp.isf = JSONArray(isf.toString())
+ sp.basal = JSONArray(basal.toString())
+ sp.targetLow = JSONArray(targetLow.toString())
+ sp.targetHigh = JSONArray(targetHigh.toString())
+ return sp
+ }
+ }
+
val profile: ProfileStore?
val profileName: String?
+ fun addProfile(p: SingleProfile)
+ fun copyFrom(pureProfile: PureProfile, newName: String): SingleProfile
}
\ No newline at end of file
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
index a145c09b89..5b5189dce6 100644
--- a/core/src/main/res/values/strings.xml
+++ b/core/src/main/res/values/strings.xml
@@ -88,6 +88,12 @@
ns_receive_profile_store
nsclientinternal_url
nsclientinternal_api_secret
+ ns_receive_insulin
+ ns_receive_carbs
+ ns_receive_therapy_events
+ ns_receive_profile_switch
+ ns_receive_offline_event
+ ns_receive_temp_target
Refresh
@@ -237,6 +243,15 @@
reset
ProfileSwitch missing. Please do a profile switch or press \"Activate Profile\" in the LocalProfile.
Profile
+ Select for removal
+ Are you sure you want to remove %1$d items
+ Treatment
+ Create new profile from this profile?
+ Wizard Settings
+ 15min trend
+ COB
+ Bolus IOB
+ Basal IOB
Limiting max basal rate to %1$.2f U/h because of %2$s
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt
index 42ccf771d8..83b49617ce 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotuneFragment.kt
@@ -46,7 +46,7 @@ import info.nightscout.plugins.databinding.AutotuneFragmentBinding
import info.nightscout.plugins.general.autotune.data.ATProfile
import info.nightscout.plugins.general.autotune.events.EventAutotuneUpdateGui
import info.nightscout.plugins.profile.ProfilePlugin
-import info.nightscout.plugins.profile.events.EventLocalProfileChanged
+import info.nightscout.androidaps.events.EventLocalProfileChanged
import info.nightscout.shared.SafeParse
import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.rxjava3.disposables.CompositeDisposable
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt
index 9626a941a0..1172fea43c 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/autotune/AutotunePlugin.kt
@@ -29,7 +29,7 @@ import info.nightscout.plugins.general.autotune.data.ATProfile
import info.nightscout.plugins.general.autotune.data.PreppedGlucose
import info.nightscout.plugins.general.autotune.events.EventAutotuneUpdateGui
import info.nightscout.plugins.profile.ProfilePlugin
-import info.nightscout.plugins.profile.events.EventLocalProfileChanged
+import info.nightscout.androidaps.events.EventLocalProfileChanged
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/nsclient/events/EventNSClientRestart.kt b/plugins/src/main/java/info/nightscout/plugins/general/nsclient/events/EventNSClientRestart.kt
deleted file mode 100644
index 59f9afe26a..0000000000
--- a/plugins/src/main/java/info/nightscout/plugins/general/nsclient/events/EventNSClientRestart.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package info.nightscout.plugins.general.nsclient.events
-
-import info.nightscout.androidaps.events.Event
-
-class EventNSClientRestart : Event()
diff --git a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
index dc7e6d803b..10e66853f5 100644
--- a/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt
@@ -12,7 +12,6 @@ import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Constants
-import info.nightscout.plugins.R
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.DetailedBolusInfo
import info.nightscout.androidaps.data.Sms
@@ -26,35 +25,53 @@ import info.nightscout.androidaps.database.transactions.CancelCurrentOfflineEven
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentOfflineEventTransaction
import info.nightscout.androidaps.database.transactions.InsertAndCancelCurrentTemporaryTargetTransaction
+import info.nightscout.androidaps.events.EventNSClientRestart
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.extensions.valueToUnitsString
-import info.nightscout.androidaps.interfaces.*
-import info.nightscout.shared.logging.AAPSLogger
-import info.nightscout.shared.logging.LTag
+import info.nightscout.androidaps.interfaces.ActivePlugin
+import info.nightscout.androidaps.interfaces.CommandQueue
+import info.nightscout.androidaps.interfaces.Config
+import info.nightscout.androidaps.interfaces.Constraint
+import info.nightscout.androidaps.interfaces.Constraints
+import info.nightscout.androidaps.interfaces.GlucoseUnit
+import info.nightscout.androidaps.interfaces.IobCobCalculator
+import info.nightscout.androidaps.interfaces.Loop
+import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.PluginDescription
+import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.interfaces.Profile
+import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.interfaces.PumpSync
+import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.interfaces.SmsCommunicator
+import info.nightscout.androidaps.interfaces.XDripBroadcast
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
-import info.nightscout.plugins.general.smsCommunicator.events.EventSmsCommunicatorUpdateGui
-import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePassword
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.receivers.DataWorkerStorage
-import info.nightscout.androidaps.utils.*
-import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.DecimalFormatter
+import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.rx.AapsSchedulers
-import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
-import info.nightscout.plugins.general.nsclient.events.EventNSClientRestart
+import info.nightscout.plugins.R
+import info.nightscout.plugins.general.smsCommunicator.events.EventSmsCommunicatorUpdateGui
+import info.nightscout.plugins.general.smsCommunicator.otp.OneTimePassword
import info.nightscout.shared.SafeParse
+import info.nightscout.shared.logging.AAPSLogger
+import info.nightscout.shared.logging.LTag
+import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import org.apache.commons.lang3.StringUtils
import org.joda.time.DateTime
import java.text.Normalizer
-import java.util.*
+import java.util.Locale
import java.util.concurrent.TimeUnit
import java.util.regex.Pattern
import javax.inject.Inject
@@ -86,14 +103,15 @@ class SmsCommunicatorPlugin @Inject constructor(
private val uel: UserEntryLogger,
private val glucoseStatusProvider: GlucoseStatusProvider,
private val repository: AppRepository
-) : PluginBase(PluginDescription()
- .mainType(PluginType.GENERAL)
- .fragmentClass(SmsCommunicatorFragment::class.java.name)
- .pluginIcon(R.drawable.ic_sms)
- .pluginName(R.string.smscommunicator)
- .shortName(R.string.smscommunicator_shortname)
- .preferencesId(R.xml.pref_smscommunicator)
- .description(R.string.description_sms_communicator),
+) : PluginBase(
+ PluginDescription()
+ .mainType(PluginType.GENERAL)
+ .fragmentClass(SmsCommunicatorFragment::class.java.name)
+ .pluginIcon(R.drawable.ic_sms)
+ .pluginName(R.string.smscommunicator)
+ .shortName(R.string.smscommunicator_shortname)
+ .preferencesId(R.xml.pref_smscommunicator)
+ .description(R.string.description_sms_communicator),
aapsLogger, rh, injector
), SmsCommunicator {
@@ -255,29 +273,36 @@ class SmsCommunicatorPlugin @Inject constructor(
"BG" ->
if (divided.size == 1) processBG(receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"LOOP" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2 || divided.size == 3) processLOOP(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"NSCLIENT" ->
if (divided.size == 2) processNSCLIENT(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"PUMP" ->
if (!remoteCommandsAllowed && divided.size > 1) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size <= 3) processPUMP(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"PROFILE" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2 || divided.size == 3) processPROFILE(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"BASAL" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2 || divided.size == 3) processBASAL(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"EXTENDED" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2 || divided.size == 3) processEXTENDED(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"BOLUS" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (commandQueue.bolusInQueue()) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_another_bolus_in_queue)))
@@ -285,25 +310,31 @@ class SmsCommunicatorPlugin @Inject constructor(
else if (divided.size == 2 && pump.isSuspended()) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.pumpsuspended)))
else if (divided.size == 2 || divided.size == 3) processBOLUS(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"CARBS" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2 || divided.size == 3) processCARBS(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"CAL" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2) processCAL(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"TARGET" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2) processTARGET(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"SMS" ->
if (!remoteCommandsAllowed) sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_remotecommandnotallowed)))
else if (divided.size == 2) processSMS(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
"HELP" ->
if (divided.size == 1 || divided.size == 2) processHELP(divided, receivedSms)
else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
+
else ->
if (messageToConfirm?.requester?.phoneNumber == receivedSms.phoneNumber) {
val execute = messageToConfirm
@@ -406,10 +437,10 @@ class SmsCommunicatorPlugin @Inject constructor(
uel.log(Action.RESUME, Sources.SMS)
disposable += repository.runTransactionForResult(CancelCurrentOfflineEventIfAnyTransaction(dateUtil.now()))
.subscribe({ result ->
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
- }, {
- aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
- })
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
+ }, {
+ aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
+ })
rxBus.send(EventRefreshOverview("SMS_LOOP_RESUME"))
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
@@ -444,13 +475,19 @@ class SmsCommunicatorPlugin @Inject constructor(
commandQueue.cancelTempBasal(true, object : Callback() {
override fun run() {
if (result.success) {
- disposable += repository.runTransactionForResult(InsertAndCancelCurrentOfflineEventTransaction(dateUtil.now(), T.mins(anInteger().toLong()).msecs(), OfflineEvent.Reason.SUSPEND))
+ disposable += repository.runTransactionForResult(
+ InsertAndCancelCurrentOfflineEventTransaction(
+ dateUtil.now(),
+ T.mins(anInteger().toLong()).msecs(),
+ OfflineEvent.Reason.SUSPEND
+ )
+ )
.subscribe({ result ->
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
- }, {
- aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
- })
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted OfflineEvent $it") }
+ }, {
+ aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
+ })
rxBus.send(EventRefreshOverview("SMS_LOOP_SUSPENDED"))
val replyText = rh.gs(R.string.smscommunicator_loopsuspended) + " " +
rh.gs(if (result.success) R.string.smscommunicator_tempbasalcanceled else R.string.smscommunicator_tempbasalcancelfailed)
@@ -527,10 +564,10 @@ class SmsCommunicatorPlugin @Inject constructor(
} else {
disposable += repository.runTransactionForResult(CancelCurrentOfflineEventIfAnyTransaction(dateUtil.now()))
.subscribe({ result ->
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
- }, {
- aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
- })
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated OfflineEvent $it") }
+ }, {
+ aapsLogger.error(LTag.DATABASE, "Error while saving OfflineEvent", it)
+ })
sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.smscommunicator_reconnect)))
rxBus.send(EventRefreshOverview("SMS_PUMP_START"))
}
@@ -637,14 +674,18 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = rh.gs(R.string.smscommunicator_tempbasalcanceled)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalcanceled),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalcanceled)))
+ uel.log(
+ Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalcanceled),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalcanceled))
+ )
} else {
var replyText = rh.gs(R.string.smscommunicator_tempbasalcancelfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalcancelfailed),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalcancelfailed)))
+ uel.log(
+ Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalcancelfailed),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalcancelfailed))
+ )
}
}
})
@@ -669,25 +710,36 @@ class SmsCommunicatorPlugin @Inject constructor(
commandQueue.tempBasalPercent(anInteger(), secondInteger(), true, profile, PumpSync.TemporaryBasalType.NORMAL, object : Callback() {
override fun run() {
if (result.success) {
- var replyText = if (result.isPercent) rh.gs(R.string.smscommunicator_tempbasalset_percent, result.percent, result.duration) else rh.gs(R.string.smscommunicator_tempbasalset, result.absolute, result.duration)
+ var replyText =
+ if (result.isPercent) rh.gs(R.string.smscommunicator_tempbasalset_percent, result.percent, result.duration) else rh.gs(
+ R.string.smscommunicator_tempbasalset,
+ result.absolute,
+ result.duration
+ )
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result.isPercent)
- uel.log(Action.TEMP_BASAL, Sources.SMS,
- activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset_percent, result.percent, result.duration),
- ValueWithUnit.Percent(result.percent),
- ValueWithUnit.Minute(result.duration))
+ uel.log(
+ Action.TEMP_BASAL, Sources.SMS,
+ activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset_percent, result.percent, result.duration),
+ ValueWithUnit.Percent(result.percent),
+ ValueWithUnit.Minute(result.duration)
+ )
else
- uel.log(Action.TEMP_BASAL, Sources.SMS,
- activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset, result.absolute, result.duration),
- ValueWithUnit.UnitPerHour(result.absolute),
- ValueWithUnit.Minute(result.duration))
+ uel.log(
+ Action.TEMP_BASAL, Sources.SMS,
+ activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset, result.absolute, result.duration),
+ ValueWithUnit.UnitPerHour(result.absolute),
+ ValueWithUnit.Minute(result.duration)
+ )
} else {
var replyText = rh.gs(R.string.smscommunicator_tempbasalfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalfailed),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalfailed)))
+ uel.log(
+ Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalfailed),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalfailed))
+ )
}
}
})
@@ -718,19 +770,29 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result.isPercent)
- uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset_percent, result.percent, result.duration),
- ValueWithUnit.Percent(result.percent),
- ValueWithUnit.Minute(result.duration))
+ uel.log(
+ Action.TEMP_BASAL,
+ Sources.SMS,
+ activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset_percent, result.percent, result.duration),
+ ValueWithUnit.Percent(result.percent),
+ ValueWithUnit.Minute(result.duration)
+ )
else
- uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset, result.absolute, result.duration),
- ValueWithUnit.UnitPerHour(result.absolute),
- ValueWithUnit.Minute(result.duration))
+ uel.log(
+ Action.TEMP_BASAL,
+ Sources.SMS,
+ activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalset, result.absolute, result.duration),
+ ValueWithUnit.UnitPerHour(result.absolute),
+ ValueWithUnit.Minute(result.duration)
+ )
} else {
var replyText = rh.gs(R.string.smscommunicator_tempbasalfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalfailed),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalfailed)))
+ uel.log(
+ Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_tempbasalfailed),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tempbasalfailed))
+ )
}
}
})
@@ -757,8 +819,10 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = rh.gs(R.string.smscommunicator_extendedcancelfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedcanceled),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_extendedcanceled)))
+ uel.log(
+ Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedcanceled),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_extendedcanceled))
+ )
}
}
})
@@ -785,20 +849,28 @@ class SmsCommunicatorPlugin @Inject constructor(
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (config.APS)
- uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedset, aDouble, duration) + " / " + rh.gs(R.string.loopsuspended),
- ValueWithUnit.Insulin(aDouble ?: 0.0),
- ValueWithUnit.Minute(duration),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.loopsuspended)))
+ uel.log(
+ Action.EXTENDED_BOLUS,
+ Sources.SMS,
+ activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedset, aDouble, duration) + " / " + rh.gs(R.string.loopsuspended),
+ ValueWithUnit.Insulin(aDouble ?: 0.0),
+ ValueWithUnit.Minute(duration),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.loopsuspended))
+ )
else
- uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedset, aDouble, duration),
- ValueWithUnit.Insulin(aDouble ?: 0.0),
- ValueWithUnit.Minute(duration))
+ uel.log(
+ Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedset, aDouble, duration),
+ ValueWithUnit.Insulin(aDouble ?: 0.0),
+ ValueWithUnit.Minute(duration)
+ )
} else {
var replyText = rh.gs(R.string.smscommunicator_extendedfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedfailed),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_extendedfailed)))
+ uel.log(
+ Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_extendedfailed),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_extendedfailed))
+ )
}
}
})
@@ -844,25 +916,31 @@ class SmsCommunicatorPlugin @Inject constructor(
eatingSoonTTDuration =
if (eatingSoonTTDuration > 0) eatingSoonTTDuration
else Constants.defaultEatingSoonTTDuration
- var eatingSoonTT = sp.getDouble(R.string.key_eatingsoon_target, if (currentProfile.units == GlucoseUnit.MMOL) Constants.defaultEatingSoonTTmmol else Constants.defaultEatingSoonTTmgdl)
+ var eatingSoonTT =
+ sp.getDouble(
+ R.string.key_eatingsoon_target,
+ if (currentProfile.units == GlucoseUnit.MMOL) Constants.defaultEatingSoonTTmmol else Constants.defaultEatingSoonTTmgdl
+ )
eatingSoonTT =
when {
eatingSoonTT > 0 -> eatingSoonTT
currentProfile.units == GlucoseUnit.MMOL -> Constants.defaultEatingSoonTTmmol
else -> Constants.defaultEatingSoonTTmgdl
}
- disposable += repository.runTransactionForResult(InsertAndCancelCurrentTemporaryTargetTransaction(
- timestamp = dateUtil.now(),
- duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
- reason = TemporaryTarget.Reason.EATING_SOON,
- lowTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits()),
- highTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits())
- )).subscribe({ result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
- }, {
- aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
- })
+ disposable += repository.runTransactionForResult(
+ InsertAndCancelCurrentTemporaryTargetTransaction(
+ timestamp = dateUtil.now(),
+ duration = TimeUnit.MINUTES.toMillis(eatingSoonTTDuration.toLong()),
+ reason = TemporaryTarget.Reason.EATING_SOON,
+ lowTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits()),
+ highTarget = Profile.toMgdl(eatingSoonTT, profileFunction.getUnits())
+ )
+ ).subscribe({ result ->
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
+ }, {
+ aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
+ })
val tt = if (currentProfile.units == GlucoseUnit.MMOL) {
DecimalFormatter.to1Decimal(eatingSoonTT)
} else DecimalFormatter.to0Decimal(eatingSoonTT)
@@ -875,8 +953,10 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = rh.gs(R.string.smscommunicator_bolusfailed)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_bolusfailed),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_bolusfailed)))
+ uel.log(
+ Action.BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true) + "\n" + rh.gs(R.string.smscommunicator_bolusfailed),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_bolusfailed))
+ )
}
}
})
@@ -933,14 +1013,18 @@ class SmsCommunicatorPlugin @Inject constructor(
var replyText = rh.gs(R.string.smscommunicator_carbsset, anInteger)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true) + ": " + rh.gs(R.string.smscommunicator_carbsset, anInteger),
- ValueWithUnit.Gram(anInteger ?: 0))
+ uel.log(
+ Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true) + ": " + rh.gs(R.string.smscommunicator_carbsset, anInteger),
+ ValueWithUnit.Gram(anInteger ?: 0)
+ )
} else {
var replyText = rh.gs(R.string.smscommunicator_carbsfailed, anInteger)
replyText += "\n" + activePlugin.activePump.shortStatus(true)
sendSMS(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true) + ": " + rh.gs(R.string.smscommunicator_carbsfailed, anInteger),
- ValueWithUnit.Gram(anInteger ?: 0))
+ uel.log(
+ Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true) + ": " + rh.gs(R.string.smscommunicator_carbsfailed, anInteger),
+ ValueWithUnit.Gram(anInteger ?: 0)
+ )
}
}
})
@@ -1000,24 +1084,28 @@ class SmsCommunicatorPlugin @Inject constructor(
var tt = sp.getDouble(keyTarget, if (units == GlucoseUnit.MMOL) defaultTargetMMOL else defaultTargetMGDL)
tt = Profile.toCurrentUnits(profileFunction, tt)
tt = if (tt > 0) tt else if (units == GlucoseUnit.MMOL) defaultTargetMMOL else defaultTargetMGDL
- disposable += repository.runTransactionForResult(InsertAndCancelCurrentTemporaryTargetTransaction(
- timestamp = dateUtil.now(),
- duration = TimeUnit.MINUTES.toMillis(ttDuration.toLong()),
- reason = reason,
- lowTarget = Profile.toMgdl(tt, profileFunction.getUnits()),
- highTarget = Profile.toMgdl(tt, profileFunction.getUnits())
- )).subscribe({ result ->
- result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
- }, {
- aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
- })
+ disposable += repository.runTransactionForResult(
+ InsertAndCancelCurrentTemporaryTargetTransaction(
+ timestamp = dateUtil.now(),
+ duration = TimeUnit.MINUTES.toMillis(ttDuration.toLong()),
+ reason = reason,
+ lowTarget = Profile.toMgdl(tt, profileFunction.getUnits()),
+ highTarget = Profile.toMgdl(tt, profileFunction.getUnits())
+ )
+ ).subscribe({ result ->
+ result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
+ }, {
+ aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
+ })
val ttString = if (units == GlucoseUnit.MMOL) DecimalFormatter.to1Decimal(tt) else DecimalFormatter.to0Decimal(tt)
val replyText = rh.gs(R.string.smscommunicator_tt_set, ttString, ttDuration)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.TT, Sources.SMS,
+ uel.log(
+ Action.TT, Sources.SMS,
ValueWithUnit.fromGlucoseUnit(tt, units.asText),
- ValueWithUnit.Minute(ttDuration))
+ ValueWithUnit.Minute(ttDuration)
+ )
}
})
} else if (isStop) {
@@ -1028,14 +1116,16 @@ class SmsCommunicatorPlugin @Inject constructor(
override fun run() {
disposable += repository.runTransactionForResult(CancelCurrentTemporaryTargetIfAnyTransaction(dateUtil.now()))
.subscribe({ result ->
- result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
- }, {
- aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
- })
+ result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
+ }, {
+ aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
+ })
val replyText = rh.gs(R.string.smscommunicator_tt_canceled)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.CANCEL_TT, Sources.SMS, rh.gs(R.string.smscommunicator_tt_canceled),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tt_canceled)))
+ uel.log(
+ Action.CANCEL_TT, Sources.SMS, rh.gs(R.string.smscommunicator_tt_canceled),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_tt_canceled))
+ )
}
})
} else
@@ -1054,8 +1144,10 @@ class SmsCommunicatorPlugin @Inject constructor(
sp.putBoolean(R.string.key_smscommunicator_remote_commands_allowed, false)
val replyText = rh.gs(R.string.smscommunicator_stoppedsms)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
- uel.log(Action.STOP_SMS, Sources.SMS, rh.gs(R.string.smscommunicator_stoppedsms),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_stoppedsms)))
+ uel.log(
+ Action.STOP_SMS, Sources.SMS, rh.gs(R.string.smscommunicator_stoppedsms),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_stoppedsms))
+ )
}
})
} else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
@@ -1074,11 +1166,15 @@ class SmsCommunicatorPlugin @Inject constructor(
if (result) rh.gs(R.string.smscommunicator_calibrationsent) else rh.gs(R.string.smscommunicator_calibrationfailed)
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
if (result)
- uel.log(Action.CALIBRATION, Sources.SMS, rh.gs(R.string.smscommunicator_calibrationsent),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_calibrationsent)))
+ uel.log(
+ Action.CALIBRATION, Sources.SMS, rh.gs(R.string.smscommunicator_calibrationsent),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_calibrationsent))
+ )
else
- uel.log(Action.CALIBRATION, Sources.SMS, rh.gs(R.string.smscommunicator_calibrationfailed),
- ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_calibrationfailed)))
+ uel.log(
+ Action.CALIBRATION, Sources.SMS, rh.gs(R.string.smscommunicator_calibrationfailed),
+ ValueWithUnit.SimpleString(rh.gsNotLocalised(R.string.smscommunicator_calibrationfailed))
+ )
}
})
} else sendSMS(Sms(receivedSms.phoneNumber, rh.gs(R.string.wrong_format)))
@@ -1106,8 +1202,10 @@ class SmsCommunicatorPlugin @Inject constructor(
if (sms.text.toByteArray().size <= 140) smsManager?.sendTextMessage(sms.phoneNumber, null, sms.text, null, null)
else {
val parts = smsManager?.divideMessage(sms.text)
- smsManager?.sendMultipartTextMessage(sms.phoneNumber, null, parts,
- null, null)
+ smsManager?.sendMultipartTextMessage(
+ sms.phoneNumber, null, parts,
+ null, null
+ )
}
messages.add(sms)
} catch (e: IllegalArgumentException) {
diff --git a/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt b/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt
index ab94466762..f6979d557a 100644
--- a/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/profile/ProfileFragment.kt
@@ -32,7 +32,7 @@ import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.ProfileFragmentBinding
-import info.nightscout.plugins.profile.events.EventLocalProfileChanged
+import info.nightscout.androidaps.events.EventLocalProfileChanged
import info.nightscout.plugins.ui.TimeListEdit
import info.nightscout.shared.SafeParse
import info.nightscout.shared.logging.AAPSLogger
diff --git a/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt b/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt
index 977ea9996f..cf6856bfc0 100644
--- a/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt
+++ b/plugins/src/main/java/info/nightscout/plugins/profile/ProfilePlugin.kt
@@ -10,6 +10,7 @@ import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PureProfile
+import info.nightscout.androidaps.events.EventLocalProfileChanged
import info.nightscout.androidaps.events.EventProfileStoreChanged
import info.nightscout.androidaps.extensions.blockFromJsonArray
import info.nightscout.androidaps.extensions.pureProfileFromJson
@@ -35,7 +36,6 @@ import info.nightscout.androidaps.utils.JsonHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.plugins.R
-import info.nightscout.plugins.profile.events.EventLocalProfileChanged
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
@@ -81,39 +81,13 @@ class ProfilePlugin @Inject constructor(
loadSettings()
}
- class SingleProfile {
-
- internal var name: String? = null
- internal var mgdl: Boolean = false
- var dia: Double = Constants.defaultDIA
- var ic: JSONArray? = null
- var isf: JSONArray? = null
- var basal: JSONArray? = null
- internal var targetLow: JSONArray? = null
- internal var targetHigh: JSONArray? = null
-
- fun deepClone(): SingleProfile {
- val sp = SingleProfile()
- sp.name = name
- sp.mgdl = mgdl
- sp.dia = dia
- sp.ic = JSONArray(ic.toString())
- sp.isf = JSONArray(isf.toString())
- sp.basal = JSONArray(basal.toString())
- sp.targetLow = JSONArray(targetLow.toString())
- sp.targetHigh = JSONArray(targetHigh.toString())
- return sp
- }
-
- }
-
var isEdited: Boolean = false
- var profiles: ArrayList = ArrayList()
+ var profiles: ArrayList = ArrayList()
val numOfProfiles get() = profiles.size
var currentProfileIndex = 0
- fun currentProfile(): SingleProfile? = if (numOfProfiles > 0 && currentProfileIndex < numOfProfiles) profiles[currentProfileIndex] else null
+ fun currentProfile(): ProfileSource.SingleProfile? = if (numOfProfiles > 0 && currentProfileIndex < numOfProfiles) profiles[currentProfileIndex] else null
@Synchronized
fun isValidEditState(activity: FragmentActivity?): Boolean {
@@ -238,7 +212,7 @@ class ProfilePlugin @Inject constructor(
// numOfProfiles = max(numOfProfiles, 1) // create at least one default profile if none exists
for (i in 0 until numOfProfiles) {
- val p = SingleProfile()
+ val p = ProfileSource.SingleProfile()
val localProfileNumbered = Constants.LOCAL_PROFILE + "_" + i + "_"
p.name = sp.getString(localProfileNumbered + "name", Constants.LOCAL_PROFILE + i)
@@ -263,7 +237,7 @@ class ProfilePlugin @Inject constructor(
@Synchronized
fun loadFromStore(store: ProfileStore) {
try {
- val newProfiles: ArrayList = ArrayList()
+ val newProfiles: ArrayList = ArrayList()
for (p in store.getProfileList()) {
val profile = store.getSpecificProfile(p.toString())
val validityCheck = profile?.let { ProfileSealed.Pure(profile).isValid("NS", activePlugin.activePump, config, rh, rxBus, hardLimits, false) } ?: Profile.ValidityCheck()
@@ -296,14 +270,14 @@ class ProfilePlugin @Inject constructor(
}
}
- fun copyFrom(pureProfile: PureProfile, newName: String): SingleProfile {
+ override fun copyFrom(pureProfile: PureProfile, newName: String): ProfileSource.SingleProfile {
var verifiedName = newName
if (rawProfile?.getSpecificProfile(newName) != null) {
verifiedName += " " + dateUtil.now().toString()
}
val profile = ProfileSealed.Pure(pureProfile)
val pureJson = pureProfile.jsonObject
- val sp = SingleProfile()
+ val sp = ProfileSource.SingleProfile()
sp.name = verifiedName
sp.mgdl = profile.units == GlucoseUnit.MGDL
sp.dia = pureJson.getDouble("dia")
@@ -372,7 +346,7 @@ class ProfilePlugin @Inject constructor(
break
}
}
- val p = SingleProfile()
+ val p = ProfileSource.SingleProfile()
p.name = Constants.LOCAL_PROFILE + free
p.mgdl = profileFunction.getUnits() == GlucoseUnit.MGDL
p.dia = Constants.defaultDIA
@@ -397,7 +371,7 @@ class ProfilePlugin @Inject constructor(
isEdited = false
}
- fun addProfile(p: SingleProfile) {
+ override fun addProfile(p: ProfileSource.SingleProfile) {
profiles.add(p)
currentProfileIndex = profiles.size - 1
createAndStoreConvertedProfile()
diff --git a/plugins/src/main/java/info/nightscout/plugins/profile/events/EventLocalProfileChanged.kt b/plugins/src/main/java/info/nightscout/plugins/profile/events/EventLocalProfileChanged.kt
deleted file mode 100644
index 87a979fefa..0000000000
--- a/plugins/src/main/java/info/nightscout/plugins/profile/events/EventLocalProfileChanged.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package info.nightscout.plugins.profile.events
-
-import info.nightscout.androidaps.events.Event
-
-class EventLocalProfileChanged : Event()
\ No newline at end of file
diff --git a/plugins/src/main/res/values/strings.xml b/plugins/src/main/res/values/strings.xml
index ed121c971e..1162ab96fb 100644
--- a/plugins/src/main/res/values/strings.xml
+++ b/plugins/src/main/res/values/strings.xml
@@ -199,7 +199,6 @@
IC
ISF
TARG
- Clone
BAS
diff --git a/ui/build.gradle b/ui/build.gradle
index c5102ae041..fa1df852f3 100644
--- a/ui/build.gradle
+++ b/ui/build.gradle
@@ -13,8 +13,9 @@ android {
}
dependencies {
+ implementation project(':libraries')
+ implementation project(':graphview')
implementation project(':shared')
implementation project(':database')
implementation project(':core')
- implementation project(':graphview')
}
\ No newline at end of file
diff --git a/ui/src/main/AndroidManifest.xml b/ui/src/main/AndroidManifest.xml
index 1baaae3f21..655b7388cb 100644
--- a/ui/src/main/AndroidManifest.xml
+++ b/ui/src/main/AndroidManifest.xml
@@ -43,6 +43,10 @@
android:name=".activities.StatsActivity"
android:exported="false"
android:theme="@style/AppTheme" />
+
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/TreatmentsActivity.kt
similarity index 76%
rename from app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt
rename to ui/src/main/java/info/nightscout/ui/activities/TreatmentsActivity.kt
index c7b913753f..d3a379c7ce 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/TreatmentsActivity.kt
@@ -1,23 +1,23 @@
-package info.nightscout.androidaps.activities
+package info.nightscout.ui.activities
import android.os.Bundle
import android.view.MenuItem
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import com.google.android.material.tabs.TabLayout
-import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.fragments.TreatmentsBolusCarbsFragment
-import info.nightscout.androidaps.activities.fragments.TreatmentsCareportalFragment
-import info.nightscout.androidaps.activities.fragments.TreatmentsExtendedBolusesFragment
-import info.nightscout.androidaps.activities.fragments.TreatmentsProfileSwitchFragment
-import info.nightscout.androidaps.activities.fragments.TreatmentsTempTargetFragment
-import info.nightscout.androidaps.activities.fragments.TreatmentsTemporaryBasalsFragment
-import info.nightscout.androidaps.activities.fragments.TreatmentsUserEntryFragment
-import info.nightscout.androidaps.databinding.TreatmentsFragmentBinding
+import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.BuildHelper
+import info.nightscout.ui.R
+import info.nightscout.ui.activities.fragments.TreatmentsBolusCarbsFragment
+import info.nightscout.ui.activities.fragments.TreatmentsCareportalFragment
+import info.nightscout.ui.activities.fragments.TreatmentsExtendedBolusesFragment
+import info.nightscout.ui.activities.fragments.TreatmentsProfileSwitchFragment
+import info.nightscout.ui.activities.fragments.TreatmentsTempTargetFragment
+import info.nightscout.ui.activities.fragments.TreatmentsTemporaryBasalsFragment
+import info.nightscout.ui.activities.fragments.TreatmentsUserEntryFragment
+import info.nightscout.ui.databinding.TreatmentsFragmentBinding
import javax.inject.Inject
class TreatmentsActivity : NoSplashAppCompatActivity() {
@@ -41,7 +41,7 @@ class TreatmentsActivity : NoSplashAppCompatActivity() {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.title = rh.gs(R.string.carbs_and_bolus)
- binding.treatmentsTabs.addOnTabSelectedListener(object : OnTabSelectedListener {
+ binding.treatmentsTabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
val fragment = when (tab.position) {
0 -> TreatmentsBolusCarbsFragment::class.java
@@ -78,4 +78,4 @@ class TreatmentsActivity : NoSplashAppCompatActivity() {
.commit()
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt
similarity index 97%
rename from app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
rename to ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt
index c8a95d287a..08f7ede24b 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt
@@ -1,17 +1,21 @@
-package info.nightscout.androidaps.activities.fragments
+package info.nightscout.ui.activities.fragments
import android.annotation.SuppressLint
import android.graphics.Paint
import android.os.Bundle
import android.util.SparseArray
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.core.util.forEach
import androidx.core.view.MenuProvider
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.Bolus
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
@@ -23,9 +27,8 @@ import info.nightscout.androidaps.database.transactions.CutCarbsTransaction
import info.nightscout.androidaps.database.transactions.InvalidateBolusCalculatorResultTransaction
import info.nightscout.androidaps.database.transactions.InvalidateBolusTransaction
import info.nightscout.androidaps.database.transactions.InvalidateCarbsTransaction
-import info.nightscout.androidaps.databinding.TreatmentsBolusCarbsFragmentBinding
-import info.nightscout.androidaps.databinding.TreatmentsBolusCarbsItemBinding
-import info.nightscout.androidaps.dialogs.WizardInfoDialog
+import info.nightscout.androidaps.events.EventNSClientRestart
+import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.events.EventTreatmentChange
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.toVisibility
@@ -35,8 +38,6 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.plugins.general.nsclient.events.EventNSClientRestart
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
@@ -47,6 +48,10 @@ import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.ui.R
+import info.nightscout.ui.databinding.TreatmentsBolusCarbsFragmentBinding
+import info.nightscout.ui.databinding.TreatmentsBolusCarbsItemBinding
+import info.nightscout.ui.dialogs.WizardInfoDialog
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@@ -126,7 +131,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
.getBolusCalculatorResultsDataFromTime(now - millsToThePast, false)
.map { calc -> calc.map { MealLink(bolusCalculatorResult = it) } }
- fun swapAdapter() {
+ private fun swapAdapter() {
val now = System.currentTimeMillis()
binding.recyclerview.isLoading = true
disposable +=
@@ -232,7 +237,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
holder.binding.mealOrCorrection.text =
when (ml.bolus.type) {
Bolus.Type.SMB -> "SMB"
- Bolus.Type.NORMAL -> rh.gs(R.string.mealbolus)
+ Bolus.Type.NORMAL -> rh.gs(R.string.meal_bolus)
Bolus.Type.PRIMING -> rh.gs(R.string.prime)
}
holder.binding.cbBolusRemove.visibility = (ml.bolus.isValid && actionHelper.isRemoving).toVisibility()
@@ -371,7 +376,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
private fun deleteFutureTreatments() {
activity?.let { activity ->
- OKDialog.showConfirmation(activity, rh.gs(R.string.overview_treatment_label), rh.gs(R.string.deletefuturetreatments) + "?", Runnable {
+ OKDialog.showConfirmation(activity, rh.gs(R.string.overview_treatment_label), rh.gs(R.string.delete_future_treatments) + "?", Runnable {
uel.log(Action.DELETE_FUTURE_TREATMENTS, Sources.Treatments)
disposable += repository
.getBolusesDataFromTime(dateUtil.now(), false)
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
rename to ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt
index 37c46f4a26..428f23b2ba 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsCareportalFragment.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.activities.fragments
+package info.nightscout.ui.activities.fragments
import android.os.Bundle
import android.util.SparseArray
@@ -9,8 +9,7 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.fragments.TreatmentsCareportalFragment.RecyclerViewAdapter.TherapyEventsViewHolder
+import info.nightscout.ui.activities.fragments.TreatmentsCareportalFragment.RecyclerViewAdapter.TherapyEventsViewHolder
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.TherapyEvent
import info.nightscout.androidaps.database.entities.UserEntry.Action
@@ -18,21 +17,22 @@ import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.transactions.InvalidateAAPSStartedTherapyEventTransaction
import info.nightscout.androidaps.database.transactions.InvalidateTherapyEventTransaction
-import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBinding
-import info.nightscout.androidaps.databinding.TreatmentsCareportalItemBinding
+import info.nightscout.androidaps.events.EventNSClientRestart
import info.nightscout.androidaps.events.EventTherapyEventChange
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.plugins.general.nsclient.events.EventNSClientRestart
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.ui.R
+import info.nightscout.ui.databinding.TreatmentsCareportalFragmentBinding
+import info.nightscout.ui.databinding.TreatmentsCareportalItemBinding
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@@ -96,7 +96,7 @@ class TreatmentsCareportalFragment : DaggerFragment(), MenuProvider {
private fun removeStartedEvents() {
activity?.let { activity ->
- OKDialog.showConfirmation(activity, rh.gs(R.string.careportal), rh.gs(R.string.careportal_removestartedevents), Runnable {
+ OKDialog.showConfirmation(activity, rh.gs(R.string.careportal), rh.gs(R.string.careportal_remove_started_events), Runnable {
uel.log(Action.RESTART_EVENTS_REMOVED, Sources.Treatments)
disposable += repository.runTransactionForResult(InvalidateAAPSStartedTherapyEventTransaction(rh.gs(R.string.androidaps_start)))
.subscribe(
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt
similarity index 96%
rename from app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
rename to ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt
index 6bc126b1a4..5897973b58 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.activities.fragments
+package info.nightscout.ui.activities.fragments
import android.annotation.SuppressLint
import android.os.Bundle
@@ -10,8 +10,7 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.fragments.TreatmentsExtendedBolusesFragment.RecyclerViewAdapter.ExtendedBolusesViewHolder
+import info.nightscout.ui.activities.fragments.TreatmentsExtendedBolusesFragment.RecyclerViewAdapter.ExtendedBolusesViewHolder
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.ExtendedBolus
import info.nightscout.androidaps.database.entities.UserEntry.Action
@@ -19,8 +18,6 @@ import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.database.transactions.InvalidateExtendedBolusTransaction
-import info.nightscout.androidaps.databinding.TreatmentsExtendedbolusFragmentBinding
-import info.nightscout.androidaps.databinding.TreatmentsExtendedbolusItemBinding
import info.nightscout.androidaps.events.EventExtendedBolusChange
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.isInProgress
@@ -39,6 +36,9 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
+import info.nightscout.ui.R
+import info.nightscout.ui.databinding.TreatmentsExtendedbolusFragmentBinding
+import info.nightscout.ui.databinding.TreatmentsExtendedbolusItemBinding
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.concurrent.TimeUnit
@@ -85,7 +85,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment(), MenuProvider {
requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
- fun swapAdapter() {
+ private fun swapAdapter() {
val now = System.currentTimeMillis()
binding.recyclerview.isLoading = true
disposable += if (showInvalidated)
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt
similarity index 93%
rename from app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
rename to ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt
index 7dd9a23734..114b2517f0 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsProfileSwitchFragment.kt
@@ -1,49 +1,54 @@
-package info.nightscout.androidaps.activities.fragments
+package info.nightscout.ui.activities.fragments
import android.annotation.SuppressLint
import android.graphics.Paint
import android.os.Bundle
import android.util.SparseArray
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.core.util.forEach
import androidx.core.view.MenuProvider
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.fragments.TreatmentsProfileSwitchFragment.RecyclerProfileViewAdapter.ProfileSwitchViewHolder
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.transactions.InvalidateProfileSwitchTransaction
-import info.nightscout.androidaps.databinding.TreatmentsProfileswitchFragmentBinding
-import info.nightscout.androidaps.databinding.TreatmentsProfileswitchItemBinding
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
+import info.nightscout.androidaps.events.EventLocalProfileChanged
+import info.nightscout.androidaps.events.EventNSClientRestart
+import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.events.EventProfileSwitchChanged
import info.nightscout.androidaps.extensions.getCustomizedName
import info.nightscout.androidaps.extensions.toVisibility
+import info.nightscout.androidaps.interfaces.ActivePlugin
+import info.nightscout.androidaps.interfaces.BuildHelper
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.plugins.general.nsclient.events.EventNSClientRestart
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData
-import info.nightscout.plugins.profile.ProfilePlugin
-import info.nightscout.plugins.profile.events.EventLocalProfileChanged
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
-import info.nightscout.androidaps.interfaces.BuildHelper
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.ui.R
+import info.nightscout.ui.activities.fragments.TreatmentsProfileSwitchFragment.RecyclerProfileViewAdapter.ProfileSwitchViewHolder
+import info.nightscout.ui.databinding.TreatmentsProfileswitchFragmentBinding
+import info.nightscout.ui.databinding.TreatmentsProfileswitchItemBinding
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@@ -55,7 +60,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@Inject lateinit var aapsLogger: AAPSLogger
- @Inject lateinit var profilePlugin: ProfilePlugin
+ @Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var rh: ResourceHelper
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var dateUtil: DateUtil
@@ -130,7 +135,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
.getEffectiveProfileSwitchDataFromTime(now - millsToThePast, false)
.map { carb -> carb.map { ProfileSealed.EPS(it) } }
- fun swapAdapter() {
+ private fun swapAdapter() {
val now = System.currentTimeMillis()
binding.recyclerview.isLoading = true
disposable +=
@@ -196,7 +201,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
holder.binding.duration.text = rh.gs(R.string.format_mins, T.msecs(profileSwitch.duration ?: 0L).mins())
holder.binding.name.text =
if (profileSwitch is ProfileSealed.PS) profileSwitch.value.getCustomizedName() else if (profileSwitch is ProfileSealed.EPS) profileSwitch.value.originalCustomizedName else ""
- if (profileSwitch.isInProgress(dateUtil)) holder.binding.date.setTextColor(rh.gac(context , R.attr.activeColor))
+ if (profileSwitch.isInProgress(dateUtil)) holder.binding.date.setTextColor(rh.gac(context, R.attr.activeColor))
else holder.binding.date.setTextColor(holder.binding.duration.currentTextColor)
holder.binding.clone.tag = profileSwitch
holder.binding.name.tag = profileSwitch
@@ -241,8 +246,8 @@ class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
ValueWithUnit.SimpleString(profileSwitch.profileName)
)
val nonCustomized = profileSealed.convertToNonCustomizedProfile(dateUtil)
- profilePlugin.addProfile(
- profilePlugin.copyFrom(
+ activePlugin.activeProfileSource.addProfile(
+ activePlugin.activeProfileSource.copyFrom(
nonCustomized,
profileSwitch.getCustomizedName() + " " + dateUtil.dateAndTimeString(profileSwitch.timestamp).replace(".", "_")
)
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt
similarity index 95%
rename from app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
rename to ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt
index 74b2d5ba0e..4af017371f 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTempTargetFragment.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.activities.fragments
+package info.nightscout.ui.activities.fragments
import android.annotation.SuppressLint
import android.os.Bundle
@@ -10,8 +10,7 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder
+import info.nightscout.ui.activities.fragments.TreatmentsTempTargetFragment.RecyclerViewAdapter.TempTargetsViewHolder
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.ValueWrapper
import info.nightscout.androidaps.database.entities.TemporaryTarget
@@ -20,9 +19,9 @@ import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.database.transactions.InvalidateTemporaryTargetTransaction
-import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBinding
-import info.nightscout.androidaps.databinding.TreatmentsTemptargetItemBinding
import info.nightscout.androidaps.events.EventEffectiveProfileSwitchChanged
+import info.nightscout.androidaps.events.EventNSClientRestart
+import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.events.EventProfileSwitchChanged
import info.nightscout.androidaps.events.EventTempTargetChange
import info.nightscout.androidaps.extensions.friendlyDescription
@@ -34,14 +33,15 @@ import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.plugins.general.nsclient.events.EventNSClientRestart
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
+import info.nightscout.ui.R
+import info.nightscout.ui.databinding.TreatmentsTemptargetFragmentBinding
+import info.nightscout.ui.databinding.TreatmentsTemptargetItemBinding
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
@@ -113,7 +113,7 @@ class TreatmentsTempTargetFragment : DaggerFragment(), MenuProvider {
}
}
- fun swapAdapter() {
+ private fun swapAdapter() {
val now = System.currentTimeMillis()
binding.recyclerview.isLoading = true
disposable +=
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
similarity index 96%
rename from app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
rename to ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
index 3bb55c7963..35f7c97505 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
@@ -1,17 +1,20 @@
-package info.nightscout.androidaps.activities.fragments
+package info.nightscout.ui.activities.fragments
import android.annotation.SuppressLint
import android.os.Bundle
import android.util.SparseArray
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.core.util.forEach
import androidx.core.view.MenuProvider
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.R
-import info.nightscout.androidaps.activities.fragments.TreatmentsTemporaryBasalsFragment.RecyclerViewAdapter.TempBasalsViewHolder
import info.nightscout.androidaps.data.IobTotal
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.ValueWrapper
@@ -23,8 +26,6 @@ import info.nightscout.androidaps.database.entities.ValueWithUnit
import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.database.transactions.InvalidateExtendedBolusTransaction
import info.nightscout.androidaps.database.transactions.InvalidateTemporaryBasalTransaction
-import info.nightscout.androidaps.databinding.TreatmentsTempbasalsFragmentBinding
-import info.nightscout.androidaps.databinding.TreatmentsTempbasalsItemBinding
import info.nightscout.androidaps.events.EventTempBasalChange
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.toStringFull
@@ -44,6 +45,10 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
+import info.nightscout.ui.R
+import info.nightscout.ui.activities.fragments.TreatmentsTemporaryBasalsFragment.RecyclerViewAdapter.TempBasalsViewHolder
+import info.nightscout.ui.databinding.TreatmentsTempbasalsFragmentBinding
+import info.nightscout.ui.databinding.TreatmentsTempbasalsItemBinding
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.concurrent.TimeUnit
@@ -104,7 +109,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment(), MenuProvider {
.getExtendedBolusDataFromTime(now - millsToThePast, false)
.map { eb -> eb.map { profileFunction.getProfile(it.timestamp)?.let { profile -> it.toTemporaryBasal(profile) } } }
- fun swapAdapter() {
+ private fun swapAdapter() {
val now = System.currentTimeMillis()
binding.recyclerview.isLoading = true
disposable +=
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsUserEntryFragment.kt
similarity index 94%
rename from app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
rename to ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsUserEntryFragment.kt
index 3219eeb5bb..71b81e6f4c 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
+++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsUserEntryFragment.kt
@@ -1,19 +1,21 @@
-package info.nightscout.androidaps.activities.fragments
+package info.nightscout.ui.activities.fragments
import android.os.Bundle
-import android.view.*
+import android.view.LayoutInflater
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
import androidx.core.view.MenuProvider
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
-import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.database.entities.UserEntry
import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources
-import info.nightscout.androidaps.databinding.TreatmentsUserEntryFragmentBinding
-import info.nightscout.androidaps.databinding.TreatmentsUserEntryItemBinding
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ImportExportPrefs
@@ -25,10 +27,12 @@ import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.ToastUtils
-import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
+import info.nightscout.ui.R
+import info.nightscout.ui.databinding.TreatmentsUserEntryFragmentBinding
+import info.nightscout.ui.databinding.TreatmentsUserEntryItemBinding
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
@@ -42,7 +46,6 @@ class TreatmentsUserEntryFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var rxBus: RxBus
- @Inject lateinit var translator: Translator
@Inject lateinit var importExportPrefs: ImportExportPrefs
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var userEntryPresentationHelper: UserEntryPresentationHelper
@@ -78,7 +81,7 @@ class TreatmentsUserEntryFragment : DaggerFragment(), MenuProvider {
}
}
- fun swapAdapter() {
+ private fun swapAdapter() {
val now = System.currentTimeMillis()
binding.recyclerview.isLoading = true
disposable +=
diff --git a/ui/src/main/java/info/nightscout/ui/di/UiModule.kt b/ui/src/main/java/info/nightscout/ui/di/UiModule.kt
index c5f6caac86..c7c43c22ba 100644
--- a/ui/src/main/java/info/nightscout/ui/di/UiModule.kt
+++ b/ui/src/main/java/info/nightscout/ui/di/UiModule.kt
@@ -7,9 +7,18 @@ import info.nightscout.ui.activities.ErrorHelperActivity
import info.nightscout.ui.activities.StatsActivity
import info.nightscout.ui.activities.SurveyActivity
import info.nightscout.ui.activities.TDDStatsActivity
+import info.nightscout.ui.activities.TreatmentsActivity
+import info.nightscout.ui.activities.fragments.TreatmentsBolusCarbsFragment
+import info.nightscout.ui.activities.fragments.TreatmentsCareportalFragment
+import info.nightscout.ui.activities.fragments.TreatmentsExtendedBolusesFragment
+import info.nightscout.ui.activities.fragments.TreatmentsProfileSwitchFragment
+import info.nightscout.ui.activities.fragments.TreatmentsTempTargetFragment
+import info.nightscout.ui.activities.fragments.TreatmentsTemporaryBasalsFragment
+import info.nightscout.ui.activities.fragments.TreatmentsUserEntryFragment
import info.nightscout.ui.dialogs.CalibrationDialog
import info.nightscout.ui.dialogs.CarbsDialog
import info.nightscout.ui.dialogs.CareDialog
+import info.nightscout.ui.dialogs.WizardInfoDialog
@Module
@Suppress("unused")
@@ -18,11 +27,21 @@ abstract class UiModule {
@ContributesAndroidInjector abstract fun contributesCalibrationDialog(): CalibrationDialog
@ContributesAndroidInjector abstract fun contributesCarbsDialog(): CarbsDialog
@ContributesAndroidInjector abstract fun contributesCareDialog(): CareDialog
+ @ContributesAndroidInjector abstract fun contributesWizardInfoDialog(): WizardInfoDialog
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
@ContributesAndroidInjector abstract fun contributeBolusProgressHelperActivity(): BolusProgressHelperActivity
@ContributesAndroidInjector abstract fun contributeErrorHelperActivity(): ErrorHelperActivity
@ContributesAndroidInjector abstract fun contributesStatsActivity(): StatsActivity
@ContributesAndroidInjector abstract fun contributesSurveyActivity(): SurveyActivity
+ @ContributesAndroidInjector abstract fun contributesTreatmentsActivity(): TreatmentsActivity
+
+ @ContributesAndroidInjector abstract fun contributesTreatmentsBolusFragment(): TreatmentsBolusCarbsFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsTemporaryBasalsFragment(): TreatmentsTemporaryBasalsFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsTempTargetFragment(): TreatmentsTempTargetFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsExtendedBolusesFragment(): TreatmentsExtendedBolusesFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsCareportalFragment(): TreatmentsCareportalFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsProfileSwitchFragment(): TreatmentsProfileSwitchFragment
+ @ContributesAndroidInjector abstract fun contributesTreatmentsUserEntryFragment(): TreatmentsUserEntryFragment
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt
similarity index 91%
rename from app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt
rename to ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt
index 1ec1c3907d..8a0f1c7b16 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt
+++ b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.dialogs
+package info.nightscout.ui.dialogs
import android.os.Bundle
import android.view.LayoutInflater
@@ -8,16 +8,15 @@ import android.view.Window
import android.view.WindowManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.Constants
-import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.entities.BolusCalculatorResult
-import info.nightscout.androidaps.databinding.DialogWizardinfoBinding
import info.nightscout.androidaps.extensions.bolusCalculatorResultFromJson
import info.nightscout.androidaps.extensions.toJson
import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.androidaps.utils.DateUtil
-import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.ui.R
+import info.nightscout.ui.databinding.DialogWizardinfoBinding
import org.json.JSONObject
import javax.inject.Inject
@@ -91,13 +90,13 @@ class WizardInfoDialog : DaggerDialogFragment() {
binding.basalIobInsulin.text = rh.gs(R.string.formatinsulinunits, data.basalIOB)
binding.basalIobCheckbox.isChecked = data.wasBasalIOBUsed
// Superbolus
- binding.sbinsulin.text = rh.gs(R.string.formatinsulinunits, data.superbolusInsulin)
+ binding.sbInsulin.text = rh.gs(R.string.formatinsulinunits, data.superbolusInsulin)
binding.sbCheckbox.isChecked = data.wasSuperbolusUsed
// Carbs
binding.carbs.text = rh.gs(R.string.format_carbs_ic, data.carbs, data.ic)
- binding.carbsinsulin.text = rh.gs(R.string.formatinsulinunits, data.carbsInsulin)
+ binding.carbsInsulin.text = rh.gs(R.string.formatinsulinunits, data.carbsInsulin)
// Correction
- binding.correctioninsulin.text = rh.gs(R.string.formatinsulinunits, data.otherCorrection)
+ binding.correctionInsulin.text = rh.gs(R.string.formatinsulinunits, data.otherCorrection)
// Profile
binding.profile.text = data.profileName
// Notes
@@ -105,7 +104,7 @@ class WizardInfoDialog : DaggerDialogFragment() {
// Percentage
binding.percentUsed.text = rh.gs(R.string.format_percent, data.percentageCorrection)
// Total
- binding.totalinsulin.text = rh.gs(R.string.formatinsulinunits, data.totalInsulin)
+ binding.totalInsulin.text = rh.gs(R.string.formatinsulinunits, data.totalInsulin)
}
override fun onStart() {
@@ -117,4 +116,4 @@ class WizardInfoDialog : DaggerDialogFragment() {
super.onDestroyView()
_binding = null
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_visibility.xml b/ui/src/main/res/drawable/ic_visibility.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_visibility.xml
rename to ui/src/main/res/drawable/ic_visibility.xml
diff --git a/app/src/main/res/drawable/ic_visibility_off.xml b/ui/src/main/res/drawable/ic_visibility_off.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_visibility_off.xml
rename to ui/src/main/res/drawable/ic_visibility_off.xml
diff --git a/app/src/main/res/layout/dialog_wizardinfo.xml b/ui/src/main/res/layout/dialog_wizardinfo.xml
similarity index 98%
rename from app/src/main/res/layout/dialog_wizardinfo.xml
rename to ui/src/main/res/layout/dialog_wizardinfo.xml
index bc36dc0873..2e201e94af 100644
--- a/app/src/main/res/layout/dialog_wizardinfo.xml
+++ b/ui/src/main/res/layout/dialog_wizardinfo.xml
@@ -265,7 +265,7 @@
android:textAppearance="?android:attr/textAppearanceSmall" />
+ tools:context=".activities.fragments.TreatmentsBolusCarbsFragment">
+ tools:context="activities.fragments.TreatmentsCareportalFragment">
+ tools:context=".activities.fragments.TreatmentsExtendedBolusesFragment">
+ tools:context=".activities.TreatmentsActivity">
diff --git a/app/src/main/res/layout/treatments_profileswitch_fragment.xml b/ui/src/main/res/layout/treatments_profileswitch_fragment.xml
similarity index 91%
rename from app/src/main/res/layout/treatments_profileswitch_fragment.xml
rename to ui/src/main/res/layout/treatments_profileswitch_fragment.xml
index ea767a0ae8..08b0686dae 100644
--- a/app/src/main/res/layout/treatments_profileswitch_fragment.xml
+++ b/ui/src/main/res/layout/treatments_profileswitch_fragment.xml
@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- tools:context="info.nightscout.androidaps.activities.fragments.TreatmentsProfileSwitchFragment">
+ tools:context=".activities.fragments.TreatmentsProfileSwitchFragment">
+ tools:context=".activities.fragments.TreatmentsTemporaryBasalsFragment">
+ tools:context=".activities.fragments.TreatmentsTempTargetFragment">
+ tools:context=".activities.fragments.TreatmentsUserEntryFragment">
diff --git a/app/src/main/res/menu/menu_treatments_extended_bolus.xml b/ui/src/main/res/menu/menu_treatments_extended_bolus.xml
similarity index 100%
rename from app/src/main/res/menu/menu_treatments_extended_bolus.xml
rename to ui/src/main/res/menu/menu_treatments_extended_bolus.xml
diff --git a/app/src/main/res/menu/menu_treatments_profile_switch.xml b/ui/src/main/res/menu/menu_treatments_profile_switch.xml
similarity index 100%
rename from app/src/main/res/menu/menu_treatments_profile_switch.xml
rename to ui/src/main/res/menu/menu_treatments_profile_switch.xml
diff --git a/app/src/main/res/menu/menu_treatments_temp_basal.xml b/ui/src/main/res/menu/menu_treatments_temp_basal.xml
similarity index 100%
rename from app/src/main/res/menu/menu_treatments_temp_basal.xml
rename to ui/src/main/res/menu/menu_treatments_temp_basal.xml
diff --git a/app/src/main/res/menu/menu_treatments_temp_target.xml b/ui/src/main/res/menu/menu_treatments_temp_target.xml
similarity index 100%
rename from app/src/main/res/menu/menu_treatments_temp_target.xml
rename to ui/src/main/res/menu/menu_treatments_temp_target.xml
diff --git a/app/src/main/res/menu/menu_treatments_user_entry.xml b/ui/src/main/res/menu/menu_treatments_user_entry.xml
similarity index 100%
rename from app/src/main/res/menu/menu_treatments_user_entry.xml
rename to ui/src/main/res/menu/menu_treatments_user_entry.xml
diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml
index fc6331d542..d05a24345a 100644
--- a/ui/src/main/res/values/strings.xml
+++ b/ui/src/main/res/values/strings.xml
@@ -39,4 +39,47 @@
Meter
Sensor
+
+ %1$s ISF: %2$.1f
+ %1$.1fg IC: %2$.1f
+ %1$.0fg IC: %2$.1f
+ %1$d%%
+ Superbolus
+ Total
+
+
+ No records available
+ Calc
+ IOB:
+ INVALID
+ Insulin:
+ Carbs:
+ Total IOB:
+ Total IOB activity:
+ Dur:
+ Ratio:
+ Ins:
+ IOB:
+ Total IOB:
+ TT
+ Corr
+ Meal
+ Prime
+ Profile changes
+ Temp Targets
+ Carbs and bolus
+ Show invalidated / removed records
+ Hide invalidated / removed records
+ Refresh from Nightscout
+ Refresh from NS
+ Show invalidated
+ Hide invalidated
+ Remove AAPS started entries
+ Hide loop
+ Show loop
+ User entry
+ Clone
+ Show loop records
+ Hide loop records
+