Merge branch 'dev' into smb060

This commit is contained in:
Milos Kozak 2018-01-21 13:38:21 +01:00
commit e5ede788ba
38 changed files with 452 additions and 211 deletions

View file

@ -48,7 +48,7 @@ import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin; import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin;
import info.nightscout.androidaps.plugins.ProfileCircadianPercentage.CircadianPercentageProfileFragment; import info.nightscout.androidaps.plugins.ProfileCircadianPercentage.CircadianPercentageProfileFragment;
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfileFragment; import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin;
import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfilePlugin; import info.nightscout.androidaps.plugins.ProfileSimple.SimpleProfilePlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
@ -138,7 +138,7 @@ public class MainApp extends Application {
if (Config.APS) pluginsList.add(OpenAPSSMBPlugin.getPlugin()); if (Config.APS) pluginsList.add(OpenAPSSMBPlugin.getPlugin());
pluginsList.add(NSProfilePlugin.getPlugin()); pluginsList.add(NSProfilePlugin.getPlugin());
if (Config.OTHERPROFILES) pluginsList.add(SimpleProfilePlugin.getPlugin()); if (Config.OTHERPROFILES) pluginsList.add(SimpleProfilePlugin.getPlugin());
if (Config.OTHERPROFILES) pluginsList.add(LocalProfileFragment.getPlugin()); if (Config.OTHERPROFILES) pluginsList.add(LocalProfilePlugin.getPlugin());
if (Config.OTHERPROFILES) if (Config.OTHERPROFILES)
pluginsList.add(CircadianPercentageProfileFragment.getPlugin()); pluginsList.add(CircadianPercentageProfileFragment.getPlugin());
pluginsList.add(TreatmentsPlugin.getPlugin()); pluginsList.add(TreatmentsPlugin.getPlugin());

View file

@ -20,9 +20,9 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.ToastUtils; import info.nightscout.utils.ToastUtils;
@ -48,6 +48,9 @@ public class Profile {
private int percentage = 100; private int percentage = 100;
private int timeshift = 0; private int timeshift = 0;
private boolean isValid = true;
private boolean isValidated = false;
public Profile(JSONObject json, String units) { public Profile(JSONObject json, String units) {
this(json, 100, 0); this(json, 100, 0);
if (this.units == null) { if (this.units == null) {
@ -121,6 +124,8 @@ public class Profile {
} catch (JSONException e) { } catch (JSONException e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.invalidprofile)); ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.invalidprofile));
isValid = false;
isValidated = true;
} }
} }
@ -174,10 +179,6 @@ public class Profile {
} }
double value = o.getDouble("value") * multiplier; double value = o.getDouble("value") * multiplier;
sparse.put(tas, value); sparse.put(tas, value);
if (value == 0) {
Notification notification = new Notification(Notification.ZERO_VALUE_IN_PROFILE, MainApp.sResources.getString(R.string.zerovalueinprofile), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
}
} catch (JSONException e) { } catch (JSONException e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
log.error(json.toString()); log.error(json.toString());
@ -192,6 +193,71 @@ public class Profile {
return sparse; return sparse;
} }
public boolean isValid(String from) {
if (!isValid)
return false;
if (!isValidated) {
if (basal_v == null)
basal_v = convertToSparseArray(basal);
validate(basal_v);
if (isf_v == null)
isf_v = convertToSparseArray(isf);
validate(isf_v);
if (ic_v == null)
ic_v = convertToSparseArray(ic);
validate(ic_v);
if (targetLow_v == null)
targetLow_v = convertToSparseArray(targetLow);
validate(targetLow_v);
if (targetHigh_v == null)
targetHigh_v = convertToSparseArray(targetHigh);
validate(targetHigh_v);
isValidated = true;
}
if (isValid) {
// Check for hours alignment
for (int index = 0; index < basal_v.size(); index++) {
long secondsFromMidnight = basal_v.keyAt(index);
if (secondsFromMidnight % 3600 != 0) {
Notification notification = new Notification(Notification.BASAL_PROFILE_NOT_ALIGNED_TO_HOURS, String.format(MainApp.gs(R.string.basalprofilenotaligned), from), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
}
}
// Check for minimal basal value
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
if (pump != null) {
PumpDescription description = pump.getPumpDescription();
for (int i = 0; i < basal_v.size(); i++) {
if (basal_v.valueAt(i) < description.basalMinimumRate) {
basal_v.setValueAt(i, description.basalMinimumRate);
MainApp.bus().post(new EventNewNotification(new Notification(Notification.MINIMAL_BASAL_VALUE_REPLACED, String.format(MainApp.gs(R.string.minimalbasalvaluereplaced), from), Notification.NORMAL)));
}
}
} else {
// if pump not available (at start)
// do not store converted array
basal_v = null;
}
}
return isValid;
}
private void validate(LongSparseArray array) {
if (array.size() == 0) {
isValid = false;
return;
}
for (int index = 0; index < array.size(); index++) {
if (array.valueAt(index).equals(0d)) {
isValid = false;
return;
}
}
}
private Double getValueToTime(JSONArray array, Integer timeAsSeconds) { private Double getValueToTime(JSONArray array, Integer timeAsSeconds) {
Double lastValue = null; Double lastValue = null;
@ -341,32 +407,6 @@ public class Profile {
public Double getBasal(Integer timeAsSeconds) { public Double getBasal(Integer timeAsSeconds) {
if (basal_v == null) { if (basal_v == null) {
basal_v = convertToSparseArray(basal); basal_v = convertToSparseArray(basal);
for (int index = 0; index < basal_v.size(); index++) {
long secondsFromMidnight = basal_v.keyAt(index);
if (secondsFromMidnight % 3600 != 0) {
Notification notification = new Notification(Notification.BASAL_PROFILE_NOT_ALIGNED_TO_HOURS, MainApp.sResources.getString(R.string.basalprofilenotaligned), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
}
}
// Check for minimal basal value
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
if (pump != null) {
PumpDescription description = pump.getPumpDescription();
for (int i = 0; i < basal_v.size(); i++) {
if (basal_v.valueAt(i) < description.basalMinimumRate) {
basal_v.setValueAt(i, description.basalMinimumRate);
MainApp.bus().post(new EventNewNotification(new Notification(Notification.MINIMAL_BASAL_VALUE_REPLACED, MainApp.sResources.getString(R.string.minimalbasalvaluereplaced), Notification.NORMAL)));
}
}
return getValueToTime(basal_v, timeAsSeconds);
} else {
// if pump not available (at start)
// do not store converted array
Double value = getValueToTime(basal_v, timeAsSeconds);
basal_v = null;
return value;
}
} }
return getValueToTime(basal_v, timeAsSeconds); return getValueToTime(basal_v, timeAsSeconds);
} }

View file

@ -31,7 +31,8 @@ public class ProfileIntervals<T extends Interval> {
public synchronized void add(List<T> list) { public synchronized void add(List<T> list) {
for (T interval : list) { for (T interval : list) {
rawData.put(interval.start(), interval); if (interval.isValid())
rawData.put(interval.start(), interval);
} }
merge(); merge();
} }
@ -62,7 +63,7 @@ public class ProfileIntervals<T extends Interval> {
public synchronized List<T> getReversedList() { public synchronized List<T> getReversedList() {
List<T> list = new ArrayList<>(); List<T> list = new ArrayList<>();
for (int i = rawData.size() -1; i>=0; i--) for (int i = rawData.size() - 1; i >= 0; i--)
list.add(rawData.valueAt(i)); list.add(rawData.valueAt(i));
return list; return list;
} }

View file

@ -69,7 +69,7 @@ public class QuickWizardEntry {
return Profile.secondsFromMidnight() >= validFrom() && Profile.secondsFromMidnight() <= validTo(); return Profile.secondsFromMidnight() >= validFrom() && Profile.secondsFromMidnight() <= validTo();
} }
public BolusWizard doCalc(Profile profile, TempTarget tempTarget, BgReading lastBG) { public BolusWizard doCalc(Profile profile, TempTarget tempTarget, BgReading lastBG, boolean _synchronized) {
BolusWizard wizard = new BolusWizard(); BolusWizard wizard = new BolusWizard();
//BG //BG
@ -80,7 +80,12 @@ public class QuickWizardEntry {
// COB // COB
double cob = 0d; double cob = 0d;
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData(); AutosensData autosensData;
if (_synchronized)
autosensData = IobCobCalculatorPlugin.getLastAutosensDataSynchronized("QuickWizard COB");
else
autosensData = IobCobCalculatorPlugin.getLastAutosensData("QuickWizard COB");
if (autosensData != null && useCOB() == YES) { if (autosensData != null && useCOB() == YES) {
cob = autosensData.cob; cob = autosensData.cob;
} }

View file

@ -51,6 +51,8 @@ import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRNSHistorySync; import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRNSHistorySync;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.PercentageSplitter; import info.nightscout.utils.PercentageSplitter;
public class DatabaseHelper extends OrmLiteSqliteOpenHelper { public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
@ -1685,10 +1687,10 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
if (profile != null) { if (profile != null) {
profileSwitch.profileJson = profile.getData().toString(); profileSwitch.profileJson = profile.getData().toString();
log.debug("Profile switch prefilled with JSON from local store"); log.debug("Profile switch prefilled with JSON from local store");
// Update data in NS
NSUpload.updateProfileSwitch(profileSwitch);
} else { } else {
Notification notification = new Notification(Notification.NO_LOCALE_PROFILE_FOUND, MainApp.sResources.getString(R.string.nolocaleprofilefound), Notification.URGENT); log.debug("JSON for profile switch doesn't exist. Ignoring: " + trJson.toString());
MainApp.bus().post(new EventNewNotification(notification));
log.debug("JSON for profile switch doesn't exist. Ignoring ...");
return; return;
} }
} }

View file

@ -147,6 +147,11 @@ public class ExtendedBolus implements Interval, DataPointWithLabelInterface {
return durationInMinutes == 0; return durationInMinutes == 0;
} }
@Override
public boolean isValid() {
return true;
}
// -------- Interval interface end --------- // -------- Interval interface end ---------
public String log() { public String log() {

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.db; package info.nightscout.androidaps.db;
import android.graphics.Color; import android.graphics.Color;
import android.support.annotation.Nullable;
import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable; import com.j256.ormlite.table.DatabaseTable;
@ -12,10 +13,14 @@ import org.slf4j.LoggerFactory;
import java.util.Objects; import java.util.Objects;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.interfaces.Interval; import info.nightscout.androidaps.interfaces.Interval;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface; import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries; import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin; import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin;
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -56,12 +61,14 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
private Profile profile = null; private Profile profile = null;
@Nullable
public Profile getProfileObject() { public Profile getProfileObject() {
if (profile == null) if (profile == null)
try { try {
profile = new Profile(new JSONObject(profileJson), percentage, timeshift); profile = new Profile(new JSONObject(profileJson), percentage, timeshift);
} catch (JSONException e) { } catch (Exception e) {
log.error("Unhandled exception", e); log.error("Unhandled exception", e);
log.error("Unhandled exception", profileJson);
} }
return profile; return profile;
} }
@ -171,6 +178,20 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
return durationInMinutes == 0; return durationInMinutes == 0;
} }
@Override
public boolean isValid() {
boolean isValid = getProfileObject() != null && getProfileObject().isValid(DateUtil.dateAndTimeString(date));
if (!isValid)
createNotificationInvalidProfile(DateUtil.dateAndTimeString(date));
return isValid;
}
public void createNotificationInvalidProfile(String detail) {
Notification notification = new Notification(Notification.ZERO_VALUE_IN_PROFILE, String.format(MainApp.gs(R.string.zerovalueinprofile), detail), Notification.LOW, 5);
MainApp.bus().post(new EventNewNotification(notification));
}
// -------- Interval interface end --------- // -------- Interval interface end ---------
// ----------------- DataPointInterface -------------------- // ----------------- DataPointInterface --------------------

View file

@ -123,6 +123,11 @@ public class TempTarget implements Interval {
return durationInMinutes == 0; return durationInMinutes == 0;
} }
@Override
public boolean isValid() {
return true;
}
// -------- Interval interface end --------- // -------- Interval interface end ---------
public String lowValueToUnitsToString(String units) { public String lowValueToUnitsToString(String units) {

View file

@ -182,6 +182,11 @@ public class TemporaryBasal implements Interval {
return durationInMinutes == 0; return durationInMinutes == 0;
} }
@Override
public boolean isValid() {
return true;
}
// -------- Interval interface end --------- // -------- Interval interface end ---------
public IobTotal iobCalc(long time) { public IobTotal iobCalc(long time) {

View file

@ -21,4 +21,6 @@ public interface Interval {
boolean isInProgress(); boolean isInProgress();
boolean isEndingEvent(); boolean isEndingEvent();
boolean isValid();
} }

View file

@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.DetailedBolusInfo; import info.nightscout.androidaps.data.DetailedBolusInfo;
@ -780,14 +781,17 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
return "Default"; return "Default";
} }
@Nullable
public Profile getProfile() { public Profile getProfile() {
return getProfile(System.currentTimeMillis()); return getProfile(System.currentTimeMillis());
} }
public String getProfileUnits() { public String getProfileUnits() {
return getProfile().getUnits(); Profile profile = getProfile();
return profile != null ? profile.getUnits() : Constants.MGDL;
} }
@Nullable
public Profile getProfile(long time) { public Profile getProfile(long time) {
if (activeTreatments == null) if (activeTreatments == null)
return null; //app not initialized return null; //app not initialized

View file

@ -598,7 +598,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
} else { } else {
if (time > now) { if (time > now) {
// data may not be calculated yet, use last data // data may not be calculated yet, use last data
return getLastAutosensData(); return getLastAutosensData("getAutosensData");
} }
//log.debug(">>> getAutosensData Cache miss " + new Date(time).toLocaleString()); //log.debug(">>> getAutosensData Cache miss " + new Date(time).toLocaleString());
return null; return null;
@ -607,13 +607,35 @@ public class IobCobCalculatorPlugin implements PluginBase {
} }
@Nullable @Nullable
public static AutosensData getLastAutosensData() { public static AutosensData getLastAutosensDataSynchronized(String reason) {
if (autosensDataTable.size() < 1) synchronized (dataLock) {
return getLastAutosensData(reason);
}
}
@Nullable
public static AutosensData getLastAutosensData(String reason) {
if (autosensDataTable.size() < 1) {
log.debug("AUTOSENSDATA null: autosensDataTable empty (" + reason + ")");
return null; return null;
AutosensData data = autosensDataTable.valueAt(autosensDataTable.size() - 1); }
AutosensData data = null;
try {
data = autosensDataTable.valueAt(autosensDataTable.size() - 1);
} catch (Exception e) {
// data can be processed on the background
// in this rare case better return null and do not block UI
// APS plugin should use getLastAutosensDataSynchronized where the blocking is not an issue
log.debug("AUTOSENSDATA null: Exception catched (" + reason + ")");
return null;
}
if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) { if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
log.debug("AUTOSENSDATA null: data is old (" + reason + ")");
return null; return null;
} else { } else {
if (data == null)
log.debug("AUTOSENSDATA null: data == null (" + " " + reason + ")");
return data; return data;
} }
} }

View file

@ -79,6 +79,11 @@ public class DBAccessReceiver extends BroadcastReceiver {
DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), _id); DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), _id);
UploadQueue.add(dbr); UploadQueue.add(dbr);
} }
} else if (action.equals("dbUpdate")) {
if (shouldUpload()) {
DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), _id, data);
UploadQueue.add(dbr);
}
} else { } else {
DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), data); DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), data);
// this is not used as mongo _id but only for searching in UploadQueue database // this is not used as mongo _id but only for searching in UploadQueue database

