From 9dc85d4e14227117206163af00193618a67ee09a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 1 Jun 2022 08:02:50 +0200 Subject: [PATCH 01/42] Gradle: enable build cache --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index 489d41472f..9e4747695e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,3 +21,4 @@ org.gradle.jvmargs=-Xmx2g android.enableJetifier=true android.useAndroidX=true +org.gradle.unsafe.configuration-cache=true From 06feba5fe9705a58851dda5d74e79bcb523e3f81 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sat, 4 Jun 2022 21:34:52 +0200 Subject: [PATCH 02/42] Fix Autotune UserEntry with Automation --- .../androidaps/plugins/general/autotune/AutotunePlugin.kt | 7 ++++--- .../general/automation/actions/ActionRunAutotune.kt | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt index 9a7839f600..320a0d212b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt @@ -161,7 +161,8 @@ class AutotunePlugin @Inject constructor( updateProfile(tunedP) uel.log( UserEntry.Action.STORE_PROFILE, - UserEntry.Sources.Autotune, + UserEntry.Sources.Automation, + rh.gs(R.string.autotune), ValueWithUnit.SimpleString(tunedP.profilename) ) updateButtonVisibility = View.GONE @@ -178,8 +179,8 @@ class AutotunePlugin @Inject constructor( log("Profile Switch succeed ${tunedP.profilename}") uel.log( UserEntry.Action.PROFILE_SWITCH, - UserEntry.Sources.Autotune, - "Autotune AutoSwitch", + UserEntry.Sources.Automation, + rh.gs(R.string.autotune), ValueWithUnit.SimpleString(tunedP.profilename)) } rxBus.send(EventLocalProfileChanged()) diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt index 27b26108f0..c2687fffed 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/actions/ActionRunAutotune.kt @@ -28,7 +28,6 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) { @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var sp: SP - @Inject lateinit var uel: UserEntryLogger var defaultValue = 0 private var inputProfileName = InputProfileName(rh, activePlugin, "", true) From d9916c3d50b15397dd0f96ecc91a8950c4d4c54d Mon Sep 17 00:00:00 2001 From: Philoul Date: Sat, 4 Jun 2022 21:45:38 +0200 Subject: [PATCH 03/42] Hide Autotune detailed log setting --- .../androidaps/plugins/general/autotune/AutotuneFragment.kt | 1 + app/src/main/res/xml/pref_autotune.xml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt index b968c7fc88..a3c6fa80c5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt @@ -79,6 +79,7 @@ class AutotuneFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) sp.putBoolean(R.string.key_autotune_tune_insulin_curve, false) // put to false tune insulin curve + sp.putBoolean(R.string.key_autotune_additional_log, false) // put to false additional log autotunePlugin.lastRun = sp.getLong(R.string.key_autotune_last_run, 0) if (autotunePlugin.lastNbDays.isEmpty()) autotunePlugin.lastNbDays = sp.getInt(R.string.key_autotune_default_tune_days, 5).toString() diff --git a/app/src/main/res/xml/pref_autotune.xml b/app/src/main/res/xml/pref_autotune.xml index 35abef7d12..fc5f6dbc72 100644 --- a/app/src/main/res/xml/pref_autotune.xml +++ b/app/src/main/res/xml/pref_autotune.xml @@ -36,11 +36,12 @@ android:key="@string/key_autotune_circadian_ic_isf" android:summary="@string/autotune_circadian_ic_isf_summary" android:title="@string/autotune_circadian_ic_isf_title" /> - + \ No newline at end of file From 46a56809034eaf9f5a9a40f67333cf7a17cfce32 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 6 Jun 2022 10:25:08 +0200 Subject: [PATCH 04/42] gradle update --- app/build.gradle | 2 ++ app/src/main/AndroidManifest.xml | 3 +-- automation/build.gradle | 3 +++ automation/src/main/AndroidManifest.xml | 3 +-- build.gradle | 2 +- combo/build.gradle | 3 +++ combo/src/main/AndroidManifest.xml | 3 +-- core/build.gradle | 4 ++++ core/src/main/AndroidManifest.xml | 3 +-- dana/build.gradle | 2 ++ dana/src/main/AndroidManifest.xml | 3 +-- danar/build.gradle | 3 +++ danar/src/main/AndroidManifest.xml | 3 +-- danars/build.gradle | 1 + danars/src/main/AndroidManifest.xml | 3 +-- database/build.gradle | 2 ++ database/src/main/AndroidManifest.xml | 3 +-- diaconn/build.gradle | 2 ++ diaconn/src/main/AndroidManifest.xml | 3 +-- insight/build.gradle | 2 ++ insight/src/main/AndroidManifest.xml | 3 +-- medtronic/build.gradle | 3 +++ medtronic/src/main/AndroidManifest.xml | 3 +-- omnipod-common/build.gradle | 3 +++ omnipod-common/src/main/AndroidManifest.xml | 3 +-- omnipod-dash/build.gradle | 2 ++ omnipod-dash/src/main/AndroidManifest.xml | 3 +-- omnipod-eros/build.gradle | 2 ++ omnipod-eros/src/main/AndroidManifest.xml | 3 +-- openhumans/build.gradle | 3 +++ openhumans/src/main/AndroidManifest.xml | 3 +-- pump-common/build.gradle | 3 +++ pump-common/src/main/AndroidManifest.xml | 2 +- rileylink/build.gradle | 3 +++ rileylink/src/main/AndroidManifest.xml | 3 +-- shared/build.gradle | 2 ++ shared/src/main/AndroidManifest.xml | 3 +-- wear/build.gradle | 1 + wear/src/main/AndroidManifest.xml | 3 +-- 39 files changed, 66 insertions(+), 38 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f125a9e74c..c37650c720 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -104,6 +104,8 @@ tasks.matching { it instanceof Test }.all { } android { + + namespace 'info.nightscout.androidaps' ndkVersion "21.1.6352462" defaultConfig { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index aaa245f3bf..8cb2f771fb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/automation/build.gradle b/automation/build.gradle index 79564845d5..e1107c676f 100644 --- a/automation/build.gradle +++ b/automation/build.gradle @@ -8,6 +8,9 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" +android { + namespace 'info.nightscout.androidaps.automation' +} dependencies { diff --git a/automation/src/main/AndroidManifest.xml b/automation/src/main/AndroidManifest.xml index 3396187ca4..94da5bcfde 100644 --- a/automation/src/main/AndroidManifest.xml +++ b/automation/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/build.gradle b/build.gradle index 46c6aa6926..e33b5b9e46 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } // jacoco 0.2 } dependencies { - classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.android.tools.build:gradle:7.2.0' classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0' diff --git a/combo/build.gradle b/combo/build.gradle index 7605e4667d..a3faa431e6 100644 --- a/combo/build.gradle +++ b/combo/build.gradle @@ -8,6 +8,9 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" +android { + namespace 'info.nightscout.androidaps.combo' +} dependencies { implementation project(':core') diff --git a/combo/src/main/AndroidManifest.xml b/combo/src/main/AndroidManifest.xml index a5aa9f0e8e..11b940a009 100644 --- a/combo/src/main/AndroidManifest.xml +++ b/combo/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/core/build.gradle b/core/build.gradle index b3fef255db..f1b51650c2 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -15,3 +15,7 @@ dependencies { implementation project(':shared') implementation project(':database') } + +android { + namespace 'info.nightscout.androidaps.core' +} diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml index 9f170d4340..6cd58651e5 100644 --- a/core/src/main/AndroidManifest.xml +++ b/core/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/dana/build.gradle b/dana/build.gradle index 64bc021517..f03521d269 100644 --- a/dana/build.gradle +++ b/dana/build.gradle @@ -10,6 +10,8 @@ apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" android { + + namespace 'info.nightscout.androidaps.dana' defaultConfig { kapt { arguments { diff --git a/dana/src/main/AndroidManifest.xml b/dana/src/main/AndroidManifest.xml index dda39a96f5..af4b1f4b1e 100644 --- a/dana/src/main/AndroidManifest.xml +++ b/dana/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/danar/build.gradle b/danar/build.gradle index 6a273260c5..7fe1ba8c55 100644 --- a/danar/build.gradle +++ b/danar/build.gradle @@ -8,6 +8,9 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" +android { + namespace 'info.nightscout.androidaps.danar' +} dependencies { implementation project(':core') diff --git a/danar/src/main/AndroidManifest.xml b/danar/src/main/AndroidManifest.xml index afa0e2ef98..df2a5d9b43 100644 --- a/danar/src/main/AndroidManifest.xml +++ b/danar/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/danars/build.gradle b/danars/build.gradle index 96b60d2931..2f0b2a46a4 100644 --- a/danars/build.gradle +++ b/danars/build.gradle @@ -11,6 +11,7 @@ apply from: "${project.rootDir}/core/jacoco_global.gradle" android { ndkVersion "21.1.6352462" + namespace 'info.nightscout.androidaps.danars' defaultConfig { diff --git a/danars/src/main/AndroidManifest.xml b/danars/src/main/AndroidManifest.xml index 9588230a7d..c0a4377e25 100644 --- a/danars/src/main/AndroidManifest.xml +++ b/danars/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/database/build.gradle b/database/build.gradle index b990da9e89..d67b86c464 100644 --- a/database/build.gradle +++ b/database/build.gradle @@ -7,6 +7,8 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" android { + + namespace 'info.nightscout.androidaps.database' defaultConfig { kapt { arguments { diff --git a/database/src/main/AndroidManifest.xml b/database/src/main/AndroidManifest.xml index fa796cae8a..94cbbcfc39 100644 --- a/database/src/main/AndroidManifest.xml +++ b/database/src/main/AndroidManifest.xml @@ -1,2 +1 @@ - + diff --git a/diaconn/build.gradle b/diaconn/build.gradle index 64bc021517..84034c07ae 100644 --- a/diaconn/build.gradle +++ b/diaconn/build.gradle @@ -10,6 +10,8 @@ apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" android { + + namespace 'info.nightscout.androidaps.diaconn' defaultConfig { kapt { arguments { diff --git a/diaconn/src/main/AndroidManifest.xml b/diaconn/src/main/AndroidManifest.xml index 290eecf25f..b4487ffda6 100644 --- a/diaconn/src/main/AndroidManifest.xml +++ b/diaconn/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/insight/build.gradle b/insight/build.gradle index 64bc021517..623c52532a 100644 --- a/insight/build.gradle +++ b/insight/build.gradle @@ -10,6 +10,8 @@ apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" android { + + namespace 'info.nightscout.androidaps.insight' defaultConfig { kapt { arguments { diff --git a/insight/src/main/AndroidManifest.xml b/insight/src/main/AndroidManifest.xml index 7e05839276..d8d973e0b3 100644 --- a/insight/src/main/AndroidManifest.xml +++ b/insight/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/medtronic/build.gradle b/medtronic/build.gradle index 7b00d238c8..89b2f37c51 100644 --- a/medtronic/build.gradle +++ b/medtronic/build.gradle @@ -8,6 +8,9 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" +android { + namespace 'info.nightscout.androidaps.plugins.pump.medtronic' +} dependencies { implementation project(':core') diff --git a/medtronic/src/main/AndroidManifest.xml b/medtronic/src/main/AndroidManifest.xml index 9738faa19c..6c2ac78309 100644 --- a/medtronic/src/main/AndroidManifest.xml +++ b/medtronic/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/omnipod-common/build.gradle b/omnipod-common/build.gradle index 5a2e5bfac4..3d4aab407b 100644 --- a/omnipod-common/build.gradle +++ b/omnipod-common/build.gradle @@ -9,6 +9,9 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" +android { + namespace 'info.nightscout.androidaps.plugins.pump.omnipod.common' +} dependencies { implementation project(':core') diff --git a/omnipod-common/src/main/AndroidManifest.xml b/omnipod-common/src/main/AndroidManifest.xml index 5f59d2c48f..9d6e11f691 100644 --- a/omnipod-common/src/main/AndroidManifest.xml +++ b/omnipod-common/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/omnipod-dash/build.gradle b/omnipod-dash/build.gradle index c6c5734f70..631dec2207 100644 --- a/omnipod-dash/build.gradle +++ b/omnipod-dash/build.gradle @@ -17,6 +17,8 @@ detekt { // TODO move to `subprojects` section in global build.gradle } android { + + namespace 'info.nightscout.androidaps.plugins.pump.omnipod.dash' defaultConfig { kapt { arguments { diff --git a/omnipod-dash/src/main/AndroidManifest.xml b/omnipod-dash/src/main/AndroidManifest.xml index 68a2f71c0b..ee32e26eea 100644 --- a/omnipod-dash/src/main/AndroidManifest.xml +++ b/omnipod-dash/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/omnipod-eros/build.gradle b/omnipod-eros/build.gradle index 9bc119cef9..a748715b9d 100644 --- a/omnipod-eros/build.gradle +++ b/omnipod-eros/build.gradle @@ -10,6 +10,8 @@ apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" android { + + namespace 'info.nightscout.androidaps.plugins.pump.omnipod.eros' defaultConfig { kapt { arguments { diff --git a/omnipod-eros/src/main/AndroidManifest.xml b/omnipod-eros/src/main/AndroidManifest.xml index 68957b8696..02eb4fc2fa 100644 --- a/omnipod-eros/src/main/AndroidManifest.xml +++ b/omnipod-eros/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/openhumans/build.gradle b/openhumans/build.gradle index 79564845d5..ead419045a 100644 --- a/openhumans/build.gradle +++ b/openhumans/build.gradle @@ -8,6 +8,9 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" +android { + namespace 'info.nightscout.androidaps.plugin.general.openhumans' +} dependencies { diff --git a/openhumans/src/main/AndroidManifest.xml b/openhumans/src/main/AndroidManifest.xml index ed6ea8dc06..11cb7d1764 100644 --- a/openhumans/src/main/AndroidManifest.xml +++ b/openhumans/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + + diff --git a/rileylink/build.gradle b/rileylink/build.gradle index 0647e1d938..24ac3125e8 100644 --- a/rileylink/build.gradle +++ b/rileylink/build.gradle @@ -8,6 +8,9 @@ apply from: "${project.rootDir}/core/android_dependencies.gradle" apply from: "${project.rootDir}/core/android_module_dependencies.gradle" apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" +android { + namespace 'info.nightscout.androidaps.plugins.pump.common.hw.rileylink' +} dependencies { implementation project(':core') diff --git a/rileylink/src/main/AndroidManifest.xml b/rileylink/src/main/AndroidManifest.xml index 2efb9aa635..17c2a20a5e 100644 --- a/rileylink/src/main/AndroidManifest.xml +++ b/rileylink/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/shared/build.gradle b/shared/build.gradle index 381cfdc40e..3a6a62902e 100644 --- a/shared/build.gradle +++ b/shared/build.gradle @@ -11,6 +11,8 @@ apply from: "${project.rootDir}/core/test_dependencies.gradle" apply from: "${project.rootDir}/core/jacoco_global.gradle" android { + + namespace 'info.nightscout.shared' defaultConfig { minSdkVersion 23 // for wear } diff --git a/shared/src/main/AndroidManifest.xml b/shared/src/main/AndroidManifest.xml index c299e9eece..a5918e68ab 100644 --- a/shared/src/main/AndroidManifest.xml +++ b/shared/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + \ No newline at end of file diff --git a/wear/build.gradle b/wear/build.gradle index 9bfdcf3e1f..ddcfcbfa2f 100644 --- a/wear/build.gradle +++ b/wear/build.gradle @@ -76,6 +76,7 @@ android { versionName version + "-nsclient" } } + namespace 'info.nightscout.androidaps' } allprojects { diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml index 1b75866fe8..88b52fc779 100644 --- a/wear/src/main/AndroidManifest.xml +++ b/wear/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> From 15a9cef6fd750b081a04de3ca07518b68364c44e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 6 Jun 2022 10:27:18 +0200 Subject: [PATCH 05/42] fix warnings --- .../androidaps/interaction/menus/FillMenuActivity.kt | 4 ++-- .../androidaps/interaction/menus/MainMenuActivity.kt | 4 ++-- .../androidaps/interaction/menus/StatusMenuActivity.kt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.kt index 20ac94ad81..552f26f391 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.kt +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/FillMenuActivity.kt @@ -23,8 +23,8 @@ class FillMenuActivity : MenuListActivity() { add(MenuItem(R.drawable.ic_canula, getString(R.string.action_free_amount))) } - override fun doAction(action: String) { - when (action) { + override fun doAction(position: String) { + when (position) { getString(R.string.action_preset_1) -> rxBus.send(EventWearToMobile(EventData.ActionFillPresetPreCheck(1))) getString(R.string.action_preset_2) -> rxBus.send(EventWearToMobile(EventData.ActionFillPresetPreCheck(2))) getString(R.string.action_preset_3) -> rxBus.send(EventWearToMobile(EventData.ActionFillPresetPreCheck(3))) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.kt index 5b24ece99c..68ea46c780 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.kt +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/MainMenuActivity.kt @@ -40,8 +40,8 @@ class MainMenuActivity : MenuListActivity() { } } - override fun doAction(action: String) { - when (action) { + override fun doAction(position: String) { + when (position) { getString(R.string.menu_settings) -> startActivity(Intent(this, WatchfaceConfigurationActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }) getString(R.string.menu_resync) -> rxBus.send(EventWearToMobile(ActionResendData("Re-Sync"))) getString(R.string.status_profile_switch) -> rxBus.send(EventWearToMobile(EventData.ActionProfileSwitchSendInitialData(System.currentTimeMillis()))) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.kt index f7abab22cc..c6705cedf3 100644 --- a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.kt +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/StatusMenuActivity.kt @@ -22,8 +22,8 @@ class StatusMenuActivity : MenuListActivity() { add(MenuItem(R.drawable.ic_tdd, getString(R.string.status_tdd))) } - override fun doAction(action: String) { - when (action) { + override fun doAction(position: String) { + when (position) { getString(R.string.status_pump) -> rxBus.send(EventWearToMobile(ActionPumpStatus(System.currentTimeMillis()))) getString(R.string.status_loop) -> rxBus.send(EventWearToMobile(ActionLoopStatus(System.currentTimeMillis()))) getString(R.string.status_tdd) -> rxBus.send(EventWearToMobile(ActionTddStatus(System.currentTimeMillis()))) From c2889710089f2a4e9c2a5619709b085696b3e3c8 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 6 Jun 2022 10:41:45 +0200 Subject: [PATCH 06/42] gradle update --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e33b5b9e46..46c6aa6926 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } // jacoco 0.2 } dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' + classpath 'com.android.tools.build:gradle:7.2.1' classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0' From 02d8e9928e848d6491b9cf82bea8a9d66c91646c Mon Sep 17 00:00:00 2001 From: Philoul Date: Mon, 6 Jun 2022 12:53:00 +0200 Subject: [PATCH 07/42] Save Autotune lastRun and Load LastRun after AAPS restart --- .../general/autotune/AutotuneFragment.kt | 4 +- .../general/autotune/AutotunePlugin.kt | 51 ++++++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt index b968c7fc88..85e7d2fb87 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt @@ -79,7 +79,7 @@ class AutotuneFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) sp.putBoolean(R.string.key_autotune_tune_insulin_curve, false) // put to false tune insulin curve - autotunePlugin.lastRun = sp.getLong(R.string.key_autotune_last_run, 0) + autotunePlugin.loadLastRun() if (autotunePlugin.lastNbDays.isEmpty()) autotunePlugin.lastNbDays = sp.getInt(R.string.key_autotune_default_tune_days, 5).toString() val defaultValue = sp.getInt(R.string.key_autotune_default_tune_days, 5).toDouble() @@ -144,6 +144,7 @@ class AutotuneFragment : DaggerFragment() { autotunePlugin.tunedProfile?.profilename = localName autotunePlugin.updateProfile(autotunePlugin.tunedProfile) autotunePlugin.updateButtonVisibility = View.GONE + autotunePlugin.saveLastRun() uel.log( UserEntry.Action.STORE_PROFILE, UserEntry.Sources.Autotune, @@ -163,6 +164,7 @@ class AutotuneFragment : DaggerFragment() { autotunePlugin.tunedProfile?.profilename = "" autotunePlugin.updateProfile(autotunePlugin.pumpProfile) autotunePlugin.updateButtonVisibility = View.VISIBLE + autotunePlugin.saveLastRun() uel.log( UserEntry.Action.STORE_PROFILE, UserEntry.Sources.Autotune, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt index 9a7839f600..948904944c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt @@ -7,6 +7,7 @@ import info.nightscout.androidaps.data.LocalInsulin import info.nightscout.androidaps.data.ProfileSealed import info.nightscout.androidaps.database.entities.UserEntry import info.nightscout.androidaps.database.entities.ValueWithUnit +import info.nightscout.androidaps.extensions.pureProfileFromJson import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus @@ -16,6 +17,7 @@ import info.nightscout.androidaps.plugins.general.autotune.events.EventAutotuneU import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.JsonHelper import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.buildHelper.BuildHelper @@ -187,7 +189,7 @@ class AutotunePlugin @Inject constructor( } } lastRunSuccess = true - sp.putLong(R.string.key_autotune_last_run, lastRun) + saveLastRun() rxBus.send(EventAutotuneUpdateGui()) calculationRunning = false tunedProfile?.let { @@ -296,6 +298,53 @@ class AutotunePlugin @Inject constructor( localProfilePlugin.storeSettings() } + fun saveLastRun() { + val json = JSONObject() + json.put("lastNbDays", lastNbDays) + json.put("lastRun",lastRun) + json.put("pumpProfile", pumpProfile.profile.toPureNsJson(dateUtil)) + json.put("pumpProfileName", pumpProfile.profilename) + json.put("pumpPeak", pumpProfile.peak) + json.put("pumpDia", pumpProfile.dia) + json.put("tunedProfile", tunedProfile?.profile?.toPureNsJson(dateUtil)) + json.put("tunedCircadianProfile", tunedProfile?.circadianProfile?.toPureNsJson(dateUtil)) + json.put("tunedProfileName", tunedProfile?.profilename) + json.put("tunedPeak", tunedProfile?.peak) + json.put("tunedDia", tunedProfile?.dia) + json.put("result", result) + json.put("updateButtonVisibility", updateButtonVisibility) + sp.putString(R.string.key_autotune_last_run, json.toString()) + } + + fun loadLastRun() { + result = "" + lastRunSuccess = false + val json = JSONObject(sp.getString(R.string.key_autotune_last_run, "")) + lastNbDays = JsonHelper.safeGetString(json, "lastNbDays", "") + lastRun = JsonHelper.safeGetLong(json, "lastRun") + val pumpPeak = JsonHelper.safeGetInt(json, "pumpPeak") + val pumpDia = JsonHelper.safeGetDouble(json, "pumpDia") + var localInsulin = LocalInsulin("PumpInsulin", pumpPeak, pumpDia) + selectedProfile = JsonHelper.safeGetString(json, "pumpProfileName", "") + val profile = JsonHelper.safeGetJSONObject(json, "pumpProfile", null)?.let { pureProfileFromJson(it, dateUtil) } + ?:return + pumpProfile = ATProfile(ProfileSealed.Pure(profile), localInsulin, injector).also { it.profilename = selectedProfile } + val tunedPeak = JsonHelper.safeGetInt(json, "tunedPeak") + val tunedDia = JsonHelper.safeGetDouble(json, "tunedDia") + localInsulin = LocalInsulin("PumpInsulin", tunedPeak, tunedDia) + val tunedProfileName = JsonHelper.safeGetString(json, "tunedProfileName", "") + val tuned = JsonHelper.safeGetJSONObject(json, "tunedProfile", null)?.let { pureProfileFromJson(it, dateUtil) } + ?: return + val circadianTuned = JsonHelper.safeGetJSONObject(json, "tunedCircadianProfile", null)?.let { pureProfileFromJson(it, dateUtil) } + ?: return + tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile -> + atProfile.profilename = tunedProfileName + atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned) + } + result = JsonHelper.safeGetString(json, "result", "") + updateButtonVisibility = JsonHelper.safeGetInt(json, "updateButtonVisibility") + lastRunSuccess = true + } private fun log(message: String) { atLog("[Plugin] $message") From e89e5102f748f59de29dbb408b8797c3ef9e1d16 Mon Sep 17 00:00:00 2001 From: Philoul Date: Mon, 6 Jun 2022 18:30:01 +0200 Subject: [PATCH 08/42] Restore LastRun results with click on LastRun date --- .../plugins/general/autotune/AutotuneFragment.kt | 9 ++++++++- app/src/main/res/layout/autotune_fragment.xml | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt index 85e7d2fb87..5ab8cb1dcf 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.general.autotune +import android.graphics.Paint import android.graphics.Typeface import android.os.Bundle import android.text.Editable @@ -253,6 +254,12 @@ class AutotuneFragment : DaggerFragment() { } } } + + binding.tuneLastrun.setOnClickListener { + autotunePlugin.loadLastRun() + updateGui() + } + binding.tuneLastrun.paintFlags = binding.tuneLastrun.paintFlags or Paint.UNDERLINE_TEXT_FLAG } @Synchronized @@ -265,7 +272,6 @@ class AutotuneFragment : DaggerFragment() { updateGui() }, { fabricPrivacy.logException(it) }) checkNewDay() - binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble() updateGui() } @@ -278,6 +284,7 @@ class AutotuneFragment : DaggerFragment() { @Synchronized private fun updateGui() { _binding ?: return + binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble() profileStore = activePlugin.activeProfileSource.profile ?: ProfileStore(injector, JSONObject(), dateUtil) profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString() profileFunction.getProfile()?.let { currentProfile -> diff --git a/app/src/main/res/layout/autotune_fragment.xml b/app/src/main/res/layout/autotune_fragment.xml index 003699e6ba..744b9a260e 100644 --- a/app/src/main/res/layout/autotune_fragment.xml +++ b/app/src/main/res/layout/autotune_fragment.xml @@ -140,7 +140,8 @@ android:gravity="start" android:paddingStart="5dp" android:paddingEnd="5dp" - android:textSize="14sp" /> + android:textSize="14sp" + android:textColor="@color/colorCalculatorButton"/> From 02148023fc900761860c6460bed6f5bd2b8f90fd Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Tue, 7 Jun 2022 09:03:47 +0200 Subject: [PATCH 09/42] fix: rounding rate in SMB, AMA, Dyn ISF reason --- app/src/main/assets/OpenAPSAMA/determine-basal.js | 14 +++++++------- app/src/main/assets/OpenAPSSMB/determine-basal.js | 12 ++++++------ .../assets/OpenAPSSMBDynamicISF/determine-basal.js | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/src/main/assets/OpenAPSAMA/determine-basal.js b/app/src/main/assets/OpenAPSAMA/determine-basal.js index 4e052e8e01..e31fb90a28 100644 --- a/app/src/main/assets/OpenAPSAMA/determine-basal.js +++ b/app/src/main/assets/OpenAPSAMA/determine-basal.js @@ -324,7 +324,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ rT.reason += ", but Min. Delta " + minDelta.toFixed(2) + " > Exp. Delta " + expectedDelta; } if (currenttemp.duration > 15 && (round_basal(basal, profile) === round_basal(currenttemp.rate, profile))) { - rT.reason += ", temp " + currenttemp.rate + " ~ req " + basal + "U/hr"; + rT.reason += ", temp " + currenttemp.rate + " ~ req " + round(basal, 2) + "U/hr"; return rT; } else { rT.reason += "; setting current basal of " + round(basal, 2) + " as temp"; @@ -367,10 +367,10 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (typeof currenttemp.rate !== 'undefined' && (currenttemp.duration > 5 && rate >= currenttemp.rate * 0.8)) { - rT.reason += ", temp " + currenttemp.rate + " ~< req " + rate + "U/hr"; + rT.reason += ", temp " + (currenttemp.rate).toFixed(3) + " ~< req " + round(rate, 2) + "U/hr"; return rT; } else { - rT.reason += ", setting " + rate + "U/hr"; + rT.reason += ", setting " + round(rate, 2) + "U/hr"; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } } @@ -476,22 +476,22 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ var insulinScheduled = currenttemp.duration * (currenttemp.rate - basal) / 60; if (insulinScheduled >= insulinReq * 2) { // if current temp would deliver >2x more than the required insulin, lower the rate - rT.reason += currenttemp.duration + "m@" + (currenttemp.rate - basal).toFixed(3) + " = " + insulinScheduled.toFixed(3) + " > 2 * req " + insulinReq + ". Setting temp basal of " + rate + "U/hr"; + rT.reason += currenttemp.duration + "m@" + (currenttemp.rate - basal).toFixed(3) + " = " + insulinScheduled.toFixed(3) + " > 2 * req " + insulinReq + ". Setting temp basal of " + round(rate, 2) + "U/hr"; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (typeof currenttemp.duration == 'undefined' || currenttemp.duration == 0) { // no temp is set - rT.reason += "no temp, setting " + rate + "U/hr"; + rT.reason += "no temp, setting " + round(rate, 2) + "U/hr"; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (currenttemp.duration > 5 && (round_basal(rate, profile) <= round_basal(currenttemp.rate, profile))) { // if required temp <~ existing temp basal - rT.reason += "temp " + currenttemp.rate + " >~ req " + rate + "U/hr"; + rT.reason += "temp " + (currenttemp.rate).toFixed(3) + " >~ req " + round(rate, 2) + "U/hr"; return rT; } // required temp > existing temp basal - rT.reason += "temp " + currenttemp.rate + "<" + rate + "U/hr"; + rT.reason += "temp " + (currenttemp.rate).toFixed(3) + " < " + round(rate, 2) + "U/hr"; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } diff --git a/app/src/main/assets/OpenAPSSMB/determine-basal.js b/app/src/main/assets/OpenAPSSMB/determine-basal.js index f7d952f141..f69317bfa6 100644 --- a/app/src/main/assets/OpenAPSSMB/determine-basal.js +++ b/app/src/main/assets/OpenAPSSMB/determine-basal.js @@ -955,7 +955,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (typeof currenttemp.rate !== 'undefined' && (currenttemp.duration > 5 && rate >= currenttemp.rate * 0.8)) { - rT.reason += ", temp " + currenttemp.rate + " ~< req " + rate + "U/hr. "; + rT.reason += ", temp " + currenttemp.rate + " ~< req " + round(rate, 2) + "U/hr. "; return rT; } else { // calculate a long enough zero temp to eventually correct back up to target @@ -976,7 +976,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return tempBasalFunctions.setTempBasal(rate, durationReq, profile, rT, currenttemp); } } else { - rT.reason += ", setting " + rate + "U/hr. "; + rT.reason += ", setting " + round(rate, 2) + "U/hr. "; } return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } @@ -1143,22 +1143,22 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ insulinScheduled = currenttemp.duration * (currenttemp.rate - basal) / 60; if (insulinScheduled >= insulinReq * 2) { // if current temp would deliver >2x more than the required insulin, lower the rate - rT.reason += currenttemp.duration + "m@" + (currenttemp.rate).toFixed(2) + " > 2 * insulinReq. Setting temp basal of " + rate + "U/hr. "; + rT.reason += currenttemp.duration + "m@" + (currenttemp.rate).toFixed(2) + " > 2 * insulinReq. Setting temp basal of " + round(rate, 2) + "U/hr. "; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (typeof currenttemp.duration === 'undefined' || currenttemp.duration === 0) { // no temp is set - rT.reason += "no temp, setting " + rate + "U/hr. "; + rT.reason += "no temp, setting " + round(rate, 2) + "U/hr. "; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (currenttemp.duration > 5 && (round_basal(rate, profile) <= round_basal(currenttemp.rate, profile))) { // if required temp <~ existing temp basal - rT.reason += "temp " + currenttemp.rate + " >~ req " + rate + "U/hr. "; + rT.reason += "temp " + (currenttemp.rate).toFixed(2) + " >~ req " + round(rate, 2) + "U/hr. "; return rT; } // required temp > existing temp basal - rT.reason += "temp " + currenttemp.rate + "<" + rate + "U/hr. "; + rT.reason += "temp " + (currenttemp.rate).toFixed(2) + " < " + round(rate, 2) + "U/hr. "; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } diff --git a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js index adaa126a8c..81b09e4730 100644 --- a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js +++ b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js @@ -1085,7 +1085,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (typeof currenttemp.rate !== 'undefined' && (currenttemp.duration > 5 && rate >= currenttemp.rate * 0.8)) { - rT.reason += ", temp " + currenttemp.rate + " ~< req " + rate + "U/hr. "; + rT.reason += ", temp " + currenttemp.rate + " ~< req " + round(rate, 2) + "U/hr. "; return rT; } else { // calculate a long enough zero temp to eventually correct back up to target @@ -1106,7 +1106,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ return tempBasalFunctions.setTempBasal(rate, durationReq, profile, rT, currenttemp); } } else { - rT.reason += ", setting " + rate + "U/hr. "; + rT.reason += ", setting " + round(rate, 2) + "U/hr. "; } return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } @@ -1273,22 +1273,22 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ insulinScheduled = currenttemp.duration * (currenttemp.rate - basal) / 60; if (insulinScheduled >= insulinReq * 2) { // if current temp would deliver >2x more than the required insulin, lower the rate - rT.reason += currenttemp.duration + "m@" + (currenttemp.rate).toFixed(2) + " > 2 * insulinReq. Setting temp basal of " + rate + "U/hr. "; + rT.reason += currenttemp.duration + "m@" + (currenttemp.rate).toFixed(2) + " > 2 * insulinReq. Setting temp basal of " + round(rate, 2) + "U/hr. "; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (typeof currenttemp.duration === 'undefined' || currenttemp.duration === 0) { // no temp is set - rT.reason += "no temp, setting " + rate + "U/hr. "; + rT.reason += "no temp, setting " + round(rate, 2) + "U/hr. "; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } if (currenttemp.duration > 5 && (round_basal(rate, profile) <= round_basal(currenttemp.rate, profile))) { // if required temp <~ existing temp basal - rT.reason += "temp " + currenttemp.rate + " >~ req " + rate + "U/hr. "; + rT.reason += "temp " + (currenttemp.rate).toFixed(2) + " >~ req " + round(rate, 2) + "U/hr. "; return rT; } // required temp > existing temp basal - rT.reason += "temp " + currenttemp.rate + "<" + rate + "U/hr. "; + rT.reason += "temp " + (currenttemp.rate).toFixed(2) + " < " + round(rate, 2) + "U/hr. "; return tempBasalFunctions.setTempBasal(rate, 30, profile, rT, currenttemp); } From 43cec5bf6216d29620468b6dbbe7a0ff2b98f33d Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 7 Jun 2022 18:05:54 +0200 Subject: [PATCH 10/42] move more calculations to io thread --- .../general/overview/OverviewFragment.kt | 579 +++++++++--------- 1 file changed, 305 insertions(+), 274 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 426b197249..e0fbf0c088 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -224,7 +224,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList disposable += activePlugin.activeOverview.overviewBus .toObservable(EventUpdateOverviewIobCob::class.java) .debounce(1L, TimeUnit.SECONDS) - .observeOn(aapsSchedulers.main) + .observeOn(aapsSchedulers.io) .subscribe({ updateIobCob() }, fabricPrivacy::logException) disposable += activePlugin.activeOverview.overviewBus .toObservable(EventUpdateOverviewSensitivity::class.java) @@ -256,7 +256,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList disposable += rxBus .toObservable(EventNewBG::class.java) .debounce(1L, TimeUnit.SECONDS) - .observeOn(aapsSchedulers.main) + .observeOn(aapsSchedulers.io) .subscribe({ updateBg() }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventRefreshOverview::class.java) @@ -287,19 +287,19 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventEffectiveProfileSwitchChanged::class.java) - .observeOn(aapsSchedulers.main) + .observeOn(aapsSchedulers.io) .subscribe({ updateProfile() }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventTempTargetChange::class.java) - .observeOn(aapsSchedulers.main) + .observeOn(aapsSchedulers.io) .subscribe({ updateTemporaryTarget() }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventExtendedBolusChange::class.java) - .observeOn(aapsSchedulers.main) + .observeOn(aapsSchedulers.io) .subscribe({ updateExtendedBolus() }, fabricPrivacy::logException) disposable += rxBus .toObservable(EventTempBasalChange::class.java) - .observeOn(aapsSchedulers.main) + .observeOn(aapsSchedulers.io) .subscribe({ updateTemporaryBasal() }, fabricPrivacy::logException) refreshLoop = Runnable { @@ -316,17 +316,19 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList fun refreshAll() { runOnUiThread { _binding ?: return@runOnUiThread - updateBg() updateTime() - updateProfile() - updateTemporaryBasal() - updateExtendedBolus() - updateTemporaryTarget() - updateIobCob() updateSensitivity() updateGraph() updateNotification() } + updateBg() + updateTemporaryBasal() + updateExtendedBolus() + updateIobCob() + processButtonsVisibility() + processAps() + updateProfile() + updateTemporaryTarget() } @Synchronized @@ -513,13 +515,16 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList // QuickWizard button val quickWizardEntry = quickWizard.getActive() - if (quickWizardEntry != null && lastBG != null && profile != null && pump.isInitialized() && !pump.isSuspended() && !loop.isDisconnected) { - binding.buttonsLayout.quickWizardButton.visibility = View.VISIBLE - val wizard = quickWizardEntry.doCalc(profile, profileName, lastBG, false) - binding.buttonsLayout.quickWizardButton.text = quickWizardEntry.buttonText() + "\n" + rh.gs(R.string.format_carbs, quickWizardEntry.carbs()) + - " " + rh.gs(R.string.formatinsulinunits, wizard.calculatedTotalInsulin) - if (wizard.calculatedTotalInsulin <= 0) binding.buttonsLayout.quickWizardButton.visibility = View.GONE - } else binding.buttonsLayout.quickWizardButton.visibility = View.GONE + runOnUiThread { + _binding ?: return@runOnUiThread + if (quickWizardEntry != null && lastBG != null && profile != null && pump.isInitialized() && !pump.isSuspended() && !loop.isDisconnected) { + binding.buttonsLayout.quickWizardButton.visibility = View.VISIBLE + val wizard = quickWizardEntry.doCalc(profile, profileName, lastBG, false) + binding.buttonsLayout.quickWizardButton.text = quickWizardEntry.buttonText() + "\n" + rh.gs(R.string.format_carbs, quickWizardEntry.carbs()) + + " " + rh.gs(R.string.formatinsulinunits, wizard.calculatedTotalInsulin) + if (wizard.calculatedTotalInsulin <= 0) binding.buttonsLayout.quickWizardButton.visibility = View.GONE + } else binding.buttonsLayout.quickWizardButton.visibility = View.GONE + } // **** Temp button **** val lastRun = loop.lastRun @@ -530,72 +535,76 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList (lastRun.lastOpenModeAccept == 0L || lastRun.lastOpenModeAccept < lastRun.lastAPSRun) &&// never accepted or before last result lastRun.constraintsProcessed?.isChangeRequested == true // change is requested - if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && (loop as PluginBase).isEnabled()) { - binding.buttonsLayout.acceptTempButton.visibility = View.VISIBLE - binding.buttonsLayout.acceptTempButton.text = "${rh.gs(R.string.setbasalquestion)}\n${lastRun!!.constraintsProcessed}" - } else { - binding.buttonsLayout.acceptTempButton.visibility = View.GONE - } - - // **** Various treatment buttons **** - binding.buttonsLayout.carbsButton.visibility = - ((!activePlugin.activePump.pumpDescription.storesCarbInfo || pump.isInitialized() && !pump.isSuspended()) && profile != null - && sp.getBoolean(R.string.key_show_carbs_button, true)).toVisibility() - binding.buttonsLayout.treatmentButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null - && sp.getBoolean(R.string.key_show_treatment_button, false)).toVisibility() - binding.buttonsLayout.wizardButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null - && sp.getBoolean(R.string.key_show_wizard_button, true)).toVisibility() - binding.buttonsLayout.insulinButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null - && sp.getBoolean(R.string.key_show_insulin_button, true)).toVisibility() - - // **** Calibration & CGM buttons **** - val xDripIsBgSource = xdripPlugin.isEnabled() - val dexcomIsSource = dexcomPlugin.isEnabled() - binding.buttonsLayout.calibrationButton.visibility = (xDripIsBgSource && actualBG != null && sp.getBoolean(R.string.key_show_calibration_button, true)).toVisibility() - if (dexcomIsSource) { - binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_byoda), null, null) - for (drawable in binding.buttonsLayout.cgmButton.compoundDrawables) { - drawable?.mutate() - drawable?.colorFilter = PorterDuffColorFilter(rh.gac(context, R.attr.cgmDexColor), PorterDuff.Mode.SRC_IN) + runOnUiThread { + _binding ?: return@runOnUiThread + if (showAcceptButton && pump.isInitialized() && !pump.isSuspended() && (loop as PluginBase).isEnabled()) { + binding.buttonsLayout.acceptTempButton.visibility = View.VISIBLE + binding.buttonsLayout.acceptTempButton.text = "${rh.gs(R.string.setbasalquestion)}\n${lastRun!!.constraintsProcessed}" + } else { + binding.buttonsLayout.acceptTempButton.visibility = View.GONE } - binding.buttonsLayout.cgmButton.setTextColor(rh.gac(context, R.attr.cgmDexColor)) - } else if (xDripIsBgSource) { - binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_xdrip), null, null) - for (drawable in binding.buttonsLayout.cgmButton.compoundDrawables) { - drawable?.mutate() - drawable?.colorFilter = PorterDuffColorFilter(rh.gac(context, R.attr.cgmXdripColor), PorterDuff.Mode.SRC_IN) + + // **** Various treatment buttons **** + binding.buttonsLayout.carbsButton.visibility = + ((!activePlugin.activePump.pumpDescription.storesCarbInfo || pump.isInitialized() && !pump.isSuspended()) && profile != null + && sp.getBoolean(R.string.key_show_carbs_button, true)).toVisibility() + binding.buttonsLayout.treatmentButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null + && sp.getBoolean(R.string.key_show_treatment_button, false)).toVisibility() + binding.buttonsLayout.wizardButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null + && sp.getBoolean(R.string.key_show_wizard_button, true)).toVisibility() + binding.buttonsLayout.insulinButton.visibility = (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null + && sp.getBoolean(R.string.key_show_insulin_button, true)).toVisibility() + + // **** Calibration & CGM buttons **** + val xDripIsBgSource = xdripPlugin.isEnabled() + val dexcomIsSource = dexcomPlugin.isEnabled() + binding.buttonsLayout.calibrationButton.visibility = (xDripIsBgSource && actualBG != null && sp.getBoolean(R.string.key_show_calibration_button, true)).toVisibility() + if (dexcomIsSource) { + binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_byoda), null, null) + for (drawable in binding.buttonsLayout.cgmButton.compoundDrawables) { + drawable?.mutate() + drawable?.colorFilter = PorterDuffColorFilter(rh.gac(context, R.attr.cgmDexColor), PorterDuff.Mode.SRC_IN) + } + binding.buttonsLayout.cgmButton.setTextColor(rh.gac(context, R.attr.cgmDexColor)) + } else if (xDripIsBgSource) { + binding.buttonsLayout.cgmButton.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_xdrip), null, null) + for (drawable in binding.buttonsLayout.cgmButton.compoundDrawables) { + drawable?.mutate() + drawable?.colorFilter = PorterDuffColorFilter(rh.gac(context, R.attr.cgmXdripColor), PorterDuff.Mode.SRC_IN) + } + binding.buttonsLayout.cgmButton.setTextColor(rh.gac(context, R.attr.cgmXdripColor)) } - binding.buttonsLayout.cgmButton.setTextColor(rh.gac(context, R.attr.cgmXdripColor)) - } - binding.buttonsLayout.cgmButton.visibility = (sp.getBoolean(R.string.key_show_cgm_button, false) && (xDripIsBgSource || dexcomIsSource)).toVisibility() + binding.buttonsLayout.cgmButton.visibility = (sp.getBoolean(R.string.key_show_cgm_button, false) && (xDripIsBgSource || dexcomIsSource)).toVisibility() - // Automation buttons - binding.buttonsLayout.userButtonsLayout.removeAllViews() - val events = automationPlugin.userEvents() - if (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null) - for (event in events) - if (event.isEnabled && event.trigger.shouldRun()) - context?.let { context -> - SingleClickButton(context).also { - it.setTextColor(rh.gac(context, R.attr.treatmentButton)) - it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f) - it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l -> - l.setMargins(0, 0, rh.dpToPx(-4), 0) - } - it.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_danar_useropt), null, null) - it.text = event.title + // Automation buttons + binding.buttonsLayout.userButtonsLayout.removeAllViews() + val events = automationPlugin.userEvents() + if (!loop.isDisconnected && pump.isInitialized() && !pump.isSuspended() && profile != null) + for (event in events) + if (event.isEnabled && event.trigger.shouldRun()) + context?.let { context -> + SingleClickButton(context).also { + it.setTextColor(rh.gac(context, R.attr.treatmentButton)) + it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f) + it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l -> + l.setMargins(0, 0, rh.dpToPx(-4), 0) + } + it.setCompoundDrawablesWithIntrinsicBounds(null, rh.gd(R.drawable.ic_danar_useropt), null, null) + it.text = event.title - it.setOnClickListener { - OKDialog.showConfirmation(context, rh.gs(R.string.run_question, event.title), { handler.post { automationPlugin.processEvent(event) } }) + it.setOnClickListener { + OKDialog.showConfirmation(context, rh.gs(R.string.run_question, event.title), { handler.post { automationPlugin.processEvent(event) } }) + } + binding.buttonsLayout.userButtonsLayout.addView(it) } - binding.buttonsLayout.userButtonsLayout.addView(it) } - } - binding.buttonsLayout.userButtonsLayout.visibility = events.isNotEmpty().toVisibility() + binding.buttonsLayout.userButtonsLayout.visibility = events.isNotEmpty().toVisibility() + } } private fun processAps() { val pump = activePlugin.activePump + val profile = profileFunction.getProfile() // aps mode val closedLoopEnabled = constraintChecker.isClosedLoopAllowed() @@ -608,103 +617,106 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList } } - if (config.APS && pump.pumpDescription.isTempBasalCapable) { - binding.infoLayout.apsMode.visibility = View.VISIBLE - binding.infoLayout.timeLayout.visibility = View.GONE - when { - (loop as PluginBase).isEnabled() && loop.isSuperBolus -> { - binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_superbolus) - apsModeSetA11yLabel(R.string.superbolus) - binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh) - binding.infoLayout.apsModeText.visibility = View.VISIBLE - } + runOnUiThread { + _binding ?: return@runOnUiThread + if (config.APS && pump.pumpDescription.isTempBasalCapable) { + binding.infoLayout.apsMode.visibility = View.VISIBLE + binding.infoLayout.timeLayout.visibility = View.GONE + when { + (loop as PluginBase).isEnabled() && loop.isSuperBolus -> { + binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_superbolus) + apsModeSetA11yLabel(R.string.superbolus) + binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh) + binding.infoLayout.apsModeText.visibility = View.VISIBLE + } - loop.isDisconnected -> { - binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_disconnected) - apsModeSetA11yLabel(R.string.disconnected) - binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh) - binding.infoLayout.apsModeText.visibility = View.VISIBLE - } + loop.isDisconnected -> { + binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_disconnected) + apsModeSetA11yLabel(R.string.disconnected) + binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh) + binding.infoLayout.apsModeText.visibility = View.VISIBLE + } - (loop as PluginBase).isEnabled() && loop.isSuspended -> { - binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_paused) - apsModeSetA11yLabel(R.string.suspendloop_label) - binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh) - binding.infoLayout.apsModeText.visibility = View.VISIBLE - } + (loop as PluginBase).isEnabled() && loop.isSuspended -> { + binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_paused) + apsModeSetA11yLabel(R.string.suspendloop_label) + binding.infoLayout.apsModeText.text = dateUtil.age(loop.minutesToEndOfSuspend() * 60000L, true, rh) + binding.infoLayout.apsModeText.visibility = View.VISIBLE + } - pump.isSuspended() -> { - binding.infoLayout.apsMode.setImageResource( - if (pump.model() == PumpType.OMNIPOD_EROS || pump.model() == PumpType.OMNIPOD_DASH) { - // For Omnipod, indicate the pump as disconnected when it's suspended. - // The only way to 'reconnect' it, is through the Omnipod tab - apsModeSetA11yLabel(R.string.disconnected) - R.drawable.ic_loop_disconnected - } else { - apsModeSetA11yLabel(R.string.pump_paused) - R.drawable.ic_loop_paused - } - ) - binding.infoLayout.apsModeText.visibility = View.GONE - } - - (loop as PluginBase).isEnabled() && closedLoopEnabled.value() && loop.isLGS -> { - binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_lgs) - apsModeSetA11yLabel(R.string.uel_lgs_loop_mode) - binding.infoLayout.apsModeText.visibility = View.GONE - } - - (loop as PluginBase).isEnabled() && closedLoopEnabled.value() -> { - binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_closed) - apsModeSetA11yLabel(R.string.closedloop) - binding.infoLayout.apsModeText.visibility = View.GONE - } - - (loop as PluginBase).isEnabled() && !closedLoopEnabled.value() -> { - binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_open) - apsModeSetA11yLabel(R.string.openloop) - binding.infoLayout.apsModeText.visibility = View.GONE - } - - else -> { - binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_disabled) - apsModeSetA11yLabel(R.string.disabledloop) - binding.infoLayout.apsModeText.visibility = View.GONE - } - } - // Show variable sensitivity - val request = loop.lastRun?.request - if (request is DetermineBasalResultSMB) { - val isfMgdl = profileFunction.getProfile()?.getIsfMgdl() - val variableSens = request.variableSens - if (variableSens != isfMgdl && variableSens != null && isfMgdl != null) { - binding.infoLayout.variableSensitivity.text = - String.format( - Locale.getDefault(), "%1$.1f→%2$.1f", - Profile.toUnits(isfMgdl, isfMgdl * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()), - Profile.toUnits(variableSens, variableSens * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()) + pump.isSuspended() -> { + binding.infoLayout.apsMode.setImageResource( + if (pump.model() == PumpType.OMNIPOD_EROS || pump.model() == PumpType.OMNIPOD_DASH) { + // For Omnipod, indicate the pump as disconnected when it's suspended. + // The only way to 'reconnect' it, is through the Omnipod tab + apsModeSetA11yLabel(R.string.disconnected) + R.drawable.ic_loop_disconnected + } else { + apsModeSetA11yLabel(R.string.pump_paused) + R.drawable.ic_loop_paused + } ) - binding.infoLayout.variableSensitivity.visibility = View.VISIBLE + binding.infoLayout.apsModeText.visibility = View.GONE + } + + (loop as PluginBase).isEnabled() && closedLoopEnabled.value() && loop.isLGS -> { + binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_lgs) + apsModeSetA11yLabel(R.string.uel_lgs_loop_mode) + binding.infoLayout.apsModeText.visibility = View.GONE + } + + (loop as PluginBase).isEnabled() && closedLoopEnabled.value() -> { + binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_closed) + apsModeSetA11yLabel(R.string.closedloop) + binding.infoLayout.apsModeText.visibility = View.GONE + } + + (loop as PluginBase).isEnabled() && !closedLoopEnabled.value() -> { + binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_open) + apsModeSetA11yLabel(R.string.openloop) + binding.infoLayout.apsModeText.visibility = View.GONE + } + + else -> { + binding.infoLayout.apsMode.setImageResource(R.drawable.ic_loop_disabled) + apsModeSetA11yLabel(R.string.disabledloop) + binding.infoLayout.apsModeText.visibility = View.GONE + } + } + // Show variable sensitivity + val request = loop.lastRun?.request + if (request is DetermineBasalResultSMB) { + val isfMgdl = profile?.getIsfMgdl() + val variableSens = request.variableSens + if (variableSens != isfMgdl && variableSens != null && isfMgdl != null) { + binding.infoLayout.variableSensitivity.text = + String.format( + Locale.getDefault(), "%1$.1f→%2$.1f", + Profile.toUnits(isfMgdl, isfMgdl * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()), + Profile.toUnits(variableSens, variableSens * Constants.MGDL_TO_MMOLL, profileFunction.getUnits()) + ) + binding.infoLayout.variableSensitivity.visibility = View.VISIBLE + } else binding.infoLayout.variableSensitivity.visibility = View.GONE } else binding.infoLayout.variableSensitivity.visibility = View.GONE - } else binding.infoLayout.variableSensitivity.visibility = View.GONE - } else { - //nsclient - binding.infoLayout.apsMode.visibility = View.GONE - binding.infoLayout.apsModeText.visibility = View.GONE - binding.infoLayout.timeLayout.visibility = View.VISIBLE + } else { + //nsclient + binding.infoLayout.apsMode.visibility = View.GONE + binding.infoLayout.apsModeText.visibility = View.GONE + binding.infoLayout.timeLayout.visibility = View.VISIBLE + } + + // pump status from ns + binding.pump.text = nsDeviceStatus.pumpStatus + binding.pump.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.pump), nsDeviceStatus.extendedPumpStatus) } } + + // OpenAPS status from ns + binding.openaps.text = nsDeviceStatus.openApsStatus + binding.openaps.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.openaps), nsDeviceStatus.extendedOpenApsStatus) } } + + // Uploader status from ns + binding.uploader.text = nsDeviceStatus.uploaderStatusSpanned + binding.uploader.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.uploader), nsDeviceStatus.extendedUploaderStatus) } } } - - // pump status from ns - binding.pump.text = nsDeviceStatus.pumpStatus - binding.pump.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.pump), nsDeviceStatus.extendedPumpStatus) } } - - // OpenAPS status from ns - binding.openaps.text = nsDeviceStatus.openApsStatus - binding.openaps.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.openaps), nsDeviceStatus.extendedOpenApsStatus) } } - - // Uploader status from ns - binding.uploader.text = nsDeviceStatus.uploaderStatusSpanned - binding.uploader.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.uploader), nsDeviceStatus.extendedUploaderStatus) } } } private fun prepareGraphsIfNeeded(numOfGraphs: Int) { @@ -760,59 +772,67 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList @SuppressLint("SetTextI18n") fun updateBg() { - _binding ?: return val units = profileFunction.getUnits() - binding.infoLayout.bg.text = overviewData.lastBg?.valueToUnitsString(units) - ?: rh.gs(R.string.notavailable) - binding.infoLayout.bg.setTextColor(overviewData.lastBgColor(context)) - binding.infoLayout.arrow.setImageResource(trendCalculator.getTrendArrow(overviewData.lastBg).directionToIcon()) - binding.infoLayout.arrow.setColorFilter(overviewData.lastBgColor(context)) - binding.infoLayout.arrow.contentDescription = overviewData.lastBgDescription + " " + rh.gs(R.string.and) + " " + trendCalculator.getTrendDescription(overviewData.lastBg) - + val lastBg = overviewData.lastBg + val lastBgColor = overviewData.lastBgColor(context) + val isActualBg = overviewData.isActualBg val glucoseStatus = glucoseStatusProvider.glucoseStatusData - if (glucoseStatus != null) { - binding.infoLayout.deltaLarge.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) - binding.infoLayout.deltaLarge.setTextColor(overviewData.lastBgColor(context)) - binding.infoLayout.delta.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) - binding.infoLayout.avgDelta.text = Profile.toSignedUnitsString(glucoseStatus.shortAvgDelta, glucoseStatus.shortAvgDelta * Constants.MGDL_TO_MMOLL, units) - binding.infoLayout.longAvgDelta.text = Profile.toSignedUnitsString(glucoseStatus.longAvgDelta, glucoseStatus.longAvgDelta * Constants.MGDL_TO_MMOLL, units) - } else { - binding.infoLayout.deltaLarge.text = "" - binding.infoLayout.delta.text = "Δ " + rh.gs(R.string.notavailable) - binding.infoLayout.avgDelta.text = "" - binding.infoLayout.longAvgDelta.text = "" - } + val trendDescription = trendCalculator.getTrendDescription(lastBg) + val trendArrow = trendCalculator.getTrendArrow(lastBg) + val lastBgDescription = overviewData.lastBgDescription + runOnUiThread { + _binding ?: return@runOnUiThread + binding.infoLayout.bg.text = lastBg?.valueToUnitsString(units) + ?: rh.gs(R.string.notavailable) + binding.infoLayout.bg.setTextColor(lastBgColor) + binding.infoLayout.arrow.setImageResource(trendArrow.directionToIcon()) + binding.infoLayout.arrow.setColorFilter(lastBgColor) + binding.infoLayout.arrow.contentDescription = lastBgDescription + " " + rh.gs(R.string.and) + " " + trendDescription - // strike through if BG is old - binding.infoLayout.bg.paintFlags = - if (!overviewData.isActualBg) binding.infoLayout.bg.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG - else binding.infoLayout.bg.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv() - - val outDate = (if (!overviewData.isActualBg) rh.gs(R.string.a11y_bg_outdated) else "") - binding.infoLayout.bg.contentDescription = - rh.gs(R.string.a11y_blood_glucose) + " " + binding.infoLayout.bg.text.toString() + " " + overviewData.lastBgDescription + " " + outDate - - binding.infoLayout.timeAgo.text = dateUtil.minAgo(rh, overviewData.lastBg?.timestamp) - binding.infoLayout.timeAgo.contentDescription = dateUtil.minAgoLong(rh, overviewData.lastBg?.timestamp) - binding.infoLayout.timeAgoShort.text = "(" + dateUtil.minAgoShort(overviewData.lastBg?.timestamp) + ")" - - val qualityIcon = bgQualityCheckPlugin.icon() - if (qualityIcon != 0) { - binding.infoLayout.bgQuality.visibility = View.VISIBLE - binding.infoLayout.bgQuality.setImageResource(qualityIcon) - binding.infoLayout.bgQuality.contentDescription = rh.gs(R.string.a11y_bg_quality) + " " + bgQualityCheckPlugin.stateDescription() - binding.infoLayout.bgQuality.setOnClickListener { - context?.let { context -> OKDialog.show(context, rh.gs(R.string.data_status), bgQualityCheckPlugin.message) } + if (glucoseStatus != null) { + binding.infoLayout.deltaLarge.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + binding.infoLayout.deltaLarge.setTextColor(lastBgColor) + binding.infoLayout.delta.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + binding.infoLayout.avgDelta.text = Profile.toSignedUnitsString(glucoseStatus.shortAvgDelta, glucoseStatus.shortAvgDelta * Constants.MGDL_TO_MMOLL, units) + binding.infoLayout.longAvgDelta.text = Profile.toSignedUnitsString(glucoseStatus.longAvgDelta, glucoseStatus.longAvgDelta * Constants.MGDL_TO_MMOLL, units) + } else { + binding.infoLayout.deltaLarge.text = "" + binding.infoLayout.delta.text = "Δ " + rh.gs(R.string.notavailable) + binding.infoLayout.avgDelta.text = "" + binding.infoLayout.longAvgDelta.text = "" + } + + // strike through if BG is old + binding.infoLayout.bg.paintFlags = + if (!isActualBg) binding.infoLayout.bg.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG + else binding.infoLayout.bg.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv() + + val outDate = (if (!isActualBg) rh.gs(R.string.a11y_bg_outdated) else "") + binding.infoLayout.bg.contentDescription = rh.gs(R.string.a11y_blood_glucose) + " " + binding.infoLayout.bg.text.toString() + " " + lastBgDescription + " " + outDate + + binding.infoLayout.timeAgo.text = dateUtil.minAgo(rh, lastBg?.timestamp) + binding.infoLayout.timeAgo.contentDescription = dateUtil.minAgoLong(rh, lastBg?.timestamp) + binding.infoLayout.timeAgoShort.text = "(" + dateUtil.minAgoShort(lastBg?.timestamp) + ")" + + val qualityIcon = bgQualityCheckPlugin.icon() + if (qualityIcon != 0) { + binding.infoLayout.bgQuality.visibility = View.VISIBLE + binding.infoLayout.bgQuality.setImageResource(qualityIcon) + binding.infoLayout.bgQuality.contentDescription = rh.gs(R.string.a11y_bg_quality) + " " + bgQualityCheckPlugin.stateDescription() + binding.infoLayout.bgQuality.setOnClickListener { + context?.let { context -> OKDialog.show(context, rh.gs(R.string.data_status), bgQualityCheckPlugin.message) } + } + } else { + binding.infoLayout.bgQuality.visibility = View.GONE } - } else { - binding.infoLayout.bgQuality.visibility = View.GONE } } fun updateProfile() { - _binding ?: return - val profileBackgroundColor = - profileFunction.getProfile()?.let { + val profile = profileFunction.getProfile() + runOnUiThread { + _binding ?: return@runOnUiThread + val profileBackgroundColor = profile?.let { if (it is ProfileSealed.EPS) { if (it.value.originalPercentage != 100 || it.value.originalTimeshift != 0L || it.value.originalDuration != 0L) R.attr.ribbonWarningColor @@ -824,8 +844,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList } } ?: R.attr.ribbonCriticalColor - val profileTextColor = - profileFunction.getProfile()?.let { + val profileTextColor = profile?.let { if (it is ProfileSealed.EPS) { if (it.value.originalPercentage != 100 || it.value.originalTimeshift != 0L || it.value.originalDuration != 0L) R.attr.ribbonTextWarningColor @@ -836,27 +855,35 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList R.attr.ribbonTextDefaultColor } } ?: R.attr.ribbonTextDefaultColor - setRibbon(binding.activeProfile, profileTextColor, profileBackgroundColor, profileFunction.getProfileNameWithRemainingTime()) + setRibbon(binding.activeProfile, profileTextColor, profileBackgroundColor, profileFunction.getProfileNameWithRemainingTime()) + } } private fun updateTemporaryBasal() { - _binding ?: return - binding.infoLayout.baseBasal.text = overviewData.temporaryBasalText(iobCobCalculator) - binding.infoLayout.baseBasal.setTextColor(overviewData.temporaryBasalColor(context, iobCobCalculator)) - binding.infoLayout.baseBasalIcon.setImageResource(overviewData.temporaryBasalIcon(iobCobCalculator)) - binding.infoLayout.basalLayout.setOnClickListener { - activity?.let { OKDialog.show(it, rh.gs(R.string.basal), overviewData.temporaryBasalDialogText(iobCobCalculator)) } + val temporaryBasalText = overviewData.temporaryBasalText(iobCobCalculator) + val temporaryBasalColor = overviewData.temporaryBasalColor(context, iobCobCalculator) + val temporaryBasalIcon = overviewData.temporaryBasalIcon(iobCobCalculator) + val temporaryBasalDialogText = overviewData.temporaryBasalDialogText(iobCobCalculator) + runOnUiThread { + _binding ?: return@runOnUiThread + binding.infoLayout.baseBasal.text = temporaryBasalText + binding.infoLayout.baseBasal.setTextColor(temporaryBasalColor) + binding.infoLayout.baseBasalIcon.setImageResource(temporaryBasalIcon) + binding.infoLayout.basalLayout.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.basal), temporaryBasalDialogText) } } } } private fun updateExtendedBolus() { - _binding ?: return val pump = activePlugin.activePump - binding.infoLayout.extendedBolus.text = overviewData.extendedBolusText(iobCobCalculator) - binding.infoLayout.extendedLayout.setOnClickListener { - activity?.let { OKDialog.show(it, rh.gs(R.string.extended_bolus), overviewData.extendedBolusDialogText(iobCobCalculator)) } + val extendedBolus = iobCobCalculator.getExtendedBolus(dateUtil.now()) + val extendedBolusText = overviewData.extendedBolusText(iobCobCalculator) + val extendedBolusDialogText = overviewData.extendedBolusDialogText(iobCobCalculator) + runOnUiThread { + _binding ?: return@runOnUiThread + binding.infoLayout.extendedBolus.text = extendedBolusText + binding.infoLayout.extendedLayout.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.extended_bolus), extendedBolusDialogText) } } + binding.infoLayout.extendedLayout.visibility = (extendedBolus != null && !pump.isFakingTempsByExtendedBoluses).toVisibility() } - binding.infoLayout.extendedLayout.visibility = (iobCobCalculator.getExtendedBolus(dateUtil.now()) != null && !pump.isFakingTempsByExtendedBoluses).toVisibility() } fun updateTime() { @@ -887,69 +914,73 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList binding.statusLightsLayout.pbAge, binding.statusLightsLayout.batteryLevel ) - processButtonsVisibility() - processAps() } fun updateIobCob() { - _binding ?: return - binding.infoLayout.iob.text = overviewData.iobText(iobCobCalculator) - binding.infoLayout.iobLayout.setOnClickListener { - activity?.let { OKDialog.show(it, rh.gs(R.string.iob), overviewData.iobDialogText(iobCobCalculator)) } - } - // cob - var cobText = overviewData.cobInfo(iobCobCalculator).displayText(rh, dateUtil, buildHelper.isEngineeringMode()) ?: rh.gs(R.string.value_unavailable_short) + val iobText = overviewData.iobText(iobCobCalculator) + val iobDialogText = overviewData.iobDialogText(iobCobCalculator) + val displayText = overviewData.cobInfo(iobCobCalculator).displayText(rh, dateUtil, buildHelper.isEngineeringMode()) + val lastCarbsTime = overviewData.lastCarbsTime + runOnUiThread { + _binding ?: return@runOnUiThread + binding.infoLayout.iob.text = iobText + binding.infoLayout.iobLayout.setOnClickListener { activity?.let { OKDialog.show(it, rh.gs(R.string.iob), iobDialogText) } } + // cob + var cobText = displayText ?: rh.gs(R.string.value_unavailable_short) - val constraintsProcessed = loop.lastRun?.constraintsProcessed - val lastRun = loop.lastRun - if (config.APS && constraintsProcessed != null && lastRun != null) { - if (constraintsProcessed.carbsReq > 0) { - //only display carbsreq when carbs have not been entered recently - if (overviewData.lastCarbsTime < lastRun.lastAPSRun) { - cobText += " | " + constraintsProcessed.carbsReq + " " + rh.gs(R.string.required) + val constraintsProcessed = loop.lastRun?.constraintsProcessed + val lastRun = loop.lastRun + if (config.APS && constraintsProcessed != null && lastRun != null) { + if (constraintsProcessed.carbsReq > 0) { + //only display carbsreq when carbs have not been entered recently + if (lastCarbsTime < lastRun.lastAPSRun) { + cobText += " | " + constraintsProcessed.carbsReq + " " + rh.gs(R.string.required) + } + if (carbAnimation?.isRunning == false) + carbAnimation?.start() + } else { + carbAnimation?.stop() + carbAnimation?.selectDrawable(0) } - if (carbAnimation?.isRunning == false) - carbAnimation?.start() - } else { - carbAnimation?.stop() - carbAnimation?.selectDrawable(0) } + binding.infoLayout.cob.text = cobText } - binding.infoLayout.cob.text = cobText } @SuppressLint("SetTextI18n") fun updateTemporaryTarget() { - _binding ?: return val units = profileFunction.getUnits() val tempTarget = overviewData.temporaryTarget - if (tempTarget != null) { - setRibbon( - binding.tempTarget, - R.attr.ribbonTextWarningColor, - R.attr.ribbonWarningColor, - Profile.toTargetRangeString(tempTarget.lowTarget, tempTarget.highTarget, GlucoseUnit.MGDL, units) + " " + dateUtil.untilString(tempTarget.end, rh) - ) - } else { - // If the target is not the same as set in the profile then oref has overridden it - profileFunction.getProfile()?.let { profile -> - val targetUsed = loop.lastRun?.constraintsProcessed?.targetBG ?: 0.0 + runOnUiThread { + _binding ?: return@runOnUiThread + if (tempTarget != null) { + setRibbon( + binding.tempTarget, + R.attr.ribbonTextWarningColor, + R.attr.ribbonWarningColor, + Profile.toTargetRangeString(tempTarget.lowTarget, tempTarget.highTarget, GlucoseUnit.MGDL, units) + " " + dateUtil.untilString(tempTarget.end, rh) + ) + } else { + // If the target is not the same as set in the profile then oref has overridden it + profileFunction.getProfile()?.let { profile -> + val targetUsed = loop.lastRun?.constraintsProcessed?.targetBG ?: 0.0 - if (targetUsed != 0.0 && abs(profile.getTargetMgdl() - targetUsed) > 0.01) { - aapsLogger.debug("Adjusted target. Profile: ${profile.getTargetMgdl()} APS: $targetUsed") - setRibbon( - binding.tempTarget, - R.attr.ribbonTextWarningColor, - R.attr.tempTargetBackgroundColor, - Profile.toTargetRangeString(targetUsed, targetUsed, GlucoseUnit.MGDL, units) - ) - } else { - setRibbon( - binding.tempTarget, - R.attr.ribbonTextDefaultColor, - R.attr.ribbonDefaultColor, - Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), GlucoseUnit.MGDL, units) - ) + if (targetUsed != 0.0 && abs(profile.getTargetMgdl() - targetUsed) > 0.01) { + aapsLogger.debug("Adjusted target. Profile: ${profile.getTargetMgdl()} APS: $targetUsed") + setRibbon( + binding.tempTarget, + R.attr.ribbonTextWarningColor, + R.attr.tempTargetBackgroundColor, + Profile.toTargetRangeString(targetUsed, targetUsed, GlucoseUnit.MGDL, units) + ) + } else { + setRibbon( + binding.tempTarget, + R.attr.ribbonTextDefaultColor, + R.attr.ribbonDefaultColor, + Profile.toTargetRangeString(profile.getTargetLowMgdl(), profile.getTargetHighMgdl(), GlucoseUnit.MGDL, units) + ) + } } } } From 62dec454b162ea5956171f0e4d474ed42b2c53b4 Mon Sep 17 00:00:00 2001 From: Philoul Date: Wed, 8 Jun 2022 00:14:39 +0200 Subject: [PATCH 11/42] Fix Crash L137 (I hope) --- .../plugins/general/autotune/AutotuneCore.kt | 6 +-- .../general/autotune/AutotunePlugin.kt | 53 ++++++++++--------- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneCore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneCore.kt index 9bfb851952..d0dc4da9be 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneCore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneCore.kt @@ -28,9 +28,9 @@ class AutotuneCore @Inject constructor( //console.error(isf); var carbRatio = previousAutotune.ic //console.error(carbRatio); - var csf = isf / carbRatio - var dia = previousAutotune.dia - var peak = previousAutotune.peak + val csf = isf / carbRatio + val dia = previousAutotune.dia + val peak = previousAutotune.peak val csfGlucose = preppedGlucose.csfGlucoseData val isfGlucose = preppedGlucose.isfGlucoseData val basalGlucose = preppedGlucose.basalGlucoseData diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt index 320a0d212b..0bc1d3fb05 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt @@ -115,37 +115,39 @@ class AutotunePlugin @Inject constructor( val from = starttime + i * 24 * 60 * 60 * 1000L // get 24 hours BG values from 4 AM to 4 AM next day val to = from + 24 * 60 * 60 * 1000L log("Tune day " + (i + 1) + " of " + daysBack) - tunedProfile?.let { tunedProfile -> - autotuneIob.initializeData(from, to, tunedProfile) //autotuneIob contains BG and Treatments data from history (<=> query for ns-treatments and ns-entries) + tunedProfile?.let { it -> + autotuneIob.initializeData(from, to, it) //autotuneIob contains BG and Treatments data from history (<=> query for ns-treatments and ns-entries) autotuneFS.exportEntries(autotuneIob) //<=> ns-entries.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine autotuneFS.exportTreatments(autotuneIob) //<=> ns-treatments.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine (include treatments ,tempBasal and extended - preppedGlucose = autotunePrep.categorize(tunedProfile) //<=> autotune.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine + preppedGlucose = autotunePrep.categorize(it) //<=> autotune.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine + preppedGlucose?.let { preppedGlucose -> + autotuneFS.exportPreppedGlucose(preppedGlucose) + tunedProfile = autotuneCore.tuneAllTheThings(preppedGlucose, it, pumpProfile).also { tunedProfile -> + autotuneFS.exportTunedProfile(tunedProfile) //<=> newprofile.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine + if (i < daysBack - 1) { + log("Partial result for day ${i + 1}".trimIndent()) + result = rh.gs(R.string.autotune_partial_result, i + 1, daysBack) + rxBus.send(EventAutotuneUpdateGui()) + } + logResult = showResults(tunedProfile, pumpProfile) + if (detailedLog) + autotuneFS.exportLog(lastRun, i + 1) + } + } + ?: { + log("preppedGlucose is null on day ${i + 1}") + tunedProfile = null + } } - - if (preppedGlucose == null || tunedProfile == null) { + if (tunedProfile == null) { result = rh.gs(R.string.autotune_error) - log(result) + log("TunedProfile is null on day ${i + 1}") calculationRunning = false rxBus.send(EventAutotuneUpdateGui()) - tunedProfile = null autotuneFS.exportResult(result) autotuneFS.exportLogAndZip(lastRun) return result } - preppedGlucose?.let { preppedGlucose -> //preppedGlucose and tunedProfile should never be null here - autotuneFS.exportPreppedGlucose(preppedGlucose) - tunedProfile = autotuneCore.tuneAllTheThings(preppedGlucose, tunedProfile!!, pumpProfile) - } - // localInsulin = LocalInsulin("TunedInsulin", tunedProfile!!.peak, tunedProfile!!.dia) // Todo: Add tune Insulin option - autotuneFS.exportTunedProfile(tunedProfile!!) //<=> newprofile.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine - if (i < daysBack - 1) { - log("Partial result for day ${i + 1}".trimIndent()) - result = rh.gs(R.string.autotune_partial_result, i + 1, daysBack) - rxBus.send(EventAutotuneUpdateGui()) - } - logResult = showResults(tunedProfile, pumpProfile) - if (detailedLog) - autotuneFS.exportLog(lastRun, i + 1) } result = rh.gs(R.string.autotune_result, dateUtil.dateAndTimeString(lastRun)) if (!detailedLog) @@ -187,11 +189,12 @@ class AutotunePlugin @Inject constructor( } } } - lastRunSuccess = true - sp.putLong(R.string.key_autotune_last_run, lastRun) - rxBus.send(EventAutotuneUpdateGui()) - calculationRunning = false + tunedProfile?.let { + lastRunSuccess = true + sp.putLong(R.string.key_autotune_last_run, lastRun) + rxBus.send(EventAutotuneUpdateGui()) + calculationRunning = false return result } return "No Result" // should never occurs From 636bdb0e94a0d2ef72bb3be57061ed333e2d8b22 Mon Sep 17 00:00:00 2001 From: Philoul Date: Wed, 8 Jun 2022 07:42:00 +0200 Subject: [PATCH 12/42] Fix loadLastRun --- .../general/autotune/AutotunePlugin.kt | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt index 948904944c..c46edcbfca 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt @@ -319,31 +319,34 @@ class AutotunePlugin @Inject constructor( fun loadLastRun() { result = "" lastRunSuccess = false - val json = JSONObject(sp.getString(R.string.key_autotune_last_run, "")) - lastNbDays = JsonHelper.safeGetString(json, "lastNbDays", "") - lastRun = JsonHelper.safeGetLong(json, "lastRun") - val pumpPeak = JsonHelper.safeGetInt(json, "pumpPeak") - val pumpDia = JsonHelper.safeGetDouble(json, "pumpDia") - var localInsulin = LocalInsulin("PumpInsulin", pumpPeak, pumpDia) - selectedProfile = JsonHelper.safeGetString(json, "pumpProfileName", "") - val profile = JsonHelper.safeGetJSONObject(json, "pumpProfile", null)?.let { pureProfileFromJson(it, dateUtil) } - ?:return - pumpProfile = ATProfile(ProfileSealed.Pure(profile), localInsulin, injector).also { it.profilename = selectedProfile } - val tunedPeak = JsonHelper.safeGetInt(json, "tunedPeak") - val tunedDia = JsonHelper.safeGetDouble(json, "tunedDia") - localInsulin = LocalInsulin("PumpInsulin", tunedPeak, tunedDia) - val tunedProfileName = JsonHelper.safeGetString(json, "tunedProfileName", "") - val tuned = JsonHelper.safeGetJSONObject(json, "tunedProfile", null)?.let { pureProfileFromJson(it, dateUtil) } - ?: return - val circadianTuned = JsonHelper.safeGetJSONObject(json, "tunedCircadianProfile", null)?.let { pureProfileFromJson(it, dateUtil) } - ?: return - tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile -> - atProfile.profilename = tunedProfileName - atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned) + try { + val json = JSONObject(sp.getString(R.string.key_autotune_last_run, "")) + lastNbDays = JsonHelper.safeGetString(json, "lastNbDays", "") + lastRun = JsonHelper.safeGetLong(json, "lastRun") + val pumpPeak = JsonHelper.safeGetInt(json, "pumpPeak") + val pumpDia = JsonHelper.safeGetDouble(json, "pumpDia") + var localInsulin = LocalInsulin("PumpInsulin", pumpPeak, pumpDia) + selectedProfile = JsonHelper.safeGetString(json, "pumpProfileName", "") + val profile = JsonHelper.safeGetJSONObject(json, "pumpProfile", null)?.let { pureProfileFromJson(it, dateUtil) } + ?: return + pumpProfile = ATProfile(ProfileSealed.Pure(profile), localInsulin, injector).also { it.profilename = selectedProfile } + val tunedPeak = JsonHelper.safeGetInt(json, "tunedPeak") + val tunedDia = JsonHelper.safeGetDouble(json, "tunedDia") + localInsulin = LocalInsulin("PumpInsulin", tunedPeak, tunedDia) + val tunedProfileName = JsonHelper.safeGetString(json, "tunedProfileName", "") + val tuned = JsonHelper.safeGetJSONObject(json, "tunedProfile", null)?.let { pureProfileFromJson(it, dateUtil) } + ?: return + val circadianTuned = JsonHelper.safeGetJSONObject(json, "tunedCircadianProfile", null)?.let { pureProfileFromJson(it, dateUtil) } + ?: return + tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile -> + atProfile.profilename = tunedProfileName + atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned) + } + result = JsonHelper.safeGetString(json, "result", "") + updateButtonVisibility = JsonHelper.safeGetInt(json, "updateButtonVisibility") + lastRunSuccess = true + } catch (e: Exception) { } - result = JsonHelper.safeGetString(json, "result", "") - updateButtonVisibility = JsonHelper.safeGetInt(json, "updateButtonVisibility") - lastRunSuccess = true } private fun log(message: String) { From a9b424b2f3b2ec1f065871aba4e5a4ea2ce59df5 Mon Sep 17 00:00:00 2001 From: Philoul Date: Wed, 8 Jun 2022 08:00:01 +0200 Subject: [PATCH 13/42] Autotune fix load result during calculation running --- .../androidaps/plugins/general/autotune/AutotuneFragment.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt index 52aefc5560..2b467cb500 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt @@ -257,8 +257,10 @@ class AutotuneFragment : DaggerFragment() { } binding.tuneLastrun.setOnClickListener { - autotunePlugin.loadLastRun() - updateGui() + if (!autotunePlugin.calculationRunning) { + autotunePlugin.loadLastRun() + updateGui() + } } binding.tuneLastrun.paintFlags = binding.tuneLastrun.paintFlags or Paint.UNDERLINE_TEXT_FLAG } From b0891ef2c1a2bb35836541f32e9134c87c2c6138 Mon Sep 17 00:00:00 2001 From: Philoul Date: Wed, 8 Jun 2022 09:03:44 +0200 Subject: [PATCH 14/42] Replace hardcoded text by string --- .../androidaps/plugins/general/autotune/AutotunePlugin.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt index 69e7ccdecb..b0ec81d2d5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt @@ -199,7 +199,7 @@ class AutotunePlugin @Inject constructor( calculationRunning = false return result } - return "No Result" // should never occurs + return rh.gs(R.string.autotune_error) } private fun showResults(tunedProfile: ATProfile?, pumpProfile: ATProfile): String { From ba5eb8f9abd0a77ef7e2dfd6ea83fc17ee3b2fa6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 09:44:12 +0200 Subject: [PATCH 15/42] limit Aidex to pumpcontrol --- .../androidaps/plugins/source/AidexPlugin.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt index 459575c234..787205abb2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt @@ -10,13 +10,10 @@ import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository import info.nightscout.androidaps.database.entities.GlucoseValue import info.nightscout.androidaps.database.transactions.CgmSourceTransaction -import info.nightscout.androidaps.interfaces.BgSource -import info.nightscout.androidaps.interfaces.PluginBase -import info.nightscout.androidaps.interfaces.PluginDescription -import info.nightscout.androidaps.interfaces.PluginType +import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.receivers.DataWorker import info.nightscout.androidaps.receivers.Intents -import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import javax.inject.Inject @@ -26,7 +23,9 @@ import javax.inject.Singleton class AidexPlugin @Inject constructor( injector: HasAndroidInjector, rh: ResourceHelper, - aapsLogger: AAPSLogger + aapsLogger: AAPSLogger, + private val buildHelper: BuildHelper, + private val config: Config ) : PluginBase( PluginDescription() .mainType(PluginType.BGSOURCE) @@ -49,6 +48,11 @@ class AidexPlugin @Inject constructor( return advancedFiltering } + // Allow only for pumpcontrol or dev & engineering_mode + override fun specialEnableCondition(): Boolean { + return config.APS.not() || buildHelper.isDev() && buildHelper.isEngineeringMode() + } + // cannot be inner class because of needed injection class AidexWorker( context: Context, From 7bc4a6cbf7799a0cd19061066d1c9a05838eb3d2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 10:39:04 +0200 Subject: [PATCH 16/42] disable build cache --- gradle.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9e4747695e..bc239ab4ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,4 +21,5 @@ org.gradle.jvmargs=-Xmx2g android.enableJetifier=true android.useAndroidX=true -org.gradle.unsafe.configuration-cache=true +# Cache is causeing issues with CircleCI nad maybe Studio 2021 +# org.gradle.unsafe.configuration-cache=true From 0e3d8dd3facbca992bf66666efe75e6f5cc46ed8 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 10:47:16 +0200 Subject: [PATCH 17/42] connect wear module to google services --- wear/google-services.json | 127 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 wear/google-services.json diff --git a/wear/google-services.json b/wear/google-services.json new file mode 100644 index 0000000000..ad84142eea --- /dev/null +++ b/wear/google-services.json @@ -0,0 +1,127 @@ +{ + "project_info": { + "project_number": "477603612366", + "firebase_url": "https://androidaps-c34f8.firebaseio.com", + "project_id": "androidaps-c34f8", + "storage_bucket": "androidaps-c34f8.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:477603612366:android:aef229914e3e5448", + "android_client_info": { + "package_name": "info.nightscout.aapspumpcontrol" + } + }, + "oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD9HRtJJsnk_SbAMAuvudSua2vEm3j3430" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:477603612366:android:efc956f55b281623", + "android_client_info": { + "package_name": "info.nightscout.androidaps" + } + }, + "oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD9HRtJJsnk_SbAMAuvudSua2vEm3j3430" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:477603612366:android:b38d6e7351f73cc0", + "android_client_info": { + "package_name": "info.nightscout.nsclient" + } + }, + "oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD9HRtJJsnk_SbAMAuvudSua2vEm3j3430" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:477603612366:android:2dc8cf3acd3332e7", + "android_client_info": { + "package_name": "info.nightscout.nsclient2" + } + }, + "oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD9HRtJJsnk_SbAMAuvudSua2vEm3j3430" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "477603612366-a925drvlvs7qn7gt73r585erbqto8c79.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file From 89039c7bec55b4c72153c0e24bbf59ea30d4a4ba Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 11:42:30 +0200 Subject: [PATCH 18/42] New Crowdin updates (#1798) * New translations strings.xml (Slovak) * New translations strings.xml (Turkish) * New translations strings.xml (Turkish) * New translations strings.xml (Czech) * New translations strings.xml (French) * New translations strings.xml (French) * New translations strings.xml (Norwegian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (French) * New translations strings.xml (French) * New translations strings.xml (French) * New translations strings.xml (French) --- app/src/main/res/values-fr-rFR/strings.xml | 8 +++++++- app/src/main/res/values-tr-rTR/strings.xml | 1 + core/src/main/res/values-fr-rFR/strings.xml | 2 +- core/src/main/res/values-ru-rRU/strings.xml | 5 +++++ wear/src/main/res/values-cs-rCZ/strings.xml | 16 ++++++++++++++++ wear/src/main/res/values-fr-rFR/strings.xml | 13 +++++++++++++ wear/src/main/res/values-no-rNO/strings.xml | 16 ++++++++++++++++ wear/src/main/res/values-ru-rRU/strings.xml | 16 ++++++++++++++++ wear/src/main/res/values-sk-rSK/strings.xml | 15 +++++++++++++++ wear/src/main/res/values-tr-rTR/strings.xml | 16 ++++++++++++++++ 10 files changed, 106 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml index 1925d15b97..9e0ec5ebc8 100644 --- a/app/src/main/res/values-fr-rFR/strings.xml +++ b/app/src/main/res/values-fr-rFR/strings.xml @@ -605,7 +605,11 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Deuxième incrément de glucides Troisième incrément de glucides MGC + Utiliser la connexion mobile + Utilisez la connexion Wi-Fi Wi-fi SSID + Pendant la charge + Sur batterie Paramètres de connexion SSIDs autorisés (séparés par point-virgule) Autoriser connexion données itinérance @@ -684,7 +688,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S Divers Paramètres journal Réinitialiser les valeurs par défaut - Dysfonctionnement NSClient. Faites une réinitialisation de NS et de NSClient. + Dysfonctionnement NSClient. Redémarrez NS et NSClient. Décalage horaire Rappel du bolus plus tard Mode APS préféré @@ -1035,4 +1039,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S GlucoRx Aidex Aidex Recevoir les valeurs de glycémie du MGC GlucoRx Aidex. + Bloqué par les options de recharge + Bloqué par les options de connectivité diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index 356067e46b..fcf6eccb0b 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -475,6 +475,7 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d Yerel uyarılar KŞ bilgisi alınmadığında uyar Pompa ulaşılamıyorsa uyar + Pompa ulaşılamaz eşiği [dk] Karbonhidrat gerekliyse uyar Acil önemli Alarm BİLGİ diff --git a/core/src/main/res/values-fr-rFR/strings.xml b/core/src/main/res/values-fr-rFR/strings.xml index 16f153ac86..042e41d62c 100644 --- a/core/src/main/res/values-fr-rFR/strings.xml +++ b/core/src/main/res/values-fr-rFR/strings.xml @@ -446,7 +446,7 @@ Aide pour ajuster le profil (SI, rapport G/I et débits de basal) AT Paramètres Autotune - Changement de profil avec l\'Automatisation + Changr le profil avec l\'automatisation Si activé, Autotune mettra à jour automatiquement à jour le profil sélectionné et activera le profil calculé effectué à partir d\'une règle d\'automatisation. Catégoriser UAM en tant que Basal Activer uniquement si vous avez correctement saisi tous les glucides consommés, avec cette option, des hausses soudaines vues par Autotune seront utilisées pour modifier les débits de basal. diff --git a/core/src/main/res/values-ru-rRU/strings.xml b/core/src/main/res/values-ru-rRU/strings.xml index af6b5dadc6..02f52a4a7c 100644 --- a/core/src/main/res/values-ru-rRU/strings.xml +++ b/core/src/main/res/values-ru-rRU/strings.xml @@ -451,6 +451,11 @@ Классифицировать UAM как базал Включите, если только вы точно ввели все съеденные углеводы. С этой опцией внезапные подъемы, зафиксированные Autotune, будут использованы для рекомендаций изменения базальной скорости. Настройка кривой инсулина + Включите, если используете беспиковый. Настроит пики и DIA + Количество дней с данными + Применить усредненный суточный IC/ISF + Autotune не настраивает суточные вариации, эта опция только применяет усредненные коэффициенты IC и ISF к суточному профилю + Включить больше информации логов для отладки Количество дней обработки данных Autotune по умолчанию (до 30) Ошибка ввода данных, попробуйте запустить снова autotune или уменьшить количество дней Неверный профиль diff --git a/wear/src/main/res/values-cs-rCZ/strings.xml b/wear/src/main/res/values-cs-rCZ/strings.xml index f792859d43..84ebb1a0ae 100644 --- a/wear/src/main/res/values-cs-rCZ/strings.xml +++ b/wear/src/main/res/values-cs-rCZ/strings.xml @@ -168,4 +168,20 @@ Není dostupná žádná konfigurace Ovládání hodinkami vypnuto Žádná data k dispozici + zvýšení + snížení + V + N + prům + --U + --g + -.--U/h + Uploader: ---% + S: žádný status + Před -- minutamí + --- mg/dl + Žádný stav smyčky + 000g + 00,0 + 0,00U diff --git a/wear/src/main/res/values-fr-rFR/strings.xml b/wear/src/main/res/values-fr-rFR/strings.xml index b4501502bf..9073bec2ef 100644 --- a/wear/src/main/res/values-fr-rFR/strings.xml +++ b/wear/src/main/res/values-fr-rFR/strings.xml @@ -168,4 +168,17 @@ Aucune configuration disponible Contrôles Wear désactivés Aucune donnée disponible + H + B + moy + --U + --g + -.-- U/h + Téléchargement : ---% + Il y a -- minutes + --- mg/dl + Aucun statut de la boucle + 000 g + 00,0 + 0,00 U diff --git a/wear/src/main/res/values-no-rNO/strings.xml b/wear/src/main/res/values-no-rNO/strings.xml index 91483daf3a..94fe4309d0 100644 --- a/wear/src/main/res/values-no-rNO/strings.xml +++ b/wear/src/main/res/values-no-rNO/strings.xml @@ -168,4 +168,20 @@ Ingen konfigurasjon tilgjengelig Wear kontroller deaktivert Ingen data tilgjengelig + økning + reduksjon + H + L + snitt + --E + --g + -.--E/t + Opplaster: ---% + S: ingen status + -- Minutter siden + --- mg/dl + Ingen loop status + 000g + 00,0 + 0,00E diff --git a/wear/src/main/res/values-ru-rRU/strings.xml b/wear/src/main/res/values-ru-rRU/strings.xml index 56bd0c5746..4f320cac43 100644 --- a/wear/src/main/res/values-ru-rRU/strings.xml +++ b/wear/src/main/res/values-ru-rRU/strings.xml @@ -168,4 +168,20 @@ Нет доступной конфигурации Функция управления Wear выключена Нет данных + приращение + декремент + В + Н + сред + --ед + --г + -.--ед/ч + Загрузчик: --% + S: статус отсутствует + -- Минут назад + --- мг/дл + Нет статуса + 000г + 00,0 + 0,00 ед diff --git a/wear/src/main/res/values-sk-rSK/strings.xml b/wear/src/main/res/values-sk-rSK/strings.xml index 8093367939..08dde6af7b 100644 --- a/wear/src/main/res/values-sk-rSK/strings.xml +++ b/wear/src/main/res/values-sk-rSK/strings.xml @@ -168,4 +168,19 @@ Nie je dostupná žiadna konfigurácia Ovládanie hodinkami vypnuté Žiadne údaje nie sú k dispozícii + prírastok + zníženie + H + L + priemer + --JI + --g + -.--JI/h + S: žiadny stav + Pred -- minútami + --- mg/dl + Žiadny stav uzavretého okruhu + 000g + 00,0 + 0,00JI diff --git a/wear/src/main/res/values-tr-rTR/strings.xml b/wear/src/main/res/values-tr-rTR/strings.xml index 872f9cde00..5754310521 100644 --- a/wear/src/main/res/values-tr-rTR/strings.xml +++ b/wear/src/main/res/values-tr-rTR/strings.xml @@ -168,4 +168,20 @@ Mevcut yapılandırma yok Saat kontrolleri devre dışı Veri yok + artış + azalma + Y + D + ort + --Ü + --g + -.--Ü/sa + Yükleyici: ---% + S: durum yok + -- Dakika önce + --- mg/dl + Döngü Durumu Yok + 000g + 00,0 + 0,00Ü From 4a854616ae8568b4086dbbec62dfb80f3ecaf5c6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 11:43:16 +0200 Subject: [PATCH 19/42] 3.0.0.2-dev-m --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c37650c720..132de499a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -111,7 +111,7 @@ android { defaultConfig { multiDexEnabled true versionCode 1500 - version "3.0.0.2-dev-l" + version "3.0.0.2-dev-m" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"' buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"' From 0273ba7bf0e6eb6d09014de8d89863998bca5d04 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 13:10:27 +0200 Subject: [PATCH 20/42] convert BolusCalculatorResult units on upload --- .../nightscout/androidaps/dialogs/WizardInfoDialog.kt | 2 +- .../general/nsclient/DataSyncSelectorImplementation.kt | 4 ++-- .../extensions/BolusCalculatorResultExtension.kt | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt index 90f297bb08..1ec1c3907d 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardInfoDialog.kt @@ -60,7 +60,7 @@ class WizardInfoDialog : DaggerDialogFragment() { override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - outState.putString("data", data.toJson(true, dateUtil).toString()) + outState.putString("data", data.toJson(true, dateUtil, profileFunction).toString()) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt index f3ab04a81f..ff88b7e38f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/DataSyncSelectorImplementation.kt @@ -286,14 +286,14 @@ class DataSyncSelectorImplementation @Inject constructor( bolusCalculatorResult.first.interfaceIDs.nightscoutId == null -> nsClientPlugin.nsClientService?.dbAdd( "treatments", - bolusCalculatorResult.first.toJson(true, dateUtil), + bolusCalculatorResult.first.toJson(true, dateUtil, profileFunction), DataSyncSelector.PairBolusCalculatorResult(bolusCalculatorResult.first, bolusCalculatorResult.second.id), "$startId/$lastDbId" ) // with nsId = update bolusCalculatorResult.first.interfaceIDs.nightscoutId != null -> nsClientPlugin.nsClientService?.dbUpdate( - "treatments", bolusCalculatorResult.first.interfaceIDs.nightscoutId, bolusCalculatorResult.first.toJson(false, dateUtil), + "treatments", bolusCalculatorResult.first.interfaceIDs.nightscoutId, bolusCalculatorResult.first.toJson(false, dateUtil, profileFunction), DataSyncSelector.PairBolusCalculatorResult(bolusCalculatorResult.first, bolusCalculatorResult.second.id), "$startId/$lastDbId" ) } diff --git a/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt b/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt index a07e789856..5affb67f08 100644 --- a/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt +++ b/core/src/main/java/info/nightscout/androidaps/extensions/BolusCalculatorResultExtension.kt @@ -2,22 +2,23 @@ package info.nightscout.androidaps.extensions import com.google.gson.Gson import com.google.gson.JsonSyntaxException -import info.nightscout.androidaps.Constants import info.nightscout.androidaps.database.entities.BolusCalculatorResult import info.nightscout.androidaps.database.entities.TherapyEvent +import info.nightscout.androidaps.interfaces.Profile +import info.nightscout.androidaps.interfaces.ProfileFunction import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.JsonHelper import org.json.JSONObject -fun BolusCalculatorResult.toJson(isAdd: Boolean, dateUtil: DateUtil): JSONObject = +fun BolusCalculatorResult.toJson(isAdd: Boolean, dateUtil: DateUtil, profileFunction: ProfileFunction): JSONObject = JSONObject() .put("eventType", TherapyEvent.Type.BOLUS_WIZARD.text) .put("created_at", dateUtil.toISOString(timestamp)) .put("isValid", isValid) .put("bolusCalculatorResult", Gson().toJson(this)) .put("date", timestamp) - .put("glucose", glucoseValue) - .put("units", Constants.MGDL) + .put("glucose", Profile.fromMgdlToUnits(glucoseValue, profileFunction.getUnits())) + .put("units", profileFunction.getUnits().asText) .put("notes", note) .also { if (isAdd && interfaceIDs.nightscoutId != null) it.put("_id", interfaceIDs.nightscoutId) } From 024a90231641c108e4aa82776ed2f501e8e7a50a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 13:39:08 +0200 Subject: [PATCH 21/42] Better log alarms --- .../main/java/info/nightscout/androidaps/MainApp.kt | 2 +- .../overview/notifications/NotificationStore.kt | 12 ++++++------ .../nightscout/androidaps/dialogs/ErrorDialog.kt | 12 ++++++------ .../general/overview/notifications/Notification.kt | 2 +- .../androidaps/services/AlarmSoundServiceHelper.kt | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/java/info/nightscout/androidaps/MainApp.kt index ac4d908da7..f3c9b69fa5 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.kt @@ -249,7 +249,7 @@ class MainApp : DaggerApplication() { override fun onTerminate() { aapsLogger.debug(LTag.CORE, "onTerminate") unregisterActivityLifecycleCallbacks(activityMonitor) - alarmSoundServiceHelper.stopService(this) + alarmSoundServiceHelper.stopService(this, "onTerminate") super.onTerminate() } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt index ddfd52f32e..6fefe0c3ad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt @@ -17,12 +17,12 @@ import info.nightscout.androidaps.databinding.OverviewNotificationItemBinding import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IconsProvider import info.nightscout.androidaps.interfaces.NotificationHolder -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.shared.logging.LTag +import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewNotification import info.nightscout.androidaps.services.AlarmSoundServiceHelper import info.nightscout.androidaps.utils.DateUtil -import info.nightscout.androidaps.interfaces.ResourceHelper +import info.nightscout.shared.logging.AAPSLogger +import info.nightscout.shared.logging.LTag import info.nightscout.shared.sharedPreferences.SP import java.util.* import javax.inject.Inject @@ -68,7 +68,7 @@ class NotificationStore @Inject constructor( store.add(n) if (sp.getBoolean(R.string.key_raise_notifications_as_android_notifications, true) && n !is NotificationWithAction) raiseSystemNotification(n) - if (n.soundId != null && n.soundId != 0) alarmSoundServiceHelper.startAlarm(context, n.soundId!!) + if (n.soundId != null && n.soundId != 0) alarmSoundServiceHelper.startAlarm(context, n.soundId!!, n.text) Collections.sort(store, NotificationComparator()) return true } @@ -77,7 +77,7 @@ class NotificationStore @Inject constructor( fun remove(id: Int): Boolean { for (i in store.indices) { if (store[i].id == id) { - if (store[i].soundId != null) alarmSoundServiceHelper.stopService(context) + if (store[i].soundId != null) alarmSoundServiceHelper.stopService(context, "Removed " + store[i].text) aapsLogger.debug(LTag.NOTIFICATION, "Notification removed: " + store[i].text) store.removeAt(i) return true @@ -92,7 +92,7 @@ class NotificationStore @Inject constructor( while (i < store.size) { val n = store[i] if (n.validTo != 0L && n.validTo < System.currentTimeMillis()) { - if (store[i].soundId != null) alarmSoundServiceHelper.stopService(context) + if (store[i].soundId != null) alarmSoundServiceHelper.stopService(context, "Expired " + store[i].text) aapsLogger.debug(LTag.NOTIFICATION, "Notification expired: " + store[i].text) store.removeAt(i) i-- diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt index bf36db39d0..12e9b48b5b 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/ErrorDialog.kt @@ -74,11 +74,11 @@ class ErrorDialog : DaggerDialogFragment() { } binding.mute.setOnClickListener { uel.log(Action.ERROR_DIALOG_MUTE, Sources.Unknown) - stopAlarm() + stopAlarm("Mute") } binding.mute5min.setOnClickListener { uel.log(Action.ERROR_DIALOG_MUTE_5MIN, Sources.Unknown) - stopAlarm() + stopAlarm("Mute 5 min") handler.postDelayed(this::startAlarm, T.mins(5).msecs()) } startAlarm() @@ -110,14 +110,14 @@ class ErrorDialog : DaggerDialogFragment() { super.dismissAllowingStateLoss() helperActivity?.finish() handler.removeCallbacksAndMessages(null) - stopAlarm() + stopAlarm("Dismiss") } private fun startAlarm() { if (sound != 0) - alarmSoundServiceHelper.startAlarm(ctx, sound) + alarmSoundServiceHelper.startAlarm(ctx, sound, "$title:$status") } - private fun stopAlarm() = - alarmSoundServiceHelper.stopService(ctx) + private fun stopAlarm(reason: String) = + alarmSoundServiceHelper.stopService(ctx, reason) } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.kt index fc0d025e80..11843accfb 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.kt @@ -8,7 +8,7 @@ open class Notification { var id = 0 var date: Long = 0 - var text: String? = null + var text: String = "" var level = 0 var validTo: Long = 0 @RawRes var soundId: Int? = null diff --git a/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundServiceHelper.kt b/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundServiceHelper.kt index 1fde2cdbb7..9f5e32a9b6 100644 --- a/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundServiceHelper.kt +++ b/core/src/main/java/info/nightscout/androidaps/services/AlarmSoundServiceHelper.kt @@ -28,8 +28,8 @@ class AlarmSoundServiceHelper @Inject constructor( private val notificationHolder: NotificationHolder ) { - fun startAlarm(context: Context, sound: Int) { - aapsLogger.debug(LTag.CORE, "Starting alarm") + fun startAlarm(context: Context, sound: Int, reason: String) { + aapsLogger.debug(LTag.CORE, "Starting alarm from $reason") val connection = object : ServiceConnection { override fun onServiceConnected(name: ComponentName?, service: IBinder?) { // The binder of the service that returns the instance that is created. @@ -62,8 +62,8 @@ class AlarmSoundServiceHelper @Inject constructor( } } - fun stopService(context: Context) { - aapsLogger.debug(LTag.CORE, "Stopping alarm") + fun stopService(context: Context, reason: String) { + aapsLogger.debug(LTag.CORE, "Stopping alarm from $reason") val alarm = Intent(context, AlarmSoundService::class.java) context.stopService(alarm) } From 79ea2fff0cf04d2abbd405e5913fbf537c52adad Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 8 Jun 2022 16:08:08 +0200 Subject: [PATCH 22/42] fix wrong basal scale --- .../androidaps/plugins/general/overview/graphData/GraphData.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt index 0e9fa99b8b..0626b97912 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt @@ -73,6 +73,7 @@ class GraphData( } fun addBasals() { + maxY = max(maxY, defaultValueHelper.determineHighLine()) val scale = defaultValueHelper.determineLowLine() / maxY / 1.2 addSeries(overviewData.baseBasalGraphSeries) addSeries(overviewData.tempBasalGraphSeries) From f546a164c82854fd3ab86801f20edb0b3671cb81 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Jun 2022 08:11:29 +0000 Subject: [PATCH 23/42] Bump kotlin_version from 1.6.21 to 1.7.0 Bumps `kotlin_version` from 1.6.21 to 1.7.0. Updates `kotlin-gradle-plugin` from 1.6.21 to 1.7.0 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-allopen` from 1.6.21 to 1.7.0 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-serialization` from 1.6.21 to 1.7.0 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-stdlib-jdk8` from 1.6.21 to 1.7.0 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) Updates `kotlin-reflect` from 1.6.21 to 1.7.0 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](https://github.com/JetBrains/kotlin/commits) --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-gradle-plugin dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.jetbrains.kotlin:kotlin-allopen dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.jetbrains.kotlin:kotlin-serialization dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.jetbrains.kotlin:kotlin-stdlib-jdk8 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.jetbrains.kotlin:kotlin-reflect dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 46c6aa6926..1872769fc3 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext { - kotlin_version = '1.6.21' + kotlin_version = '1.7.0' core_version = '1.8.0' rxjava_version = '3.1.5' rxandroid_version = '3.0.0' From 1d95571560fefae820a20e721ff4b33ab37b9754 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Jun 2022 08:11:41 +0000 Subject: [PATCH 24/42] Bump org.jetbrains.kotlin.android from 1.6.21 to 1.7.0 Bumps org.jetbrains.kotlin.android from 1.6.21 to 1.7.0. --- updated-dependencies: - dependency-name: org.jetbrains.kotlin.android dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 46c6aa6926..2df15a614e 100644 --- a/build.gradle +++ b/build.gradle @@ -66,7 +66,7 @@ plugins { id "io.gitlab.arturbosch.detekt" version "1.20.0" id "org.jlleitschuh.gradle.ktlint" version "10.3.0" id 'org.barfuin.gradle.jacocolog' version '2.0.0' - id 'org.jetbrains.kotlin.android' version '1.6.21' apply false + id 'org.jetbrains.kotlin.android' version '1.7.0' apply false } allprojects { From 845879d91635c788f18b73382f1f567a253e37fd Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 9 Jun 2022 15:22:02 +0200 Subject: [PATCH 25/42] Cache TDD calculations --- .../nightscout/androidaps/MainActivity.kt | 1 - .../IobCobCalculatorPlugin.kt | 46 ++-- .../androidaps/utils/stats/TddCalculator.kt | 110 ++++---- .../plugins/pump/common/defs/PumpType.kt | 255 +++++++++++------- .../androidaps/database/AppRepository.kt | 21 +- .../database/daos/TotalDailyDoseDao.kt | 14 +- .../database/embedments/InterfaceIDs.kt | 3 +- 7 files changed, 261 insertions(+), 189 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index e4960d913f..e3c7fb1c11 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -39,7 +39,6 @@ import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventRebuildTabs import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.logging.UserEntryLogger -import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt index 6d76621a6d..00fa1dd6dd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt @@ -30,6 +30,7 @@ import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.workflow.CalculationWorkflow import info.nightscout.androidaps.events.Event +import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import info.nightscout.shared.sharedPreferences.SP @@ -127,10 +128,20 @@ class IobCobCalculatorPlugin @Inject constructor( } private fun resetDataAndRunCalculation(reason: String, event: Event?) { - calculationWorkflow.stopCalculation(CalculationWorkflow.MAIN_CALCULATION,reason) + calculationWorkflow.stopCalculation(CalculationWorkflow.MAIN_CALCULATION, reason) clearCache() ads.reset() - calculationWorkflow.runCalculation(CalculationWorkflow.MAIN_CALCULATION,this, overviewData, reason, System.currentTimeMillis(), bgDataReload = false, limitDataToOldestAvailable = true, cause = event, runLoop = true) + calculationWorkflow.runCalculation( + CalculationWorkflow.MAIN_CALCULATION, + this, + overviewData, + reason, + System.currentTimeMillis(), + bgDataReload = false, + limitDataToOldestAvailable = true, + cause = event, + runLoop = true + ) } override fun clearCache() { @@ -363,18 +374,21 @@ class IobCobCalculatorPlugin @Inject constructor( scheduledHistoryPost?.cancel(false) // prepare task for execution in 1 sec scheduledEvent = event - scheduledHistoryPost = historyWorker.schedule({ - synchronized(this) { - aapsLogger.debug(LTag.AUTOSENS, "Running newHistoryData") - newHistoryData( - event.oldDataTimestamp, - event.reloadBgData, - if (event.newestGlucoseValue != null) EventNewBG(event.newestGlucoseValue) else event - ) - scheduledEvent = null - scheduledHistoryPost = null - } - }, 1L, TimeUnit.SECONDS) + scheduledHistoryPost = historyWorker.schedule( + { + synchronized(this) { + aapsLogger.debug(LTag.AUTOSENS, "Running newHistoryData") + repository.clearCachedData(MidnightTime.calc(event.oldDataTimestamp)) + newHistoryData( + event.oldDataTimestamp, + event.reloadBgData, + if (event.newestGlucoseValue != null) EventNewBG(event.newestGlucoseValue) else event + ) + scheduledEvent = null + scheduledHistoryPost = null + } + }, 1L, TimeUnit.SECONDS + ) } else { // asked reload is newer -> adjust params only scheduledEvent?.let { @@ -391,7 +405,7 @@ class IobCobCalculatorPlugin @Inject constructor( // When historical data is changed (coming from NS etc) finished calculations after this date must be invalidated private fun newHistoryData(oldDataTimestamp: Long, bgDataReload: Boolean, event: Event) { //log.debug("Locking onNewHistoryData"); - calculationWorkflow.stopCalculation(CalculationWorkflow.MAIN_CALCULATION,"onEventNewHistoryData") + calculationWorkflow.stopCalculation(CalculationWorkflow.MAIN_CALCULATION, "onEventNewHistoryData") synchronized(dataLock) { // clear up 5 min back for proper COB calculation @@ -415,7 +429,7 @@ class IobCobCalculatorPlugin @Inject constructor( } ads.newHistoryData(time, aapsLogger, dateUtil) } - calculationWorkflow.runCalculation(CalculationWorkflow.MAIN_CALCULATION,this, overviewData, event.javaClass.simpleName, System.currentTimeMillis(), bgDataReload, true, event, runLoop = true) + calculationWorkflow.runCalculation(CalculationWorkflow.MAIN_CALCULATION, this, overviewData, event.javaClass.simpleName, System.currentTimeMillis(), bgDataReload, true, event, runLoop = true) //log.debug("Releasing onNewHistoryData"); } diff --git a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt index 91ef25a1f8..e6261c5e37 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/stats/TddCalculator.kt @@ -11,6 +11,8 @@ import android.widget.TableRow import android.widget.TextView import info.nightscout.androidaps.R import info.nightscout.androidaps.database.AppRepository +import info.nightscout.androidaps.database.ValueWrapper +import info.nightscout.androidaps.database.embedments.InterfaceIDs import info.nightscout.androidaps.database.entities.Bolus import info.nightscout.androidaps.database.entities.TotalDailyDose import info.nightscout.androidaps.extensions.convertedToAbsolute @@ -19,10 +21,10 @@ import info.nightscout.androidaps.extensions.toTableRowHeader import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.IobCobCalculator import info.nightscout.androidaps.interfaces.ProfileFunction +import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.androidaps.utils.T -import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import javax.inject.Inject @@ -38,48 +40,62 @@ class TddCalculator @Inject constructor( ) { fun calculate(days: Long): LongSparseArray { - val startTime = MidnightTime.calc(dateUtil.now() - T.days(days).msecs()) + var startTime = MidnightTime.calc(dateUtil.now() - T.days(days).msecs()) val endTime = MidnightTime.calc(dateUtil.now()) val result = LongSparseArray() - repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() - .filter { it.type != Bolus.Type.PRIMING } - .forEach { t -> - val midnight = MidnightTime.calc(t.timestamp) - val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - tdd.bolusAmount += t.amount - result.put(midnight, tdd) - } - repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> - val midnight = MidnightTime.calc(t.timestamp) - val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - tdd.carbs += t.amount - result.put(midnight, tdd) + // Try to load cached values + while (startTime < endTime) { + val tdd = repository.getCalculatedTotalDailyDose(startTime).blockingGet() + if (tdd is ValueWrapper.Existing) result.put(startTime, tdd.value) + else break + startTime += T.hours(24).msecs() } - val calculationStep = T.mins(5).msecs() - val tempBasals = iobCobCalculator.getTempBasalIncludingConvertedExtendedForRange(startTime, endTime, calculationStep) - for (t in startTime until endTime step calculationStep) { - val midnight = MidnightTime.calc(t) - val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) - val tbr = tempBasals[t] - val profile = profileFunction.getProfile(t) ?: continue - val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) - tdd.basalAmount += absoluteRate / T.mins(60).msecs().toDouble() * calculationStep.toDouble() - - if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { - // they are not included in TBRs - val eb = iobCobCalculator.getExtendedBolus(t) - val absoluteEbRate = eb?.rate ?: 0.0 - tdd.bolusAmount += absoluteEbRate / T.mins(60).msecs().toDouble() * calculationStep.toDouble() + if (endTime > startTime) { + repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() + .filter { it.type != Bolus.Type.PRIMING } + .forEach { t -> + val midnight = MidnightTime.calc(t.timestamp) + val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + tdd.bolusAmount += t.amount + result.put(midnight, tdd) + } + repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> + val midnight = MidnightTime.calc(t.timestamp) + val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + tdd.carbs += t.amount + result.put(midnight, tdd) + } + + val calculationStep = T.mins(5).msecs() + val tempBasals = iobCobCalculator.getTempBasalIncludingConvertedExtendedForRange(startTime, endTime, calculationStep) + for (t in startTime until endTime step calculationStep) { + val midnight = MidnightTime.calc(t) + val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) + val tbr = tempBasals[t] + val profile = profileFunction.getProfile(t) ?: continue + val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) + tdd.basalAmount += absoluteRate / T.mins(60).msecs().toDouble() * calculationStep.toDouble() + + if (!activePlugin.activePump.isFakingTempsByExtendedBoluses) { + // they are not included in TBRs + val eb = iobCobCalculator.getExtendedBolus(t) + val absoluteEbRate = eb?.rate ?: 0.0 + tdd.bolusAmount += absoluteEbRate / T.mins(60).msecs().toDouble() * calculationStep.toDouble() + } + result.put(midnight, tdd) } - result.put(midnight, tdd) } for (i in 0 until result.size()) { val tdd = result.valueAt(i) tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount + if (tdd.interfaceIDs.pumpType != InterfaceIDs.PumpType.CACHE) { + tdd.interfaceIDs.pumpType = InterfaceIDs.PumpType.CACHE + aapsLogger.debug(LTag.CORE, "Storing TDD $tdd") + repository.createTotalDailyDose(tdd) + } } - aapsLogger.debug(LTag.CORE, result.toString()) return result } @@ -91,22 +107,13 @@ class TddCalculator @Inject constructor( repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() .filter { it.type != Bolus.Type.PRIMING } .forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) tdd.bolusAmount += t.amount - //result.put(midnight, tdd) } repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) tdd.carbs += t.amount - //result.put(midnight, tdd) } val calculationStep = T.mins(5).msecs() for (t in startTime until endTime step calculationStep) { - - //val midnight = MidnightTime.calc(t) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) val profile = profileFunction.getProfile(t) ?: continue val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) @@ -118,13 +125,8 @@ class TddCalculator @Inject constructor( val absoluteEbRate = eb?.rate ?: 0.0 tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0 } - //result.put(midnight, tdd) } - //for (i in 0 until tdd.size()) { - //val tdd = result.valueAt(i) tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount - //} - aapsLogger.debug(LTag.CORE, tdd.toString()) return tdd } @@ -133,27 +135,16 @@ class TddCalculator @Inject constructor( val startTime = dateUtil.now() - T.hours(hour = 24).msecs() val endTime = dateUtil.now() val tdd = TotalDailyDose(timestamp = startTime) - //val result = TotalDailyDose() repository.getBolusesDataFromTimeToTime(startTime, endTime, true).blockingGet() .filter { it.type != Bolus.Type.PRIMING } .forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) tdd.bolusAmount += t.amount - //result.put(midnight, tdd) } repository.getCarbsDataFromTimeToTimeExpanded(startTime, endTime, true).blockingGet().forEach { t -> - //val midnight = MidnightTime.calc(t.timestamp) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) tdd.carbs += t.amount - //result.put(midnight, tdd) } val calculationStep = T.mins(5).msecs() - //val tempBasals = iobCobCalculator.getTempBasalIncludingConvertedExtendedForRange(startTime, endTime, calculationStep) for (t in startTime until endTime step calculationStep) { - - //val midnight = MidnightTime.calc(t) - //val tdd = result[midnight] ?: TotalDailyDose(timestamp = midnight) val tbr = iobCobCalculator.getTempBasalIncludingConvertedExtended(t) val profile = profileFunction.getProfile(t) ?: continue val absoluteRate = tbr?.convertedToAbsolute(t, profile) ?: profile.getBasal(t) @@ -165,13 +156,8 @@ class TddCalculator @Inject constructor( val absoluteEbRate = eb?.rate ?: 0.0 tdd.bolusAmount += absoluteEbRate / 60.0 * 5.0 } - //result.put(midnight, tdd) } - //for (i in 0 until tdd.size()) { - //val tdd = result.valueAt(i) tdd.totalAmount = tdd.bolusAmount + tdd.basalAmount - //} - aapsLogger.debug(LTag.CORE, tdd.toString()) return tdd } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt index 9344476a61..0a9d28d76c 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt @@ -11,7 +11,8 @@ import kotlin.math.min @Suppress("unused") enum class PumpType { - GENERIC_AAPS(description = "Generic AAPS", + GENERIC_AAPS( + description = "Generic AAPS", manufacturer = ManufacturerType.AndroidAPS, model = "VirtualPump", bolusSize = 0.1, @@ -23,9 +24,11 @@ enum class PumpType { baseBasalMinValue = 0.01, baseBasalStep = 0.01, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.VirtualPumpCapabilities), + pumpCapability = PumpCapability.VirtualPumpCapabilities + ), - CELLNOVO(description = "Cellnovo", + CELLNOVO( + description = "Cellnovo", manufacturer = ManufacturerType.Cellnovo, model = "Cellnovo", bolusSize = 0.05, @@ -37,9 +40,11 @@ enum class PumpType { baseBasalMinValue = 0.05, baseBasalStep = 0.05, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.VirtualPumpCapabilities), + pumpCapability = PumpCapability.VirtualPumpCapabilities + ), - ACCU_CHEK_COMBO(description = "Accu-Chek Combo", + ACCU_CHEK_COMBO( + description = "Accu-Chek Combo", manufacturer = ManufacturerType.Roche, model = "Combo", bolusSize = 0.1, @@ -53,8 +58,10 @@ enum class PumpType { baseBasalSpecialSteps = DoseStepSize.ComboBasal, pumpCapability = PumpCapability.ComboCapabilities, source = Sources.Combo, - supportBatteryLevel = false), - ACCU_CHEK_SPIRIT(description = "Accu-Chek Spirit", + supportBatteryLevel = false + ), + ACCU_CHEK_SPIRIT( + description = "Accu-Chek Spirit", manufacturer = ManufacturerType.Roche, model = "Spirit", bolusSize = 0.1, @@ -66,8 +73,10 @@ enum class PumpType { baseBasalMinValue = 0.01, baseBasalStep = 0.1, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.VirtualPumpCapabilities), - ACCU_CHEK_INSIGHT_VIRTUAL(description = "Accu-Chek Insight", + pumpCapability = PumpCapability.VirtualPumpCapabilities + ), + ACCU_CHEK_INSIGHT_VIRTUAL( + description = "Accu-Chek Insight", manufacturer = ManufacturerType.Roche, model = "Insight", bolusSize = 0.05, @@ -79,8 +88,10 @@ enum class PumpType { baseBasalMinValue = 0.02, baseBasalStep = 0.01, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.InsightCapabilities), - ACCU_CHEK_INSIGHT(description = "Accu-Chek Insight", + pumpCapability = PumpCapability.InsightCapabilities + ), + ACCU_CHEK_INSIGHT( + description = "Accu-Chek Insight", manufacturer = ManufacturerType.Roche, model = "Insight", bolusSize = 0.01, @@ -94,8 +105,10 @@ enum class PumpType { baseBasalStep = 0.01, baseBasalSpecialSteps = DoseStepSize.InsightBasal, pumpCapability = PumpCapability.InsightCapabilities, - source = Sources.Insight), - ACCU_CHEK_SOLO(description = "Accu-Chek Solo", + source = Sources.Insight + ), + ACCU_CHEK_SOLO( + description = "Accu-Chek Solo", manufacturer = ManufacturerType.Roche, model = "Solo", bolusSize = 0.01, @@ -108,9 +121,11 @@ enum class PumpType { baseBasalMaxValue = null, baseBasalStep = 0.01, baseBasalSpecialSteps = DoseStepSize.InsightBolus, - pumpCapability = PumpCapability.InsightCapabilities), + pumpCapability = PumpCapability.InsightCapabilities + ), - ANIMAS_VIBE(description = "Animas Vibe", + ANIMAS_VIBE( + description = "Animas Vibe", manufacturer = ManufacturerType.Animas, model = "Vibe", bolusSize = 0.05, @@ -123,9 +138,11 @@ enum class PumpType { baseBasalMaxValue = 5.0, baseBasalStep = 0.0, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.VirtualPumpCapabilities), + pumpCapability = PumpCapability.VirtualPumpCapabilities + ), ANIMAS_PING(description = "Animas Ping", model = "Ping", parent = ANIMAS_VIBE), - DANA_R(description = "DanaR", + DANA_R( + description = "DanaR", manufacturer = ManufacturerType.Sooil, model = "DanaR", bolusSize = 0.05, @@ -138,8 +155,10 @@ enum class PumpType { baseBasalStep = 0.01, baseBasalSpecialSteps = null, pumpCapability = PumpCapability.DanaCapabilities, - source = Sources.DanaR), - DANA_R_KOREAN(description = "DanaR Korean", + source = Sources.DanaR + ), + DANA_R_KOREAN( + description = "DanaR Korean", manufacturer = ManufacturerType.Sooil, model = "DanaRKorean", bolusSize = 0.05, @@ -152,8 +171,10 @@ enum class PumpType { baseBasalStep = 0.01, baseBasalSpecialSteps = null, pumpCapability = PumpCapability.DanaCapabilities, - source = Sources.DanaRC), - DANA_RS(description = "DanaRS", + source = Sources.DanaRC + ), + DANA_RS( + description = "DanaRS", manufacturer = ManufacturerType.Sooil, model = "DanaRS", bolusSize = 0.05, @@ -166,11 +187,13 @@ enum class PumpType { baseBasalStep = 0.01, baseBasalSpecialSteps = null, pumpCapability = PumpCapability.DanaWithHistoryCapabilities, - source = Sources.DanaRS), + source = Sources.DanaRS + ), DANA_RS_KOREAN(description = "DanaRSKorean", model = "DanaRSKorean", parent = DANA_RS), DANA_I(description = "DanaI", model = "DanaI", parent = DANA_RS, source = Sources.DanaI), DANA_RV2(description = "DanaRv2", model = "DanaRv2", parent = DANA_RS, source = Sources.DanaRv2), - OMNIPOD_EROS(description = "Omnipod Eros", + OMNIPOD_EROS( + description = "Omnipod Eros", manufacturer = ManufacturerType.Insulet, model = "Eros", bolusSize = 0.05, @@ -188,8 +211,10 @@ enum class PumpType { isPatchPump = true, useHardwareLink = true, supportBatteryLevel = false, - source = Sources.OmnipodEros), - OMNIPOD_DASH(description = "Omnipod Dash", + source = Sources.OmnipodEros + ), + OMNIPOD_DASH( + description = "Omnipod Dash", manufacturer = ManufacturerType.Insulet, model = "Dash", bolusSize = 0.05, @@ -205,8 +230,10 @@ enum class PumpType { isPatchPump = true, pumpCapability = PumpCapability.OmnipodCapabilities, hasCustomUnreachableAlertCheck = false, - supportBatteryLevel = false), - MEDTRONIC_512_712(description = "Medtronic 512/712", + supportBatteryLevel = false + ), + MEDTRONIC_512_712( + description = "Medtronic 512/712", manufacturer = ManufacturerType.Medtronic, model = "512/712", bolusSize = 0.1, @@ -219,14 +246,20 @@ enum class PumpType { baseBasalStep = 0.05, baseBasalSpecialSteps = null, pumpCapability = PumpCapability.MedtronicCapabilities, - source = Sources.Medtronic), - MEDTRONIC_515_715(description = "Medtronic 515/715", + source = Sources.Medtronic + ), + MEDTRONIC_515_715( + description = "Medtronic 515/715", model = "515/715", - parent = MEDTRONIC_512_712), - MEDTRONIC_522_722(description = "Medtronic 522/722", + parent = MEDTRONIC_512_712 + ), + MEDTRONIC_522_722( + description = "Medtronic 522/722", model = "522/722", - parent = MEDTRONIC_512_712), - MEDTRONIC_523_723_REVEL(description = "Medtronic 523/723 (Revel)", + parent = MEDTRONIC_512_712 + ), + MEDTRONIC_523_723_REVEL( + description = "Medtronic 523/723 (Revel)", manufacturer = ManufacturerType.Medtronic, model = "523/723 (Revel)", bolusSize = 0.05, @@ -239,9 +272,11 @@ enum class PumpType { baseBasalStep = 0.025, baseBasalSpecialSteps = DoseStepSize.MedtronicVeoBasal, pumpCapability = PumpCapability.MedtronicCapabilities, - source = Sources.Medtronic), + source = Sources.Medtronic + ), MEDTRONIC_554_754_VEO(description = "Medtronic 554/754 (Veo)", model = "554/754 (Veo)", parent = MEDTRONIC_523_723_REVEL), - MEDTRONIC_640G(description = "Medtronic 640G", + MEDTRONIC_640G( + description = "Medtronic 640G", manufacturer = ManufacturerType.Medtronic, model = "640G", bolusSize = 0.025, @@ -253,9 +288,11 @@ enum class PumpType { baseBasalMinValue = 0.025, baseBasalStep = 0.025, baseBasalSpecialSteps = DoseStepSize.MedtronicVeoBasal, - pumpCapability = PumpCapability.VirtualPumpCapabilities), + pumpCapability = PumpCapability.VirtualPumpCapabilities + ), - TANDEM_T_SLIM(description = "Tandem t:slim", + TANDEM_T_SLIM( + description = "Tandem t:slim", manufacturer = ManufacturerType.Tandem, model = "t:slim", bolusSize = 0.01, @@ -267,12 +304,14 @@ enum class PumpType { baseBasalMinValue = 0.1, baseBasalStep = 0.001, baseBasalSpecialSteps = null, - pumpCapability = PumpCapability.VirtualPumpCapabilities), + pumpCapability = PumpCapability.VirtualPumpCapabilities + ), TANDEM_T_FLEX(description = "Tandem t:flex", model = "t:flex", parent = TANDEM_T_SLIM), TANDEM_T_SLIM_G4(description = "Tandem t:slim G4", model = "t:slim G4", parent = TANDEM_T_SLIM), TANDEM_T_SLIM_X2(description = "Tandem t:slim X2", model = "t:slim X2", parent = TANDEM_T_SLIM), - YPSOPUMP(description = "YpsoPump", + YPSOPUMP( + description = "YpsoPump", manufacturer = ManufacturerType.Ypsomed, model = "Ypsopump", bolusSize = 0.1, @@ -285,26 +324,39 @@ enum class PumpType { baseBasalMaxValue = 40.0, baseBasalStep = 0.01, baseBasalSpecialSteps = DoseStepSize.YpsopumpBasal, - pumpCapability = PumpCapability.YpsomedCapabilities), - MDI(description = "MDI", + pumpCapability = PumpCapability.YpsomedCapabilities + ), + MDI( + description = "MDI", manufacturer = ManufacturerType.AndroidAPS, bolusSize = 0.5, model = "MDI", tbrSettings = DoseSettings(1.0, 15, 24 * 60, 0.0, 500.0), extendedBolusSettings = DoseSettings(0.1, 15, 12 * 60, 0.1), - pumpCapability = PumpCapability.MDI), + pumpCapability = PumpCapability.MDI + ), // Not real pump. Used for User as a source - USER(description = "USER", + USER( + description = "USER", manufacturer = ManufacturerType.AndroidAPS, model = "USER", tbrSettings = DoseSettings(1.0, 15, 24 * 60, 0.0, 500.0), extendedBolusSettings = DoseSettings(0.1, 15, 12 * 60, 0.1), pumpCapability = PumpCapability.MDI, - source = Sources.MDI), + source = Sources.MDI + ), + + // Not real, cached value + CACHE( + description = "CACHE", + model = "CACHE", + parent = USER + ), //Diaconn Pump - DIACONN_G8(description = "Diaconn G8", + DIACONN_G8( + description = "Diaconn G8", manufacturer = ManufacturerType.G2e, model = "DiaconnG8", bolusSize = 0.01, @@ -319,7 +371,8 @@ enum class PumpType { baseBasalSpecialSteps = null, pumpCapability = PumpCapability.DiaconnCapabilities, source = Sources.DiaconnG8, - useHardwareLink = true); + useHardwareLink = true + ); val description: String var manufacturer: ManufacturerType? = null @@ -407,6 +460,7 @@ enum class PumpType { InterfaceIDs.PumpType.MDI -> MDI InterfaceIDs.PumpType.USER -> USER InterfaceIDs.PumpType.DIACONN_G8 -> DIACONN_G8 + InterfaceIDs.PumpType.CACHE -> TODO() } } @@ -418,25 +472,27 @@ enum class PumpType { parent.model = model } - constructor(description: String, - manufacturer: ManufacturerType, - model: String, - bolusSize: Double = 0.0, - specialBolusSize: DoseStepSize? = null, - extendedBolusSettings: DoseSettings, - pumpTempBasalType: PumpTempBasalType? = null, - tbrSettings: DoseSettings, - specialBasalDurations: PumpCapability? = null, - baseBasalMinValue: Double = 0.01, - baseBasalMaxValue: Double? = null, - baseBasalStep: Double = 1.0, - baseBasalSpecialSteps: DoseStepSize? = null, - pumpCapability: PumpCapability, - hasCustomUnreachableAlertCheck: Boolean = false, - isPatchPump: Boolean = false, - supportBatteryLevel: Boolean = true, - useHardwareLink: Boolean = false, - source: Sources = Sources.VirtualPump) { + constructor( + description: String, + manufacturer: ManufacturerType, + model: String, + bolusSize: Double = 0.0, + specialBolusSize: DoseStepSize? = null, + extendedBolusSettings: DoseSettings, + pumpTempBasalType: PumpTempBasalType? = null, + tbrSettings: DoseSettings, + specialBasalDurations: PumpCapability? = null, + baseBasalMinValue: Double = 0.01, + baseBasalMaxValue: Double? = null, + baseBasalStep: Double = 1.0, + baseBasalSpecialSteps: DoseStepSize? = null, + pumpCapability: PumpCapability, + hasCustomUnreachableAlertCheck: Boolean = false, + isPatchPump: Boolean = false, + supportBatteryLevel: Boolean = true, + useHardwareLink: Boolean = false, + source: Sources = Sources.VirtualPump + ) { this.description = description this.manufacturer = manufacturer this.model = model @@ -463,12 +519,14 @@ enum class PumpType { val eb = extendedBolusSettings ?: return "INVALID" val tbr = tbrSettings ?: return "INVALID" val extendedNote = if (hasExtendedBasals) rh.gs(R.string.def_extended_note) else "" - return String.format(i18nTemplate, + return String.format( + i18nTemplate, getStep("" + bolusSize, specialBolusSize), eb.step, eb.durationStep, eb.maxDuration / 60, getStep(baseBasalRange(), baseBasalSpecialSteps), tbr.minDose.toString() + unit + "-" + tbr.maxDose + unit, tbr.step.toString() + unit, - tbr.durationStep, tbr.maxDuration / 60, extendedNote) + tbr.durationStep, tbr.maxDuration / 60, extendedNote + ) } private fun baseBasalRange(): String = @@ -494,42 +552,45 @@ enum class PumpType { fun determineCorrectBasalSize(basalAmount: Double): Double { val tSettings = tbrSettings ?: throw IllegalStateException() - return Round.roundTo(min(basalAmount, tSettings.maxDose), baseBasalSpecialSteps?.getStepSizeForAmount(basalAmount) - ?: baseBasalStep) + return Round.roundTo( + min(basalAmount, tSettings.maxDose), baseBasalSpecialSteps?.getStepSizeForAmount(basalAmount) + ?: baseBasalStep + ) } fun toDbPumpType(): InterfaceIDs.PumpType = when (this) { - GENERIC_AAPS -> InterfaceIDs.PumpType.GENERIC_AAPS - CELLNOVO -> InterfaceIDs.PumpType.CELLNOVO - ACCU_CHEK_COMBO -> InterfaceIDs.PumpType.ACCU_CHEK_COMBO - ACCU_CHEK_SPIRIT -> InterfaceIDs.PumpType.ACCU_CHEK_SPIRIT + GENERIC_AAPS -> InterfaceIDs.PumpType.GENERIC_AAPS + CELLNOVO -> InterfaceIDs.PumpType.CELLNOVO + ACCU_CHEK_COMBO -> InterfaceIDs.PumpType.ACCU_CHEK_COMBO + ACCU_CHEK_SPIRIT -> InterfaceIDs.PumpType.ACCU_CHEK_SPIRIT ACCU_CHEK_INSIGHT_VIRTUAL -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT ACCU_CHEK_INSIGHT -> InterfaceIDs.PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH ACCU_CHEK_SOLO -> InterfaceIDs.PumpType.ACCU_CHEK_SOLO - ANIMAS_VIBE -> InterfaceIDs.PumpType.ANIMAS_VIBE - ANIMAS_PING -> InterfaceIDs.PumpType.ANIMAS_PING - DANA_R -> InterfaceIDs.PumpType.DANA_R - DANA_R_KOREAN -> InterfaceIDs.PumpType.DANA_R_KOREAN - DANA_RS -> InterfaceIDs.PumpType.DANA_RS - DANA_RS_KOREAN -> InterfaceIDs.PumpType.DANA_RS_KOREAN - DANA_RV2 -> InterfaceIDs.PumpType.DANA_RV2 - DANA_I -> InterfaceIDs.PumpType.DANA_I - OMNIPOD_EROS -> InterfaceIDs.PumpType.OMNIPOD_EROS - OMNIPOD_DASH -> InterfaceIDs.PumpType.OMNIPOD_DASH - MEDTRONIC_512_712 -> InterfaceIDs.PumpType.MEDTRONIC_512_517 - MEDTRONIC_515_715 -> InterfaceIDs.PumpType.MEDTRONIC_515_715 - MEDTRONIC_522_722 -> InterfaceIDs.PumpType.MEDTRONIC_522_722 - MEDTRONIC_523_723_REVEL -> InterfaceIDs.PumpType.MEDTRONIC_523_723_REVEL - MEDTRONIC_554_754_VEO -> InterfaceIDs.PumpType.MEDTRONIC_554_754_VEO - MEDTRONIC_640G -> InterfaceIDs.PumpType.MEDTRONIC_640G - TANDEM_T_SLIM -> InterfaceIDs.PumpType.TANDEM_T_SLIM - TANDEM_T_SLIM_G4 -> InterfaceIDs.PumpType.TANDEM_T_SLIM_G4 - TANDEM_T_FLEX -> InterfaceIDs.PumpType.TANDEM_T_FLEX - TANDEM_T_SLIM_X2 -> InterfaceIDs.PumpType.TANDEM_T_SLIM_X2 - YPSOPUMP -> InterfaceIDs.PumpType.YPSOPUMP - MDI -> InterfaceIDs.PumpType.MDI - USER -> InterfaceIDs.PumpType.USER - DIACONN_G8 -> InterfaceIDs.PumpType.DIACONN_G8 + ANIMAS_VIBE -> InterfaceIDs.PumpType.ANIMAS_VIBE + ANIMAS_PING -> InterfaceIDs.PumpType.ANIMAS_PING + DANA_R -> InterfaceIDs.PumpType.DANA_R + DANA_R_KOREAN -> InterfaceIDs.PumpType.DANA_R_KOREAN + DANA_RS -> InterfaceIDs.PumpType.DANA_RS + DANA_RS_KOREAN -> InterfaceIDs.PumpType.DANA_RS_KOREAN + DANA_RV2 -> InterfaceIDs.PumpType.DANA_RV2 + DANA_I -> InterfaceIDs.PumpType.DANA_I + OMNIPOD_EROS -> InterfaceIDs.PumpType.OMNIPOD_EROS + OMNIPOD_DASH -> InterfaceIDs.PumpType.OMNIPOD_DASH + MEDTRONIC_512_712 -> InterfaceIDs.PumpType.MEDTRONIC_512_517 + MEDTRONIC_515_715 -> InterfaceIDs.PumpType.MEDTRONIC_515_715 + MEDTRONIC_522_722 -> InterfaceIDs.PumpType.MEDTRONIC_522_722 + MEDTRONIC_523_723_REVEL -> InterfaceIDs.PumpType.MEDTRONIC_523_723_REVEL + MEDTRONIC_554_754_VEO -> InterfaceIDs.PumpType.MEDTRONIC_554_754_VEO + MEDTRONIC_640G -> InterfaceIDs.PumpType.MEDTRONIC_640G + TANDEM_T_SLIM -> InterfaceIDs.PumpType.TANDEM_T_SLIM + TANDEM_T_SLIM_G4 -> InterfaceIDs.PumpType.TANDEM_T_SLIM_G4 + TANDEM_T_FLEX -> InterfaceIDs.PumpType.TANDEM_T_FLEX + TANDEM_T_SLIM_X2 -> InterfaceIDs.PumpType.TANDEM_T_SLIM_X2 + YPSOPUMP -> InterfaceIDs.PumpType.YPSOPUMP + MDI -> InterfaceIDs.PumpType.MDI + USER -> InterfaceIDs.PumpType.USER + DIACONN_G8 -> InterfaceIDs.PumpType.DIACONN_G8 + CACHE -> InterfaceIDs.PumpType.CACHE } } diff --git a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt index ad6be79def..2ce6796e66 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/AppRepository.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.database import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.database.data.NewEntries +import info.nightscout.androidaps.database.embedments.InterfaceIDs import info.nightscout.androidaps.database.entities.* import info.nightscout.androidaps.database.interfaces.DBEntry import info.nightscout.androidaps.database.transactions.Transaction @@ -59,6 +60,10 @@ import kotlin.math.roundToInt fun clearDatabases() = database.clearAllTables() + fun clearCachedData(from: Long) { + database.totalDailyDoseDao.deleteNewerThan(from, InterfaceIDs.PumpType.CACHE) + } + //BG READINGS -- only valid records fun compatGetBgReadingsDataFromTime(timestamp: Long, ascending: Boolean): Single> = database.glucoseValueDao.compatGetBgReadingsDataFromTime(timestamp) @@ -775,22 +780,26 @@ import kotlin.math.roundToInt fun getOldestExtendedBolusRecord(): ExtendedBolus? = database.extendedBolusDao.getOldestRecord() - // TotalDailyDose - fun getAllTotalDailyDoses(ascending: Boolean): Single> = - database.totalDailyDoseDao.getAllTotalDailyDoses() - .map { if (!ascending) it.reversed() else it } + fun getLastExtendedBolusIdWrapped(): Single> = + database.extendedBolusDao.getLastId() .subscribeOn(Schedulers.io()) + .toWrappedSingle() + // TotalDailyDose fun getLastTotalDailyDoses(count: Int, ascending: Boolean): Single> = database.totalDailyDoseDao.getLastTotalDailyDoses(count) .map { if (!ascending) it.reversed() else it } .subscribeOn(Schedulers.io()) - fun getLastExtendedBolusIdWrapped(): Single> = - database.extendedBolusDao.getLastId() + fun getCalculatedTotalDailyDose(timestamp: Long): Single> = + database.totalDailyDoseDao.findByTimestamp(timestamp, InterfaceIDs.PumpType.CACHE) .subscribeOn(Schedulers.io()) .toWrappedSingle() + fun createTotalDailyDose(tdd: TotalDailyDose) { + database.totalDailyDoseDao.insert(tdd) + } + // OFFLINE EVENT /* * returns a Pair of the next entity to sync and the ID of the "update". diff --git a/database/src/main/java/info/nightscout/androidaps/database/daos/TotalDailyDoseDao.kt b/database/src/main/java/info/nightscout/androidaps/database/daos/TotalDailyDoseDao.kt index d14d8b9bc0..5cb71c265a 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/daos/TotalDailyDoseDao.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/daos/TotalDailyDoseDao.kt @@ -2,11 +2,10 @@ package info.nightscout.androidaps.database.daos import androidx.room.Dao import androidx.room.Query -import info.nightscout.androidaps.database.TABLE_TEMPORARY_TARGETS import info.nightscout.androidaps.database.TABLE_TOTAL_DAILY_DOSES import info.nightscout.androidaps.database.embedments.InterfaceIDs -import info.nightscout.androidaps.database.entities.TemporaryTarget import info.nightscout.androidaps.database.entities.TotalDailyDose +import io.reactivex.rxjava3.core.Maybe import io.reactivex.rxjava3.core.Single @Suppress("FunctionName") @@ -25,13 +24,16 @@ internal interface TotalDailyDoseDao : TraceableDao { @Query("SELECT * FROM $TABLE_TOTAL_DAILY_DOSES WHERE timestamp = :timestamp AND pumpType = :pumpType AND pumpSerial = :pumpSerial AND referenceId IS NULL") fun findByPumpTimestamp(timestamp: Long, pumpType: InterfaceIDs.PumpType, pumpSerial: String): TotalDailyDose? - @Query("SELECT * FROM $TABLE_TOTAL_DAILY_DOSES WHERE isValid = 1 AND referenceId IS NULL ORDER BY timestamp ASC") - fun getAllTotalDailyDoses(): Single> + @Query("SELECT * FROM $TABLE_TOTAL_DAILY_DOSES WHERE timestamp = :timestamp AND pumpType = :pumpType AND referenceId IS NULL") + fun findByTimestamp(timestamp: Long, pumpType: InterfaceIDs.PumpType): Maybe - @Query("SELECT * FROM $TABLE_TOTAL_DAILY_DOSES WHERE isValid = 1 AND referenceId IS NULL ORDER BY timestamp DESC LIMIT :count") - fun getLastTotalDailyDoses(count: Int): Single> + @Query("SELECT * FROM $TABLE_TOTAL_DAILY_DOSES WHERE isValid = 1 AND referenceId IS NULL AND pumpType <> :exclude ORDER BY timestamp DESC LIMIT :count") + fun getLastTotalDailyDoses(count: Int, exclude: InterfaceIDs.PumpType = InterfaceIDs.PumpType.CACHE): Single> @Query("SELECT * FROM $TABLE_TOTAL_DAILY_DOSES WHERE dateCreated > :since AND dateCreated <= :until LIMIT :limit OFFSET :offset") suspend fun getNewEntriesSince(since: Long, until: Long, limit: Int, offset: Int): List + @Query("DELETE FROM $TABLE_TOTAL_DAILY_DOSES WHERE dateCreated >= :since AND pumpType = :pumpType") + fun deleteNewerThan(since: Long, pumpType: InterfaceIDs.PumpType) + } \ No newline at end of file diff --git a/database/src/main/java/info/nightscout/androidaps/database/embedments/InterfaceIDs.kt b/database/src/main/java/info/nightscout/androidaps/database/embedments/InterfaceIDs.kt index 0477dc1c8d..7306c89d1f 100644 --- a/database/src/main/java/info/nightscout/androidaps/database/embedments/InterfaceIDs.kt +++ b/database/src/main/java/info/nightscout/androidaps/database/embedments/InterfaceIDs.kt @@ -42,7 +42,8 @@ data class InterfaceIDs( YPSOPUMP, MDI, DIACONN_G8, - USER; + USER, + CACHE; companion object { From 2f928ad5489120271288660b0fb3998882e968a0 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 9 Jun 2022 15:51:57 +0200 Subject: [PATCH 26/42] Interface cleanup --- .../main/java/info/nightscout/androidaps/MainActivity.kt | 2 +- app/src/main/java/info/nightscout/androidaps/MainApp.kt | 2 +- .../androidaps/activities/HistoryBrowseActivity.kt | 2 +- .../androidaps/activities/TreatmentsActivity.kt | 2 +- .../activities/fragments/TreatmentsBolusCarbsFragment.kt | 2 +- .../activities/fragments/TreatmentsCareportalFragment.kt | 2 +- .../fragments/TreatmentsProfileSwitchFragment.kt | 2 +- .../activities/fragments/TreatmentsTempTargetFragment.kt | 2 +- .../main/java/info/nightscout/androidaps/di/AppModule.kt | 2 +- .../openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt | 2 +- .../plugins/configBuilder/ConfigBuilderFragment.kt | 2 +- .../androidaps/plugins/constraints/safety/SafetyPlugin.kt | 2 +- .../androidaps/plugins/general/actions/ActionsFragment.kt | 2 +- .../androidaps/plugins/general/autotune/AutotunePlugin.kt | 4 ++-- .../plugins/general/maintenance/ImportExportPrefsImpl.kt | 2 +- .../plugins/general/maintenance/MaintenancePlugin.kt | 2 +- .../plugins/general/nsclient/NSClientAddUpdateWorker.kt | 2 +- .../plugins/general/nsclient/NSClientMbgWorker.kt | 2 +- .../androidaps/plugins/general/nsclient/NSClientPlugin.kt | 2 +- .../plugins/general/nsclient/services/NSClientService.kt | 2 +- .../plugins/general/overview/OverviewFragment.kt | 2 +- .../androidaps/plugins/general/overview/OverviewMenus.kt | 2 +- .../plugins/iob/iobCobCalculator/IobCobOref1Worker.kt | 2 +- .../plugins/iob/iobCobCalculator/IobCobOrefWorker.kt | 2 +- .../nightscout/androidaps/plugins/source/AidexPlugin.kt | 2 +- .../androidaps/queue/CommandQueueImplementation.kt | 2 +- .../info/nightscout/androidaps/utils/LocalAlertUtils.kt | 8 ++++---- .../androidaps/utils/buildHelper/BuildHelperImpl.kt | 1 + .../androidaps/interfaces/ConstraintsCheckerTest.kt | 1 - .../plugins/constraints/safety/SafetyPluginTest.kt | 2 +- .../plugins/general/maintenance/MaintenancePluginTest.kt | 2 +- .../androidaps/queue/CommandQueueImplementationTest.kt | 2 +- .../{utils/buildHelper => interfaces}/BuildHelper.kt | 2 +- .../info/nightscout/androidaps/interfaces/CommandQueue.kt | 3 +-- .../nightscout/androidaps/interfaces/ImportExportPrefs.kt | 2 -- .../java/info/nightscout/androidaps/interfaces/Profile.kt | 2 +- .../pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt | 2 +- 37 files changed, 39 insertions(+), 42 deletions(-) rename core/src/main/java/info/nightscout/androidaps/{utils/buildHelper => interfaces}/BuildHelper.kt (71%) diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index e3c7fb1c11..241da0bed9 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -48,7 +48,7 @@ import info.nightscout.androidaps.setupwizard.SetupWizardActivity import info.nightscout.androidaps.utils.AndroidPermission import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.extensions.isRunningRealPumpTest import info.nightscout.androidaps.utils.locale.LocaleHelper import info.nightscout.androidaps.utils.protection.PasswordCheck diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/java/info/nightscout/androidaps/MainApp.kt index f3c9b69fa5..bc201bf3c8 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.kt @@ -43,7 +43,7 @@ import info.nightscout.androidaps.utils.ActivityMonitor import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.LocalAlertUtils import info.nightscout.androidaps.utils.ProcessLifecycleListener -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.locale.LocaleHelper import info.nightscout.androidaps.widget.updateWidget import info.nightscout.shared.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt index b4f2a655fd..20bed45c84 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt @@ -37,7 +37,7 @@ import info.nightscout.androidaps.utils.DefaultValueHelper import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.Translator -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.workflow.CalculationWorkflow import info.nightscout.shared.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt index 3b88ff8770..d8c71fa70f 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/TreatmentsActivity.kt @@ -11,7 +11,7 @@ import info.nightscout.androidaps.activities.fragments.* import info.nightscout.androidaps.databinding.TreatmentsFragmentBinding import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import javax.inject.Inject class TreatmentsActivity : NoSplashAppCompatActivity() { diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt index 1f7b9686e6..02e4e864f0 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt @@ -40,7 +40,7 @@ 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.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt index a1de658977..d34301a3e6 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt @@ -25,7 +25,7 @@ import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart import info.nightscout.androidaps.utils.* import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +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 diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt index 08e91af77a..4eda0aa1e5 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt @@ -36,7 +36,7 @@ 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.utils.buildHelper.BuildHelper +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 diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt index 09e138bcee..4876e22dc2 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt @@ -35,7 +35,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientR 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.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt index 5cb0e30721..545c497c69 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/AppModule.kt @@ -28,7 +28,7 @@ import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.androidNotification.NotificationHolderImpl -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl import info.nightscout.androidaps.utils.buildHelper.ConfigImpl import info.nightscout.androidaps.utils.resources.IconsProviderImplementation diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt index 3c7878676c..f3978aacf1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt @@ -17,7 +17,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProv import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Profiler -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt index a8aab6ee56..34d058ac5c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ConfigBuilderFragment.kt @@ -23,7 +23,7 @@ import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.PREFERENCES import info.nightscout.androidaps.interfaces.ResourceHelper diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt index 651e5b18a6..4f4a835e9f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.kt @@ -19,7 +19,7 @@ import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Round -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.json.JSONObject diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index 5e2342770c..92002eab4d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -39,7 +39,7 @@ import info.nightscout.androidaps.skins.SkinProvider import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt index b0ec81d2d5..c652c832e0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt @@ -20,7 +20,7 @@ import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.JsonHelper import info.nightscout.androidaps.utils.MidnightTime import info.nightscout.androidaps.utils.T -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP import org.json.JSONException @@ -50,7 +50,7 @@ class AutotunePlugin @Inject constructor( private val autotuneIob: AutotuneIob, private val autotunePrep: AutotunePrep, private val autotuneCore: AutotuneCore, - private val buildHelper:BuildHelper, + private val buildHelper: BuildHelper, private val uel: UserEntryLogger, aapsLogger: AAPSLogger ) : PluginBase(PluginDescription() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt index 5a108666ba..6e6e0ab684 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt @@ -39,7 +39,7 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.PrefImportSummaryDialog import info.nightscout.androidaps.utils.alertDialogs.TwoMessagesAlertDialog import info.nightscout.androidaps.utils.alertDialogs.WarningDialog -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.protection.PasswordCheck import info.nightscout.androidaps.utils.storage.Storage import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt index 90f051f2a1..0c466e7027 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.shared.logging.AAPSLogger import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import java.io.* diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt index 7c01449ba6..5707cd439c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientAddUpdateWorker.kt @@ -27,7 +27,7 @@ import info.nightscout.androidaps.receivers.DataWorker import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.JsonHelper import info.nightscout.androidaps.utils.JsonHelper.safeGetLong -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.shared.sharedPreferences.SP import java.util.concurrent.TimeUnit import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt index a4c6386c17..a64d04ab0d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientMbgWorker.kt @@ -14,7 +14,7 @@ import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import info.nightscout.androidaps.plugins.general.nsclient.data.NSMbg import info.nightscout.androidaps.receivers.DataWorker -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.shared.sharedPreferences.SP import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.kt index 10c6be7ad3..2a8954c583 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.kt @@ -33,7 +33,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientServ import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.HtmlHelper.fromHtml import info.nightscout.androidaps.utils.ToastUtils -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt index f8e3257213..cd08db55fe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/services/NSClientService.kt @@ -48,7 +48,7 @@ import info.nightscout.androidaps.utils.JsonHelper.safeGetString import info.nightscout.androidaps.utils.JsonHelper.safeGetStringAllowNull import info.nightscout.androidaps.utils.T.Companion.mins import info.nightscout.androidaps.utils.XDripBroadcast -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index e0fbf0c088..4374fd0c05 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -66,7 +66,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.ToastUtils import info.nightscout.androidaps.utils.TrendCalculator import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.ui.SingleClickButton diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt index 42db526cd4..e388adb8bf 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt @@ -19,7 +19,7 @@ import info.nightscout.androidaps.interfaces.Loop import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.sharedPreferences.SP import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt index 854e08aebc..4d157a874a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt @@ -30,7 +30,7 @@ import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.Profiler import info.nightscout.androidaps.utils.T -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.workflow.CalculationWorkflow import info.nightscout.shared.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt index a093a3c2b9..347d4bb573 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOrefWorker.kt @@ -28,7 +28,7 @@ import info.nightscout.androidaps.utils.DecimalFormatter import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.Profiler import info.nightscout.androidaps.utils.T -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.workflow.CalculationWorkflow import info.nightscout.shared.logging.AAPSLogger diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt index 787205abb2..3e0a9d2d8c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/AidexPlugin.kt @@ -13,7 +13,7 @@ import info.nightscout.androidaps.database.transactions.CgmSourceTransaction import info.nightscout.androidaps.interfaces.* import info.nightscout.androidaps.receivers.DataWorker import info.nightscout.androidaps.receivers.Intents -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.shared.logging.AAPSLogger import info.nightscout.shared.logging.LTag import javax.inject.Inject diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt index caf4bc9f49..918643c8ce 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt @@ -35,7 +35,7 @@ import info.nightscout.androidaps.utils.AndroidPermission import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.HtmlHelper -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +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 diff --git a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt index cf96415ef2..512f1b2d53 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/LocalAlertUtils.kt @@ -12,15 +12,15 @@ import info.nightscout.androidaps.database.transactions.InsertTherapyEventAnnoun import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.interfaces.ProfileFunction -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.shared.logging.LTag +import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.logging.UserEntryLogger import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin -import info.nightscout.androidaps.interfaces.ResourceHelper +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 @@ -128,7 +128,7 @@ class LocalAlertUtils @Inject constructor( rxBus.send(EventNewNotification(n)) uel.log(Action.CAREPORTAL, Sources.Aaps, rh.gs(R.string.missed_bg_readings), ValueWithUnit.TherapyEventType(TherapyEvent.Type.ANNOUNCEMENT)) if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) { - n.text?.let { disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(it)).subscribe() } + disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(n.text)).subscribe() } } else if (dateUtil.isOlderThan(bgReading.timestamp, 5).not()) { rxBus.send(EventDismissNotification(Notification.BG_READINGS_MISSED)) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt b/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt index 77e725e998..5408591634 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelperImpl.kt @@ -1,6 +1,7 @@ package info.nightscout.androidaps.utils.buildHelper import info.nightscout.androidaps.BuildConfig +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider import java.io.File diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt index cd46c1048d..ee67c07b13 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.kt @@ -31,7 +31,6 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.source.GlimpPlugin import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Profiler -import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt index 5575c973f7..da0e9b7187 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPluginTest.kt @@ -17,7 +17,7 @@ import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin import info.nightscout.androidaps.plugins.source.GlimpPlugin import info.nightscout.androidaps.utils.HardLimits -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert import org.junit.Before diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt index 02ae75b90c..a055f7c519 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePluginTest.kt @@ -5,7 +5,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.TestBase import info.nightscout.androidaps.interfaces.Config import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.shared.sharedPreferences.SP import org.junit.Assert diff --git a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt index be0eb00790..907f739127 100644 --- a/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/queue/CommandQueueImplementationTest.kt @@ -25,7 +25,7 @@ import info.nightscout.androidaps.queue.commands.* import info.nightscout.androidaps.utils.AndroidPermission import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.buildHelper.BuildHelperImpl import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.utils.rx.AapsSchedulers diff --git a/core/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/BuildHelper.kt similarity index 71% rename from core/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt rename to core/src/main/java/info/nightscout/androidaps/interfaces/BuildHelper.kt index ca6a251f65..5f47316282 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/BuildHelper.kt @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.utils.buildHelper +package info.nightscout.androidaps.interfaces interface BuildHelper { diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt index 7218b06df2..5ba0055402 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/CommandQueue.kt @@ -2,10 +2,9 @@ package info.nightscout.androidaps.interfaces import android.text.Spanned import info.nightscout.androidaps.data.DetailedBolusInfo -import info.nightscout.androidaps.interfaces.Profile -import info.nightscout.androidaps.queue.commands.CustomCommand import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.commands.Command +import info.nightscout.androidaps.queue.commands.CustomCommand interface CommandQueue { diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/ImportExportPrefs.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/ImportExportPrefs.kt index 15ee7030b4..efed509a3a 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/ImportExportPrefs.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/ImportExportPrefs.kt @@ -2,9 +2,7 @@ package info.nightscout.androidaps.interfaces import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity -import info.nightscout.androidaps.database.entities.UserEntry import info.nightscout.androidaps.plugins.general.maintenance.PrefsFile -import io.reactivex.rxjava3.core.Single interface ImportExportPrefs { diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt index c62af2c988..7061c01540 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/Profile.kt @@ -8,7 +8,6 @@ import info.nightscout.androidaps.utils.DecimalFormatter.to0Decimal import info.nightscout.androidaps.utils.DecimalFormatter.to1Decimal import info.nightscout.androidaps.utils.HardLimits import info.nightscout.androidaps.utils.Round -import info.nightscout.androidaps.interfaces.ResourceHelper import org.joda.time.DateTime import org.json.JSONObject @@ -62,6 +61,7 @@ interface Profile { * ISF value according to "now"" in MGDL */ fun getIsfMgdl(): Double + /** * ISF value according to timestamp in MGDL */ diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 3b8f32c426..49e03984fe 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -39,7 +39,7 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.alertDialogs.OKDialog -import info.nightscout.androidaps.utils.buildHelper.BuildHelper +import info.nightscout.androidaps.interfaces.BuildHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.ui.UIRunnable From 17bbcf0e3e349a65927558d94ca4ebb187c680f3 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 9 Jun 2022 19:56:15 +0200 Subject: [PATCH 27/42] fix basal rendering --- .../plugins/general/overview/OverviewData.kt | 1 - .../plugins/general/overview/graphData/GraphData.kt | 10 +++++++--- .../androidaps/workflow/PrepareBasalDataWorker.kt | 2 -- .../plugins/general/overview/graphExtensions/Scale.kt | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt index 825cba3df1..d114f19847 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewData.kt @@ -251,7 +251,6 @@ class OverviewData @Inject constructor( var bgReadingGraphSeries: PointsWithLabelGraphSeries = PointsWithLabelGraphSeries() var predictionsGraphSeries: PointsWithLabelGraphSeries = PointsWithLabelGraphSeries() - var maxBasalValueFound = 0.0 val basalScale = Scale() var baseBasalGraphSeries: LineGraphSeries = LineGraphSeries() var tempBasalGraphSeries: LineGraphSeries = LineGraphSeries() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt index 0626b97912..308e67bb5a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt @@ -73,13 +73,17 @@ class GraphData( } fun addBasals() { - maxY = max(maxY, defaultValueHelper.determineHighLine()) - val scale = defaultValueHelper.determineLowLine() / maxY / 1.2 + overviewData.basalScale.multiplier = 1.0 // get unscaled Y-values for max calculation + var maxBasalValue = maxOf(0.1, overviewData.baseBasalGraphSeries.highestValueY, overviewData.tempBasalGraphSeries.highestValueY) + maxBasalValue = maxOf(maxBasalValue, overviewData.basalLineGraphSeries.highestValueY, overviewData.absoluteBasalGraphSeries.highestValueY) addSeries(overviewData.baseBasalGraphSeries) addSeries(overviewData.tempBasalGraphSeries) addSeries(overviewData.basalLineGraphSeries) addSeries(overviewData.absoluteBasalGraphSeries) - overviewData.basalScale.multiplier = maxY * scale / overviewData.maxBasalValueFound + maxY = max(maxY, defaultValueHelper.determineHighLine()) + val scale = defaultValueHelper.determineLowLine() / maxY / 1.2 + overviewData.basalScale.multiplier = maxY * scale / maxBasalValue + aapsLogger.debug("XXXXXX maxY:$maxY maxBasalValueFound:${maxBasalValue} multiplier:${overviewData.basalScale.multiplier}") } fun addTargetLine() { diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBasalDataWorker.kt b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBasalDataWorker.kt index b2bff7a245..45f8bd4e0c 100644 --- a/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBasalDataWorker.kt +++ b/app/src/main/java/info/nightscout/androidaps/workflow/PrepareBasalDataWorker.kt @@ -47,7 +47,6 @@ class PrepareBasalDataWorker( ?: return Result.failure(workDataOf("Error" to "missing input data")) rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_BASAL_DATA, 0, null)) - data.overviewData.maxBasalValueFound = 0.0 val baseBasalArray: MutableList = ArrayList() val tempBasalArray: MutableList = ArrayList() val basalLineArray: MutableList = ArrayList() @@ -104,7 +103,6 @@ class PrepareBasalDataWorker( lastAbsoluteLineBasal = absoluteLineValue lastLineBasal = baseBasalValue lastTempBasal = tempBasalValue - data.overviewData.maxBasalValueFound = max(data.overviewData.maxBasalValueFound, max(tempBasalValue, baseBasalValue)) time += 60 * 1000L } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt index 0c11b7e285..748f327eaf 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.general.overview.graphExtensions -class Scale(var shift: Double = 0.0, var multiplier: Double = 0.0) { +class Scale(var shift: Double = 0.0, var multiplier: Double = 1.0) { fun transform(original: Double): Double { return original * multiplier + shift From 690b85151127220996b6a95365507418f6ea890a Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 9 Jun 2022 20:08:42 +0200 Subject: [PATCH 28/42] remove debug --- .../androidaps/plugins/general/overview/graphData/GraphData.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt index 308e67bb5a..7b34ba26c3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt @@ -83,7 +83,6 @@ class GraphData( maxY = max(maxY, defaultValueHelper.determineHighLine()) val scale = defaultValueHelper.determineLowLine() / maxY / 1.2 overviewData.basalScale.multiplier = maxY * scale / maxBasalValue - aapsLogger.debug("XXXXXX maxY:$maxY maxBasalValueFound:${maxBasalValue} multiplier:${overviewData.basalScale.multiplier}") } fun addTargetLine() { From 9508730c3533369b73f4ddde47cb44f9f2a3d233 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sat, 11 Jun 2022 19:34:00 +0200 Subject: [PATCH 29/42] Fix missingDays after loadLastRun --- .../plugins/general/autotune/AutotunePlugin.kt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt index c652c832e0..5f926c28c5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt @@ -310,11 +310,16 @@ class AutotunePlugin @Inject constructor( json.put("pumpProfileName", pumpProfile.profilename) json.put("pumpPeak", pumpProfile.peak) json.put("pumpDia", pumpProfile.dia) - json.put("tunedProfile", tunedProfile?.profile?.toPureNsJson(dateUtil)) - json.put("tunedCircadianProfile", tunedProfile?.circadianProfile?.toPureNsJson(dateUtil)) - json.put("tunedProfileName", tunedProfile?.profilename) - json.put("tunedPeak", tunedProfile?.peak) - json.put("tunedDia", tunedProfile?.dia) + tunedProfile?.let { atProfile -> + json.put("tunedProfile", atProfile.profile.toPureNsJson(dateUtil)) + json.put("tunedCircadianProfile", atProfile.circadianProfile.toPureNsJson(dateUtil)) + json.put("tunedProfileName", atProfile.profilename) + json.put("tunedPeak", atProfile.peak) + json.put("tunedDia", atProfile.dia) + for (i in 0..23) { + json.put("missingDays_$i", atProfile.basalUntuned[i]) + } + } json.put("result", result) json.put("updateButtonVisibility", updateButtonVisibility) sp.putString(R.string.key_autotune_last_run, json.toString()) @@ -345,6 +350,9 @@ class AutotunePlugin @Inject constructor( tunedProfile = ATProfile(ProfileSealed.Pure(tuned), localInsulin, injector).also { atProfile -> atProfile.profilename = tunedProfileName atProfile.circadianProfile = ProfileSealed.Pure(circadianTuned) + for (i in 0..23) { + atProfile.basalUntuned[i] = JsonHelper.safeGetInt(json,"missingDays_$i") + } } result = JsonHelper.safeGetString(json, "result", "") updateButtonVisibility = JsonHelper.safeGetInt(json, "updateButtonVisibility") From 534a8e55f2b205380e635cce2524d28f18d8bc88 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sat, 11 Jun 2022 19:41:06 +0200 Subject: [PATCH 30/42] Shorter warnings for circadian IC/ISF --- core/src/main/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 28411ab493..30974f7512 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -569,8 +569,8 @@ Last run : Warning : Select profile to tune - Autotune works with only one IC value, your profile has %1$d values. Average value is %2$.2fg/U - Autotune works with only one ISF value, your profile has %1$d values. Average value is %2$.1f%3$s/U + Selected profile has %1$d IC values. Autotune will use %2$.2f g/U + Selected profile has %1$d ISF values. Autotune will use %2$.1f %3$s/U Error in input data, try to run again autotune or reduce the number of days Autotune calculation started, please be patient Check the results carefully before using it! From 4e9202651fdf8fe3342d9daebf211fa709beceb2 Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Sat, 11 Jun 2022 23:04:32 +0100 Subject: [PATCH 31/42] - small fix for bolus date, that might fix the problem --- .../androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt index a4e660fe4c..bf01175866 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt @@ -640,6 +640,8 @@ class MedtronicPumpPlugin @Inject constructor( } val now = System.currentTimeMillis() + detailedBolusInfo.timestamp = now + pumpSyncStorage.addBolusWithTempId(detailedBolusInfo, true, this) // we subtract insulin, exact amount will be visible with next remainingInsulin update. From 5fec1ccc552188d1990815b189bd578e13c275f1 Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Sun, 12 Jun 2022 14:24:25 +0100 Subject: [PATCH 32/42] - changed version number --- medtronic/Changelog.txt | 3 ++- .../androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/medtronic/Changelog.txt b/medtronic/Changelog.txt index fc0b934b1c..ddea9b2ba0 100644 --- a/medtronic/Changelog.txt +++ b/medtronic/Changelog.txt @@ -8,4 +8,5 @@ V2 - Rewrite into kotlin, new database (for v3.0) 0002 - some fixes 0003 - SMB fix (798) 0004 - Zero TBR Duration fix (798), refactoring of TempBasalProcessDTO -0005 - fixes to MedtronicHistoryEntry lateinit problem \ No newline at end of file +0005 - fixes to MedtronicHistoryEntry lateinit problem +0006 - when bolus is placed, we adjust detailedBolusInfo with current timestamp \ No newline at end of file diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt index bf01175866..9752d1ef42 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.kt @@ -116,7 +116,7 @@ class MedtronicPumpPlugin @Inject constructor( private var isBusy = false override fun onStart() { - aapsLogger.debug(LTag.PUMP, deviceID() + " started. (V2.0005)") + aapsLogger.debug(LTag.PUMP, deviceID() + " started. (V2.0006)") serviceConnection = object : ServiceConnection { override fun onServiceDisconnected(name: ComponentName) { aapsLogger.debug(LTag.PUMP, "RileyLinkMedtronicService is disconnected") From 9eebf60610bb8c5a380869e19110d3edcf98053b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 12:15:27 +0200 Subject: [PATCH 33/42] libs update --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 1be193e49d..f7aeaacda4 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { gson_version = '2.9.0' nav_version = '2.4.2' appcompat_version = '1.4.2' - material_version = '1.6.0' + material_version = '1.6.1' constraintlayout_version = '2.1.4' preferencektx_version = '1.2.0' commonslang3_version = '3.12.0' @@ -40,7 +40,7 @@ buildscript { wearable_version = '2.9.0' play_services_wearable_version = '17.1.0' - play_services_location_version = '19.0.1' + play_services_location_version = '20.0.0' } repositories { google() From f887043aff9abccf3106112af667669e21e374b2 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 12:18:30 +0200 Subject: [PATCH 34/42] DanaR: disconnect on occlusion --- .../main/java/info/nightscout/androidaps/danar/comm/MsgError.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt index b2c5c0924b..fbbc7600f8 100644 --- a/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt +++ b/danar/src/main/java/info/nightscout/androidaps/danar/comm/MsgError.kt @@ -29,6 +29,8 @@ class MsgError( danaPump.bolusStopped = true bolusingEvent.status = errorString rxBus.send(bolusingEvent) + // at least on Occlusion pump stops communication. Try to force reconnecting + activePlugin.activePump.disconnect("Error from pump received") failed = true } else { failed = false From 0ff69f869668581d1d712ac02470cc92139c2d50 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 12:23:57 +0200 Subject: [PATCH 35/42] New Crowdin updates (#1822) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (Russian) * New translations strings.xml (French) * Update source file strings.xml * New translations strings.xml (Hebrew) * New translations strings.xml (Slovak) * New translations strings.xml (Russian) * New translations strings.xml (Spanish) * New translations strings.xml (French) * New translations strings.xml (Turkish) * New translations strings.xml (Norwegian) * New translations strings.xml (Danish) * New translations strings.xml (Czech) * New translations strings.xml (Norwegian) * New translations strings.xml (Turkish) * New translations strings.xml (Czech) * New translations strings.xml (Hebrew) * New translations strings.xml (Dutch) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Irish) * New translations strings.xml (Hebrew) * New translations strings.xml (Hungarian) * New translations strings.xml (Italian) * New translations strings.xml (Korean) * New translations strings.xml (Lithuanian) * New translations strings.xml (Norwegian) * New translations strings.xml (Czech) * New translations strings.xml (Polish) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Slovak) * New translations strings.xml (Swedish) * New translations strings.xml (Turkish) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Danish) * New translations strings.xml (Catalan) * New translations strings.xml (Bulgarian) * New translations strings.xml (Romanian) * New translations strings.xml (French) * New translations strings.xml (Spanish) * New translations strings.xml (Afrikaans) * New translations strings.xml (Croatian) * New translations strings.xml (Romanian) * New translations strings.xml (Korean) * New translations strings.xml (German) * New translations strings.xml (Irish) * New translations strings.xml (Afrikaans) * New translations strings.xml (Lithuanian) * New translations strings.xml (Bulgarian) * New translations strings.xml (Polish) * New translations strings.xml (Portuguese) * New translations strings.xml (Swedish) * New translations strings.xml (Catalan) * New translations strings.xml (Romanian) * New translations strings.xml (French) * New translations strings.xml (Portuguese) * New translations strings.xml (Swedish) * New translations strings.xml (Polish) * New translations strings.xml (German) * New translations strings.xml (Afrikaans) * New translations strings.xml (Bulgarian) * New translations strings.xml (Catalan) * New translations strings.xml (Lithuanian) * New translations strings.xml (Greek) * New translations strings.xml (Irish) * New translations strings.xml (Hungarian) * New translations strings.xml (Korean) * New translations strings.xml (Croatian) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (German) * New translations strings.xml (Romanian) * New translations strings.xml (Afrikaans) * New translations strings.xml (Bulgarian) * New translations strings.xml (Catalan) * New translations strings.xml (Danish) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Romanian) * New translations strings.xml (Irish) * New translations strings.xml (Hungarian) * New translations strings.xml (Czech) * New translations strings.xml (Danish) * New translations strings.xml (German) * New translations strings.xml (Greek) * New translations strings.xml (Irish) * New translations strings.xml (Italian) * New translations strings.xml (Bulgarian) * New translations strings.xml (Korean) * New translations strings.xml (Lithuanian) * New translations strings.xml (Norwegian) * New translations strings.xml (Polish) * New translations strings.xml (Portuguese) * New translations strings.xml (Russian) * New translations strings.xml (Slovak) * New translations strings.xml (Catalan) * New translations strings.xml (Afrikaans) * New translations strings.xml (Portuguese) * New translations strings.xml (Korean) * New translations strings.xml (Lithuanian) * New translations strings.xml (Spanish) * New translations strings.xml (Polish) * New translations strings.xml (French) * New translations strings.xml (Swedish) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Swedish) * New translations strings.xml (Turkish) * New translations strings.xml (Chinese Simplified) * New translations strings.xml (Portuguese, Brazilian) --- app/src/main/res/values-af-rZA/strings.xml | 1 + app/src/main/res/values-bg-rBG/strings.xml | 1 + app/src/main/res/values-ca-rES/strings.xml | 2 + app/src/main/res/values-de-rDE/strings.xml | 3 ++ app/src/main/res/values-ga-rIE/strings.xml | 1 + app/src/main/res/values-ko-rKR/strings.xml | 2 + app/src/main/res/values-lt-rLT/strings.xml | 2 + app/src/main/res/values-pl-rPL/strings.xml | 6 +++ app/src/main/res/values-pt-rPT/strings.xml | 2 + app/src/main/res/values-ro-rRO/strings.xml | 4 ++ app/src/main/res/values-sv-rSE/strings.xml | 2 + .../src/main/res/values-de-rDE/strings.xml | 1 + .../src/main/res/values-ru-rRU/strings.xml | 3 ++ core/src/main/res/values-af-rZA/strings.xml | 3 ++ core/src/main/res/values-bg-rBG/strings.xml | 3 ++ core/src/main/res/values-ca-rES/strings.xml | 3 ++ core/src/main/res/values-cs-rCZ/strings.xml | 4 +- core/src/main/res/values-da-rDK/strings.xml | 2 - core/src/main/res/values-de-rDE/strings.xml | 4 ++ core/src/main/res/values-el-rGR/strings.xml | 3 ++ core/src/main/res/values-es-rES/strings.xml | 2 - core/src/main/res/values-fr-rFR/strings.xml | 4 +- core/src/main/res/values-ga-rIE/strings.xml | 2 + core/src/main/res/values-hr-rHR/strings.xml | 2 + core/src/main/res/values-hu-rHU/strings.xml | 1 + core/src/main/res/values-iw-rIL/strings.xml | 4 +- core/src/main/res/values-ko-rKR/strings.xml | 3 ++ core/src/main/res/values-lt-rLT/strings.xml | 3 ++ core/src/main/res/values-no-rNO/strings.xml | 4 +- core/src/main/res/values-pl-rPL/strings.xml | 5 +++ core/src/main/res/values-pt-rPT/strings.xml | 3 ++ core/src/main/res/values-ro-rRO/strings.xml | 4 ++ core/src/main/res/values-ru-rRU/strings.xml | 27 +++++++++++++ core/src/main/res/values-sk-rSK/strings.xml | 2 - core/src/main/res/values-sv-rSE/strings.xml | 3 ++ core/src/main/res/values-tr-rTR/strings.xml | 4 +- core/src/main/res/values-zh-rCN/strings.xml | 1 + .../src/main/res/values-ru-rRU/strings.xml | 2 + .../src/main/res/values-ru-rRU/strings.xml | 2 + .../src/main/res/values-af-rZA/strings.xml | 5 ++- .../src/main/res/values-bg-rBG/strings.xml | 3 ++ .../src/main/res/values-ca-rES/strings.xml | 3 ++ .../src/main/res/values-da-rDK/strings.xml | 2 + .../src/main/res/values-de-rDE/strings.xml | 3 ++ .../src/main/res/values-el-rGR/strings.xml | 5 ++- .../src/main/res/values-ga-rIE/strings.xml | 5 ++- .../src/main/res/values-ko-rKR/strings.xml | 3 ++ .../src/main/res/values-lt-rLT/strings.xml | 3 ++ .../src/main/res/values-pl-rPL/strings.xml | 3 ++ .../src/main/res/values-pt-rBR/strings.xml | 5 ++- .../src/main/res/values-pt-rPT/strings.xml | 3 ++ .../src/main/res/values-ro-rRO/strings.xml | 3 ++ .../src/main/res/values-ru-rRU/strings.xml | 38 +++++++++++++++++++ .../src/main/res/values-sv-rSE/strings.xml | 3 ++ shared/src/main/res/values-af-rZA/strings.xml | 19 ++++++++++ shared/src/main/res/values-bg-rBG/strings.xml | 21 ++++++++++ shared/src/main/res/values-ca-rES/strings.xml | 21 ++++++++++ shared/src/main/res/values-cs-rCZ/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-da-rDK/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-de-rDE/strings.xml | 22 +++++++++++ shared/src/main/res/values-el-rGR/strings.xml | 18 +++++++++ shared/src/main/res/values-es-rES/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-fr-rFR/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-ga-rIE/strings.xml | 21 ++++++++++ shared/src/main/res/values-hr-rHR/strings.xml | 4 ++ shared/src/main/res/values-hu-rHU/strings.xml | 6 +++ shared/src/main/res/values-it-rIT/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-iw-rIL/strings.xml | 4 ++ shared/src/main/res/values-ko-rKR/strings.xml | 21 ++++++++++ shared/src/main/res/values-lt-rLT/strings.xml | 21 ++++++++++ shared/src/main/res/values-nl-rNL/strings.xml | 4 ++ shared/src/main/res/values-no-rNO/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-pl-rPL/strings.xml | 29 ++++++++++++++ shared/src/main/res/values-pt-rBR/strings.xml | 22 +++++++++++ shared/src/main/res/values-pt-rPT/strings.xml | 21 ++++++++++ shared/src/main/res/values-ro-rRO/strings.xml | 21 ++++++++++ shared/src/main/res/values-ru-rRU/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-sk-rSK/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-sv-rSE/strings.xml | 22 +++++++++++ shared/src/main/res/values-tr-rTR/strings.xml | 30 +++++++++++++++ shared/src/main/res/values-zh-rCN/strings.xml | 30 +++++++++++++++ wear/src/main/res/values-fr-rFR/strings.xml | 3 ++ 82 files changed, 797 insertions(+), 20 deletions(-) create mode 100644 shared/src/main/res/values-af-rZA/strings.xml create mode 100644 shared/src/main/res/values-bg-rBG/strings.xml create mode 100644 shared/src/main/res/values-ca-rES/strings.xml create mode 100644 shared/src/main/res/values-cs-rCZ/strings.xml create mode 100644 shared/src/main/res/values-da-rDK/strings.xml create mode 100644 shared/src/main/res/values-de-rDE/strings.xml create mode 100644 shared/src/main/res/values-el-rGR/strings.xml create mode 100644 shared/src/main/res/values-es-rES/strings.xml create mode 100644 shared/src/main/res/values-fr-rFR/strings.xml create mode 100644 shared/src/main/res/values-ga-rIE/strings.xml create mode 100644 shared/src/main/res/values-hr-rHR/strings.xml create mode 100644 shared/src/main/res/values-hu-rHU/strings.xml create mode 100644 shared/src/main/res/values-it-rIT/strings.xml create mode 100644 shared/src/main/res/values-iw-rIL/strings.xml create mode 100644 shared/src/main/res/values-ko-rKR/strings.xml create mode 100644 shared/src/main/res/values-lt-rLT/strings.xml create mode 100644 shared/src/main/res/values-nl-rNL/strings.xml create mode 100644 shared/src/main/res/values-no-rNO/strings.xml create mode 100644 shared/src/main/res/values-pl-rPL/strings.xml create mode 100644 shared/src/main/res/values-pt-rBR/strings.xml create mode 100644 shared/src/main/res/values-pt-rPT/strings.xml create mode 100644 shared/src/main/res/values-ro-rRO/strings.xml create mode 100644 shared/src/main/res/values-ru-rRU/strings.xml create mode 100644 shared/src/main/res/values-sk-rSK/strings.xml create mode 100644 shared/src/main/res/values-sv-rSE/strings.xml create mode 100644 shared/src/main/res/values-tr-rTR/strings.xml create mode 100644 shared/src/main/res/values-zh-rCN/strings.xml diff --git a/app/src/main/res/values-af-rZA/strings.xml b/app/src/main/res/values-af-rZA/strings.xml index e7235fd739..809877af52 100644 --- a/app/src/main/res/values-af-rZA/strings.xml +++ b/app/src/main/res/values-af-rZA/strings.xml @@ -127,6 +127,7 @@ Eindverbruiker Lisensie Ooreenkoms MOET NIE GEBRUIK WORD OM MEDIESE BESLUITE TE MAAK NIE. DAAR IS GEEN WAARBORG DAT DIE PROGRAM, ONDERWORPE AAN TOEPASSELIKE WETTE EN WETGEWING. TENSY ANDERS GEMELD IN TEKS VOORSIEN DIE KOPIEREG-HOUERS EN / OF ANDER PARTYE DIE PROGRAM \"AS IS\" SONDER ËNIGE WAARBORG VAN ENIGE ORDE, UITDRUKKELIK OF IMPLISIET, INKLUSIEF, MAAR NIE BEPERK TOT DIE IMPLISIETE WAARBORG VAN TOEPAASBAARHEID OF NUT VIR EEN SPESIFIEKE DOEL. DIE TOTALE EN ALLE RISIKOVIR DIE KWALITEIT EN PRESTASIE VAN DIE PROGRAM RUS MET JOUSELF. VIR ENIGE PROGRAM DEFEKTIEWE OF FALINGS MOET JY PERSOONLIK DIE KOSTE EN REGSAANSPREEKLIKHEID DRA VAN ALLE NODIGE AKSIES, DIENS, REPARASIES OF KORREKSIES VIR USELF OF ENIGE DERDE PARTYE EN/OF AKSIES, DIENS, REPARASIES OF KORREKSIES WAT DEUR DIE PROGRAM GEDOEN WAS. EK VERSTAAN en STEM IN + Stoor Herlaai profiel SMS Communicator Toegelate telefoon nommers diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml index 4210714b25..0cd5f28707 100644 --- a/app/src/main/res/values-bg-rBG/strings.xml +++ b/app/src/main/res/values-bg-rBG/strings.xml @@ -879,5 +879,6 @@ Недостъпно + Вход diff --git a/app/src/main/res/values-ca-rES/strings.xml b/app/src/main/res/values-ca-rES/strings.xml index 34b622bacc..7319244844 100644 --- a/app/src/main/res/values-ca-rES/strings.xml +++ b/app/src/main/res/values-ca-rES/strings.xml @@ -154,6 +154,7 @@ Acord de llicència per a l\'usuari final NO S\'HA D\'UTILITZAR PER A PRENDRE DECISIONS MÈDIQUES. EL PROGRAMA NO TÉ GARANTIA, EN LA MESURA QUE HO PERMET LA LLEI APLICABLE. EXCEPTE QUAN S\'INDIQUI EL CONTRARI PER ESCRIT, ELS PROPIETARIS DEL COPYRIGHT I/O ALTRES PARTS PROPORCIONEN EL PROGRAMA \"TAL QUAL\" SENSE CAP MENA DE GARANTIA, NI IMPLÍCITA NI EXPLÍCITA, INCLOENT, PERÒ SENSE ESTAR LIMITADES A, LES GARANTIES IMPLÍCITES DE COMERCIALITZACIÓ I ADEQUACIÓ A UN OBJECTIU PARTICULAR. US FEU RESPONSABLES TOTALMENT DELS RISCOS EN QUANT A LA QUALITAT I EL RENDIMENT DEL PROGRAMA. SI EL PROGRAMA FOS DEFECTUÓS, VOSALTRES ASSUMIU EL COST DE TOT SERVEI, REPARACIÓ O CORRECCIÓ. ENTENC I ACCEPTO + Desar Recarregar perfil Comunicador SMS Nrs. de telèfon permesos @@ -314,5 +315,6 @@ + Iniciar sessió diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index 80200d30ee..0ccb861169 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -159,6 +159,7 @@ Endbenutzervereinbarung DAS PROGRAMM DARF NICHT FÜR MEDIZINISCHE ENTSCHEIDUNGEN BENUTZT WERDEN. ES GIBT IN DIESEM PROJEKT KEINE GEWÄHRLEISTUNG ODER GARANTIERTE UNTERSTÜTZUNG IN IRGENDEINER ART. WENN DU DICH ENTSCHEIDEST, ES ZU NUTZEN, HÄNGT DIE QUALITÄT UND LEISTUNGSFÄHIGKEIT DIESES PROJEKTES VON DIR SELBST AB. ES WIRD \"WIE BESEHEN\" ZUR VERFÜGUNG GESTELLT. SOLLTE SICH DAS PROGRAMM ALS FEHLERHAFT ERWEISEN, ÜBERNIMMST DU ALLE NOTWENDIGEN KRANKHEITSKOSTEN, SERVICELEISTUNGEN, REPARATUREN ODER KORREKTUREN. Ich verstehe und stimme zu. + Speichern Profil neuladen SMS-Kommunikator Erlaubte Telefonnummern @@ -939,5 +940,7 @@ Unerwartetes Verhalten. Kohlenhydrate & Bolus Sind Sie sicher, dass Sie diese(s) %1$d Element(e) löschen möchten? %1$d ausgewählt + Sortieren + Login diff --git a/app/src/main/res/values-ga-rIE/strings.xml b/app/src/main/res/values-ga-rIE/strings.xml index 908b6b148b..115e43452f 100644 --- a/app/src/main/res/values-ga-rIE/strings.xml +++ b/app/src/main/res/values-ga-rIE/strings.xml @@ -59,6 +59,7 @@ Socruithe Easpórtáil Socruithe Iompórtáil Iompórtáil + Sábháil Athlódáil próifíl Is lúb díchumasaithe Is lúb cumasaithe diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 0f14db4df7..90652a8a7a 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -155,6 +155,7 @@ 최종 사용자 라이선스 동의서 이 프로그램을 의학적 결정을 내리는 데 사용해서는 안되며, 여기에 대한 어떠한 보증도 없습니다. 이 프로그램의 품질과 성능에 관한 모든 위험은 사용자에게 있습니다.\nMUST NOT BE USED TO MAKE MEDICAL DECISIONS. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 모두 이해하였고 동의합니다. + 저장 프로파일 새로고침 SMS 통신기 허가된 전화번호 @@ -849,5 +850,6 @@ 계산 진행 중 + 로그인 diff --git a/app/src/main/res/values-lt-rLT/strings.xml b/app/src/main/res/values-lt-rLT/strings.xml index fb0d0f2b08..211286d69f 100644 --- a/app/src/main/res/values-lt-rLT/strings.xml +++ b/app/src/main/res/values-lt-rLT/strings.xml @@ -159,6 +159,7 @@ Licencinė sutartis su vartotoju PROGRAMA NEGALI BŪTI NAUDOJAMA GYDYMO SPRENDIMAMS PRIIMTI. PAGAL GALIOJANČIUS ĮSTATYMUS PROGRAMA NESUTEIKIA JOKIŲ GARANTIJŲ VARTOTOJUI. JEI RAŠTU NENURODYTA KITAIP, PROGRAMOS AUTORINIŲ TEISIŲ TURĖTOJAS IR/AR KITOS ŠALYS PATEIKIA PROGRAMĄ \"KAIP YRA\" BE JOKIŲ GARANTIJŲ, TIEK AKIVAIZDŽIŲ, TIEK NUMANOMŲ, ĮSKAITANT, BET NEAPSIRIBOJANT GALIMYBĘ NAUDOTI PROGRAMĄ KOMERCINIAMS AR KITOKIEMS DALINIAMS TIKSLAMS. RIZIKĄ, KYLANČIĄ NAUDOJANT PROGRAMĄ PRISIIMA PATS VARTOTOJAS. JEI PROGRAMA VEIKIA NETINKAMAI, IŠLAIDOS, SUSIJUSIOS SU PROGRAMOS SERVISU, TAISYMU AR KOREGAVIMU, TENKA VARTOTOJUI. SUPRATAU IR SUTINKU + Išsaugoti Atnaujinti profilį SMS komunikatorius Leidžiami telefono numeriai @@ -893,5 +894,6 @@ Negalimas + Prisijungti diff --git a/app/src/main/res/values-pl-rPL/strings.xml b/app/src/main/res/values-pl-rPL/strings.xml index 06f2e32c76..716f005083 100644 --- a/app/src/main/res/values-pl-rPL/strings.xml +++ b/app/src/main/res/values-pl-rPL/strings.xml @@ -159,6 +159,7 @@ Umowa licencyjna użytkownika końcowego NIE MOŻE BY WYKORZYSTYWANY DO PODEJMOWANIA DECYZJI MEDYCZNYCH. NIE MA ŻADNEJ GWARANCJI NA PROGRAM, W ZAKRESIE DOZWOLONYM PRZEZ OBOWIĄZUJĄCE PRAWO. Z WYJĄTKIEM PRZYPADKÓW, GDY W INNY SPOSÓB PISMO OŚWIADCZENIA PRAW AUTORSKICH I / LUB INNYCH STRON, PRZEDSTAWIAĆ PROGRAM \"W STANIE TAKIM, W JAKIM SIĘ ZNAJDUJE\" BEZ JAKIEJKOLWIEK GWARANCJI, WYRAŹNEJ LUB DOMNIEMANEJ, W TYM MIĘDZY INNYMI DOMNIEMANYCH GWARANCJI PRZYDATNOŚCI HANDLOWEJ I PRZYDATNOŚCI DO OKREŚLONEGO CELU. CAŁKOWITE RYZYKO ZWIĄZANE Z JAKOŚCIĄ I WYNIKIEM PROGRAMU JEST PO PAŃSTWA STRONIE. W PRZYPADKU USZKODZENIA PROGRAMU UŻYTKOWNIK PONOSI KOSZT CAŁEGO NIEZBĘDNEGO SERWISU, NAPRAWY LUB POPRAWEK. W PRZYPADKU NIEPOROZUMIEŃ ZASTOSOWANIE PRAWNE MA UMOWA W ANGIELSKIEJ WERSJI JĘZYKOWEJ!!! ROZUMIEM I WYRAŻAM ZGODĘ + ZACHOWAJ Załaduj profil ponownie Komunikator SMS Dozwolone numery telefonów @@ -893,5 +894,10 @@ Niedostępne + Usuń wybrane pozycje + Czy na pewno chcesz usunąć %1$d pozycji + Wybrany %1$d + Sortuj + Zaloguj się diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 0c41fd2511..1049c0380e 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -159,6 +159,7 @@ Condições de Utilização NÃO DEVE SER USADO PARA FAZER DECISÕES MÉDICAS. NÃO HÁ NENHUMA GARANTIA PARA O PROGRAMA, NA EXTENSÃO PERMITIDA PELA LEGISLAÇÃO APLICÁVEL. EXCEPTO QUANDO DE OUTRA FORMA, POR ESCRITO, OS TITULARES DOS DIREITOS DE AUTOR E / OU OUTRAS PARTES FORNECEM O PROGRAMA “TAL COMO ESTÁ”, SEM GARANTIA DE QUALQUER TIPO, EXPRESSA OU IMPLÍCITA, INCLUINDO, MAS NÃO SE LIMITANDO, ÀS GARANTIAS IMPLÍCITAS DE COMERCIALIZAÇÃO E ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. TODO O RISCO QUANTO À QUALIDADE E DESEMPENHO DO PROGRAMA É CONSIGO. CASO O PROGRAMA SEJA DEFEITUOSO, ASSUME O CUSTO DE TODOS OS SERVIÇOS, REPAROS OU CORREÇÕES NECESSÁRIOS. EU ENTENDO E CONCORDO + Guardar Recarregar perfil Comunicador SMS Número de telefones permitidos @@ -894,5 +895,6 @@ Indisponível + Login diff --git a/app/src/main/res/values-ro-rRO/strings.xml b/app/src/main/res/values-ro-rRO/strings.xml index c9501b704f..2d55df640a 100644 --- a/app/src/main/res/values-ro-rRO/strings.xml +++ b/app/src/main/res/values-ro-rRO/strings.xml @@ -159,6 +159,7 @@ Licență utilizator final NU FOLOSIȚI PENTRU LUAREA DE DECIZII MEDICALE. NU EXISTĂ RĂSPUNDERE LEGALĂ SAU GARANȚIE PENTRU ACEST PROGRAM, ÎN LIMITA APLICABILĂ A LEGII. CU EXCEPTIA CAZURILOR SPECIAL MENȚIONATE, AUTORUL ȘI/SAU ALTE PERSOANE IMPLICATE PUN LA DISPOZIȚIE ACEST PROGRAM FĂRĂ NICIO GARANȚIE, IMPLICITĂ SAU EXPLICITĂ, INCLUZÂND, DAR FĂRĂ A SE LIMITA LA, GARANȚIILE LEGATE DE VĂNZAREA SAU POTRIVIREA PENTRU UN ANUME SCOP. ÎNTREGUL RISC LEGAT DE CALITATEA ȘI PERFORMANȚA ACESTUI PROGRAM CAD ÎN RESPONSABILITATEA DUMNEAVOASTRĂ. DACĂ PROGRAMUL SE DOVEDEȘTE A FI DEFECT, DUMNEAVOASTRĂ VĂ ASUMAȚI ÎNTREAGA RĂSPUNDERE, PRECUM ȘI TOATE COSTURILE LEGATE DE SERVICE, REPARAȚII SAU CORECȚII. ÎNȚELEG ȘI SUNT DE ACORD + Salvează Reîncarcă profilul Comunicator SMS Numere de telefon permise @@ -894,5 +895,8 @@ Nu este disponibil + Sigur vrei să elimini %1$d element(e) + Sortează + Autentificare diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index 5a373efad3..ee5c7d8905 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -161,6 +161,7 @@ Eversense-appen. Licensavtal för slutanvändare FÅR INTE ANVÄNDAS FÖR ATT FATTA MEDICINSKA BESLUT. DET FINNS INGEN GARANTI FÖR PROGRAMMET I DEN UTSTRÄCKNING SOM TILLÅTS AV GÄLLANDE LAG. FÖRUTOM NÄR ANNAT ANGES SKRIFTLIGEN LEVERERAS APPLIKATIONEN SOM DEN ÄR HELT UTAN GARANTIER I NÅGON SOM HELST FORM, VARKEN UTTRYCKTA ELLER UNDERFÖRSTÅDDA, INKLUSIVE MEN INTE BEGRÄNSAT TILL SÄLJBARHET OCH LÄMPLIGHET FÖR ETT VISST ÄNDAMÅL. HELA RISKEN VAD GÄLLER KVALITET OCH PRESTANDA AV PROGRAMMET ÅLIGGER ANVÄNDAREN. OM PROGRAMMET VISAR SIG VARA DEFEKT ANTAR ANVÄNDAREN DEN FULLA FÖR KOSTNADEN FÖR ALL NÖDVÄNDIG SERVICE, REPARATION ELLER KORRIGERING. JAG FÖRSTÅR OCH GODKÄNNER + Spara Ladda om profil SMS-tjänst Godkända telefonnummer @@ -962,5 +963,6 @@ Eversense-appen. Okänt kommando: Procent Appens standardinställning + Logga in diff --git a/automation/src/main/res/values-de-rDE/strings.xml b/automation/src/main/res/values-de-rDE/strings.xml index 3cb46b8eaa..4fdf548bc7 100644 --- a/automation/src/main/res/values-de-rDE/strings.xml +++ b/automation/src/main/res/values-de-rDE/strings.xml @@ -113,4 +113,5 @@ Automatisierungs-Ereignis Umsortieren Benutzeraktion + Sind Sie sicher, dass Sie diese(s) %1$d Element(e) löschen möchten? diff --git a/automation/src/main/res/values-ru-rRU/strings.xml b/automation/src/main/res/values-ru-rRU/strings.xml index 2caaa73c95..181d25930f 100644 --- a/automation/src/main/res/values-ru-rRU/strings.xml +++ b/automation/src/main/res/values-ru-rRU/strings.xml @@ -120,4 +120,7 @@ Вы уверены, что хотите удалить %1$d элемент Сортировать Автоматизация системы + Запустить автоматизацию + Добавить правило + Удаление/сортировка diff --git a/core/src/main/res/values-af-rZA/strings.xml b/core/src/main/res/values-af-rZA/strings.xml index e16a8775f0..0b6a6abc84 100644 --- a/core/src/main/res/values-af-rZA/strings.xml +++ b/core/src/main/res/values-af-rZA/strings.xml @@ -2,7 +2,9 @@ + Stoor %1$.2f U/h + ]]> Ja Nee LOOP UIT AKSIE GESTEL DEUR BEPERKINGS @@ -60,5 +62,6 @@ %1$.2f beperk tot %2$.2f + Basale diff --git a/core/src/main/res/values-bg-rBG/strings.xml b/core/src/main/res/values-bg-rBG/strings.xml index 9eada62db6..183980600d 100644 --- a/core/src/main/res/values-bg-rBG/strings.xml +++ b/core/src/main/res/values-bg-rBG/strings.xml @@ -4,6 +4,7 @@ Обнови Грешка + Съхрани Не е зададен Неуспешно обновяване на базалния профил Профила на помпата е обновен @@ -41,6 +42,7 @@ въглехидрати Грешен профил !!! НЕ Е АКТИВИРАН ПРОФИЛ + ]]> Дата Единици DIA (Време на действие на инсулина): @@ -285,6 +287,7 @@ %1$.2f ограничен до %2$.2f SMS + Базал %1$d дeн diff --git a/core/src/main/res/values-ca-rES/strings.xml b/core/src/main/res/values-ca-rES/strings.xml index 16ce76713d..1eb5f978ea 100644 --- a/core/src/main/res/values-ca-rES/strings.xml +++ b/core/src/main/res/values-ca-rES/strings.xml @@ -2,6 +2,8 @@ + Desar + ]]> @@ -66,5 +68,6 @@ %1$.2f limitat a %2$.2f »%1$s« supera els límits + Basal diff --git a/core/src/main/res/values-cs-rCZ/strings.xml b/core/src/main/res/values-cs-rCZ/strings.xml index 7867c85bf7..8f03f86ea7 100644 --- a/core/src/main/res/values-cs-rCZ/strings.xml +++ b/core/src/main/res/values-cs-rCZ/strings.xml @@ -464,8 +464,8 @@ Poslední spuštění : Varování : Vyberte profil pro ladění - Autotune funguje pouze s jedinou hodnotou IC, váš profil má %1$d hodnot. Průměrná hodnota je %2$.2fg/U - Autotune funguje pouze s jedinou hodnotou ISF, váš profil má %1$d hodnot. Průměrná hodnota je %2$.1f%3$s/U + Vybraný profil má %1$d hodnot IC. Autotune bude používat %2$.2f g/U + Vybraný profil má %1$d hodnot ISF. Autotune bude používat %2$.1f %3$s/U Chyba vstupních dat, zkuste autotune spustit znovu nebo snížit počet dní Autotune spuštěno, prosím buďte trpěliví Před použitím výsledky pečlivě zkontrolujte! diff --git a/core/src/main/res/values-da-rDK/strings.xml b/core/src/main/res/values-da-rDK/strings.xml index 8f64c75dee..d446162c2f 100644 --- a/core/src/main/res/values-da-rDK/strings.xml +++ b/core/src/main/res/values-da-rDK/strings.xml @@ -461,8 +461,6 @@ Sidst kørt : Advarsel : Vælg profil, der skal justeres - Autotune fungerer med kun én IC-værdi, din profil har %1$d værdier. Gennemsnitsværdi er %2$.2fg/E - Autotune virker med kun én ISF-værdi, din profil har %1$d værdier. Gennemsnitlig værdi er %2$.1f%3$s/E Automatisk beregning startet, vær venligst tålmodig Kontrollér resultaterne omhyggeligt, før du bruger dem! Delvis resultat dag %1$d / %2$d justeret diff --git a/core/src/main/res/values-de-rDE/strings.xml b/core/src/main/res/values-de-rDE/strings.xml index 0c2664a530..5b12029067 100644 --- a/core/src/main/res/values-de-rDE/strings.xml +++ b/core/src/main/res/values-de-rDE/strings.xml @@ -42,6 +42,7 @@ Kohlenhydrate Ungültiges oder defektes Profil! KEIN PROFIL GESETZT + ]]> Datum Einheiten DIA @@ -428,6 +429,9 @@ Insight Refresh Button abnehmend %1$s mit %2$s zunehmend %1$s mit %2$s + Basal + %1$d ausgewählt + Sortieren %1$d Tag diff --git a/core/src/main/res/values-el-rGR/strings.xml b/core/src/main/res/values-el-rGR/strings.xml index 730d941711..68de2b7014 100644 --- a/core/src/main/res/values-el-rGR/strings.xml +++ b/core/src/main/res/values-el-rGR/strings.xml @@ -2,7 +2,9 @@ + Αποθήκευση %1$.2f U/h + ]]> Ναι Όχι ΤΟ ΚΥΚΛΩΜΑ ΑΠΕΝΕΡΓΟΠΟΙΗΘΗΚΕ ΑΠΟ ΠΕΡΙΟΡΙΣΜΟΥΣ @@ -60,5 +62,6 @@ Το %1$.2f περιορίζεται σε %2$.2f + Βασικός Ρυθμός diff --git a/core/src/main/res/values-es-rES/strings.xml b/core/src/main/res/values-es-rES/strings.xml index 936daa643a..19f888b736 100644 --- a/core/src/main/res/values-es-rES/strings.xml +++ b/core/src/main/res/values-es-rES/strings.xml @@ -464,8 +464,6 @@ Última ejecución : Advertencia : Selecciona el perfil para a ajustar - Autotune sólo funciona con un valor de IC. Tu perfil tiene %1$d valores. El valor promedio es %2$.2fg/U - Autotune sólo funciona con un valor de ISF. Tu perfil tiene %1$d valores. El valor promedio es %2$.1f%3$s/U Error en los datos de entrada, intenta ejecutar de nuevo autotune o reducir el número de días Cálculo de autototune iniciado, por favor ten paciencia ¡Comprueba los resultados cuidadosamente antes de usarlos! diff --git a/core/src/main/res/values-fr-rFR/strings.xml b/core/src/main/res/values-fr-rFR/strings.xml index 042e41d62c..2170468b20 100644 --- a/core/src/main/res/values-fr-rFR/strings.xml +++ b/core/src/main/res/values-fr-rFR/strings.xml @@ -464,8 +464,8 @@ Dernier run : Avertissement : Sélectionnez le profil à optimiser - Autotune ne fonctionne qu\'avec une seule valeur G/I, votre profil a %1$d valeurs. La valeur moyenne est de %2$.2f g/U - Autotune ne calcule qu\'une seule valeur de SI, votre profil a %1$d valeurs. La valeur moyenne est de %2$.1f %3$s/U + Le profil sélectionné %1$d valeurs de G/I. Autotune va utiliser la moyenne %2$.2f g/U + Le profil sélectionné a %1$d valeurs de SI. Autotune va utiliser la moyenne %2$.1f %3$s/U Erreur dans les données d\'entrée, essayez de relancer le calcul ou réduire le nombre de jours Le calcul Autotune a commencé, veuillez patienter Vérifiez attentivement les résultats avant de les utiliser! diff --git a/core/src/main/res/values-ga-rIE/strings.xml b/core/src/main/res/values-ga-rIE/strings.xml index 57edab2df3..0ab0b703fd 100644 --- a/core/src/main/res/values-ga-rIE/strings.xml +++ b/core/src/main/res/values-ga-rIE/strings.xml @@ -3,6 +3,7 @@ Earráid + Sábháil Ag fanacht do caidéil Ag nascadh le %1$d s Ag seachadadh %1$.2f A @@ -114,5 +115,6 @@ + Bunaidh diff --git a/core/src/main/res/values-hr-rHR/strings.xml b/core/src/main/res/values-hr-rHR/strings.xml index 6f676893c7..57579e20e0 100644 --- a/core/src/main/res/values-hr-rHR/strings.xml +++ b/core/src/main/res/values-hr-rHR/strings.xml @@ -2,8 +2,10 @@ + Zatvori + Otkaži diff --git a/core/src/main/res/values-hu-rHU/strings.xml b/core/src/main/res/values-hu-rHU/strings.xml index cb08528112..8d7d288e7b 100644 --- a/core/src/main/res/values-hu-rHU/strings.xml +++ b/core/src/main/res/values-hu-rHU/strings.xml @@ -26,5 +26,6 @@ + Bázis diff --git a/core/src/main/res/values-iw-rIL/strings.xml b/core/src/main/res/values-iw-rIL/strings.xml index bf525d5731..700387ef45 100644 --- a/core/src/main/res/values-iw-rIL/strings.xml +++ b/core/src/main/res/values-iw-rIL/strings.xml @@ -464,8 +464,8 @@ הפעלה אחרונה : אזהרה : בחרו פרופיל לכוונון - כוונון אוטומטי עובד עם ערך IC אחד בלבד, לפרופיל שלכם יש %1$d ערכים. הערך הממוצע הוא %2$.2f גר\'\\יח\' - כוונון אוטומטי עובד עם ערך ISF אחד בלבד, לפרופיל שלכם יש %1$d ערכים. הערך הממוצע הוא %2$.1f %3$s\\יח\' + בפרופיל הנבחר יש %1$d ערכי יחס פחמימות. הכיוונון האוטומטי ישתמש ב-%2$.2f גר\'\\יח\' + בפרופיל הנבחר יש %1$d ערכי יחס תיקון. הכיוונון האוטומטי ישתמש ב-%2$.1f %3$s\\יח\' שגיאה בנתוני הקלט, נסו להפעיל בשנית או שנסו לצמצם את מספר הימים חישוב הכוונון האוטומטי התחיל, אנא התאזרו בסבלנות בדקו היטב את התוצאות לפני השימוש בהן! diff --git a/core/src/main/res/values-ko-rKR/strings.xml b/core/src/main/res/values-ko-rKR/strings.xml index 59b3617bea..c04e9ec5b3 100644 --- a/core/src/main/res/values-ko-rKR/strings.xml +++ b/core/src/main/res/values-ko-rKR/strings.xml @@ -4,6 +4,7 @@ 새로고침 에러 + 저장 설정되지 않음 Basal 프로파일 갱신 실패 Basal 프로파일이 펌프에 업데이트 되었습니다 @@ -40,6 +41,7 @@ 탄수화물 프로파일이 유효하지 않습니다!!! 프로파일이 설정되지 않았습니다. + ]]> 날짜 단위 인슐린활동시간(DIA): @@ -376,6 +378,7 @@ »%1$s« %2$.2f이 \'고정된 한계값\'을 벗어났습니다. Basal 값 + Basal %1$d 일 diff --git a/core/src/main/res/values-lt-rLT/strings.xml b/core/src/main/res/values-lt-rLT/strings.xml index 976c5a496f..c834cbf768 100644 --- a/core/src/main/res/values-lt-rLT/strings.xml +++ b/core/src/main/res/values-lt-rLT/strings.xml @@ -4,6 +4,7 @@ Atnaujinti Klaida + Išsaugoti Nenustatyta Nepavyko atnaujinti bazės profilio Bazės profilis pompoje atnaujintas @@ -41,6 +42,7 @@ AV Netinkamas profilis!!! Nenustatytas profilis + ]]> Data Vienetai IVT @@ -418,6 +420,7 @@ Bolusas OK Pompa suporuota Insight Mygtukas Naujinti + Valandinė bazė %1$d d. diff --git a/core/src/main/res/values-no-rNO/strings.xml b/core/src/main/res/values-no-rNO/strings.xml index dfbe711045..d8b19182c7 100644 --- a/core/src/main/res/values-no-rNO/strings.xml +++ b/core/src/main/res/values-no-rNO/strings.xml @@ -464,8 +464,8 @@ Siste beregning : Varsel: Velg profil du vil justere - Autotune fungerer bare med én IC-verdi, og din profil har %1$d verdier. Gjennomsnittlig verdi er %2$.2fg/E - Autotune fungerer med bare én ISF verdi, og din profil har %1$d verdier. Gjennomsnittsverdi er %2$.1f%3$s/E + Valgt profil har %1$d IK verdier. Autotune vil bruke %2$.2f g/E + Valgte profil har %1$d ISF-verdier. Autotune vil bruke %2$.1f %3$s/E Feil i innleste datasett, prøv å kjør Autotune en gang til eller reduser antall dager Har startet Autotune beregning, vennligst vent Kontroller resultatene nøye før du bruker dem! diff --git a/core/src/main/res/values-pl-rPL/strings.xml b/core/src/main/res/values-pl-rPL/strings.xml index 76332f8fbf..eba2bf6385 100644 --- a/core/src/main/res/values-pl-rPL/strings.xml +++ b/core/src/main/res/values-pl-rPL/strings.xml @@ -4,6 +4,7 @@ Odśwież Błąd + ZACHOWAJ Nie ustawiono Nieudane uaktualnienie profilu bazy Profil bazowy w pompie uaktualniony @@ -41,6 +42,7 @@ Węglowodany Nieprawidłowy profil !!! NIE USTAWIONO PROFILU + ]]> Data Jednostki DIA @@ -418,6 +420,9 @@ Bolus OK Pompa sparowana Przycisk Odświeżania Insight + Baza + Wybrany %1$d + Sortuj %1$d dzień diff --git a/core/src/main/res/values-pt-rPT/strings.xml b/core/src/main/res/values-pt-rPT/strings.xml index ffbe00bc75..29c658270c 100644 --- a/core/src/main/res/values-pt-rPT/strings.xml +++ b/core/src/main/res/values-pt-rPT/strings.xml @@ -4,6 +4,7 @@ Actualizar Erro + Guardar Não definido Falha a actualizar perfil da basal Perfil Basal actualizado na bomba @@ -40,6 +41,7 @@ Hidratos Perfil inválido !!! SEM PERFIL DEFINIDO + ]]> Data Unidades DIA @@ -337,6 +339,7 @@ %1$.2f limitado a %2$.2f »%1$s« está fora dos limites máximos + Basal %1$d dia diff --git a/core/src/main/res/values-ro-rRO/strings.xml b/core/src/main/res/values-ro-rRO/strings.xml index 1ef70c3e8f..dc4b4b01f3 100644 --- a/core/src/main/res/values-ro-rRO/strings.xml +++ b/core/src/main/res/values-ro-rRO/strings.xml @@ -4,6 +4,7 @@ Actualizează Eroare + Salvează Nesetată Actualizarea profilului bazalei a eșuat Profilul bazalei a fost modificat în pompă @@ -41,6 +42,7 @@ Carbohidrați Profil invalid!!! NICIUN PROFIL SETAT + ]]> Data Unități DIA @@ -419,6 +421,8 @@ Bolus OK Pompă împerecheată Buton Reîmprospătare Insight + Rate bazale + Sortează %1$d zi diff --git a/core/src/main/res/values-ru-rRU/strings.xml b/core/src/main/res/values-ru-rRU/strings.xml index 02f52a4a7c..86d074832f 100644 --- a/core/src/main/res/values-ru-rRU/strings.xml +++ b/core/src/main/res/values-ru-rRU/strings.xml @@ -456,9 +456,36 @@ Применить усредненный суточный IC/ISF Autotune не настраивает суточные вариации, эта опция только применяет усредненные коэффициенты IC и ISF к суточному профилю Включить больше информации логов для отладки + Включите только если разработчик просит отправить больше информации о логах для отладки плагина Autotune Количество дней обработки данных Autotune по умолчанию (до 30) + Настроено + Профиль: + Настроено дней: + Последнее выполнение: + Внимание: + Выберите профиль для изменения Ошибка ввода данных, попробуйте запустить снова autotune или уменьшить количество дней + Идет настройка автоматизации, ждите + Перед использованием внимательно проверьте результаты! + Частичный результат дня %1$d / %2$d с отладкой + Результат: %1$s + Парам + % + Отсутствует + Профиль авто тюн + Выполнить Autotune + Проверьте профиль ввода + Сравнить профили + Копировать в локальный профиль + Обновить профиль ввода + Вернуть профиль ввода + Создать новый локальный профиль из этого профиля Autotune? + Обновить профиль %1$s профилем Autotune? + Восстановить профиль %1$s с помощью входного профиля? Неверный профиль + Autotune выполнен без переключения профиля + Autotune выполнен и профиль переключён автоматически + Ошибка во время последнего выполнения Autotune %1$d день %1$d дня diff --git a/core/src/main/res/values-sk-rSK/strings.xml b/core/src/main/res/values-sk-rSK/strings.xml index 780625bd0a..cbd101e11e 100644 --- a/core/src/main/res/values-sk-rSK/strings.xml +++ b/core/src/main/res/values-sk-rSK/strings.xml @@ -464,8 +464,6 @@ Posledné spustenie : Upozornenie : Vyberte profil pre ladenie - Autotune funguje iba s jedinou hodnotou IC, váš profil má %1$d hodnôt. Priemerná hodnota je %2$.2fg/JI - Autotune funguje iba s jedinou hodnotou IC, váš profil má %1$d hodnôt. Priemerná hodnota je %2$.1fg/JI Chyba vstupných dát, skúste znova spustiť Autotune, alebo znížte počet dní Autotune spustený, prosím buďte trpezliví Pred použitím výsledky starostlivo skontrolujte! diff --git a/core/src/main/res/values-sv-rSE/strings.xml b/core/src/main/res/values-sv-rSE/strings.xml index eb3759fb8d..86d9f25d0c 100644 --- a/core/src/main/res/values-sv-rSE/strings.xml +++ b/core/src/main/res/values-sv-rSE/strings.xml @@ -4,6 +4,7 @@ Uppdatera Fel + Spara Ej vald Lyckades inte uppdatera basalprofilen Basalprofilen uppdaterad i pumpen @@ -41,6 +42,7 @@ Kolhydrater Ogiltig profil! INGEN PROFIL VALD + ]]> Datum Enheter DIA @@ -426,6 +428,7 @@ Uppdat. knapp för Insight minska %1$s med %2$s öka %1$s med %2$s + Basal %1$d dag diff --git a/core/src/main/res/values-tr-rTR/strings.xml b/core/src/main/res/values-tr-rTR/strings.xml index db7b65151d..07bb349882 100644 --- a/core/src/main/res/values-tr-rTR/strings.xml +++ b/core/src/main/res/values-tr-rTR/strings.xml @@ -464,8 +464,8 @@ Son Çalıştırma : Uyarı : Ayarlanacak profili seçin - OtoAyar yalnızca bir IC değeriyle çalışır, profilinizde %1$d değer mevcut. Ortalama değer: %2$.2fg/Ü - OtoAyar yalnızca bir İDF değeriyle çalışır, profilinizde %1$d değer mevcut. Ortalama değer: %2$.1f%3$s/Ü + Seçilen profilde %1$d KİO değeri var. OtoAyar %2$.2f g/Ü kullanacak + Seçilen profilde %1$d İDF değeri var. OtoAyar %2$.1f %3$s/Ü kullanacak Giriş verilerinde hata, otoayarı tekrar çalıştırmayı deneyin veya gün sayısını azaltın OtoAyar hesaplaması başladı, lütfen sabırlı olun Kullanmadan önce sonuçları dikkatlice kontrol edin! diff --git a/core/src/main/res/values-zh-rCN/strings.xml b/core/src/main/res/values-zh-rCN/strings.xml index d0f3e1844a..d64d0e7d41 100644 --- a/core/src/main/res/values-zh-rCN/strings.xml +++ b/core/src/main/res/values-zh-rCN/strings.xml @@ -42,6 +42,7 @@ 碳水化合物 无效的配置文件!!! 没有设置配置文件 + ]]> 日期 单位 DIA diff --git a/diaconn/src/main/res/values-ru-rRU/strings.xml b/diaconn/src/main/res/values-ru-rRU/strings.xml index f3fd8c04f3..126ce64c5c 100644 --- a/diaconn/src/main/res/values-ru-rRU/strings.xml +++ b/diaconn/src/main/res/values-ru-rRU/strings.xml @@ -152,4 +152,6 @@ Приостановка на низких отключена, команда ВЫКЛ отклонена. Запуск временного базала отклоняется при работе tempbasal Остановка временного базала отклоняется при неработающем tempbasal + Отправить лог помпы в Diaconn Cloud. + Синхронизация с Diaconn Cloud diff --git a/medtronic/src/main/res/values-ru-rRU/strings.xml b/medtronic/src/main/res/values-ru-rRU/strings.xml index 30c3a6af52..71e7be8ba3 100644 --- a/medtronic/src/main/res/values-ru-rRU/strings.xml +++ b/medtronic/src/main/res/values-ru-rRU/strings.xml @@ -91,4 +91,6 @@ Если эта опция включена, то она отменяет временный базал до конца каждого часа. Такой метод помогает прекратить почасовую вибрацию некоторых помп. %1$.1fед/ч(%2$d мин осталось) Обнаружены недопустимые данные истории помпы. Создайте запись о новой проблеме и предоставьте журналы. + Статистика RL + Тип: diff --git a/openhumans/src/main/res/values-af-rZA/strings.xml b/openhumans/src/main/res/values-af-rZA/strings.xml index 3ea04e700d..a2a8d91107 100644 --- a/openhumans/src/main/res/values-af-rZA/strings.xml +++ b/openhumans/src/main/res/values-af-rZA/strings.xml @@ -1,2 +1,5 @@ - + + Kanselleer + Maak toe + diff --git a/openhumans/src/main/res/values-bg-rBG/strings.xml b/openhumans/src/main/res/values-bg-rBG/strings.xml index 80e2ef9000..6aee856ee4 100644 --- a/openhumans/src/main/res/values-bg-rBG/strings.xml +++ b/openhumans/src/main/res/values-bg-rBG/strings.xml @@ -16,4 +16,7 @@ Излязохте от \"Open Humans\". Натиснете тук за да влезете отново, ако това не е било нарочно. Качи сега + Условия за ползване + Откажи + Затвори diff --git a/openhumans/src/main/res/values-ca-rES/strings.xml b/openhumans/src/main/res/values-ca-rES/strings.xml index 9868d0e25d..7eac6702e2 100644 --- a/openhumans/src/main/res/values-ca-rES/strings.xml +++ b/openhumans/src/main/res/values-ca-rES/strings.xml @@ -7,4 +7,7 @@ Enviar només si carregant Heu tancat la sessió amb Open Humans Cliqueu aquí si no era la intenció. + Condicions d\'ús + Cancel·lar + Tancar diff --git a/openhumans/src/main/res/values-da-rDK/strings.xml b/openhumans/src/main/res/values-da-rDK/strings.xml index e58df734fe..dd505c8935 100644 --- a/openhumans/src/main/res/values-da-rDK/strings.xml +++ b/openhumans/src/main/res/values-da-rDK/strings.xml @@ -16,4 +16,6 @@ Du er blevet logget ud af Open Humans Klik her for at logge ind igen, hvis dette ikke var meningen. Upload nu + Annuller + Luk diff --git a/openhumans/src/main/res/values-de-rDE/strings.xml b/openhumans/src/main/res/values-de-rDE/strings.xml index f31bb0cf22..19a6178baa 100644 --- a/openhumans/src/main/res/values-de-rDE/strings.xml +++ b/openhumans/src/main/res/values-de-rDE/strings.xml @@ -16,4 +16,7 @@ Du wurdest von Open Humans abgemeldet. Klicke hier, um Dich erneut anzumelden, falls dies versehentlich passiert ist. Jetzt hochladen + Nutzungsbedingungen + Abbrechen + Schließen diff --git a/openhumans/src/main/res/values-el-rGR/strings.xml b/openhumans/src/main/res/values-el-rGR/strings.xml index 3ea04e700d..e963aa86ba 100644 --- a/openhumans/src/main/res/values-el-rGR/strings.xml +++ b/openhumans/src/main/res/values-el-rGR/strings.xml @@ -1,2 +1,5 @@ - + + Ακύρωση + Κλείσιμο + diff --git a/openhumans/src/main/res/values-ga-rIE/strings.xml b/openhumans/src/main/res/values-ga-rIE/strings.xml index 3ea04e700d..d1e993eb08 100644 --- a/openhumans/src/main/res/values-ga-rIE/strings.xml +++ b/openhumans/src/main/res/values-ga-rIE/strings.xml @@ -1,2 +1,5 @@ - + + Cuir ar ceal + Dún + diff --git a/openhumans/src/main/res/values-ko-rKR/strings.xml b/openhumans/src/main/res/values-ko-rKR/strings.xml index 969971395d..5be117d4e8 100644 --- a/openhumans/src/main/res/values-ko-rKR/strings.xml +++ b/openhumans/src/main/res/values-ko-rKR/strings.xml @@ -16,4 +16,7 @@ Open Humans에 접속 종료되었습니다. 의도한 것이 아닌 경우 \"여기\"를 클릭하여 다시 접속하십시오. 지금 업로드하기 + 이용 약관 + 취소 + 닫기 diff --git a/openhumans/src/main/res/values-lt-rLT/strings.xml b/openhumans/src/main/res/values-lt-rLT/strings.xml index 202491c0c3..59d9291c26 100644 --- a/openhumans/src/main/res/values-lt-rLT/strings.xml +++ b/openhumans/src/main/res/values-lt-rLT/strings.xml @@ -16,4 +16,7 @@ Jūs buvote atjungtas iš Open Humans Spustelėkite čia, kad prisijungtumėte dar kartą, jei tai atsitiko netyčia. Įkelti dabar + Naudojimosi sąlygos + Atšaukti + Uždaryti diff --git a/openhumans/src/main/res/values-pl-rPL/strings.xml b/openhumans/src/main/res/values-pl-rPL/strings.xml index 0138f625ca..09615b828e 100644 --- a/openhumans/src/main/res/values-pl-rPL/strings.xml +++ b/openhumans/src/main/res/values-pl-rPL/strings.xml @@ -16,4 +16,7 @@ Zostałeś wylogowany z Open Humans Kliknij tutaj, aby zalogować się ponownie, jeśli wylogowanie nie było celowe. Prześlij teraz + Warunki użytkowania + Anuluj + Zamknij diff --git a/openhumans/src/main/res/values-pt-rBR/strings.xml b/openhumans/src/main/res/values-pt-rBR/strings.xml index 3ea04e700d..604c5d915b 100644 --- a/openhumans/src/main/res/values-pt-rBR/strings.xml +++ b/openhumans/src/main/res/values-pt-rBR/strings.xml @@ -1,2 +1,5 @@ - + + Cancelar + Fechar + diff --git a/openhumans/src/main/res/values-pt-rPT/strings.xml b/openhumans/src/main/res/values-pt-rPT/strings.xml index 778e45ca27..03076d75a5 100644 --- a/openhumans/src/main/res/values-pt-rPT/strings.xml +++ b/openhumans/src/main/res/values-pt-rPT/strings.xml @@ -16,4 +16,7 @@ Sessão do Open Humans foi encerrada Clique aqui para entrar novamente, se não foi de propósito. Fazer o upload agora + Termos de Utilização + Cancelar + Fechar diff --git a/openhumans/src/main/res/values-ro-rRO/strings.xml b/openhumans/src/main/res/values-ro-rRO/strings.xml index 0f1261b783..47f2c88863 100644 --- a/openhumans/src/main/res/values-ro-rRO/strings.xml +++ b/openhumans/src/main/res/values-ro-rRO/strings.xml @@ -16,4 +16,7 @@ Ai fost deconectat de la Open Humans Dați click aici pentru a vă conecta din nou, dacă a fost din greșeală. Încarcă acum + Condiții de utilizare + Renunță + Închide diff --git a/openhumans/src/main/res/values-ru-rRU/strings.xml b/openhumans/src/main/res/values-ru-rRU/strings.xml index 8827371bc6..2d277cae07 100644 --- a/openhumans/src/main/res/values-ru-rRU/strings.xml +++ b/openhumans/src/main/res/values-ru-rRU/strings.xml @@ -16,4 +16,42 @@ Вы вышли из Open Humans Нажмите здесь, чтобы снова войти в систему, если выход произошел случайно. Начать передачу данных + Далее + Добро пожаловать в Open Humans + Для настройки загрузки данных нажмите \'Далее\'. + Согласие + Условия пользования + Внимательно ознакомьтесь со следующей информацией и примите условия использования. + Это проект с открытым исходным кодом, который будет копировать ваши данные на Open Humans. Мы не будем обмениваться вашими данными с третьими лицами без вашего явного разрешения. Данные, отправляемые на проект и приложение, идентифицируются с помощью случайного идентификатора и будут безопасно передаваться на учетную запись Open Humans при вашем одобрении этого процесса. Вы можете остановить загрузку и удалить загруженные данные в любое время здесь: www.openhumans.org. + Данные загружены + Гликемия + Болюсы + Пролонгированные болюсы + Углеводы + События портала терапии (кроме примечаний) + Переключения профиля + Суммарные суточные дозы + Временные базальные скорости + Временные целевые значения + Настройки + Версия приложения + Модель устройства + Размеры экрана + Данные отладки алгоритма + Данные НЕ загружены + Пароли + URL-адрес Nightscout + Секретный ключ Nightscout API + Поля свободного текста + Я понимаю и соглашаюсь. + Войти в Open Humans + Финальные настройки + Вы в одном шаге от передачи данных в Open Humans. Продолжить? + Отменить + Продолжить + Завершение... + Может занять несколько секунд. + Готово! + С этого момента ваш телефон будет иногда загружать данные в фоновом режиме. + Закрыть diff --git a/openhumans/src/main/res/values-sv-rSE/strings.xml b/openhumans/src/main/res/values-sv-rSE/strings.xml index 039bd031f8..0323a8edd8 100644 --- a/openhumans/src/main/res/values-sv-rSE/strings.xml +++ b/openhumans/src/main/res/values-sv-rSE/strings.xml @@ -16,4 +16,7 @@ Du har loggats ut från Open Humans Klicka här om du vill logga in igen. Ladda upp nu + Användarvillkor + Avbryt + Stäng diff --git a/shared/src/main/res/values-af-rZA/strings.xml b/shared/src/main/res/values-af-rZA/strings.xml new file mode 100644 index 0000000000..875daa124a --- /dev/null +++ b/shared/src/main/res/values-af-rZA/strings.xml @@ -0,0 +1,19 @@ + + + + h + dae + ure + sekonde + minuut + uur + dag + week + sekondes + minute + ure + dae + weke + m + d + diff --git a/shared/src/main/res/values-bg-rBG/strings.xml b/shared/src/main/res/values-bg-rBG/strings.xml new file mode 100644 index 0000000000..56da387b4b --- /dev/null +++ b/shared/src/main/res/values-bg-rBG/strings.xml @@ -0,0 +1,21 @@ + + + + преди %1$d мин + преди %1$.1fч + ч. + дни + часа + секунда + минута + час + ден + седмица + секунди + минути + часове + дни + седмици + мин. + д + diff --git a/shared/src/main/res/values-ca-rES/strings.xml b/shared/src/main/res/values-ca-rES/strings.xml new file mode 100644 index 0000000000..9735814c77 --- /dev/null +++ b/shared/src/main/res/values-ca-rES/strings.xml @@ -0,0 +1,21 @@ + + + + Fa %1$d m + Fa %1$.1f h + h + dies + hores + segon + minut + hora + dia + setmana + segons + minuts + hores + dies + setmanes + m + d + diff --git a/shared/src/main/res/values-cs-rCZ/strings.xml b/shared/src/main/res/values-cs-rCZ/strings.xml new file mode 100644 index 0000000000..a05fa45757 --- /dev/null +++ b/shared/src/main/res/values-cs-rCZ/strings.xml @@ -0,0 +1,30 @@ + + + + před %1$d min + před %1$d minutamí + před %1$.1f h + Před %1$.1f dny + Před %1$.0f dny + za %1$.0f dní + za %1$.0f dní + h + dnů + hodin + sekund + minut + hodina + den + týden + sekund + minut + hodin + dní + týdnů + m + d + Později během dneška + Zítra + Dnes + Včera + diff --git a/shared/src/main/res/values-da-rDK/strings.xml b/shared/src/main/res/values-da-rDK/strings.xml new file mode 100644 index 0000000000..d46c0c97a2 --- /dev/null +++ b/shared/src/main/res/values-da-rDK/strings.xml @@ -0,0 +1,30 @@ + + + + %1$d min. siden + %1$d minutter siden + %1$.1f t siden + %1$.1f dage siden + %1$.0f dage siden + om %1$.0f dage + om %1$.0f dage + t + dage + timer + sekund + minut + time + dag + uge + sekunder + minutter + timer + dage + uger + min + d + Senere i dag + I morgen + I dag + I går + diff --git a/shared/src/main/res/values-de-rDE/strings.xml b/shared/src/main/res/values-de-rDE/strings.xml new file mode 100644 index 0000000000..8c95db789a --- /dev/null +++ b/shared/src/main/res/values-de-rDE/strings.xml @@ -0,0 +1,22 @@ + + + + vor %1$d Min. + vor %1$d Minuten + vor %1$.1f Stunde + Std + Tage + Stunden + Sekunde + Minute + Stunde + Tag + Woche + Sekunden + Minuten + Stunden + Tage + Wochen + min + d + diff --git a/shared/src/main/res/values-el-rGR/strings.xml b/shared/src/main/res/values-el-rGR/strings.xml new file mode 100644 index 0000000000..960d69de0d --- /dev/null +++ b/shared/src/main/res/values-el-rGR/strings.xml @@ -0,0 +1,18 @@ + + + + h + ημέρες + ώρες + δευτερόλεπτο + λεπτό + ώρα + ημέρα + εβδομάδα + δευτερόλεπτα + λεπτά + ώρες + ημέρες + εβδομάδες + m + diff --git a/shared/src/main/res/values-es-rES/strings.xml b/shared/src/main/res/values-es-rES/strings.xml new file mode 100644 index 0000000000..a0f0767587 --- /dev/null +++ b/shared/src/main/res/values-es-rES/strings.xml @@ -0,0 +1,30 @@ + + + + hace %1$d m + Hace %1$d minutos + hace %1$.1f h + Hace %1$.1f día + Hace %1$.0f días + en %1$.0f días + en %1$.0f días + h + días + horas + segundo + minuto + hora + día + semana + segundos + minutos + horas + días + semanas + m + d + Más tarde hoy + Mañana + Hoy + Ayer + diff --git a/shared/src/main/res/values-fr-rFR/strings.xml b/shared/src/main/res/values-fr-rFR/strings.xml new file mode 100644 index 0000000000..67db8a5129 --- /dev/null +++ b/shared/src/main/res/values-fr-rFR/strings.xml @@ -0,0 +1,30 @@ + + + + il y a %1$d m + Il y a %1$d minutes + il y a %1$.1f h + Il y a %1$.1f jours + Il y a %1$.0f jours + en %1$.0f jours + en %1$.0f jours + h + jours + heures + seconde + minute + heure + jour + semaine + secondes + minutes + heures + jours + semaines + m + j + Plus tard aujourd\'hui + Demain + Aujourd’hui + Hier + diff --git a/shared/src/main/res/values-ga-rIE/strings.xml b/shared/src/main/res/values-ga-rIE/strings.xml new file mode 100644 index 0000000000..8d4df752e5 --- /dev/null +++ b/shared/src/main/res/values-ga-rIE/strings.xml @@ -0,0 +1,21 @@ + + + + %1$d nóim ó shin + %1$.1f u ó shin + u + + uair + soicind + nóiméad + uair + + seachtain + soicind + nóiméad + uair + + seachtaine + n + + diff --git a/shared/src/main/res/values-hr-rHR/strings.xml b/shared/src/main/res/values-hr-rHR/strings.xml new file mode 100644 index 0000000000..554d7a16e3 --- /dev/null +++ b/shared/src/main/res/values-hr-rHR/strings.xml @@ -0,0 +1,4 @@ + + + + diff --git a/shared/src/main/res/values-hu-rHU/strings.xml b/shared/src/main/res/values-hu-rHU/strings.xml new file mode 100644 index 0000000000..875ac03d58 --- /dev/null +++ b/shared/src/main/res/values-hu-rHU/strings.xml @@ -0,0 +1,6 @@ + + + + p + n + diff --git a/shared/src/main/res/values-it-rIT/strings.xml b/shared/src/main/res/values-it-rIT/strings.xml new file mode 100644 index 0000000000..28f5292504 --- /dev/null +++ b/shared/src/main/res/values-it-rIT/strings.xml @@ -0,0 +1,30 @@ + + + + %1$d m fa + %1$d minuti fa + %1$.1f h fa + %1$.1f giorni fa + %1$.0f giorni fa + in %1$.0f giorni + in %1$.0f giorni + h + giorni + ore + secondi + minuti + ora + giorno + settimana + secondi + minuti + ore + giorni + settimane + m + d + Più tardì oggi + Domani + Oggi + Ieri + diff --git a/shared/src/main/res/values-iw-rIL/strings.xml b/shared/src/main/res/values-iw-rIL/strings.xml new file mode 100644 index 0000000000..554d7a16e3 --- /dev/null +++ b/shared/src/main/res/values-iw-rIL/strings.xml @@ -0,0 +1,4 @@ + + + + diff --git a/shared/src/main/res/values-ko-rKR/strings.xml b/shared/src/main/res/values-ko-rKR/strings.xml new file mode 100644 index 0000000000..be3ce93a16 --- /dev/null +++ b/shared/src/main/res/values-ko-rKR/strings.xml @@ -0,0 +1,21 @@ + + + + %1$d 분 전 + %1$.1f 시간 전 + 시간 + + 시간 + + + + + + + + + + + + + diff --git a/shared/src/main/res/values-lt-rLT/strings.xml b/shared/src/main/res/values-lt-rLT/strings.xml new file mode 100644 index 0000000000..bb053b1723 --- /dev/null +++ b/shared/src/main/res/values-lt-rLT/strings.xml @@ -0,0 +1,21 @@ + + + + prieš %1$d min + Prieš %1$.1f val. + val + d. + val. + sek. + min. + val. + d. + savaitė + sekundės + min. + val. + d. + savaičių + min. + d + diff --git a/shared/src/main/res/values-nl-rNL/strings.xml b/shared/src/main/res/values-nl-rNL/strings.xml new file mode 100644 index 0000000000..554d7a16e3 --- /dev/null +++ b/shared/src/main/res/values-nl-rNL/strings.xml @@ -0,0 +1,4 @@ + + + + diff --git a/shared/src/main/res/values-no-rNO/strings.xml b/shared/src/main/res/values-no-rNO/strings.xml new file mode 100644 index 0000000000..6cdad44084 --- /dev/null +++ b/shared/src/main/res/values-no-rNO/strings.xml @@ -0,0 +1,30 @@ + + + + %1$d min siden + %1$d minutter siden + %1$.1f timer siden + %1$.1f dager siden + %1$.0f dager siden + om %1$.0f dager + om %1$.0f dager + t + dager + timer + sekund + minutt + time + dag + uke + sekunder + minutter + timer + dager + uker + m + d + Senere i dag + I morgen + Idag + I går + diff --git a/shared/src/main/res/values-pl-rPL/strings.xml b/shared/src/main/res/values-pl-rPL/strings.xml new file mode 100644 index 0000000000..52ab7af39b --- /dev/null +++ b/shared/src/main/res/values-pl-rPL/strings.xml @@ -0,0 +1,29 @@ + + + + %1$d min temu + %1$.1f godz. temu + %1$.1f dni temu + %1$.0f dni temu + za %1$.0f dni + za %1$.0f dni + h + dni + godzin + sekunda + minuta + godzina + dzień + tydzień + sekund + minut + godzin + dni + tygodni + m + d + Dzisiaj, później + Jutro + Dziś + Wczoraj + diff --git a/shared/src/main/res/values-pt-rBR/strings.xml b/shared/src/main/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000000..91d8dc0119 --- /dev/null +++ b/shared/src/main/res/values-pt-rBR/strings.xml @@ -0,0 +1,22 @@ + + + + %1$d min atrás + %1$d minutos atrás + %1$.1fh atrás + %1$d dias atrás + h + dias + horas + segundo + minuto + hora + dia + semana + segundos + minutos + horas + dias + semanas + m + diff --git a/shared/src/main/res/values-pt-rPT/strings.xml b/shared/src/main/res/values-pt-rPT/strings.xml new file mode 100644 index 0000000000..b6194783ad --- /dev/null +++ b/shared/src/main/res/values-pt-rPT/strings.xml @@ -0,0 +1,21 @@ + + + + %1$d m atrás + %1$.1f h atrás + h + dias + horas + segundo + minuto + hora + dia + semana + segundos + minutos + horas + dias + semanas + m + d + diff --git a/shared/src/main/res/values-ro-rRO/strings.xml b/shared/src/main/res/values-ro-rRO/strings.xml new file mode 100644 index 0000000000..025c5d22c6 --- /dev/null +++ b/shared/src/main/res/values-ro-rRO/strings.xml @@ -0,0 +1,21 @@ + + + + %1$d min în urmă + %1$.1f ore în urmă + h + zile + ore + secundă + minut + oră + zi + săptămână + secunde + minute + ore + zile + săptămâni + min + z + diff --git a/shared/src/main/res/values-ru-rRU/strings.xml b/shared/src/main/res/values-ru-rRU/strings.xml new file mode 100644 index 0000000000..823285bb86 --- /dev/null +++ b/shared/src/main/res/values-ru-rRU/strings.xml @@ -0,0 +1,30 @@ + + + + %1$d мин. назад + %1$d минут назад + %1$.1fч. назад + %1$s дн назад + %1$s дн назад + через %1$.0f дн + через %1$.0f дн + ч + дн + час + сек + мин + час + дн + нед + сек + мин + час + дн + нед + мин + дн + Позднее сегодня + Завтра + Cегодня + Вчера + diff --git a/shared/src/main/res/values-sk-rSK/strings.xml b/shared/src/main/res/values-sk-rSK/strings.xml new file mode 100644 index 0000000000..3371a5e805 --- /dev/null +++ b/shared/src/main/res/values-sk-rSK/strings.xml @@ -0,0 +1,30 @@ + + + + pred %1$d min + pred %1$d minútami + pred %1$.1f h + Pred %1$.1f dňami + Pred %1$.0f dňami + za %1$.0f dní + za %1$.0f dní + h + dní + hodín + sekunda + minúta + hodina + deň + týždeň + sekúnd + minút + hodín + dní + týždňov + m + d + Neskôr počas dňa + Zajtra + Dnes + včera + diff --git a/shared/src/main/res/values-sv-rSE/strings.xml b/shared/src/main/res/values-sv-rSE/strings.xml new file mode 100644 index 0000000000..df1d98aae8 --- /dev/null +++ b/shared/src/main/res/values-sv-rSE/strings.xml @@ -0,0 +1,22 @@ + + + + %1$dm sedan + %1$d minuter sedan + %1$.1f tim sedan + h + dagar + timmar + sekund + minut + timme + dag + vecka + sekunder + minuter + timmar + dagar + veckor + m + d + diff --git a/shared/src/main/res/values-tr-rTR/strings.xml b/shared/src/main/res/values-tr-rTR/strings.xml new file mode 100644 index 0000000000..b457090d83 --- /dev/null +++ b/shared/src/main/res/values-tr-rTR/strings.xml @@ -0,0 +1,30 @@ + + + + %1$d dak önce + %1$d dakika önce + %1$.1f s önce + %1$.1f gün önce + %1$.0f gün önce + %1$.0f gün içinde + %1$.0f gün içinde + s + gün + saat + saniye + dakika + saat + gün + hafta + saniye + dakika + saat + gün + hafta + dk + g + Bugünden sonra + Yarın + Bugün + Dün + diff --git a/shared/src/main/res/values-zh-rCN/strings.xml b/shared/src/main/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000000..2619d4b612 --- /dev/null +++ b/shared/src/main/res/values-zh-rCN/strings.xml @@ -0,0 +1,30 @@ + + + + %1$d 分钟前 + %1$d 分钟前 + %1$.1f 小时前 + %1$.1f 天前 + %1$.0f 天前 + 在 %1$.0f 天内 + 在 %1$.0f 天内 + h + + 小时 + + 分钟 + 小时 + + + + 分钟 + 小时 + + + m + d + 今天稍后 + 明天 + 今天 + 昨天 + diff --git a/wear/src/main/res/values-fr-rFR/strings.xml b/wear/src/main/res/values-fr-rFR/strings.xml index 9073bec2ef..645f5d699b 100644 --- a/wear/src/main/res/values-fr-rFR/strings.xml +++ b/wear/src/main/res/values-fr-rFR/strings.xml @@ -168,6 +168,8 @@ Aucune configuration disponible Contrôles Wear désactivés Aucune donnée disponible + augmenter + diminuer H B moy @@ -175,6 +177,7 @@ --g -.-- U/h Téléchargement : ---% + aucun statut Il y a -- minutes --- mg/dl Aucun statut de la boucle From 1bbb779d254a988b6fb4208e47b77afc3a082e3a Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Mon, 13 Jun 2022 13:28:44 +0200 Subject: [PATCH 36/42] translation add missing modules --- crowdin.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crowdin.yml b/crowdin.yml index ec9551d875..61f98bf0b8 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -19,6 +19,8 @@ files: translation: /combo/src/main/res/values-%android_code%/strings.xml - source: /dana/src/main/res/values/strings.xml translation: /dana/src/main/res/values-%android_code%/strings.xml + - source: /danar/src/main/res/values/strings.xml + translation: /danar/src/main/res/values-%android_code%/strings.xml - source: /medtronic/src/main/res/values/strings.xml translation: /medtronic/src/main/res/values-%android_code%/strings.xml - source: /omnipod-common/src/main/res/values/strings.xml @@ -43,6 +45,8 @@ files: translation: /automation/src/main/res/values-%android_code%/strings.xml - source: /diaconn/src/main/res/values/strings.xml translation: /diaconn/src/main/res/values-%android_code%/strings.xml + - source: /pump-common/src/main/res/values/strings.xml + translation: /pump-common/src/main/res/values-%android_code%/strings.xml - source: /openhumans/src/main/res/values/strings.xml translation: /openhumans/src/main/res/values-%android_code%/strings.xml translate_attributes: 0 From ee717ff36fea419c406a331048b3758308ffc563 Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Mon, 13 Jun 2022 14:06:07 +0200 Subject: [PATCH 37/42] fix: status light text color --- .../androidaps/plugins/general/overview/StatusLightHandler.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt index 11de792fbd..04095b64a8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.general.overview -import android.graphics.Color import android.widget.TextView import androidx.annotation.StringRes import info.nightscout.androidaps.R @@ -97,7 +96,7 @@ class StatusLightHandler @Inject constructor( if (level > OmnipodConstants.MAX_RESERVOIR_READING) { @Suppress("SetTextI18n") view?.text = " 50+$units" - view?.setTextColor(Color.WHITE) + view?.setTextColor(rh.gac(view.context, R.attr.defaultTextColor)) } else { handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units) } From 6afd2678f1c7900c0ff160af426047205a53ca11 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 15:35:09 +0200 Subject: [PATCH 38/42] move test code --- .../versionChecker/AllowedVersionsTest.kt | 53 ++++++++++++++++--- .../versionChecker/AllowedVersions.kt | 34 ------------ 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersionsTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersionsTest.kt index 1b14ba64d0..37fe08b20a 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersionsTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersionsTest.kt @@ -1,16 +1,52 @@ package info.nightscout.androidaps.plugins.constraints.versionChecker -import org.joda.time.DateTime import org.joda.time.LocalDate -import org.junit.Assert -import org.junit.Assert.* +import org.json.JSONArray +import org.json.JSONObject +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue import org.junit.Test class AllowedVersionsTest { + fun generateSupportedVersions(): String = + JSONArray() + // Android API versions + .put(JSONObject().apply { + put("minAndroid", 1) // 1.0 + put("maxAndroid", 23) // 6.0.1 + }) + .put(JSONObject().apply { + put("minAndroid", 24) // 7.0 + put("maxAndroid", 25) // 7.1.2 + put("supported", "2.6.2") + }) + .put(JSONObject().apply { + put("minAndroid", 26) // 8.0 + put("maxAndroid", 27) // 8.1 + put("supported", "2.8.2") + }) + .put(JSONObject().apply { + put("minAndroid", 28) // 9.0 + put("maxAndroid", 99) + put("supported", "2.8.2") + }) + // Version time limitation + .put(JSONObject().apply { + put("endDate", "2021-11-07") + put("version", "2.9.0-beta1") + }) + .put(JSONObject().apply { + put("endDate", "2021-11-07") + put("version", "3.0-beta1") + }) + .toString() + @Test fun generateSupportedVersionsTest() { - val definition = AllowedVersions().generateSupportedVersions() + val definition = generateSupportedVersions() assertNull(AllowedVersions().findByApi(definition, 0)) assertFalse(AllowedVersions().findByApi(definition, 1)?.has("supported") ?: true) assertFalse(AllowedVersions().findByApi(definition, 23)?.has("supported") ?: true) @@ -24,9 +60,10 @@ class AllowedVersionsTest { @Test fun findByVersionTest() { //val definition = AllowedVersions().generateSupportedVersions() - val definition = "[{\"minAndroid\":1,\"maxAndroid\":23},{\"minAndroid\":24,\"maxAndroid\":25,\"supported\":\"2.6.2\"},{\"minAndroid\":26,\"maxAndroid\":27,\"supported\":\"2.8.2\"},{\"minAndroid\":28,\"maxAndroid\":99,\"supported\":\"2.8.2\"},{\"endDate\":\"2021-11-07\",\"version\":\"2.9.0-beta1\"},{\"endDate\":\"2021-11-02\",\"version\":\"3.0-beta1\"},{\"endDate\":\"2021-11-04\",\"version\":\"3.0-beta2\"},{\"endDate\":\"2021-11-10\",\"version\":\"3.0-beta3\"},{\"endDate\":\"2021-11-14\",\"version\":\"3.0-beta4\"}\n" + - " ,{\"endDate\":\"2021-11-16\",\"version\":\"3.0-beta5\"}\n" + - "]" + val definition = + "[{\"minAndroid\":1,\"maxAndroid\":23},{\"minAndroid\":24,\"maxAndroid\":25,\"supported\":\"2.6.2\"},{\"minAndroid\":26,\"maxAndroid\":27,\"supported\":\"2.8.2\"},{\"minAndroid\":28,\"maxAndroid\":99,\"supported\":\"2.8.2\"},{\"endDate\":\"2021-11-07\",\"version\":\"2.9.0-beta1\"},{\"endDate\":\"2021-11-02\",\"version\":\"3.0-beta1\"},{\"endDate\":\"2021-11-04\",\"version\":\"3.0-beta2\"},{\"endDate\":\"2021-11-10\",\"version\":\"3.0-beta3\"},{\"endDate\":\"2021-11-14\",\"version\":\"3.0-beta4\"}\n" + + " ,{\"endDate\":\"2021-11-16\",\"version\":\"3.0-beta5\"}\n" + + "]" assertNull(AllowedVersions().findByVersion(definition, "2.6.0")) assertTrue(AllowedVersions().findByVersion(definition, "2.9.0-beta1")?.has("endDate") ?: false) assertEquals("2021-11-07", AllowedVersions().findByVersion(definition, "2.9.0-beta1")?.getString("endDate")) @@ -34,7 +71,7 @@ class AllowedVersionsTest { @Test fun endDateToMilliseconds() { - val definition = AllowedVersions().generateSupportedVersions() + val definition = generateSupportedVersions() val endDate = AllowedVersions().endDateToMilliseconds(AllowedVersions().findByVersion(definition, "2.9.0-beta1")?.getString("endDate") ?: "1000/01/01") val dateTime = LocalDate(endDate) assertEquals(2021, dateTime.year) diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersions.kt b/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersions.kt index 6d6c1e945a..9cf779cfe2 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersions.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/AllowedVersions.kt @@ -4,43 +4,9 @@ import org.joda.time.LocalDate import org.json.JSONArray import org.json.JSONException import org.json.JSONObject -import java.lang.Exception class AllowedVersions { - fun generateSupportedVersions(): String = - JSONArray() - // Android API versions - .put(JSONObject().apply { - put("minAndroid", 1) // 1.0 - put("maxAndroid", 23) // 6.0.1 - }) - .put(JSONObject().apply { - put("minAndroid", 24) // 7.0 - put("maxAndroid", 25) // 7.1.2 - put("supported", "2.6.2") - }) - .put(JSONObject().apply { - put("minAndroid", 26) // 8.0 - put("maxAndroid", 27) // 8.1 - put("supported", "2.8.2") - }) - .put(JSONObject().apply { - put("minAndroid", 28) // 9.0 - put("maxAndroid", 99) - put("supported", "2.8.2") - }) - // Version time limitation - .put(JSONObject().apply { - put("endDate", "2021-11-07") - put("version", "2.9.0-beta1") - }) - .put(JSONObject().apply { - put("endDate", "2021-11-07") - put("version", "3.0-beta1") - }) - .toString() - fun findByApi(definition: String?, api: Int): JSONObject? { if (definition == null) return null try { From a3fb086912f5a07717b3989c3d0c8a406b6b9423 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 15:58:39 +0200 Subject: [PATCH 39/42] Data: fir threading --- .../nightscout/androidaps/queue/CommandQueueImplementation.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt index 918643c8ce..bbfbd91d31 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt @@ -327,7 +327,7 @@ class CommandQueueImplementation @Inject constructor( } removeAll(CommandType.BOLUS) removeAll(CommandType.SMB_BOLUS) - Thread { activePlugin.activePump.stopBolusDelivering() }.run() + Thread { activePlugin.activePump.stopBolusDelivering() }.start() } // returns true if command is queued From 9995be702cda1448c0837e3aa6c74e13cc3d075e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 17:17:54 +0200 Subject: [PATCH 40/42] WizardDialog: move calculation out of main thread --- .../androidaps/dialogs/WizardDialog.kt | 65 +++++++++++-------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt index 5b5d56f93e..c234ef63a2 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -3,6 +3,8 @@ package info.nightscout.androidaps.dialogs import android.annotation.SuppressLint import android.content.Context import android.os.Bundle +import android.os.Handler +import android.os.HandlerThread import android.text.Editable import android.text.TextWatcher import android.view.LayoutInflater @@ -24,6 +26,7 @@ import info.nightscout.androidaps.database.ValueWrapper import info.nightscout.androidaps.databinding.DialogWizardBinding import info.nightscout.androidaps.events.EventAutosensCalculationFinished import info.nightscout.androidaps.extensions.formatColor +import info.nightscout.androidaps.extensions.runOnUiThread import info.nightscout.androidaps.extensions.toVisibility import info.nightscout.androidaps.extensions.valueToUnits import info.nightscout.androidaps.interfaces.* @@ -63,6 +66,8 @@ class WizardDialog : DaggerDialogFragment() { @Inject lateinit var dateUtil: DateUtil @Inject lateinit var protectionCheck: ProtectionCheck + private val handler = Handler(HandlerThread(this::class.simpleName + "Handler").also { it.start() }.looper) + private var queryingProtection = false private var wizard: BolusWizard? = null private var calculatedPercentage = 100.0 @@ -168,7 +173,7 @@ class WizardDialog : DaggerDialogFragment() { savedInstanceState?.getDouble("carb_time_input") ?: 0.0, -60.0, 60.0, 5.0, DecimalFormat("0"), false, binding.okcancel.ok, timeTextWatcher ) - initDialog() + handler.post { initDialog() } calculatedPercentage = sp.getInt(R.string.key_boluswizard_percentage, 100).toDouble() binding.percentUsed.text = rh.gs(R.string.format_percent, sp.getInt(R.string.key_boluswizard_percentage, 100)) // ok button @@ -257,6 +262,7 @@ class WizardDialog : DaggerDialogFragment() { override fun onDestroyView() { super.onDestroyView() disposable.clear() + handler.removeCallbacksAndMessages(null) _binding = null } @@ -323,14 +329,9 @@ class WizardDialog : DaggerDialogFragment() { else DecimalFormatter.to1Decimal(value * Constants.MGDL_TO_MMOLL) private fun initDialog() { - if (carbsPassedIntoWizard != 0.0) { - binding.carbsInput.value = carbsPassedIntoWizard - } - if (notesPassedIntoWizard.isNotBlank()) { - binding.notesLayout.notes.setText(notesPassedIntoWizard) - } val profile = profileFunction.getProfile() val profileStore = activePlugin.activeProfileSource.profile + val tempTarget = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet() if (profile == null || profileStore == null) { ToastUtils.showToastInUiThread(ctx, rh.gs(R.string.noprofile)) @@ -338,32 +339,40 @@ class WizardDialog : DaggerDialogFragment() { return } - val profileList: ArrayList = profileStore.getProfileList() - profileList.add(0, rh.gs(R.string.active)) - context?.let { context -> - binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList)) - binding.profileList.setText(profileList[0], false) - } - - val units = profileFunction.getUnits() - binding.bgUnits.text = units.asText - binding.bgInput.step = if (units == GlucoseUnit.MGDL) 1.0 else 0.1 - - // Set BG if not old - binding.bgInput.value = iobCobCalculator.ads.actualBg()?.valueToUnits(units) ?: 0.0 - - binding.ttCheckbox.isEnabled = repository.getTemporaryTargetActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing - binding.ttCheckboxIcon.visibility = binding.ttCheckbox.isEnabled.toVisibility() - // IOB calculation val bolusIob = iobCobCalculator.calculateIobFromBolus().round() val basalIob = iobCobCalculator.calculateIobFromTempBasalsIncludingConvertedExtended().round() - binding.iobInsulin.text = rh.gs(R.string.formatinsulinunits, -bolusIob.iob - basalIob.basaliob) + runOnUiThread { + if (carbsPassedIntoWizard != 0.0) { + binding.carbsInput.value = carbsPassedIntoWizard + } + if (notesPassedIntoWizard.isNotBlank()) { + binding.notesLayout.notes.setText(notesPassedIntoWizard) + } - calculateInsulin() + val profileList: ArrayList = profileStore.getProfileList() + profileList.add(0, rh.gs(R.string.active)) + context?.let { context -> + binding.profileList.setAdapter(ArrayAdapter(context, R.layout.spinner_centered, profileList)) + binding.profileList.setText(profileList[0], false) + } - binding.percentUsed.visibility = (sp.getInt(R.string.key_boluswizard_percentage, 100) != 100 || correctionPercent).toVisibility() + val units = profileFunction.getUnits() + binding.bgUnits.text = units.asText + binding.bgInput.step = if (units == GlucoseUnit.MGDL) 1.0 else 0.1 + + // Set BG if not old + binding.bgInput.value = iobCobCalculator.ads.actualBg()?.valueToUnits(units) ?: 0.0 + + binding.ttCheckbox.isEnabled = tempTarget is ValueWrapper.Existing + binding.ttCheckboxIcon.visibility = binding.ttCheckbox.isEnabled.toVisibility() + binding.iobInsulin.text = rh.gs(R.string.formatinsulinunits, -bolusIob.iob - basalIob.basaliob) + + calculateInsulin() + + binding.percentUsed.visibility = (sp.getInt(R.string.key_boluswizard_percentage, 100) != 100 || correctionPercent).toVisibility() + } } @SuppressLint("SetTextI18n") @@ -496,7 +505,7 @@ class WizardDialog : DaggerDialogFragment() { override fun onResume() { super.onResume() - if(!queryingProtection) { + if (!queryingProtection) { queryingProtection = true activity?.let { activity -> val cancelFail = { From 1932966a637042e57c3ccbaee25cb17d9e991f59 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 17:50:31 +0200 Subject: [PATCH 41/42] do not export activities --- app/src/main/AndroidManifest.xml | 102 ++++++++++++++-------- core/src/main/AndroidManifest.xml | 9 +- dana/src/main/AndroidManifest.xml | 5 +- danars/src/main/AndroidManifest.xml | 6 +- diaconn/src/main/AndroidManifest.xml | 9 +- insight/src/main/AndroidManifest.xml | 6 +- medtronic/src/main/AndroidManifest.xml | 12 ++- omnipod-dash/src/main/AndroidManifest.xml | 19 ++-- omnipod-eros/src/main/AndroidManifest.xml | 19 ++-- rileylink/src/main/AndroidManifest.xml | 12 +-- 10 files changed, 129 insertions(+), 70 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8cb2f771fb..8fb0dea2f6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + @@ -47,7 +46,7 @@ android:restoreAnyVersion="true" android:roundIcon="${appIconRound}" android:supportsRtl="true" - android:theme="@style/AppTheme.Launcher" > + android:theme="@style/AppTheme.Launcher"> + android:exported="true"> @@ -82,69 +81,86 @@ android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc" /> - + + - - + + - - - - - - + android:name=".receivers.DataReceiver" + android:enabled="true" + android:exported="true"> - + - + - + - + - + - + - + + android:name=".receivers.SmsReceiver" + android:enabled="true" + android:exported="true" + android:permission="android.permission.BROADCAST_SMS"> - + @@ -211,15 +227,23 @@ + android:exported="false" + android:label="@string/title_activity_setup_wizard" + android:theme="@style/AppTheme" /> - - - + + + @@ -227,7 +251,9 @@ - + diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml index 6cd58651e5..0f37944ddb 100644 --- a/core/src/main/AndroidManifest.xml +++ b/core/src/main/AndroidManifest.xml @@ -8,14 +8,17 @@ - - + + diff --git a/dana/src/main/AndroidManifest.xml b/dana/src/main/AndroidManifest.xml index af4b1f4b1e..3960154ebf 100644 --- a/dana/src/main/AndroidManifest.xml +++ b/dana/src/main/AndroidManifest.xml @@ -1,12 +1,13 @@ - + diff --git a/danars/src/main/AndroidManifest.xml b/danars/src/main/AndroidManifest.xml index c0a4377e25..c3ef8bc727 100644 --- a/danars/src/main/AndroidManifest.xml +++ b/danars/src/main/AndroidManifest.xml @@ -6,7 +6,9 @@ - + @@ -14,9 +16,11 @@ - + + android:exported="false" + android:theme="@style/AppTheme"> diff --git a/insight/src/main/AndroidManifest.xml b/insight/src/main/AndroidManifest.xml index d8d973e0b3..d125d192f6 100644 --- a/insight/src/main/AndroidManifest.xml +++ b/insight/src/main/AndroidManifest.xml @@ -6,19 +6,23 @@ + diff --git a/medtronic/src/main/AndroidManifest.xml b/medtronic/src/main/AndroidManifest.xml index 6c2ac78309..935c304195 100644 --- a/medtronic/src/main/AndroidManifest.xml +++ b/medtronic/src/main/AndroidManifest.xml @@ -1,15 +1,19 @@ - + - + - + diff --git a/omnipod-dash/src/main/AndroidManifest.xml b/omnipod-dash/src/main/AndroidManifest.xml index ee32e26eea..0408c54440 100644 --- a/omnipod-dash/src/main/AndroidManifest.xml +++ b/omnipod-dash/src/main/AndroidManifest.xml @@ -7,11 +7,18 @@ - - - - - + + + + + \ No newline at end of file diff --git a/omnipod-eros/src/main/AndroidManifest.xml b/omnipod-eros/src/main/AndroidManifest.xml index 02eb4fc2fa..b036e15038 100644 --- a/omnipod-eros/src/main/AndroidManifest.xml +++ b/omnipod-eros/src/main/AndroidManifest.xml @@ -1,15 +1,22 @@ - + - - - - + + + + \ No newline at end of file diff --git a/rileylink/src/main/AndroidManifest.xml b/rileylink/src/main/AndroidManifest.xml index 17c2a20a5e..684a90fcf6 100644 --- a/rileylink/src/main/AndroidManifest.xml +++ b/rileylink/src/main/AndroidManifest.xml @@ -12,9 +12,10 @@ - + @@ -23,8 +24,9 @@ + android:exported="false" + android:label="@string/title_activity_rileylink_settings" + android:theme="@style/AppTheme" /> From f980d2f73c27c7e2a7cb84123a733a490c086851 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 13 Jun 2022 18:56:13 +0200 Subject: [PATCH 42/42] SMS: set TT type correctly --- .../general/smsCommunicator/SmsCommunicatorPlugin.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt index 61021d55bc..311b1999fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.kt @@ -966,6 +966,7 @@ class SmsCommunicatorPlugin @Inject constructor( var keyTarget = 0 var defaultTargetMMOL = 0.0 var defaultTargetMGDL = 0.0 + var reason = TemporaryTarget.Reason.EATING_SOON when { isMeal -> { keyDuration = R.string.key_eatingsoon_duration @@ -973,6 +974,7 @@ class SmsCommunicatorPlugin @Inject constructor( keyTarget = R.string.key_eatingsoon_target defaultTargetMMOL = Constants.defaultEatingSoonTTmmol defaultTargetMGDL = Constants.defaultEatingSoonTTmgdl + reason = TemporaryTarget.Reason.EATING_SOON } isActivity -> { @@ -981,6 +983,7 @@ class SmsCommunicatorPlugin @Inject constructor( keyTarget = R.string.key_activity_target defaultTargetMMOL = Constants.defaultActivityTTmmol defaultTargetMGDL = Constants.defaultActivityTTmgdl + reason = TemporaryTarget.Reason.ACTIVITY } isHypo -> { @@ -989,6 +992,7 @@ class SmsCommunicatorPlugin @Inject constructor( keyTarget = R.string.key_hypo_target defaultTargetMMOL = Constants.defaultHypoTTmmol defaultTargetMGDL = Constants.defaultHypoTTmgdl + reason = TemporaryTarget.Reason.HYPOGLYCEMIA } } var ttDuration = sp.getInt(keyDuration, defaultTargetDuration) @@ -999,7 +1003,7 @@ class SmsCommunicatorPlugin @Inject constructor( disposable += repository.runTransactionForResult(InsertAndCancelCurrentTemporaryTargetTransaction( timestamp = dateUtil.now(), duration = TimeUnit.MINUTES.toMillis(ttDuration.toLong()), - reason = TemporaryTarget.Reason.EATING_SOON, + reason = reason, lowTarget = Profile.toMgdl(tt, profileFunction.getUnits()), highTarget = Profile.toMgdl(tt, profileFunction.getUnits()) )).subscribe({ result ->