diff --git a/app/build.gradle b/app/build.gradle
index fe6ce65442..20c70ab9b6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -25,12 +25,10 @@ jacoco {
}
ext {
- ormLiteVersion = "4.46"
powermockVersion = "1.7.3"
dexmakerVersion = "1.2"
retrofit2Version = '2.8.1'
- okhttp3Version = '4.5.0'
- coroutinesVersion = '1.3.5'
+ okhttp3Version = '4.6.0'
}
@@ -160,6 +158,7 @@ android {
}
firebaseDisable {
System.setProperty("disableFirebase", "true")
+ ext.enableCrashlytics = false
}
}
productFlavors {
@@ -242,12 +241,14 @@ allprojects {
dependencies {
wearApp project(':wear')
+ implementation project(':core')
+
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
implementation "com.google.android.gms:play-services-location:17.0.0"
- implementation 'com.google.firebase:firebase-core:17.3.0'
- implementation 'com.google.firebase:firebase-auth:19.3.0'
- implementation 'com.google.firebase:firebase-database:19.2.1'
+ implementation 'com.google.firebase:firebase-core:17.4.0'
+ implementation 'com.google.firebase:firebase-auth:19.3.1'
+ implementation 'com.google.firebase:firebase-database:19.3.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
@@ -260,7 +261,10 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
- implementation "androidx.preference:preference-ktx:1.1.0"
+ implementation "androidx.preference:preference-ktx:1.1.1"
+ implementation "androidx.activity:activity:${activityVersion}"
+ implementation "androidx.activity:activity-ktx:${activityVersion}"
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
@@ -271,12 +275,11 @@ dependencies {
implementation("com.github.tony19:logback-android-classic:1.1.1-6") {
exclude group: "com.google.android", module: "android"
}
- implementation "org.apache.commons:commons-lang3:3.9"
+ implementation 'org.apache.commons:commons-lang3:3.10'
implementation 'org.slf4j:slf4j-api:1.7.30'
// Graphview cannot be upgraded
implementation "com.jjoe64:graphview:4.0.1"
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2"
- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.madgag.spongycastle:core:1.58.0.0'
implementation(name: "com.atech-software.android.library.wizardpager-1.1.1", ext: "aar")
@@ -288,28 +291,28 @@ dependencies {
exclude group: "org.json", module: "json"
}
implementation "com.google.code.gson:gson:2.8.6"
- implementation ("com.google.guava:guava:24.1-jre") {
+ implementation('com.google.guava:guava:29.0-jre') {
exclude group: "com.google.code.findbugs", module: "jsr305"
}
implementation 'com.google.code.findbugs:jsr305:3.0.2'
- implementation "net.danlew:android.joda:2.10.3"
+ implementation 'net.danlew:android.joda:2.10.6'
- implementation 'org.mozilla:rhino:1.7.11'
+ implementation 'org.mozilla:rhino:1.7.12'
implementation 'com.github.DavidProdinger:weekdays-selector:1.1.0'
implementation 'com.github.kenglxn.QRGen:android:2.6.0'
implementation 'com.eatthepath:java-otp:0.2.0'
- testImplementation "junit:junit:4.12"
+ testImplementation "junit:junit:4.13"
testImplementation "org.json:json:20190722"
testImplementation "org.mockito:mockito-core:2.8.47"
testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
- testImplementation "joda-time:joda-time:2.10.5"
+ testImplementation 'joda-time:joda-time:2.10.6'
testImplementation('com.google.truth:truth:1.0.1') {
exclude group: "com.google.guava", module: "guava"
exclude group: "com.google.code.findbugs", module: "jsr305"
@@ -330,24 +333,24 @@ dependencies {
implementation "com.squareup.retrofit2:converter-gson:$retrofit2Version"
// Phone checker
- implementation 'com.scottyab:rootbeer-lib:0.0.7'
+ implementation 'com.scottyab:rootbeer-lib:0.0.8'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha03'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
- androidTestImplementation 'androidx.test:rules:1.3.0-alpha03'
+ androidTestImplementation 'androidx.test:rules:1.3.0-beta01'
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.2'
/* Dagger2 - We are going to use dagger.android which includes
* support for Activity and fragment injection so we need to include
* the following dependencies */
- implementation 'com.google.dagger:dagger-android:2.25.2'
- implementation 'com.google.dagger:dagger-android-support:2.25.2'
- annotationProcessor 'com.google.dagger:dagger-compiler:2.25.2'
- annotationProcessor 'com.google.dagger:dagger-android-processor:2.25.2'
- kapt 'com.google.dagger:dagger-android-processor:2.25.2'
+ implementation "com.google.dagger:dagger-android:$dagger_version"
+ implementation "com.google.dagger:dagger-android-support:$dagger_version"
+ annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
+ annotationProcessor "com.google.dagger:dagger-android-processor:$dagger_version"
+ kapt "com.google.dagger:dagger-android-processor:$dagger_version"
/* Dagger2 - default dependency */
- kapt 'com.google.dagger:dagger-compiler:2.25.2'
+ kapt "com.google.dagger:dagger-compiler:$dagger_version"
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
}
diff --git a/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt b/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt
index a327989975..9158c5f119 100644
--- a/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt
+++ b/app/src/androidTest/java/info/nightscout/androidaps/RealPumpTest.kt
@@ -8,11 +8,10 @@ import androidx.test.rule.GrantPermissionRule
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginType
-import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
+import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
import info.nightscout.androidaps.plugins.general.actions.ActionsPlugin
import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin
@@ -30,7 +29,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
-import org.slf4j.LoggerFactory
import javax.inject.Inject
@LargeTest
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c2724241a1..d2d419b0c0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -82,6 +82,7 @@
+
@@ -302,6 +303,17 @@
+
+
+
+
+
+
+
diff --git a/app/src/main/java/info/nightscout/androidaps/Config.java b/app/src/main/java/info/nightscout/androidaps/Config.java
deleted file mode 100644
index bb967cdeb6..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/Config.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package info.nightscout.androidaps;
-
-/**
- * Created by mike on 07.06.2016.
- */
-public class Config {
- public static int SUPPORTEDNSVERSION = 1002; // 0.10.00
-
- public static final boolean APS = BuildConfig.FLAVOR.equals("full");
-
- public static final boolean NSCLIENT = BuildConfig.FLAVOR.equals("nsclient") || BuildConfig.FLAVOR.equals("nsclient2");
- public static final boolean PUMPCONTROL = BuildConfig.FLAVOR.equals("pumpcontrol");
-
- public static final boolean PUMPDRIVERS = BuildConfig.FLAVOR.equals("full") || BuildConfig.FLAVOR.equals("pumpcontrol");
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/Config.kt b/app/src/main/java/info/nightscout/androidaps/Config.kt
new file mode 100644
index 0000000000..c5edf0c438
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/Config.kt
@@ -0,0 +1,15 @@
+package info.nightscout.androidaps
+
+import info.nightscout.androidaps.interfaces.ConfigInterface
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class Config @Inject constructor(): ConfigInterface{
+
+ override val SUPPORTEDNSVERSION = 1002 // 0.10.00
+ override val APS = BuildConfig.FLAVOR == "full"
+ override val NSCLIENT = BuildConfig.FLAVOR == "nsclient" || BuildConfig.FLAVOR == "nsclient2"
+ override val PUMPCONTROL = BuildConfig.FLAVOR == "pumpcontrol"
+ override val PUMPDRIVERS = BuildConfig.FLAVOR == "full" || BuildConfig.FLAVOR == "pumpcontrol"
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
index 778d2cf985..c78aaedaf5 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
@@ -41,11 +41,12 @@ import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
+import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
+import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
import info.nightscout.androidaps.setupwizard.SetupWizardActivity
-import info.nightscout.androidaps.utils.tabs.TabPageAdapter
import info.nightscout.androidaps.utils.AndroidPermission
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.LocaleHelper
@@ -53,11 +54,15 @@ import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.extensions.isRunningRealPumpTest
import info.nightscout.androidaps.utils.protection.ProtectionCheck
+import info.nightscout.androidaps.utils.resources.IconsProvider
import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP
+import info.nightscout.androidaps.utils.tabs.TabPageAdapter
+import info.nightscout.androidaps.utils.ui.UIRunnable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.activity_main.*
+import java.util.*
import javax.inject.Inject
import kotlin.system.exitProcess
@@ -77,6 +82,10 @@ class MainActivity : NoSplashAppCompatActivity() {
@Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var protectionCheck: ProtectionCheck
+ @Inject lateinit var iconsProvider: IconsProvider
+ @Inject lateinit var constraintChecker: ConstraintChecker
+ @Inject lateinit var signatureVerifierPlugin: SignatureVerifierPlugin
+ @Inject lateinit var config: Config
private lateinit var actionBarDrawerToggle: ActionBarDrawerToggle
private var pluginPreferencesMenuItem: MenuItem? = null
@@ -107,7 +116,7 @@ class MainActivity : NoSplashAppCompatActivity() {
//Check here if loop plugin is disabled. Else check via constraints
if (!loopPlugin.isEnabled(PluginType.LOOP)) versionCheckerUtils.triggerCheckVersion()
- fabricPrivacy.setUserStats()
+ setUserStats()
setupViews()
disposable.add(rxBus
.toObservable(EventRebuildTabs::class.java)
@@ -129,7 +138,7 @@ class MainActivity : NoSplashAppCompatActivity() {
}
androidPermission.notifyForStoragePermission(this)
androidPermission.notifyForBatteryOptimizationPermission(this)
- if (Config.PUMPDRIVERS) {
+ if (config.PUMPDRIVERS) {
androidPermission.notifyForLocationPermissions(this)
androidPermission.notifyForSMSPermissions(this, smsCommunicatorPlugin)
androidPermission.notifyForSystemWindowPermissions(this)
@@ -153,12 +162,9 @@ class MainActivity : NoSplashAppCompatActivity() {
override fun onResume() {
super.onResume()
protectionCheck.queryProtection(this, ProtectionCheck.Protection.APPLICATION, null,
- Runnable {
- OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() })
- },
- Runnable {
- OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() })
- })
+ UIRunnable(Runnable { OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() }) }),
+ UIRunnable(Runnable { OKDialog.show(this, "", resourceHelper.gs(R.string.authorizationfailed), Runnable { finish() }) })
+ )
}
private fun setWakeLock() {
@@ -190,6 +196,7 @@ class MainActivity : NoSplashAppCompatActivity() {
}
}
main_pager.adapter = pageAdapter
+ main_pager.offscreenPageLimit = 8 // This may cause more memory consumption
checkPluginPreferences(main_pager)
// Tabs
@@ -283,7 +290,7 @@ class MainActivity : NoSplashAppCompatActivity() {
Linkify.addLinks(messageSpanned, Linkify.WEB_URLS)
AlertDialog.Builder(this)
.setTitle(resourceHelper.gs(R.string.app_name) + " " + BuildConfig.VERSION)
- .setIcon(resourceHelper.getIcon())
+ .setIcon(iconsProvider.getIcon())
.setMessage(messageSpanned)
.setPositiveButton(resourceHelper.gs(R.string.ok), null)
.create().also {
@@ -323,4 +330,35 @@ class MainActivity : NoSplashAppCompatActivity() {
}
return actionBarDrawerToggle.onOptionsItemSelected(item)
}
+
+ // Correct place for calling setUserStats() would be probably MainApp
+ // but we need to have it called at least once a day. Thus this location
+
+ private fun setUserStats() {
+ if (!fabricPrivacy.fabricEnabled()) return
+ val closedLoopEnabled = if (constraintChecker.isClosedLoopAllowed().value()) "CLOSED_LOOP_ENABLED" else "CLOSED_LOOP_DISABLED"
+ // Size is limited to 36 chars
+ val remote = BuildConfig.REMOTE.toLowerCase(Locale.getDefault())
+ .replace("https://", "")
+ .replace("http://", "")
+ .replace(".git", "")
+ .replace(".com/", ":")
+ .replace(".org/", ":")
+ .replace(".net/", ":")
+ fabricPrivacy.firebaseAnalytics.setUserProperty("Mode", BuildConfig.APPLICATION_ID + "-" + closedLoopEnabled)
+ fabricPrivacy.firebaseAnalytics.setUserProperty("Language", sp.getString(R.string.key_language, Locale.getDefault().language))
+ fabricPrivacy.firebaseAnalytics.setUserProperty("Version", BuildConfig.VERSION)
+ fabricPrivacy.firebaseAnalytics.setUserProperty("HEAD", BuildConfig.HEAD)
+ fabricPrivacy.firebaseAnalytics.setUserProperty("Remote", remote)
+ val hashes: List = signatureVerifierPlugin.shortHashes()
+ if (hashes.isNotEmpty()) fabricPrivacy.firebaseAnalytics.setUserProperty("Hash", hashes[0])
+ activePlugin.activePump.let { fabricPrivacy.firebaseAnalytics.setUserProperty("Pump", it::class.java.simpleName) }
+ if (!config.NSCLIENT && !config.PUMPCONTROL)
+ activePlugin.activeAPS.let { fabricPrivacy.firebaseAnalytics.setUserProperty("Aps", it::class.java.simpleName) }
+ activePlugin.activeBgSource.let { fabricPrivacy.firebaseAnalytics.setUserProperty("BgSource", it::class.java.simpleName) }
+ fabricPrivacy.firebaseAnalytics.setUserProperty("Profile", activePlugin.activeProfileInterface.javaClass.simpleName)
+ activePlugin.activeSensitivity.let { fabricPrivacy.firebaseAnalytics.setUserProperty("Sensitivity", it::class.java.simpleName) }
+ activePlugin.activeInsulin.let { fabricPrivacy.firebaseAnalytics.setUserProperty("Insulin", it::class.java.simpleName) }
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java
index 66acee4016..85d8f83ed7 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java
@@ -14,14 +14,19 @@ import com.j256.ormlite.android.apptools.OpenHelperManager;
import net.danlew.android.joda.JodaTimeAndroid;
+import org.jetbrains.annotations.NotNull;
+
import java.util.List;
import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DaggerApplication;
+import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper;
+import info.nightscout.androidaps.db.StaticInjector;
import info.nightscout.androidaps.dependencyInjection.DaggerAppComponent;
+import info.nightscout.androidaps.interfaces.DatabaseHelperInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag;
@@ -40,7 +45,7 @@ import info.nightscout.androidaps.utils.ActivityMonitor;
import info.nightscout.androidaps.utils.LocaleHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
-public class MainApp extends DaggerApplication {
+public class MainApp extends DaggerApplication implements DatabaseHelperInterface {
static MainApp sInstance;
private static Resources sResources;
@@ -57,6 +62,8 @@ public class MainApp extends DaggerApplication {
@Inject KeepAliveReceiver.KeepAliveManager keepAliveManager;
@Inject List plugins;
+ @Inject StaticInjector staticInjector; // TODO remove , fake only to initialize
+
@Override
public void onCreate() {
super.onCreate();
@@ -166,4 +173,8 @@ public class MainApp extends DaggerApplication {
keepAliveManager.cancelAlarm(this);
super.onTerminate();
}
+
+ @NotNull @Override public List getAllBgreadingsDataFromTime(long mills, boolean ascending) {
+ return getDbHelper().getAllBgreadingsDataFromTime(mills, ascending);
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt
index b06276114d..0b8fc440ca 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt
@@ -22,7 +22,7 @@ import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
+import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.constraints.safety.SafetyPlugin
import info.nightscout.androidaps.plugins.general.automation.AutomationPlugin
import info.nightscout.androidaps.plugins.general.careportal.CareportalPlugin
@@ -41,6 +41,7 @@ import info.nightscout.androidaps.plugins.pump.danaRS.DanaRSPlugin
import info.nightscout.androidaps.plugins.pump.danaRv2.DanaRv2Plugin
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
+import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
@@ -66,6 +67,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
@Inject lateinit var sp: SP
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var pluginStore: PluginStore
+ @Inject lateinit var config: Config
@Inject lateinit var automationPlugin: AutomationPlugin
@Inject lateinit var danaRPlugin: DanaRPlugin
@@ -100,6 +102,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
@Inject lateinit var passwordCheck: PasswordCheck
@Inject lateinit var nsSettingStatus: NSSettingsStatus
+ // TODO why?
@Inject lateinit var androidInjector: DispatchingAndroidInjector
override fun androidInjector(): AndroidInjector = androidInjector
@@ -160,20 +163,20 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
addPreferencesFromResourceIfEnabled(poctechPlugin, rootKey)
addPreferencesFromResourceIfEnabled(glimpPlugin, rootKey)
addPreferencesFromResourceIfEnabled(careportalPlugin, rootKey)
- addPreferencesFromResourceIfEnabled(loopPlugin, rootKey, Config.APS)
- addPreferencesFromResourceIfEnabled(openAPSAMAPlugin, rootKey, Config.APS)
- addPreferencesFromResourceIfEnabled(openAPSSMBPlugin, rootKey, Config.APS)
+ addPreferencesFromResourceIfEnabled(loopPlugin, rootKey, config.APS)
+ addPreferencesFromResourceIfEnabled(openAPSAMAPlugin, rootKey, config.APS)
+ addPreferencesFromResourceIfEnabled(openAPSSMBPlugin, rootKey, config.APS)
addPreferencesFromResourceIfEnabled(sensitivityAAPSPlugin, rootKey)
addPreferencesFromResourceIfEnabled(sensitivityWeightedAveragePlugin, rootKey)
addPreferencesFromResourceIfEnabled(sensitivityOref1Plugin, rootKey)
- addPreferencesFromResourceIfEnabled(danaRPlugin, rootKey, Config.PUMPDRIVERS)
- addPreferencesFromResourceIfEnabled(danaRKoreanPlugin, rootKey, Config.PUMPDRIVERS)
- addPreferencesFromResourceIfEnabled(danaRv2Plugin, rootKey, Config.PUMPDRIVERS)
- addPreferencesFromResourceIfEnabled(danaRSPlugin, rootKey, Config.PUMPDRIVERS)
- addPreferencesFromResourceIfEnabled(localInsightPlugin, rootKey, Config.PUMPDRIVERS)
- addPreferencesFromResourceIfEnabled(comboPlugin, rootKey, Config.PUMPDRIVERS)
- addPreferencesFromResourceIfEnabled(medtronicPumpPlugin, rootKey, Config.PUMPDRIVERS)
- addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey, !Config.NSCLIENT)
+ addPreferencesFromResourceIfEnabled(danaRPlugin, rootKey, config.PUMPDRIVERS)
+ addPreferencesFromResourceIfEnabled(danaRKoreanPlugin, rootKey, config.PUMPDRIVERS)
+ addPreferencesFromResourceIfEnabled(danaRv2Plugin, rootKey, config.PUMPDRIVERS)
+ addPreferencesFromResourceIfEnabled(danaRSPlugin, rootKey, config.PUMPDRIVERS)
+ addPreferencesFromResourceIfEnabled(localInsightPlugin, rootKey, config.PUMPDRIVERS)
+ addPreferencesFromResourceIfEnabled(comboPlugin, rootKey, config.PUMPDRIVERS)
+ addPreferencesFromResourceIfEnabled(medtronicPumpPlugin, rootKey, config.PUMPDRIVERS)
+ addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey, !config.NSCLIENT)
addPreferencesFromResourceIfEnabled(insulinOrefFreePeakPlugin, rootKey)
addPreferencesFromResourceIfEnabled(nsClientPlugin, rootKey)
addPreferencesFromResourceIfEnabled(tidepoolPlugin, rootKey)
@@ -279,7 +282,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
}
for (plugin in pluginStore.plugins) {
- pref?.let { pref-> pref.getKey()?.let { plugin.updatePreferenceSummary(pref) }}
+ pref?.let { it.key?.let { plugin.updatePreferenceSummary(pref) }}
}
val hmacPasswords = arrayOf(
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
index 6ea91d443a..ca26266f8f 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/StatsActivity.kt
@@ -3,6 +3,7 @@ package info.nightscout.androidaps.activities
import android.os.Bundle
import info.nightscout.androidaps.R
import info.nightscout.androidaps.utils.ActivityMonitor
+import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.stats.TddCalculator
import info.nightscout.androidaps.utils.stats.TirCalculator
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
index 2a5e8bcecd..ff3e361a9b 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/SurveyActivity.kt
@@ -10,7 +10,7 @@ import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.interfaces.ActivePluginProvider
import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.logging.LTag
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
+import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.utils.ActivityMonitor
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.InstanceId
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java
index ae337b8e59..1cf80ed1ca 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java
@@ -39,7 +39,7 @@ import info.nightscout.androidaps.interfaces.CommandQueueProvider;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction;
+import info.nightscout.androidaps.interfaces.ProfileFunction;
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.pump.danaR.events.EventDanaRSyncStatus;
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin;
diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
index d1c63d284c..abc6df92c9 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
@@ -33,7 +33,7 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.data.NonOverlappingIntervals;
import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.data.ProfileStore;
+import info.nightscout.androidaps.interfaces.ProfileStore;
import info.nightscout.androidaps.events.EventCareportalEventChange;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventNewBG;
@@ -47,10 +47,9 @@ import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.logging.L;
+import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.logging.StacktraceLoggerWrapper;
import info.nightscout.androidaps.plugins.bus.RxBus;
-import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.configBuilder.PluginStore;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData;
import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes;
@@ -61,6 +60,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistory;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.utils.JsonHelper;
import info.nightscout.androidaps.utils.PercentageSplitter;
+import info.nightscout.androidaps.utils.T;
import info.nightscout.androidaps.utils.ToastUtils;
/**
@@ -72,7 +72,7 @@ import info.nightscout.androidaps.utils.ToastUtils;
* direct calls to the corresponding methods (eg. resetDatabases) should be done by a central service.
*/
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
- private static Logger log = StacktraceLoggerWrapper.getLogger(L.DATABASE);
+ private static Logger log = StacktraceLoggerWrapper.getLogger(LTag.DATABASE);
public static final String DATABASE_NAME = "AndroidAPSDb";
public static final String DATABASE_BGREADINGS = "BgReadings";
@@ -82,7 +82,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_DANARHISTORY = "DanaRHistory";
public static final String DATABASE_DBREQUESTS = "DBRequests";
public static final String DATABASE_CAREPORTALEVENTS = "CareportalEvents";
- public static final String DATABASE_PROFILESWITCHES = "ProfileSwitches";
public static final String DATABASE_TDDS = "TDDs";
public static final String DATABASE_INSIGHT_HISTORY_OFFSETS = "InsightHistoryOffsets";
public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs";
@@ -123,7 +122,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
@Override
public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
try {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.info("onCreate");
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
@@ -366,7 +365,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static long roundDateToSec(long date) {
long rounded = date - date % 1000;
if (rounded != date)
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Rounding " + date + " to " + rounded);
return rounded;
}
@@ -378,17 +377,17 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
BgReading old = getDaoBgReadings().queryForId(bgReading.date);
if (old == null) {
getDaoBgReadings().create(bgReading);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("BG: New record from: " + from + " " + bgReading.toString());
scheduleBgChange(bgReading);
return true;
}
if (!old.isEqual(bgReading)) {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("BG: Similiar found: " + old.toString());
old.copyFrom(bgReading);
getDaoBgReadings().update(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("BG: Updating record from: " + from + " New data: " + old.toString());
scheduleBgChange(bgReading);
return false;
@@ -411,7 +410,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static void scheduleBgChange(@Nullable final BgReading bgReading) {
class PostRunnable implements Runnable {
public void run() {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Firing EventNewBg");
RxBus.Companion.getINSTANCE().send(new EventNewBG(bgReading));
scheduledBgPost = null;
@@ -640,7 +639,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
getDaoTempTargets().delete(old); // need to delete/create because date may change too
old.copyFrom(tempTarget);
getDaoTempTargets().create(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPTARGET: Updating record by date from: " + Source.getString(tempTarget.source) + " " + old.toString());
scheduleTemporaryTargetChange();
return true;
@@ -660,7 +659,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
getDaoTempTargets().delete(old); // need to delete/create because date may change too
old.copyFrom(tempTarget);
getDaoTempTargets().create(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPTARGET: Updating record by _id from: " + Source.getString(tempTarget.source) + " " + old.toString());
scheduleTemporaryTargetChange();
return true;
@@ -668,14 +667,14 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
}
getDaoTempTargets().create(tempTarget);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPTARGET: New record from: " + Source.getString(tempTarget.source) + " " + tempTarget.toString());
scheduleTemporaryTargetChange();
return true;
}
if (tempTarget.source == Source.USER) {
getDaoTempTargets().create(tempTarget);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPTARGET: New record from: " + Source.getString(tempTarget.source) + " " + tempTarget.toString());
scheduleTemporaryTargetChange();
return true;
@@ -698,7 +697,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static void scheduleTemporaryTargetChange() {
class PostRunnable implements Runnable {
public void run() {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Firing EventTempTargetChange");
RxBus.Companion.getINSTANCE().send(new EventTempTargetChange());
scheduledTemTargetPost = null;
@@ -824,7 +823,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
List trList = getDaoTemporaryBasal().query(preparedQuery);
if (trList.size() > 0) {
// do nothing, pump history record cannot be changed
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: Already exists from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
return false;
}
@@ -842,7 +841,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
old.copyFromPump(tempBasal);
old.source = Source.PUMP;
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: Updated record with Pump Data : " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
getDaoTemporaryBasal().update(old);
@@ -854,7 +853,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
getDaoTemporaryBasal().create(tempBasal);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
updateEarliestDataChange(tempBasal.date);
scheduleTemporaryBasalChange();
@@ -872,7 +871,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
getDaoTemporaryBasal().delete(old); // need to delete/create because date may change too
old.copyFrom(tempBasal);
getDaoTemporaryBasal().create(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: Updating record by date from: " + Source.getString(tempBasal.source) + " " + old.toString());
updateEarliestDataChange(oldDate);
updateEarliestDataChange(old.date);
@@ -895,7 +894,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
getDaoTemporaryBasal().delete(old); // need to delete/create because date may change too
old.copyFrom(tempBasal);
getDaoTemporaryBasal().create(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: Updating record by _id from: " + Source.getString(tempBasal.source) + " " + old.toString());
updateEarliestDataChange(oldDate);
updateEarliestDataChange(old.date);
@@ -905,7 +904,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
}
getDaoTemporaryBasal().create(tempBasal);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
updateEarliestDataChange(tempBasal.date);
scheduleTemporaryBasalChange();
@@ -913,7 +912,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
if (tempBasal.source == Source.USER) {
getDaoTemporaryBasal().create(tempBasal);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: New record from: " + Source.getString(tempBasal.source) + " " + tempBasal.toString());
updateEarliestDataChange(tempBasal.date);
scheduleTemporaryBasalChange();
@@ -970,7 +969,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static void scheduleTemporaryBasalChange() {
class PostRunnable implements Runnable {
public void run() {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Firing EventTempBasalChange");
RxBus.Companion.getINSTANCE().send(new EventReloadTempBasalData());
RxBus.Companion.getINSTANCE().send(new EventTempBasalChange());
@@ -1065,7 +1064,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public void deleteTempBasalById(String _id) {
TemporaryBasal stored = findTempBasalById(_id);
if (stored != null) {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("TEMPBASAL: Removing TempBasal record from database: " + stored.toString());
delete(stored);
updateEarliestDataChange(stored.date);
@@ -1120,7 +1119,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public boolean createOrUpdate(ExtendedBolus extendedBolus) {
try {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("EXTENDEDBOLUS: createOrUpdate: " + Source.getString(extendedBolus.source) + " " + extendedBolus.log());
ExtendedBolus old;
@@ -1145,7 +1144,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
getDaoExtendedBolus().createOrUpdate(extendedBolus);
}
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.log());
updateEarliestDataChange(extendedBolus.date);
scheduleExtendedBolusChange();
@@ -1159,7 +1158,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
getDaoExtendedBolus().delete(old); // need to delete/create because date may change too
old.copyFrom(extendedBolus);
getDaoExtendedBolus().create(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("EXTENDEDBOLUS: Updating record by date from: " + Source.getString(extendedBolus.source) + " " + old.log());
updateEarliestDataChange(oldDate);
updateEarliestDataChange(old.date);
@@ -1182,7 +1181,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
getDaoExtendedBolus().delete(old); // need to delete/create because date may change too
old.copyFrom(extendedBolus);
getDaoExtendedBolus().create(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("EXTENDEDBOLUS: Updating record by _id from: " + Source.getString(extendedBolus.source) + " " + old.log());
updateEarliestDataChange(oldDate);
updateEarliestDataChange(old.date);
@@ -1192,7 +1191,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
}
getDaoExtendedBolus().create(extendedBolus);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.log());
updateEarliestDataChange(extendedBolus.date);
scheduleExtendedBolusChange();
@@ -1200,7 +1199,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
if (extendedBolus.source == Source.USER) {
getDaoExtendedBolus().create(extendedBolus);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("EXTENDEDBOLUS: New record from: " + Source.getString(extendedBolus.source) + " " + extendedBolus.log());
updateEarliestDataChange(extendedBolus.date);
scheduleExtendedBolusChange();
@@ -1249,10 +1248,26 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return new ArrayList();
}
+ public List getExtendedBolusDataFromTime(long from, long to, boolean ascending) {
+ try {
+ List extendedBoluses;
+ QueryBuilder queryBuilder = getDaoExtendedBolus().queryBuilder();
+ queryBuilder.orderBy("date", ascending);
+ Where where = queryBuilder.where();
+ where.between("date", from, to);
+ PreparedQuery preparedQuery = queryBuilder.prepare();
+ extendedBoluses = getDaoExtendedBolus().query(preparedQuery);
+ return extendedBoluses;
+ } catch (SQLException e) {
+ log.error("Unhandled exception", e);
+ }
+ return new ArrayList();
+ }
+
public void deleteExtendedBolusById(String _id) {
ExtendedBolus stored = findExtendedBolusById(_id);
if (stored != null) {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("EXTENDEDBOLUS: Removing ExtendedBolus record from database: " + stored.toString());
delete(stored);
updateEarliestDataChange(stored.date);
@@ -1306,7 +1321,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static void scheduleExtendedBolusChange() {
class PostRunnable implements Runnable {
public void run() {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Firing EventExtendedBolusChange");
RxBus.Companion.getINSTANCE().send(new EventReloadTreatmentData(new EventExtendedBolusChange()));
if (earliestDataChange != null)
@@ -1468,11 +1483,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
if (list.size() == 1) {
CareportalEvent record = list.get(0);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Removing CareportalEvent record from database: " + record.toString());
delete(record);
} else {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("CareportalEvent not found database: " + _id);
}
} catch (SQLException e) {
@@ -1492,12 +1507,12 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
if (list.size() == 0) {
careportalEvent = new CareportalEvent(MainApp.instance());
careportalEvent.source = Source.NIGHTSCOUT;
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Adding CareportalEvent record to database: " + trJson.toString());
// Record does not exists. add
} else if (list.size() == 1) {
careportalEvent = list.get(0);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Updating CareportalEvent record in database: " + trJson.toString());
} else {
log.error("Something went wrong");
@@ -1516,7 +1531,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static void scheduleCareportalEventChange() {
class PostRunnable implements Runnable {
public void run() {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Firing scheduleCareportalEventChange");
RxBus.Companion.getINSTANCE().send(new EventCareportalEventChange());
scheduledCareportalEventPost = null;
@@ -1629,7 +1644,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
profileSwitch.profileName = old.profileName; // preserver profileName to prevent multiple CPP extension
getDaoProfileSwitch().delete(old); // need to delete/create because date may change too
getDaoProfileSwitch().create(profileSwitch);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("PROFILESWITCH: Updating record by date from: " + Source.getString(profileSwitch.source) + " " + old.toString());
scheduleProfileSwitchChange();
return true;
@@ -1649,7 +1664,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
getDaoProfileSwitch().delete(old); // need to delete/create because date may change too
old.copyFrom(profileSwitch);
getDaoProfileSwitch().create(old);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("PROFILESWITCH: Updating record by _id from: " + Source.getString(profileSwitch.source) + " " + old.toString());
scheduleProfileSwitchChange();
return true;
@@ -1659,14 +1674,14 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// look for already added percentage from NS
profileSwitch.profileName = PercentageSplitter.pureName(profileSwitch.profileName);
getDaoProfileSwitch().create(profileSwitch);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
scheduleProfileSwitchChange();
return true;
}
if (profileSwitch.source == Source.USER) {
getDaoProfileSwitch().create(profileSwitch);
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
scheduleProfileSwitchChange();
return true;
@@ -1689,7 +1704,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static void scheduleProfileSwitchChange() {
class PostRunnable implements Runnable {
public void run() {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Firing EventProfileNeedsUpdate");
RxBus.Companion.getINSTANCE().send(new EventReloadProfileSwitchData());
RxBus.Companion.getINSTANCE().send(new EventProfileNeedsUpdate());
@@ -1741,17 +1756,17 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
Profile profile = store.getSpecificProfile(profileSwitch.profileName);
if (profile != null) {
profileSwitch.profileJson = profile.getData().toString();
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Profile switch prefilled with JSON from local store");
// Update data in NS
NSUpload.updateProfileSwitch(profileSwitch);
} else {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("JSON for profile switch doesn't exist. Ignoring: " + trJson.toString());
return;
}
} else {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("Store for profile switch doesn't exist. Ignoring: " + trJson.toString());
return;
}
@@ -1767,7 +1782,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public void deleteProfileSwitchById(String _id) {
ProfileSwitch stored = findProfileSwitchById(_id);
if (stored != null) {
- if (L.isEnabled(L.DATABASE))
+ if (L.isEnabled(LTag.DATABASE))
log.debug("PROFILESWITCH: Removing ProfileSwitch record from database: " + stored.toString());
delete(stored);
scheduleTemporaryTargetChange();
@@ -1886,4 +1901,52 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return new ArrayList<>();
}
+
+ // Copied from xDrip+
+ String calculateDirection(BgReading bgReading) {
+ // Rework to get bgreaings from internal DB and calculate on that base
+
+ List bgReadingsList = MainApp.getDbHelper().getAllBgreadingsDataFromTime(bgReading.date - T.mins(10).msecs(), false);
+ if (bgReadingsList == null || bgReadingsList.size() < 2)
+ return "NONE";
+ BgReading current = bgReadingsList.get(1);
+ BgReading previous = bgReadingsList.get(0);
+
+ if (bgReadingsList.get(1).date < bgReadingsList.get(0).date) {
+ current = bgReadingsList.get(0);
+ previous = bgReadingsList.get(1);
+ }
+
+ double slope;
+
+ // Avoid division by 0
+ if (current.date == previous.date)
+ slope = 0;
+ else
+ slope = (previous.value - current.value) / (previous.date - current.date);
+
+// aapsLogger.error(LTag.GLUCOSE, "Slope is :" + slope + " delta " + (previous.value - current.value) + " date difference " + (current.date - previous.date));
+
+ double slope_by_minute = slope * 60000;
+ String arrow = "NONE";
+
+ if (slope_by_minute <= (-3.5)) {
+ arrow = "DoubleDown";
+ } else if (slope_by_minute <= (-2)) {
+ arrow = "SingleDown";
+ } else if (slope_by_minute <= (-1)) {
+ arrow = "FortyFiveDown";
+ } else if (slope_by_minute <= (1)) {
+ arrow = "Flat";
+ } else if (slope_by_minute <= (2)) {
+ arrow = "FortyFiveUp";
+ } else if (slope_by_minute <= (3.5)) {
+ arrow = "SingleUp";
+ } else if (slope_by_minute <= (40)) {
+ arrow = "DoubleUp";
+ }
+// aapsLogger.error(LTag.GLUCOSE, "Direction set to: " + arrow);
+ return arrow;
+ }
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt
index d3fef14166..7315329ab2 100644
--- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/APSModule.kt
@@ -8,7 +8,7 @@ import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalAdapterAM
import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalResultAMA
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Thread
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread
diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt
index e7411ad56b..2f6d515b0e 100644
--- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt
@@ -6,6 +6,7 @@ import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.*
import info.nightscout.androidaps.historyBrowser.HistoryBrowseActivity
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
+import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity
import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEScanActivity
@@ -48,4 +49,5 @@ abstract class ActivitiesModule {
@ContributesAndroidInjector abstract fun contributesStatsActivity(): StatsActivity
@ContributesAndroidInjector abstract fun contributesSurveyActivity(): SurveyActivity
@ContributesAndroidInjector abstract fun contributesTDDStatsActivity(): TDDStatsActivity
+ @ContributesAndroidInjector abstract fun contributesPrefImportListActivity(): PrefImportListActivity
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt
index 91153bd867..1dec3bf9bb 100644
--- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt
@@ -5,54 +5,14 @@ import dagger.Component
import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector
import info.nightscout.androidaps.MainApp
-import info.nightscout.androidaps.data.Profile
-import info.nightscout.androidaps.data.ProfileStore
-import info.nightscout.androidaps.data.PumpEnactResult
-import info.nightscout.androidaps.db.BgReading
-import info.nightscout.androidaps.db.CareportalEvent
-import info.nightscout.androidaps.db.ProfileSwitch
-import info.nightscout.androidaps.db.TemporaryBasal
-import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback
-import info.nightscout.androidaps.plugins.aps.loop.APSResult
-import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalResultAMA
-import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
-import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
-import info.nightscout.androidaps.plugins.constraints.objectives.objectives.*
-import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
-import info.nightscout.androidaps.plugins.general.automation.actions.*
-import info.nightscout.androidaps.plugins.general.automation.elements.*
-import info.nightscout.androidaps.plugins.general.automation.triggers.*
-import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
-import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
-import info.nightscout.androidaps.plugins.general.smsCommunicator.AuthRequest
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Thread
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SendAndListen
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SetPreamble
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioPacket
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.*
-import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager
-import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask
-import info.nightscout.androidaps.plugins.treatments.Treatment
-import info.nightscout.androidaps.queue.CommandQueue
-import info.nightscout.androidaps.queue.commands.*
-import info.nightscout.androidaps.setupwizard.SWEventListener
-import info.nightscout.androidaps.setupwizard.SWScreen
-import info.nightscout.androidaps.setupwizard.elements.*
-import info.nightscout.androidaps.utils.wizard.BolusWizard
-import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
+import info.nightscout.androidaps.core.dependencyInjection.CoreModule
import javax.inject.Singleton
@Singleton
@Component(
modules = [
AndroidInjectionModule::class,
+ CoreModule::class,
ActivitiesModule::class,
FragmentsModule::class,
AppModule::class,
@@ -67,7 +27,8 @@ import javax.inject.Singleton
PreferencesModule::class,
OverviewModule::class,
DataClassesModule::class,
- SMSModule::class
+ SMSModule::class,
+ UIModule::class
]
)
interface AppComponent : AndroidInjector {
diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt
index 871f88a503..e405ab91fd 100644
--- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppModule.kt
@@ -1,88 +1,33 @@
package info.nightscout.androidaps.dependencyInjection
import android.content.Context
-import androidx.preference.PreferenceManager
import dagger.Binds
import dagger.Lazy
import dagger.Module
import dagger.Provides
-import dagger.android.ContributesAndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.MainApp
-import info.nightscout.androidaps.data.Profile
-import info.nightscout.androidaps.data.ProfileStore
-import info.nightscout.androidaps.data.PumpEnactResult
-import info.nightscout.androidaps.db.BgReading
-import info.nightscout.androidaps.db.CareportalEvent
-import info.nightscout.androidaps.db.ProfileSwitch
-import info.nightscout.androidaps.db.TemporaryBasal
-import info.nightscout.androidaps.interfaces.ActivePluginProvider
-import info.nightscout.androidaps.interfaces.CommandQueueProvider
-import info.nightscout.androidaps.interfaces.PluginBase
+import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.logging.AAPSLogger
-import info.nightscout.androidaps.logging.AAPSLoggerProduction
-import info.nightscout.androidaps.plugins.aps.loop.APSResult
-import info.nightscout.androidaps.plugins.aps.openAPSAMA.DetermineBasalResultAMA
-import info.nightscout.androidaps.plugins.aps.logger.LoggerCallback
-import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalAdapterSMBJS
-import info.nightscout.androidaps.plugins.aps.openAPSSMB.DetermineBasalResultSMB
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctionImplementation
-import info.nightscout.androidaps.plugins.constraints.objectives.objectives.*
-import info.nightscout.androidaps.plugins.general.automation.AutomationEvent
-import info.nightscout.androidaps.plugins.general.automation.actions.*
-import info.nightscout.androidaps.plugins.general.automation.elements.*
-import info.nightscout.androidaps.plugins.general.automation.triggers.*
-import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
-import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs
-import info.nightscout.androidaps.plugins.general.maintenance.formats.ClassicPrefsFormat
-import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
-import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationWithAction
-import info.nightscout.androidaps.plugins.general.smsCommunicator.AuthRequest
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Thread
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SendAndListen
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.command.SetPreamble
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioPacket
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.*
-import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager
-import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUITask
-import info.nightscout.androidaps.plugins.treatments.Treatment
+import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.queue.CommandQueue
-import info.nightscout.androidaps.queue.commands.*
-import info.nightscout.androidaps.setupwizard.SWEventListener
-import info.nightscout.androidaps.setupwizard.SWScreen
-import info.nightscout.androidaps.setupwizard.elements.*
-import info.nightscout.androidaps.utils.CryptoUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.resources.ResourceHelper
-import info.nightscout.androidaps.utils.resources.ResourceHelperImplementation
import info.nightscout.androidaps.utils.sharedPreferences.SP
-import info.nightscout.androidaps.utils.sharedPreferences.SPImplementation
import info.nightscout.androidaps.utils.storage.FileStorage
import info.nightscout.androidaps.utils.storage.Storage
-import info.nightscout.androidaps.utils.wizard.BolusWizard
-import info.nightscout.androidaps.utils.wizard.QuickWizardEntry
import javax.inject.Singleton
-@Module(includes = [AppModule.AppBindings::class, PluginsModule::class])
+@Module(includes = [
+ AppModule.AppBindings::class,
+ PluginsModule::class,
+ SkinsModule::class
+])
open class AppModule {
- @Provides
- @Singleton
- fun provideSharedPreferences(context: Context, resourceHelper: ResourceHelper): SP {
- return SPImplementation(PreferenceManager.getDefaultSharedPreferences(context), resourceHelper)
- }
-
@Provides
@Singleton
fun provideProfileFunction(injector: HasAndroidInjector, aapsLogger: AAPSLogger, sp: SP, resourceHelper: ResourceHelper, activePlugin: ActivePluginProvider, fabricPrivacy: FabricPrivacy): ProfileFunction {
@@ -90,35 +35,18 @@ open class AppModule {
}
@Provides
- @Singleton
- fun provideResources(mainApp: MainApp): ResourceHelper {
- return ResourceHelperImplementation(mainApp)
- }
-
- @Provides
- @Singleton
- fun provideAAPSLogger(): AAPSLogger {
- return AAPSLoggerProduction()
-/* if (BuildConfig.DEBUG) {
- AAPSLoggerDebug()
- } else {
- AAPSLoggerProduction()
- }
- */
- }
-
- @Provides
- fun providesPlugins(@PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>,
+ fun providesPlugins(configInterface: ConfigInterface,
+ @PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>,
@PluginsModule.PumpDriver pumpDrivers: Lazy
%1$s: Low: %2$02d%% In: %3$02d%% High: %4$02d%%]]>
Average
TDD
@@ -1767,7 +1686,6 @@
24h
Automation event
Already set
- Message
Clear queue? All data in queue will be lost!
xdripstatus_detailediob
xdripstatus_showbgi
@@ -1775,7 +1693,6 @@
snoozedTo
snooze_dst_in24h
snooze_loopdisabled
- enable_fabric
^\\d{6}
Use of Extended bolus feature will stop closed loop mode for the time of running extended bolus. Do you really want it?
Closed loop disabled because of running Extended bolus
@@ -1834,8 +1751,10 @@
statuslights_copy_ns
Copy NS settings (if exists)?
statuslights_overview_advanced
- (20g needed in 45min)
- (%dg needed in %dmin)
+ Original skin
+ Buttons are always displayed on bottom of screen
+ skin
+ Skin
@@ -1884,13 +1803,16 @@
No active pod.
Command verification failed.
- An unexpected error occured. Please report! (type: %1$s).
+ An unexpected error occurred. Please report! (type: %1$s).
Communication failed: received invalid input parameters.
- Communication failed.
+ Communication failed: timeout.
+ Communication failed: an unexpected error occurred. Please report!
Communication failed: message integrity verification failed.
Communication failed: received an invalid packet from the Pod.
Communication failed: the Pod is in a wrong state.
Communication failed: received an invalid response from the Pod.
+ Communication failed: received a message with an invalid sequence number from the Pod.
+ Communication failed: received a message with an invalid address from the Pod.
Communication failed: failed to decode message from the Pod.
Communication failed: nonce resync failed.
Communication failed: nonce out of sync.
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index e68e414cf1..747db85115 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -16,12 +16,6 @@
- @color/dialog_title_icon_tint
-
-
-
-
-
-
-
-
-
-
-
+
+
\ No newline at end of file
diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..413dc29ca1
--- /dev/null
+++ b/core/src/main/res/values/strings.xml
@@ -0,0 +1,128 @@
+
+
+ enable_fabric
+ language
+ units
+ loop_openmode_min_change
+ absorption_maxtime
+ openapsama_min_5m_carbimpact
+ absorption_cutoff
+ danar_visualizeextendedaspercentage"
+ danar_useextended
+ eatingsoon_duration
+ eatingsoon_target
+ activity_duration
+ activity_target
+ hypo_duration
+ hypo_target
+ low_mark
+ high_mark
+
+
+ Confirmation
+ Message
+ OK
+ Cancel
+ DISMISS
+
+
+ Bluetooth Low Energy not supported.
+ Bluetooth not enabled.
+ Location Is Not Enabled
+ For Bluetooth discovery to work on newer devices, location must be enabled. AAPS does not track your location and it can be disabled after pairing is successful.
+
+
+ %1$dm ago
+ %1$.1fh ago
+ h
+ days
+ hours
+ second
+ minute
+ hour
+ day
+ week
+ seconds
+ minutes
+ hours
+ days
+ weeks
+ m
+ d
+
+
+ Basal values not aligned to hours: %1$s
+ Basal value replaced by minimal supported value: %1$s
+ Basal value replaced by maximum supported value: %1$s
+ /U
+ U/h
+ g/U
+
+
+ No profile selected
+
+
+ * Only discrete values no ranges are supported as granularity for basal/bolus in virtual pump.
+
+
+ Cancel temp basal
+ Let temp basal run
+ Rate
+ Duration
+ Reason
+ No change requested
+
+
+ Invalid profile: %1$s
+
+
+ %1$dmin
+
+
+ %1$s: ∑: %2$.2f Bol: %3$.2f Bas: %4$.2f]]>
+
+
+ BG Check
+ Announcement
+ Note
+ Question
+ Exercise
+ Pump Site Change
+ CGM Sensor Insert
+ CGM Sensor Start
+ Insulin Cartridge Change
+ Profile switch
+ Snack Bolus
+ Meal Bolus
+ Correction Bolus
+ Combo Bolus
+ Temp Basal Start
+ Temp Basal End
+ Carbs correction
+ OpenAPS Offline
+ Pump Battery Change
+ Temporary target
+ Temporary target cancel
+ Finger
+ Sensor
+ Manual
+ unknown
+
+
+ Connection timed out
+
+
+ Enacted
+ Comment
+ Success
+ Percent
+ Absolute
+ Insulin
+ U
+ Waiting for result
+ SMB
+
+
+ "%dg Additional Carbs Required Within %d Minutes
+
+
\ No newline at end of file
diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml
new file mode 100644
index 0000000000..aabdcd6d8d
--- /dev/null
+++ b/core/src/main/res/values/styles.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/test/java/info/nightscout/androidaps/core/ExampleUnitTest.kt b/core/src/test/java/info/nightscout/androidaps/core/ExampleUnitTest.kt
new file mode 100644
index 0000000000..35bc1a6629
--- /dev/null
+++ b/core/src/test/java/info/nightscout/androidaps/core/ExampleUnitTest.kt
@@ -0,0 +1,18 @@
+package info.nightscout.androidaps.core
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/crowdin.yml b/crowdin.yml
index a37dfd27e0..ace938f2a1 100644
--- a/crowdin.yml
+++ b/crowdin.yml
@@ -13,3 +13,5 @@ files:
translation: /app/src/main/res/values-%android_code%/protection.xml
- source: /app/src/main/res/values/validator.xml
translation: /app/src/main/res/values-%android_code%/validator.xml
+ - source: /core/src/main/res/values/strings.xml
+ translation: /core/src/main/res/values-%android_code%/strings.xml
diff --git a/gradle.properties b/gradle.properties
index 1bc51c91af..43ad963b2f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -15,7 +15,7 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
+org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2g
diff --git a/settings.gradle b/settings.gradle
index 9ccfb61915..f7c8a5fc0a 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app', ':wear'
+include ':app', ':wear', ':core'
\ No newline at end of file
diff --git a/wear/build.gradle b/wear/build.gradle
index dc73e3c4f0..ffe7617086 100644
--- a/wear/build.gradle
+++ b/wear/build.gradle
@@ -122,9 +122,9 @@ dependencies {
implementation 'androidx.wear:wear:1.0.0'
implementation('me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0')
implementation('com.github.lecho:hellocharts-library:1.5.8@aar')
-
- testImplementation "junit:junit:4.12"
- testImplementation "org.json:json:20140107"
+
+ testImplementation 'junit:junit:4.13'
+ testImplementation 'org.json:json:20190722'
testImplementation ("org.mockito:mockito-core:2.8.47") {
exclude group: 'net.bytebuddy', module: 'byte-buddy'
exclude group: 'net.bytebuddy', module: 'byte-buddy-android'
@@ -139,8 +139,8 @@ dependencies {
testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
- testImplementation "joda-time:joda-time:2.9.9"
- testImplementation("com.google.truth:truth:0.39") {
+ testImplementation 'joda-time:joda-time:2.10.6'
+ testImplementation('com.google.truth:truth:1.0.1') {
exclude group: "com.google.guava", module: "guava"
}
testImplementation "org.skyscreamer:jsonassert:1.5.0"