View file

@ -55,6 +55,7 @@ import info.nightscout.androidaps.events.EventRefreshOverview;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData; import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin; import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
@ -151,6 +152,18 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
}); });
} }
@Subscribe
public void onStatusEvent(final EventAutosensCalculationFinished e) {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
calculateInsulin();
}
});
}
final private TextWatcher textWatcher = new TextWatcher() { final private TextWatcher textWatcher = new TextWatcher() {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
@ -459,7 +472,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
// COB // COB
Double c_cob = 0d; Double c_cob = 0d;
if (cobCheckbox.isChecked()) { if (cobCheckbox.isChecked()) {
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData(); AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Wizard COB");
if(autosensData != null) { if(autosensData != null) {
c_cob = autosensData.cob; c_cob = autosensData.cob;

View file

@ -639,7 +639,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
final QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive(); final QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive();
if (quickWizardEntry != null && actualBg != null) { if (quickWizardEntry != null && actualBg != null) {
quickWizardButton.setVisibility(View.VISIBLE); quickWizardButton.setVisibility(View.VISIBLE);
final BolusWizard wizard = quickWizardEntry.doCalc(profile, tempTarget, actualBg); final BolusWizard wizard = quickWizardEntry.doCalc(profile, tempTarget, actualBg, true);
final JSONObject boluscalcJSON = new JSONObject(); final JSONObject boluscalcJSON = new JSONObject();
try { try {
@ -1134,7 +1134,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) { if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
quickWizardButton.setVisibility(View.VISIBLE); quickWizardButton.setVisibility(View.VISIBLE);
String text = quickWizardEntry.buttonText() + "\n" + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g"; String text = quickWizardEntry.buttonText() + "\n" + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
BolusWizard wizard = quickWizardEntry.doCalc(profile, tempTarget, lastBG); BolusWizard wizard = quickWizardEntry.doCalc(profile, tempTarget, lastBG, false);
text += " " + DecimalFormatter.to2Decimal(wizard.calculatedTotalInsulin) + "U"; text += " " + DecimalFormatter.to2Decimal(wizard.calculatedTotalInsulin) + "U";
quickWizardButton.setText(text); quickWizardButton.setText(text);
if (wizard.calculatedTotalInsulin <= 0) if (wizard.calculatedTotalInsulin <= 0)
@ -1200,7 +1200,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// cob // cob
if (cobView != null) { // view must not exists if (cobView != null) { // view must not exists
String cobText = ""; String cobText = "";
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData(); AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Overview COB");
if (autosensData != null) if (autosensData != null)
cobText = (int) autosensData.cob + " g"; cobText = (int) autosensData.cob + " g";
cobView.setText(cobText); cobView.setText(cobText);

View file

@ -59,7 +59,6 @@ public class Notification {
public static final int MINIMAL_BASAL_VALUE_REPLACED = 29; public static final int MINIMAL_BASAL_VALUE_REPLACED = 29;
public static final int BASAL_PROFILE_NOT_ALIGNED_TO_HOURS = 30; public static final int BASAL_PROFILE_NOT_ALIGNED_TO_HOURS = 30;
public static final int ZERO_VALUE_IN_PROFILE = 31; public static final int ZERO_VALUE_IN_PROFILE = 31;
public static final int NO_LOCALE_PROFILE_FOUND = 32;
public int id; public int id;
public Date date; public Date date;

View file

@ -11,6 +11,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -22,6 +23,8 @@ import java.text.DecimalFormat;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment; import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
@ -37,12 +40,6 @@ import info.nightscout.utils.TimeListEdit;
public class LocalProfileFragment extends SubscriberFragment { public class LocalProfileFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(LocalProfileFragment.class); private static Logger log = LoggerFactory.getLogger(LocalProfileFragment.class);
private static LocalProfilePlugin localProfilePlugin = new LocalProfilePlugin();
public static LocalProfilePlugin getPlugin() {
return localProfilePlugin;
}
NumberPicker diaView; NumberPicker diaView;
RadioButton mgdlView; RadioButton mgdlView;
RadioButton mmolView; RadioButton mmolView;
@ -51,6 +48,7 @@ public class LocalProfileFragment extends SubscriberFragment {
TimeListEdit basalView; TimeListEdit basalView;
TimeListEdit targetView; TimeListEdit targetView;
Button profileswitchButton; Button profileswitchButton;
TextView invalidProfile;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -59,10 +57,11 @@ public class LocalProfileFragment extends SubscriberFragment {
Runnable save = new Runnable() { Runnable save = new Runnable() {
@Override @Override
public void run() { public void run() {
localProfilePlugin.storeSettings(); LocalProfilePlugin.getPlugin().storeSettings();
if (basalView != null) { if (basalView != null) {
basalView.updateLabel(MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel()); basalView.updateLabel(MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel());
} }
updateGUI();
} }
}; };
@ -80,8 +79,9 @@ public class LocalProfileFragment extends SubscriberFragment {
@Override @Override
public void onTextChanged(CharSequence s, int start, public void onTextChanged(CharSequence s, int start,
int before, int count) { int before, int count) {
localProfilePlugin.dia = SafeParse.stringToDouble(diaView.getText().toString()); LocalProfilePlugin.getPlugin().dia = SafeParse.stringToDouble(diaView.getText().toString());
localProfilePlugin.storeSettings(); LocalProfilePlugin.getPlugin().storeSettings();
updateGUI();
} }
}; };
@ -89,40 +89,39 @@ public class LocalProfileFragment extends SubscriberFragment {
View layout = inflater.inflate(R.layout.localprofile_fragment, container, false); View layout = inflater.inflate(R.layout.localprofile_fragment, container, false);
diaView = (NumberPicker) layout.findViewById(R.id.localprofile_dia); diaView = (NumberPicker) layout.findViewById(R.id.localprofile_dia);
diaView.setParams(localProfilePlugin.dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch); diaView.setParams(LocalProfilePlugin.getPlugin().dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
mgdlView = (RadioButton) layout.findViewById(R.id.localprofile_mgdl); mgdlView = (RadioButton) layout.findViewById(R.id.localprofile_mgdl);
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol); mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save); icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", LocalProfilePlugin.getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save);
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save); isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", LocalProfilePlugin.getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save);
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save); basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), LocalProfilePlugin.getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save);
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", getPlugin().targetLow, getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save); targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", LocalProfilePlugin.getPlugin().targetLow, LocalProfilePlugin.getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch); profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) { if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE); layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE);
} }
updateGUI(); mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
mgdlView.setChecked(localProfilePlugin.mgdl);
mmolView.setChecked(localProfilePlugin.mmol);
mgdlView.setOnClickListener(new View.OnClickListener() { mgdlView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
localProfilePlugin.mgdl = mgdlView.isChecked(); LocalProfilePlugin.getPlugin().mgdl = mgdlView.isChecked();
localProfilePlugin.mmol = !localProfilePlugin.mgdl; LocalProfilePlugin.getPlugin().mmol = !LocalProfilePlugin.getPlugin().mgdl;
mmolView.setChecked(localProfilePlugin.mmol); mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
localProfilePlugin.storeSettings(); LocalProfilePlugin.getPlugin().storeSettings();
} }
}); });
mmolView.setOnClickListener(new View.OnClickListener() { mmolView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
localProfilePlugin.mmol = mmolView.isChecked(); LocalProfilePlugin.getPlugin().mmol = mmolView.isChecked();
localProfilePlugin.mgdl = !localProfilePlugin.mmol; LocalProfilePlugin.getPlugin().mgdl = !LocalProfilePlugin.getPlugin().mmol;
mgdlView.setChecked(localProfilePlugin.mgdl); mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
localProfilePlugin.storeSettings(); LocalProfilePlugin.getPlugin().storeSettings();
} }
}); });
@ -138,7 +137,6 @@ public class LocalProfileFragment extends SubscriberFragment {
}); });
updateGUI();
return layout; return layout;
} catch (Exception e) { } catch (Exception e) {
log.error("Unhandled exception: ", e); log.error("Unhandled exception: ", e);
@ -150,7 +148,11 @@ public class LocalProfileFragment extends SubscriberFragment {
@NonNull @NonNull
public String getSumLabel() { public String getSumLabel() {
return "" + DecimalFormatter.to2Decimal(localProfilePlugin.getProfile().getDefaultProfile().baseBasalSum()) + "U"; ProfileStore profile = LocalProfilePlugin.getPlugin().getProfile();
if (profile != null)
return "" + DecimalFormatter.to2Decimal(profile.getDefaultProfile().baseBasalSum()) + "U";
else
return MainApp.gs(R.string.localprofile);
} }
@Subscribe @Subscribe
@ -165,11 +167,16 @@ public class LocalProfileFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!ConfigBuilderPlugin.getActivePump().isInitialized() || ConfigBuilderPlugin.getActivePump().isSuspended()) { boolean isValid = LocalProfilePlugin.getPlugin().getProfile() != null && LocalProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid(MainApp.gs(R.string.localprofile));
if (!ConfigBuilderPlugin.getActivePump().isInitialized() || ConfigBuilderPlugin.getActivePump().isSuspended() || !isValid) {
profileswitchButton.setVisibility(View.GONE); profileswitchButton.setVisibility(View.GONE);
} else { } else {
profileswitchButton.setVisibility(View.VISIBLE); profileswitchButton.setVisibility(View.VISIBLE);
} }
if (isValid)
invalidProfile.setVisibility(View.GONE);
else
invalidProfile.setVisibility(View.VISIBLE);
} }
}); });
} }

