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.Persistentnotification.PersistentNotificationPlugin;
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.ProfileSimple.SimpleProfilePlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
@ -138,7 +138,7 @@ public class MainApp extends Application {
if (Config.APS) pluginsList.add(OpenAPSSMBPlugin.getPlugin());
pluginsList.add(NSProfilePlugin.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)
pluginsList.add(CircadianPercentageProfileFragment.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.PumpInterface;
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.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.ToastUtils;
@ -48,6 +48,9 @@ public class Profile {
private int percentage = 100;
private int timeshift = 0;
private boolean isValid = true;
private boolean isValidated = false;
public Profile(JSONObject json, String units) {
this(json, 100, 0);
if (this.units == null) {
@ -121,6 +124,8 @@ public class Profile {
} catch (JSONException e) {
log.error("Unhandled exception", e);
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;
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) {
log.error("Unhandled exception", e);
log.error(json.toString());
@ -192,6 +193,71 @@ public class Profile {
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) {
Double lastValue = null;
@ -341,32 +407,6 @@ public class Profile {
public Double getBasal(Integer timeAsSeconds) {
if (basal_v == null) {
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);
}

View file

@ -31,6 +31,7 @@ public class ProfileIntervals<T extends Interval> {
public synchronized void add(List<T> list) {
for (T interval : list) {
if (interval.isValid())
rawData.put(interval.start(), interval);
}
merge();
@ -62,7 +63,7 @@ public class ProfileIntervals<T extends Interval> {
public synchronized List<T> getReversedList() {
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));
return list;
}

View file

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

View file

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

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.db;
import android.graphics.Color;
import android.support.annotation.Nullable;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
@ -12,10 +13,14 @@ import org.slf4j.LoggerFactory;
import java.util.Objects;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
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.PointsWithLabelGraphSeries;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.ProfileLocal.LocalProfilePlugin;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
@ -56,12 +61,14 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
private Profile profile = null;
@Nullable
public Profile getProfileObject() {
if (profile == null)
try {
profile = new Profile(new JSONObject(profileJson), percentage, timeshift);
} catch (JSONException e) {
} catch (Exception e) {
log.error("Unhandled exception", e);
log.error("Unhandled exception", profileJson);
}
return profile;
}
@ -171,6 +178,20 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
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 ---------
// ----------------- DataPointInterface --------------------

View file

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

View file

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

View file

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

View file

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

View file

@ -598,7 +598,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
} else {
if (time > now) {
// data may not be calculated yet, use last data
return getLastAutosensData();
return getLastAutosensData("getAutosensData");
}
//log.debug(">>> getAutosensData Cache miss " + new Date(time).toLocaleString());
return null;
@ -607,13 +607,35 @@ public class IobCobCalculatorPlugin implements PluginBase {
}
@Nullable
public static AutosensData getLastAutosensData() {
if (autosensDataTable.size() < 1)
public static AutosensData getLastAutosensDataSynchronized(String reason) {
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;
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) {
log.debug("AUTOSENSDATA null: data is old (" + reason + ")");
return null;
} else {
if (data == null)
log.debug("AUTOSENSDATA null: data == null (" + " " + reason + ")");
return data;
}
}

View file

@ -79,6 +79,11 @@ public class DBAccessReceiver extends BroadcastReceiver {
DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), _id);
UploadQueue.add(dbr);
}
} else if (action.equals("dbUpdate")) {
if (shouldUpload()) {
DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), _id, data);
UploadQueue.add(dbr);
}
} else {
DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), data);
// 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.IobCobCalculator.AutosensData;
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.OpenAPSAMA.OpenAPSAMAPlugin;
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() {
@Override
public void afterTextChanged(Editable s) {
@ -459,7 +472,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
// COB
Double c_cob = 0d;
if (cobCheckbox.isChecked()) {
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData();
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Wizard COB");
if(autosensData != null) {
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();
if (quickWizardEntry != null && actualBg != null) {
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();
try {
@ -1134,7 +1134,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
quickWizardButton.setVisibility(View.VISIBLE);
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";
quickWizardButton.setText(text);
if (wizard.calculatedTotalInsulin <= 0)
@ -1200,7 +1200,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// cob
if (cobView != null) { // view must not exists
String cobText = "";
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData();
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("Overview COB");
if (autosensData != null)
cobText = (int) autosensData.cob + " g";
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 BASAL_PROFILE_NOT_ALIGNED_TO_HOURS = 30;
public static final int ZERO_VALUE_IN_PROFILE = 31;
public static final int NO_LOCALE_PROFILE_FOUND = 32;
public int id;
public Date date;

View file

@ -11,6 +11,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
@ -22,6 +23,8 @@ import java.text.DecimalFormat;
import info.nightscout.androidaps.MainApp;
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.interfaces.PumpDescription;
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
@ -37,12 +40,6 @@ import info.nightscout.utils.TimeListEdit;
public class LocalProfileFragment extends SubscriberFragment {
private static Logger log = LoggerFactory.getLogger(LocalProfileFragment.class);
private static LocalProfilePlugin localProfilePlugin = new LocalProfilePlugin();
public static LocalProfilePlugin getPlugin() {
return localProfilePlugin;
}
NumberPicker diaView;
RadioButton mgdlView;
RadioButton mmolView;
@ -51,6 +48,7 @@ public class LocalProfileFragment extends SubscriberFragment {
TimeListEdit basalView;
TimeListEdit targetView;
Button profileswitchButton;
TextView invalidProfile;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -59,10 +57,11 @@ public class LocalProfileFragment extends SubscriberFragment {
Runnable save = new Runnable() {
@Override
public void run() {
localProfilePlugin.storeSettings();
LocalProfilePlugin.getPlugin().storeSettings();
if (basalView != null) {
basalView.updateLabel(MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel());
}
updateGUI();
}
};
@ -80,8 +79,9 @@ public class LocalProfileFragment extends SubscriberFragment {
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count) {
localProfilePlugin.dia = SafeParse.stringToDouble(diaView.getText().toString());
localProfilePlugin.storeSettings();
LocalProfilePlugin.getPlugin().dia = SafeParse.stringToDouble(diaView.getText().toString());
LocalProfilePlugin.getPlugin().storeSettings();
updateGUI();
}
};
@ -89,40 +89,39 @@ public class LocalProfileFragment extends SubscriberFragment {
View layout = inflater.inflate(R.layout.localprofile_fragment, container, false);
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);
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);
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);
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);
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);
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) + ":", 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(), 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) + ":", LocalProfilePlugin.getPlugin().targetLow, LocalProfilePlugin.getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE);
}
updateGUI();
mgdlView.setChecked(localProfilePlugin.mgdl);
mmolView.setChecked(localProfilePlugin.mmol);
mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
mgdlView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
localProfilePlugin.mgdl = mgdlView.isChecked();
localProfilePlugin.mmol = !localProfilePlugin.mgdl;
mmolView.setChecked(localProfilePlugin.mmol);
localProfilePlugin.storeSettings();
LocalProfilePlugin.getPlugin().mgdl = mgdlView.isChecked();
LocalProfilePlugin.getPlugin().mmol = !LocalProfilePlugin.getPlugin().mgdl;
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
LocalProfilePlugin.getPlugin().storeSettings();
}
});
mmolView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
localProfilePlugin.mmol = mmolView.isChecked();
localProfilePlugin.mgdl = !localProfilePlugin.mmol;
mgdlView.setChecked(localProfilePlugin.mgdl);
localProfilePlugin.storeSettings();
LocalProfilePlugin.getPlugin().mmol = mmolView.isChecked();
LocalProfilePlugin.getPlugin().mgdl = !LocalProfilePlugin.getPlugin().mmol;
mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
LocalProfilePlugin.getPlugin().storeSettings();
}
});
@ -138,7 +137,6 @@ public class LocalProfileFragment extends SubscriberFragment {
});
updateGUI();
return layout;
} catch (Exception e) {
log.error("Unhandled exception: ", e);
@ -150,7 +148,11 @@ public class LocalProfileFragment extends SubscriberFragment {
@NonNull
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
@ -165,11 +167,16 @@ public class LocalProfileFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() {
@Override
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);
} else {
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.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.utils.DecimalFormatter;
import info.nightscout.utils.SP;
@ -26,6 +26,14 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
public static final String LOCAL_PROFILE = "LocalProfile";
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 fragmentVisible = false;
@ -128,7 +136,7 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
editor.apply();
createConvertedProfile();
if (Config.logPrefsChange)
log.debug("Storing settings: " + getProfile().getData().toString());
log.debug("Storing settings: " + getRawProfile().getData().toString());
}
public void loadSettings() {
@ -243,6 +251,14 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
@Override
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)
createConvertedProfile();
return convertedProfile;

View file

@ -84,6 +84,7 @@ public class NSProfileFragment extends SubscriberFragment implements AdapterView
}
ProfileStore profileStore = NSProfilePlugin.getPlugin().getProfile();
if (profileStore != null) {
ArrayList<CharSequence> profileList = profileStore.getProfileList();
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(getContext(),
R.layout.spinner_centered, profileList);
@ -93,14 +94,17 @@ public class NSProfileFragment extends SubscriberFragment implements AdapterView
if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName()))
profileSpinner.setSelection(p);
}
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String name = parent.getItemAtPosition(position).toString();
Profile profile = NSProfilePlugin.getPlugin().getProfile().getSpecificProfile(name);
ProfileStore store = NSProfilePlugin.getPlugin().getProfile();
if (store != null) {
Profile profile = store.getSpecificProfile(name);
if (profile != null) {
units.setText(profile.getUnits());
dia.setText(DecimalFormatter.to2Decimal(profile.getDia()) + " h");
activeProfile.setText(name);
@ -109,6 +113,8 @@ public class NSProfileFragment extends SubscriberFragment implements AdapterView
basal.setText(profile.getBasalList());
target.setText(profile.getTargetList());
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {

View file

@ -11,6 +11,7 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import com.crashlytics.android.Crashlytics;
import com.squareup.otto.Subscribe;
@ -18,6 +19,7 @@ import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
@ -39,6 +41,7 @@ public class SimpleProfileFragment extends SubscriberFragment {
EditText targetlowView;
EditText targethighView;
Button profileswitchButton;
TextView invalidProfile;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -54,14 +57,13 @@ public class SimpleProfileFragment extends SubscriberFragment {
targetlowView = (EditText) layout.findViewById(R.id.simpleprofile_targetlow);
targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh);
profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch);
invalidProfile = (TextView) layout.findViewById(R.id.invalidprofile);
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
layout.findViewById(R.id.simpleprofile_basalrate).setVisibility(View.GONE);
layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE);
}
updateGUI();
mgdlView.setChecked(SimpleProfilePlugin.getPlugin().mgdl);
mmolView.setChecked(SimpleProfilePlugin.getPlugin().mmol);
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().targetHigh = SafeParse.stringToDouble(targethighView.getText().toString());
SimpleProfilePlugin.getPlugin().storeSettings();
updateGUI();
}
};
@ -132,8 +135,6 @@ public class SimpleProfileFragment extends SubscriberFragment {
targetlowView.addTextChangedListener(textWatch);
targethighView.addTextChangedListener(textWatch);
updateGUI();
return layout;
} catch (Exception e) {
Crashlytics.logException(e);
@ -154,11 +155,16 @@ public class SimpleProfileFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() {
@Override
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);
} else {
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();
createConvertedProfile();
if (Config.logPrefsChange)
log.debug("Storing settings: " + getRawProfile().getData().toString());
}
private void loadSettings() {
@ -141,11 +143,11 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
mgdl = SP.getBoolean("SimpleProfile" + "mgdl", true);
mmol = SP.getBoolean("SimpleProfile" + "mmol", false);
dia = SP.getDouble("SimpleProfile" + "dia", Constants.defaultDIA);
ic = SP.getDouble("SimpleProfile" + "ic", 20d);
isf = SP.getDouble("SimpleProfile" + "isf", 200d);
basal = SP.getDouble("SimpleProfile" + "basal", 1d);
targetLow = SP.getDouble("SimpleProfile" + "targetlow", 80d);
targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 120d);
ic = SP.getDouble("SimpleProfile" + "ic", 0d);
isf = SP.getDouble("SimpleProfile" + "isf", 0d);
basal = SP.getDouble("SimpleProfile" + "basal", 0d);
targetLow = SP.getDouble("SimpleProfile" + "targetlow", 0d);
targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 0d);
}
/*
@ -210,6 +212,14 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
@Override
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)
createConvertedProfile();
return convertedProfile;

View file

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

View file

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

View file

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

View file

@ -116,7 +116,7 @@ public class SensitivityWeightedAveragePlugin implements PluginBase, Sensitivity
return new AutosensResult();
}
AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime);
AutosensData current = IobCobCalculatorPlugin.getAutosensData(toTime); // this is running inside lock already
if (current == null) {
if (Config.logAutosensData)
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) {
result.mealCOB = autosensData.cob;
result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation;

View file

@ -83,6 +83,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
holder.remove.setTag(profileSwitch);
holder.name.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 ph;
TextView ns;
TextView invalid;
ProfileSwitchViewHolder(View itemView) {
super(itemView);
@ -113,6 +115,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
name = (TextView) itemView.findViewById(R.id.profileswitch_name);
ph = (TextView) itemView.findViewById(R.id.pump_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.setOnClickListener(this);
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

View file

@ -654,7 +654,7 @@ public class WatchUpdaterService extends WearableListenerService implements
private String generateCOBString() {
String cobStringResult = "--";
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData();
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData("WatcherUpdaterService");
if (autosensData != null) {
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) {
try {
if (data.has("preBolus") && data.has("carbs")) {

View file

@ -13,6 +13,16 @@
android:layout_height="wrap_content"
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
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

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

View file

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

View file

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

View file

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

View file

@ -13,6 +13,16 @@
android:layout_height="wrap_content"
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
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -62,6 +62,14 @@
android:text="60 min"
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
android:id="@+id/pump_sign"
android:layout_width="0dp"

View file

@ -733,13 +733,12 @@
<string name="active"><![CDATA[<Huidig>]]></string>
<string name="none"><![CDATA[<geen>]]></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="positiveonly">Enkel positief</string>
<string name="negativeonly">Enkel negatief</string>
<string name="maxiobset">Maximum IOB juist ingesteld</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_refresh">Vernieuw</string>
<string name="combo_pump_state_label">Status</string>

View file

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