diff --git a/app/build.gradle b/app/build.gradle
index 45ca9219ba..9a5b64d974 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,6 +10,8 @@ buildscript {
}
}
apply plugin: "com.android.application"
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: "io.fabric"
apply plugin: "jacoco-android"
@@ -27,6 +29,7 @@ ext {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter { url "https://jcenter.bintray.com/" }
+ mavenCentral()
}
def generateGitBuild = { ->
@@ -45,12 +48,49 @@ def generateGitBuild = { ->
return stringBuilder.toString()
}
+def generateGitRemote = { ->
+ StringBuilder stringBuilder = new StringBuilder();
+ try {
+ def stdout = new ByteArrayOutputStream()
+ exec {
+ commandLine 'git', 'remote', 'get-url', 'origin'
+ standardOutput = stdout
+ }
+ String commitObject = stdout.toString().trim()
+ stringBuilder.append(commitObject)
+ } catch (ignored) {
+ stringBuilder.append('NoGitSystemAvailable')
+ }
+ return stringBuilder.toString()
+}
+
def generateDate = { ->
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append((new Date()).format('yyyy.MM.dd-HH:mm'))
return stringBuilder.toString()
}
+def isMaster = { ->
+ return !version.contains('-')
+}
+
+def allCommited = { ->
+ StringBuilder stringBuilder = new StringBuilder();
+ try {
+ def stdout = new ByteArrayOutputStream()
+ exec {
+ commandLine 'git', 'status', '-s'
+ standardOutput = stdout
+ }
+ String commitObject = stdout.toString().trim()
+ stringBuilder.append(commitObject)
+ } catch (ignored) {
+ return false; // NoGitSystemAvailable
+ }
+ return stringBuilder.toString().isEmpty()
+
+}
+
tasks.matching { it instanceof Test }.all {
testLogging.events = ["failed", "skipped", "started"]
testLogging.exceptionFormat = "full"
@@ -64,14 +104,14 @@ android {
targetSdkVersion 25
multiDexEnabled true
versionCode 1500
- // dev_version: 2.2.3-dev
- version "medtronic-0.9.3-SNAPSHOT"
+ // dev_version: 2.3.1-dev
+ version "medtronic-0.9.4-SNAPSHOT"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
- buildConfigField "String", "DEV_VERSION", '"2.2.3-dev"'
- buildConfigField "String", "DEV_DATE", '"7.4.2019"'
- buildConfigField "String", "DEV_CHECKIN", '"a076b00363067fd43c83cbbd91cc964fa6978ddd"'
+ buildConfigField "String", "DEV_VERSION", '"2.3.1-dev"'
+ buildConfigField "String", "DEV_DATE", '"29.4.2019"'
+ buildConfigField "String", "DEV_CHECKIN", '"ea60b6ceef30ccf32566bf7c6caa4f1f33b42f41"'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// if you change minSdkVersion to less than 11, you need to change executeTask for wear
@@ -79,6 +119,9 @@ android {
moduleName "BleCommandUtil"
}
}
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
lintOptions {
// TODO remove once wear dependency com.google.android.gms:play-services-wearable:7.3.0
// has been upgraded (requiring significant code changes), which currently fails release
@@ -232,12 +275,11 @@ dependencies {
testImplementation "com.google.truth:truth:0.39"
testImplementation 'org.robolectric:robolectric:3.8'
testImplementation "org.skyscreamer:jsonassert:1.5.0"
- testImplementation "org.hamcrest:hamcrest-all:1.3"
- testImplementation "uk.org.lidalia:slf4j-test:1.2.0"
androidTestImplementation "org.mockito:mockito-core:2.8.47"
androidTestImplementation "com.google.dexmaker:dexmaker:${dexmakerVersion}"
androidTestImplementation "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
task unzip(type: Copy) {
@@ -262,4 +304,13 @@ task full_clean(type: Delete) {
}
clean.dependsOn full_clean
-preBuild.dependsOn copyLibs
\ No newline at end of file
+preBuild.dependsOn copyLibs
+
+printf('--------------\n')
+printf('isMaster: %s\n', isMaster().toString())
+printf('allCommited: %s\n', allCommited().toString())
+printf('--------------\n')
+if (isMaster() && !allCommited()) {
+ throw new GradleException('There are uncommitted changes or git system is not available. Clone sources again as described in wiki and do not allow gradle update')
+}
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 83c79c7164..5bf1c15ec3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -73,31 +73,40 @@
+
+ android:name=".receivers.DataReceiver"
+ android:enabled="true"
+ android:exported="true">
-
-
-
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.java b/app/src/main/java/info/nightscout/androidaps/MainActivity.java
index f441a8b243..6779b0a467 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.java
@@ -48,9 +48,12 @@ import info.nightscout.androidaps.events.EventFeatureRunning;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui;
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.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
+import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerUtilsKt;
import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
import info.nightscout.androidaps.tabs.TabPageAdapter;
import info.nightscout.androidaps.utils.AndroidPermission;
@@ -59,7 +62,6 @@ import info.nightscout.androidaps.utils.LocaleHelper;
import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.PasswordProtection;
import info.nightscout.androidaps.utils.SP;
-import info.nightscout.androidaps.utils.VersionChecker;
public class MainActivity extends AppCompatActivity {
private static Logger log = LoggerFactory.getLogger(L.CORE);
@@ -115,7 +117,11 @@ public class MainActivity extends AppCompatActivity {
public void onPageScrollStateChanged(int state) {
}
});
- VersionChecker.check();
+
+ //Check here if loop plugin is disabled. Else check via constraints
+ if (!LoopPlugin.getPlugin().isEnabled(PluginType.LOOP))
+ VersionCheckerUtilsKt.triggerCheckVersion();
+
FabricPrivacy.setUserStats();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java
index ebcef17640..6905234b9c 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.java
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java
@@ -1,34 +1,28 @@
package info.nightscout.androidaps;
-import java.io.File;
-import java.util.ArrayList;
-
-import net.danlew.android.joda.JodaTimeAndroid;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import android.app.Application;
-import android.bluetooth.BluetoothAdapter;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.os.SystemClock;
import android.support.annotation.Nullable;
import android.support.annotation.PluralsRes;
import android.support.v4.content.LocalBroadcastManager;
-import android.util.Log;
import com.crashlytics.android.Crashlytics;
-import com.crashlytics.android.answers.Answers;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.j256.ormlite.android.apptools.OpenHelperManager;
import com.squareup.otto.Bus;
import com.squareup.otto.LoggingBus;
import com.squareup.otto.ThreadEnforcer;
+import net.danlew.android.joda.JodaTimeAndroid;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.ArrayList;
+
import info.nightscout.androidaps.data.ConstraintChecker;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.interfaces.PluginBase;
@@ -56,6 +50,7 @@ import info.nightscout.androidaps.plugins.general.nsclient.receivers.DBAccessRec
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin;
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin;
+import info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerPlugin;
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatuslinePlugin;
import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin;
@@ -66,16 +61,12 @@ import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin;
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin;
import info.nightscout.androidaps.plugins.profile.simple.SimpleProfilePlugin;
import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst;
-import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
import info.nightscout.androidaps.plugins.pump.danaR.DanaRPlugin;
import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin;
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.mdi.MDIPlugin;
-import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
-import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityAAPSPlugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
@@ -96,11 +87,12 @@ import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NSAlarmReceiver;
import info.nightscout.androidaps.services.Intents;
import info.nightscout.androidaps.utils.FabricPrivacy;
-import info.nightscout.androidaps.utils.SP;
import io.fabric.sdk.android.Fabric;
-public class MainApp extends Application {
+import static info.nightscout.androidaps.plugins.general.versionChecker.VersionCheckerUtilsKt.triggerCheckVersion;
+
+public class MainApp extends Application {
private static Logger log = LoggerFactory.getLogger(L.CORE);
private static KeepAliveReceiver keepAliveReceiver;
@@ -125,21 +117,18 @@ public class MainApp extends Application {
public static boolean devBranch;
public static boolean engineeringMode;
-
@Override
public void onCreate() {
super.onCreate();
log.debug("onCreate");
sInstance = this;
sResources = getResources();
- sConstraintsChecker = new ConstraintChecker(this);
+ sConstraintsChecker = new ConstraintChecker();
sDatabaseHelper = OpenHelperManager.getHelper(sInstance, DatabaseHelper.class);
try {
if (FabricPrivacy.fabricEnabled()) {
Fabric.with(this, new Crashlytics());
- Fabric.with(this, new Answers());
- Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
}
} catch (Exception e) {
log.error("Error with Fabric init! " + e);
@@ -151,6 +140,7 @@ public class MainApp extends Application {
log.info("Version: " + BuildConfig.VERSION_NAME);
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
+ log.info("Remote: " + BuildConfig.REMOTE);
String extFilesDir = LoggerUtils.getLogDirectory();
File engineeringModeSemaphore = new File(extFilesDir, "engineering_mode");
@@ -162,6 +152,8 @@ public class MainApp extends Application {
registerLocalBroadcastReceiver();
+ //trigger here to see the new version on app start after an update
+ triggerCheckVersion();
setBTReceiver();
if (pluginsList == null) {
@@ -169,8 +161,7 @@ public class MainApp extends Application {
// Register all tabs in app here
pluginsList.add(OverviewPlugin.getPlugin());
pluginsList.add(IobCobCalculatorPlugin.getPlugin());
- if (Config.ACTION)
- pluginsList.add(ActionsFragment.getPlugin());
+ if (Config.ACTION) pluginsList.add(ActionsFragment.getPlugin());
pluginsList.add(InsulinOrefRapidActingPlugin.getPlugin());
pluginsList.add(InsulinOrefUltraRapidActingPlugin.getPlugin());
pluginsList.add(InsulinOrefFreePeakPlugin.getPlugin());
@@ -178,45 +169,30 @@ public class MainApp extends Application {
pluginsList.add(SensitivityAAPSPlugin.getPlugin());
pluginsList.add(SensitivityWeightedAveragePlugin.getPlugin());
pluginsList.add(SensitivityOref1Plugin.getPlugin());
- if (Config.PUMPDRIVERS)
- pluginsList.add(DanaRPlugin.getPlugin());
- if (Config.PUMPDRIVERS)
- pluginsList.add(DanaRKoreanPlugin.getPlugin());
- if (Config.PUMPDRIVERS)
- pluginsList.add(DanaRv2Plugin.getPlugin());
- if (Config.PUMPDRIVERS)
- pluginsList.add(DanaRSPlugin.getPlugin());
- if (Config.PUMPDRIVERS)
- pluginsList.add(LocalInsightPlugin.getPlugin());
+ if (Config.PUMPDRIVERS) pluginsList.add(DanaRPlugin.getPlugin());
+ if (Config.PUMPDRIVERS) pluginsList.add(DanaRKoreanPlugin.getPlugin());
+ if (Config.PUMPDRIVERS) pluginsList.add(DanaRv2Plugin.getPlugin());
+ if (Config.PUMPDRIVERS) pluginsList.add(DanaRSPlugin.getPlugin());
+ if (Config.PUMPDRIVERS) pluginsList.add(LocalInsightPlugin.getPlugin());
pluginsList.add(CareportalPlugin.getPlugin());
- if (Config.PUMPDRIVERS)
- pluginsList.add(ComboPlugin.getPlugin());
- if (Config.MDI)
- pluginsList.add(MDIPlugin.getPlugin());
+ if (Config.PUMPDRIVERS) pluginsList.add(ComboPlugin.getPlugin());
+ if (Config.MDI) pluginsList.add(MDIPlugin.getPlugin());
+ pluginsList.add(VirtualPumpPlugin.getPlugin());
if (Config.PUMPDRIVERS && engineeringMode) {
pluginsList.add(MedtronicPumpPlugin.getPlugin());
}
- pluginsList.add(VirtualPumpPlugin.getPlugin());
- if (Config.APS)
- pluginsList.add(LoopPlugin.getPlugin());
- if (Config.APS)
- pluginsList.add(OpenAPSMAPlugin.getPlugin());
- if (Config.APS)
- pluginsList.add(OpenAPSAMAPlugin.getPlugin());
- if (Config.APS)
- pluginsList.add(OpenAPSSMBPlugin.getPlugin());
+ if (Config.APS) pluginsList.add(LoopPlugin.getPlugin());
+ if (Config.APS) pluginsList.add(OpenAPSMAPlugin.getPlugin());
+ if (Config.APS) pluginsList.add(OpenAPSAMAPlugin.getPlugin());
+ if (Config.APS) pluginsList.add(OpenAPSSMBPlugin.getPlugin());
pluginsList.add(NSProfilePlugin.getPlugin());
- if (Config.OTHERPROFILES)
- pluginsList.add(SimpleProfilePlugin.getPlugin());
- if (Config.OTHERPROFILES)
- pluginsList.add(LocalProfilePlugin.getPlugin());
+ if (Config.OTHERPROFILES) pluginsList.add(SimpleProfilePlugin.getPlugin());
+ if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin());
pluginsList.add(TreatmentsPlugin.getPlugin());
- if (Config.SAFETY)
- pluginsList.add(SafetyPlugin.getPlugin());
- if (Config.SAFETY)
- pluginsList.add(StorageConstraintPlugin.getPlugin());
- if (Config.APS)
- pluginsList.add(ObjectivesPlugin.getPlugin());
+ if (Config.SAFETY) pluginsList.add(SafetyPlugin.getPlugin());
+ if (Config.SAFETY) pluginsList.add(VersionCheckerPlugin.INSTANCE);
+ if (Config.SAFETY) pluginsList.add(StorageConstraintPlugin.getPlugin());
+ if (Config.APS) pluginsList.add(ObjectivesPlugin.getPlugin());
pluginsList.add(SourceXdripPlugin.getPlugin());
pluginsList.add(SourceNSClientPlugin.getPlugin());
pluginsList.add(SourceMM640gPlugin.getPlugin());
@@ -226,8 +202,7 @@ public class MainApp extends Application {
pluginsList.add(SourcePoctechPlugin.getPlugin());
pluginsList.add(SourceTomatoPlugin.getPlugin());
pluginsList.add(SourceEversensePlugin.getPlugin());
- if (Config.SMSCOMMUNICATORENABLED)
- pluginsList.add(SmsCommunicatorPlugin.getPlugin());
+ if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin());
pluginsList.add(FoodPlugin.getPlugin());
pluginsList.add(WearPlugin.initPlugin(this));
@@ -240,6 +215,7 @@ public class MainApp extends Application {
pluginsList.add(DstHelperPlugin.getPlugin());
+
ConfigBuilderPlugin.getPlugin().initialize();
}
@@ -255,7 +231,6 @@ public class MainApp extends Application {
}
}
-
private void registerLocalBroadcastReceiver() {
lbm = LocalBroadcastManager.getInstance(this);
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT));
@@ -271,16 +246,16 @@ public class MainApp extends Application {
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL));
- // register alarms
+ //register alarms
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ALARM));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ANNOUNCEMENT));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_CLEAR_ALARM));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_URGENT_ALARM));
- // register ack alarm
+ //register ack alarm
lbm.registerReceiver(ackAlarmReciever, new IntentFilter(Intents.ACTION_ACK_ALARM));
- // register dbaccess
+ //register dbaccess
lbm.registerReceiver(dbAccessReciever, new IntentFilter(Intents.ACTION_DATABASE));
}
@@ -330,13 +305,11 @@ public class MainApp extends Application {
}
}
-
public void stopKeepAliveService() {
if (keepAliveReceiver != null)
KeepAliveReceiver.cancelAlarm(this);
}
-
public static void subscribe(Object subscriber) {
try {
bus().register(subscriber);
@@ -345,7 +318,6 @@ public class MainApp extends Application {
}
}
-
public static void unsubscribe(Object subscriber) {
try {
bus().unregister(subscriber);
@@ -354,42 +326,34 @@ public class MainApp extends Application {
}
}
-
public static Bus bus() {
return sBus;
}
-
public static String gs(int id) {
return sResources.getString(id);
}
-
public static String gs(int id, Object... args) {
return sResources.getString(id, args);
}
-
public static String gq(@PluralsRes int id, int quantity, Object... args) {
return sResources.getQuantityString(id, quantity, args);
}
-
public static int gc(int id) {
return sResources.getColor(id);
}
-
public static MainApp instance() {
return sInstance;
}
-
public static DatabaseHelper getDbHelper() {
return sDatabaseHelper;
}
-
public static void closeDbHelper() {
if (sDatabaseHelper != null) {
sDatabaseHelper.close();
@@ -397,22 +361,18 @@ public class MainApp extends Application {
}
}
-
public static FirebaseAnalytics getFirebaseAnalytics() {
return mFirebaseAnalytics;
}
-
public static ConstraintChecker getConstraintChecker() {
return sConstraintsChecker;
}
-
public static ArrayList getPluginsList() {
return pluginsList;
}
-
public static ArrayList getSpecificPluginsList(PluginType type) {
ArrayList newList = new ArrayList<>();
@@ -427,7 +387,6 @@ public class MainApp extends Application {
return newList;
}
-
public static ArrayList getSpecificPluginsVisibleInList(PluginType type) {
ArrayList newList = new ArrayList<>();
@@ -443,7 +402,6 @@ public class MainApp extends Application {
return newList;
}
-
public static ArrayList getSpecificPluginsListByInterface(Class interfaceClass) {
ArrayList newList = new ArrayList<>();
@@ -458,7 +416,6 @@ public class MainApp extends Application {
return newList;
}
-
public static ArrayList getSpecificPluginsVisibleInListByInterface(Class interfaceClass, PluginType type) {
ArrayList newList = new ArrayList<>();
@@ -474,13 +431,12 @@ public class MainApp extends Application {
return newList;
}
-
@Nullable
public static T getSpecificPlugin(Class pluginClass) {
if (pluginsList != null) {
for (PluginBase p : pluginsList) {
if (pluginClass.isAssignableFrom(p.getClass()))
- return (T)p;
+ return (T) p;
}
} else {
log.error("pluginsList=null");
@@ -488,26 +444,16 @@ public class MainApp extends Application {
return null;
}
-
- public static boolean isEngineeringMode() {
- if (!Config.APS)
- return true;
- return engineeringMode;
- }
-
-
public static boolean isEngineeringModeOrRelease() {
if (!Config.APS)
return true;
return engineeringMode || !devBranch;
}
-
public static boolean isDev() {
return devBranch;
}
-
public static int getIcon() {
if (Config.NSCLIENT)
return R.mipmap.ic_yellowowl;
@@ -517,7 +463,6 @@ public class MainApp extends Application {
return R.mipmap.ic_launcher;
}
-
public static int getNotificationIcon() {
if (Config.NSCLIENT)
return R.drawable.ic_notif_nsclient;
@@ -527,7 +472,6 @@ public class MainApp extends Application {
return R.drawable.ic_notif_aaps;
}
-
@Override
public void onTerminate() {
if (L.isEnabled(L.CORE))
diff --git a/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java b/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java
index 68664033d0..b1267e81bc 100644
--- a/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java
+++ b/app/src/main/java/info/nightscout/androidaps/data/ConstraintChecker.java
@@ -1,7 +1,11 @@
package info.nightscout.androidaps.data;
+import android.support.annotation.NonNull;
+
import java.util.ArrayList;
+import javax.annotation.Nonnull;
+
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.interfaces.Constraint;
@@ -15,13 +19,6 @@ import info.nightscout.androidaps.interfaces.PluginType;
public class ConstraintChecker implements ConstraintsInterface {
- private MainApp mainApp;
-
- public ConstraintChecker(MainApp mainApp) {
- this.mainApp = mainApp;
- }
-
-
public Constraint isLoopInvokationAllowed() {
return isLoopInvocationAllowed(new Constraint<>(true));
}
@@ -79,9 +76,9 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isLoopInvocationAllowed(Constraint value) {
+ public Constraint isLoopInvocationAllowed(@NonNull Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -91,9 +88,9 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isClosedLoopAllowed(Constraint value) {
+ public Constraint isClosedLoopAllowed(@NonNull Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -103,9 +100,9 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isAutosensModeEnabled(Constraint value) {
+ public Constraint isAutosensModeEnabled(@NonNull Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -115,9 +112,9 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isAMAModeEnabled(Constraint value) {
+ public Constraint isAMAModeEnabled(@NonNull Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constrain = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -127,9 +124,9 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isSMBModeEnabled(Constraint value) {
+ public Constraint isSMBModeEnabled(@NonNull Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -139,9 +136,9 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isUAMEnabled(Constraint value) {
+ public Constraint isUAMEnabled(@NonNull Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -151,8 +148,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isAdvancedFilteringEnabled(Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint isAdvancedFilteringEnabled(@NonNull Constraint value) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -162,8 +159,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint isSuperBolusEnabled(Constraint value) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint isSuperBolusEnabled(@NonNull Constraint value) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -173,8 +170,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint applyBasalConstraints(Constraint absoluteRate, Profile profile) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint applyBasalConstraints(@NonNull Constraint absoluteRate, Profile profile) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constraint = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -184,8 +181,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint applyBasalPercentConstraints(Constraint percentRate, Profile profile) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint applyBasalPercentConstraints(@NonNull Constraint percentRate, Profile profile) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constrain = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -195,8 +192,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint applyBolusConstraints(Constraint insulin) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint applyBolusConstraints(@NonNull Constraint insulin) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constrain = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -206,8 +203,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint applyExtendedBolusConstraints(Constraint insulin) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint applyExtendedBolusConstraints(@NonNull Constraint insulin) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constrain = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -217,8 +214,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint applyCarbsConstraints(Constraint carbs) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint applyCarbsConstraints(@NonNull Constraint carbs) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constrain = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
@@ -228,8 +225,8 @@ public class ConstraintChecker implements ConstraintsInterface {
}
@Override
- public Constraint applyMaxIOBConstraints(Constraint maxIob) {
- ArrayList constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
+ public Constraint applyMaxIOBConstraints(@NonNull Constraint maxIob) {
+ ArrayList constraintsPlugins = MainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
for (PluginBase p : constraintsPlugins) {
ConstraintsInterface constrain = (ConstraintsInterface) p;
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
diff --git a/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java b/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java
deleted file mode 100644
index d7895e518a..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package info.nightscout.androidaps.data;
-
-import android.support.annotation.Nullable;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.db.BgReading;
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
-import info.nightscout.androidaps.utils.DateUtil;
-import info.nightscout.androidaps.utils.DecimalFormatter;
-import info.nightscout.androidaps.utils.Round;
-
-/**
- * Created by mike on 04.01.2017.
- */
-
-public class GlucoseStatus {
- private static Logger log = LoggerFactory.getLogger(GlucoseStatus.class);
- public double glucose = 0d;
- public double delta = 0d;
- public double avgdelta = 0d;
- public double short_avgdelta = 0d;
- public double long_avgdelta = 0d;
- public long date = 0L;
-
-
- @Override
- public String toString() {
- return MainApp.gs(R.string.glucose) + " " + DecimalFormatter.to0Decimal(glucose) + " mg/dl\n" +
- MainApp.gs(R.string.delta) + " " + DecimalFormatter.to0Decimal(delta) + " mg/dl\n" +
- MainApp.gs(R.string.short_avgdelta) + " " + DecimalFormatter.to2Decimal(short_avgdelta) + " mg/dl\n" +
- MainApp.gs(R.string.long_avgdelta) + " " + DecimalFormatter.to2Decimal(long_avgdelta) + " mg/dl";
- }
-
- public GlucoseStatus() {
- }
-
- public GlucoseStatus round() {
- this.glucose = Round.roundTo(this.glucose, 0.1);
- this.delta = Round.roundTo(this.delta, 0.01);
- this.avgdelta = Round.roundTo(this.avgdelta, 0.01);
- this.short_avgdelta = Round.roundTo(this.short_avgdelta, 0.01);
- this.long_avgdelta = Round.roundTo(this.long_avgdelta, 0.01);
- return this;
- }
-
-
- @Nullable
- public static GlucoseStatus getGlucoseStatusData() {
- return getGlucoseStatusData(false);
- }
-
- @Nullable
- public static GlucoseStatus getGlucoseStatusData(boolean allowOldData) {
- // load 45min
- //long fromtime = DateUtil.now() - 60 * 1000L * 45;
- //List data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
-
- List data = IobCobCalculatorPlugin.getPlugin().getBgReadings();
-
- if (data == null)
- return null;
-
- int sizeRecords = data.size();
- if (sizeRecords == 0) {
- return null;
- }
-
- if (data.get(0).date < DateUtil.now() - 7 * 60 * 1000L && !allowOldData) {
- return null;
- }
-
- BgReading now = data.get(0);
- long now_date = now.date;
- double change;
-
- if (sizeRecords == 1) {
- GlucoseStatus status = new GlucoseStatus();
- status.glucose = now.value;
- status.short_avgdelta = 0d;
- status.delta = 0d;
- status.long_avgdelta = 0d;
- status.avgdelta = 0d; // for OpenAPS MA
- status.date = now_date;
- return status.round();
- }
-
- ArrayList now_value_list = new ArrayList();
- ArrayList last_deltas = new ArrayList();
- ArrayList short_deltas = new ArrayList();
- ArrayList long_deltas = new ArrayList();
-
- // Use the latest sgv value in the now calculations
- now_value_list.add(now.value);
-
- for (int i = 1; i < sizeRecords; i++) {
- if (data.get(i).value > 38) {
- BgReading then = data.get(i);
- long then_date = then.date;
- double avgdelta = 0;
- long minutesago;
-
- minutesago = Math.round((now_date - then_date) / (1000d * 60));
- // multiply by 5 to get the same units as delta, i.e. mg/dL/5m
- change = now.value - then.value;
- avgdelta = change / minutesago * 5;
-
- // use the average of all data points in the last 2.5m for all further "now" calculations
- if (0 < minutesago && minutesago < 2.5) {
- // Keep and average all values within the last 2.5 minutes
- now_value_list.add(then.value);
- now.value = average(now_value_list);
- // short_deltas are calculated from everything ~5-15 minutes ago
- } else if (2.5 < minutesago && minutesago < 17.5) {
- //console.error(minutesago, avgdelta);
- short_deltas.add(avgdelta);
- // last_deltas are calculated from everything ~5 minutes ago
- if (2.5 < minutesago && minutesago < 7.5) {
- last_deltas.add(avgdelta);
- }
- // long_deltas are calculated from everything ~20-40 minutes ago
- } else if (17.5 < minutesago && minutesago < 42.5) {
- long_deltas.add(avgdelta);
- } else {
- // Do not process any more records after >= 42.5 minutes
- break;
- }
- }
- }
-
- GlucoseStatus status = new GlucoseStatus();
- status.glucose = now.value;
- status.date = now_date;
-
- status.short_avgdelta = average(short_deltas);
-
- if (last_deltas.isEmpty()) {
- status.delta = status.short_avgdelta;
- } else {
- status.delta = average(last_deltas);
- }
-
- status.long_avgdelta = average(long_deltas);
- status.avgdelta = status.short_avgdelta; // for OpenAPS MA
-
- return status.round();
- }
-
- public static double average(ArrayList array) {
- double sum = 0d;
-
- if (array.size() == 0)
- return 0d;
-
- for (Double value : array) {
- sum += value;
- }
- return sum / array.size();
- }
-}
diff --git a/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java b/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java
index 4262fe2133..0bfcbb1002 100644
--- a/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java
+++ b/app/src/main/java/info/nightscout/androidaps/data/QuickWizardEntry.java
@@ -12,6 +12,7 @@ import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.CobInfo;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
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 8bcf767afb..393cdd13e5 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java
@@ -38,7 +38,7 @@ import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.events.EventCareportalEventChange;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventNewBG;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.events.EventReloadProfileSwitchData;
import info.nightscout.androidaps.events.EventReloadTempBasalData;
@@ -48,9 +48,9 @@ import info.nightscout.androidaps.events.EventTempTargetChange;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
+import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData;
-import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.pump.danaR.activities.DanaRNSHistorySync;
import info.nightscout.androidaps.plugins.pump.danaR.comm.RecordTypes;
import info.nightscout.androidaps.plugins.pump.insight.database.InsightBolusID;
@@ -86,7 +86,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_INSIGHT_BOLUS_IDS = "InsightBolusIDs";
public static final String DATABASE_INSIGHT_PUMP_IDS = "InsightPumpIDs";
- private static final int DATABASE_VERSION = 10;
+ private static final int DATABASE_VERSION = 11;
public static Long earliestDataChange = null;
@@ -134,6 +134,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
+ database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
+ "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");
+ database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
+ "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")");
} catch (SQLException e) {
log.error("Can't create database", e);
throw new RuntimeException(e);
@@ -146,15 +150,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
this.oldVersion = oldVersion;
this.newVersion = newVersion;
- if (oldVersion == 7 && newVersion == 8) {
- log.debug("Upgrading database from v7 to v8");
- } else if (oldVersion == 8 && newVersion == 9) {
- log.debug("Upgrading database from v8 to v9");
- } else if (oldVersion == 9 && newVersion == 10) {
- TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
- TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
- TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
- } else {
+ if (oldVersion < 7) {
log.info(DatabaseHelper.class.getName(), "onUpgrade");
TableUtils.dropTable(connectionSource, TempTarget.class, true);
TableUtils.dropTable(connectionSource, BgReading.class, true);
@@ -165,6 +161,17 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
TableUtils.dropTable(connectionSource, CareportalEvent.class, true);
TableUtils.dropTable(connectionSource, ProfileSwitch.class, true);
onCreate(database, connectionSource);
+ } else if (oldVersion < 10) {
+ TableUtils.createTableIfNotExists(connectionSource, InsightHistoryOffset.class);
+ TableUtils.createTableIfNotExists(connectionSource, InsightBolusID.class);
+ TableUtils.createTableIfNotExists(connectionSource, InsightPumpID.class);
+ database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_BOLUS_IDS + "\", " + System.currentTimeMillis() + " " +
+ "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\")");
+ database.execSQL("INSERT INTO sqlite_sequence (name, seq) SELECT \"" + DATABASE_INSIGHT_PUMP_IDS + "\", " + System.currentTimeMillis() + " " +
+ "WHERE NOT EXISTS (SELECT 1 FROM sqlite_sequence WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\")");
+ } else if (oldVersion < 11) {
+ database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DATABASE_INSIGHT_BOLUS_IDS + "\"");
+ database.execSQL("UPDATE sqlite_sequence SET seq = " + System.currentTimeMillis() + " WHERE name = \"" + DATABASE_INSIGHT_PUMP_IDS + "\"");
}
} catch (SQLException e) {
log.error("Can't drop databases", e);
@@ -430,7 +437,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return null;
for (int i = 0; i < bgList.size(); i++)
- if (bgList.get(i).value > 39)
+ if (bgList.get(i).value >= 39)
return bgList.get(i);
return null;
}
@@ -1598,9 +1605,9 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
class PostRunnable implements Runnable {
public void run() {
if (L.isEnabled(L.DATABASE))
- log.debug("Firing EventProfileSwitchChange");
+ log.debug("Firing EventProfileNeedsUpdate");
MainApp.bus().post(new EventReloadProfileSwitchData());
- MainApp.bus().post(new EventProfileSwitchChange());
+ MainApp.bus().post(new EventProfileNeedsUpdate());
scheduledProfileSwitchEventPost = null;
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventProfileSwitchChange.java b/app/src/main/java/info/nightscout/androidaps/events/EventProfileNeedsUpdate.java
similarity index 62%
rename from app/src/main/java/info/nightscout/androidaps/events/EventProfileSwitchChange.java
rename to app/src/main/java/info/nightscout/androidaps/events/EventProfileNeedsUpdate.java
index 7bab9d4518..9e3f3b08c7 100644
--- a/app/src/main/java/info/nightscout/androidaps/events/EventProfileSwitchChange.java
+++ b/app/src/main/java/info/nightscout/androidaps/events/EventProfileNeedsUpdate.java
@@ -4,5 +4,5 @@ package info.nightscout.androidaps.events;
* Created by mike on 02.06.2017.
*/
-public class EventProfileSwitchChange extends Event {
+public class EventProfileNeedsUpdate extends Event {
}
diff --git a/app/src/main/java/info/nightscout/androidaps/logging/L.java b/app/src/main/java/info/nightscout/androidaps/logging/L.java
index 583969c739..f685bbd424 100644
--- a/app/src/main/java/info/nightscout/androidaps/logging/L.java
+++ b/app/src/main/java/info/nightscout/androidaps/logging/L.java
@@ -78,6 +78,7 @@ public class L {
public static final String CORE = "CORE";
public static final String AUTOSENS = "AUTOSENS";
public static final String EVENTS = "EVENTS";
+ public static final String GLUCOSE = "GLUCOSE";
public static final String BGSOURCE = "BGSOURCE";
public static final String OVERVIEW = "OVERVIEW";
public static final String NOTIFICATION = "NOTIFICATION";
@@ -102,6 +103,7 @@ public class L {
logElements.add(new LogElement(APS, true));
logElements.add(new LogElement(AUTOSENS, false));
logElements.add(new LogElement(BGSOURCE, true));
+ logElements.add(new LogElement(GLUCOSE, false));
logElements.add(new LogElement(CONFIGBUILDER, false));
logElements.add(new LogElement(CONSTRAINTS, true));
logElements.add(new LogElement(CORE, true));
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.java
index 7eb9a2d81d..5b5c8cb63d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/DetermineBasalAdapterAMAJS.java
@@ -20,7 +20,7 @@ import java.lang.reflect.InvocationTargetException;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java
index 3447c7c4f4..1f7deebea4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java
@@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/DetermineBasalAdapterMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/DetermineBasalAdapterMAJS.java
index 4baabf22ab..ae1f390ded 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/DetermineBasalAdapterMAJS.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/DetermineBasalAdapterMAJS.java
@@ -17,7 +17,7 @@ import java.lang.reflect.InvocationTargetException;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/OpenAPSMAPlugin.java
index 24b4cb7929..2dd78bdb82 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/OpenAPSMAPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSMA/OpenAPSMAPlugin.java
@@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java
index edaddd62c9..bfb75503c1 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java
@@ -20,7 +20,7 @@ import java.lang.reflect.InvocationTargetException;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java
index 73914662d7..728e3145d6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java
@@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.data.Profile;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java
index ba7a245269..0360ba4a68 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctions.java
@@ -19,7 +19,7 @@ import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.events.EventNewBasalProfile;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.logging.L;
@@ -48,7 +48,7 @@ public class ProfileFunctions {
}
@Subscribe
- public void onProfileSwitch(EventProfileSwitchChange ignored) {
+ public void onProfileSwitch(EventProfileNeedsUpdate ignored) {
if (L.isEnabled(L.PROFILE))
log.debug("onProfileSwitch");
ConfigBuilderPlugin.getPlugin().getCommandQueue().setProfile(getProfile(), new Callback() {
@@ -62,7 +62,8 @@ public class ProfileFunctions {
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MainApp.instance().startActivity(i);
}
- MainApp.bus().post(new EventNewBasalProfile());
+ if (result.enacted)
+ MainApp.bus().post(new EventNewBasalProfile());
}
});
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java
index e94cc658ca..57414927b4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/careportal/Dialogs/NewNSTreatmentDialog.java
@@ -39,7 +39,7 @@ import java.util.List;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.db.BgReading;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java
index bd5e67345d..35bd9f9d06 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenancePlugin.java
@@ -222,6 +222,7 @@ public class MaintenancePlugin extends PluginBase {
builder.append("NSCLIENT" + System.lineSeparator());
builder.append("Build: " + BuildConfig.BUILDVERSION + System.lineSeparator());
+ builder.append("Remote: " + BuildConfig.REMOTE + System.lineSeparator());
builder.append("Flavor: " + BuildConfig.FLAVOR + BuildConfig.BUILD_TYPE + System.lineSeparator());
builder.append(MainApp.gs(R.string.configbuilder_nightscoutversion_label) + " " + NSSettingsStatus.getInstance().nightscoutVersionName + System.lineSeparator());
if (MainApp.engineeringMode)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java
index f7eed4db9f..1d9b12ea94 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.java
@@ -56,7 +56,7 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.QuickWizardEntry;
@@ -72,7 +72,7 @@ import info.nightscout.androidaps.events.EventCareportalEventChange;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.events.EventTempBasalChange;
@@ -982,8 +982,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
@Subscribe
- public void onStatusEvent(final EventProfileSwitchChange ev) {
- scheduleUpdateGUI("EventProfileSwitchChange");
+ public void onStatusEvent(final EventProfileNeedsUpdate ev) {
+ scheduleUpdateGUI("EventProfileNeedsUpdate");
}
@Subscribe
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java
index 53c571aad7..0ab1b98ff6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/dialogs/CalibrationDialog.java
@@ -18,7 +18,7 @@ import java.text.DecimalFormat;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.utils.NumberPicker;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.java
index 3b6bcf615d..f7a4c32360 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/Notification.java
@@ -74,6 +74,7 @@ public class Notification {
public static final int DST_LOOP_DISABLED = 49;
public static final int DST_IN_24H = 50;
public static final int DISKFULL = 51;
+ public static final int OLDVERSION = 52;
public int id;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java
index 0287c21260..987d9374bd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/persistentNotification/PersistentNotificationPlugin.java
@@ -20,7 +20,7 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.java
index 7703561aa9..181bdd86d2 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/SmsCommunicatorPlugin.java
@@ -20,7 +20,7 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerPlugin.kt
new file mode 100644
index 0000000000..c0335ea64a
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerPlugin.kt
@@ -0,0 +1,72 @@
+package info.nightscout.androidaps.plugins.general.versionChecker
+
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.interfaces.*
+import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
+import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
+import info.nightscout.androidaps.utils.SP
+import java.util.concurrent.TimeUnit
+
+/**
+ * Usually we would have a class here.
+ * Instead of having a class we can use an object directly inherited from PluginBase.
+ * This is a lazy loading singleton only loaded when actually used.
+ * */
+
+object VersionCheckerPlugin : PluginBase(PluginDescription()
+ .mainType(PluginType.CONSTRAINTS)
+ .neverVisible(true)
+ .alwaysEnabled(true)
+ .showInList(false)
+ .pluginName(R.string.versionChecker)), ConstraintsInterface {
+
+ override fun isClosedLoopAllowed(value: Constraint): Constraint {
+ checkWarning()
+ triggerCheckVersion()
+ return if (isOldVersion(GRACE_PERIOD_VERY_OLD))
+ value.set(false, MainApp.gs(R.string.very_old_version), this)
+ else
+ value
+ }
+
+ private fun checkWarning() {
+ val now = System.currentTimeMillis()
+
+ if (!SP.contains(R.string.key_last_versionchecker_plugin_warning)) {
+ SP.putLong(R.string.key_last_versionchecker_plugin_warning, now)
+ return
+ }
+
+
+ if (isOldVersion(GRACE_PERIOD_WARNING) && shouldWarnAgain(now)) {
+ // store last notification time
+ SP.putLong(R.string.key_last_versionchecker_plugin_warning, now)
+
+ //notify
+ val message = MainApp.gs(R.string.new_version_warning, Math.round((now - SP.getLong(R.string.key_last_time_this_version_detected, now)) / TimeUnit.DAYS.toMillis(1).toDouble()))
+ val notification = Notification(Notification.OLDVERSION, message, Notification.NORMAL)
+ MainApp.bus().post(EventNewNotification(notification))
+ }
+ }
+
+ private fun shouldWarnAgain(now: Long) =
+ now > SP.getLong(R.string.key_last_versionchecker_plugin_warning, 0) + WARN_EVERY
+
+ override fun applyMaxIOBConstraints(maxIob: Constraint): Constraint =
+ if (isOldVersion(GRACE_PERIOD_OLD))
+ maxIob.set(0.toDouble(), MainApp.gs(R.string.old_version), this)
+ else
+ maxIob
+
+ private fun isOldVersion(gracePeriod: Long): Boolean {
+ val now = System.currentTimeMillis()
+ return now > SP.getLong(R.string.key_last_time_this_version_detected, 0) + gracePeriod
+ }
+
+ val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
+ val GRACE_PERIOD_WARNING = TimeUnit.DAYS.toMillis(30)
+ val GRACE_PERIOD_OLD = TimeUnit.DAYS.toMillis(60)
+ val GRACE_PERIOD_VERY_OLD = TimeUnit.DAYS.toMillis(90)
+
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtils.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtils.kt
new file mode 100644
index 0000000000..8791030abb
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtils.kt
@@ -0,0 +1,111 @@
+package info.nightscout.androidaps.plugins.general.versionChecker
+
+import android.content.Context
+import android.net.ConnectivityManager
+import info.nightscout.androidaps.BuildConfig
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
+import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
+import info.nightscout.androidaps.utils.SP
+import org.apache.http.HttpResponse
+import org.apache.http.client.methods.HttpGet
+import org.apache.http.impl.client.DefaultHttpClient
+import org.slf4j.LoggerFactory
+import java.io.IOException
+import java.io.InputStream
+import java.util.concurrent.TimeUnit
+
+// check network connection
+fun isConnected(): Boolean {
+ val connMgr = MainApp.instance().applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
+ return connMgr.activeNetworkInfo?.isConnected ?: false
+}
+
+// convert inputstream to String
+@Throws(IOException::class)
+inline fun InputStream.findVersion(): String? {
+ val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
+ return bufferedReader()
+ .readLines()
+ .filter { regex.matches(it) }
+ .mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }
+ .firstOrNull()
+}
+
+private val log = LoggerFactory.getLogger(L.CORE)
+
+
+fun triggerCheckVersion() {
+
+ if(!SP.contains(R.string.key_last_time_this_version_detected)) {
+ // On a new installation, set it as 30 days old in order to warn that there is a new version.
+ SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))
+ }
+
+ // If we are good, only check once every day.
+ if(System.currentTimeMillis() > SP.getLong(R.string.key_last_time_this_version_detected, 0) + CHECK_EVERY){
+ checkVersion()
+ }
+}
+
+@Suppress("DEPRECATION")
+private fun checkVersion() = if (isConnected()) {
+ Thread {
+ try {
+ val request = HttpGet("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle")
+ val response: HttpResponse = DefaultHttpClient().execute(request)
+ val version: String? = response.entity.content?.findVersion()
+ compareWithCurrentVersion(version, BuildConfig.VERSION_NAME)
+ } catch (e: IOException) {
+ log.debug("Github master version check error: $e")
+ }
+ }.start()
+} else
+ log.debug("Github master version no checked. No connectivity")
+
+fun compareWithCurrentVersion(newVersion: String?, currentVersion: String) {
+ val comparison: Int? = newVersion?.versionStrip()?.compareTo(currentVersion.versionStrip())
+ when {
+ comparison == null -> onVersionNotDetectable()
+ comparison == 0 -> onSameVersionDetected()
+ comparison > 0 -> onNewVersionDetected(currentVersion = currentVersion, newVersion = newVersion)
+ else -> onOlderVersionDetected()
+ }
+}
+
+private fun onOlderVersionDetected() {
+ log.debug("Version newer than master. Are you developer?")
+ SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis())
+}
+
+fun onSameVersionDetected() {
+ SP.putLong(R.string.key_last_time_this_version_detected, System.currentTimeMillis())
+}
+
+fun onVersionNotDetectable() {
+ log.debug("fetch failed, ignore and smartcast to non-null")
+}
+
+fun onNewVersionDetected(currentVersion: String, newVersion: String?) {
+ val now = System.currentTimeMillis()
+ if(now > SP.getLong(R.string.key_last_versionchecker_warning, 0) + WARN_EVERY) {
+ log.debug("Version ${currentVersion} outdated. Found $newVersion")
+ val notification = Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), newVersion.toString()), Notification.LOW)
+ MainApp.bus().post(EventNewNotification(notification))
+ SP.putLong(R.string.key_last_versionchecker_warning, now)
+ }
+}
+
+fun String.versionStrip() = this.mapNotNull {
+ when (it) {
+ in '0'..'9' -> it
+ '.' -> it
+ else -> null
+ }
+}.joinToString(separator = "")
+
+
+val CHECK_EVERY = TimeUnit.DAYS.toMillis(1)
+val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java
index 86b56ba130..d121c5c55d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/WatchUpdaterService.java
@@ -32,17 +32,11 @@ import com.google.android.gms.wearable.PutDataRequest;
import com.google.android.gms.wearable.Wearable;
import com.google.android.gms.wearable.WearableListenerService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.BgReading;
@@ -55,15 +49,11 @@ import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
-import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus;
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
import info.nightscout.androidaps.plugins.general.wear.WearPlugin;
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
-import info.nightscout.androidaps.plugins.treatments.Treatment;
-import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SafeParse;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/GlucoseStatus.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/GlucoseStatus.java
new file mode 100644
index 0000000000..191ce9e1cd
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/GlucoseStatus.java
@@ -0,0 +1,180 @@
+package info.nightscout.androidaps.plugins.iob.iobCobCalculator;
+
+import android.support.annotation.Nullable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import info.nightscout.androidaps.db.BgReading;
+import info.nightscout.androidaps.logging.L;
+import info.nightscout.androidaps.utils.DateUtil;
+import info.nightscout.androidaps.utils.DecimalFormatter;
+import info.nightscout.androidaps.utils.Round;
+
+/**
+ * Created by mike on 04.01.2017.
+ */
+
+public class GlucoseStatus {
+ private static Logger log = LoggerFactory.getLogger(GlucoseStatus.class);
+ public double glucose = 0d;
+ public double delta = 0d;
+ public double avgdelta = 0d;
+ public double short_avgdelta = 0d;
+ public double long_avgdelta = 0d;
+ public long date = 0L;
+
+
+ public String log() {
+ return "Glucose: " + DecimalFormatter.to0Decimal(glucose) + " mg/dl " +
+ "Delta: " + DecimalFormatter.to0Decimal(delta) + " mg/dl" +
+ "Short avg. delta: " + " " + DecimalFormatter.to2Decimal(short_avgdelta) + " mg/dl " +
+ "Long avg. delta: " + DecimalFormatter.to2Decimal(long_avgdelta) + " mg/dl";
+ }
+
+ public GlucoseStatus() {
+ }
+
+ public GlucoseStatus round() {
+ this.glucose = Round.roundTo(this.glucose, 0.1);
+ this.delta = Round.roundTo(this.delta, 0.01);
+ this.avgdelta = Round.roundTo(this.avgdelta, 0.01);
+ this.short_avgdelta = Round.roundTo(this.short_avgdelta, 0.01);
+ this.long_avgdelta = Round.roundTo(this.long_avgdelta, 0.01);
+ return this;
+ }
+
+
+ @Nullable
+ public static GlucoseStatus getGlucoseStatusData() {
+ return getGlucoseStatusData(false);
+ }
+
+ @Nullable
+ public static GlucoseStatus getGlucoseStatusData(boolean allowOldData) {
+ // load 45min
+ //long fromtime = DateUtil.now() - 60 * 1000L * 45;
+ //List data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false);
+
+ synchronized (IobCobCalculatorPlugin.getPlugin().getDataLock()) {
+
+ List data = IobCobCalculatorPlugin.getPlugin().getBgReadings();
+
+ if (data == null) {
+ if (L.isEnabled(L.GLUCOSE))
+ log.debug("data=null");
+ return null;
+ }
+
+ int sizeRecords = data.size();
+ if (sizeRecords == 0) {
+ if (L.isEnabled(L.GLUCOSE))
+ log.debug("sizeRecords==0");
+ return null;
+ }
+
+ if (data.get(0).date < DateUtil.now() - 7 * 60 * 1000L && !allowOldData) {
+ if (L.isEnabled(L.GLUCOSE))
+ log.debug("olddata");
+ return null;
+ }
+
+ BgReading now = data.get(0);
+ long now_date = now.date;
+ double change;
+
+ if (sizeRecords == 1) {
+ GlucoseStatus status = new GlucoseStatus();
+ status.glucose = now.value;
+ status.short_avgdelta = 0d;
+ status.delta = 0d;
+ status.long_avgdelta = 0d;
+ status.avgdelta = 0d; // for OpenAPS MA
+ status.date = now_date;
+ if (L.isEnabled(L.GLUCOSE))
+ log.debug("sizeRecords==1");
+ return status.round();
+ }
+
+ ArrayList now_value_list = new ArrayList<>();
+ ArrayList last_deltas = new ArrayList<>();
+ ArrayList short_deltas = new ArrayList<>();
+ ArrayList long_deltas = new ArrayList<>();
+
+ // Use the latest sgv value in the now calculations
+ now_value_list.add(now.value);
+
+ for (int i = 1; i < sizeRecords; i++) {
+ if (data.get(i).value > 38) {
+ BgReading then = data.get(i);
+ long then_date = then.date;
+ double avgdelta;
+ long minutesago;
+
+ minutesago = Math.round((now_date - then_date) / (1000d * 60));
+ // multiply by 5 to get the same units as delta, i.e. mg/dL/5m
+ change = now.value - then.value;
+ avgdelta = change / minutesago * 5;
+
+ if (L.isEnabled(L.GLUCOSE))
+ log.debug(then.toString() + " minutesago=" + minutesago + " avgdelta=" + avgdelta);
+
+ // use the average of all data points in the last 2.5m for all further "now" calculations
+ if (0 < minutesago && minutesago < 2.5) {
+ // Keep and average all values within the last 2.5 minutes
+ now_value_list.add(then.value);
+ now.value = average(now_value_list);
+ // short_deltas are calculated from everything ~5-15 minutes ago
+ } else if (2.5 < minutesago && minutesago < 17.5) {
+ //console.error(minutesago, avgdelta);
+ short_deltas.add(avgdelta);
+ // last_deltas are calculated from everything ~5 minutes ago
+ if (2.5 < minutesago && minutesago < 7.5) {
+ last_deltas.add(avgdelta);
+ }
+ // long_deltas are calculated from everything ~20-40 minutes ago
+ } else if (17.5 < minutesago && minutesago < 42.5) {
+ long_deltas.add(avgdelta);
+ } else {
+ // Do not process any more records after >= 42.5 minutes
+ break;
+ }
+ }
+ }
+
+ GlucoseStatus status = new GlucoseStatus();
+ status.glucose = now.value;
+ status.date = now_date;
+
+ status.short_avgdelta = average(short_deltas);
+
+ if (last_deltas.isEmpty()) {
+ status.delta = status.short_avgdelta;
+ } else {
+ status.delta = average(last_deltas);
+ }
+
+ status.long_avgdelta = average(long_deltas);
+ status.avgdelta = status.short_avgdelta; // for OpenAPS MA
+
+ if (L.isEnabled(L.GLUCOSE))
+ log.debug(status.log());
+ return status.round();
+ }
+ }
+
+ public static double average(ArrayList array) {
+ double sum = 0d;
+
+ if (array.size() == 0)
+ return 0d;
+
+ for (Double value : array) {
+ sum += value;
+ }
+ return sum / array.size();
+ }
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java
index 84cd903f0a..4f21a1f0ac 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.java
@@ -65,7 +65,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
private volatile List bgReadings = null; // newest at index 0
private volatile List bucketed_data = null;
- final Object dataLock = new Object();
+ private final Object dataLock = new Object();
boolean stopCalculationTrigger = false;
private Thread thread = null;
@@ -108,6 +108,10 @@ public class IobCobCalculatorPlugin extends PluginBase {
return bucketed_data;
}
+ public Object getDataLock() {
+ return dataLock;
+ }
+
// roundup to whole minute
public static long roundUpTime(long time) {
if (time % 60000 == 0)
@@ -630,6 +634,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
log.debug("Invalidating cached data because of new profile. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
iobTable = new LongSparseArray<>();
autosensDataTable = new LongSparseArray<>();
+ basalDataTable = new LongSparseArray<>();
}
runCalculation("onNewProfile", System.currentTimeMillis(), false, true, ev);
}
@@ -652,9 +657,10 @@ public class IobCobCalculatorPlugin extends PluginBase {
stopCalculation("onEventPreferenceChange");
synchronized (dataLock) {
if (L.isEnabled(L.AUTOSENS))
- log.debug("Invalidating cached data because of preference change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records");
+ log.debug("Invalidating cached data because of preference change. IOB: " + iobTable.size() + " Autosens: " + autosensDataTable.size() + " records" + " BasalData: " + basalDataTable.size() + " records");
iobTable = new LongSparseArray<>();
autosensDataTable = new LongSparseArray<>();
+ basalDataTable = new LongSparseArray<>();
}
runCalculation("onEventPreferenceChange", System.currentTimeMillis(), false, true, ev);
}
@@ -730,6 +736,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
log.debug("Clearing cached data.");
iobTable = new LongSparseArray<>();
autosensDataTable = new LongSparseArray<>();
+ basalDataTable = new LongSparseArray<>();
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java
index 492f3c0ff1..c483ffd2a6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Thread.java
@@ -96,7 +96,7 @@ public class IobCobOref1Thread extends Thread {
long oldestTimeWithData = iobCobCalculatorPlugin.calculateDetectionStart(end, limitDataToOldestAvailable);
- synchronized (iobCobCalculatorPlugin.dataLock) {
+ synchronized (iobCobCalculatorPlugin.getDataLock()) {
if (bgDataReload) {
iobCobCalculatorPlugin.loadBgData(end);
iobCobCalculatorPlugin.createBucketedData();
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java
index 2aacb4f453..9ddf18abb0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobThread.java
@@ -95,7 +95,7 @@ public class IobCobThread extends Thread {
long oldestTimeWithData = iobCobCalculatorPlugin.calculateDetectionStart(end, limitDataToOldestAvailable);
- synchronized (iobCobCalculatorPlugin.dataLock) {
+ synchronized (iobCobCalculatorPlugin.getDataLock()) {
if (bgDataReload) {
iobCobCalculatorPlugin.loadBgData(end);
iobCobCalculatorPlugin.createBucketedData();
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java
index 2d636037c6..22d98368a6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/services/DanaRExecutionService.java
@@ -18,7 +18,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
@@ -166,7 +166,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal());
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
- MainApp.bus().post(new EventProfileSwitchChange());
+ MainApp.bus().post(new EventProfileNeedsUpdate());
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java
index c35b17620a..749b977c2c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRKorean/services/DanaRKoreanExecutionService.java
@@ -18,7 +18,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
@@ -171,7 +171,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal());
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
- MainApp.bus().post(new EventProfileSwitchChange());
+ MainApp.bus().post(new EventProfileNeedsUpdate());
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
index a31bf01c8e..06a3a651ca 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/services/DanaRSService.java
@@ -20,7 +20,7 @@ import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
@@ -149,7 +149,7 @@ public class DanaRSService extends Service {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
- MainApp.bus().post(new EventProfileSwitchChange());
+ MainApp.bus().post(new EventProfileNeedsUpdate());
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java
index 66c6e22eba..2d2d2526dd 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRv2/services/DanaRv2ExecutionService.java
@@ -19,7 +19,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventPreferenceChange;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
@@ -188,7 +188,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal());
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
- MainApp.bus().post(new EventProfileSwitchChange());
+ MainApp.bus().post(new EventProfileNeedsUpdate());
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java
index 5da86217f0..c59d5e1836 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/treatments/fragments/TreatmentsProfileSwitchFragment.java
@@ -27,13 +27,13 @@ import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.services.Intents;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.Source;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
import info.nightscout.androidaps.plugins.common.SubscriberFragment;
import info.nightscout.androidaps.plugins.general.nsclient.UploadQueue;
import info.nightscout.androidaps.utils.DateUtil;
@@ -216,7 +216,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
}
@Subscribe
- public void onStatusEvent(final EventProfileSwitchChange ev) {
+ public void onStatusEvent(final EventProfileNeedsUpdate ev) {
updateGUI();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
index c13632e9fb..a11bacc4e9 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
+++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
@@ -381,7 +381,7 @@ public class CommandQueue {
Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.gs(R.string.not_eng_mode_or_release), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
if (callback != null)
- callback.result(new PumpEnactResult().success(false).comment(MainApp.gs(R.string.not_eng_mode_or_release))).run();
+ callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.not_eng_mode_or_release))).run();
return false;
}
@@ -394,7 +394,7 @@ public class CommandQueue {
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.gs(R.string.basalvaluebelowminimum), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
if (callback != null)
- callback.result(new PumpEnactResult().success(false).comment(MainApp.gs(R.string.basalvaluebelowminimum))).run();
+ callback.result(new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.basalvaluebelowminimum))).run();
return false;
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java
index 9acc217904..7a9aa31c46 100644
--- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java
@@ -13,7 +13,7 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.data.Profile;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
@@ -73,7 +73,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
}
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
- MainApp.bus().post(new EventProfileSwitchChange());
+ MainApp.bus().post(new EventProfileNeedsUpdate());
} else if (isStatusOutdated && !pump.isBusy()) {
lastReadStatus = System.currentTimeMillis();
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/SmsReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/SmsReceiver.java
new file mode 100644
index 0000000000..f527375349
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/receivers/SmsReceiver.java
@@ -0,0 +1,7 @@
+package info.nightscout.androidaps.receivers;
+
+/**
+ * Forward received SMS intents. This is a separate class, because unlike local broadcasts handled by DataReceiver,
+ * receiving SMS requires a special permission in the manifest, which necessitates a separate receiver.
+ */
+public class SmsReceiver extends DataReceiver {}
diff --git a/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java b/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java
index e95cd7c479..4917789db1 100644
--- a/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java
+++ b/app/src/main/java/info/nightscout/androidaps/services/AlarmSoundService.java
@@ -75,8 +75,11 @@ public class AlarmSoundService extends Service {
@Override
public void onDestroy() {
- player.stop();
- player.release();
+ if (player != null) {
+ player.stop();
+ player.release();
+ }
+
if (L.isEnabled(L.CORE))
log.debug("onDestroy");
}
diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java
index 3dad4535ac..9049ad7463 100644
--- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.java
@@ -22,7 +22,7 @@ import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventProfileStoreChanged;
-import info.nightscout.androidaps.events.EventProfileSwitchChange;
+import info.nightscout.androidaps.events.EventProfileNeedsUpdate;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.plugins.constraints.objectives.events.EventObjectivesSaved;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus;
@@ -115,7 +115,7 @@ public class SetupWizardActivity extends AppCompatActivity {
}
@Subscribe
- public void onEventProfileSwitchChange(EventProfileSwitchChange ignored) {
+ public void onEventProfileSwitchChange(EventProfileNeedsUpdate ignored) {
updateButtons();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.java b/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.java
index e47a74e17f..cd789ee225 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/BolusWizard.java
@@ -3,7 +3,7 @@ package info.nightscout.androidaps.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.TempTarget;
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.java b/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.java
index e94e21b94d..92520d1139 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/FabricPrivacy.java
@@ -112,11 +112,20 @@ public class FabricPrivacy {
if (!fabricEnabled()) return;
String closedLoopEnabled = MainApp.getConstraintChecker().isClosedLoopAllowed().value() ? "CLOSED_LOOP_ENABLED" : "CLOSED_LOOP_DISABLED";
+ // Size is limited to 36 chars
+ String remote = BuildConfig.REMOTE
+ .replace("https://","")
+ .replace("http://","")
+ .replace(".git", "")
+ .replace(".com/", ":")
+ .replace(".org/", ":")
+ .replace(".net/", ":");
MainApp.getFirebaseAnalytics().setUserProperty("Mode", BuildConfig.APPLICATION_ID + "-" + closedLoopEnabled);
MainApp.getFirebaseAnalytics().setUserProperty("Language", LocaleHelper.getLanguage(MainApp.instance()));
MainApp.getFirebaseAnalytics().setUserProperty("Version", BuildConfig.VERSION);
MainApp.getFirebaseAnalytics().setUserProperty("HEAD", BuildConfig.HEAD);
+ MainApp.getFirebaseAnalytics().setUserProperty("Remote", remote);
if (ConfigBuilderPlugin.getPlugin().getActivePump() != null)
MainApp.getFirebaseAnalytics().setUserProperty("Pump", ConfigBuilderPlugin.getPlugin().getActivePump().getClass().getSimpleName());
if (ConfigBuilderPlugin.getPlugin().getActiveAPS() != null)
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/MidnightTime.java b/app/src/main/java/info/nightscout/androidaps/utils/MidnightTime.java
index 668ca02e96..235bb9c6e9 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/MidnightTime.java
+++ b/app/src/main/java/info/nightscout/androidaps/utils/MidnightTime.java
@@ -5,11 +5,13 @@ import android.util.LongSparseArray;
import java.util.Calendar;
public class MidnightTime {
- private static final LongSparseArray times = new LongSparseArray<>();
+ static final LongSparseArray times = new LongSparseArray<>();
private static long hits = 0;
private static long misses = 0;
+ private static final int THRESHOLD = 100000;
+
public static long calc() {
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);
@@ -36,10 +38,17 @@ public class MidnightTime {
m = c.getTimeInMillis();
times.append(time, m);
++misses;
+ if (times.size() > THRESHOLD) resetCache();
}
return m;
}
+ static void resetCache() {
+ hits = 0;
+ misses = 0;
+ times.clear();
+ }
+
public static String log() {
return "Hits: " + hits + " misses: " + misses + " stored: " + times.size();
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/VersionChecker.java b/app/src/main/java/info/nightscout/androidaps/utils/VersionChecker.java
deleted file mode 100644
index fd636b4596..0000000000
--- a/app/src/main/java/info/nightscout/androidaps/utils/VersionChecker.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package info.nightscout.androidaps.utils;
-
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import info.nightscout.androidaps.BuildConfig;
-import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.R;
-import info.nightscout.androidaps.logging.L;
-import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
-import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
-
-import static android.content.Context.CONNECTIVITY_SERVICE;
-
-public class VersionChecker {
- private static Logger log = LoggerFactory.getLogger(L.CORE);
-
- public static void check() {
- if (isConnected())
- new Thread(() -> {
- HttpClient client = new DefaultHttpClient();
- HttpGet request = new HttpGet("https://raw.githubusercontent.com/MilosKozak/AndroidAPS/master/app/build.gradle");
- HttpResponse response;
-
- try {
- response = client.execute(request);
- InputStream inputStream = response.getEntity().getContent();
-
- if (inputStream != null) {
- String result = findLine(inputStream);
- if (result != null) {
- int compare = result.compareTo(BuildConfig.VERSION_NAME.replace("\"", ""));
- if (compare == 0) {
- log.debug("Version equal to master");
- return;
- } else if (compare > 0) {
- log.debug("Version outdated. Found " + result);
- Notification notification = new Notification(Notification.NEWVERSIONDETECTED, String.format(MainApp.gs(R.string.versionavailable), result), Notification.LOW);
- MainApp.bus().post(new EventNewNotification(notification));
- return;
- } else {
- log.debug("Version newer than master. Are you developer?");
- return;
- }
- }
- }
-
- log.debug("Github master version not found");
-
- } catch (IOException e) {
- e.printStackTrace();
- log.debug("Github master version check error");
- }
- }).start();
- else
- log.debug("Github master version no checked. No connectivity");
- }
-
- // convert inputstream to String
- private static String findLine(InputStream inputStream) throws IOException {
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
- String line;
- String regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)";
- Pattern p = Pattern.compile(regex);
-
- while ((line = bufferedReader.readLine()) != null) {
- Matcher m = p.matcher(line);
- if (m.matches()) {
- log.debug("+++ " + line);
- return m.group(3);
- } else {
- log.debug("--- " + line);
- }
- }
- inputStream.close();
- return null;
- }
-
- // check network connection
- public static boolean isConnected() {
- ConnectivityManager connMgr = (ConnectivityManager) MainApp.instance().getApplicationContext().getSystemService(CONNECTIVITY_SERVICE);
- NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
- return networkInfo != null && networkInfo.isConnected();
- }
-
-}
diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml
index 1200a8e2e3..a0a0048ca1 100644
--- a/app/src/main/res/values-af/strings.xml
+++ b/app/src/main/res/values-af/strings.xml
@@ -147,8 +147,6 @@
Beperkings skending
Bolus aflewering fout
Tempbasal aflewering fout
- Basale waarde [%]
- % (100% =huidig)
Aanvaar nuwe tydelike basale:
Behandeling
Rekenaar
@@ -248,7 +246,6 @@
Pomp IAB
Daaglikse eenhede
Laaste bolus
- %.1fh gelede
Ongeldige invoer
Waarde nie behoorlik gestel
Herlaai profiel
@@ -528,7 +525,6 @@
Insulien weerstandige volwasse
Kies asseblief pasiënt ouderdom om veiligheids limiete te stel
Glimp
- %s benodig battery optimisering whitelisting vir behoorlike prestasie
Lus opgeskort
Opgeskort (%1$d m)
Superbolus (%1$d m)
@@ -564,8 +560,6 @@
Wys status vlae vir cage, iage, sage, stoor en battery vlak op tuisskerm.
Drempel waarskuwings stoor vlak [U]
Drempel kritieke stoor vlak [U]
- Drempel waarskuwing battery vlak [%]
- Drempel kritieke battery vlak [%]
IAB
KOB
Firmware
@@ -764,7 +758,6 @@
Loop tans
Kanselleer TBR
Stel TBR (%1$d%% / %2$d min)
- Bolusing (%.1f U)
Verfris
Versoekte bewerking nie ondersteun deur pomp
Onveilige gebruik: uitgebreide of multigolf boluses is aktief. Lus modus is gestel om laag te opskort net 6 ure. Net gewone boluses is ondersteun in lus modus
diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml
index 62a783510e..e40152dce3 100644
--- a/app/src/main/res/values-bg/strings.xml
+++ b/app/src/main/res/values-bg/strings.xml
@@ -146,8 +146,8 @@
Нарушено ограничение
Грешка при подаване на болус
Грешка при подаване на временен базал
- Стойност на базал [%]
- % (100% = текущ)
+ Базална стойност [%%]
+ %% (100%% = текущ)
Приложи нов временен базал:
Болус
Калкулатор
@@ -247,7 +247,7 @@
IOB на помпата
Инсулин за деня
Последен болус:
- преди %.1fч
+ преди %1$.1fч
Грешни входящи данни
Неправилна стойност
Презареди профил
@@ -527,7 +527,7 @@
Възрастни с голяма инсулинова резистентност
Изберете възраст за определяне лимитите на безопасност
Glimp
- %s се нуждае от зключване на оптимизиране на батерията за пълна функционалност
+ %1$s се нуждае от изключване от списъка за оптимизиране на батерията за пълна функционалност
Loop изключен
Изключен (%1$d мин)
Суперболус (%1$d мин)
@@ -563,8 +563,8 @@
Покажи статус светлини за канула, инсулин, сензор, резервоар и батерията на началния екран.
Ниво за аларма за останал инсулин в резервоара [Е]
Критично ниво на останал инсулин в резервоар [Е]
- Аларма за заряд на батерия [%]
- Критично ниво на батерията под [%]
+ Ниско ниво на батерията под [%%]
+ Критично ниво на батерията под [%%]
IOB
СОВ
Фърмуер
@@ -763,7 +763,7 @@
Изпълнява
Отказва временен базал
Задава временен базал (%1$d%% / %2$d min)
- Болус (%.1f U)
+ Болус (%1$.1f Е)
Обновява
Исканата операция не се поддържа от помпата
Опасно използване: удължени или многовълнови болуси са активни. Помпата е изключена за само 6 часа. Само нормални болуси се поддържат.
@@ -1155,6 +1155,10 @@
Грешен код. Командата не е изпълнена.
Не е конфигуриран
Създаден запис - Промяна на профил
+ Проверка на версията
+ стара версия
+ много стара версия
+ Има нова версия от най-малко %1$d дни! Връщане към LGS след 60 дни, цикълът ще бъде изключен след 90 дни
- %1$d дeн
- %1$d дни
diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml
index 61864568d3..96a66c5b8b 100644
--- a/app/src/main/res/values-cs/strings.xml
+++ b/app/src/main/res/values-cs/strings.xml
@@ -147,8 +147,8 @@
Mimo povolený rozsah
Chyba podání bolusu
Chyba nastavování dočasného bazálu
- Hodnota bazálu [%]
- % (100% = současný)
+ Hodnota bazálu [%%]
+ %% (100%% = současný)
Spustit nový dočasný bazál:
Bolus
Kalkulačka
@@ -248,7 +248,7 @@
IOB z pumpy
Jednotek za den
Poslední bolus
- před %.1fh
+ před %1$.1fh
Chybná vstupní data
Hodnota nenastavena správně
Obnovit profil
@@ -528,7 +528,7 @@
Dospělý s nízkou citlivostí
Vyberte věk pacienta pro nastavení bezpečnostních limitů
Glimp
- %s potřebuje vypnout optimalizace baterie pro optimální výkon
+ %1$s potřebuje vypnout optimalizace baterie pro optimální výkon
Smyčka pozastavena
Pozastaveno (%1$d min)
Superbolus (%1$d m)
@@ -564,8 +564,8 @@
Povolte stavové indikátory pro stáří kanyly, inzulínu, senzoru, zásobníku a baterie na domovské obrazovce.
Úroveň varování stavu zásobníku [U]
Úroveň kritického varování stavu zásobníku [U]
- Úroveň varování stavu baterie [%]
- Úroveň kritického varování stavu baterie [%]
+ Úroveň varování stavu baterie [%%]
+ Úroveň kritického varování stavu baterie [%%]
IOB
COB
Firmware
@@ -764,7 +764,7 @@
Běží
Rušení dočasného bazálu
Nastavování doč. bazálu (%1$d%% / %2$d min)
- Bolus (%.1f U)
+ Bolus (%1$.1f U)
Obnovování
Požadovaná operace není pumpou podporována
Nebezpečné použití: extended nebo multiwave bolus je aktivní. Pumpa byla vypnuta jen na 6 hodin. Povolené jsou pouze normální bolusy.
@@ -1156,6 +1156,10 @@
Nesprávný kód. Příkaz zrušen.
Není nakonfigurováno
Přepnutí profilu vytvořeno
+ Kontrola verze
+ stará verze
+ velmi stará verze
+ Nová verze je dostupná minimálně %1$d dní! Přepnutí na ochranu před nízkou glykémií po 60 dnech, vypnutí smyčky po 90 dnech
- %1$d den
- %1$d dnů
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index ed46e6a8ea..2d0a15d6ac 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -147,8 +147,8 @@
Beschränkungen wurden verletzt oder Limit erreicht.
Bolus-Abgabefehler
TBR Abgabe-Fehler
- Basal-Wert [%]
- % (100% = aktuell)
+ Basal-Wert [%%]
+ %% (100%% = aktuell)
Akzeptiere neue TBR:
Bolus
Rechner
@@ -248,7 +248,7 @@
Pumpen-IOB
Tägliche Einheiten
Letzter Bolus:
- vor %.1f h
+ vor %1$.1f Stunde
Ungültige Eingabedaten
Wert nicht korrekt gesetzt
Profil neuladen
@@ -529,7 +529,7 @@ maxIOB = durchschnittlicher Essensbolus + 3 x maximale Basalrate
Insulinresistenter Erwachsener
Bitte wähle das Patientenalter, um die Sicherheits-Limits festzulegen
Glimp
- %s benötigt eine deaktivierte Akku-Leistungsoptimierung, um korrekt arbeiten zu können.
+ %1$s benötigt eine deaktivierte Akku-Leistungsoptimierung, um korrekt arbeiten zu können.
Loop pausiert
Pausiert (%1$d min)
Superbolus (%1$d m)
@@ -565,8 +565,8 @@ maxIOB = durchschnittlicher Essensbolus + 3 x maximale Basalrate
Statusanzeige für CAGE, IAGE, SAGE, Reservoir- und Batteriestand auf dem Homescreen.
Warnschwelle Reservoirstand [IE]
Warnschwelle kritischer Reservoirstand [IE]
- Warnschwelle Batteriestand [%]
- Warnschwelle kritischer Batteriestand [%]
+ Warnschwelle Batteriestand [%%]
+ Warnschwelle kritischer Batteriestand [%%]
IOB
COB
Firmware
@@ -1158,6 +1158,10 @@ Unerwartetes Verhalten.
Falscher Code. Befehl wurde abgebrochen.
Nicht konfiguriert
Profilwechsel wurde erstellt
+ Versionsprüfer
+ Vorherige Version
+ sehr alte Version
+ Neue Version für mindestens %1$d Tage verfügbar! Rückfall zur sensorunterstützten Pumpentherapie nach 60 Tagen, Loop wird nach 90 Tagen deaktiviert
- %1$d Tag
- %1$d Tage
diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml
index a767f9766c..da0a53ba6e 100644
--- a/app/src/main/res/values-el/strings.xml
+++ b/app/src/main/res/values-el/strings.xml
@@ -146,8 +146,8 @@
Παραβίαση Περιορισμών
Σφάλμα παράδοσης Bolus
Σφάλμα παράδοσης Προσ Ρυθμού
- Τιμή Βασικού [%]
- % (100% = τρέχων)
+ Τιμή Βασικού [%%]
+ %% (100%% = τρέχων)
Αποδοχή νέου Προσ Ρυθμού:
Θεραπεία
Υπολογιστής
@@ -247,7 +247,7 @@
IOB αντλίας
Μονάδες ανά ημέρα
Τελευταίο Bolus:
- πριν από %.1fh
+ %1$.1fώρες πριν
Μη έγκυρα δεδομένα
Η τιμή δεν μπήκε σωστά
Ξαναφορτώστε το προφίλ
@@ -527,7 +527,7 @@
Αντίσταση ινσουλίνης ενηλίκων
Παρακαλώ επιλέξτε ηλικία χρήστη για να ορισθούν όρια ασφαλείας
Glimp
- Το %s πρέπει να απενεργοποιήσει τη βελτιστοποίηση της μπαταρίας για βέλτιστη απόδοση
+ %1$s χρειάζεται λίστα βελτιστοποίησης μπαταρίας για σωστή απόδοση
Κύκλωμα σε αναστολή
Αναστολή (%1$d m)
Superbolus (%1$d m)
@@ -563,8 +563,8 @@
Ενεργοποίηση του φωτισμού κατάστασης για cage, iage, sage, reservoir και επίπεδο μπεταρίας στην αρχική οθόνη.
Όριο προειδοποίησης χαμηλής αμπούλας [U]
Όριο προειδοποίησης πολύ χαμηλής αμπούλας [U]
- Όριο προειδοποίησης χαμηλής μπαταρίας [%]
- Όριο προειδοποίησης πολύ χαμηλής μπαταρίας [%]
+ Όριο προειδοποίησης χαμηλής μπαταρίας [%%]
+ Όριο προειδοποίησης πολύ χαμηλής μπαταρίας [%%]
IOB
COB
Έκδοση
@@ -763,7 +763,7 @@
Εκτελείτε
Ακυρώνεται TBR
Ρύθμιση TBR (%1$d%% / %2$d λεπτά)
- Bolus (%.1f U)
+ Bolus (%1$.1f U)
Ανανέωση
Η λειτουργία που ζητήθηκε δεν υποστηρίζεται από την αντλία
Επικίνδυνη χρήση: Εκτεταμένο ή πολλαπλά bolus είναι ενεργό. Το κύκλωμα απενεργοποιήθηκε λόγω low-suspend μόνο για 6 ώρες. Επιτρέπονται μόνο κανονικά bolus
@@ -1155,6 +1155,10 @@
Λάθος κωδικός. Η εντολή ακυρώθηκε.
Δεν έχει ρυθμιστεί
Δημιουργήθηκε αλλαγή προφίλ
+ Έλεγχος Έκδοσης
+ παλιά έκδοση
+ πολύ παλιά έκδοση
+ Νέα έκδοση για τουλάχιστον %1$d ημέρες διαθέσιμη! Επιστροφή σε LGS μετά από 60 ημέρες, το κύκλωμα θα απενεργοποιηθεί μετά από 90 ημέρες
- %1$d ημέρα
- %1$d ημέρες
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 9d800ccc59..93d2498e5a 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -143,8 +143,6 @@
Violación restricciones
Error de administración del bolo
Basal Temporal no emitida
- Valor basal [%]
- % (100% = actual)
Aceptar nueva basal temporal:
Tratamiento
Calculadora
@@ -244,7 +242,6 @@
Bomba IOB
Unidades diarias
Último bolo
- Hace %.1fh
Datos inválidos
Valor no establecido correctamente
Recargar Perfil
@@ -503,7 +500,6 @@
Adulto resistente a la insulina
Por favor elige la edad del paciente para ajustar los límites de seguridad
Glimp
- %s necesita optimización de batería lista blanca para funcionar bien
Loop desactivado
Desactivado (%1$d m)
Superbolo (%1$d m)
@@ -539,8 +535,6 @@
Habilitar las luces de estado para tiempo de la canula, tiempo de la insulina, tiempo del sensor y nivel de bateria en la pantalla de inicio.
Umbral de advertencia de nivel de reservorio [U]
Umbral crítico de nivel de reservorio [U]
- Umbral de advertencia de nivel de pila [%]
- Umbral crítico de nivel de batería [%]
IOB
COB
Firmware
@@ -734,7 +728,6 @@
Funcionando
Cancelando TBR
Poniendo TBR (%1$d%% / %2$d min)
- Emitiendo bolo (%.1f U)
Actualizando
Acción requerida no disponible por la bomba
Uso inseguro: bolo extendido o multionda activo. El modo del lazo ha sido fijado a sólo suspensión en baja glucosa durante 6 horas. En modo lazo sólo se soportan los bolo estándar.
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 9f05d24a84..8c13305af0 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -146,8 +146,8 @@
Violation des restrictions
Erreur injection bolus
Erreur injection basal temporaire
- Valeur Basal [%]
- % (100% = actuel)
+ Valeur de Basal [%%]
+ %% (100%% = actuel)
Accepter nouveau basal temporaire :
Traitement
Calculatrice
@@ -248,7 +248,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Insuline Active pompe
Unités journalières
Dernier bolus
- %.1fh passées
+ il y a %1$.1fh
Données saisies invalides
Valeur pas correctement définie
Actualiser le profil
@@ -528,7 +528,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Adulte résistant à l\'insuline
Veuillez svp sélectionner l’âge du patient pour définir les limites de sécurité
Glimp
- %s a besoin de la liste blanche de l’optimisation batterie pour une bonne performance
+ %1$s a besoin d\'optimisation de la batterie (whitelisting) pour une performance correcte
La Boucle est suspendue
Suspendu (%1$d m)
Superbolus (%1$d m)
@@ -564,8 +564,8 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Activer les lumières d\'état pour AgeC, AgeI, AgeS, niveaux du réservoir et de batterie sur l\'écran d\'accueil.
Seuil d\'avertissement de niveau du réservoir [U]
Seuil critique de niveau du réservoir [U]
- Seuil d’avertissement du niveau de batterie [%]
- Seuil critique du niveau de la batterie [%]
+ Seuil d’avertissement du niveau de batterie [%%]
+ Seuil critique du niveau de la batterie [%%]
IA
GA
Firmware
@@ -764,7 +764,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
En cours d\'exécution
Annulation en cours du TBR
Paramétrer TBR (%1$d%% / %2$d min)
- Injection du bolus en cours (%.1f U)
+ Injection du Bolus en cours (%1$.1f U)
Actualisation en cours
L\'opération demandée n\'est pas prise en charge par la pompe
Utilisation dangereuse : les bolus étendus ou carrés sont actifs. Le mode Boucle a été programmé pour des suspensions seulement pour 6 heures. Uniquement les bolus normaux sont pris en charge par le mode Boucle
@@ -1156,6 +1156,10 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Code incorrect. Commande annulée.
Non configuré
Changement de profil effectué
+ Vérificateur de version
+ ancienne version
+ très ancienne version
+ Une nouvelle version est disponible depuis au moins %1$d jours ! Retour au traitement par pompe assistée par capteur (Arrêt par Glycémie Basse (AGB), Low Glucose Suspend (LGS) ) après 60 jours et la Boucle sera désactivée après 90 jours
- %1$d jour
- %1$d jours
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index cbb98e7289..5d942f4818 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -143,8 +143,6 @@
Vincolo Violato
Errore di erogazione del bolo
Errore di somministrazione basale temporale
- Valore Basale [%]
- % (100% = corrente)
Accettare il nuovo basale temp
Boli
Calcolatore
@@ -244,7 +242,6 @@
IOB Microinfusore
Unita\' giornaliera
Ultimo Bolo
- %.1fh fa
Data Errata
Valore non impostato correttamente
Aggiorna Profilo
@@ -502,7 +499,6 @@
Insulina resistente
Si prega di selezionare l\'età paziente e di impostare i limiti di sicurezza
Glimp
- %s ha bisogno di whitelisting di ottimizzazione della batteria per un buon funzionamento
Sospensione Loop
Sospendi (%1$d m)
Superbolo (%1$d m)
@@ -722,7 +718,6 @@
In esecuzione
Annullamento di TBR
L\'impostazione di TBR (%1$d%% / %2$d min)
- Bolusing (%.1f U)
Aggiornando
Richiesta operazione non supportata dal micro
L\'utilizzo non sicuro: estesi o multiwave boli sono attivi. Modalità loop è stato impostato basso-sospendere solo 6 ore. Solo normali boli sono supportati in modalità loop
diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml
index 80b2994a0e..46b451b602 100644
--- a/app/src/main/res/values-ko/strings.xml
+++ b/app/src/main/res/values-ko/strings.xml
@@ -143,8 +143,6 @@
제한 위반
Bolus 주입 에러
임시Basal 주입 에러
- Basal값[%]
- % (100% = 현재)
새 임시Basal 적용:
관리
계산기
@@ -244,7 +242,6 @@
펌프 IOB
일 인슐린 총량
최근 Bolus:
- %.1f시간 전
사용할수 없는 입력 데이터
값이 제대로 설정되지 않았습니다
프로파일 새로고침
@@ -502,7 +499,6 @@
인슐린 저항성 높은 성인
안전제한을 설정하기 위해 당뇨인의 나이를 선택하세요
Glimp
- 최적의 성능을 위해 %s에서 배터리 최적화를 해제해야합니다.
Loop 일시중지
일시중지중 (%d분)
Superbolus (%1$d 분)
@@ -722,7 +718,6 @@
실행중
임시기초주입 취소중
임시기초주입 설정중 (%1$d%% / %2$d분)
- Bolus 주입중(%.1f U)
새로고침중
요청하신 동작은 펌프에서 지원하지 않습니다.
위험한 사용: 확장Bolus 혹은 멀티웨이브Bolus가 활성화 됩니다. Loop 모드가 저혈당 방지로 오직 6시간만 설정됩니다. Loop 모드에선 일반 Bolus만 지원합니다.
diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml
index 3656ece383..f07634291b 100644
--- a/app/src/main/res/values-lt/strings.xml
+++ b/app/src/main/res/values-lt/strings.xml
@@ -8,9 +8,10 @@
Iš naujo nustatyti duomenų bazę
Ar tikrai norite iš naujo nustatyti duomenų bazę?
Išeiti
+ Naudoti ištęstinį bolusą >200%%
DanaR Bluetooth įrenginys
Visada naudoti bazės absoliučias vertes
- Prašome iš naujo paleisti telefoną arba sistemos nustatymuose iš naujo paleisti AndroidAPS \nkitaip AndroidAPS negalės registruoti prisijungimų (svarbu stebint ir tikrinant, ar algoritmai veikia tinkamai)!
+ Prašome iš naujo paleisti telefoną arba sistemos nustatymuose iš naujo paleisti AndroidAPS \nkitaip AndroidAPS negalės registruoti prisijungimų (svarbu stebėti ir tikrinti ar algoritmai veikia tinkamai)!
Mygtukai greitesniam pagrindinių funkcijų paleidimui
Papildomų įrašų žurnalas.
Naudojama aktyvių įskiepių konfigūravimui
@@ -145,8 +146,8 @@
Apribojimų pažeidimas
Boluso suleidimo klaida
Laikinos bazės suleidimo klaida
- Valandinė bazė [%]
- % (100 % = dabartinis)
+ Valandinė bazė [%%]
+ %%(100%% - pasirinkta)
Patvirtinti naują laikiną bazę:
Terapija
Skaičiuotuvas
@@ -246,7 +247,7 @@
Pompos AIO
Paros insulinas
Paskutinis bolusas
- prieš %.1fval
+ Prieš %1$.1f valandų
Neteisingai įvesti duomenys
Vertė nėra tinkamai nustatyta
Atnaujinti profilį
@@ -312,6 +313,7 @@
Stop
Paspausta STOP
Laukiama ryšio su pompa
+ Bus suleista %1$.2fvv
Nustatymai vizualizacijai, monitoringui ir bazės verčių bei koeficientų analizei
Įsitikinkite, kad gliukozės duomenys rodomi Nightscout, o pompos insulino duomenys yra įkelti
Aktyvuojamas atviras ciklas
@@ -334,6 +336,7 @@
Ciklas išjungtas
Ciklas įjungtas
%1$.2f apribotas iki %2$.2f
+ Vertė %1$s viršija griežtą limitą
Nuotolinis valdymas negalimas
Nuotolinis bolusas negalimas. Bandykite vėliau.
Norėdami aktyvuoti %1$.2fvv/val bazę, kurios trukmė %2$d min, atsakykite kodu %3$s
@@ -460,6 +463,7 @@
Profilis
Numatytoji reikšmė: 3 tai pagrindinis OpenAPS saugiklis. Jis apriboja Jūsų valandinę bazę iki trigubos maksimalios valandinės bazės (standartiniu atveju). Jums greičiausiai neprireiks šios reikšmės keisti, tačiau turėtumėte žinoti, kad ji naudojama kaip saugiklis apskaičiuojant \"3x maksimali dienos bazė; 4x dabartinė valandinė bazė\".
Numatytoji reikšmė: 4 tai antras pagrindinis OpenAPS saugiklis, apskaičiuojant \"3x maksimali dienos bazė; 4x dabartinė valandinė bazė\". Jis reiškia, kad jūsų valandinė bazė, nepriklausomai nuo to, kokia maksimali valandinė bazė suprogramuota pompoje, negali būti didesnė, nei keturguba dabartinė valandinė bazė. Tai apsaugo Jus nuo pavojingų situacijų, kai nustatoma pernelyg didelė valandinė bazė, pilnai nesuprantant, kaip veikia algoritmas. Numatytoji reikšmė yra 4x; daugumai vartotojų niekada neprireikia šio skaičiaus keisti, o pajutus, kad \"atsitrenkiama\" į saugiklį, rekomenduojama peržiūrėti kitus nustatymus.
+ Numatytoji reikšmė: 1.2\nTai daugiklis Autosens (ir netrukus Autotune) funkcijoje, kuris nustato 20%% maksimalią ribą iki kurios Autosens gali padidinti valandinę bazę, sumažinti JIF ir tikslinę gliukozės vertę.
Numatytoji reikšmė: 0.7\nTai antras daugiklis Autosens funkcijoje, kuris nustato, kad Autosens gali iki minimalios 70 % ribos sumažinti valandinę bazę bei padidinti JIF ir tikslinę gliukozės vertę.
Autosens nustatomi tikslai
Numatytoji reikšmė: true\nTai suteikia Autosens funkcijai leidimą keisti tikslinės gliukozės vertes, JIF ir valandinę bazę.
@@ -472,6 +476,7 @@
Telefono numeris negalioja
Neteisingas SMS telefono numeris
Kalibravimas
+ Siųsti kalibraciją %1$.1f į xDrip?
xDrip+ neįdiegta
Kalibracija nusiųsta į xDrip
Kalibracija išsiųsta. xDrip programoje turi būti įgalintas gavimas.
@@ -522,7 +527,7 @@
Insulinui rezistentiškas suaugęs
Pasirinkite paciento amžių saugumo riboms nustatyti
Glimp
- %s įtraukite baterijos optimizavimą į baltąjį sąrašą, tinkamam veikimui užtikrinti
+ %1$s įtraukite į baterijos optimizavimo baltąjį sąrašą tinkamam veikimui užtikrinti
Ciklas sustabdytas
Sustabdyta (%1$d m)
Superbolusas (%1$d m)
@@ -558,8 +563,8 @@
Pradžios ekrane rodyti spalvotus indikatorius adatos, insulino, sensoriaus naudojimo trukmei bei baterijos įkrovimo lygiui.
Įspėjimo apie žemą rezervuaro lygį riba [U]
Įspėjimo apie kritiškai žemą rezervuaro lygį riba [U]
- Įspėjimo apie žemą baterijos įkrovimo lygį riba [%]
- Įspėjimo apie kritiškai žemą baterijos įkrovimo lygį riba [%]
+ Įspėjimo apie žemą baterijos įkrovimo lygį riba [%%]
+ Įspėjimo apie kritiškai žemą baterijos įkrovimo lygį riba [%%]
AIO
AAO
Programinė įranga
@@ -612,6 +617,7 @@
Angliavandenių įsisavinimo parametrai
Maksimalus angliavandenių įsisavinimo laikas [h]
Laikas, per kurį visi maisto angliavandeniai, tikėtina, bus įsisavinti
+ Rodyti ištęstinį boliusą kaip %%
SAMŽ
IAMŽ
KAMŽ
@@ -724,6 +730,8 @@
Siųsti KG duomenis į xDrip+
Xdrip+ pasirinkite 640g/Eversense duomenų šaltinį
NSClient KG
+ Valandinė bazė pakeista mažiausia palaikoma verte: %1$s
+ Valandinė bazė pakeista didžiausia palaikoma verte: %1$s
KG apskaičiavimas
Bolusų AIO apskaičiavimas
Bazės AIO apskaičiavimas
@@ -741,6 +749,8 @@
Uždaras ciklas aktyvus
Maksimalus AIO nustatytas tinkamai
KG šaltinis pasirinktas teisingai
+ Bazės reikšmės nesuderintos su valandomis: %1$s
+ Netinkamas profilis: %1$s
Programuojamas bolusas
Atnaujinti
Būsena
@@ -753,7 +763,7 @@
Vykdoma
Laikina bazė atšaukiama
Nustatyti laikiną bazę (%1$d%% / %2$d min)
- Bolusas (%.1f vv)
+ Leidžiamas bolusas (%1$.1f vv)
Atnaujinama
Pompa negali įvykdyti prašomos operacijos
Nesaugu: aktyvus ištęstinis arba dvibangis bolusas. Ciklas nustatytas stabdymui prie žemo tik 6 valandoms. Aktyvūs tik paprasti bolusai.
@@ -1082,6 +1092,7 @@
Įrašyti darbo režimo pakeitimus
Įrašyti įspėjimus
Aktyvuoti LBD emuliaciją
+ Naudoti ištęstinius bolusus vietoj laikinos bazės, kai viršijama 250%% riba
Atjungimo vėlavimas [s]
Serijos numeris
Išleistos programinės įrangos versija
@@ -1144,6 +1155,10 @@
Neteisingas kodas. Komanda atšaukta.
Nesukonfigūruota
Profilio perjungimas sukurtas
+ Versijos tikrintuvas
+ sena versija
+ labai sena versija
+ Nauja versija pasiekiama mažiausiai %1$d dienų! Po 60 d. grįšite prie stabdymo prie žemo, po 90 d. ciklas bus išjungtas.
- %1$d diena
- %1$d diena
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index 405918431f..313c3fdde5 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -145,8 +145,6 @@
In strijd met beperkingen
Bolus toedien storing
Tijdelijk basaal toedien storing
- Basale waarde [%]
- % (100% = actueel)
Accepteer nieuw tijdelijk basaal:
Bolus
Bolus wizard
@@ -246,7 +244,6 @@
Pomp IOB
Dag totaal
Laatste bolus
- %.1fu geleden
Verkeerde ingave
Waarde niet correct ingesteld
Herlaad profiel
@@ -506,7 +503,6 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
insuline resistente volwassene
Kies leeftijd van de patient voor veiligheids limieten
Glimp
- %s benodigd batterij optimalistaie vrijwaring voor goede werking
Loop pauzeren
Gepauzeerd (%1$d m)
Superbolus (%1$d m)
@@ -542,8 +538,6 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
Statusindicatoren inschakelen voor cage, iage, sage, reservoir en batterijniveau op het beginscherm.
Drempel waarschuwing reservoir niveau [E]
Drempel alarm reservoir niveau [E]
- Drempel waarschuwing batterij niveau [%]
- Drempel alarm batterij niveau [%]
IOB
COB
Firmware
@@ -737,7 +731,6 @@ Stel in en gebruik tijdelijk en standaard tijdelijke streefdoelen (bv. bij sport
Actief
Annuleren van TB
Instellen TBR (%1$d%% / %2$d min)
- Bolus (%.1f E)
Vernieuwen
Gevraagde is niet mogelijk met de pomp
Opgelet: verlengde en multi wave bolussen zijn actief. Loop is overgeschakeld naar low-suspend modus gedurende 6 uur. Alleen gewone bolussen worden ondersteund in loop modus
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index 18f711530c..b06da87522 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -9,6 +9,7 @@
Zresetuj bazy danych
Na pewno chcesz zresetować bazy danych?
Wyjście
+ Używaj przedłużonych bolusów dla >200%%
Urządzenie Bluetooth DanaR
Zawsze używaj wartości bezwzględnych bazy
Proszę uruchomić ponownie telefon lub zrestartować AndroidAPS w ustawieniach systemu telefonu \ninaczej AndroidAPS nie będzie otrzymywał logowań (ważne ze względu na śledzenie i sprawdzanie poprawności działania algorytmów)!
@@ -146,8 +147,8 @@
Naruszenie ograniczeń
Błąd podania bolusa
Błąd podania bazy tymczasowej
- Wartość bazy [%]
- % (100% = aktualny)
+ Wartość bazy [%%]
+ %% (100%% = aktualny)
Akceptuj nową bazę tymczasową:
Leczenie
Kalkulator
@@ -247,7 +248,7 @@
IOB w pompie
Jednostki dzienne
Ostatni bolus
- %.1fh temu
+ %1$.1fh temu
Błędne dane wejściowe
Wartość ustawiona nieprawidłowo
Załaduj profil ponownie
@@ -313,6 +314,7 @@
Stop
NACIŚNIĘTY STOP
Czekam na pompę
+ Zamierzam dostarczyć %1$.2fU
Konfiguracja wizualizacji i monitorowania, analiza dawek i wartości bazowych
Sprawdź czy BG (pomiary cukru) są dostępne w Nightscout, i dane pompy insulinowej są ładowane
Uruchamiam otwartą pętle (OpenLoop)
@@ -335,12 +337,26 @@
Pętla (Loop) jest wyłączona
Pętla (Loop) jest włączona
%1$.2f ograniczone do %2$.2f
+ Wartość %1$s jest poza dopuszczalną granicą
Zdalne komendy nie są dozwolone
+ Bolus zdalny niedostępny. Spróbuj ponownie później.
+ Aby rozpocząć bazę %1$.2fU/h przez %2$d min. odpowiedz kodem %3$s
+ Aby przełączyć profil na %1$s %2$d%% odpowiedz kodem %3$s
+ Aby rozpocząć bolus przedłużony %1$.2fU przez %2$d min. odpowiedz kodem %3$s
+ Aby rozpocząć bolus przedłużony %1$d%% przez %2$d min. odpowiedz kodem %3$s
Aby wstrzymać pętle na %1$d minut odpowiedz kodem %2$s
Tymczasowa baza %1$.2fU/h przez %2$d min rozpoczęta
+ Bolus przedłużony %1$.2fU na %2$d min. rozpoczęty pomyślnie
+ Tymczasowa baza %1$d%% przez %2$d min. pomyślnie rozpoczęta
Rozpoczęcie tymczasowej bazy nie powiodło się
+ Nie powiodło się podanie bolusa przedłużonego
+ Aby zatrzymać bazę tymczasową wprowadź kod %1$s
+ Aby zatrzymać bolus przedłużony wprowadź kod %1$s
Baza tymczasowa anulowana
+ Przedłużony bolus anulowano
Anulowanie tymczasowej bazy nie powiodło się
+ Anulowanie bolusa przedłużonego nie powiodło się
+ Nieznane polecenie lub błędna odpowiedź
Bolus zdefiniowany
Ustaw szybkie bolusy
Tekst przycisku:
@@ -448,6 +464,7 @@
Profil
Wartość domyślna: 3 To jest kluczowy współczynnik bezpieczeństwa OpenAPS. Ogranicza dawki bazowe do 3x twojej największej dawki bazowej. Prawdopodobnie nie będziesz musiał tego zmieniać, ale powinieneś być świadomy tego, co się rozumie przez “3x max dzienna; 4x aktualna” dla współczynników bezpieczeństwa.
Wartość domyślna: 4 To jest drugi kluczowy współczynnik bezpieczeństwa OpenAPS, i druga wartość z “3x max dzienna; 4x aktualna”. To oznacza, że Twoja dawka bazowa niezależnie od maksymalnej bazy ustawionej na pompie nie może być większa niż ta ustawiona wartość razy twoja aktualna dawka bazowa. To ma na celu przestrzec ludzi przed ustawieniem zbyt wysokiej dawki maksymalnej przed zrozumieniem jak działa algorytm. Ponownie, wartość domyślna to 4x; większość ludzi nie będzie potrzebowała tego zmienić i raczej będą potrzebować dostosować inne ustawienia, jeśli czują, że zbliżają się do współczynnika bezpieczeństwa.
+ Wartość domyślna: 1.2\nTo jest mnożnik dla autosens (wkrótce autotune), ustawia 20%% maks. limit dla najwyższej wartości jaką autosens może przyjąć, co z kolei określa jak wysoko autosens może zwiększyć bazę, jak nisko może ustawić współczynnik wrażliwości insuliny ISF, i jak nisko może ustawić docelową wartość glikemii.
Wartość domyślna: 0.7\nDruga strona limitu bezpieczeństwa dla autosens, ustawia mnożnik minimalny dla wartości, do jakiej autosens może obniżyć bazę, i jak wysoko może ustawić ISF i wartość docelową BG.
Autosens wpływa na wartości docelowe
Domyślnie włączone\nTa funkcja pozwala wpływać na zmianę wartości docelowe BG, wartości bazy i oraz współczynnika wrażliwości na insulinę ISF.
@@ -460,6 +477,7 @@
Nieprawidłowy numer telefonu
Nieprawidłowy numer telefonu SMS
Kalibracja
+ Wysłać kalibrację %1$.1f do xDrip?
xDrip+ nie zainstalowany
Kalibracja przesłana do xDrip
Kalibracja wysłana. Odbiór musi być dozwolony w xDrip.
@@ -510,7 +528,7 @@
Osoba dorosła insulino odporna
Proszę wybierz wiek pacjenta w celu ustawienia wartości limitów bezpieczeństwa
Glimp
- %s Potrzebuję wpisu na białą listę optymalizacji baterii, w celu zapewnienia poprawnego działania
+ %1$s potrzebuję wyłączenia z optymalizacji baterii, w celu zapewnienia poprawnego działania
Pętla wstrzymana
Wstrzymana (%1$d m)
Superbolus (%1$d m)
@@ -546,8 +564,8 @@
Włącz diody stanu dla cage, iage, sage, rezerwuar i poziom baterii na ekranie głównym.
Próg ostrzeżenia o poziomie zbiornika [U]
Próg ostrzeżenia o krytycznym poziomie zbiornika [U]
- Próg ostrzeżenia o poziomie baterii [%]
- Próg ostrzeżenia o krytycznym poziomie baterii [%]
+ Próg ostrzeżenia o poziomie baterii [%%]
+ Próg ostrzeżenia o krytycznym poziomie baterii [%%]
IOB
COB
Firmware
@@ -601,6 +619,7 @@
Ustawienia wchłaniania
Maks. czas wchłaniania posiłku [h]
Oczekiwany czas w godzinach, w którym wszystkie węglowodany zostają wchłonięte
+ Wizualizacja bolusa przedłużonego jako %%
SAGE
IAGE
CAGE
@@ -713,6 +732,8 @@
Prześlij dane BG do xDrip+
W xDrip+ wybierz źródło danych 640g/Eversense
NSClient BG
+ Wartość bazy zastąpiona minimalną obsługiwaną wartością: %1$s
+ Wartość bazy zastąpiona maksymalną obsługiwaną wartością: %1$s
Obliczenia BG
Obliczenia Bolus IOB
Obliczenia IOB
@@ -730,6 +751,8 @@
Tryb zamknięty włączony
Maks. IOB ustawione poprawnie
BG dostępne z wybranego źródła
+ Wartości bazy nie są ustawione w pełnych godzinach: %1$s
+ Nieprawidłowy profil: %1$s
Programowanie pompy do podawania bolusa
Odśwież
Stan
@@ -742,7 +765,7 @@
W działaniu
Anulowanie TBR
Ustawianie TBR (%1$d%% / %2$d min)
- Podawanie bolusa (%.1f U)
+ Podawanie bolusa (%1$.1f U)
Odświeżanie
Żądana operacja nie jest obsługiwana przez pompę
Niebezpieczne użycie: aktywne są bolusy przedłużone lub wielofalowe. Tryb pętli został ustawiony tylko na 6 godzinne zawieszenie z uwagi na niski poziom (BG). W trybie pętli obsługiwane są tylko normalne bolusy
@@ -1065,11 +1088,13 @@
Wycisz
Alarm pompy
Melduj zmianę miejsca wkłucia
+ Zapisz zmianę zbiornika
Melduj zmianę drenu
Melduj zmiany baterii
Melduj zmiany trybu pracy
Melduj ostrzeżenia
Włącz emulację TBR
+ Użyj rozszerzonych bolusów zamiast TBR by ominąć limit 250%% bazy
Opóźnienie rozłączenie [s]
Numer seryjny
Wersja oprogramowania
@@ -1124,6 +1149,18 @@
Podaj \"Zmiana Sensora\" do NS do NS automatycznie przy uruchomieniu sensora
Tomato (MiaoMiao)
Tomato
+ Zmiana na czas letni w ciągu 24 godzin lub krócej
+ Zmiana czasu nastąpiła mniej niż 3 godziny temu - Zamknięta pętla wyłączona
+ limit wielkości pamięci wewnętrznej
+ Zwolnij co najmniej %1$d MB z pamięci wewnętrznej! Pętla zatrzymana!
+ Błędny format
+ Zły kod. Polecenie anulowano.
+ Nie skonfigurowano
+ Zmiana profilu wykonana
+ Kontroler wersji
+ stara wersja
+ bardzo stara wersja
+ Nowa wersja dostępna co najmniej %1$d dni! Powrót do LGS (zawieszania podawania bazy przy niskim poziomie) po 60 dniach, pętla zostanie wyłączona po 90 dniach
- %1$d dzień
- %1$d dni
diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml
index 6499f63e59..36ffb7c5e9 100644
--- a/app/src/main/res/values-pt/strings.xml
+++ b/app/src/main/res/values-pt/strings.xml
@@ -9,6 +9,7 @@
Reinicializar base de dados
Quer realmente reiniciar a base de dados?
Sair
+ Usar bólus prolongado de >200%%
Dispositivo Bluetooth DanaR
Usar sempre valores absolutos de basal
Por favor, reinicie o seu telefone ou reinicie o AndroidAPS a partir das Configurações do Sistema \ncaso contrário, o AndroidAPS não terá registro (importante para controlar e verificar se os algoritmos estão a funcionar corretamente)!
@@ -146,8 +147,8 @@
Violação das restrições
Erro na entrega do bolus
Erro na entrega da basal temporária
- Valor da Basal [%]
- % (100% = atual)
+ Valor da Basal [%%]
+ %% (100%% = actual)
Aceitar nova basal temporária:
Tratamento
Calculadora
@@ -247,7 +248,7 @@
IOB Bomba
Unidades diárias
Último bólus
- %.1fh atrás
+ %1$.1fh atrás
Entrada Inválida
Valor não definido corretamente
Recarregar perfil
@@ -313,6 +314,7 @@
Parar
STOP PRESSIONADO
À espera da bomba
+ Vão ser administradas %1$.2fU
Configuração da visualização e monitoramento, e análise de rácios e basals
Verificar se a BG está disponível no Nightscout, e se os dados de insulina da bomba estão a ser carregados
A iniciar um open loop
@@ -335,11 +337,23 @@
Loop desactivado
Loop activado
%1$.2f limitado a %2$.2f
+ O valor %1$s está fora dos limites permitidos
O comando remoto não é permitido
+ O bólus remoto não está disponível. Tente novamente mais tarde.
+ Para começar a basal %1$.2fU/h durante%2$d min responda com o código %3$s
+ Para mudar o perfil para %1$s %2$d%% responda com o código %3$s
+ Para começar o bólus estendido %1$.2fU/h para %2$d min responda com o código %3$s
+ Para começar a basal %1$d% U/h durante %2$d min responda com o código %3$s
Para suspender o loop por %1$d minutos resposta com código %2$s
Basal temporária %1$.2fU/h para %2$d min iniciada com êxito
+ Bólus estendido %1$.2fU/h para %2$d min iniciado com êxito
+ Basal temporária %1$d% U/h durante%2$d min iniciada com êxito
Início basal temp falhou
+ Falha ao iniciar o bólus estendido
+ Para parar a basal temporária responda com o código %1$s
+ Para parar o bólus temporário responda com o código %1$s
Basal temp cancelada
+ Bólus estendido cancelado
Não foi possivel cancelar a basal temp
Falhou o cancelamento do bolus extendido
Comando desconhecido ou resposta errada
@@ -450,6 +464,7 @@
Perfil
Valor padrão: 3 Por segurança é o valor limite estabelecido por OpenAPS. O que faz é limitar a basal a x3 a basal mázima. Se necessário modificar este valor, por favor ter em conta que os dados apontam para que os limites de segurança sejam - 3 x max diario ou 4x valor actual (qual seja menor) como valores máximos.
Valor padrão: 4 Esta é a outra parte dos valores limites de segurança - 3 x max diário ou 4x valor actual - do OpenAPS. Isto define que não importa o valor da basal máxima definido na bomba, o valor máximo da basal temporária não pode ser maior que 4 x o valor da basal definida na bomba. O objectivo é evitar que sejam determinadas basais temporárias demasiado elevadas antes que se perceba como o algoritmo funciona. 4x é um valor que a maior parte das pessoas nunca necessitará de alterar pois o mais provável é necessitar de alterar outras definições para não necessitar de \"ultrapassar\" este limite de segurança.
+ Valor predefinido: 1.2\n Este é um multiplicador para autosens (e em breve autotune) que coloca um limite máximo de 20%% aos rácios superiores e inferiores de autosens, o que por sua vez calcula o quão alto autosens pode ajustar a basal, quão pode baixar o Factor de Sensibilidade (FSI) e baixar o valor alvo de glicose no sangue.
Valor padrão: 0.7\nO outro lado dos limites de segurança do autosens. Coloca um tecto no quão baixo autosens pode ajustar as basais, e quão alto pode ajustar os valores de ISF e valor alvo de glucose no sangue (BG).
Autosens também ajusta os alvos
Valor padrão: true\nÉ usado para permitir que autosens possa ajustar os valores alvo de glucose no sangue (BG), além de ISF e basais.
@@ -462,6 +477,7 @@
Número de telefone não é válido
SMS número de telefone inválido
Calibração
+ Enviar calibração %1$.1f para o xDrip?
xDrip+ não está instalado
Calibração enviada para o xDrip
Calibração enviada. Recepção têm de estar activada no xDrip.
@@ -512,7 +528,7 @@
Adulto resistente insulina
Por favor seleccione a idade do diabético para definir os limites de segurança
Glimp
- %s necessita de autorizar a não optimização da bateria para assegurar a performance necessária
+ %1$s necessita de autorizar a não optimização da bateria para assegurar a performance necessária
Loop suspenso
Suspendido (%1$d m)
Superbólus (%1$d m)
@@ -548,8 +564,8 @@
Ativar as luzes de status para idade da cânula, idade da insulina, idade do sensor, reservatório e bateria no ecrã inicial.
Limite de aviso de nível de reservatório [U]
Limite crítico de nível de reservatório [U]
- Limite de aviso de nível de bateria [%]
- Limite crítico de nível de bateria [%]
+ Limite de aviso de nível de bateria [%%]
+ Limite crítico de nível de bateria [%%]
IOB
COB
Firmware
@@ -602,6 +618,7 @@
Configurações de absorção
Tempo máx. absorção refeição [h]
Tempo em horas, espectável para que todos os hidratos de carbono da refeição sejam absorvidos
+ Visualizar bólus prolongado como %%
SAGE
IAGE
CAGE
@@ -714,6 +731,8 @@
Enviar dados Glic. para xDrip+
Seleccionar 640g/Eversense como fonte no xDrip+
Glic NSCliente
+ Valor da basal alterado para o valor mínimo suportado: %1$s
+ Valor da basal alterado para o valor máximo suportado: %1$s
Cálculos Glic
Cálculo de Bólus IOB
Cálculo de Basal IOB
@@ -731,6 +750,8 @@
Modo fechado ativado
IOB máxima definida correctamente
Glicemia disponivel desde a fonte selecionada
+ Valores das basais não definidos por horas: %1$s
+ Perfil inválido: %1$s
A programar a bomba para injectar o bolus
Actualizar
Estado
@@ -743,7 +764,7 @@
A correr
Cancelar TBR
A definir TBR (%1$d%% / %2$d min)
- Injectando (%.1f U)
+ Injectando (%1$.1f U)
A actualizar
Operação solicitada não suportada pela bomba
Ultilização nao segura: bolus estendudos ou multionda estão activos. Modo do loop foi alterado para apenas suspender em limite inferior por 6h. Apenas são suportados bolus normais em modo loop
@@ -1072,6 +1093,7 @@
Alterações do modo de funcionamento de registo
Alertas de registo
Ativar a emulação TBR
+ Usar bólus prolongados em vez de basais temporárias para contornar o limite de 250%%
Atraso de desconexão [s]
Número de série
Lançar versão de software
@@ -1107,15 +1129,17 @@
Actualizar
Integração de bomba para bombas Accu-Chek Insight
Não inserido
- Última conexão:%1$d minutos atrás
+ Última ligação:%1$d minutos atrás
Basal temporária: %1$d%% para %2$d / %3$d minutos
Estendido: %1$.2f / %2$.2f U por %3$d min
Multionda: %1$.2f / %2$.2f U por %3$d min
+ TDD: %1$.2f
Reser:%1$.2fU
Bat.: %1$d%%
Duração máxima da recuperação [s]
Duração mínima da recuperação [s]
Duração da recuperação
+ Tempo de operação excedido - reinicar bluetooth
== ∑ %1$s U
U/h
g/U
@@ -1124,12 +1148,18 @@
Criar evento \"Mudança de Sensor\" automaticamente no NS aquando do início do sensor
Tomato (MiaoMiao)
Tomato
+ Horário de Verão em 24h ou menos
+ Horário de Verão a menos de 3 horas - Closed Loop desligado
restrição de armazenamento interno
Liberte pelo menos %1$d MB do armazenamento interno! Loop desativado!
Formato incorrecto
Código errado. Comando cancelado.
Não configurado
Troca de perfil criada
+ Verificador de Versão
+ versão antiga
+ versão muito antiga
+ Nova versão para pelo menos %1$d dias disponíveis! Voltar para o LGS após 60 dias, o loop será desativado após 90 dias
- %1$d dia
- %1$d dias
diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml
index 67868f930a..894641e880 100644
--- a/app/src/main/res/values-ro/strings.xml
+++ b/app/src/main/res/values-ro/strings.xml
@@ -9,6 +9,7 @@
Resetează bazele de date
Sigur resetați bazele de date?
Ieșire
+ Folosiți bolusuri extinse pentru >200%%
Dispozitive bluetooth DanaR
Folosește întotdeauna valori absolute ale bazalei
Restartați telefonul sau reporniți aplicația AndroidAPS din System Settings \naltfel AndroidAPS nu va putea face loguri (importante pentru verificarea corectitudinii funcționării algoritmilor)!
@@ -53,6 +54,7 @@
Monitorizează și controlează aplicația AndroidAPS folosind smartwatchul WearOS.
Afișează informații privind starea buclei pe watchface-ul xDrip+.
Controlare de la distanță a AndroidAPS folosind comenzi date prin SMS.
+ Înapoi
Start
Verifică
Unități
@@ -145,8 +147,8 @@
Încălcare a unei limite
Eroare la livrarea bolusului
Eroare la setare bazală temporară
- Valoare bazală [%]
- % (100% = curent)
+ Valoare bazală [%%]
+ %% (100%% = curent)
Acceptă noua bazală temporară:
Tratament
Calculator
@@ -246,7 +248,7 @@
IOB din pompă
Unități zilnic
Ultimul bolus
- %.1f o în urmă
+ %1$.1f o în urmă
Date de intrare incorecte
Valoare setată incorect
Reîncarcă profilul
@@ -264,6 +266,10 @@
Pentru a livra un bolus de %1$.2fU răspundeți cu codul %2$s
Pentru a trimite calibrarea cu %1$.2f răspundeți cu codul %2$s
Bolusare eșuată
+ Bolusul de %1$.2fU a fost livrat cu succes
+ Se va livra un bolus de %1$.2fU
+ Bolusul de %1$.2fU a fost livrat cu succes
+ Se livrează %1$.2fU
Permite comenzi de la distanță, prin SMS
Deget
Senzor
@@ -308,6 +314,7 @@
Stop
STOP APĂSAT
Se așteaptă pompa
+ Se va livra un bolus de %1$.2fU
Se stabilesc vizualizările și monitorizarea și se analizează bazalele și valorile ratelor
Verificați că vedeți glicemia în Nightscout și că datele despre insulină date de pompă sunt înregistrate în site
Pornire în mod buclă deschisă
@@ -330,12 +337,26 @@
Bucla este dezactivată
Bucla este activată
%1$.2f este limitată la %2$.2f
+ Valoarea %1$s este mai mare decât limita stabilită
Comanda de la distanță nu este permisă
+ Bolus de la distanță nu este disponibil. Încearcă din nou mai târziu.
+ Pentru a iniția bazala de %1$.2fU/h pentru %2$d min trimiteți codul %3$s
+ Pentru a schimba profilul în %1$s %2$d%% trimiteți codul %3$s
+ Pentru a stabili bazala de %1$.2fU/h pentru %2$d min trimiteți codul %3$s
+ Pentru a iniția bazala de %1$d%% pentru %2$d min trimiteți codul %3$s
Pentru suspendarea buclei pentru %1$d minute trimiteți codul %2$s
Bazala temporară %1$.2fU/h pentru %2$d minute a fost trimisă cu succes
+ Bolusul extins de %1$.2fU pentru %2$d min a fost inițiat
+ Bazala temporară %1$d% pentru %2$d minute a fost stabilită cu succes
Trimiterea bazalei temporare a eșuat
+ Pornirea bolusului extins a eșuat
+ Pentru oprirea bazalei temporare, răspundeți cu codul %1$s
+ Pentru oprirea bolusului extins, răspundeți cu codul %1$s
Bazala temporară a fost anulată
+ Bolus extins anulat
Renunțarea la bazala temporară a eșuat
+ Anularea bolusului extins a eșuat
+ Comandă necunoscută sau răspuns greșit
AsistentRapid
Setări AsistentRapid
Text buton:
@@ -443,6 +464,7 @@
Profil
Valoare implicită: 3\nAceasta este o setare de critică de securitate a OpenAPS. Asta înseamnă că se limitează bazala lade 3x valoarea maximă a bazalelor tale.Cel mai probabil nu veți schimba această valoare, dar trebuie să țineți cont de ce se discută despre “3x max zilnic; 4x curent” ca valori de siguranță.
Valoare implicită: 4\nAceasta este cealaltă jumătate a cheii de siguranță a OpenAPS și cealaltă jumătate a \"3x max zilnic; 4x curent\" al setărilor de siguranță.Aceasta înseamnă că bazala dumneavoastră, indiferent de bazala maximă configurată în pompă, nu poate fi mai mare de acest număr înmulțit cu nivelul curent al bazalei active. Această limitare este impusă pentru a evita posibilitatea de a intra pe un teritoriu periculos prin setarea unei bazale maxime excesiv de mari înainte de a înțelege funcționarea algoritmului. Din nou, valoarea implictă este 4x; majoritatea oamenilor nu vor trebui să ajusteze această valoare și vor modifica, mai degrabă, alte valori dacă vor simți că această valoare le stă în cale.
+ Valoare implicită: 1.2\nAceasta este valoarea limită de multiplicare pentru autosens (și pentru autotune, în curând) pentru a seta o limită maximă de 20%% din cât de mare poate fi raportul autosens, care, la rândul ei, determină cât de mult poate autosens să modifice bazalele, cât de jos poate modifica ISF și cât de jos poate pune ținta glicemiei.
Valoare implicită: 0.7\nCealaltă parte a limitelor autosens, care limitează cât de jos poate ajusta bazalele și cât de mult poate mări ISF și țintele de glicemie.
Autosens ajustează țintele la
Valoare implicită: adevărat\nAceasta se folosește pentru a permite autosens să ajusteze țintele de glicemie, pe lângă modificările asupra ISF și bazalelor.
@@ -455,6 +477,7 @@
Numărul de telefon este invalid
Număr de telefon SMS invalid
Calibrare
+ Trimite calibrarea %1$.1f către xDrip?
xDrip+ nu este instalat.
Calibrare trimisă către xDrip
Calibrare trimisă. Recepționarea trebuie să fie activată și în xDrip.
@@ -505,7 +528,7 @@
Adult rezistent la insulină
Vă rog să selectați vârsta pacientului în vederea stabilirii valorilor maxime admise de siguranță
Glimp
- %s necesită excluderea din lista de optimizare a bateriei pentru funcționare corespunzătoare
+ %1$s necesită excluderea din lista de optimizare a bateriei pentru o funcționare corespunzătoare
Buclă suspendată
Suspendat (%1$d min)
Superbolus (%1$d min)
@@ -541,8 +564,8 @@
Activați indicatori pentru CAGE, IAGE, SAGE, nivel baterie și rezervor pe ecranul principal.
Pragul de avertisment pentru insulina din rezervor [U]
Pragul critic al nivelului insulinei în rezervor [U]
- Pragul de avertizare nivel baterie [%]
- Pragul critic al nivelului baterie [%]
+ Pragul de avertizare nivel baterie [%%]
+ Pragul critic al nivelului baterie [%%]
IOB
COB
Firmware
@@ -595,6 +618,7 @@
Setări absorbție
Timp maxim absorbție masă [o]
Timp în ore la care se presupune că toți carbohidrații sunt absorbiți
+ Afișati bolusul extins ca %%
VS
VI
VC
@@ -707,6 +731,8 @@
Trimite date glicemie la xDrip+
Selectați 640g/Eversense ca sursă de date în xDrip+
Glicemie NSClient
+ Valoarea bazalei a fost înlocuită cu valoarea minimă posibilă: %1$s
+ Valoarea bazalei a fost înlocuită cu valoarea maximă posibilă: %1$s
Calcul glicemie
Calcul IOB bolus
Calcul IOB bazală
@@ -724,6 +750,8 @@
Mod buclă închisă activat
IOB maxim configurat corect
Glicemie disponibilă din sursa selectată
+ Valori bazale nesincronizate cu ora: %1$s
+ Profil invalid: %1$s
Se programează pompa pentru livrare bolus
Reîncarcă
Stare
@@ -736,7 +764,7 @@
Rulează
Se oprește TBR
Se setează TBR (%1$d%% / %2$d min)
- Bolusare (%.1f U)
+ Bolusare (%1$.1f U)
Reîncărcare
Operațiunea nu este suportată de pompă
Folosire nesigură: un bolus extins sau multiwave este activ. Modul buclă este setat să funcționeze în low-suspend pentru 6 ore. Doar bolusurile normale sunt posibile.
@@ -1059,11 +1087,13 @@
Liniște
Alertă a pompei
Înregistrează schimbările locului de inserție
+ Jurnal al schimbărilor rezervorului
Înregistrează schimbările canulei
Înregistrează schimbările bateriei
Înregistrează schimbările modului de operare
Înregistrează alertele
Activează emularea RBT
+ Folosește bolus extins în locul RBT pentru a trece de limita de 250%%
Întârziere a deconectării [s]
Număr de serie
Versiunea de software
@@ -1078,6 +1108,58 @@
Șterge asocierea
Informații despre asociere
Reîmprospătare stare
+ Porniți pompa
+ Opriți pompa
+ Modul de funcționare
+ Stare
+ Bolus TDD
+ Bazală TDD
+ Total TDD
+ Se recuperează...
+ Nu există asociere
+ Ultima conexiune
+ Pornit
+ Oprit
+ %1$d%% pentru %2$d / %3$d min
+ Bolus extins
+ Bolus multiwave
+ %1$.2f / %2$.2f U pentru %3$d min
+ Permiteți notificarea de terminare RBT\n(setare a pompei)
+ Nu permiteți notificarea terminării RBT\n(setare a pompei)
+ Actualizează
+ Integrare pentru pompele Accu-Chek Insight
+ Nu este introdus
+ Ultima conexiune: acum %1$d min
+ TBR: %1$d%% pentru %2$d / %3$d min
+ Extins: %1$.2f / %2$.2f U pentru %3$d min
+ Multiwave: %1$.2f / %2$.2f U pentru %3$d min
+ TDD: %1$.2f
+ Rzvr.: %1$.2fU
+ Bat.: %1$d%%
+ Timpul maxim de restabilire [s]
+ Timpul minim de restabilire [s]
+ Durata restabilirii
+ Durată timp expirat pe timpul negocierii - resetare bluetooth
+ == ∑ %1$s U
+ U/h
+ g/U
+ /U
+ Înregistrează schimbarea senzorului în NS
+ Crează eveniment ”Schimbare Senzor” în NS la pornirea senzorului
+ Tomato (MiaoMiao)
+ Tomato
+ Schimbare oră vară/iarnă în mai puțin de 24h
+ Schimbare oră vară/iarnă în mai puțin de 3 ore - buclă dezactivată
+ restricție de stocare internă
+ Eliberați cel puțin %1$d MB din spațiunl de stocare al telefonlui! Buclă dezactivată!
+ Format greșit
+ Cod greșit. Comandă anulată.
+ Nu este configurat
+ Schimbare de profil creată
+ Verificator versiune
+ versiune veche
+ versiune foarte veche
+ Noua versiune este disponibilă de cel puțin %1$d zile! Revenire la LGS după 60 zile, bucla va fi dezactivată după 90 zile
- %1$d zi
- %1$d zi
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index e970c21d48..aaa07dfec0 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -1,11 +1,11 @@
- Безопасность назначений
+ Безопасность терапии
Макс разрешенный болюс [U] ед.
макс разрешенные углеводы (г)
опции
- синхронисировать назначения с NS
+ Синхронизировать назначения с NS
обнулить базы
Вы действительно хотите обнулить базы данных?
Выход
@@ -116,7 +116,7 @@
профиль NS
простой профиль
ВремБазал
- назначения
+ Терапия
виртуальная помпа
Портал лечения / назначений
помпа
@@ -147,14 +147,14 @@
ограничение нарушено
Ошибка подачи болюса
Ошибка подачи врем базала
- величина базала (%)
- % (100% = текущий)
+ Величина базала [%%]
+ %% (100%% = текущее)
принять новый врем базал:
болюс
калькулятор
применено ограничение!
подтверждение
- введите новое назначение
+ Ввести новое назначение:
болюс
болюс:
базал
@@ -248,7 +248,7 @@
активный инсулин на помпе
суточные единицы
предыдущий болюс
- %.1fч назад
+ %1$.1fч назад
введенные данные неверны
величина не задана должным образом
обновить профиль
@@ -528,7 +528,7 @@
Инсулинорезистентный взрослый
выберите возраст пациента для определения ограничителей безопасности
Glimp
- %s необходимо включить в белый список для корректной работы
+ %1$s необходимо включить в белый список оптимизации батареи для корректной работы
ЗЦ остановлен
Остановлен на(%1$d m)
Суперболюс(%1$d m)
@@ -564,8 +564,8 @@
Включить на главном экране индикаторы отработанного времени для канюли помпы, инсулина, сенсора, резервуара, а также показать уровень аккумулятора.
Порог уровня наполненности резервуара для оповещения [ед.]
Порог критического уровня наполненности резервуара [U]
- Порог предупреждения о разрядке батареи [%]
- Порог предупреждения о критическом уровне разрядки батареи [%]
+ Порог предупреждения о разрядке батареи [%%]
+ Порог предупреждения о критическом уровне разрядки батареи [%%]
IOB акт инс
акт углев
прошивка
@@ -690,7 +690,7 @@
Получение времени помпы
повторное использование
Контроль с часов
- Поставить временные цели и ввести назначения с часов.
+ Ставить временные цели и вводить назначения с часов.
Истекло время ожидания соединения
Еда
грамм
@@ -764,7 +764,7 @@
Выполняется
Отмена врем базала TBR
Установка врем базала TBR на (%1$d%% / %2$d мин)
- Введение болюса (%.1f ед)
+ Введение болюса (%1$.1f ед)
Обновление
Запрашиваемая операция не поддерживается помпой
Небезопасное использование: Удлиненный или многоволновой болюс активны. Режим цикла Loop установлен на приостановку при низкой гликемии только на 6 часов. В режиме loop поддерживаются только обычные болюсы
@@ -1044,7 +1044,7 @@ Context | Edit Context
AndroidAPS перезапущен
Найдены сохраненные параметры
Внимание: Если вы активируете подключение к невиртуальной помпе, AndroidAPS скопирует настройки базала в профиль помпы, перезаписывая существующие настройки, хранящиеся в ней. Убедитесь, что настройки базала в AndroidAPS корректны. Если вы не уверены или не хотите перезаписать настройки базала на помпу, нажмите отменить и повторите подключение в другое время.
- Данные назначений неполные
+ Данные терапии неполные
Параметры обслуживания
Адрес электронной почты
Недопустимый e-mail
@@ -1158,4 +1158,8 @@ Context | Edit Context
Неверный код. Команда отменена.
Не сконфигурировано
Переключатель профиля создан
+ Проверка версии
+ старая версия
+ очень старая версия
+ Новая версия доступна не менее %1$d дней! После 60 дней переход на остановку при низкой гликемии LGS, замкнутый цикл будет отключен через 90 дней
diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml
index d2cdb050cd..f9dacaef8b 100644
--- a/app/src/main/res/values-sk/strings.xml
+++ b/app/src/main/res/values-sk/strings.xml
@@ -147,8 +147,8 @@
Mimo povolený rozsah
Chyba podania bolusu
Chyba podávania dočasného bazálu
- Hodnota bazálu [%]
- % (100% = aktuálny)
+ Hodnota bazálu [%%]
+ %% (100%% = aktuálny)
Povoliť nový dočasný bazál:
Bolus
Kalkulačka
@@ -248,7 +248,7 @@
IOB z pumpy
Jednotiek za deň
Posledný bolus
- pred %.1fh
+ pred %1$.1fh
Chybné vstupné dáta
Hodnota nenastavená správne
Obnoviť profil
@@ -528,7 +528,7 @@
Dospelý z nízkou citlivosťou
Vyberte vek pacienta pre nastavenie bezpečnostných limitov
Glimp
- %s potrebuje vypnúť optimalizáciu baterie pre optimálny výkon
+ %1$s potrebuje vypnúť optimalizáciu batérie pre optimálny výkon
Uzavretý okruh pozastavený
Pozastavený (%1$d min)
Superbolus (%1$d m)
@@ -564,8 +564,8 @@
Povoliť indikátory stavu pre CAGE, IAGE, SAGE, Reservoir a Battery Level na domovskej obrazovke.
Prah upozornenia na úroveň hladiny zásobníka [U]
Prah kritickej úrovne hladiny zásobníka [U]
- Prah upozornenia na úroveň batérie [%]
- Prah kritickej úrovne batérie [%]
+ Prah upozornenia na úroveň batérie [%%]
+ Prah kritickej úrovne batérie [%%]
IOB
COB
Firmware
@@ -764,7 +764,7 @@
V prevádzke
Rušenie dočasného bazálu
Nastavovanie doč. bazálu (%1$d%% / %2$d min)
- Podávanie bolusu (%.1f U)
+ Podávanie bolusu (%1$.1f U)
Aktualizuje sa stav
Požadovaná operácia nie je pumpou podporovaná
Nebezpečné použitie: predĺžený alebo multiwave bolus je aktívny. Pumpa bola vypnutá len na 6 hodín. Povolené sú iba normálne bolusy.
@@ -1156,6 +1156,10 @@
Nesprávný kód. Príkaz zrušený.
Nie je nakonfigurované
Prepnutie profilu vytvorené
+ Kontrola verzie
+ stará verzia
+ veľmi stará verzia
+ Nová verzia dostupná najmenej %1$d dní! Návrat k liečbe inzulínovou pumpou s podporou senzora po 60 dňoch, okruh bude deaktivovaný po 90 dňoch.
- %1$d deň
- %1$d dní
diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml
index 74378fb8d9..409b7f21a6 100644
--- a/app/src/main/res/values-sv/strings.xml
+++ b/app/src/main/res/values-sv/strings.xml
@@ -148,8 +148,6 @@ Eversense-appen.
Begränsning nådd
Fel vid bolusleverans
Fel vid justering av temp basal
- Basal [%]
- % (100% = profilens värde)
Acceptera ny temp basal:
Behandling
Kalkylator
@@ -249,7 +247,6 @@ Eversense-appen.
Pumpens IOB
Enheter per dag
Senaste bolus
- %.1f tim sedan
Fel på inmatning
Misslyckades med inställning
Ladda om profil
@@ -529,7 +526,6 @@ Eversense-appen.
Insulinresistent vuxen
Vg ange personens ålder för inställningar av gränser
Glimp
- %s behöver kunna kringgå batterisparfunktionerna för att fungera korrekt
Loop pausad
Pausad (%1$d min)
Superbolus (%1$d min)
@@ -565,8 +561,6 @@ Eversense-appen.
Aktivera statusindikationerna för cage, iage, sage, reservoar och batterinivå på hemskärmen.
Varningsnivå för reservoar [U]
Akut varningsnivå för reservoar [U]
- Varningsnivå för batteri [%]
- Akut varningsnivå för batteri [%]
IOB
COB
Firmwareversion
@@ -765,7 +759,6 @@ Eversense-appen.
Körs
Avbryter temp basal
Sätter temp basal (%1$d%% / %2$d min)
- Levererar bolus (%.1f enheter)
Uppdaterar
Önskad åtgärd stöds inte av pumpen
Osäker användning: Förlängd- eller kombibolus är aktiv. Loop mode är satt till att bromsa vid lågt BG i 6 timmar. Endast normala bolusar tillåtna i loopläge.
diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml
index dcc3af86e3..d858630fff 100644
--- a/app/src/main/res/values-tr/strings.xml
+++ b/app/src/main/res/values-tr/strings.xml
@@ -143,8 +143,6 @@
Kısıtlamalar ihlali
Bolus teslimat hatası
Geçici Bazal teslimat hatası
- Bazal değeri [%]
- % ( 100% = aktuel)
Yeni geçici bazal oranını kabul et:
Tedavi
Hesap makinesi
@@ -244,7 +242,6 @@
IOB(Aktif insülin) pompa
Günlük birimleri
Son bolus
- %.1fs önce
Geçersiz bilgi girişi
Değer düzgün ayarlanmamış
Dosyayı yeniden yükle
@@ -503,7 +500,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Yetişkin İnsülin direnci
Güvenlik sınırlarını ayarlamak için lütfen hasta yaşını seçiniz
Glimp
- %s, düzgün bir şekilde çalışması için devre dışı bırakılmış pil performans ayarlaması gerektirir
Döngü durduldu
Askıya alındı (%1$d m)
Superbolus (%1$d m)
@@ -725,7 +721,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Çalışıyor
TBR (Geçici Bazal Oranı) İptal ediliyor
TBR(Geçici Bazal Oranı) ayarı (%1$d%% / %2$d dak)
- Bolus (%.1f U) teslim ediliyor
Yenileniyor...
İstenen işlem pompası tarafından desteklenmiyor
Güvensiz kullanım: yayım veya çoklu dalgalı (kare dalgalı) boluslar aktiftir. Döngü modu 6 saat içinde ekstra insülin vermeyecektir. Döngü modunda sadece normal boluslar desteklenir
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 2e1874e5ef..7e4b22eacd 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -53,6 +53,7 @@
使用您的 WearOS 手表监视和控制 AndroidAPS。
在 xDrip + 表盘上显示有关闭环的信息。
远程控制 AndroidAPS 使用 SMS 短信命令。
+ 返回
开始
校验
单位
@@ -145,8 +146,6 @@
违反约束条件
大剂量输注错误
临时基础输注错误
- 基础率数值 [%]
- % (100% = 当前)
接受新的临时基础率
治疗
计算器
@@ -246,7 +245,6 @@
泵 IOB
每日单位数
上次大剂量
- %.1fh 前
无效的输入数据
数值设定的不正确
重新加载配置文件
@@ -264,6 +262,10 @@
要输注大剂量胰岛素%1$.2fU 回复如下代码 %2$s
要发送校准值 %1$.2f 回复如下代码 %2$s
大剂量输注失败
+ 已经成功输注大剂量%1$.2fU
+ 将要输注 %1$.2fU
+ 已经成功输注大剂量%1$.2fU
+ 正在输注 %1$.2fU
通过SMS短信允许远程命令
手指
传感器
@@ -331,11 +333,24 @@
闭环被启用
%1$.2f 超过 %2$.2f的限制
远程命令没有被允许
+ 远程大剂量不可用。请稍后再试。
+ 要开始基础率 %1$.2fU/h 持续时间%2$d 分钟,请回复如下代码 %3$s
+ 要切换配置文件到 %1$s %2$d%% 请回复代码 %3$s
+ 要开始扩展大剂量 %1$.2fU/h 持续时间%2$d 分钟,请回复如下代码 %3$s
+ 要开始基础率 %1$d%% 持续时间%2$d 分钟,请回复如下代码 %3$s
要暂停闭环 %1$d 分钟请回复如下代码 %2$s
临时基础率 %1$.2fU/h 持续 %2$d 分钟启用成功了
+ 扩展大剂量 %1$.2fU/h 持续时间 %2$d 分钟已经启用成功了
+ 临时基础率 %1$d%% 持续时间 %2$d 分钟 启用成功了
开始临时基础率失败了
+ 开始扩展大剂量失败了
+ 要停止临时基础率,请回复如下代码 %1$s
+ 要停止扩展大剂量,请回复如下代码 %1$s
临时基础率取消了
+ 扩展大剂量已经取消了
取消临时基础率失败
+ 取消扩展大剂量失败
+ 未知的命令或者错误的回复
快速向导
快速向导设置
按钮文本:
@@ -505,7 +520,6 @@
胰岛素抵抗成人
请选择患者年龄以设置安全限制
Glimp
- %s 需要加入电池优化白名单才能正常运行
闭环暂停了
暂停了 (%1$d m)
超级大剂量 (%1$d m)
@@ -541,8 +555,6 @@
在主屏幕上启用cage(碳水时间)、iage(胰岛素时间)、sage(探头使用时间)、储药器和电池电量的状态指示灯。
储药器药量低于阈值[U] 警告
储药器药量低于阈值[U] 严重警告
- 电池电量低于阈值[%] 警告
- 电池电量低于阈值[%] 严重警告
IOB活性胰岛素
COB活性碳水
固件
@@ -550,6 +562,7 @@
蓝牙状态
关于
缺少 SMS 短信权限
+ 缺少手机状态权限
xDrip 状态 (手表)
xDrip 状态线 (手表)
xdrip
@@ -735,7 +748,6 @@
正在运行
正在取消临时基础率
正在设置临时基础率 (%1$d%% / %2$d 分钟)
- 正在输注大剂量 (%.1f U)
正在刷新
泵不支持请求的操作
不安全的用法: 扩展大剂量(方波) 或者双波被启用了,闭环只支持常规大剂量, 闭环已经被设置为6个小时的低血糖暂停模式(low-suspend only 6 hours).
@@ -1001,6 +1013,7 @@
%1$d.目标
Poctech
从 Poctech app 接收血糖值。
+ 从番茄app(喵喵设备) 接收血糖值
高临时目标增加灵敏度
=100 mg/dl (5.5 mmol/l) 时提高灵敏度]]>
低临时目标降低灵敏度
@@ -1057,6 +1070,7 @@
静音
泵警报
记录位置更换
+ 记录储药器更换
记录管路更换
记录电池更换
记录操作模式更改
@@ -1100,6 +1114,7 @@
最后一次连接: %1$d 分钟前
临时基础率: %1$d%% for %2$d / %3$d 分钟
扩展: %1$.2f / %2$.2f U 为 %3$d 分钟
+ 多波: %1$.2f / %2$.2f U 持续时间 %3$d 分钟
TDD(日输注总量): %1$.2f
Reser.: %1$.2fU
电池: %1$d%%
@@ -1113,6 +1128,16 @@
/U
记录传感器更换至NS服务器
在传感器启动时在 NS服务器 自动创建事件 \"传感器更改\"
+ 番茄(喵喵)
+ 番茄
+ 在24小时内或更少时间内更夏令时时间
+ 不到3小时前夏令时时间变化了-已禁用闭环
+ 内部储存空间不足
+ 至少 剩余%1$d MB 内部存储!闭环已禁用!
+ 格式错误
+ 错误的代码。命令取消
+ 未配置
+ 配置文件切换已创建
- %1$d 天
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e281fa103c..9c01c4546d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -152,8 +152,8 @@
Constraints violation
Bolus delivery error
Tempbasal delivery error
- Basal value [%]
- % (100% = current)
+ Basal value [%%]
+ %% (100%% = current)
Accept new temp basal:
Treatment
Calculator
@@ -276,7 +276,7 @@
Pump IOB
Daily units
Last bolus
- %.1fh ago
+ %1$.1fh ago
Invalid input data
Value not set properly
Reload profile
@@ -582,7 +582,7 @@
Please select patient age to setup safety limits
I_understand
Glimp
- %s needs battery optimalization whitelisting for proper performance
+ %1$s needs battery optimalization whitelisting for proper performance
Loop suspended
Suspended (%1$d m)
Superbolus (%1$d m)
@@ -624,9 +624,9 @@
key_statuslights_res_critical
Threshold critical reservoir level [U]
key_statuslights_bat_warning
- Threshold warning battery level [%]
+ Threshold warning battery level [%%]
key_statuslights_bat_critical
- Threshold critical battery level [%]
+ Threshold critical battery level [%%]
IOB
COB
Firmware
@@ -869,7 +869,7 @@
Running
Cancelling TBR
Setting TBR (%1$d%% / %2$d min)
- Bolusing (%.1f U)
+ Bolusing (%1$.1f U)
Refreshing
Requested operation not supported by pump
Unsafe usage: extended or multiwave boluses are active. Loop mode has been set to low-suspend only 6 hours. Only normal boluses are supported in loop mode
@@ -1326,6 +1326,14 @@
Wrong code. Command cancelled.
Not configured
Profile switch created
+ Version Checker
+ last_time_this_version_detected
+ last_versionchecker_waring
+ last_versionchecker_plugin_waring
+
+ old version
+ very old version
+ New version for at least %1$d days available! Fallback to LGS after 60 days, loop will be disabled after 90 days
Operation not supported by pump and/or driver.
diff --git a/app/src/test/java/info/AAPSMocker.java b/app/src/test/java/info/AAPSMocker.java
index 850affa224..50bd20d198 100644
--- a/app/src/test/java/info/AAPSMocker.java
+++ b/app/src/test/java/info/AAPSMocker.java
@@ -282,10 +282,13 @@ public class AAPSMocker {
PowerMockito.when(ProfileFunctions.getInstance().getProfileName()).thenReturn(TESTPROFILENAME);
}
- public static void mockIobCobCalculatorPlugin() {
+ public static IobCobCalculatorPlugin mockIobCobCalculatorPlugin() {
PowerMockito.mockStatic(IobCobCalculatorPlugin.class);
IobCobCalculatorPlugin iobCobCalculatorPlugin = PowerMockito.mock(IobCobCalculatorPlugin.class);
PowerMockito.when(IobCobCalculatorPlugin.getPlugin()).thenReturn(iobCobCalculatorPlugin);
+ Object dataLock = new Object();
+ PowerMockito.when(iobCobCalculatorPlugin.getDataLock()).thenReturn(dataLock);
+ return iobCobCalculatorPlugin;
}
private static MockedBus bus = new MockedBus();
diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java
index ee03ef73d7..fbbd72f064 100644
--- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java
+++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java
@@ -289,7 +289,7 @@ public class ConstraintsCheckerTest {
//SafetyPlugin
when(ConfigBuilderPlugin.getPlugin().getActivePump()).thenReturn(pump);
- constraintChecker = new ConstraintChecker(mainApp);
+ constraintChecker = new ConstraintChecker();
safetyPlugin = SafetyPlugin.getPlugin();
objectivesPlugin = ObjectivesPlugin.getPlugin();
diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtilsKtTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtilsKtTest.kt
new file mode 100644
index 0000000000..2d07e40c1d
--- /dev/null
+++ b/app/src/test/java/info/nightscout/androidaps/plugins/general/versionChecker/VersionCheckerUtilsKtTest.kt
@@ -0,0 +1,230 @@
+package info.nightscout.androidaps.plugins.general.versionChecker
+
+import com.squareup.otto.Bus
+import info.nightscout.androidaps.MainApp
+import info.nightscout.androidaps.R
+import info.nightscout.androidaps.logging.L
+import info.nightscout.androidaps.utils.SP
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.ArgumentMatchers
+import org.mockito.Mockito.*
+import org.powermock.api.mockito.PowerMockito
+import org.powermock.core.classloader.annotations.PrepareForTest
+import org.powermock.modules.junit4.PowerMockRunner
+
+
+@RunWith(PowerMockRunner::class)
+class VersionCheckerUtilsKtTest {
+ @Test
+ fun findVersionMatchesRegularVersion() {
+ val buildGradle = """blabla
+ | android {
+ | aosenuthoae
+ | }
+ | version = "2.2.2"
+ | appName = "Aaoeu"
+ """.trimMargin()
+ val detectedVersion: String? = buildGradle.byteInputStream().findVersion()
+ assertEquals("2.2.2", detectedVersion)
+ }
+
+
+ // In case we merge a "x.x.x-dev" into master, don't see it as update.
+ @Test
+ fun `should return null on non-digit versions on master`() {
+ val buildGradle = """blabla
+ | android {
+ | aosenuthoae
+ | }
+ | version = "2.2.2-nefarious-underground-mod"
+ | appName = "Aaoeu"
+ """.trimMargin()
+ val detectedVersion: String? = buildGradle.byteInputStream().findVersion()
+ assertEquals(null, detectedVersion)
+ }
+
+ @Test
+ fun findVersionMatchesDoesNotMatchErrorResponse() {
+ val buildGradle = """Balls! No build.gradle here. Move along"""
+ val detectedVersion: String? = buildGradle.byteInputStream().findVersion()
+ assertEquals(null, detectedVersion)
+ }
+
+ @Test
+ fun testVersionStrip() {
+ assertEquals("2.2.2", "2.2.2".versionStrip())
+ assertEquals("2.2.2", "2.2.2-dev".versionStrip())
+ assertEquals("2.2.2", "2.2.2dev".versionStrip())
+ assertEquals("2.2.2", """"2.2.2"""".versionStrip())
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `should find update1`() {
+ val bus = prepareBus()
+
+ compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1")
+
+ verify(bus, times(1)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `should find update2`() {
+ val bus = prepareBus()
+
+ compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.2.1-dev")
+
+ verify(bus, times(1)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `should find update3`() {
+ val bus = prepareBus()
+
+ compareWithCurrentVersion(newVersion = "2.2.3", currentVersion = "2.1")
+
+ verify(bus, times(1)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `should find update4`() {
+ val bus = prepareBus()
+
+ compareWithCurrentVersion(newVersion = "2.2", currentVersion = "2.1.1")
+
+ verify(bus, times(1)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `should find update5`() {
+ val bus = prepareBus()
+ compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2-dev")
+
+ verify(bus, times(1)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `should find update6`() {
+ val bus = prepareBus()
+ compareWithCurrentVersion(newVersion = "2.2.1", currentVersion = "2.2dev")
+
+ verify(bus, times(1)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `find same version`() {
+ val buildGradle = """blabla
+ | android {
+ | aosenuthoae
+ | }
+ | version = "2.2.2"
+ | appName = "Aaoeu"
+ """.trimMargin()
+ val bus = prepareBus()
+ compareWithCurrentVersion(buildGradle.byteInputStream().findVersion(), currentVersion = "2.2.2")
+
+ verify(bus, times(0)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_time_this_version_detected), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+ }
+
+ @Test
+ @PrepareForTest(MainApp::class, L::class, SP::class)
+ fun `find higher version`() {
+ val buildGradle = """blabla
+ | android {
+ | aosenuthoae
+ | }
+ | version = "3.0"
+ | appName = "Aaoeu"
+ """.trimMargin()
+ val bus = prepareBus()
+ compareWithCurrentVersion(buildGradle.byteInputStream().findVersion(), currentVersion = "2.2.2")
+
+ verify(bus, times(1)).post(any())
+
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyStatic(SP::class.java, times(1))
+ SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
+ PowerMockito.verifyNoMoreInteractions(SP::class.java)
+ }
+
+
+ @Test
+ @PrepareForTest(System::class)
+ fun `set time`() {
+ PowerMockito.spy(System::class.java)
+ PowerMockito.`when`(System.currentTimeMillis()).thenReturn(100L)
+
+ assertEquals(100L, System.currentTimeMillis())
+ }
+
+ private fun prepareBus(): Bus {
+ PowerMockito.mockStatic(MainApp::class.java)
+ val mainApp = mock(MainApp::class.java)
+ `when`(MainApp.instance()).thenReturn(mainApp)
+ val bus = mock(Bus::class.java)
+ `when`(MainApp.bus()).thenReturn(bus)
+ `when`(MainApp.gs(ArgumentMatchers.anyInt())).thenReturn("some dummy string")
+ prepareSP()
+ return bus
+ }
+
+ private fun prepareSP() {
+ PowerMockito.mockStatic(SP::class.java)
+ }
+
+ private fun prepareLogging() {
+ PowerMockito.mockStatic(L::class.java)
+ `when`(L.isEnabled(any())).thenReturn(true)
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/test/java/info/nightscout/androidaps/data/GlucoseStatusTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculatorPlugin/GlucoseStatusTest.java
similarity index 97%
rename from app/src/test/java/info/nightscout/androidaps/data/GlucoseStatusTest.java
rename to app/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculatorPlugin/GlucoseStatusTest.java
index b7a1d8b0b2..19e497b834 100644
--- a/app/src/test/java/info/nightscout/androidaps/data/GlucoseStatusTest.java
+++ b/app/src/test/java/info/nightscout/androidaps/plugins/iob/iobCobCalculatorPlugin/GlucoseStatusTest.java
@@ -1,4 +1,4 @@
-package info.nightscout.androidaps.data;
+package info.nightscout.androidaps.plugins.iob.iobCobCalculatorPlugin;
import org.json.JSONException;
import org.json.JSONObject;
@@ -16,6 +16,7 @@ import java.util.List;
import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.BgReading;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSgv;
import info.nightscout.androidaps.utils.DateUtil;
@@ -36,7 +37,7 @@ public class GlucoseStatusTest {
@Test
public void toStringShouldBeOverloaded() {
GlucoseStatus glucoseStatus = new GlucoseStatus();
- Assert.assertEquals(true, glucoseStatus.toString().contains("Delta"));
+ Assert.assertEquals(true, glucoseStatus.log().contains("Delta"));
}
@Test
@@ -133,10 +134,7 @@ public class GlucoseStatusTest {
public void initMocking() {
AAPSMocker.mockMainApp();
AAPSMocker.mockStrings();
-
- PowerMockito.mockStatic(IobCobCalculatorPlugin.class);
- iobCobCalculatorPlugin = mock(IobCobCalculatorPlugin.class);
- when(IobCobCalculatorPlugin.getPlugin()).thenReturn(iobCobCalculatorPlugin);
+ iobCobCalculatorPlugin = AAPSMocker.mockIobCobCalculatorPlugin();
PowerMockito.mockStatic(DateUtil.class);
when(DateUtil.now()).thenReturn(1514766900000L + T.mins(1).msecs());
diff --git a/app/src/test/java/info/nightscout/androidaps/utils/BolusWizardTest.java b/app/src/test/java/info/nightscout/androidaps/utils/BolusWizardTest.java
index 945c813674..2143a7101c 100644
--- a/app/src/test/java/info/nightscout/androidaps/utils/BolusWizardTest.java
+++ b/app/src/test/java/info/nightscout/androidaps/utils/BolusWizardTest.java
@@ -9,7 +9,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import info.AAPSMocker;
import info.nightscout.androidaps.MainApp;
-import info.nightscout.androidaps.data.GlucoseStatus;
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.IobTotal;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.interfaces.PumpInterface;
diff --git a/app/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.java b/app/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.java
index a15efa6c24..823653c5ab 100644
--- a/app/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.java
+++ b/app/src/test/java/info/nightscout/androidaps/utils/MidnightTimeTest.java
@@ -53,6 +53,13 @@ public class MidnightTimeTest {
Assert.assertEquals(midnight, MidnightTime.calc(now));
}
+ @Test
+ public void resetCache() {
+ long now = DateUtil.now();
+ MidnightTime.calc(now);
+ MidnightTime.resetCache();
+ Assert.assertEquals(0, MidnightTime.times.size());
+ }
@Test
public void log() {
long now = DateUtil.now();
diff --git a/build.gradle b/build.gradle
index 101d4c95e7..0173127932 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
+ ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
@@ -16,6 +17,7 @@ buildscript {
// in the individual module build.gradle files
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}