View file

@ -13,9 +13,9 @@ import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
@ -26,6 +26,14 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
public static final String LOCAL_PROFILE = "LocalProfile"; public static final String LOCAL_PROFILE = "LocalProfile";
private static Logger log = LoggerFactory.getLogger(LocalProfilePlugin.class); private static Logger log = LoggerFactory.getLogger(LocalProfilePlugin.class);
private static LocalProfilePlugin localProfilePlugin;
public static LocalProfilePlugin getPlugin() {
if (localProfilePlugin == null)
localProfilePlugin = new LocalProfilePlugin();
return localProfilePlugin;
}
private boolean fragmentEnabled = false; private boolean fragmentEnabled = false;
private boolean fragmentVisible = false; private boolean fragmentVisible = false;
@ -128,7 +136,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
editor.apply(); editor.apply();
createConvertedProfile(); createConvertedProfile();
if (Config.logPrefsChange) if (Config.logPrefsChange)
log.debug("Storing settings: " + getProfile().getData().toString()); log.debug("Storing settings: " + getRawProfile().getData().toString());
} }
public void loadSettings() { public void loadSettings() {
@ -243,6 +251,14 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public ProfileStore getProfile() { public ProfileStore getProfile() {
if (convertedProfile == null)
createConvertedProfile();
if (!convertedProfile.getDefaultProfile().isValid(MainApp.gs(R.string.localprofile)))
return null;
return convertedProfile;
}
public ProfileStore getRawProfile() {
if (convertedProfile == null) if (convertedProfile == null)
createConvertedProfile(); createConvertedProfile();
return convertedProfile; return convertedProfile;

View file

@ -84,30 +84,36 @@ public class NSProfileFragment extends SubscriberFragment implements AdapterView
} }
ProfileStore profileStore = NSProfilePlugin.getPlugin().getProfile(); ProfileStore profileStore = NSProfilePlugin.getPlugin().getProfile();
ArrayList<CharSequence> profileList = profileStore.getProfileList(); if (profileStore != null) {
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(getContext(), ArrayList<CharSequence> profileList = profileStore.getProfileList();
R.layout.spinner_centered, profileList); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(getContext(),
profileSpinner.setAdapter(adapter); R.layout.spinner_centered, profileList);
// set selected to actual profile profileSpinner.setAdapter(adapter);
for (int p = 0; p < profileList.size(); p++) { // set selected to actual profile
if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName())) for (int p = 0; p < profileList.size(); p++) {
profileSpinner.setSelection(p); if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName()))
profileSpinner.setSelection(p);
}
} }
} }
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String name = parent.getItemAtPosition(position).toString(); String name = parent.getItemAtPosition(position).toString();
Profile profile = NSProfilePlugin.getPlugin().getProfile().getSpecificProfile(name); ProfileStore store = NSProfilePlugin.getPlugin().getProfile();
units.setText(profile.getUnits()); if (store != null) {
dia.setText(DecimalFormatter.to2Decimal(profile.getDia()) + " h"); Profile profile = store.getSpecificProfile(name);
activeProfile.setText(name); if (profile != null) {
ic.setText(profile.getIcList()); units.setText(profile.getUnits());
isf.setText(profile.getIsfList()); dia.setText(DecimalFormatter.to2Decimal(profile.getDia()) + " h");
basal.setText(profile.getBasalList()); activeProfile.setText(name);
target.setText(profile.getTargetList()); ic.setText(profile.getIcList());
isf.setText(profile.getIsfList());
basal.setText(profile.getBasalList());
target.setText(profile.getTargetList());
}
}
} }
@Override @Override

