diff --git a/.gitignore b/.gitignore
index 4b311a1123..d9e995910d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,6 @@ app/.classpath
app/.settings/org.eclipse.buildship.core.prefs
wear/.classpath
wear/.settings/org.eclipse.buildship.core.prefs
+app/nsclient/*
+app/nsclient2/*
+app/pumpcontrol/*
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index a9c3d0e4d9..c76f23799b 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -3,9 +3,12 @@
+
-
-
+
+
diff --git a/.idea/dictionaries/project_dictionary.xml b/.idea/dictionaries/project_dictionary.xml
index 79a1572acb..2e08ebd897 100644
--- a/.idea/dictionaries/project_dictionary.xml
+++ b/.idea/dictionaries/project_dictionary.xml
@@ -3,9 +3,11 @@
aaps
abcdef
+ accu
acked
actionstring
aidex
+ alarmack
allowednumbers
androidaps
autosens
@@ -26,11 +28,15 @@
carbsreq
careportal
cellnovo
+ chek
+ clearalarm
crashlytics
danar
danars
dataset
datasets
+ dbadd
+ dbupdate
devicestatus
devicestatuses
devslope
@@ -39,12 +45,14 @@
diaconn
enteredby
enteredinsulin
+ eopatch
eveningoutpost
eversense
extendedbolus
fileprovider
firebase
glimp
+ glunovo
gson
hmac
iage
@@ -79,12 +87,14 @@
pred
profileswitch
pumpbtcomm
+ pumpcontrol
quickwizard
readstatus
realduration
refresheventsfromnightscout
rileylink
roboelectric
+ rozman
sgvs
shortgramm
sitechange
@@ -108,7 +118,8 @@
tirs
totp
tunedays
- uart
+ uart
+ urgentalarm
wizzardpage
xdrip
xstream
diff --git a/app/build.gradle b/app/build.gradle
index 131dfce776..3b58a7abdb 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -105,7 +105,7 @@ android {
defaultConfig {
multiDexEnabled true
versionCode 1500
- version "3.1.0"
+ version "3.1.0.3-dev-a"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
diff --git a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js
index 24b8c29718..f3ff906aac 100644
--- a/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js
+++ b/app/src/main/assets/OpenAPSSMBDynamicISF/determine-basal.js
@@ -203,206 +203,97 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
// 80 mg/dL with low_temptarget_lowers_sensitivity would give 1.5x basal, but is limited to autosens_max (1.2x by default)
}
+ //*********************************************************************************
+ //** Start of Dynamic ISF code for predictions **
+ //*********************************************************************************
- var profile_sens = round(profile.sens,1)
- var sens = profile.sens;
+ console.error("---------------------------------------------------------");
+ console.error( " Dynamic ISF version Beta 1.6.5 ");
+ console.error("---------------------------------------------------------");
- var now = new Date().getHours();
- if (now < 1){
- now = 1;}
- else {
- console.error("Time now is "+now+"; ");
- }
- //*********************************************************************************
- //** Start of Dynamic ISF code for predictions **
- //*********************************************************************************
+ var variable_sens = profile.variable_sens;
+ var TDD = profile.TDD;
+ var insulinDivisor = profile.insulinDivisor;
- console.error("---------------------------------------------------------");
- console.error( " Dynamic ISF version Beta 1.6.5 ");
- console.error("---------------------------------------------------------");
+ //*********************************************************************************
+ //** End of Dynamic ISF code for predictions **
+ //*********************************************************************************
- if (meal_data.TDDAIMI7){
- var tdd7 = meal_data.TDDAIMI7;
- }
- else{
- var tdd7 = ((basal * 12)*100)/21;
- }
- console.error("7-day average TDD is: " +tdd7+ "; ");
-
- if (meal_data.TDDLast24){
- var tdd_24 = meal_data.TDDLast24;
- }
- else {
- var tdd_24 = (( basal * 24 ) * 2.8);
- }
-
- if (meal_data.TDDPUMP){
- var tdd_pump = ( (meal_data.TDDPUMP / now ) * 24);
- }
- else {
- var tdd_pump = (( basal * 24 ) * 2.8);
- }
- console.log("Rolling TDD for last 24 hours is: "+tdd_24+"; ");
-
- /*var tdd_pump_now = meal_data.TDDPUMP;
- var tdd_pump = ( tdd_pump_now / (now / 24));*/
- //var TDD = (tdd7 * 0.4) + (tdd_pump * 0.6);
-
- var tdd1 = meal_data.TDDAIMI1;
- var tdd_4 = meal_data.TDDLast4;
- var tdd8to4 = meal_data.TDD4to8;
- var tdd_last8_wt = ( ( ( 1.4 * tdd_4) + ( 0.6 * tdd8to4) ) * 3 );
-
- console.error("Rolling 8 hours weight average: "+tdd_last8_wt+"; ");
- console.error("1-day average TDD is: "+tdd1+"; ");
- console.error("7-day average TDD is: " +tdd7+ "; ");
-
- //TDD = ( tdd_last8_wt * 0.6) + ( tdd7 * 0.4 );
-
- var TDD = ( tdd_last8_wt * 0.33 ) + ( tdd7 * 0.34 ) + (tdd1 * 0.33);
- console.log("TDD = " +TDD+ " using average of 7-day, 1-day and weighted 8hr average");
-
-
- //var ins_val = 75;
- var insulin = profile.insulinType;
- console.log("Insulin Peak = "+profile.insulinPeak+"; ");
- //console.log("Initial insulin value for ISF: "+ins_val+"; ");
- //console.log("Current value for insulin: "+insulin+"; ");
-
- var ins_val;
- if (profile.insulinPeak > 65) { // lyumjev peak: 45
- ins_val = 55;
- } else if (profile.insulinPeak > 50 ){ // ultra rapid peak: 55
- ins_val = 65;
+ if ( high_temptarget_raises_sensitivity && profile.temptargetSet && target_bg > normalTarget
+ || profile.low_temptarget_lowers_sensitivity && profile.temptargetSet && target_bg < normalTarget ) {
+ // w/ target 100, temp target 110 = .89, 120 = 0.8, 140 = 0.67, 160 = .57, and 200 = .44
+ // e.g.: Sensitivity ratio set to 0.8 based on temp target of 120; Adjusting basal from 1.65 to 1.35; ISF from 58.9 to 73.6
+ //sensitivityRatio = 2/(2+(target_bg-normalTarget)/40);
+ var c = halfBasalTarget - normalTarget;
+ sensitivityRatio = c/(c+target_bg-normalTarget);
+ // limit sensitivityRatio to profile.autosens_max (1.2x by default)
+ sensitivityRatio = Math.min(sensitivityRatio, profile.autosens_max);
+ sensitivityRatio = round(sensitivityRatio,2);
+ console.log("Sensitivity ratio set to "+sensitivityRatio+" based on temp target of "+target_bg+"; ");
+ } else if (typeof autosens_data !== 'undefined' && autosens_data) {
+ sensitivityRatio = autosens_data.ratio;
+ console.log("Autosens ratio: "+sensitivityRatio+"; ");
+ }
+ if (sensitivityRatio) {
+ basal = profile.current_basal * sensitivityRatio;
+ basal = round_basal(basal, profile);
+ if (basal !== profile_current_basal) {
+ console.log("Adjusting basal from "+profile_current_basal+" to "+basal+"; ");
} else {
- ins_val = 75; // rapid peak: 75
+ console.log("Basal unchanged: "+basal+"; ");
}
- console.log("For "+profile.insulinType+" (insulin peak: "+profile.insulinPeak+") divisor is: "+ins_val+"; ");
+ }
- console.log("Insulin value for ISF based on profile: "+ins_val+"; ");
-
- var dynISFadjust = profile.DynISFAdjust;
- dynISFadjust = ( dynISFadjust / 100 );
- TDD = ( dynISFadjust * TDD );
-
- var variable_sens = 1800 / ( TDD * (Math.log(( bg / ins_val ) + 1 ) ) );
-
- variable_sens = round(variable_sens,1);
-
-
- if (dynISFadjust > 1 ) {
- console.log("TDD adjustment factor is: " +dynISFadjust+"; ");
- console.log("TDD adjusted to "+TDD+" using adjustment factor of "+dynISFadjust+"; ");
- console.log("Current sensitivity for predictions is " +variable_sens+" based on current bg");
- }
- else if (dynISFadjust < 1 ){
- console.log("TDD adjustment factor is: " +dynISFadjust+"; ");
- console.log("TDD adjusted to "+TDD+" using adjustment factor of "+dynISFadjust+"; ");
- console.log("Current sensitivity for predictions is " +variable_sens+" based on current bg");
- } else {
- console.log("Current sensitivity for predictions is " +variable_sens+" based on current bg");
- }
- sens = variable_sens;
-
- //*********************************************************************************
- //** End of Dynamic ISF code for predictions **
- //*********************************************************************************
-
-
- if ( high_temptarget_raises_sensitivity && profile.temptargetSet && target_bg > normalTarget || profile.low_temptarget_lowers_sensitivity && profile.temptargetSet && target_bg < normalTarget ) {
- // w/ target 100, temp target 110 = .89, 120 = 0.8, 140 = 0.67, 160 = .57, and 200 = .44
- // e.g.: Sensitivity ratio set to 0.8 based on temp target of 120; Adjusting basal from 1.65 to 1.35; ISF from 58.9 to 73.6
- //sensitivityRatio = 2/(2+(target_bg-normalTarget)/40);
- var c = halfBasalTarget - normalTarget;
- sensitivityRatio = c/(c+target_bg-normalTarget);
- // limit sensitivityRatio to profile.autosens_max (1.2x by default)
- sensitivityRatio = Math.min(sensitivityRatio, profile.autosens_max);
- sensitivityRatio = round(sensitivityRatio,2);
- console.log("Sensitivity ratio set to "+sensitivityRatio+" based on temp target of "+target_bg+"; ");
- sens = sens / sensitivityRatio ;
- sens = round(sens, 1);
- console.log("ISF from "+variable_sens+" to "+sens+ "due to temp target; ");
- }
- else {
- sensitivityRatio = ( meal_data.TDD24 / tdd7 );
- }
- if (sensitivityRatio > 1) {
- sensitivityRatio = Math.min(sensitivityRatio, profile.autosens_max);
- sensitivityRatio = round(sensitivityRatio,2);
- console.log("Sensitivity ratio: "+sensitivityRatio+"; ");
- }
- else if( sensitivityRatio < 1) {
- sensitivityRatio = Math.max(sensitivityRatio, profile.autosens_min);
- sensitivityRatio = round(sensitivityRatio,2);
- console.log("Sensitivity ratio: "+sensitivityRatio+"; ");
- }
- else {
- console.log("Sensitivity ratio: "+sensitivityRatio+"; ");
- }
-
-
- if (sensitivityRatio && profile.openapsama_useautosens === true) {
- basal = profile.current_basal * sensitivityRatio;
- basal = round_basal(basal, profile);
- if (basal !== profile_current_basal) {
- console.log("Adjusting basal from "+profile_current_basal+" to "+basal+"; ");
+ // adjust min, max, and target BG for sensitivity, such that 50% increase in ISF raises target from 100 to 120
+ if (profile.temptargetSet) {
+ //console.log("Temp Target set, not adjusting with autosens; ");
+ } else if (typeof autosens_data !== 'undefined' && autosens_data) {
+ if ( profile.sensitivity_raises_target && autosens_data.ratio < 1 || profile.resistance_lowers_target && autosens_data.ratio > 1 ) {
+ // with a target of 100, default 0.7-1.2 autosens min/max range would allow a 93-117 target range
+ min_bg = round((min_bg - 60) / autosens_data.ratio) + 60;
+ max_bg = round((max_bg - 60) / autosens_data.ratio) + 60;
+ var new_target_bg = round((target_bg - 60) / autosens_data.ratio) + 60;
+ // don't allow target_bg below 80
+ new_target_bg = Math.max(80, new_target_bg);
+ if (target_bg === new_target_bg) {
+ console.log("target_bg unchanged: "+new_target_bg+"; ");
} else {
- console.log("Autosens disabled. Basal unchanged: "+basal+"; ");
+ console.log("target_bg from "+target_bg+" to "+new_target_bg+"; ");
}
+ target_bg = new_target_bg;
}
+ }
- // adjust min, max, and target BG for sensitivity, such that 50% increase in ISF raises target from 100 to 120
- if (profile.temptargetSet) {
- //console.log("Temp Target set, not adjusting with autosens; ");
- } else {
- if ( profile.sensitivity_raises_target && sensitivityRatio < 1 && profile.openapsama_useautosens === true || profile.resistance_lowers_target && sensitivityRatio > 1 && profile.openapsama_useautosens === true) {
- // with a target of 100, default 0.7-1.2 autosens min/max range would allow a 93-117 target range
- min_bg = round((min_bg - 60) / sensitivityRatio) + 60;
- max_bg = round((max_bg - 60) / sensitivityRatio) + 60;
- var new_target_bg = round((target_bg - 60) / sensitivityRatio) + 60;
- // don't allow target_bg below 80
- new_target_bg = Math.max(80, new_target_bg);
- if (target_bg === new_target_bg) {
- console.log("target_bg unchanged: "+new_target_bg+"; ");
- } else {
- console.log("target_bg from "+target_bg+" to "+new_target_bg+"; ");
- }
- target_bg = new_target_bg;
- }
- }
+ if (typeof iob_data === 'undefined' ) {
+ rT.error ='Error: iob_data undefined. ';
+ return rT;
+ }
+ var iobArray = iob_data;
+ if (typeof(iob_data.length) && iob_data.length > 1) {
+ iob_data = iobArray[0];
+ //console.error(JSON.stringify(iob_data[0]));
+ }
- if (typeof iob_data === 'undefined' ) {
- rT.error ='Error: iob_data undefined. ';
- return rT;
- }
+ if (typeof iob_data.activity === 'undefined' || typeof iob_data.iob === 'undefined' ) {
+ rT.error ='Error: iob_data missing some property. ';
+ return rT;
+ }
- var iobArray = iob_data;
- if (typeof(iob_data.length) && iob_data.length > 1) {
- iob_data = iobArray[0];
- //console.error(JSON.stringify(iob_data[0]));
- }
+ var tick;
- if (typeof iob_data.activity === 'undefined' || typeof iob_data.iob === 'undefined' ) {
- rT.error ='Error: iob_data missing some property. ';
- return rT;
- }
+ if (glucose_status.delta > -0.5) {
+ tick = "+" + round(glucose_status.delta,0);
+ } else {
+ tick = round(glucose_status.delta,0);
+ }
+ //var minDelta = Math.min(glucose_status.delta, glucose_status.short_avgdelta, glucose_status.long_avgdelta);
+ var minDelta = Math.min(glucose_status.delta, glucose_status.short_avgdelta);
+ var minAvgDelta = Math.min(glucose_status.short_avgdelta, glucose_status.long_avgdelta);
+ var maxDelta = Math.max(glucose_status.delta, glucose_status.short_avgdelta, glucose_status.long_avgdelta);
- var tick;
-
- if (glucose_status.delta > -0.5) {
- tick = "+" + round(glucose_status.delta,0);
- } else {
- tick = round(glucose_status.delta,0);
- }
- //var minDelta = Math.min(glucose_status.delta, glucose_status.short_avgdelta, glucose_status.long_avgdelta);
- var minDelta = Math.min(glucose_status.delta, glucose_status.short_avgdelta);
- var minAvgDelta = Math.min(glucose_status.short_avgdelta, glucose_status.long_avgdelta);
- var maxDelta = Math.max(glucose_status.delta, glucose_status.short_avgdelta, glucose_status.long_avgdelta);
-
-
- console.error("; CR:",profile.carb_ratio);
+ var sens = variable_sens
// compare currenttemp to iob_data.lastTemp and cancel temp if they don't match
var lastTempAge;
@@ -413,7 +304,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
}
//console.error("currenttemp:",currenttemp,"lastTemp:",JSON.stringify(iob_data.lastTemp),"lastTempAge:",lastTempAge,"m");
var tempModulus = (lastTempAge + currenttemp.duration) % 30;
- console.error("currenttemp:",currenttemp,"lastTempAge:",lastTempAge,"m","tempModulus:",tempModulus,"m");
+ console.error("currenttemp:",round(currenttemp.rate,2),"lastTempAge:",lastTempAge,"m","tempModulus:",tempModulus,"m");
rT.temp = 'absolute';
rT.deliverAt = deliverAt;
if ( microBolusAllowed && currenttemp && iob_data.lastTemp && currenttemp.rate !== iob_data.lastTemp.rate && lastTempAge > 10 && currenttemp.duration ) {
@@ -822,39 +713,36 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
console.error("UAM Impact:",uci,"mg/dL per 5m; UAM Duration:",UAMduration,"hours");
- console.log("EventualBG is" +eventualBG+" ;");
+ console.log("EventualBG is" +eventualBG+" ;");
- minIOBPredBG = Math.max(39,minIOBPredBG);
- minCOBPredBG = Math.max(39,minCOBPredBG);
- minUAMPredBG = Math.max(39,minUAMPredBG);
- minPredBG = round(minIOBPredBG);
+ minIOBPredBG = Math.max(39,minIOBPredBG);
+ minCOBPredBG = Math.max(39,minCOBPredBG);
+ minUAMPredBG = Math.max(39,minUAMPredBG);
+ minPredBG = round(minIOBPredBG);
- var fSensBG = Math.min(minPredBG,bg);
+ var fSensBG = Math.min(minPredBG,bg);
- if (bg > target_bg && glucose_status.delta < 3 && glucose_status.delta > -3 && glucose_status.short_avgdelta > -3 && glucose_status.short_avgdelta < 3 && eventualBG > target_bg && eventualBG < bg ) {
- var future_sens = ( 1800 / (Math.log((((fSensBG * 0.5) + (bg * 0.5))/ins_val)+1)*TDD));
- //var future_sens_old = ( 277700 / (TDD * ((bg * 0.5) + (eventualBG * 0.5 ))));
- console.log("Future state sensitivity is " +future_sens+" based on eventual and current bg due to flat glucose level above target");
- rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;";
+ if (bg > target_bg && glucose_status.delta < 3 && glucose_status.delta > -3 && glucose_status.short_avgdelta > -3 && glucose_status.short_avgdelta < 3 && eventualBG > target_bg && eventualBG < bg ) {
+ var future_sens = ( 1800 / (Math.log((((fSensBG * 0.5) + (bg * 0.5))/insulinDivisor)+1)*TDD));
+ //var future_sens_old = ( 277700 / (TDD * ((bg * 0.5) + (eventualBG * 0.5 ))));
+ console.log("Future state sensitivity is " +future_sens+" based on eventual and current bg due to flat glucose level above target");
+ rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;";
+ }
+
+ else if( glucose_status.delta > 0 && eventualBG > target_bg || eventualBG > bg) {
+ var future_sens = ( 1800 / (Math.log((bg/insulinDivisor)+1)*TDD));
+ //var future_sens_old = ( 277700 / (TDD * bg));
+ console.log("Future state sensitivity is " +future_sens+" using current bg due to small delta or variation");
+ rT.reason += "Dosing sensitivity: " +future_sens+" using current BG;";
}
- else if( glucose_status.delta > 0 && eventualBG > target_bg || eventualBG > bg ) {
- var future_sens = ( 1800 / (Math.log((bg/ins_val)+1)*TDD));
- //var future_sens_old = ( 277700 / (TDD * bg));
- console.log("Future state sensitivity is " +future_sens+" using current bg due to small delta or variation");
- rT.reason += "Dosing sensitivity: " +future_sens+" using current BG;";
- }
-
- else {
- var future_sens = ( 1800 / (Math.log((fSensBG/ins_val)+1)*TDD));
- //var future_sens_old = ( 277700 / (TDD * eventualBG));
- console.log("Future state sensitivity is " +future_sens+" based on eventual bg due to -ve delta");
- rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;";
- }
- future_sens = round(future_sens,1);
-
-
-
+ else {
+ var future_sens = ( 1800 / (Math.log((fSensBG/insulinDivisor)+1)*TDD));
+ //var future_sens_old = ( 277700 / (TDD * eventualBG));
+ console.log("Future state sensitivity is " +future_sens+" based on eventual bg due to -ve delta");
+ rT.reason += "Dosing sensitivity: " +future_sens+" using eventual BG;";
+ }
+ future_sens = round(future_sens,1);
var fractionCarbsLeft = meal_data.mealCOB/meal_data.carbs;
@@ -1079,25 +967,22 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
}
}
-
-
- // calculate 30m low-temp required to get projected BG up to target
- // multiply by 2 to low-temp faster for increased hypo safety
-
- var insulinReq = 2 * Math.min(0, (eventualBG - target_bg) / future_sens);
- insulinReq = round( insulinReq , 2);
- // calculate naiveInsulinReq based on naive_eventualBG
- var naiveInsulinReq = Math.min(0, (naive_eventualBG - target_bg) / sens);
- naiveInsulinReq = round( naiveInsulinReq , 2);
- if (minDelta < 0 && minDelta > expectedDelta) {
- // if we're barely falling, newinsulinReq should be barely negative
- var newinsulinReq = round(( insulinReq * (minDelta / expectedDelta) ), 2);
- //console.error("Increasing insulinReq from " + insulinReq + " to " + newinsulinReq);
- insulinReq = newinsulinReq;
- }
- // rate required to deliver insulinReq less insulin over 30m:
- var rate = basal + (2 * insulinReq);
- rate = round_basal(rate, profile);
+ // calculate 30m low-temp required to get projected BG up to target
+ // multiply by 2 to low-temp faster for increased hypo safety
+ var insulinReq = 2 * Math.min(0, (eventualBG - target_bg) / future_sens);
+ insulinReq = round( insulinReq , 2);
+ // calculate naiveInsulinReq based on naive_eventualBG
+ var naiveInsulinReq = Math.min(0, (naive_eventualBG - target_bg) / sens);
+ naiveInsulinReq = round( naiveInsulinReq , 2);
+ if (minDelta < 0 && minDelta > expectedDelta) {
+ // if we're barely falling, newinsulinReq should be barely negative
+ var newinsulinReq = round(( insulinReq * (minDelta / expectedDelta) ), 2);
+ //console.error("Increasing insulinReq from " + insulinReq + " to " + newinsulinReq);
+ insulinReq = newinsulinReq;
+ }
+ // rate required to deliver insulinReq less insulin over 30m:
+ var rate = basal + (2 * insulinReq);
+ rate = round_basal(rate, profile);
// if required temp < existing temp basal
var insulinScheduled = currenttemp.duration * (currenttemp.rate - basal) / 60;
@@ -1185,14 +1070,14 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
}
} else { // otherwise, calculate 30m high-temp required to get projected BG down to target
- // insulinReq is the additional insulin required to get minPredBG down to target_bg
- //console.error(minPredBG,eventualBG);
- insulinReq = round( (Math.min(minPredBG,eventualBG) - target_bg) / future_sens, 2);
- // if that would put us over max_iob, then reduce accordingly
- if (insulinReq > max_iob-iob_data.iob) {
- rT.reason += "max_iob " + max_iob + ", ";
- insulinReq = max_iob-iob_data.iob;
- }
+ // insulinReq is the additional insulin required to get minPredBG down to target_bg
+ //console.error(minPredBG,eventualBG);
+ insulinReq = round( (Math.min(minPredBG,eventualBG) - target_bg) / future_sens, 2);
+ // if that would put us over max_iob, then reduce accordingly
+ if (insulinReq > max_iob-iob_data.iob) {
+ rT.reason += "max_iob " + max_iob + ", ";
+ insulinReq = max_iob-iob_data.iob;
+ }
// rate required to deliver insulinReq more insulin over 30m:
rate = basal + (2 * insulinReq);
diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
index 241da0bed9..ca5331004a 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt
@@ -295,6 +295,7 @@ class MainActivity : NoSplashAppCompatActivity() {
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
+ super.onCreateOptionsMenu(menu)
menu.setGroupDividerEnabled(true)
this.menu = menu
menuInflater.inflate(R.menu.menu_main, menu)
@@ -306,6 +307,7 @@ class MainActivity : NoSplashAppCompatActivity() {
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ super.onOptionsItemSelected(item)
when (item.itemId) {
R.id.nav_preferences -> {
protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, {
diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.kt b/app/src/main/java/info/nightscout/androidaps/MainApp.kt
index bc201bf3c8..62468ebbd9 100644
--- a/app/src/main/java/info/nightscout/androidaps/MainApp.kt
+++ b/app/src/main/java/info/nightscout/androidaps/MainApp.kt
@@ -80,7 +80,7 @@ class MainApp : DaggerApplication() {
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var alarmSoundServiceHelper: AlarmSoundServiceHelper
@Inject lateinit var notificationStore: NotificationStore
- @Inject lateinit var processLifecycleListener: ProcessLifecycleListener
+ @Inject lateinit var processLifecycleListener: Provider
@Inject lateinit var profileSwitchPlugin: ThemeSwitcherPlugin
@Inject lateinit var localAlertUtils: LocalAlertUtils
@Inject lateinit var rh: Provider
@@ -94,7 +94,6 @@ class MainApp : DaggerApplication() {
RxDogTag.install()
setRxErrorHandler()
LocaleHelper.update(this)
- ProcessLifecycleOwner.get().lifecycle.addObserver(processLifecycleListener)
var gitRemote: String? = BuildConfig.REMOTE
var commitHash: String? = BuildConfig.HEAD
@@ -151,6 +150,7 @@ class MainApp : DaggerApplication() {
localAlertUtils.preSnoozeAlarms()
doMigrations()
uel.log(UserEntry.Action.START_AAPS, UserEntry.Sources.Aaps)
+ ProcessLifecycleOwner.get().lifecycle.addObserver(processLifecycleListener.get())
// schedule widget update
refreshWidget = Runnable {
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt
index 20bed45c84..73547e31c2 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt
@@ -12,7 +12,7 @@ import com.google.android.material.datepicker.MaterialDatePicker
import com.jjoe64.graphview.GraphView
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
-import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.androidaps.activities.fragments.HistoryBrowserData
import info.nightscout.androidaps.databinding.ActivityHistorybrowseBinding
import info.nightscout.androidaps.events.EventAutosensCalculationFinished
import info.nightscout.androidaps.events.EventCustomCalculationFinished
@@ -21,27 +21,18 @@ import info.nightscout.androidaps.events.EventScale
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.extensions.toVisibilityKeepSpace
import info.nightscout.androidaps.interfaces.ActivePlugin
-import info.nightscout.androidaps.interfaces.Config
-import info.nightscout.androidaps.interfaces.Loop
-import info.nightscout.androidaps.interfaces.ProfileFunction
-import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
-import info.nightscout.androidaps.plugins.general.overview.OverviewData
+import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.plugins.general.overview.OverviewMenus
import info.nightscout.androidaps.plugins.general.overview.events.EventUpdateOverviewGraph
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
-import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventIobCalculationProgress
-import info.nightscout.androidaps.receivers.DataWorker
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T
-import info.nightscout.androidaps.utils.Translator
-import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.workflow.CalculationWorkflow
import info.nightscout.shared.logging.LTag
-import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.*
@@ -50,23 +41,16 @@ import kotlin.math.min
class HistoryBrowseActivity : NoSplashAppCompatActivity() {
+ @Inject lateinit var historyBrowserData: HistoryBrowserData
@Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var aapsSchedulers: AapsSchedulers
- @Inject lateinit var sp: SP
- @Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var defaultValueHelper: DefaultValueHelper
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var buildHelper: BuildHelper
- @Inject lateinit var repository: AppRepository
@Inject lateinit var fabricPrivacy: FabricPrivacy
@Inject lateinit var overviewMenus: OverviewMenus
@Inject lateinit var dateUtil: DateUtil
- @Inject lateinit var config: Config
- @Inject lateinit var loop: Loop
- @Inject lateinit var nsDeviceStatus: NSDeviceStatus
- @Inject lateinit var translator: Translator
@Inject lateinit var context: Context
- @Inject lateinit var dataWorker: DataWorker
@Inject lateinit var calculationWorkflow: CalculationWorkflow
private val disposable = CompositeDisposable()
@@ -78,9 +62,6 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
private var rangeToDisplay = 24 // for graph
// private var start: Long = 0
- private lateinit var iobCobCalculator: IobCobCalculatorPlugin
- private lateinit var overviewData: OverviewData
-
private lateinit var binding: ActivityHistorybrowseBinding
private var destroyed = false
@@ -89,42 +70,12 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
binding = ActivityHistorybrowseBinding.inflate(layoutInflater)
setContentView(binding.root)
- // We don't want to use injected singletons but own instance working on top of different data
- overviewData =
- OverviewData(
- aapsLogger,
- rh,
- dateUtil,
- sp,
- activePlugin,
- defaultValueHelper,
- profileFunction,
- repository,
- fabricPrivacy
- )
- iobCobCalculator =
- IobCobCalculatorPlugin(
- injector,
- aapsLogger,
- aapsSchedulers,
- rxBus,
- sp,
- rh,
- profileFunction,
- activePlugin,
- fabricPrivacy,
- dateUtil,
- repository,
- overviewData,
- calculationWorkflow
- )
-
binding.left.setOnClickListener {
- adjustTimeRange(overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
+ adjustTimeRange(historyBrowserData.overviewData.fromTime - T.hours(rangeToDisplay.toLong()).msecs())
loadAll("onClickLeft")
}
binding.right.setOnClickListener {
- adjustTimeRange(overviewData.fromTime + T.hours(rangeToDisplay.toLong()).msecs())
+ adjustTimeRange(historyBrowserData.overviewData.fromTime + T.hours(rangeToDisplay.toLong()).msecs())
loadAll("onClickRight")
}
binding.end.setOnClickListener {
@@ -138,7 +89,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
}
binding.zoom.setOnLongClickListener {
Calendar.getInstance().also { calendar ->
- calendar.timeInMillis = overviewData.fromTime
+ calendar.timeInMillis = historyBrowserData.overviewData.fromTime
calendar[Calendar.MILLISECOND] = 0
calendar[Calendar.SECOND] = 0
calendar[Calendar.MINUTE] = 0
@@ -151,13 +102,13 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
binding.date.setOnClickListener {
MaterialDatePicker.Builder.datePicker()
- .setSelection(dateUtil.timeStampToUtcDateMillis(overviewData.fromTime))
+ .setSelection(dateUtil.timeStampToUtcDateMillis(historyBrowserData.overviewData.fromTime))
.setTheme(R.style.DatePicker)
.build()
.apply {
addOnPositiveButtonClickListener { selection ->
- setTime(dateUtil.mergeUtcDateToTimestamp(overviewData.fromTime, selection))
- binding.date.text = dateUtil.dateAndTimeString(overviewData.fromTime)
+ setTime(dateUtil.mergeUtcDateToTimestamp(historyBrowserData.overviewData.fromTime, selection))
+ binding.date.text = dateUtil.dateAndTimeString(historyBrowserData.overviewData.fromTime)
loadAll("onClickDate")
}
}
@@ -180,8 +131,8 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
prepareGraphsIfNeeded(overviewMenus.setting.size)
savedInstanceState?.let { bundle ->
rangeToDisplay = bundle.getInt("rangeToDisplay", 0)
- overviewData.fromTime = bundle.getLong("start", 0)
- overviewData.toTime = bundle.getLong("end", 0)
+ historyBrowserData.overviewData.fromTime = bundle.getLong("start", 0)
+ historyBrowserData.overviewData.toTime = bundle.getLong("end", 0)
}
}
@@ -220,11 +171,11 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
.observeOn(aapsSchedulers.main)
.subscribe({
rangeToDisplay = it.hours
- setTime(overviewData.fromTime)
+ setTime(historyBrowserData.overviewData.fromTime)
loadAll("rangeChange")
}, fabricPrivacy::logException)
-
- if (overviewData.fromTime == 0L) {
+ updateCalcProgress(100)
+ if (historyBrowserData.overviewData.fromTime == 0L) {
// set start of current day
setTime(dateUtil.now())
loadAll("onResume")
@@ -236,8 +187,8 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putInt("rangeToDisplay", rangeToDisplay)
- outState.putLong("start", overviewData.fromTime)
- outState.putLong("end", overviewData.toTime)
+ outState.putLong("start", historyBrowserData.overviewData.fromTime)
+ outState.putLong("end", historyBrowserData.overviewData.toTime)
}
private fun prepareGraphsIfNeeded(numOfGraphs: Int) {
@@ -293,18 +244,18 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
}
private fun adjustTimeRange(start: Long) {
- overviewData.fromTime = start
- overviewData.toTime = overviewData.fromTime + T.hours(rangeToDisplay.toLong()).msecs()
- overviewData.endTime = overviewData.toTime
+ historyBrowserData.overviewData.fromTime = start
+ historyBrowserData.overviewData.toTime = historyBrowserData.overviewData.fromTime + T.hours(rangeToDisplay.toLong()).msecs()
+ historyBrowserData.overviewData.endTime = historyBrowserData.overviewData.toTime
}
private fun runCalculation(from: String) {
calculationWorkflow.runCalculation(
CalculationWorkflow.HISTORY_CALCULATION,
- iobCobCalculator,
- overviewData,
+ historyBrowserData.iobCobCalculator,
+ historyBrowserData.overviewData,
from,
- overviewData.toTime,
+ historyBrowserData.overviewData.toTime,
bgDataReload = true,
limitDataToOldestAvailable = false,
cause = EventCustomCalculationFinished(),
@@ -325,7 +276,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
}
private fun updateDate() {
- binding.date.text = dateUtil.dateAndTimeString(overviewData.fromTime)
+ binding.date.text = dateUtil.dateAndTimeString(historyBrowserData.overviewData.fromTime)
binding.zoom.text = rangeToDisplay.toString()
}
@@ -337,9 +288,9 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
updateDate()
val pump = activePlugin.activePump
- val graphData = GraphData(injector, binding.bgGraph, overviewData)
+ val graphData = GraphData(injector, binding.bgGraph, historyBrowserData.overviewData)
val menuChartSettings = overviewMenus.setting
- graphData.addInRangeArea(overviewData.fromTime, overviewData.endTime, defaultValueHelper.determineLowLine(), defaultValueHelper.determineHighLine())
+ graphData.addInRangeArea(historyBrowserData.overviewData.fromTime, historyBrowserData.overviewData.endTime, defaultValueHelper.determineLowLine(), defaultValueHelper.determineHighLine())
graphData.addBgReadings(menuChartSettings[0][OverviewMenus.CharType.PRE.ordinal], context)
if (buildHelper.isDev()) graphData.addBucketedData()
graphData.addTreatments(context)
@@ -355,7 +306,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
// set manual x bounds to have nice steps
graphData.setNumVerticalLabels()
- graphData.formatAxis(overviewData.fromTime, overviewData.endTime)
+ graphData.formatAxis(historyBrowserData.overviewData.fromTime, historyBrowserData.overviewData.endTime)
graphData.performUpdate()
@@ -365,7 +316,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
val now = System.currentTimeMillis()
for (g in 0 until min(secondaryGraphs.size, menuChartSettings.size + 1)) {
- val secondGraphData = GraphData(injector, secondaryGraphs[g], overviewData)
+ val secondGraphData = GraphData(injector, secondaryGraphs[g], historyBrowserData.overviewData)
var useABSForScale = false
var useIobForScale = false
var useCobForScale = false
@@ -393,7 +344,7 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() {
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && buildHelper.isDev()) secondGraphData.addDeviationSlope(useDSForScale, 1.0)
// set manual x bounds to have nice steps
- secondGraphData.formatAxis(overviewData.fromTime, overviewData.endTime)
+ secondGraphData.formatAxis(historyBrowserData.overviewData.fromTime, historyBrowserData.overviewData.endTime)
secondGraphData.addNowLine(now)
secondaryGraphsData.add(secondGraphData)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/HistoryBrowserData.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/HistoryBrowserData.kt
new file mode 100644
index 0000000000..2fba78b07c
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/HistoryBrowserData.kt
@@ -0,0 +1,72 @@
+package info.nightscout.androidaps.activities.fragments
+
+import dagger.android.HasAndroidInjector
+import info.nightscout.androidaps.database.AppRepository
+import info.nightscout.androidaps.interfaces.ActivePlugin
+import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.plugins.bus.RxBus
+import info.nightscout.androidaps.plugins.general.overview.OverviewData
+import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin
+import info.nightscout.androidaps.utils.DateUtil
+import info.nightscout.androidaps.utils.DefaultValueHelper
+import info.nightscout.androidaps.utils.FabricPrivacy
+import info.nightscout.androidaps.utils.rx.AapsSchedulers
+import info.nightscout.androidaps.workflow.CalculationWorkflow
+import info.nightscout.shared.logging.AAPSLogger
+import info.nightscout.shared.sharedPreferences.SP
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class HistoryBrowserData @Inject constructor(
+ injector: HasAndroidInjector,
+ aapsSchedulers: AapsSchedulers,
+ rxBus: RxBus,
+ aapsLogger: AAPSLogger,
+ rh: ResourceHelper,
+ dateUtil: DateUtil,
+ sp: SP,
+ activePlugin: ActivePlugin,
+ defaultValueHelper: DefaultValueHelper,
+ profileFunction: ProfileFunction,
+ repository: AppRepository,
+ fabricPrivacy: FabricPrivacy,
+ calculationWorkflow: CalculationWorkflow
+) {
+
+ var iobCobCalculator: IobCobCalculatorPlugin
+ var overviewData: OverviewData
+
+ init {
+ // We don't want to use injected singletons but own instance working on top of different data
+ overviewData =
+ OverviewData(
+ aapsLogger,
+ rh,
+ dateUtil,
+ sp,
+ activePlugin,
+ defaultValueHelper,
+ profileFunction,
+ repository,
+ fabricPrivacy
+ )
+ iobCobCalculator =
+ IobCobCalculatorPlugin(
+ injector,
+ aapsLogger,
+ aapsSchedulers,
+ rxBus,
+ sp,
+ rh,
+ profileFunction,
+ activePlugin,
+ fabricPrivacy,
+ dateUtil,
+ repository,
+ overviewData,
+ calculationWorkflow
+ )
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
index 02e4e864f0..be18c83e80 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsBolusCarbsFragment.kt
@@ -6,6 +6,8 @@ import android.os.Bundle
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -28,6 +30,7 @@ import info.nightscout.androidaps.events.EventTreatmentChange
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ActivePlugin
+import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
@@ -40,7 +43,6 @@ import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
-import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
@@ -52,7 +54,7 @@ import io.reactivex.rxjava3.kotlin.subscribeBy
import java.util.concurrent.TimeUnit
import javax.inject.Inject
-class TreatmentsBolusCarbsFragment : DaggerFragment() {
+class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@@ -93,11 +95,11 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
actionHelper = ActionModeHelper(rh, activity, this)
actionHelper.setUpdateListHandler { binding.recyclerview.adapter?.notifyDataSetChanged() }
actionHelper.setOnRemoveHandler { removeSelected(it) }
- setHasOptionsMenu(true)
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
binding.recyclerview.emptyView = binding.noRecordsText
binding.recyclerview.loadingView = binding.progressBar
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
private fun bolusMealLinksWithInvalid(now: Long) = repository
@@ -215,7 +217,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility()
val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia)
if (iob.iobContrib > 0.01) {
- holder.binding.iob.setTextColor(rh.gac(context , R.attr.activeColor))
+ holder.binding.iob.setTextColor(rh.gac(context, R.attr.activeColor))
holder.binding.iob.text = rh.gs(R.string.formatinsulinunits, iob.iobContrib)
holder.binding.iobLabel.visibility = View.VISIBLE
holder.binding.iob.visibility = View.VISIBLE
@@ -225,8 +227,8 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
holder.binding.iobLabel.visibility = View.GONE
holder.binding.iob.visibility = View.GONE
}
- if (bolus.timestamp > dateUtil.now()) holder.binding.date.setTextColor(rh.gac(context, R.attr.scheduledColor)) else holder.binding.date.setTextColor(holder.binding.carbs
- .currentTextColor)
+ if (bolus.timestamp > dateUtil.now())
+ holder.binding.date.setTextColor(rh.gac(context, R.attr.scheduledColor)) else holder.binding.date.setTextColor(holder.binding.carbs.currentTextColor)
holder.binding.mealOrCorrection.text =
when (ml.bolus.type) {
Bolus.Type.SMB -> "SMB"
@@ -291,10 +293,14 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
}
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
this.menu = menu
inflater.inflate(R.menu.menu_treatments_carbs_bolus, menu)
- super.onCreateOptionsMenu(menu, inflater)
+ updateMenuVisibility()
+ val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_insulin, false) || !sp.getBoolean(R.string.key_ns_receive_carbs, false) || !buildHelper.isEngineeringMode()
+ menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
+ val hasItems = (binding.recyclerview.adapter?.itemCount ?: 0) > 0
+ menu.findItem(R.id.nav_delete_future)?.isVisible = hasItems
}
private fun updateMenuVisibility() {
@@ -302,17 +308,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
menu?.findItem(R.id.nav_show_invalidated)?.isVisible = !showInvalidated
}
- override fun onPrepareOptionsMenu(menu: Menu) {
- updateMenuVisibility()
- val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_insulin, false) || !sp.getBoolean(R.string.key_ns_receive_carbs, false) || !buildHelper.isEngineeringMode()
- menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
- val hasItems = (binding.recyclerview.adapter?.itemCount ?: 0) > 0
- menu.findItem(R.id.nav_delete_future)?.isVisible = hasItems
-
- return super.onPrepareOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
R.id.nav_remove_items -> actionHelper.startRemove()
@@ -369,7 +365,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
}
}
- fun deleteFutureTreatments() {
+ private fun deleteFutureTreatments() {
activity?.let { activity ->
OKDialog.showConfirmation(activity, rh.gs(R.string.overview_treatment_label), rh.gs(R.string.deletefuturetreatments) + "?", Runnable {
uel.log(Action.DELETE_FUTURE_TREATMENTS, Sources.Treatments)
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
index d34301a3e6..bedac02f8d 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsCareportalFragment.kt
@@ -4,6 +4,8 @@ import android.os.Bundle
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -20,13 +22,13 @@ import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBindin
import info.nightscout.androidaps.databinding.TreatmentsCareportalItemBinding
import info.nightscout.androidaps.events.EventTherapyEventChange
import info.nightscout.androidaps.extensions.toVisibility
+import info.nightscout.androidaps.interfaces.BuildHelper
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientRestart
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
-import info.nightscout.androidaps.interfaces.BuildHelper
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
@@ -38,7 +40,7 @@ import io.reactivex.rxjava3.kotlin.subscribeBy
import java.util.concurrent.TimeUnit
import javax.inject.Inject
-class TreatmentsCareportalFragment : DaggerFragment() {
+class TreatmentsCareportalFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var rxBus: RxBus
@@ -70,11 +72,11 @@ class TreatmentsCareportalFragment : DaggerFragment() {
actionHelper = ActionModeHelper(rh, activity, this)
actionHelper.setUpdateListHandler { binding.recyclerview.adapter?.notifyDataSetChanged() }
actionHelper.setOnRemoveHandler { removeSelected(it) }
- setHasOptionsMenu(true)
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
binding.recyclerview.emptyView = binding.noRecordsText
binding.recyclerview.loadingView = binding.progressBar
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
private fun refreshFromNightscout() {
@@ -184,18 +186,12 @@ class TreatmentsCareportalFragment : DaggerFragment() {
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
this.menu = menu
inflater.inflate(R.menu.menu_treatments_careportal, menu)
- super.onCreateOptionsMenu(menu, inflater)
- }
-
- override fun onPrepareOptionsMenu(menu: Menu) {
updateMenuVisibility()
val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_therapy_events, false) || !buildHelper.isEngineeringMode()
menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
-
- return super.onPrepareOptionsMenu(menu)
}
private fun updateMenuVisibility() {
@@ -203,7 +199,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
menu?.findItem(R.id.nav_show_invalidated)?.isVisible = !showInvalidated
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
R.id.nav_remove_items -> actionHelper.startRemove()
@@ -265,5 +261,4 @@ class TreatmentsCareportalFragment : DaggerFragment() {
})
}
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
index ce91e33a51..46c8bdc5f4 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsExtendedBolusesFragment.kt
@@ -5,6 +5,8 @@ import android.os.Bundle
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -42,7 +44,7 @@ import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.concurrent.TimeUnit
import javax.inject.Inject
-class TreatmentsExtendedBolusesFragment : DaggerFragment() {
+class TreatmentsExtendedBolusesFragment : DaggerFragment(), MenuProvider {
private val disposable = CompositeDisposable()
@@ -76,11 +78,11 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
actionHelper = ActionModeHelper(rh, activity, this)
actionHelper.setUpdateListHandler { binding.recyclerview.adapter?.notifyDataSetChanged() }
actionHelper.setOnRemoveHandler { removeSelected(it) }
- setHasOptionsMenu(true)
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
binding.recyclerview.emptyView = binding.noRecordsText
binding.recyclerview.loadingView = binding.progressBar
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
fun swapAdapter() {
@@ -174,10 +176,10 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
this.menu = menu
inflater.inflate(R.menu.menu_treatments_extended_bolus, menu)
- super.onCreateOptionsMenu(menu, inflater)
+ updateMenuVisibility()
}
private fun updateMenuVisibility() {
@@ -185,12 +187,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
menu?.findItem(R.id.nav_show_invalidated)?.isVisible = !showInvalidated
}
- override fun onPrepareOptionsMenu(menu: Menu) {
- updateMenuVisibility()
- return super.onPrepareOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ override fun onMenuItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.nav_remove_items -> actionHelper.startRemove()
@@ -243,5 +240,4 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
})
}
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
index 4eda0aa1e5..eb4ea10937 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsProfileSwitchFragment.kt
@@ -6,6 +6,8 @@ import android.os.Bundle
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -48,7 +50,7 @@ import io.reactivex.rxjava3.kotlin.plusAssign
import io.reactivex.rxjava3.kotlin.subscribeBy
import javax.inject.Inject
-class TreatmentsProfileSwitchFragment : DaggerFragment() {
+class TreatmentsProfileSwitchFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var sp: SP
@@ -81,11 +83,11 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
actionHelper = ActionModeHelper(rh, activity, this)
actionHelper.setUpdateListHandler { binding.recyclerview.adapter?.notifyDataSetChanged() }
actionHelper.setOnRemoveHandler { removeSelected(it) }
- setHasOptionsMenu(true)
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
binding.recyclerview.emptyView = binding.noRecordsText
binding.recyclerview.loadingView = binding.progressBar
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
private fun refreshFromNightscout() {
@@ -272,10 +274,12 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
}
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
this.menu = menu
inflater.inflate(R.menu.menu_treatments_profile_switch, menu)
- super.onCreateOptionsMenu(menu, inflater)
+ updateMenuVisibility()
+ val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_profile_switch, false) || !buildHelper.isEngineeringMode()
+ menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
}
private fun updateMenuVisibility() {
@@ -283,15 +287,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
menu?.findItem(R.id.nav_show_invalidated)?.isVisible = !showInvalidated
}
- override fun onPrepareOptionsMenu(menu: Menu) {
- updateMenuVisibility()
- val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_profile_switch, false) || !buildHelper.isEngineeringMode()
- menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
-
- return super.onPrepareOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
R.id.nav_remove_items -> actionHelper.startRemove()
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
index 4876e22dc2..ffe324b869 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTempTargetFragment.kt
@@ -5,6 +5,8 @@ import android.os.Bundle
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -27,6 +29,7 @@ import info.nightscout.androidaps.extensions.friendlyDescription
import info.nightscout.androidaps.extensions.highValueToUnitsToString
import info.nightscout.androidaps.extensions.lowValueToUnitsToString
import info.nightscout.androidaps.extensions.toVisibility
+import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
@@ -35,7 +38,6 @@ import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientR
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventNewHistoryData
import info.nightscout.androidaps.utils.*
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
-import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
@@ -47,7 +49,7 @@ import io.reactivex.rxjava3.kotlin.subscribeBy
import java.util.concurrent.TimeUnit
import javax.inject.Inject
-class TreatmentsTempTargetFragment : DaggerFragment() {
+class TreatmentsTempTargetFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var sp: SP
@Inject lateinit var rxBus: RxBus
@@ -81,10 +83,10 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
actionHelper = ActionModeHelper(rh, activity, this)
actionHelper.setUpdateListHandler { binding.recyclerview.adapter?.notifyDataSetChanged() }
actionHelper.setOnRemoveHandler { removeSelected(it) }
- setHasOptionsMenu(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
binding.recyclerview.emptyView = binding.noRecordsText
binding.recyclerview.loadingView = binding.progressBar
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
private fun refreshFromNightscout() {
@@ -203,10 +205,12 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
}
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
this.menu = menu
inflater.inflate(R.menu.menu_treatments_temp_target, menu)
- super.onCreateOptionsMenu(menu, inflater)
+ updateMenuVisibility()
+ val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_temp_target, false) || !buildHelper.isEngineeringMode()
+ menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
}
private fun updateMenuVisibility() {
@@ -214,15 +218,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
menu?.findItem(R.id.nav_show_invalidated)?.isVisible = !showInvalidated
}
- override fun onPrepareOptionsMenu(menu: Menu) {
- updateMenuVisibility()
- val nsUploadOnly = !sp.getBoolean(R.string.key_ns_receive_temp_target, false) || !buildHelper.isEngineeringMode()
- menu.findItem(R.id.nav_refresh_ns)?.isVisible = !nsUploadOnly
-
- return super.onPrepareOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
R.id.nav_remove_items -> actionHelper.startRemove()
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
index b55a0723a2..7da21e6cad 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsTemporaryBasalsFragment.kt
@@ -5,6 +5,8 @@ import android.os.Bundle
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -48,7 +50,7 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
import kotlin.math.abs
-class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
+class TreatmentsTemporaryBasalsFragment : DaggerFragment(), MenuProvider {
private val disposable = CompositeDisposable()
@@ -81,11 +83,11 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
actionHelper = ActionModeHelper(rh, activity, this)
actionHelper.setUpdateListHandler { binding.recyclerview.adapter?.notifyDataSetChanged() }
actionHelper.setOnRemoveHandler { removeSelected(it) }
- setHasOptionsMenu(true)
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
binding.recyclerview.emptyView = binding.noRecordsText
binding.recyclerview.loadingView = binding.progressBar
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
private fun tempBasalsWithInvalid(now: Long) = repository
@@ -216,10 +218,10 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
this.menu = menu
inflater.inflate(R.menu.menu_treatments_temp_basal, menu)
- super.onCreateOptionsMenu(menu, inflater)
+ updateMenuVisibility()
}
private fun updateMenuVisibility() {
@@ -227,13 +229,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
menu?.findItem(R.id.nav_show_invalidated)?.isVisible = !showInvalidated
}
- override fun onPrepareOptionsMenu(menu: Menu) {
- updateMenuVisibility()
-
- return super.onPrepareOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
R.id.nav_remove_items -> actionHelper.startRemove()
diff --git a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
index a5c4c40110..bd7bcdc406 100644
--- a/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/activities/fragments/TreatmentsUserEntryFragment.kt
@@ -2,6 +2,8 @@ package info.nightscout.androidaps.activities.fragments
import android.os.Bundle
import android.view.*
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -16,6 +18,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.toVisibility
import info.nightscout.androidaps.interfaces.ImportExportPrefs
import info.nightscout.androidaps.interfaces.ProfileFunction
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.DateUtil
@@ -24,14 +27,13 @@ import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.Translator
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
-class TreatmentsUserEntryFragment : DaggerFragment() {
+class TreatmentsUserEntryFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var repository: AppRepository
@Inject lateinit var aapsSchedulers: AapsSchedulers
@@ -60,11 +62,11 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- setHasOptionsMenu(true)
binding.recyclerview.setHasFixedSize(true)
binding.recyclerview.layoutManager = LinearLayoutManager(view.context)
binding.recyclerview.emptyView = binding.noRecordsText
binding.recyclerview.loadingView = binding.progressBar
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}
private fun exportUserEntries() {
@@ -144,10 +146,10 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
override fun getItemCount() = entries.size
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
this.menu = menu
inflater.inflate(R.menu.menu_treatments_user_entry, menu)
- super.onCreateOptionsMenu(menu, inflater)
+ updateMenuVisibility()
}
private fun updateMenuVisibility() {
@@ -155,12 +157,7 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
menu?.findItem(R.id.nav_show_loop)?.isVisible = !showLoop
}
- override fun onPrepareOptionsMenu(menu: Menu) {
- updateMenuVisibility()
- return super.onPrepareOptionsMenu(menu)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
R.id.nav_show_loop -> {
showLoop = true
@@ -185,5 +182,4 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
else -> false
}
-
}
diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
index b6bff09699..e0b0788a25 100644
--- a/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
+++ b/app/src/main/java/info/nightscout/androidaps/dialogs/LoopDialog.kt
@@ -153,7 +153,7 @@ class LoopDialog : DaggerDialogFragment() {
aapsLogger.debug("UpdateGUI from $from")
val pumpDescription: PumpDescription = activePlugin.activePump.pumpDescription
val closedLoopAllowed = constraintChecker.isClosedLoopAllowed(Constraint(true))
- val closedLoopAllowed2 = objectivePlugin.objectives[ObjectivesPlugin.MAXIOB_OBJECTIVE].isCompleted
+ val closedLoopAllowed2 = objectivePlugin.objectives[ObjectivesPlugin.MAXIOB_OBJECTIVE].isAccomplished
val lgsEnabled = constraintChecker.isLgsAllowed(Constraint(true))
val apsMode = sp.getString(R.string.key_aps_mode, "open")
val pump = activePlugin.activePump
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
index 1970d7c179..49345faff8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/loop/LoopFragment.kt
@@ -2,18 +2,20 @@ package info.nightscout.androidaps.plugins.aps.loop
import android.os.Bundle
import android.view.*
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.LoopFragmentBinding
import info.nightscout.androidaps.interfaces.Constraint
import info.nightscout.androidaps.interfaces.Loop
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopSetLastRunGui
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.HtmlHelper
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.sharedPreferences.SP
@@ -21,7 +23,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
-class LoopFragment : DaggerFragment() {
+class LoopFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var aapsSchedulers: AapsSchedulers
@@ -32,7 +34,7 @@ class LoopFragment : DaggerFragment() {
@Inject lateinit var loop: Loop
@Inject lateinit var dateUtil: DateUtil
- private val ID_MENU_RUN = 1
+ private val ID_MENU_RUN = 501
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -45,7 +47,7 @@ class LoopFragment : DaggerFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
LoopFragmentBinding.inflate(inflater, container, false).also {
_binding = it
- setHasOptionsMenu(true)
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}.root
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -54,22 +56,18 @@ class LoopFragment : DaggerFragment() {
with(binding.swipeRefresh) {
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
setOnRefreshListener {
- binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
+ binding.lastrun.text = rh.gs(R.string.executing)
Thread { loop.invoke("Loop swiperefresh", true) }.start()
}
}
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- super.onCreateOptionsMenu(menu, inflater)
- if (isResumed) {
- menu.removeItem(ID_MENU_RUN)
- menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
- menu.setGroupDividerEnabled(true)
- }
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
+ menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
+ menu.setGroupDividerEnabled(true)
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
ID_MENU_RUN -> {
binding.lastrun.text = rh.gs(R.string.executing)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAFragment.kt
index d3fa56acf1..d135ef0cd0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAFragment.kt
@@ -3,16 +3,18 @@ package info.nightscout.androidaps.plugins.aps.openAPSAMA
import android.os.Bundle
import android.text.TextUtils
import android.view.*
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.OpenapsamaFragmentBinding
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateResultGui
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.JSONFormatter
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
@@ -22,7 +24,7 @@ import org.json.JSONArray
import org.json.JSONException
import javax.inject.Inject
-class OpenAPSAMAFragment : DaggerFragment() {
+class OpenAPSAMAFragment : DaggerFragment(), MenuProvider {
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -35,7 +37,8 @@ class OpenAPSAMAFragment : DaggerFragment() {
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var jsonFormatter: JSONFormatter
- private val ID_MENU_RUN = 1
+ @Suppress("PrivatePropertyName")
+ private val ID_MENU_RUN = 502
private var _binding: OpenapsamaFragmentBinding? = null
@@ -46,7 +49,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
OpenapsamaFragmentBinding.inflate(inflater, container, false).also {
_binding = it
- setHasOptionsMenu(true)
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}.root
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -55,23 +58,19 @@ class OpenAPSAMAFragment : DaggerFragment() {
with(binding.swipeRefresh) {
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
setOnRefreshListener {
- binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
- Thread { openAPSAMAPlugin.invoke("OpenAPSAMA swiperefresh", false) }.start()
+ binding.lastrun.text = rh.gs(R.string.executing)
+ Thread { openAPSAMAPlugin.invoke("OpenAPSAMA swipe refresh", false) }.start()
}
}
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- super.onCreateOptionsMenu(menu, inflater)
- if (isResumed) {
- menu.removeItem(ID_MENU_RUN)
- menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
- menu.setGroupDividerEnabled(true)
- }
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
+ menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
+ menu.setGroupDividerEnabled(true)
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
ID_MENU_RUN -> {
binding.lastrun.text = rh.gs(R.string.executing)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBFragment.kt
index db729031a0..cb863b0fc7 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBFragment.kt
@@ -4,17 +4,19 @@ import android.annotation.SuppressLint
import android.os.Bundle
import android.text.TextUtils
import android.view.*
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.OpenapsamaFragmentBinding
import info.nightscout.androidaps.interfaces.ActivePlugin
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateGui
import info.nightscout.androidaps.plugins.aps.events.EventOpenAPSUpdateResultGui
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.JSONFormatter
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
@@ -24,7 +26,7 @@ import org.json.JSONArray
import org.json.JSONException
import javax.inject.Inject
-class OpenAPSSMBFragment : DaggerFragment() {
+class OpenAPSSMBFragment : DaggerFragment(), MenuProvider {
private var disposable: CompositeDisposable = CompositeDisposable()
@@ -36,9 +38,9 @@ class OpenAPSSMBFragment : DaggerFragment() {
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var jsonFormatter: JSONFormatter
- private lateinit var refreshDialog: Runnable
- private val ID_MENU_RUN = 1
+ @Suppress("PrivatePropertyName")
+ private val ID_MENU_RUN = 503
private var _binding: OpenapsamaFragmentBinding? = null
@@ -49,7 +51,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
OpenapsamaFragmentBinding.inflate(inflater, container, false).also {
_binding = it
- setHasOptionsMenu(true)
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}.root
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -58,22 +60,18 @@ class OpenAPSSMBFragment : DaggerFragment() {
with(binding.swipeRefresh) {
setColorSchemeColors(rh.gac(context, R.attr.colorPrimaryDark), rh.gac(context, R.attr.colorPrimary), rh.gac(context, R.attr.colorSecondary))
setOnRefreshListener {
- binding.lastrun.text = rh.gs(info.nightscout.androidaps.R.string.executing)
- Thread { activePlugin.activeAPS.invoke("OpenAPSSMB swiperefresh", false) }.start()
+ binding.lastrun.text = rh.gs(R.string.executing)
+ Thread { activePlugin.activeAPS.invoke("OpenAPSSMB swipe refresh", false) }.start()
}
}
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- super.onCreateOptionsMenu(menu, inflater)
- if (isResumed) {
- menu.removeItem(ID_MENU_RUN)
- menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
- menu.setGroupDividerEnabled(true)
- }
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
+ menu.add(Menu.FIRST, ID_MENU_RUN, 0, rh.gs(R.string.openapsma_run)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
+ menu.setGroupDividerEnabled(true)
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
ID_MENU_RUN -> {
binding.lastrun.text = rh.gs(R.string.executing)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt
index d5a33606eb..234735a214 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/DetermineBasalAdapterSMBDynamicISFJS.kt
@@ -22,6 +22,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.interfaces.ResourceHelper
+import info.nightscout.androidaps.utils.Round
import info.nightscout.androidaps.utils.stats.TddCalculator
import info.nightscout.shared.SafeParse
import info.nightscout.shared.logging.AAPSLogger
@@ -36,6 +37,7 @@ import java.io.IOException
import java.lang.reflect.InvocationTargetException
import java.nio.charset.StandardCharsets
import javax.inject.Inject
+import kotlin.math.ln
class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scriptReader: ScriptReader, private val injector: HasAndroidInjector) : DetermineBasalAdapterInterface {
@@ -194,10 +196,6 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri
this.profile.put("current_basal_safety_multiplier", sp.getDouble(R.string.key_openapsama_current_basal_safety_multiplier, 4.0))
this.profile.put("lgsThreshold", Profile.toMgdl(sp.getDouble(R.string.key_lgs_threshold, 65.0)))
- val insulin = activePlugin.activeInsulin
- val insulinType = insulin.friendlyName
- val insulinPeak = insulin.peak
-
//mProfile.put("high_temptarget_raises_sensitivity", SP.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity));
this.profile.put("high_temptarget_raises_sensitivity", sp.getBoolean(R.string.key_high_temptarget_raises_sensitivity, SMBDefaults.high_temptarget_raises_sensitivity))
//mProfile.put("low_temptarget_lowers_sensitivity", SP.getBoolean(R.string.key_low_temptarget_lowers_sensitivity, SMBDefaults.low_temptarget_lowers_sensitivity));
@@ -227,9 +225,6 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri
this.profile.put("enableSMB_after_carbs", smbEnabled && sp.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering)
this.profile.put("maxSMBBasalMinutes", sp.getInt(R.string.key_smbmaxminutes, SMBDefaults.maxSMBBasalMinutes))
this.profile.put("maxUAMSMBBasalMinutes", sp.getInt(R.string.key_uamsmbmaxminutes, SMBDefaults.maxUAMSMBBasalMinutes))
- this.profile.put("DynISFAdjust", SafeParse.stringToDouble(sp.getString(R.string.key_DynISFAdjust, "100")))
- this.profile.put("insulinType", insulinType)
- this.profile.put("insulinPeak", insulinPeak)
this.profile.put("maxUAMSMBBasalMinutes", sp.getInt(R.string.key_uamsmbmaxminutes, SMBDefaults.maxUAMSMBBasalMinutes))
//set the min SMB amount to be the amount set by the pump.
this.profile.put("bolus_increment", pumpBolusStep)
@@ -237,8 +232,7 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri
this.profile.put("current_basal", basalRate)
this.profile.put("temptargetSet", tempTargetSet)
this.profile.put("autosens_max", SafeParse.stringToDouble(sp.getString(R.string.key_openapsama_autosens_max, "1.2")))
- this.profile.put("autosens_min", SafeParse.stringToDouble(sp.getString(R.string.key_openapsama_autosens_min, "0.8")))
- this.profile.put("openapsama_useautosens", sp.getBoolean(R.string.key_openapsama_useautosens, false))
+ this.profile.put("autosens_min", SafeParse.stringToDouble(sp.getString(R.string.key_openapsama_autosens_min, "0.7")))
//set the min SMB amount to be the amount set by the pump.
if (profileFunction.getUnits() == GlucoseUnit.MMOL) {
this.profile.put("out_units", "mmol/L")
@@ -270,19 +264,53 @@ class DetermineBasalAdapterSMBDynamicISFJS internal constructor(private val scri
this.mealData.put("lastBolusTime", mealData.lastBolusTime)
this.mealData.put("lastCarbTime", mealData.lastCarbTime)
- this.mealData.put("TDDAIMI1", tddCalculator.averageTDD(tddCalculator.calculate(1))?.totalAmount)
- this.mealData.put("TDDAIMI7", tddCalculator.averageTDD(tddCalculator.calculate(7))?.totalAmount)
- this.mealData.put("TDDLast4", tddCalculator.calculateDaily(-4, 0).totalAmount)
- this.mealData.put("TDD4to8", tddCalculator.calculateDaily(-8, -4).totalAmount)
- this.mealData.put("TDD24", tddCalculator.calculateDaily(-24, 0).totalAmount)
+ val tdd1D = tddCalculator.averageTDD(tddCalculator.calculate(1))?.totalAmount
+ val tdd7D = tddCalculator.averageTDD(tddCalculator.calculate(7))?.totalAmount
+ val tddLast24H = tddCalculator.calculateDaily(-24, 0).totalAmount
+ val tddLast4H = tddCalculator.calculateDaily(-4, 0).totalAmount
+ val tddLast8to4H = tddCalculator.calculateDaily(-8, -4).totalAmount
+ val tddWeightedFromLast8H = ((1.4 * tddLast4H) + (0.6 * tddLast8to4H)) * 3
+// console.error("Rolling 8 hours weight average: " + tdd_last8_wt + "; ");
+// console.error("1-day average TDD is: " + tdd1 + "; ");
+// console.error("7-day average TDD is: " + tdd7 + "; ");
+ var tdd =
+ if (tdd1D != null && tdd7D != null) (tddWeightedFromLast8H * 0.33) + (tdd7D * 0.34) + (tdd1D * 0.33)
+ else tddWeightedFromLast8H
+// console.log("TDD = " + TDD + " using average of 7-day, 1-day and weighted 8hr average");
- if (constraintChecker.isAutosensModeEnabled().value()) {
- autosensData.put("ratio", autosensDataRatio)
- } else {
- autosensData.put("ratio", 1.0)
+// console.log("Insulin Peak = " + insulin.peak + "; ");
+
+ val insulin = activePlugin.activeInsulin
+ val insulinDivisor = when {
+ insulin.peak > 65 -> 55 // lyumjev peak: 45
+ insulin.peak > 50 -> 65 // ultra rapid peak: 55
+ else -> 75 // rapid peak: 75
}
+// console.log("For " + insulin.friendlyName + " (insulin peak: " + insulin.peak + ") insulin divisor is: " + ins_val + "; ");
+
+ val dynISFadjust = SafeParse.stringToDouble(sp.getString(R.string.key_DynISFAdjust, "100")) / 100.0
+ tdd *= dynISFadjust
+
+ var variableSensitivity = 1800 / (tdd * (ln((glucoseStatus.glucose / insulinDivisor) + 1)))
+ variableSensitivity = Round.roundTo(variableSensitivity, 0.1)
+
+ if (dynISFadjust != 1.0) {
+// console.log("TDD adjusted to " + TDD + " using adjustment factor of " + dynISFadjust + "; ");
+ }
+// console.log("Current sensitivity for predictions is " + variable_sens + " based on current bg");
+
+ this.profile.put("variable_sens", variableSensitivity)
+ this.profile.put("insulinDivisor", insulinDivisor)
+ this.profile.put("TDD", tdd)
+
+
+ if (sp.getBoolean(R.string.key_adjust_sensitivity, false) && tdd7D != null)
+ autosensData.put("ratio", tddLast24H / tdd7D)
+ else
+ autosensData.put("ratio", 1.0)
+
this.microBolusAllowed = microBolusAllowed
smbAlwaysAllowed = advancedFiltering
currentTime = now
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt
index f3978aacf1..ea2d85eeaa 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMBDynamicISF/OpenAPSSMBDynamicISFPlugin.kt
@@ -68,6 +68,7 @@ class OpenAPSSMBDynamicISFPlugin @Inject constructor(
.shortName(R.string.dynisf_shortname)
.preferencesId(R.xml.pref_openapssmbdynamicisf)
.setDefault(false)
+ .showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
}
override fun specialEnableCondition(): Boolean = buildHelper.isEngineeringMode() && buildHelper.isDev()
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
index 92002eab4d..ff3fc89a4a 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt
@@ -312,7 +312,7 @@ class ActionsFragment : DaggerFragment() {
for (customAction in customActions) {
if (!customAction.isEnabled) continue
- val btn = SingleClickButton(currentContext, null, android.R.attr.buttonStyle)
+ val btn = SingleClickButton(currentContext, null, R.attr.customBtnStyle)
btn.text = rh.gs(customAction.name)
val layoutParams = LinearLayout.LayoutParams(
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt
index 0f2834c90e..6ad3b9e04e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneFragment.kt
@@ -115,6 +115,7 @@ class AutotuneFragment : DaggerFragment() {
}
autotunePlugin.selectedProfile = profileName
resetParam()
+ binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
}
updateGui()
}
@@ -275,6 +276,7 @@ class AutotuneFragment : DaggerFragment() {
.observeOn(aapsSchedulers.main)
.subscribe({ updateGui() }, fabricPrivacy::logException)
checkNewDay()
+ binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
updateGui()
}
@@ -287,7 +289,6 @@ class AutotuneFragment : DaggerFragment() {
@Synchronized
private fun updateGui() {
_binding ?: return
- binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
profileStore = activePlugin.activeProfileSource.profile ?: ProfileStore(injector, JSONObject(), dateUtil)
profileName = if (binding.profileList.text.toString() == rh.gs(R.string.active)) "" else binding.profileList.text.toString()
profileFunction.getProfile()?.let { currentProfile ->
@@ -387,7 +388,7 @@ class AutotuneFragment : DaggerFragment() {
try {
if (autotunePlugin.calculationRunning)
binding.tuneDays.value = autotunePlugin.lastNbDays.toDouble()
- if (binding.tuneDays.value != autotunePlugin.lastNbDays.toDouble()) {
+ if (binding.tuneDays.text != autotunePlugin.lastNbDays) {
autotunePlugin.lastNbDays = binding.tuneDays.text
resetParam(false)
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneIob.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneIob.kt
index a634ee876c..649838a0b0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneIob.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotuneIob.kt
@@ -35,10 +35,8 @@ open class AutotuneIob @Inject constructor(
private val profileFunction: ProfileFunction,
private val sp: SP,
private val dateUtil: DateUtil,
- private val activePlugin: ActivePlugin,
private val autotuneFS: AutotuneFS
) {
-
private var nsTreatments = ArrayList()
private var dia: Double = Constants.defaultDIA
var boluses: ArrayList = ArrayList()
@@ -54,7 +52,11 @@ open class AutotuneIob @Inject constructor(
startBG = from
endBG = to
nsTreatments.clear()
+ meals.clear()
+ boluses.clear()
tempBasals = ArrayList()
+ if (profileFunction.getProfile(from - range()) == null)
+ return
initializeBgreadings(from, to)
initializeTreatmentData(from - range(), to)
initializeTempBasalData(from - range(), to, tunedProfile)
@@ -91,8 +93,6 @@ open class AutotuneIob @Inject constructor(
aapsLogger.debug(LTag.AUTOTUNE, "Check BG date: BG Size: " + glucose.size + " OldestBG: " + dateUtil.dateAndTimeAndSecondsString(oldestBgDate) + " to: " + dateUtil.dateAndTimeAndSecondsString(to))
val tmpCarbs = repository.getCarbsDataFromTimeToTimeExpanded(from, to, false).blockingGet()
aapsLogger.debug(LTag.AUTOTUNE, "Nb treatments after query: " + tmpCarbs.size)
- meals.clear()
- boluses.clear()
var nbCarbs = 0
for (i in tmpCarbs.indices) {
val tp = tmpCarbs[i]
@@ -138,23 +138,17 @@ open class AutotuneIob @Inject constructor(
//nsTreatment is used only for export data
private fun initializeExtendedBolusData(from: Long, to: Long, tunedProfile: ATProfile) {
val extendedBoluses = repository.getExtendedBolusDataFromTimeToTime(from, to, false).blockingGet()
- val pumpInterface = activePlugin.activePump
- if (pumpInterface.isFakingTempsByExtendedBoluses) {
- for (i in extendedBoluses.indices) {
- val eb = extendedBoluses[i]
- if (eb.isValid)
+ for (i in extendedBoluses.indices) {
+ val eb = extendedBoluses[i]
+ if (eb.isValid)
+ if (eb.isEmulatingTempBasal) {
profileFunction.getProfile(eb.timestamp)?.let {
toSplittedTimestampTB(eb.toTemporaryBasal(it), tunedProfile)
}
- }
- } else {
- for (i in extendedBoluses.indices) {
- val eb = extendedBoluses[i]
- if (eb.isValid) {
+ } else {
nsTreatments.add(NsTreatment(eb))
boluses.addAll(convertToBoluses(eb))
}
- }
}
}
@@ -381,9 +375,11 @@ open class AutotuneIob @Inject constructor(
}
}
TherapyEvent.Type.COMBO_BOLUS ->
- extendedBolus?.let {
- val profile = profileFunction.getProfile(it.timestamp)
- it.toJson(true, profile!!, dateUtil)
+ extendedBolus?.let { ebr ->
+ val profile = profileFunction.getProfile(ebr.timestamp)
+ profile?.let {
+ ebr.toJson(true, it, dateUtil)
+ }
}
TherapyEvent.Type.CORRECTION_BOLUS -> bolusTreatment?.toJson(true, dateUtil)
TherapyEvent.Type.CARBS_CORRECTION -> carbsTreatment?.toJson(true, dateUtil)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt
index 6a4f3d6a94..6690cc3235 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/autotune/AutotunePlugin.kt
@@ -61,6 +61,7 @@ class AutotunePlugin @Inject constructor(
.pluginName(R.string.autotune)
.shortName(R.string.autotune_shortname)
.preferencesId(R.xml.pref_autotune)
+ .showInList(buildHelper.isEngineeringMode() && buildHelper.isDev())
.description(R.string.autotune_description),
aapsLogger, resourceHelper, injector
), Autotune {
@@ -133,6 +134,15 @@ class AutotunePlugin @Inject constructor(
log("Tune day " + (i + 1) + " of " + daysBack)
tunedProfile?.let { it ->
autotuneIob.initializeData(from, to, it) //autotuneIob contains BG and Treatments data from history (<=> query for ns-treatments and ns-entries)
+ if (autotuneIob.boluses.size == 0) {
+ result = rh.gs(R.string.autotune_error)
+ log("No basal data on day ${i + 1}")
+ autotuneFS.exportResult(result)
+ autotuneFS.exportLogAndZip(lastRun)
+ rxBus.send(EventAutotuneUpdateGui())
+ calculationRunning = false
+ return
+ }
autotuneFS.exportEntries(autotuneIob) //<=> ns-entries.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine
autotuneFS.exportTreatments(autotuneIob) //<=> ns-treatments.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine (include treatments ,tempBasal and extended
preppedGlucose = autotunePrep.categorize(it) //<=> autotune.yyyymmdd.json files exported for results compare with oref0 autotune on virtual machine
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt
index 6e6e0ab684..25a75d17ce 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefsImpl.kt
@@ -5,6 +5,7 @@ import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
+import android.os.Build
import android.provider.Settings
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatActivity
@@ -113,7 +114,7 @@ class ImportExportPrefsImpl @Inject constructor(
val n1 = Settings.System.getString(context.contentResolver, "bluetooth_name")
val n2 = Settings.Secure.getString(context.contentResolver, "bluetooth_name")
val n3 = try {
- if (ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.name
} else null
} catch (e: Exception){
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt
index 63bf4a5724..888c6ff71c 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/LoggerUtils.kt
@@ -1,8 +1,6 @@
package info.nightscout.androidaps.plugins.general.maintenance
-import ch.qos.logback.classic.LoggerContext
import info.nightscout.androidaps.annotations.OpenForTesting
-import org.slf4j.LoggerFactory
import javax.inject.Inject
import javax.inject.Singleton
@@ -11,7 +9,9 @@ import javax.inject.Singleton
*/
@OpenForTesting
@Singleton
-class LoggerUtils @Inject constructor() {
+class LoggerUtils @Inject constructor(
+ val prefFileListProvider: PrefFileListProvider
+) {
var suffix = ".log.zip"
@@ -21,9 +21,15 @@ class LoggerUtils @Inject constructor() {
*
* @return
*/
+/*
+ This is failing after slf4j update to 2.0.0
+ It would be better to find a way to read the value from xml
+ So far replaced by static value
val logDirectory: String
get() {
val lc = LoggerFactory.getILoggerFactory() as LoggerContext
return lc.getProperty("EXT_FILES_DIR")
}
+*/
+ val logDirectory get() = prefFileListProvider.logsPath
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt
index 43061ed25f..4a1f643a73 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientFragment.kt
@@ -3,6 +3,8 @@ package info.nightscout.androidaps.plugins.general.nsclient
import android.os.Bundle
import android.view.*
import android.widget.ScrollView
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R
import info.nightscout.androidaps.database.entities.UserEntry.Action
@@ -22,7 +24,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject
-class NSClientFragment : DaggerFragment() {
+class NSClientFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var nsClientPlugin: NSClientPlugin
@Inject lateinit var sp: SP
@@ -35,10 +37,10 @@ class NSClientFragment : DaggerFragment() {
companion object {
- const val ID_MENU_CLEAR_LOG = 6
- const val ID_MENU_RESTART = 7
- const val ID_MENU_SEND_NOW = 8
- const val ID_MENU_FULL_SYNC = 9
+ const val ID_MENU_CLEAR_LOG = 507
+ const val ID_MENU_RESTART = 508
+ const val ID_MENU_SEND_NOW = 509
+ const val ID_MENU_FULL_SYNC = 510
}
private val disposable = CompositeDisposable()
@@ -52,7 +54,7 @@ class NSClientFragment : DaggerFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
NsClientFragmentBinding.inflate(inflater, container, false).also {
_binding = it
- setHasOptionsMenu(true)
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}.root
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -73,18 +75,15 @@ class NSClientFragment : DaggerFragment() {
}
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- super.onCreateOptionsMenu(menu, inflater)
- if (isResumed) {
- menu.add(Menu.FIRST, ID_MENU_CLEAR_LOG, 0, rh.gs(R.string.clearlog)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
- menu.add(Menu.FIRST, ID_MENU_RESTART, 0, rh.gs(R.string.restart)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
- menu.add(Menu.FIRST, ID_MENU_SEND_NOW, 0, rh.gs(R.string.deliver_now)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
- menu.add(Menu.FIRST, ID_MENU_FULL_SYNC, 0, rh.gs(R.string.full_sync)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
- menu.setGroupDividerEnabled(true)
- }
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
+ menu.add(Menu.FIRST, ID_MENU_CLEAR_LOG, 0, rh.gs(R.string.clearlog)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
+ menu.add(Menu.FIRST, ID_MENU_RESTART, 0, rh.gs(R.string.restart)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
+ menu.add(Menu.FIRST, ID_MENU_SEND_NOW, 0, rh.gs(R.string.deliver_now)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
+ menu.add(Menu.FIRST, ID_MENU_FULL_SYNC, 0, rh.gs(R.string.full_sync)).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER)
+ menu.setGroupDividerEnabled(true)
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean =
+ override fun onMenuItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
ID_MENU_CLEAR_LOG -> {
nsClientPlugin.clearLog()
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
index 8ecba9d5ad..54a2bbcb40 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt
@@ -120,7 +120,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
@Inject lateinit var repository: AppRepository
@Inject lateinit var glucoseStatusProvider: GlucoseStatusProvider
@Inject lateinit var overviewData: OverviewData
- @Inject lateinit var overviewPlugin: OverviewPlugin
@Inject lateinit var automationPlugin: AutomationPlugin
@Inject lateinit var bgQualityCheckPlugin: BgQualityCheckPlugin
@@ -417,7 +416,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
uel.log(Action.ACCEPTS_TEMP_BASAL, Sources.Overview)
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager?)?.cancel(Constants.notificationID)
rxBus.send(EventMobileToWear(EventData.CancelNotification(dateUtil.now())))
- Thread { loop.acceptChangeRequest() }.run()
+ Thread { loop.acceptChangeRequest() }.start()
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
})
})
@@ -582,7 +581,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
for (event in events)
if (event.isEnabled && event.trigger.shouldRun())
context?.let { context ->
- SingleClickButton(context).also {
+ SingleClickButton(context, null, R.attr.customBtnStyle).also {
it.setTextColor(rh.gac(context, R.attr.treatmentButton))
it.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f)
it.layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 0.5f).also { l ->
@@ -827,7 +826,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
}
}
- fun updateProfile() {
+ private fun updateProfile() {
val profile = profileFunction.getProfile()
runOnUiThread {
_binding ?: return@runOnUiThread
@@ -885,7 +884,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
}
}
- fun updateTime() {
+ private fun updateTime() {
_binding ?: return
binding.infoLayout.time.text = dateUtil.timeString(dateUtil.now())
// Status lights
@@ -915,7 +914,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
)
}
- fun updateIobCob() {
+ private fun updateIobCob() {
val iobText = overviewData.iobText(iobCobCalculator)
val iobDialogText = overviewData.iobDialogText(iobCobCalculator)
val displayText = overviewData.cobInfo(iobCobCalculator).displayText(rh, dateUtil, buildHelper.isEngineeringMode())
@@ -999,6 +998,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
val pump = activePlugin.activePump
val graphData = GraphData(injector, binding.graphsLayout.bgGraph, overviewData)
val menuChartSettings = overviewMenus.setting
+ if (menuChartSettings.isEmpty()) return
graphData.addInRangeArea(overviewData.fromTime, overviewData.endTime, defaultValueHelper.determineLowLine(), defaultValueHelper.determineHighLine())
graphData.addBgReadings(menuChartSettings[0][OverviewMenus.CharType.PRE.ordinal], context)
if (buildHelper.isDev()) graphData.addBucketedData()
@@ -1084,7 +1084,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
private fun updateSensitivity() {
_binding ?: return
- if (sp.getBoolean(R.string.key_openapsama_useautosens, false) && constraintChecker.isAutosensModeEnabled().value()) {
+ if (constraintChecker.isAutosensModeEnabled().value()) {
binding.infoLayout.sensitivityIcon.setImageResource(R.drawable.ic_swap_vert_black_48dp_green)
} else {
binding.infoLayout.sensitivityIcon.setImageResource(R.drawable.ic_x_swap_vert)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt
index e388adb8bf..2431dc5f61 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewMenus.kt
@@ -69,14 +69,16 @@ class OverviewMenus @Inject constructor(
private var _setting: MutableList> = ArrayList()
val setting: List>
- get() = _setting.toMutableList() // implicitly does a list copy
+ @Synchronized get() = _setting.toMutableList() // implicitly does a list copy
+ @Synchronized
private fun storeGraphConfig() {
val sts = Gson().toJson(_setting)
sp.putString(R.string.key_graphconfig, sts)
aapsLogger.debug(sts)
}
+ @Synchronized
fun loadGraphConfig() {
val sts = sp.getString(R.string.key_graphconfig, "")
if (sts.isNotEmpty()) {
@@ -115,7 +117,7 @@ class OverviewMenus @Inject constructor(
val used = arrayListOf()
for (g in 0 until numOfGraphs) {
- if (g != 0 && g < numOfGraphs) {
+ if (g != 0) {
val dividerItem = popup.menu.add(Menu.NONE, g, Menu.NONE, "------- ${rh.gs(R.string.graph_menu_divider_header)} $g -------")
dividerItem.isCheckable = true
dividerItem.isChecked = true
@@ -134,8 +136,8 @@ class OverviewMenus @Inject constructor(
val item = popup.menu.add(Menu.NONE, m.ordinal + 100 * (g + 1), Menu.NONE, rh.gs(m.nameId))
val title = item.title
val s = SpannableString(" $title ")
- s.setSpan(ForegroundColorSpan(rh.gac(context, m.attrTextId)), 0, s.length, 0)
- s.setSpan(BackgroundColorSpan(rh.gac(context, m.attrId)), 0, s.length, 0)
+ s.setSpan(ForegroundColorSpan(rh.gac(m.attrTextId)), 0, s.length, 0)
+ s.setSpan(BackgroundColorSpan(rh.gac(m.attrId)), 0, s.length, 0)
item.title = s
item.isCheckable = true
item.isChecked = settingsCopy[g][m.ordinal]
@@ -150,36 +152,38 @@ class OverviewMenus @Inject constructor(
}
popup.setOnMenuItemClickListener {
- try {
- // id < 100 graph header - divider 1, 2, 3 .....
- when {
- it.itemId == SCALE_ID -> {
- // do nothing, submenu
- }
+ synchronized(this) {
+ try {
+ // id < 100 graph header - divider 1, 2, 3 .....
+ when {
+ it.itemId == SCALE_ID -> {
+ // do nothing, submenu
+ }
- it.itemId > SCALE_ID && it.itemId < SCALE_ID + 100 -> {
- val hours = it.itemId - SCALE_ID // 6,12,....
- rxBus.send(EventScale(hours))
- }
+ it.itemId > SCALE_ID && it.itemId < SCALE_ID + 100 -> {
+ val hours = it.itemId - SCALE_ID // 6,12,....
+ rxBus.send(EventScale(hours))
+ }
- it.itemId == numOfGraphs -> {
- // add new empty
- _setting.add(Array(CharType.values().size) { false })
- }
+ it.itemId == numOfGraphs -> {
+ // add new empty
+ _setting.add(Array(CharType.values().size) { false })
+ }
- it.itemId < 100 -> {
- // remove graph
- _setting.removeAt(it.itemId)
- }
+ it.itemId < 100 -> {
+ // remove graph
+ _setting.removeAt(it.itemId)
+ }
- else -> {
- val graphNumber = it.itemId / 100 - 1
- val item = it.itemId % 100
- _setting[graphNumber][item] = !it.isChecked
+ else -> {
+ val graphNumber = it.itemId / 100 - 1
+ val item = it.itemId % 100
+ _setting[graphNumber][item] = !it.isChecked
+ }
}
+ } catch (exception: Exception) {
+ fabricPrivacy.logException(exception)
}
- } catch (exception: Exception) {
- fabricPrivacy.logException(exception)
}
storeGraphConfig()
setupChartMenu(context, chartButton)
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
index 04095b64a8..18c902f6a4 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt
@@ -44,10 +44,11 @@ class StatusLightHandler @Inject constructor(
handleAge(careportal_pb_age, TherapyEvent.Type.PUMP_BATTERY_CHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0)
}
if (!config.NSCLIENT) {
+ val insulinUnit = rh.gs(R.string.insulin_unit_shortname)
if (pump.model() == PumpType.OMNIPOD_EROS || pump.model() == PumpType.OMNIPOD_DASH) {
- handleOmnipodReservoirLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U")
+ handleOmnipodReservoirLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, insulinUnit)
} else {
- handleLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U")
+ handleLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, insulinUnit)
}
if (bgSource.sensorBatteryLevel != -1)
handleLevel(careportal_sensor_battery_level, R.string.key_statuslights_sbat_critical, 5.0, R.string.key_statuslights_sbat_warning, 20.0, bgSource.sensorBatteryLevel.toDouble(), "%")
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearPlugin.kt
index 61f0558009..e705b0b8bb 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/WearPlugin.kt
@@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.general.wear
import android.content.Context
-import android.content.Intent
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventAutosensCalculationFinished
@@ -10,14 +9,14 @@ import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginDescription
import info.nightscout.androidaps.interfaces.PluginType
+import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.aps.loop.events.EventLoopUpdateGui
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning
import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewBolusProgress
import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataHandlerMobile
-import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataLayerListenerServiceMobile
+import info.nightscout.androidaps.plugins.general.wear.wearintegration.DataLayerListenerServiceMobileHelper
import info.nightscout.androidaps.utils.FabricPrivacy
-import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.sharedPreferences.SP
@@ -37,7 +36,8 @@ class WearPlugin @Inject constructor(
private val fabricPrivacy: FabricPrivacy,
private val rxBus: RxBus,
private val context: Context,
- private val dataHandlerMobile: DataHandlerMobile
+ private val dataHandlerMobile: DataHandlerMobile,
+ val dataLayerListenerServiceMobileHelper: DataLayerListenerServiceMobileHelper
) : PluginBase(
PluginDescription()
@@ -57,7 +57,7 @@ class WearPlugin @Inject constructor(
override fun onStart() {
super.onStart()
- context.startService(Intent(context, DataLayerListenerServiceMobile::class.java))
+ dataLayerListenerServiceMobileHelper.startService(context)
disposable += rxBus
.toObservable(EventDismissBolusProgressIfRunning::class.java)
.observeOn(aapsSchedulers.io)
@@ -94,6 +94,6 @@ class WearPlugin @Inject constructor(
override fun onStop() {
disposable.clear()
super.onStop()
- context.stopService(Intent(context, DataLayerListenerServiceMobile::class.java))
+ dataLayerListenerServiceMobileHelper.stopService(context)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt
index 4292307c59..1a3cd7f601 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobile.kt
@@ -1,5 +1,6 @@
package info.nightscout.androidaps.plugins.general.wear.wearintegration
+import android.os.Binder
import android.os.Handler
import android.os.HandlerThread
import com.google.android.gms.tasks.Tasks
@@ -10,14 +11,12 @@ import info.nightscout.androidaps.database.AppRepository
import info.nightscout.androidaps.events.EventMobileToWear
import info.nightscout.androidaps.interfaces.*
import info.nightscout.androidaps.plugins.bus.RxBus
-import info.nightscout.androidaps.plugins.general.nsclient.data.NSDeviceStatus
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.general.wear.events.EventWearUpdateGui
import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.rx.AapsSchedulers
-import info.nightscout.androidaps.utils.wizard.QuickWizard
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.LTag
import info.nightscout.shared.sharedPreferences.SP
@@ -38,9 +37,7 @@ class DataLayerListenerServiceMobile : WearableListenerService() {
@Inject lateinit var loop: Loop
@Inject lateinit var wearPlugin: WearPlugin
@Inject lateinit var sp: SP
- @Inject lateinit var quickWizard: QuickWizard
@Inject lateinit var config: Config
- @Inject lateinit var nsDeviceStatus: NSDeviceStatus
@Inject lateinit var receiverStatusStore: ReceiverStatusStore
@Inject lateinit var repository: AppRepository
@Inject lateinit var defaultValueHelper: DefaultValueHelper
@@ -48,6 +45,11 @@ class DataLayerListenerServiceMobile : WearableListenerService() {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var aapsSchedulers: AapsSchedulers
+ inner class LocalBinder : Binder() {
+
+ fun getService(): DataLayerListenerServiceMobile = this@DataLayerListenerServiceMobile
+ }
+
private val dataClient by lazy { Wearable.getDataClient(this) }
private val messageClient by lazy { Wearable.getMessageClient(this) }
private val capabilityClient by lazy { Wearable.getCapabilityClient(this) }
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobileHelper.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobileHelper.kt
new file mode 100644
index 0000000000..941e04eb53
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/wearintegration/DataLayerListenerServiceMobileHelper.kt
@@ -0,0 +1,62 @@
+package info.nightscout.androidaps.plugins.general.wear.wearintegration
+
+import android.content.ComponentName
+import android.content.Context
+import android.content.Intent
+import android.content.ServiceConnection
+import android.os.IBinder
+import info.nightscout.androidaps.interfaces.NotificationHolder
+import javax.inject.Inject
+import javax.inject.Singleton
+
+/*
+ This code replaces following
+ val alarm = Intent(context, DataLayerListenerServiceMobile::class.java)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) context.startForegroundService(alarm) else context.startService(alarm)
+
+ it fails randomly with error
+ Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{e317f7e u0 info.nightscout.nsclient/info.nightscout.androidaps.services.DataLayerListenerServiceMobile}
+
+ */
+@Singleton
+class DataLayerListenerServiceMobileHelper @Inject constructor(
+ private val notificationHolder: NotificationHolder
+) {
+
+ fun startService(context: Context) {
+ val connection = object : ServiceConnection {
+ override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
+ // The binder of the service that returns the instance that is created.
+ val binder: DataLayerListenerServiceMobile.LocalBinder = service as DataLayerListenerServiceMobile.LocalBinder
+
+ val dataLayerListenerServiceMobile: DataLayerListenerServiceMobile = binder.getService()
+
+ context.startForegroundService(Intent(context, DataLayerListenerServiceMobile::class.java))
+
+ // This is the key: Without waiting Android Framework to call this method
+ // inside Service.onCreate(), immediately call here to post the notification.
+ dataLayerListenerServiceMobile.startForeground(notificationHolder.notificationID, notificationHolder.notification)
+
+ // Release the connection to prevent leaks.
+ context.unbindService(this)
+ }
+
+ override fun onServiceDisconnected(name: ComponentName?) {
+ }
+ }
+
+ try {
+ context.bindService(Intent(context, DataLayerListenerServiceMobile::class.java), connection, Context.BIND_AUTO_CREATE)
+ } catch (ignored: RuntimeException) {
+ // This is probably a broadcast receiver context even though we are calling getApplicationContext().
+ // Just call startForegroundService instead since we cannot bind a service to a
+ // broadcast receiver context. The service also have to call startForeground in
+ // this case.
+ context.startForegroundService(Intent(context, DataLayerListenerServiceMobile::class.java))
+ }
+ }
+
+ fun stopService(context: Context) {
+ context.stopService(Intent(context, DataLayerListenerServiceMobile::class.java))
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt
index 4d157a874a..12f240b1e3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/iob/iobCobCalculator/IobCobOref1Worker.kt
@@ -97,11 +97,11 @@ class IobCobOref1Worker(
val bucketedData = ads.bucketedData
val autosensDataTable = ads.autosensDataTable
if (bucketedData == null || bucketedData.size < 3) {
- aapsLogger.debug(LTag.AUTOSENS, "Aborting calculation thread (No bucketed data available): ${data.from}")
+ aapsLogger.debug(LTag.AUTOSENS, {"Aborting calculation thread (No bucketed data available): ${data.from}"})
return Result.success(workDataOf("Error" to "Aborting calculation thread (No bucketed data available): ${data.from}"))
}
val prevDataTime = ads.roundUpTime(bucketedData[bucketedData.size - 3].timestamp)
- aapsLogger.debug(LTag.AUTOSENS, "Prev data time: " + dateUtil.dateAndTimeString(prevDataTime))
+ aapsLogger.debug(LTag.AUTOSENS, {"Prev data time: " + dateUtil.dateAndTimeString(prevDataTime)})
var previous = autosensDataTable[prevDataTime]
// start from oldest to be able sub cob
for (i in bucketedData.size - 4 downTo 0) {
@@ -156,15 +156,15 @@ class IobCobOref1Worker(
val hourAgoData = ads.getAutosensDataAtTime(hourAgo)
if (hourAgoData != null) {
val initialIndex = autosensDataTable.indexOfKey(hourAgoData.time)
- aapsLogger.debug(LTag.AUTOSENS, ">>>>> bucketed_data.size()=" + bucketedData.size + " i=" + i + " hourAgoData=" + hourAgoData.toString())
+ aapsLogger.debug(LTag.AUTOSENS, { ">>>>> bucketed_data.size()=" + bucketedData.size + " i=" + i + " hourAgoData=" + hourAgoData.toString()})
var past = 1
try {
while (past < 12) {
val ad = autosensDataTable.valueAt(initialIndex + past)
- aapsLogger.debug(LTag.AUTOSENS, ">>>>> past=" + past + " ad=" + ad?.toString())
+ aapsLogger.debug(LTag.AUTOSENS, {">>>>> past=" + past + " ad=" + ad?.toString()})
if (ad == null) {
- aapsLogger.debug(LTag.AUTOSENS, autosensDataTable.toString())
- aapsLogger.debug(LTag.AUTOSENS, bucketedData.toString())
+ aapsLogger.debug(LTag.AUTOSENS, {autosensDataTable.toString()})
+ aapsLogger.debug(LTag.AUTOSENS, {bucketedData.toString()})
//aapsLogger.debug(LTag.AUTOSENS, iobCobCalculatorPlugin.getBgReadingsDataTable().toString())
val notification = Notification(Notification.SEND_LOGFILES, rh.gs(R.string.sendlogfiles), Notification.LOW)
rxBus.send(EventNewNotification(notification))
@@ -319,14 +319,12 @@ class IobCobOref1Worker(
if (bgTime < dateUtil.now()) autosensDataTable.put(bgTime, autosensData)
aapsLogger.debug(
LTag.AUTOSENS,
- "Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + ads.lastDataTime(
- dateUtil
- )
+ {"Running detectSensitivity from: " + dateUtil.dateAndTimeString(oldestTimeWithData) + " to: " + dateUtil.dateAndTimeString(bgTime) + " lastDataTime:" + ads.lastDataTime(dateUtil)}
)
val sensitivity = activePlugin.activeSensitivity.detectSensitivity(ads, oldestTimeWithData, bgTime)
aapsLogger.debug(LTag.AUTOSENS, "Sensitivity result: $sensitivity")
autosensData.autosensResult = sensitivity
- aapsLogger.debug(LTag.AUTOSENS, autosensData.toString())
+ aapsLogger.debug(LTag.AUTOSENS, {autosensData.toString()})
}
data.iobCobCalculator.ads = ads
Thread {
@@ -335,7 +333,7 @@ class IobCobOref1Worker(
}.start()
} finally {
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.IOB_COB_OREF, 100, data.cause))
- aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA thread ended: ${data.from}")
+ aapsLogger.debug(LTag.AUTOSENS, {"AUTOSENSDATA thread ended: ${data.from}"})
profiler.log(LTag.AUTOSENS, "IobCobOref1Thread", start)
}
return Result.success()
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
index a3fd240570..9da1348c48 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/BGSourceFragment.kt
@@ -4,6 +4,8 @@ import android.os.Bundle
import android.util.SparseArray
import android.view.*
import androidx.core.util.forEach
+import androidx.core.view.MenuProvider
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
@@ -39,7 +41,7 @@ import io.reactivex.rxjava3.kotlin.plusAssign
import java.util.concurrent.TimeUnit
import javax.inject.Inject
-class BGSourceFragment : DaggerFragment() {
+class BGSourceFragment : DaggerFragment(), MenuProvider {
@Inject lateinit var rxBus: RxBus
@Inject lateinit var fabricPrivacy: FabricPrivacy
@@ -66,7 +68,7 @@ class BGSourceFragment : DaggerFragment() {
actionHelper = ActionModeHelper(rh, activity, this)
actionHelper.setUpdateListHandler { binding.recyclerview.adapter?.notifyDataSetChanged() }
actionHelper.setOnRemoveHandler { handler -> removeSelected(handler) }
- setHasOptionsMenu(true)
+ requireActivity().addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED)
}.root
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -104,13 +106,8 @@ class BGSourceFragment : DaggerFragment() {
super.onPause()
}
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- super.onCreateOptionsMenu(menu, inflater)
+ override fun onCreateMenu(menu: Menu, inflater: MenuInflater) {
actionHelper.onCreateOptionsMenu(menu, inflater)
- }
-
- override fun onPrepareOptionsMenu(menu: Menu) {
- super.onPrepareOptionsMenu(menu)
actionHelper.onPrepareOptionsMenu(menu)
}
@@ -121,7 +118,7 @@ class BGSourceFragment : DaggerFragment() {
_binding = null
}
- override fun onOptionsItemSelected(item: MenuItem) =
+ override fun onMenuItemSelected(item: MenuItem) =
actionHelper.onOptionsItemSelected(item)
inner class RecyclerViewAdapter internal constructor(private var glucoseValues: List) : RecyclerView.Adapter() {
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt
index 239a317781..6a02daa322 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/source/GlunovoPlugin.kt
@@ -89,80 +89,84 @@ class GlunovoPlugin @Inject constructor(
private fun handleNewData() {
if (!isEnabled()) return
- context.contentResolver.query(contentUri, null, null, null, null)?.let { cr ->
- val glucoseValues = mutableListOf()
- val calibrations = mutableListOf()
- cr.moveToFirst()
+ try {
+ context.contentResolver.query(contentUri, null, null, null, null)?.let { cr ->
+ val glucoseValues = mutableListOf()
+ val calibrations = mutableListOf()
+ cr.moveToFirst()
- while (!cr.isAfterLast) {
- val timestamp = cr.getLong(0)
- val value = cr.getDouble(1) //value in mmol/l...
- val curr = cr.getDouble(2)
+ while (!cr.isAfterLast) {
+ val timestamp = cr.getLong(0)
+ val value = cr.getDouble(1) //value in mmol/l...
+ val curr = cr.getDouble(2)
- // bypass already processed
- if (timestamp < sp.getLong(R.string.key_last_processed_glunovo_timestamp, 0L)) {
- cr.moveToNext()
- continue
- }
+ // bypass already processed
+ if (timestamp < sp.getLong(R.string.key_last_processed_glunovo_timestamp, 0L)) {
+ cr.moveToNext()
+ continue
+ }
- if (timestamp > dateUtil.now() || timestamp == 0L) {
- aapsLogger.error(LTag.BGSOURCE, "Error in received data date/time $timestamp")
- cr.moveToNext()
- continue
- }
+ if (timestamp > dateUtil.now() || timestamp == 0L) {
+ aapsLogger.error(LTag.BGSOURCE, "Error in received data date/time $timestamp")
+ cr.moveToNext()
+ continue
+ }
- if (value < 2 || value > 25) {
- aapsLogger.error(LTag.BGSOURCE, "Error in received data value (value out of bounds) $value")
- cr.moveToNext()
- continue
- }
+ if (value < 2 || value > 25) {
+ aapsLogger.error(LTag.BGSOURCE, "Error in received data value (value out of bounds) $value")
+ cr.moveToNext()
+ continue
+ }
- if (curr != 0.0)
- glucoseValues += CgmSourceTransaction.TransactionGlucoseValue(
- timestamp = timestamp,
- value = value * Constants.MMOLL_TO_MGDL,
- raw = 0.0,
- noise = null,
- trendArrow = GlucoseValue.TrendArrow.NONE,
- sourceSensor = GlucoseValue.SourceSensor.GLUNOVO_NATIVE
- )
- else
- calibrations.add(
- CgmSourceTransaction.Calibration(
+ if (curr != 0.0)
+ glucoseValues += CgmSourceTransaction.TransactionGlucoseValue(
timestamp = timestamp,
- value = value,
- glucoseUnit = TherapyEvent.GlucoseUnit.MMOL
+ value = value * Constants.MMOLL_TO_MGDL,
+ raw = 0.0,
+ noise = null,
+ trendArrow = GlucoseValue.TrendArrow.NONE,
+ sourceSensor = GlucoseValue.SourceSensor.GLUNOVO_NATIVE
)
- )
- sp.putLong(R.string.key_last_processed_glunovo_timestamp, timestamp)
- cr.moveToNext()
- }
- cr.close()
+ else
+ calibrations.add(
+ CgmSourceTransaction.Calibration(
+ timestamp = timestamp,
+ value = value,
+ glucoseUnit = TherapyEvent.GlucoseUnit.MMOL
+ )
+ )
+ sp.putLong(R.string.key_last_processed_glunovo_timestamp, timestamp)
+ cr.moveToNext()
+ }
+ cr.close()
- if (glucoseValues.isNotEmpty() || calibrations.isNotEmpty())
- repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, calibrations, null))
- .doOnError {
- aapsLogger.error(LTag.DATABASE, "Error while saving values from Glunovo App", it)
- }
- .blockingGet()
- .also { savedValues ->
- savedValues.inserted.forEach {
- xDripBroadcast.send(it)
- aapsLogger.debug(LTag.DATABASE, "Inserted bg $it")
+ if (glucoseValues.isNotEmpty() || calibrations.isNotEmpty())
+ repository.runTransactionForResult(CgmSourceTransaction(glucoseValues, calibrations, null))
+ .doOnError {
+ aapsLogger.error(LTag.DATABASE, "Error while saving values from Glunovo App", it)
}
- savedValues.calibrationsInserted.forEach { calibration ->
- calibration.glucose?.let { glucosevalue ->
- uel.log(
- UserEntry.Action.CALIBRATION,
- UserEntry.Sources.Dexcom,
- ValueWithUnit.Timestamp(calibration.timestamp),
- ValueWithUnit.TherapyEventType(calibration.type),
- ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString)
- )
+ .blockingGet()
+ .also { savedValues ->
+ savedValues.inserted.forEach {
+ xDripBroadcast.send(it)
+ aapsLogger.debug(LTag.DATABASE, "Inserted bg $it")
+ }
+ savedValues.calibrationsInserted.forEach { calibration ->
+ calibration.glucose?.let { glucosevalue ->
+ uel.log(
+ UserEntry.Action.CALIBRATION,
+ UserEntry.Sources.Dexcom,
+ ValueWithUnit.Timestamp(calibration.timestamp),
+ ValueWithUnit.TherapyEventType(calibration.type),
+ ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString)
+ )
+ }
+ aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration")
}
- aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration")
}
- }
+ }
+ } catch (e: SecurityException) {
+ aapsLogger.error(LTag.CORE, "Exception", e)
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt
index 6262e552bc..cea1f8bb35 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/AndroidPermission.kt
@@ -2,7 +2,6 @@ package info.nightscout.androidaps.utils
import android.Manifest
import android.annotation.SuppressLint
-import android.annotation.TargetApi
import android.bluetooth.BluetoothAdapter
import android.content.ActivityNotFoundException
import android.content.Context
@@ -51,12 +50,20 @@ class AndroidPermission @Inject constructor(
}
if (test) {
if (activity is DaggerAppCompatActivityWithResult)
- activity.requestMultiplePermissions.launch(permissions)
+ try {
+ activity.requestMultiplePermissions.launch(permissions)
+ } catch (ignored: IllegalStateException) {
+ ToastUtils.errorToast(activity, rh.gs(R.string.error_asking_for_permissions))
+ }
}
if (testBattery) {
try {
if (activity is DaggerAppCompatActivityWithResult)
- activity.callForBatteryOptimization.launch(null)
+ try {
+ activity.callForBatteryOptimization.launch(null)
+ } catch (ignored: IllegalStateException) {
+ ToastUtils.errorToast(activity, rh.gs(R.string.error_asking_for_permissions))
+ }
} catch (e: ActivityNotFoundException) {
permissionBatteryOptimizationFailed = true
OKDialog.show(activity, rh.gs(R.string.permission), rh.gs(R.string.alert_dialog_permission_battery_optimization_failed)) { activity.recreate() }
@@ -95,13 +102,14 @@ class AndroidPermission @Inject constructor(
}
}
+ @SuppressLint("MissingPermission")
@Synchronized
fun notifyForBtConnectPermission(activity: FragmentActivity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// Manifest.permission.BLUETOOTH_CONNECT
- if (permissionNotGranted(activity, "android.permission.BLUETOOTH_CONNECT") || permissionNotGranted(activity, "android.permission.BLUETOOTH_SCAN")) {
+ if (permissionNotGranted(activity, Manifest.permission.BLUETOOTH_CONNECT) || permissionNotGranted(activity, Manifest.permission.BLUETOOTH_SCAN)) {
val notification = NotificationWithAction(injector, Notification.PERMISSION_BT, rh.gs(R.string.needconnectpermission), Notification.URGENT)
- notification.action(R.string.request) { askForPermission(activity, arrayOf("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT")) }
+ notification.action(R.string.request) { askForPermission(activity, arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT)) }
rxBus.send(EventNewNotification(notification))
} else {
activity.startActivity(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE))
@@ -145,8 +153,10 @@ class AndroidPermission @Inject constructor(
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
// Show alert dialog to the user saying a separate permission is needed
// Launch the settings activity if the user prefers
- val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
- Uri.parse("package:" + activity.packageName))
+ val intent = Intent(
+ Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
+ Uri.parse("package:" + activity.packageName)
+ )
activity.startActivity(intent)
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt b/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt
index b4a2cbcd29..3d8c1e62cd 100644
--- a/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt
+++ b/app/src/main/java/info/nightscout/androidaps/widget/Widget.kt
@@ -204,7 +204,7 @@ class Widget : AppWidgetProvider() {
}
}
- fun updateProfile(views: RemoteViews) {
+ private fun updateProfile(views: RemoteViews) {
val profileTextColor =
profileFunction.getProfile()?.let {
if (it is ProfileSealed.EPS) {
@@ -226,7 +226,7 @@ class Widget : AppWidgetProvider() {
}
private fun updateSensitivity(views: RemoteViews) {
- if (sp.getBoolean(R.string.key_openapsama_useautosens, false) && constraintChecker.isAutosensModeEnabled().value())
+ if (constraintChecker.isAutosensModeEnabled().value())
views.setImageViewResource(R.id.sensitivity_icon, R.drawable.ic_swap_vert_black_48dp_green)
else
views.setImageViewResource(R.id.sensitivity_icon, R.drawable.ic_x_swap_vert)
@@ -256,7 +256,7 @@ class Widget : AppWidgetProvider() {
internal fun updateWidget(context: Context) {
context.sendBroadcast(Intent().also {
- it.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, AppWidgetManager.getInstance(context).getAppWidgetIds(ComponentName(context, Widget::class.java)))
+ it.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, AppWidgetManager.getInstance(context)?.getAppWidgetIds(ComponentName(context, Widget::class.java)))
it.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
})
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_historybrowse.xml b/app/src/main/res/layout/activity_historybrowse.xml
index c3d0eec40a..26673e7b76 100644
--- a/app/src/main/res/layout/activity_historybrowse.xml
+++ b/app/src/main/res/layout/activity_historybrowse.xml
@@ -1,5 +1,5 @@
-
-
-
+ android:layout_height="300dp">
-
+
diff --git a/app/src/main/res/values-af-rZA/strings.xml b/app/src/main/res/values-af-rZA/strings.xml
index 809877af52..9748d50fcb 100644
--- a/app/src/main/res/values-af-rZA/strings.xml
+++ b/app/src/main/res/values-af-rZA/strings.xml
@@ -500,7 +500,6 @@
= 100]]>
Lae tydelike doelwitte verlaag sensitiwiteit
- Skoon AndroidAPS begin
Gestoorde instellings gevind
Aandag: As jy aktiveer en koppel aan \'n hardeware pomp, AndroidAPS sal die basale instellings uit die profiel aan die pomp kopieer, die bestaande basale koers gestoor op die pomp sal oorskryf word. Maak seker jy het die korrekte basale instelling in AndroidAPS. As jy nie seker is of nie die basale instellings wil oorskryf op jou pomp, druk Kanselleer en herhaal oorskakel na die pomp op \'n later tyd.
Behandeling data onvolledig
diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml
index 0cd5f28707..68d6c733ef 100644
--- a/app/src/main/res/values-bg-rBG/strings.xml
+++ b/app/src/main/res/values-bg-rBG/strings.xml
@@ -644,7 +644,6 @@
Когато се установи резистентност, намалява целевата глюкоза.
Чувствителността увеличава целта
Когато се установи чувствителност, повишаване на целевата глюкоза
- AndroidAPS стартира
Открити са предишни настройки
Внимание: Ако активирате и свържете с хардуерна помпа, AndroidAPS ще копира основните настройки от профила в помпата, като презапише съществуващата базова скорост, съхранявана на помпата. Уверете се, че имате правилните основни настройки в AndroidAPS. Ако не сте сигурни или не искате да презапишете основните настройки на помпата, натиснете Cancel и повторете превключването към помпата по-късно.
Данните за лечението не са пълни
diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml
index 5a9ff0129f..8336c1a0de 100644
--- a/app/src/main/res/values-cs-rCZ/strings.xml
+++ b/app/src/main/res/values-cs-rCZ/strings.xml
@@ -645,7 +645,6 @@
Pro oznámení vyžaduje aplikace oprávnění systémového okna
Aplikace potřebuje oprávnění k přístupu k poloze kvůli skenování BT a WiFi identifikaci
Aby bylo možné nahrávat logy a exportovat nastavení, je nutné pro aplikaci povolit oprávnění přístupu k úložišti
- Aplikace potřebuje oprávnění bluetooth
Požadavek
Otevřít menu
Zavřít menu
@@ -666,7 +665,7 @@
Je-li zjištěna rezistence, sníží nastavenou cílovou glykémii
Citlivost zvyšuje cíl
Je-li zjištěna vyšší citlivost, zvýší nastavenou cílovou glykémii
- Vyčistit události \"AndroidAPS restartován\"
+ Odebrat záznamy spuštěné AAPS
Zobrazit neplatné
Skrýt zneplatněné
Odstranit položky
@@ -1045,4 +1044,6 @@
Zablokováno možností nabíjení
Zablokováno možností připojení
(Žádné hodinky nejsou připojeny)
+ Chyba žádosti o oprávnění
+ Upravit citlivost a glykémii
diff --git a/app/src/main/res/values-da-rDK/exam.xml b/app/src/main/res/values-da-rDK/exam.xml
index 2a4276dfe3..75e3579ca8 100644
--- a/app/src/main/res/values-da-rDK/exam.xml
+++ b/app/src/main/res/values-da-rDK/exam.xml
@@ -123,6 +123,7 @@
Notering af kanyleskift vil nulstille Autosens ratio tilbage til 100%.
Nogle af plugin mulighederne har konfigurerbare tidsintervaller, der kan indstilles af brugeren.
https://androidaps.readthedocs.io/en/latest/EN/Configuration/Sensitivity-detection-and-COB.html
+ https://androidaps.readthedocs.io/en/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens
Kulhydrat indtastningsfejl
Hvad gør du, hvis du har lavet en forkert kulhydrat indtastning?
Slet den forkerte indtastning i Behandlinger og indtast korrekte nye kulhydrat værdier.
@@ -135,6 +136,19 @@
Sammenlign værdier i AndroidAPS og pumpehistorik (hvis pumpen understøtter dette).
Bolus en del af din beregnede \"glemte\" insulin med enten sprøjter / pen eller brug af en kanylefyldning.
Gør ingenting og tillad AndroidAPS at rette op på højt blodsukker.
+ Kulhydrater om bord (COB)
+ Hvordan ændring af ISF værdi påvirker COB beregning?
+ Ved øget ISF, vil kulhydrater være længere tid om at absorberes
+ Ved øget ISF, vil kulhydrater være kortere tid om at absorberes
+ Øget ISF vil ikke påvirke absorbering af beregnet kulhydrat
+ Hvordan ændring af IC værdi påvirker COB beregning?
+ Ved øget IC, vil kulhydrater være længere tid om at absorberes
+ Ved øget IC, vil kulhydrater være kortere tid om at absorberes
+ Øget IC vil ikke påvirke absorbering af beregnet kulhydrat
+ Hvordan skift af profil procent påvirker COB beregning?
+ Ved indstilling af profil til 150%, vil kulhydrater være længere tid om at absorberes
+ Ved indstilling af profil til 150%, vil kulhydrater være kortere tid om at absorberes
+ Ved indstilling af profil til 150%, påvirkes absorbering af beregnet kulhydrat ikke
Insulin om bord (IOB)
IOB-værdi påvirkes af midlertidige basaler.
Høj midlertidlig basal vil ikke blive givet, når dit blodsukker er under målet.
diff --git a/app/src/main/res/values-da-rDK/strings.xml b/app/src/main/res/values-da-rDK/strings.xml
index 0f64e595f1..24e3c26317 100644
--- a/app/src/main/res/values-da-rDK/strings.xml
+++ b/app/src/main/res/values-da-rDK/strings.xml
@@ -6,6 +6,7 @@
Behandlings sikkerhed
Maks tilladt bolus [IE]
Maks tilladte kulhydrater [g]
+ BS under værdi for LGS grænse
%1$s indstillinger
Indstillinger
Opdater behandlinger fra NS
@@ -432,12 +433,15 @@
Aktiver lokale udsendelser.
OpenAPS SMB
Dynamisk ISF
+ DynamiskISF-justeringsfaktor %
+ Justeringsfaktor for DynamiskISF. Indstil mere end 100% for mere aggressive korrektionsdoser og mindre end 100% for mindre aggressive korrektioner.
Aktiver UAM
Aktiver SMB
Brug Super Mikro Boluser i stedet for midlertidig basal for hurtigere handling
Detektering af uanmeldte måltider
IOB Kurve Peak-Tid
Spidstidspunkt [min]
+ Top
Free-Peak Oref
Rapid-Acting Oref
Ultra-Rapid Oref
@@ -589,6 +593,7 @@
Denne værdi kaldes Max IOB i OpenAPS kontekst\nOpenAPS vil ikke tilføje mere insulin, hvis den aktuelle IOB er større end denne værdi
Måltid max absorptionstid [h]
Tid hvor ethvert måltid betragtes som absorberet. Resterende kulhydrater vil blive afskåret.
+ BS værdi under hvilken insulin er suspenderet. Standard værdi bruger standard målmodel. Bruger kan indstille værdi mellem 60 mg/dl (3,3 mmol/l) og 100 mg/dl (5,5 mmol/l). Værdier under 65/3,6 resulterer i brug af standardmodel
Vis notefelt i behandlingsdialoger
Næste
Forrige
@@ -601,7 +606,11 @@
Anden kulhydratstigning
Tredje kulhydratstigning
CGM
+ Brug mobilforbindelse
+ Brug Wi-Fi-forbindelse
WiFi SSID
+ Under opladning
+ På batteri
Indstillinger for forbindelse
Tilladte SSID\'er (semikolon separeret)
Tillad forbindelse i roaming
@@ -636,7 +645,6 @@
Applikationen mangler system vindues tilladelse til notifikationer
Applikationen mangler lokations tilladelse til BT scanning og WIFI identifikation
Applikationen mangler lagerstyrings tilladelse for at gemme logfiler og exporteringsindstillinger
- Applikationen kræver tilladelse til bluetooth
Anmod
Åbn navigation
Luk navigation
@@ -657,7 +665,6 @@
Når der påvises resistens, sænkes målglukosen
Følsomhed hæver midlertidige mål
Når der påvises følsomhed, skal målglukosen hæves
- Ren AndroidAPS startet
Vis ugyldige
Skjul ugyldige
Fjern elementer
@@ -676,6 +683,8 @@
En behandling (insulin: %1$.2f, kulhydrater: %2$d, kl: %3$s) kunne ikke tilføjes til behandlinger. Tjek og tilføj venligst en note manuelt efter behov.
eCarbs: %1$d g (%2$d h), forsinkelse: %3$d m
Ingen tilgængelige autosens data
+ Logfiler
+ Diverse
Log indstillinger
Nulstil til standardindstillinger
NSClient funktionsfejl. Overvej NS og NSClient genstart.
@@ -768,6 +777,11 @@
Ugyldig angivelse af %
Gennemsnit
Tid i målområde
+ Dags TIR
+ Nat TIR
+ Detaljerede 14 dage
+ SD: %1$s
+ HbA1c:
Aktivitetsovervågning
Ønsker du at nulstille aktivitetsstatistik?
Statistikker
@@ -954,6 +968,7 @@
Max-BS udenfor området!
Midlertidigt mål:\nMin: %1$s\nMax: %2$s\nVarighed: %3$s
Midlertigt mål:\nMål: %1$s\nVarighed: %2$s
+ Midlertigt mål:\nGrund: %1$s\nMål: %2$s\nVarighed: %3$s
Hurtigguide: %1$s\nInsulin: %2$.2fE\nKH: %3$dg
Guide:\nInsulin: %1$.2fE\nKH: %2$dg
Vis post på enhed:
@@ -962,9 +977,11 @@
Ingen aktiv profil angivet!
Ukendt COB! BG læsning mangler eller nylig app genstart?
KH begrænsninger overtrådt!
+ Beregner (IC: %1$.1f, ISF: %2$.1f)
Kulhydrater: %1$.2fE
COB: %1$.0fg %2$.2fE
BS: %1$.2fE
+ IOB: %1$.2fE
Superbolus: %1$.2fE
15\' trend: %1$.2fE
Procent: %1$.2fE x %2$d%% ≈ %3$.2fE
@@ -991,6 +1008,10 @@
%1$d valgt
Sortér
Dialog annulleret
+ Meget lav
+ Lav
+ Høj
+ Meget høj
Under
Inden for området
Over
@@ -999,6 +1020,12 @@
AndroidAPS widget
Indstil gennemsigtighed
Loop status
+ Graf skala
+ Profil 1
+ Profil 2
+ Log ind
+ Fjern alle
+ Nulstil start
QR-kode til opsætning af engangs kodeord
Åbn indstillinger
indstil KH alarm
@@ -1008,8 +1035,12 @@
kun på ur
kun på telefon
træk og slip håndtering
+ Søg
GlucoRx Aidex
Aidex
Modtag BG-værdier fra GlucoRx Aidex CGMS.
+ Blokeret af opladningsmuligheder
+ Blokeret af forbindelsesmuligheder
+ (Intet ur forbundet)
diff --git a/app/src/main/res/values-de-rDE/exam.xml b/app/src/main/res/values-de-rDE/exam.xml
index 6b25674a29..224325bbe7 100644
--- a/app/src/main/res/values-de-rDE/exam.xml
+++ b/app/src/main/res/values-de-rDE/exam.xml
@@ -104,9 +104,11 @@
Wo kannst Du nach Hilfe für AndroidAPS suchen?
Du kannst in der AndroidAPS-Facebook-Gruppe um Rat bitten.
Du solltest die AndroidAPS-Dokumentation lesen (und wiederholt lesen).
+ Im Discord Channel AndroidAPS kannst Du bei technischen Problemen oder Fragestellungen um Hilfe bitten.
Du solltest Deine Diabetesklinik / Deinen Diabetologen fragen.
https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Installing-AndroidAPS/Update-to-new-version.html#problembehandlung
https://www.facebook.com/groups/loopedDE/
+ https://discord.gg/4fQUWHZ4Mw
Insulin-Plugins
Welches Insulin kann mit dem Ultra-Rapid-Oref-Plugin verwendet werden?
Fiasp®
@@ -121,6 +123,7 @@
Das Protokollieren eines Kanülenwechsels setzt das Autosens Verhältnis wieder auf 100% zurück.
Einige der Plugin-Optionen haben konfigurierbare Zeiträume, die vom Benutzer eingestellt werden können.
https://androidaps.readthedocs.io/en/latest/CROWDIN/de/Configuration/Sensitivity-detection-and-COB.html
+ https://androidaps.readthedocs.io/de/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens
Fehler bei der KH-Eingabe
Was sollst Du tun, wenn Du einen falschen KH-Eintrag gemacht hast?
Lösche die falsche Eingabe in der Behandlung und gib den richtigen neuen Kohlehydratwert ein.
@@ -133,6 +136,19 @@
Vergleiche die Werte der Historie in AAPS und Deiner Pumpe (wenn die Pumpe diese Funktion bietet).
Gib einen Teil-Bolus des \'nicht erhaltenen\' Insulins mit Spritze / Pen oder durch Befüllen der Kanüle.
Unternimm nichts und lass AndroidAPS die entstehenden hohen Glukosewerte korrigieren.
+ KH an Board (COB)
+ Wie beeinflusst das Ändern des ISF-Wertes die COB-Berechnung?
+ Steigende ISF absorbiert Kohlenhydrate länger
+ Steigende ISF absorbiert Kohlenhydrate kürzer
+ Steigende ISF verändert die Dauer für die Kohlenhydrataufnahme nicht
+ Wie beeinflusst das Ändern des ISF-Wertes die COB-Berechnung?
+ Steigende IC absorbiert Kohlenhydrate länger
+ Steigende IC absorbiert Kohlenhydrate kürzer
+ Steigende IC verändert die Zeit für die Kohlenhydrataufnahme nicht
+ Wie beeinflusst die Änderung des Profil-Prozentsatzes die COB-Berechnung?
+ Die Einstellung des Profils auf 150% verlängert die Zeit für Kohlenhydrataufnahme
+ Die Einstellung des Profils auf 150% verkürzt die Zeit für Kohlenhydrataufnahme
+ Die Einstellung des Profils auf 150% verändert die Zeit für die Kohlenhydrataufnahme nicht
Aktives Insulin (IOB)
IOB wird von den abgegebenen temporären Basalraten beeinflusst.
Eine hohe temporäre Basalrate wird nicht abgegeben, wenn der BZ unterhalb des Zielwerts liegt.
diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml
index 0ccb861169..a5a1293fa4 100644
--- a/app/src/main/res/values-de-rDE/strings.xml
+++ b/app/src/main/res/values-de-rDE/strings.xml
@@ -6,6 +6,7 @@
Sicherheitseinstellungen der Behandlungen
Max. erlaubter Bolus [IE]
Max. erlaubte Kohlenhydrate [g]
+ BG-Pegel, unterhalb dessen die Aussetzung wegen niedriger Glukoseaussetzung eintritt
%1$s-Einstellungen
Einstellungen
Behandlungen von NS aktualisieren
@@ -25,6 +26,7 @@
Synchronisiert deine Daten mit Nightscout
Stand des Algorithmus in 2017
Der aktuellste Algorithmus für erfahrene Nutzer
+ Neuester Algorithmus für fortgeschrittene Benutzer mit dynamischer/automatischer ISF
Zeigt den aktuellen Status deines Loops und Schaltflächen für die geläufigsten Aktionen an
Zeigt eine fortlaufende Benachrichtigung mit einer kurzen Übersicht darüber, was dein Loop derzeit tut
Definiere ein Profil, was auch offline verfügbar ist.
@@ -264,6 +266,7 @@
KONF
LOOP
OAPS
+ DYNISF
LP
HOME
VP
@@ -430,12 +433,15 @@
Aktiviere lokale Broadcasts
OpenAPS SMB
Dynamischer ISF
+ DynamicISF Anpassungsfaktor %
+ Anpassungsfaktor für DynamicISF. Stelle mehr als 100 % für aggressivere Korrekturdosen ein, und weniger als 100 % für weniger aggressive Korrekturen.
Aktiviere UAM
Aktiviere SMB
Benutze Super-Mikro-Boli anstelle von temporären Basalraten, um eine schnellere Wirkung zu erreichen.
Erkennung von unangekündigten Mahlzeiten
Wirkungshoch der IOB-Kurve
Wirkungshoch [min]
+ Gipfel
Free-Peak Oref
Rapid-Acting Oref
Ultra-Rapid Oref
@@ -497,6 +503,7 @@
Nur negative
COB Berechnung
Temporäres Ziel Berechnung
+ Prozentuale Berechnung
Loop aktiviert
APS ausgewählt
Nightscout-Client hat Schreibrechte
@@ -586,6 +593,7 @@
Diesen Wert nennt OpenAPS MaxIOB.\nSolange dieser Wert überschritten wird, wird AndroidAPS kein Insulin abgeben.
Maximale Dauer der Essens-Resorption [h]
Zeit, nach der jede Mahlzeit mit Sicherheit absorbiert ist. Verbleibende Kohlenhydrate werden danach nicht mehr berücksichtigt.
+ Der BG-Wert, unter dem die Insulinzuführung ausgesetzt wird. Der Standardwert verwendet das Standard-Zielmodell. Der Benutzer kann einen Wert zwischen 60mg/dl (3.3 mmol/l) und 100mg/dl (5.5mmol/l) setzen. Werte unterhalb 65/3.6 führen zur Verwendung des Standardmodells
Zeige Feld für Notizen in den Behandlungsdialogen
Weiter
Zurück
@@ -598,7 +606,11 @@
Zweite KH-Erhöhung
Dritte KH-Erhöhung
CGM
+ Mobilfunkverbindung verwenden
+ WLAN Verbindung verwenden
WLAN SSID
+ Während des Ladevorgangs
+ Bei Batteriebetrieb
Verbindungs-Einstellungen
Erlaubte SSIDs (durch Semikolon getrennt)
Erlaube Verbindung bei Roaming
@@ -633,7 +645,6 @@
Die App benötigt die Systemberechtigung für App-Benachrichtigungen
Die App benötigt die Berechtigung für den Standort, um Bluetooth und WLAN nutzen zu können
Die App benötigt Zugriffsrechte für den Speicher um Log-Dateien zu sichern und die Einstellungen zu exportieren.
- App benötigt Bluetooth-Berechtigung
Anfordern
Menü öffnen
Menü schließen
@@ -654,8 +665,10 @@
Wenn Resistenz festgestellt wird, senke den Glukose-Zielwert
Empfindlichkeit erhöht den Zielwert
Wenn eine höhere Empfindlichkeit festgestellt wird, wird der Glukose-Zielwert erhöht.
- \"AndroidAPS gestartet\" Ereignisse löschen
+ Zeige Ungültige
+ Verstecke Ungültige
Objekte entfernen
+ Einträge sortieren
Gespeicherte Einstellungen gefunden
WARNUNG: Wenn Du eine echte Pumpe aktivierst und anschließt, kopiert AndroidAPS die Basaleinstellungen vom aktiven Profil zur Pumpe (und behält sie bei). Die Einstellungen in der Pumpe werden hierbei überschrieben. Wenn Du Dir nicht sicher bist oder die Basaleinstellungen in der Pumpe nicht überschreiben möchten, drücke \"Abbrechen\" und vollziehe den Wechsel zur Pumpe später.
Behandlungsdaten unvollständig
@@ -670,6 +683,8 @@
Der Eintrag (Insulin: %1$.2f, Kohlenhydrate: %2$d, um: %3$s) konnte nicht als Behandlung gespeichert werden. Bitte überprüfe die aktuelle Liste und füge, falls notwendig, den Datensatz manuell hinzu.
eCarbs: %1$d g (%2$d h), Verzögerung: %3$d m
Keine Autosens-Daten verfügbar
+ Log Dateien
+ Verschiedenes
Log-Einstellungen
Auf Standardwerte zurücksetzen
NSClient Störung. Ziehe einen Neustart von NS und NSClient in Betracht.
@@ -763,6 +778,11 @@ Unerwartetes Verhalten.
Ungültige % Eingabe
Durchschnitt
TIR
+ Tages TIR
+ Nacht TIR
+ Detaillierte 14 Tage
+ SD: %1$s
+ HbA1c:
Aktivitätsmonitor
Willst Du die Aktivitätsstatistik zurücksetzen?
Statistiken
@@ -803,6 +823,7 @@ Unerwartetes Verhalten.
Installiere auf jedem Follower-Phone eine Authenticator-App, die RFC 6238 TOTP-Token unterstützt. Beliebte kostenlose Apps sind:\n Authy\n Google Authenticator\n LastPass Authenticator\n FreeOTP Authenticator
Wenn Du den Authentifikator zurücksetzt werden alle bestehenden Authentifikatoren ungültig. Du musst sie dann neu einrichten!
Predictions (Vorhersagen)
+ Behandlungen
Steigung der Abweichung
Autorisierung fehlgeschlagen
Gesamtinsulin
@@ -872,6 +893,8 @@ Unerwartetes Verhalten.
Profilwechsel akzeptieren, die in NS oder NSClient eingegeben wurden
APS Offline-Ereignisse empfangen
APS Offline-Ereignisse akzeptieren, die über NS oder NSClient eingegeben wurden
+ TBR und EB empfangen
+ Akzeptiere TBR und EB, die von einer anderen Instanz eingegeben wurden
Insulin abrufen
Insulin akzeptieren, das in NS oder NSClient eingegeben wurden
Kohlenhydrate abrufen
@@ -890,9 +913,11 @@ Unerwartetes Verhalten.
Fehler in ISF-Werten
%s ausführen?
Ungültiges Profil %1$s wurde von NS nicht akzeptiert
+ Ansicht
Fehler
Hochladen verlangsamen
Status BZ-Daten
+ BG-Werte entfernen
Kanülenalter
Alter Patchpumpe
Patch-Pumpe
@@ -930,7 +955,46 @@ Unerwartetes Verhalten.
aktuelles Profil löschen
neu zur Liste hinzufügen
+ Wähle das dunkle, helle oder das Systemdesign
+ App Farbschema
+ Dunkles Design
+ Helles Design
+ Systemdesign verwenden
+ Temp-Target unbekannte Voreinstellung: %1$s
+ Ausführung des Temp-Targets abbrechen?
+ Verschiedene Einheiten werden auf Uhr und Telefon verwendet!
+ Zero-Temp-Target - abbrechen des laufenden Temp-Targets?
+ Min-BG ist außerhalb des Bereichs!
+ Max-BG ist außerhalb des Bereichs!
+ Temptarget:\nMin: %1$s\nMax: %2$s\nDauer: %3$s
+ Temptarget:\nTarget: %1$s\nDauer: %2$s
+ Temp-Target:\nGrund: %1$s\nTarget: %2$s\nDauer: %3$s
+ QuickWizard: %1$s\nInsulin: %2$.2fU\nCarbs: %3$dg
+ Calc. Wizard:\nInsulin: %1$.2fU\nCarbs: %2$dg
+ Zeige Eintrag auf dem Gerät:
+ Ausgewählter Quickwizard nicht mehr verfügbar, bitte aktualisiere die Kachel
+ Kein aktueller BG liegt als Basis zur Berechnung vor!
+ Kein aktives Profil gesetzt!
+ Unbekannter COB! BG-Wert fehlt oder wurde App vor kurzem neu gestartet?
+ Die Kohlenhydrateinschränkung wurde überschritten!
+ Calc (IC: %1$.1f, ISF: %2$.1f)
+ Kohlenhydrate: %1$.2fU
+ COB: %1$.0fg %2$.2fU
+ BZ: %1$.2fU
+ IOB: %1$.2fU
+ Superbolus: %1$.2fU
+ 15\' Trend: %1$.2fU
+ Prozent: %1$.2fU x %2$d%% ≈ %3$.2fU
+ Verletzung der Bolusbeschränkung!\nKann %1$.2fU nicht abgeben
+ TempT: %1$s
+ %1$s zu %2$s
+ Keine Pumpe verfügbar!
+ Unbekannter Actionbefehl:
+ Prozentsatz
+ Standardwert der Anwendung
+ Zeige ungültige / gelöschte Einträge
+ Verberge ungültige / gelöschte Einträge
Profil zum Bearbeiten auswählen
Aktualisiere von Nightscout
Ausgewähltes Objekt löschen
@@ -939,8 +1003,47 @@ Unerwartetes Verhalten.
Temporäre Ziele
Kohlenhydrate & Bolus
Sind Sie sicher, dass Sie diese(s) %1$d Element(e) löschen möchten?
+ Keine Datensätze verfügbar
+ Verberge Loop
+ Zeige Loop an
%1$d ausgewählt
Sortieren
+ Dialog abgebrochen
+ Sehr niedrig
+ Niedrig
+ Hoch
+ Sehr hoch
+ Unter
+ Im Zielbereich
+ Über
+ Zeige Loop Datensätze
+ Verberge Loop Datensätze
+ AndroidAPS Widget
+ Deckkraft konfigurieren
+ Loop Status
+ Diagrammskala
+ Profil 1
+ Profil 2
Login
+ Alle entfernen
+ Start zurücksetzen
+ QR Code für einmaliges Passwort einrichten
+ Einstellungen öffnen
+ setze Alarm für KH Timer
+ Alle
+ Smartphone
+ Smartwatch
+ nur auf Uhr
+ nur auf Telefon
+ Drag and Drop Handle
+ Suche
+ GlucoRx Aidex
+ Aidex
+ Erhalte BG-Werte von GlucoRx Aidex CGMS.
+ Blockiert durch Ladeoptionen
+ Blockiert durch Verbindungsoptionen
+ (keine Uhr verbunden)
+ Fehler beim Anfordern der Erlaubnis
+ Empfindlichkeit und BZ anpassen
diff --git a/app/src/main/res/values-el-rGR/strings.xml b/app/src/main/res/values-el-rGR/strings.xml
index f7514986ed..da7295dcea 100644
--- a/app/src/main/res/values-el-rGR/strings.xml
+++ b/app/src/main/res/values-el-rGR/strings.xml
@@ -502,7 +502,6 @@
= 100]]>
Ο χαμηλός προσωρινός στόχος μειώνει την ευαισθησία
- Ξεκίνησε το AndroidAPS καθαρό
Βρέθηκαν αποθηκευμένες ρυθμίσεις
Προσοχή: Εάν ενεργοποιήσετε και συνδεθείτε με μια αντλία, το AndroidAPS θα αντιγράψει τις ρυθμίσεις βασικού από το προφίλ στην αντλία, αντικαθιστώντας τον υπάρχων βασικό ρυθμό της αντλίας. Βεβαιωθείτε ότι έχετε τον σωστό βασικό ρυθμό στο AndroidAPS. Εάν δεν είστε βέβαιοι ή δεν θέλετε να αντικαταστήσετε τον βασικό ρυθμό στην αντλία σας, πατήστε Άκυρο και επαναλάβετε εναλλαγή προς την αντλία σε μεταγενέστερο χρόνο.
Ελλιπή δεδομένα θεραπείας
diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml
index d8e5d59e56..e8f55b0a79 100644
--- a/app/src/main/res/values-es-rES/strings.xml
+++ b/app/src/main/res/values-es-rES/strings.xml
@@ -645,7 +645,6 @@
La aplicación necesita permisos del sistema para poder mostrarse sobre otras aplicaciones, para las notificaciones
La aplicación necesita permiso de ubicación para poder buscar dispositivos Bluetooth y redes WiFi
La aplicación necesita permiso de almacenamiento para poder almacenar archivos de registro y valores de exportación
- La aplicación necesita permiso de bluetooth
Solicitar
Abrir navegación
Cerrar navegación
@@ -666,7 +665,7 @@
Cuando se detecta resistencia a la insulina, disminuye el objetivo de glucosa
Sensibilidad aumenta el objetivo
Cuando se detecta sensibilidad a la insulina, aumenta el objetivo de glucosa
- Comenzar la limpieza de AndroidAPS
+ Eliminar registros de inicio de AAPS
Mostrar invalidados
Ocultar invalidados
Eliminar elementos
@@ -1045,4 +1044,6 @@
Bloqueado por opciones de carga
Bloqueado por opciones de conectividad
(Ningún reloj conectado)
+ Error al solicitar permisos
+ Ajustar sensibilidad y glucosa
diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml
index 5988390a0d..a166f7fd52 100644
--- a/app/src/main/res/values-fr-rFR/strings.xml
+++ b/app/src/main/res/values-fr-rFR/strings.xml
@@ -646,7 +646,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
L\'application a besoin de l\'autorisation d\'accès à la fenêtre système pour les notifications
L\'application a besoin de l\'autorisation de localisation pour l\'analyse BT et l\'identification WiFi
L\'application a besoin d\'une autorisation de stockage pour pouvoir stocker les fichiers journaux et les paramètres d\'exportation
- L\'application a besoin de l\'autorisation Bluetooth
Demande
Ouvrir navigation
Fermer navigation
@@ -667,7 +666,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Quand une résistance est détectée, baisse de la glycémie cible
Sensibilité augmente la cible
Quand une sensibilité est détectée, augmentation de la glycémie cible
- Réinitialiser AndroidAPS
+ Suppr. entrées \"Démarrage AAPS\"
Montrer les entrées invalides
Masquer les entrées invalides
Supprimer des entrées
@@ -1045,4 +1044,6 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
Bloqué par les options de recharge
Bloqué par les options de connectivité
(Pas de montre connectée)
+ Erreur lors de la demande des autorisations
+ Ajuster la sensibilité et la glycémie
diff --git a/app/src/main/res/values-ga-rIE/strings.xml b/app/src/main/res/values-ga-rIE/strings.xml
index 115e43452f..b73615f8f0 100644
--- a/app/src/main/res/values-ga-rIE/strings.xml
+++ b/app/src/main/res/values-ga-rIE/strings.xml
@@ -3,184 +3,6 @@
- %1$s Sainroghanna
- Sainroghanna
- An bhfuil tú cinnte gur mian leat an bhunachair sonraí a athshocrú?
- Scoir
- Luachanna BG a fháil ón 600SeriesAndroidUploader.
- Sonraí a íoslódáil ó Nightscout
- Luachanna BG a fháil ó xDrip+.
- Inslin:
- Carbí:
- IOB:
- IOB:
- Lomlán IOB:
- Fad:
- Cóimheas:
- Ins:
- IOB:
- Lomlán IOB:
- BG
- TT
- Carbí
- Cear
- Reáchtáil anois
- Reáchtáil deiridh
- Glúcóis stádas
- Próifíl
- Toradh
- Toradh: %1$s %2$s
- Deilte
- Deilte:
- Cóireálacha
- Caidéil
- Próifíl
- APS
- Ginearálta
- Srianta
- Lúb
- APS
- Áireamhán
- Bólas:
- Bunaidh:
- Foinse BG
- xDrip+
- APS mód
- Lúb dúnta
- Lúb oscailte
- Lúb díchumasaithe
- Bunaidh IOB
- Eile
- Braiteoir
- Fad
- Glúcóis cineál
- Easpórtáil Socruithe
- Socruithe Easpórtáil chun
- Socruithe Easpórtáil
- Socruithe Iompórtáil
- Iompórtáil
- Sábháil
- Athlódáil próifíl
- Is lúb díchumasaithe
- Is lúb cumasaithe
- Is lúb cumasaithe
- Cealú TBR teip
- Carbí:
- Bailí:
- Cuir
- In eagar
- Cear
- Gníomhartha
- Cnaipe 1
- Cnaipe 2
- Cnaipe 3
- Aonaid:
- Aonaid
- DIA
- BG:
- GF deiridh:
- MM640g
- %1$dnóim ó shin
- OpenAPS AMA
- GNÍ
- LÚB
- OAPS
- BAILE
- WEAR
- SMS
- Próifíl
- Calabrú
- Caidéil ar fionraí
- Feidhmiú
- URL:
- Atosaigh
- Seachadadh anois
- Stádas:
- Othar cineál
- Páiste
- Déagóirí
- Duine fásta
- Ainm cineál
- Glimp
- Lúb ar fionraí
- Ar fionraí (%1$d nóim)
- Fionraí lúb do 1 u
- Fionraí lúb do 2 u
- Fionraí lúb do 3 u
- Fionraí lúb do 10 u
- Dhícheangal Caidéil
- Dhícheangal Caidéil do 15 nóim
- Dhícheangal Caidéil do 30 nóim
- Dhícheangal Caidéil do 1 u
- Dhícheangal Caidéil do 2 u
- Dhícheangal Caidéil do 3 u
- 15 nóim
- 30 nóim
- 1 uair
- 2 uair
- 3 uair
- 10 uair
- Atosú
- Lúb ar fionraí
- Lúb atógáil
- COB
- Fiasp
- INS
- BUN
- GNÍ
- Faoi
- xds
- Braiteoir
- Inslin
- Caidéil ceallraí
- aois:
- Aláraim roghanna
- OpenAPS
- OAPS
- BUN
- OpenAPS SMB
- Rapid-Acting Oref
- Lyumjev
- Céatadán
- Gníomhaíocht fad
- Gníomhaíocht sprioc
- Bia
- g
- kJ
- Lúb cumasaithe
- APS roghnaithe
- Inslin
- Cnaipi
- CGM
- TT
- Catagóir
- Gníomhaíocht
- Bunaidhi
- Bia
- Ar Aghaidh
- Roimhe seo
- CGM
- WiFi SSID
- Socruithe Ginearálta
- Poctech
- Lomlán
- == ∑ %1$s A
- Tomato (MiaoMiao)
- Tomato
- Tidepool
- TDP
- 2u
- %1$s ISF: %2$.1f
- %1$.0fg IC: %2$.1f
- %1$.1fg IC: %2$.1f
- %1$d%%
- nóim
- Ainm Próifíle:
- Aonaid
- DIA
- IC
- ISF
- BG
diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml
index 699936420f..4b4ccb5887 100644
--- a/app/src/main/res/values-it-rIT/strings.xml
+++ b/app/src/main/res/values-it-rIT/strings.xml
@@ -645,7 +645,6 @@
L\'applicazione richiede l\'autorizzazione \"finestra di sistema\" per le notifiche
L\'applicazione richiede l\'accesso alla posizione per la scansione bluetooth e l\'identificazione WiFi
L\'applicazione richiede l\'accesso alla memoria per memorizzare i file di log ed esportare le impostazioni
- L\'applicazione richiede l\'autorizzazione bluetooth
Richiesta
Apri navigazione
Chiudi navigazione
@@ -666,7 +665,6 @@
Quando viene rilevata resistenza, ridurre la glicemia target
La sensibilità aumenta il target
Quando viene rilevata sensibilità, aumentare la glicemia target
- Rimuovi gli eventi \"AndroidAPS avviato\"
Mostra invalidato
Nascondi invalidato
Rimuovi elementi
@@ -1045,4 +1043,6 @@
Bloccato dalle opzioni di ricarica
Bloccato dalle opzioni di connettività
(Nessuno smartwatch connesso)
+ Errore nel richiedere le autorizzazioni
+ Regola sensibilità e BG
diff --git a/app/src/main/res/values-iw-rIL/strings.xml b/app/src/main/res/values-iw-rIL/strings.xml
index a51a33dfee..438fa5b589 100644
--- a/app/src/main/res/values-iw-rIL/strings.xml
+++ b/app/src/main/res/values-iw-rIL/strings.xml
@@ -645,7 +645,6 @@
האפליקציה צריכה הרשאת מערכת של חלונות לצורך התראות
דרושה הרשאת מיקום עבור סריקת בלוטות\' וזיהוי WiFi
דרושה הרשאת אחסון כדי שתוכלו לאחסן קובצי יומן והגדרות יצוא.
- האפליקציה צריכה הרשאה לבלוטות\'
בקשה
פתח ניווט
סגור ניווט
@@ -666,7 +665,8 @@
כשמזוהה תנגודת, הורד את ערך המטרה של הגלוקוז
רגישות מעלה את ערך המטרה
כשמזוהה רגישות, הגדל את ערך המטרה של הגלוקוז
- מחק אירועי \"AndroidAPS Started\"
+ הצג פסולים
+ הסתר פסולים
הסר פריטים
מיין פריטים
נמצאו הגדרות שמורות
@@ -1041,4 +1041,6 @@
חסום ע\"י הגדרות טעינה
חסום ע\"י הגדרות חיבור
(השעון לא מחובר)
+ שגיאה בעת בקשת הרשאות
+ כיוונון הרגישות והסוכר בדם
diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml
index 90652a8a7a..76e284a2c5 100644
--- a/app/src/main/res/values-ko-rKR/strings.xml
+++ b/app/src/main/res/values-ko-rKR/strings.xml
@@ -639,7 +639,6 @@
저항성이 감지되면, 목표 혈당을 낮춥니다.
민감성이 목표 올리기
민감성이 감지되면, 목표 혈당을 높입니다.
- \"AndroidAPS 시작\" 기록 삭제하기
저장된 설정이 있습니다.
주의: 활성화하고 펌프에 연결하게되면, AndroidAPS는 프로파일의 Basal설정을 복사해서 기존에 펌프에 저장되어 있던 Basal설정을 덮어쓰게 될것입니다. AndroidAPS의 Basal설정이 올바른지 반드시 확인하세요. 만약 확실치 않거나 Basal설정을 덮어씌우길 원치않는다면, 취소버튼을 누르고 나중에 다시 연결하세요.
관리 데이터가 불완전합니다
diff --git a/app/src/main/res/values-lt-rLT/strings.xml b/app/src/main/res/values-lt-rLT/strings.xml
index 211286d69f..60086670bb 100644
--- a/app/src/main/res/values-lt-rLT/strings.xml
+++ b/app/src/main/res/values-lt-rLT/strings.xml
@@ -631,7 +631,6 @@
Norint gauti pranešimus, programai reikalingas sisteminio lango leidimas
Programai reikia vietos nustatymo leidimo, kad būtų galima naudoti Bluetooth ir WiFi
Aplikacijai reikia leidimo prieigai prie saugyklos, kad galėtų išsaugoti žurnalo įrašus ir eksportavimo nustatymus
- Programai reikalinga Bluetooth prieigos teisė
Užklausa
Atidaryti meniu
Uždaryti meniu
@@ -652,7 +651,6 @@
Kai nustatoma rezistencija, tikslinė gliukozės vertė sumažinama
Jautrumas didina tikslą
Kai aptinkamas padidėjęs jautrumas insulinui, tikslinis gliukozės lygis padidinamas
- Ištrinti \"AndroidAPS paleista\" įrašus
Rasti išsaugoti nustatymai
Dėmesio: jei aktyvuosite ir prijungsite prie aparatinės pompos, AndroidAPS nukopijuos bazės nustatymus iš profilio į pompą, pakeisdamas esančius nustatymus pompoje. Įsitikinkite, kad turimi bazės nustatymai AndroidAPS yra teisingi. Jei nesate tikri arba nenorite iš naujo keisti bazės nustatymų jūsų pompoje, paspauskite atšaukti ir pakartokite prijungimą prie pompos kitą kartą.
Terapijos duomenys nepilni
@@ -894,6 +892,7 @@
Negalimas
+ Rūšiuoti
Prisijungti
diff --git a/app/src/main/res/values-nl-rNL/strings.xml b/app/src/main/res/values-nl-rNL/strings.xml
index b1beae35b7..d87c17473e 100644
--- a/app/src/main/res/values-nl-rNL/strings.xml
+++ b/app/src/main/res/values-nl-rNL/strings.xml
@@ -645,7 +645,6 @@
Toepassing vereist systeemvenstermachtiging voor meldingen
App heeft locatie toestemming nodig voor Bluetooth scan en WiFi identificatie
Applicatie heeft toestemming nodig om log bestanden op te slaan en instellingen te exporteren
- Applicatie heeft Bluetooth toestemming nodig
Verzoek
Open navigatie
Sluit navigatie
@@ -666,7 +665,6 @@
Wanneer insulineresistentie wordt gedetecteerd, wordt het BG streefdoel verlaagd
Gevoeligheid verhoogt het doel
Wanneer insulinegevoeligheid wordt gedetecteerd, wordt het BG streefdoel verhoogd
- Verwijder AndroidAPS start-meldingen
Toon ongeldig
Verberg ongeldig
Items verwijderen
diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-no-rNO/strings.xml
index 21dbe2cb6a..9641693ebc 100644
--- a/app/src/main/res/values-no-rNO/strings.xml
+++ b/app/src/main/res/values-no-rNO/strings.xml
@@ -645,7 +645,6 @@
App trenger tillatelse til å bruke Varslinger for å vise meldinger
App trenger tilgang til Posisjon for å søke etter Bluetooth og Wifi enheter
App trenger tilgang til Lagring for lagre logg filer og eksportere innstillinger
- Appen trenger bluetooth tillatelse
Forespørsel
Åpne meny
Lukk meny
@@ -666,7 +665,6 @@
Hvis resistens oppdages vil det redusere BS målverdi
Sensitivitet øker BS målverdi
Når systemet oppdager økt insulinsensitivitet, vil BS målverdi økes
- Basis AndroidAPS startet
Vis ugyldige oppføringer
Skjul ugyldige oppføringer
Fjern oppføringer
@@ -1045,4 +1043,6 @@
Blokkert på grunn av ladealternativer
Blokkert på grunn av tilkoblingsalternativer
(Ingen klokke tilkoblet)
+ Feil under spørring etter tillatelser
+ Juster sensitivitet og BS
diff --git a/app/src/main/res/values-pl-rPL/strings.xml b/app/src/main/res/values-pl-rPL/strings.xml
index 716f005083..3b71aea876 100644
--- a/app/src/main/res/values-pl-rPL/strings.xml
+++ b/app/src/main/res/values-pl-rPL/strings.xml
@@ -244,6 +244,7 @@
Oprogramowanie Wear (Smartwatch)
Prześlij ponownie wszystkie dane
Otwórz ustawienia dla Wear
+ Dawka bazowa
Wartość bazy poniżej minimum. Nie ustawiono profilu!
BG:
Ostatnia BG:
@@ -631,7 +632,6 @@
Aplikacja wymaga uprawnienia systemowego okna dla powiadomień
Aplikacja wymaga dostępu do lokalizacji dla zarządzania bluetoothem i identyfikacją Wi-Fi
Aplikacja wymaga zgody na zapis do pamięci, aby móc przechować pliki logów i eksportować ustawienia
- Aplikacja wymaga uprawnienia Bluetooth
Żądanie
Otwórz menu
Zamknij menu
@@ -652,7 +652,6 @@
Po wykryciu oporności obniża się docelowy poziom cukru
Wrażliwość podnosi docelowy poziom glukozy
Po zwiększeniu wrażliwości zwiększ docelowy poziom glukozy
- Wyczyść zdarzenia \"Start AndroidAPS\"
Znaleziono zapisane ustawienia
Uwaga: Jeśli aktywujesz połączenie z pompą inną niż wirtualna, AndroidAPS skopiuje ustawienia bazy do profilu pompy, zastępując istniejące ustawienia w niej zapisane. Upewnij się, że ustawienia bazy w AndroidAPS są poprawne. Jeśli nie jesteś pewien lub nie chcesz nadpisywać podstawowych ustawień pompy, naciśnij przycisk anuluj i połącz ponownie w innym czasie.
Niekompletne dane leczenie
@@ -667,6 +666,7 @@
Leczenie (insulina: %1$.2f, węglowodany: %2$d, czas:%3$s) nie mogą być dodane. Sprawdź i dodaj ręcznie rekord w razie potrzeby.
eWęgle: %1$d g (%2$d h), Opóźnienie: %3$d m
Brak dostępnych danych autosens
+ Log files
Ustawienia logów
Przywróć ustawienia domyślne
Usterka NSClient. Spróbuj zrestartować NS i NSClient.
@@ -748,6 +748,8 @@
Nazwa profilu zawiera kropki.\nTo nie jest obsługiwane przez NS.\nProfil nie zostanie przesyłany do NS.
Dolna wartość zakresu docelowego (tylko do wyświetlania)
Górna wartość zakresu docelowego (tylko do wyświetlania)
+ Czas
+ Waga
ID:
Wyślij
Najczęściej używany profil:
@@ -797,6 +799,7 @@
Na każdym telefonie śledzącym zainstalować aplikację uwierzytelniania obsługującą tokeny TOTP RFC 6238 Popularne darmowe aplikacje:\n • Authy\n • Google Authenticator\n • LastPass Authenticator\n • FreeOTP Authenticator
Resetowanie uwierzytelniania powoduje, że wszystkie już ustawione uwierzytelnienia stają się niepoprawne (przestają działać). Trzeba będzie je jeszcze raz skonfigurować!
Prognozy poziomu
+ Zabiegi
Krzywa odchylenie
Autoryzacja nie powiodła się
Cała insulina
@@ -896,6 +899,7 @@
Usuń wybrane pozycje
Czy na pewno chcesz usunąć %1$d pozycji
+ Brak wpisów
Wybrany %1$d
Sortuj
Zaloguj się
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index fc2d50ec62..52d2a80004 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -552,7 +552,7 @@
SMB não permitido no modo open loop
Alimentos
repor
- Máximo total IOS OpenAPS não pode superar [U]
+ Máximo total de IOB OpenAPS não pode superar [U]
Este valor é chamado de Max IOB em contexto de OpenAPS\nOpenAPS não adicionará mais insulina se o IOB atual for maior que este valor
Tempo máx. absorção refeição [h]
Hora em que qualquer refeição é considerada absorvida. Restantes hidratos de carbono serão cortados.
@@ -616,7 +616,6 @@
Quando a resistência for detectada, diminui o alvo de glicose
Sensibilidade aumenta o alvo
Quando a sensibilidade é detectada, aumenta o alvo glicose
- Limpar AndroidAPS iniciado
Ordenar itens
Configurações encontradas
Atenção: Se conectar à sua bomba física e ativar o perfil, o AndroidAPS irá copiar as definições desse perfil para as definições da bomba, apagando o memorizado na bomba. Por favor verifique que o que preencheu no perfil do app tem os mesmos valores que estão na bomba. Em caso contrário pressione imediatamente cancelar e corrija antes de voltar a ligar à bomba.
diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml
index 1049c0380e..74e3f6421f 100644
--- a/app/src/main/res/values-pt-rPT/strings.xml
+++ b/app/src/main/res/values-pt-rPT/strings.xml
@@ -631,7 +631,6 @@
Aplicação precisa de permissão de janela do sistema para notificações
Aplicação necessita de permissão de localização para pesquisa Bluetooth e identificação Wi-Fi
A aplicação precisa da permissão de armazenamento para poder armazenar ficheiros de registo e exportar definições
- Aplicação precisa de permissão Bluetooth
Pedido
Abrir a navegação
Fechar a navegação
@@ -652,7 +651,6 @@
Quando a resistência for detectada, diminui o alvo de glicose
Sensibilidade aumenta o alvo
Quando a sensibilidade é detectada, aumenta o alvo glicose
- Limpar AndroidAPS iniciado
Definições armazenadas encontradas
Atenção: Se conectar à sua bomba física e activar o perfil, a AndroidAPS irá copiar as definições desse perfil para as definições da bomba, apagando o perfil memorizado na bomba. Por favor verifique se o que preencheu no perfil da app tem os mesmos valores que estão na bomba. Caso contrário pressione imediatamente cancelar e corrija antes de voltar a ligar à bomba.
Dados tratamento incompletos
diff --git a/app/src/main/res/values-ro-rRO/strings.xml b/app/src/main/res/values-ro-rRO/strings.xml
index 2d55df640a..764d305a65 100644
--- a/app/src/main/res/values-ro-rRO/strings.xml
+++ b/app/src/main/res/values-ro-rRO/strings.xml
@@ -631,7 +631,6 @@
Aplicația are nevoie de permisiune la fereastra sistemului pentru a afișa notificări
Aplicația are nevoie sa acceseze locația pentru scanare Bluetooth și identificare WiFi
Aplicația are nevoie de permisiunea de a accesa unitatea de stocare pentru a scrie fișierele registru și pentru a exporta setările
- Aplicația are nevoie de permisiune Bluetooth
Cerință
Afișare navigație
Închidere navigație
@@ -652,7 +651,6 @@
Când e detectata rezistență la insulină, coboară targetul
Sensibilitatea la insulină crește targetul
Când este detectată sensibilitate la insulină, crește targetul
- AndroidAPS pornit curat
Au fost găsite setări stocate
Atenție: Dacă activați și conectați o pompă fizică, AndroidAPS va copia setările bazalelor din profilurile din aplicație în pompă, suprascriindu-le pe cele existente deja în pompă. Asigurați-vă că aveți setările corecte ale bazalelor în AndroidAPS. Dacă aveți dubii sau nu doriți suprascrierea setărilor bazalelor existente în pompă, apăsați butonul de anulare și repetați acțiunea mai târziu.
Date incomplete despre tratament
diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml
index fa3d099a67..0bf687cd4a 100644
--- a/app/src/main/res/values-ru-rRU/strings.xml
+++ b/app/src/main/res/values-ru-rRU/strings.xml
@@ -645,7 +645,6 @@
Приложению требуется разрешение системного окна для уведомлений
Приложению требуется разрешение на доступ к местоположению для сканирования BT и идентификации WiFi
Приложение требует разрешения на доступ к записи в память, чтобы хранить файлы журналов и настройки экспорта
- Приложению требуется разрешение Bluetooth
Запрос
Показать панель навигации
Cкрыть панель навигации
@@ -666,7 +665,7 @@
При обнаружении сопротивляемости целевой уровень гликемии понижается
Чувствительность поднимает цель
При обнаружении чувствительности целевой уровень глюкозы повышается
- AndroidAPS перезапущен
+ Удалить начатые записи AAPS
Показать недействительные
Скрыть недействительные
Удалить элементы
@@ -1044,4 +1043,6 @@
Заблокировано опциями зарядки
Заблокировано настройками подключения
(Часы не подключены)
+ Ошибка при запросе разрешения
+ Настроить чувствительность относительно ГК
diff --git a/app/src/main/res/values-sk-rSK/strings.xml b/app/src/main/res/values-sk-rSK/strings.xml
index c77651b5d5..6fd9a964c7 100644
--- a/app/src/main/res/values-sk-rSK/strings.xml
+++ b/app/src/main/res/values-sk-rSK/strings.xml
@@ -645,7 +645,6 @@
Aplikácia vyžaduje pre oznámenia systémové oprávnenie
Aplikácia vyžaduje oprávnenie polohy, pre vyhľadávanie BT a identifikáciu WiFi
Aby bolo možné nahrávať logy a exportovať nastavenia, je nutné pre aplikáciu povoliť oprávnenie prístupu k úložisku
- Aplikácia vyžaduje povolenie bluetooth
Požiadavka
Otvoriť Menu
Zavrieť Menu
@@ -666,7 +665,7 @@
Ak je zistená rezistancia, znížiť cieľovú hladinu glykémie
Citlivosť zvyšuje cieľ
Ak je zistená vyššia citlivosť, zvýši cieľovú hladinu glykémie
- Vymazať udalosti \"AndroidAPS reštartovaný\"
+ Odstrániť všetky záznamy AAPS spustený
Zobraziť neplatné
Skryť zneplatnené
Odstrániť položky
@@ -1045,4 +1044,6 @@
Zablokované možnosti nabíjania
Zablokované možnosti pripojenia
(Žiadne hodinky nie sú pripojené)
+ Chyba pri žiadosti o oprávnenie
+ Upraviť citlivosť a glykémiu
diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml
index a85a2e4cb2..8a91b5eee2 100644
--- a/app/src/main/res/values-sv-rSE/strings.xml
+++ b/app/src/main/res/values-sv-rSE/strings.xml
@@ -636,7 +636,6 @@ Eversense-appen.
Applikationen behöver förhöjd behörighet för aviseringar
Appen behöver platsåtkomst för bluetooth- och WiFi-identifiering
Applikationen behöver lagringsbehörighet för att kunna lagra loggfiler och exportinställningar
- Applikationen behöver bluetooth-behörighet
Begäran
Öppna menyn
Stäng menyn
@@ -657,7 +656,6 @@ Eversense-appen.
Om systemet upptäcker tillfällig insulinresistens, sänk mål-BG för att på så sätt tillåta mer insulin
Insulinkänslighet höjer mål-BG
Om systemet upptäcker tillfällig insulinkänslighet, höj mål-BG för att på så sätt minska insulindoseringen
- Rensa alla \"AndroidAPS startad\"
Tidigare sparade inställningar hittade
Varning: Om du aktiverar och ansluter en pump, kommer AndroidAPS skriva över pumpens basalprofil med den aktiva profilen i AndroidAPS. Se till att ha rätt inställningar i appen innan du ansluter. Om du är osäker, tryck på Avbryt och anslut pumpen på nytt vid ett senare tillfälle.
Behandlingsdata ofullständigt
diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml
index 12b3ce5b18..a75a61225e 100644
--- a/app/src/main/res/values-tr-rTR/strings.xml
+++ b/app/src/main/res/values-tr-rTR/strings.xml
@@ -646,7 +646,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Uygulama, bildirimler için sistem iznine ihtiyaç duyuyor
Uygulamanın BT taraması ve WiFi tanımlaması için konum iznine ihtiyacı var
Uygulamanın, günlük dosyalarını saklayabilmesi ve ayarları dışa aktarabilmesi için depolama iznine ihtiyacı var
- Uygulama bluetooth iznine ihtiyac duyuyor
İstek
Navigasyonu aç
Navigasyonu kapat
@@ -667,7 +666,7 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Direnç tespit edildiğinde KŞ hedefini düşürün
Duyarlılık hedefi yükseltir
Hassasiyet tespit edildiğinde, KŞ hedefini yükseltin
- Temiz AndroidAPS başladı
+ AAPS tarafından başlatılmış girdileri kaldırın
Geçersiz olanları göster
Geçersiz olanları gizle
Öğeleri kaldır
@@ -1046,4 +1045,6 @@ Aktif Karbonhidratın ne kadar hızlı sindirildiğine ve KŞ\'nin beklenenden d
Şarj seçenekleri tarafından engellendi
Bağlantı seçenekleri tarafından engellendi
(Saat Bağlı Değil)
+ İzin istenirken hata
+ Duyarlılığı ve KŞ\'ni ayarlayın
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 642148ddb4..ef92a77915 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -432,6 +432,7 @@
启用本地广播。
OpenAPS SMB
动态ISF(胰岛素敏感系数)
+ 动态ISF的调整因子。设置100%以上用于更积极的校正,100%以下则不那么积极校正。
启用 UAM
启用微型大剂量
使用微型大剂量代替使用临时基础率,更快的干预
@@ -636,7 +637,6 @@
应用程序需要悬浮窗权限用于发送通知。
应用程序需要定位权限,才能进行蓝牙扫描及WIFI识别。
应用程序需要文件存储权限,才能存储日志文件及导出设置。
- 应用程序需要蓝牙权限。
请求
打开导航栏
关闭导航栏
@@ -657,7 +657,6 @@
当检测到胰岛素抵抗时,降低血糖的目标值。
敏感时提高目标
当检测到胰岛素敏感时,提高血糖的目标值。
- Clean AndroidAPS 启动了
显示无效项
隐藏失效项
删除项目
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 5d784dd1f8..d01d0e0b58 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -28,6 +28,7 @@
- @string/bg_lang
- @string/cs_lang
- @string/de_lang
+ - @string/dk_lang
- @string/fr_lang
- @string/nl_lang
- @string/es_lang
@@ -55,6 +56,7 @@
- bg
- cs
- de
+ - dk
- fr
- nl
- es
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7bc428a968..de4abf23c9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -9,6 +9,7 @@
French
German
+ Danish
Greek
Chinese
@@ -789,7 +790,6 @@
Application needs system window permission for notifications
Application needs location permission for BT scan and WiFi identification
Application needs storage permission to be able store log files and export settings
- Application needs bluetooth permission
Request
Open navigation
Close navigation
@@ -815,7 +815,7 @@
Sensitivity raises target
When sensitivity is detected, raise the target glucose
keep_screen_on
- Clean AndroidAPS started
+ Remove AAPS started entries
Show invalidated
Hide invalidated
Remove items
@@ -1251,6 +1251,8 @@
Blocked by charging options
Blocked by connectivity options
(No Watch Connected)
-
+ Error asking for permissions
+ dynisf_adjust_sensitivity
+ Adjust sensitivity and BG
diff --git a/app/src/main/res/xml/pref_autotune.xml b/app/src/main/res/xml/pref_autotune.xml
index aef72365a0..7cc1d6d488 100644
--- a/app/src/main/res/xml/pref_autotune.xml
+++ b/app/src/main/res/xml/pref_autotune.xml
@@ -1,6 +1,8 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:validate="http://schemas.android.com/apk/res-auto">
+
-->
-
+ android:title="@string/autotune_default_tune_days_title"
+ android:dialogMessage="@string/autotune_default_tune_days_summary"
+ android:digits="0123456789"
+ android:inputType="number"
+ android:selectAllOnFocus="true"
+ android:singleLine="true"
+ validate:maxNumber="30"
+ validate:minNumber="1"
+ validate:testType="numericRange" />
+ android:key="@string/key_adjust_sensitivity"
+ android:title="@string/dynisf_adjust_sensitivity" />
{
- Thread { automationPlugin.processActions() }.start()
- true
- }
-
- ID_MENU_ADD -> {
- add()
- true
- }
-
- ID_MENU_EDIT_MOVE -> {
- actionHelper.startAction()
- true
- }
-
- else -> false
+ else when (item.itemId) {
+ ID_MENU_RUN -> {
+ Thread { automationPlugin.processActions() }.start()
+ true
}
+ ID_MENU_ADD -> {
+ add()
+ true
+ }
+
+ ID_MENU_EDIT_MOVE -> {
+ actionHelper.startAction()
+ true
+ }
+
+ else -> false
+ }
+
@SuppressLint("NotifyDataSetChanged")
@Synchronized
override fun onResume() {
@@ -129,15 +131,11 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
disposable += rxBus
.toObservable(EventAutomationUpdateGui::class.java)
.observeOn(aapsSchedulers.main)
- .subscribe({
- updateGui()
- }, fabricPrivacy::logException)
+ .subscribe({ updateGui() }, fabricPrivacy::logException)
disposable += rxBus
.toObservable(EventAutomationDataChanged::class.java)
.observeOn(aapsSchedulers.main)
- .subscribe({
- eventListAdapter.notifyDataSetChanged()
- }, fabricPrivacy::logException)
+ .subscribe({ eventListAdapter.notifyDataSetChanged() }, fabricPrivacy::logException)
updateGui()
}
diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDevice.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDevice.kt
index bb0c3848f1..81d22fecf9 100644
--- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDevice.kt
+++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/triggers/TriggerBTDevice.kt
@@ -1,8 +1,12 @@
package info.nightscout.androidaps.plugins.general.automation.triggers
+import android.Manifest
import android.bluetooth.BluetoothManager
import android.content.Context
+import android.content.pm.PackageManager
+import android.os.Build
import android.widget.LinearLayout
+import androidx.core.app.ActivityCompat
import com.google.common.base.Optional
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.automation.R
@@ -13,9 +17,9 @@ import info.nightscout.androidaps.plugins.general.automation.elements.InputDropd
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder
import info.nightscout.androidaps.plugins.general.automation.elements.StaticLabel
import info.nightscout.androidaps.utils.JsonHelper
+import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.shared.logging.LTag
import org.json.JSONObject
-import java.util.*
import javax.inject.Inject
class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
@@ -74,12 +78,16 @@ class TriggerBTDevice(injector: HasAndroidInjector) : Trigger(injector) {
// Get the list of paired BT devices to use in dropdown menu
private fun devicesPaired(): ArrayList {
val s = ArrayList()
- (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.bondedDevices?.forEach { s.add(it.name) }
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S || ActivityCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED) {
+ (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.bondedDevices?.forEach { s.add(it.name) }
+ } else {
+ ToastUtils.errorToast(context, context.getString(R.string.needconnectpermission))
+ }
return s
}
private fun eventExists(): Boolean {
- automationPlugin.btConnects.forEach {
+ ArrayList(automationPlugin.btConnects).forEach {
if (btDevice.value == it.deviceName) {
if (comparator.value == ComparatorConnect.Compare.ON_CONNECT && it.state == EventBTChange.Change.CONNECT) return true
if (comparator.value == ComparatorConnect.Compare.ON_DISCONNECT && it.state == EventBTChange.Change.DISCONNECT) return true
diff --git a/automation/src/main/res/values-da-rDK/strings.xml b/automation/src/main/res/values-da-rDK/strings.xml
index 9e3bf9669b..59f99c5877 100644
--- a/automation/src/main/res/values-da-rDK/strings.xml
+++ b/automation/src/main/res/values-da-rDK/strings.xml
@@ -123,4 +123,5 @@
Kør automatisering
Tilføj regel
Fjern/sorter
+ Stop afvikling
diff --git a/automation/src/main/res/values-de-rDE/strings.xml b/automation/src/main/res/values-de-rDE/strings.xml
index 4fdf548bc7..c6e3b2bc69 100644
--- a/automation/src/main/res/values-de-rDE/strings.xml
+++ b/automation/src/main/res/values-de-rDE/strings.xml
@@ -113,5 +113,15 @@
Automatisierungs-Ereignis
Umsortieren
Benutzeraktion
+ Automatisierung entfernen
+ Automation-Regeln sortieren
+ Ausgewähltes Objekt löschen
+ %1$d ausgewählt
Sind Sie sicher, dass Sie diese(s) %1$d Element(e) löschen möchten?
+ Sortieren
+ System-Automatisierung
+ Automatisierungen ausführen
+ Regel hinzufügen
+ Entfernen/sortieren
+ Verarbeitung beenden
diff --git a/automation/src/main/res/values-ga-rIE/strings.xml b/automation/src/main/res/values-ga-rIE/strings.xml
index 464cd30486..3ea04e700d 100644
--- a/automation/src/main/res/values-ga-rIE/strings.xml
+++ b/automation/src/main/res/values-ga-rIE/strings.xml
@@ -1,18 +1,2 @@
-
- Aláram: %1$s
- Fionraí lúb do %1$d nóim
- IOB %1$s %2$.1f
- Agus
- Nó
- Deilte
- %1$s %2$s
- CUIR
- WiFi SSID %1$s %2$s
- %3$s %1$s %2$s
- Glúcóis [%1$s]:
- COB %1$s %2$.0f
- IOB [U]:
- Riamh
- Gníomh:
-
+
diff --git a/automation/src/main/res/values-iw-rIL/strings.xml b/automation/src/main/res/values-iw-rIL/strings.xml
index 8dd19a3a32..48ca09ada2 100644
--- a/automation/src/main/res/values-iw-rIL/strings.xml
+++ b/automation/src/main/res/values-iw-rIL/strings.xml
@@ -123,4 +123,5 @@
הפעל אוטומציות
הוספת כלל
הסרה\\סידור
+ עצור עיבוד
diff --git a/automation/src/main/res/values-lt-rLT/strings.xml b/automation/src/main/res/values-lt-rLT/strings.xml
index acd9f4fba0..c4d36915e2 100644
--- a/automation/src/main/res/values-lt-rLT/strings.xml
+++ b/automation/src/main/res/values-lt-rLT/strings.xml
@@ -112,4 +112,5 @@
Automatizuotas įvykis
Pertvarkyti
Vartotojo veiksmas
+ Rūšiuoti
diff --git a/automation/src/main/res/values-ru-rRU/strings.xml b/automation/src/main/res/values-ru-rRU/strings.xml
index d91dd62b17..ec29696bf0 100644
--- a/automation/src/main/res/values-ru-rRU/strings.xml
+++ b/automation/src/main/res/values-ru-rRU/strings.xml
@@ -90,7 +90,7 @@
Широта:
Долгота:
Гк %1$s]:
- Цель %1$d м
+ Цель [%1$s]:
Предыдущий болюс
Время болюса %1$s %2$s мин назад
Активн углеводы
diff --git a/automation/src/main/res/values-sk-rSK/strings.xml b/automation/src/main/res/values-sk-rSK/strings.xml
index 39a1502bc1..13e9c9d977 100644
--- a/automation/src/main/res/values-sk-rSK/strings.xml
+++ b/automation/src/main/res/values-sk-rSK/strings.xml
@@ -123,4 +123,5 @@
Spustiť automatizácie
Pridať pravidlo
Odstrániť/zoradiť
+ Zastaviť spracovanie
diff --git a/build.gradle b/build.gradle
index f7900a8fb6..cc611b52b7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,14 +7,14 @@ buildscript {
rxjava_version = '3.1.5'
rxandroid_version = '3.0.0'
rxkotlin_version = '3.0.1'
- room_version = '2.4.2'
- lifecycle_version = '2.5.0'
- dagger_version = '2.42'
+ room_version = '2.4.3'
+ lifecycle_version = '2.5.1'
+ dagger_version = '2.43'
coroutines_version = '1.6.4'
activity_version = '1.4.0'
fragmentktx_version = '1.4.1'
ormLite_version = '4.46'
- gson_version = '2.9.0'
+ gson_version = '2.9.1'
nav_version = '2.4.2'
appcompat_version = '1.4.2'
material_version = '1.6.1'
@@ -26,7 +26,7 @@ buildscript {
work_version = '2.7.1'
tink_version = '1.5.0'
json_version = '20220320'
- joga_version = '2.10.14'
+ joda_version = '2.11.0.1'
junit_version = '4.13.2'
mockito_version = '4.4.0'
@@ -51,8 +51,8 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" } // jacoco 0.2
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.2.1'
- classpath 'com.google.gms:google-services:4.3.10'
+ classpath 'com.android.tools.build:gradle:7.2.2'
+ classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
// NOTE: Do not place your application dependencies here; they belong
@@ -67,7 +67,7 @@ buildscript {
plugins {
id "io.gitlab.arturbosch.detekt" version "1.21.0"
- id "org.jlleitschuh.gradle.ktlint" version "10.3.0"
+ id "org.jlleitschuh.gradle.ktlint" version "11.0.0"
id 'org.barfuin.gradle.jacocolog' version '2.0.0'
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}
diff --git a/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java
index ee256dac53..1ecd53ece1 100644
--- a/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java
+++ b/combo/src/main/java/org/monkey/d/ruffy/ruffy/driver/display/Menu.java
@@ -4,6 +4,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
+import androidx.annotation.NonNull;
+
import org.monkey.d.ruffy.ruffy.driver.display.menu.BolusType;
import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuBlink;
import org.monkey.d.ruffy.ruffy.driver.display.menu.MenuDate;
@@ -39,11 +41,11 @@ public class Menu implements Parcelable{
MenuAttribute a = MenuAttribute.valueOf(attr);
Object o = null;
if (Integer.class.toString().equals(clas)) {
- o = new Integer(value);
+ o = Integer.valueOf(value);
} else if (Double.class.toString().equals(clas)) {
- o = new Double(value);
+ o = Double.valueOf(value);
} else if (Boolean.class.toString().equals(clas)) {
- o = new Boolean(value);
+ o = Boolean.valueOf(value);
} else if (MenuDate.class.toString().equals(clas)) {
o = new MenuDate(value);
} else if (MenuTime.class.toString().equals(clas)) {
@@ -70,14 +72,9 @@ public class Menu implements Parcelable{
}
}
- public void setAttribute(MenuAttribute key, Object value)
- {
- attributes.put(key,value);
- }
-
public List attributes()
{
- return new LinkedList(attributes.keySet());
+ return new LinkedList<>(attributes.keySet());
}
public Object getAttribute(MenuAttribute key)
@@ -104,17 +101,11 @@ public class Menu implements Parcelable{
String atr = a.toString();
Object o = attributes.get(a);
- String clas = o.getClass().toString();
- String v = o.toString();
- if(atr != null && o != null && v != null) {
- dest.writeString(atr);
- dest.writeString(clas);
- dest.writeString(v);
- }
- else
- {
- Log.e("Menu","null in write :/");
- }
+ String clas = o != null ? o.getClass().toString() : "null";
+ String v = o != null ? o.toString() : " null";
+ dest.writeString(atr);
+ dest.writeString(clas);
+ dest.writeString(v);
}catch(Exception e)
{
Log.v("MenuOut","error in write",e);
@@ -122,7 +113,7 @@ public class Menu implements Parcelable{
}
}
public static final Parcelable.Creator