View file

@ -11,6 +11,7 @@ import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
@ -18,6 +19,7 @@ import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment; import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
@ -39,6 +41,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
EditText targetlowView; EditText targetlowView;
EditText targethighView; EditText targethighView;
Button profileswitchButton; Button profileswitchButton;
TextView invalidProfile;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -54,14 +57,13 @@ public class SimpleProfileFragment extends SubscriberFragment {
targetlowView = (EditText) layout.findViewById(R.id.simpleprofile_targetlow); targetlowView = (EditText) layout.findViewById(R.id.simpleprofile_targetlow);
targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh); targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh);
profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch); profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch);
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) { if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
layout.findViewById(R.id.simpleprofile_basalrate).setVisibility(View.GONE); layout.findViewById(R.id.simpleprofile_basalrate).setVisibility(View.GONE);
layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE); layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE);
} }
updateGUI();
mgdlView.setChecked(SimpleProfilePlugin.getPlugin().mgdl); mgdlView.setChecked(SimpleProfilePlugin.getPlugin().mgdl);
mmolView.setChecked(SimpleProfilePlugin.getPlugin().mmol); mmolView.setChecked(SimpleProfilePlugin.getPlugin().mmol);
diaView.setText(SimpleProfilePlugin.getPlugin().dia.toString()); diaView.setText(SimpleProfilePlugin.getPlugin().dia.toString());
@ -122,6 +124,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
SimpleProfilePlugin.getPlugin().targetLow = SafeParse.stringToDouble(targetlowView.getText().toString()); SimpleProfilePlugin.getPlugin().targetLow = SafeParse.stringToDouble(targetlowView.getText().toString());
SimpleProfilePlugin.getPlugin().targetHigh = SafeParse.stringToDouble(targethighView.getText().toString()); SimpleProfilePlugin.getPlugin().targetHigh = SafeParse.stringToDouble(targethighView.getText().toString());
SimpleProfilePlugin.getPlugin().storeSettings(); SimpleProfilePlugin.getPlugin().storeSettings();
updateGUI();
} }
}; };
@ -132,8 +135,6 @@ public class SimpleProfileFragment extends SubscriberFragment {
targetlowView.addTextChangedListener(textWatch); targetlowView.addTextChangedListener(textWatch);
targethighView.addTextChangedListener(textWatch); targethighView.addTextChangedListener(textWatch);
updateGUI();
return layout; return layout;
} catch (Exception e) { } catch (Exception e) {
Crashlytics.logException(e); Crashlytics.logException(e);
@ -154,11 +155,16 @@ public class SimpleProfileFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!ConfigBuilderPlugin.getActivePump().isInitialized() || ConfigBuilderPlugin.getActivePump().isSuspended()) { boolean isValid = SimpleProfilePlugin.getPlugin().getProfile() != null && SimpleProfilePlugin.getPlugin().getProfile().getDefaultProfile().isValid(MainApp.gs(R.string.simpleprofile));
if (!ConfigBuilderPlugin.getActivePump().isInitialized() || ConfigBuilderPlugin.getActivePump().isSuspended() || !isValid) {
profileswitchButton.setVisibility(View.GONE); profileswitchButton.setVisibility(View.GONE);
} else { } else {
profileswitchButton.setVisibility(View.VISIBLE); profileswitchButton.setVisibility(View.VISIBLE);
} }
if (isValid)
invalidProfile.setVisibility(View.GONE);
else
invalidProfile.setVisibility(View.VISIBLE);
} }
}); });
} }

View file

@ -132,6 +132,8 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
editor.apply(); editor.apply();
createConvertedProfile(); createConvertedProfile();
if (Config.logPrefsChange)
log.debug("Storing settings: " + getRawProfile().getData().toString());
} }
private void loadSettings() { private void loadSettings() {
@ -141,11 +143,11 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
mgdl = SP.getBoolean("SimpleProfile" + "mgdl", true); mgdl = SP.getBoolean("SimpleProfile" + "mgdl", true);
mmol = SP.getBoolean("SimpleProfile" + "mmol", false); mmol = SP.getBoolean("SimpleProfile" + "mmol", false);
dia = SP.getDouble("SimpleProfile" + "dia", Constants.defaultDIA); dia = SP.getDouble("SimpleProfile" + "dia", Constants.defaultDIA);
ic = SP.getDouble("SimpleProfile" + "ic", 20d); ic = SP.getDouble("SimpleProfile" + "ic", 0d);
isf = SP.getDouble("SimpleProfile" + "isf", 200d); isf = SP.getDouble("SimpleProfile" + "isf", 0d);
basal = SP.getDouble("SimpleProfile" + "basal", 1d); basal = SP.getDouble("SimpleProfile" + "basal", 0d);
targetLow = SP.getDouble("SimpleProfile" + "targetlow", 80d); targetLow = SP.getDouble("SimpleProfile" + "targetlow", 0d);
targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 120d); targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 0d);
} }
/* /*
@ -210,6 +212,14 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
@Override @Override
public ProfileStore getProfile() { public ProfileStore getProfile() {
if (convertedProfile == null)
createConvertedProfile();
if (!convertedProfile.getDefaultProfile().isValid(MainApp.gs(R.string.simpleprofile)))
return null;
return convertedProfile;
}
public ProfileStore getRawProfile() {
if (convertedProfile == null) if (convertedProfile == null)
createConvertedProfile(); createConvertedProfile();
return convertedProfile; return convertedProfile;

View file

@ -212,6 +212,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override @Override
public void getPumpStatus() { public void getPumpStatus() {
lastDataTime = new Date();
} }
@Override @Override

View file

@ -118,7 +118,7 @@ public class SensitivityAAPSPlugin implements PluginBase, SensitivityInterface{
return new AutosensResult(); return new AutosensResult();
} }
AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already
if (current == null) { if (current == null) {
log.debug("No autosens data available"); log.debug("No autosens data available");
return new AutosensResult(); return new AutosensResult();

View file

@ -118,7 +118,7 @@ public class SensitivityOref0Plugin implements PluginBase, SensitivityInterface
return new AutosensResult(); return new AutosensResult();
} }
AutosensData current = IobCobCalculatorPlugin.getLastAutosensData(); AutosensData current = IobCobCalculatorPlugin.getLastAutosensData("SensitivityOref0"); // this is running inside lock already
if (current == null) { if (current == null) {
log.debug("No current autosens data available"); log.debug("No current autosens data available");
return new AutosensResult(); return new AutosensResult();

View file

@ -116,7 +116,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
return new AutosensResult(); return new AutosensResult();
} }
AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already
if (current == null) { if (current == null) {
if (Config.logAutosensData) if (Config.logAutosensData)
log.debug("No autosens data available"); log.debug("No autosens data available");

View file

@ -258,7 +258,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
} }
} }
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData(); AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensDataSynchronized("getMealData()");
if (autosensData != null) { if (autosensData != null) {
result.mealCOB = autosensData.cob; result.mealCOB = autosensData.cob;
result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation; result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation;

View file

@ -83,6 +83,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
holder.remove.setTag(profileSwitch); holder.remove.setTag(profileSwitch);
holder.name.setTag(profileSwitch); holder.name.setTag(profileSwitch);
holder.date.setTag(profileSwitch); holder.date.setTag(profileSwitch);
holder.invalid.setVisibility(profileSwitch.isValid() ? View.GONE : View.VISIBLE);
} }
@ -104,6 +105,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
TextView remove; TextView remove;
TextView ph; TextView ph;
TextView ns; TextView ns;
TextView invalid;
ProfileSwitchViewHolder(View itemView) { ProfileSwitchViewHolder(View itemView) {
super(itemView); super(itemView);
@ -113,6 +115,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
name = (TextView) itemView.findViewById(R.id.profileswitch_name); name = (TextView) itemView.findViewById(R.id.profileswitch_name);
ph = (TextView) itemView.findViewById(R.id.pump_sign); ph = (TextView) itemView.findViewById(R.id.pump_sign);
ns = (TextView) itemView.findViewById(R.id.ns_sign); ns = (TextView) itemView.findViewById(R.id.ns_sign);
invalid = (TextView) itemView.findViewById(R.id.invalid_sign);
remove = (TextView) itemView.findViewById(R.id.profileswitch_remove); remove = (TextView) itemView.findViewById(R.id.profileswitch_remove);
remove.setOnClickListener(this); remove.setOnClickListener(this);
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

View file

@ -654,7 +654,7 @@ public class WatchUpdaterService extends WearableListenerService implements
private String generateCOBString() { private String generateCOBString() {
String cobStringResult = "--"; String cobStringResult = "--";
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData(); AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("WatcherUpdaterService");
if (autosensData != null) { if (autosensData != null) {
cobStringResult = (int) autosensData.cob + "g"; cobStringResult = (int) autosensData.cob + "g";
} }

View file

@ -287,6 +287,39 @@ public class NSUpload {
} }
} }
public static void updateProfileSwitch(ProfileSwitch profileSwitch) {
try {
JSONObject data = new JSONObject();
data.put("eventType", CareportalEvent.PROFILESWITCH);
data.put("duration", profileSwitch.durationInMinutes);
data.put("profile", profileSwitch.getCustomizedName());
data.put("profileJson", profileSwitch.profileJson);
data.put("profilePlugin", profileSwitch.profilePlugin);
if (profileSwitch.isCPP) {
data.put("CircadianPercentageProfile", true);
data.put("timeshift", profileSwitch.timeshift);
data.put("percentage", profileSwitch.percentage);
}
data.put("created_at", DateUtil.toISOString(profileSwitch.date));
data.put("enteredBy", MainApp.instance().getString(R.string.app_name));
if (profileSwitch._id != null) {
Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle();
bundle.putString("action", "dbUpdate");
bundle.putString("collection", "treatments");
bundle.putString("data", data.toString());
bundle.putString("_id", profileSwitch._id);
Intent intent = new Intent(Intents.ACTION_DATABASE);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
DbLogger.dbAdd(intent, data.toString());
}
} catch (JSONException e) {
log.error("Unhandled exception", e);
}
}
public static void uploadCareportalEntryToNS(JSONObject data) { public static void uploadCareportalEntryToNS(JSONObject data) {
try { try {
if (data.has("preBolus") && data.has("carbs")) { if (data.has("preBolus") && data.has("carbs")) {

View file

@ -13,6 +13,16 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:id="@+id/invalidprofile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/invalidprofile"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/holo_red_light"
android:textStyle="bold" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -245,6 +245,13 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="5dp"> android:paddingTop="5dp">
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView <TextView
android:id="@+id/overview_showprediction_label" android:id="@+id/overview_showprediction_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -255,22 +262,6 @@
android:textColor="@color/prediction" android:textColor="@color/prediction"
android:textStyle="bold"/> android:textStyle="bold"/>
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/basal"
android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showbasals" android:id="@+id/overview_showbasals"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -282,9 +273,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/iob" android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/iob" android:textColor="@color/basal"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -298,11 +289,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/cob" android:text="@string/iob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cob" android:textColor="@color/iob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showcob" android:id="@+id/overview_showcob"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -314,9 +306,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/dev" android:text="@string/cob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations" android:textColor="@color/cob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -330,8 +322,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/ratio_short" android:text="@string/dev"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -340,6 +333,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" /> android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/ratio_short"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View file

@ -474,6 +474,13 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="5dp"> android:paddingTop="5dp">
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView <TextView
android:id="@+id/overview_showprediction_label" android:id="@+id/overview_showprediction_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -484,22 +491,6 @@
android:textColor="@color/prediction" android:textColor="@color/prediction"
android:textStyle="bold"/> android:textStyle="bold"/>
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/basal"
android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showbasals" android:id="@+id/overview_showbasals"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -511,9 +502,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/iob" android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/iob" android:textColor="@color/basal"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -527,11 +518,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/cob" android:text="@string/iob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cob" android:textColor="@color/iob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showcob" android:id="@+id/overview_showcob"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -543,9 +535,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/dev" android:text="@string/cob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations" android:textColor="@color/cob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -559,8 +551,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/ratio_short" android:text="@string/dev"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -569,6 +562,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" /> android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/ratio_short"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View file

@ -558,6 +558,13 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="5dp"> android:paddingTop="5dp">
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView <TextView
android:id="@+id/overview_showprediction_label" android:id="@+id/overview_showprediction_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -568,22 +575,6 @@
android:textColor="@color/prediction" android:textColor="@color/prediction"
android:textStyle="bold"/> android:textStyle="bold"/>
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/basal"
android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showbasals" android:id="@+id/overview_showbasals"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -595,9 +586,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/iob" android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/iob" android:textColor="@color/basal"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -611,11 +602,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/cob" android:text="@string/iob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cob" android:textColor="@color/iob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showcob" android:id="@+id/overview_showcob"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -627,9 +619,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/dev" android:text="@string/cob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations" android:textColor="@color/cob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -643,8 +635,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/ratio_short" android:text="@string/dev"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -653,6 +646,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" /> android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/ratio_short"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View file

@ -240,6 +240,13 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="5dp"> android:paddingTop="5dp">
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView <TextView
android:id="@+id/overview_showprediction_label" android:id="@+id/overview_showprediction_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -250,22 +257,6 @@
android:textColor="@color/prediction" android:textColor="@color/prediction"
android:textStyle="bold"/> android:textStyle="bold"/>
<CheckBox
android:id="@+id/overview_showprediction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:buttonTint="@color/prediction" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/basal"
android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showbasals" android:id="@+id/overview_showbasals"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -277,9 +268,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/iob" android:text="@string/basalshortlabel"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/iob" android:textColor="@color/basal"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -293,11 +284,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/cob" android:text="@string/iob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cob" android:textColor="@color/iob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
android:id="@+id/overview_showcob" android:id="@+id/overview_showcob"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -309,9 +301,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/dev" android:text="@string/cob"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations" android:textColor="@color/cob"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -325,8 +317,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/ratio_short" android:text="@string/dev"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/deviations"
android:textStyle="bold" /> android:textStyle="bold" />
<CheckBox <CheckBox
@ -335,6 +328,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" /> android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/ratio_short"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View file

@ -13,6 +13,16 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:id="@+id/invalidprofile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/invalidprofile"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/holo_red_light"
android:textStyle="bold" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -62,6 +62,14 @@
android:text="60 min" android:text="60 min"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/invalid_sign"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingEnd="10dp"
android:text="@string/invalid"
android:textColor="@android:color/holo_red_light" />
<TextView <TextView
android:id="@+id/pump_sign" android:id="@+id/pump_sign"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -733,13 +733,12 @@
<string name="active"><![CDATA[<Huidig>]]></string> <string name="active"><![CDATA[<Huidig>]]></string>
<string name="none"><![CDATA[<geen>]]></string> <string name="none"><![CDATA[<geen>]]></string>
<string name="app_name">AndroidAPS</string> <string name="app_name">AndroidAPS</string>
<string name="zerovalueinprofile">Nul waarde in basaal profiel</string> <string name="zerovalueinprofile" formatted="false">Nul waarde in basaal profiel %s</string>
<string name="hasbgdata">BG beschikbaar op gekozen bron</string> <string name="hasbgdata">BG beschikbaar op gekozen bron</string>
<string name="positiveonly">Enkel positief</string> <string name="positiveonly">Enkel positief</string>
<string name="negativeonly">Enkel negatief</string> <string name="negativeonly">Enkel negatief</string>
<string name="maxiobset">Maximum IOB juist ingesteld</string> <string name="maxiobset">Maximum IOB juist ingesteld</string>
<string name="overview_editquickwizard_usetrend">Trend berekening</string> <string name="overview_editquickwizard_usetrend">Trend berekening</string>
<string name="nolocaleprofilefound">Profiel wissel ontvangen via NS maar dit profiel bestaat niet op gsm</string>
<string name="combo_programming_bolus">"Bolus in pomp programmeren "</string> <string name="combo_programming_bolus">"Bolus in pomp programmeren "</string>
<string name="combo_refresh">Vernieuw</string> <string name="combo_refresh">Vernieuw</string>
<string name="combo_pump_state_label">Status</string> <string name="combo_pump_state_label">Status</string>

View file

@ -820,9 +820,8 @@
<string name="closedmodeenabled">Closed mode enabled</string> <string name="closedmodeenabled">Closed mode enabled</string>
<string name="maxiobset">Maximal IOB set properly</string> <string name="maxiobset">Maximal IOB set properly</string>
<string name="hasbgdata">BG available from selected source</string> <string name="hasbgdata">BG available from selected source</string>
<string name="basalprofilenotaligned">Basal values not aligned to hours</string> <string name="basalprofilenotaligned" formatted="false">Basal values not aligned to hours: %s</string>
<string name="zerovalueinprofile">Zero value in profile</string> <string name="zerovalueinprofile" formatted="false">Zero value in profile: %s</string>
<string name="nolocaleprofilefound">Received profile switch from NS but profile doesn\'t exist localy</string>
<string name="combo_programming_bolus">Programming pump for bolusing</string> <string name="combo_programming_bolus">Programming pump for bolusing</string>
<string name="combo_refresh">Refresh</string> <string name="combo_refresh">Refresh</string>
<string name="combo_tdds">TDDS</string> <string name="combo_tdds">TDDS</string>