Merge remote-tracking branch 'origin/dev' into csv2-staging
* origin/dev: fix non smooth ratio graph fix of fix fix wrong button type fix doubled percentage when comming from NS proper select last used profile when using profile percentage limit basal rate to minimal value supported by pump SingleClickButton RS fix crash when pairing is not confirmed on pump Double -> double use joda-time Use autosensdata for wizard instead of APSResult
This commit is contained in:
commit
ea5629fc86
34 changed files with 268 additions and 130 deletions
|
@ -192,4 +192,7 @@ dependencies {
|
||||||
compile 'com.google.code.gson:gson:2.7'
|
compile 'com.google.code.gson:gson:2.7'
|
||||||
compile 'com.google.guava:guava:20.0'
|
compile 'com.google.guava:guava:20.0'
|
||||||
compile project(path: ':ruffyscripter')
|
compile project(path: ':ruffyscripter')
|
||||||
|
|
||||||
|
compile 'net.danlew:android.joda:2.9.9.1'
|
||||||
|
testCompile 'joda-time:joda-time:2.9.4.2'
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ import com.squareup.otto.Bus;
|
||||||
import com.squareup.otto.LoggingBus;
|
import com.squareup.otto.LoggingBus;
|
||||||
import com.squareup.otto.ThreadEnforcer;
|
import com.squareup.otto.ThreadEnforcer;
|
||||||
|
|
||||||
|
import net.danlew.android.joda.JodaTimeAndroid;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -97,6 +99,7 @@ public class MainApp extends Application {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Fabric.with(this, new Crashlytics());
|
Fabric.with(this, new Crashlytics());
|
||||||
Fabric.with(this, new Answers());
|
Fabric.with(this, new Answers());
|
||||||
|
JodaTimeAndroid.init(this);
|
||||||
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
|
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
|
||||||
log.info("Version: " + BuildConfig.VERSION_NAME);
|
log.info("Version: " + BuildConfig.VERSION_NAME);
|
||||||
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
||||||
|
|
|
@ -17,6 +17,9 @@ import java.util.TimeZone;
|
||||||
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.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.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;
|
||||||
|
@ -327,8 +330,27 @@ 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);
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
||||||
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.PercentageSplitter;
|
||||||
|
|
||||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
|
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
|
||||||
|
@ -1633,6 +1634,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// look for already added percentage from NS
|
||||||
|
profileSwitch.profileName = PercentageSplitter.pureName(profileSwitch.profileName);
|
||||||
getDaoProfileSwitch().create(profileSwitch);
|
getDaoProfileSwitch().create(profileSwitch);
|
||||||
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
|
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
|
||||||
scheduleProfileSwitchChange();
|
scheduleProfileSwitchChange();
|
||||||
|
|
|
@ -21,5 +21,5 @@ public interface InsulinInterface {
|
||||||
String getFriendlyName();
|
String getFriendlyName();
|
||||||
String getComment();
|
String getComment();
|
||||||
double getDia();
|
double getDia();
|
||||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia);
|
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.support.v4.app.FragmentManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
import com.crashlytics.android.Crashlytics;
|
import com.crashlytics.android.Crashlytics;
|
||||||
import com.crashlytics.android.answers.Answers;
|
import com.crashlytics.android.answers.Answers;
|
||||||
|
@ -33,6 +32,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
|
||||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.utils.SingleClickButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
|
@ -45,13 +45,13 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
return actionsPlugin;
|
return actionsPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
Button profileSwitch;
|
SingleClickButton profileSwitch;
|
||||||
Button tempTarget;
|
SingleClickButton tempTarget;
|
||||||
Button extendedBolus;
|
SingleClickButton extendedBolus;
|
||||||
Button extendedBolusCancel;
|
SingleClickButton extendedBolusCancel;
|
||||||
Button tempBasal;
|
SingleClickButton tempBasal;
|
||||||
Button tempBasalCancel;
|
SingleClickButton tempBasalCancel;
|
||||||
Button fill;
|
SingleClickButton fill;
|
||||||
|
|
||||||
public ActionsFragment() {
|
public ActionsFragment() {
|
||||||
super();
|
super();
|
||||||
|
@ -64,13 +64,13 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
||||||
try {
|
try {
|
||||||
View view = inflater.inflate(R.layout.actions_fragment, container, false);
|
View view = inflater.inflate(R.layout.actions_fragment, container, false);
|
||||||
|
|
||||||
profileSwitch = (Button) view.findViewById(R.id.actions_profileswitch);
|
profileSwitch = (SingleClickButton) view.findViewById(R.id.actions_profileswitch);
|
||||||
tempTarget = (Button) view.findViewById(R.id.actions_temptarget);
|
tempTarget = (SingleClickButton) view.findViewById(R.id.actions_temptarget);
|
||||||
extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus);
|
extendedBolus = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus);
|
||||||
extendedBolusCancel = (Button) view.findViewById(R.id.actions_extendedbolus_cancel);
|
extendedBolusCancel = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus_cancel);
|
||||||
tempBasal = (Button) view.findViewById(R.id.actions_settempbasal);
|
tempBasal = (SingleClickButton) view.findViewById(R.id.actions_settempbasal);
|
||||||
tempBasalCancel = (Button) view.findViewById(R.id.actions_canceltempbasal);
|
tempBasalCancel = (SingleClickButton) view.findViewById(R.id.actions_canceltempbasal);
|
||||||
fill = (Button) view.findViewById(R.id.actions_fill);
|
fill = (SingleClickButton) view.findViewById(R.id.actions_fill);
|
||||||
|
|
||||||
profileSwitch.setOnClickListener(this);
|
profileSwitch.setOnClickListener(this);
|
||||||
tempTarget.setOnClickListener(this);
|
tempTarget.setOnClickListener(this);
|
||||||
|
|
|
@ -100,6 +100,8 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
if (button1.getVisibility() == View.GONE && button2.getVisibility() == View.GONE && button3.getVisibility() == View.GONE) {
|
if (button1.getVisibility() == View.GONE && button2.getVisibility() == View.GONE && button3.getVisibility() == View.GONE) {
|
||||||
divider.setVisibility(View.GONE);
|
divider.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,9 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
||||||
|
|
||||||
view.findViewById(R.id.ok).setOnClickListener(this);
|
view.findViewById(R.id.ok).setOnClickListener(this);
|
||||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
setCancelable(false);
|
||||||
public void onResume() {
|
return view;
|
||||||
super.onResume();
|
|
||||||
if (getDialog() != null)
|
|
||||||
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -102,6 +102,8 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
||||||
view.findViewById(R.id.ok).setOnClickListener(this);
|
view.findViewById(R.id.ok).setOnClickListener(this);
|
||||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||||
basalTypeRadioGroup.setOnCheckedChangeListener(this);
|
basalTypeRadioGroup.setOnCheckedChangeListener(this);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
profileSpinner.setAdapter(adapter);
|
profileSpinner.setAdapter(adapter);
|
||||||
// set selected to actual profile
|
// set selected to actual profile
|
||||||
for (int p = 0; p < profileList.size(); p++) {
|
for (int p = 0; p < profileList.size(); p++) {
|
||||||
if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName()))
|
if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName(false)))
|
||||||
profileSpinner.setSelection(p);
|
profileSpinner.setSelection(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,6 +360,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
showOrHide((ViewGroup) view.findViewById(R.id.careportal_newnstreatment_reuse_layout), options.profile && ps != null && ps.isCPP);
|
showOrHide((ViewGroup) view.findViewById(R.id.careportal_newnstreatment_reuse_layout), options.profile && ps != null && ps.isCPP);
|
||||||
showOrHide((ViewGroup) view.findViewById(R.id.careportal_newnstreatment_temptarget_layout), options.tempTarget);
|
showOrHide((ViewGroup) view.findViewById(R.id.careportal_newnstreatment_temptarget_layout), options.tempTarget);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -736,6 +736,10 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
|
||||||
return getProfileName(System.currentTimeMillis());
|
return getProfileName(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProfileName(boolean customized) {
|
||||||
|
return getProfileName(System.currentTimeMillis(), customized);
|
||||||
|
}
|
||||||
|
|
||||||
public String getProfileName(long time) {
|
public String getProfileName(long time) {
|
||||||
return getProfileName(time, true);
|
return getProfileName(time, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class InsulinFastactingPlugin implements PluginBase, InsulinInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia) {
|
||||||
Iob result = new Iob();
|
Iob result = new Iob();
|
||||||
|
|
||||||
double scaleFactor = 3.0 / dia;
|
double scaleFactor = 3.0 / dia;
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class InsulinFastactingProlongedPlugin implements PluginBase, InsulinInte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia) {
|
||||||
Iob result = new Iob();
|
Iob result = new Iob();
|
||||||
|
|
||||||
//Double scaleFactor = 3.0 / dia;
|
//Double scaleFactor = 3.0 / dia;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public abstract class InsulinOrefBasePlugin implements PluginBase, InsulinInterf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia) {
|
||||||
Iob result = new Iob();
|
Iob result = new Iob();
|
||||||
|
|
||||||
int peak = getPeak();
|
int peak = getPeak();
|
||||||
|
|
|
@ -364,6 +364,8 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
// check if data already exists
|
// check if data already exists
|
||||||
long bgTime = bucketed_data.get(i).date;
|
long bgTime = bucketed_data.get(i).date;
|
||||||
bgTime = roundUpTime(bgTime);
|
bgTime = roundUpTime(bgTime);
|
||||||
|
if (bgTime > System.currentTimeMillis())
|
||||||
|
continue;
|
||||||
Profile profile = MainApp.getConfigBuilder().getProfile(bgTime);
|
Profile profile = MainApp.getConfigBuilder().getProfile(bgTime);
|
||||||
|
|
||||||
AutosensData existing;
|
AutosensData existing;
|
||||||
|
|
|
@ -76,6 +76,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
|
||||||
unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
|
unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
|
||||||
unitsView.setText(units);
|
unitsView.setText(units);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
||||||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||||
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher);
|
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher);
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.events.EventNewBG;
|
import info.nightscout.androidaps.events.EventNewBG;
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
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.IobCobCalculatorPlugin;
|
||||||
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;
|
||||||
|
@ -251,6 +253,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
|
editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
|
||||||
initDialog();
|
initDialog();
|
||||||
|
|
||||||
|
setCancelable(false);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +442,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
basalIobInsulin.setText(DecimalFormatter.to2Decimal(-basalIob.basaliob) + "U");
|
basalIobInsulin.setText(DecimalFormatter.to2Decimal(-basalIob.basaliob) + "U");
|
||||||
|
|
||||||
// COB only if AMA is selected
|
// COB only if AMA is selected
|
||||||
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin) {
|
||||||
cobLayout.setVisibility(View.VISIBLE);
|
cobLayout.setVisibility(View.VISIBLE);
|
||||||
cobAvailable = true;
|
cobAvailable = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -483,12 +486,10 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
||||||
// COB
|
// COB
|
||||||
Double c_cob = 0d;
|
Double c_cob = 0d;
|
||||||
if (cobAvailable && cobCheckbox.isChecked()) {
|
if (cobAvailable && cobCheckbox.isChecked()) {
|
||||||
if (ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
|
||||||
try {
|
|
||||||
c_cob = SafeParse.stringToDouble(ConfigBuilderPlugin.getActiveAPS().getLastAPSResult().json().getString("COB"));
|
if(autosensData != null && autosensData.time > System.currentTimeMillis() - 11 * 60 * 1000L) {
|
||||||
} catch (JSONException e) {
|
c_cob = autosensData.cob;
|
||||||
log.error("Unhandled exception", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@ import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import info.nightscout.androidaps.BuildConfig;
|
|
||||||
import info.nightscout.androidaps.Config;
|
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;
|
||||||
|
@ -114,6 +113,7 @@ import info.nightscout.utils.NSUpload;
|
||||||
import info.nightscout.utils.OKDialog;
|
import info.nightscout.utils.OKDialog;
|
||||||
import info.nightscout.utils.Profiler;
|
import info.nightscout.utils.Profiler;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
import info.nightscout.utils.SingleClickButton;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
public class OverviewFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
public class OverviewFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
||||||
|
@ -157,11 +157,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
LinearLayoutManager llm;
|
LinearLayoutManager llm;
|
||||||
|
|
||||||
LinearLayout acceptTempLayout;
|
LinearLayout acceptTempLayout;
|
||||||
Button treatmentButton;
|
SingleClickButton treatmentButton;
|
||||||
Button wizardButton;
|
SingleClickButton wizardButton;
|
||||||
Button calibrationButton;
|
SingleClickButton calibrationButton;
|
||||||
Button acceptTempButton;
|
SingleClickButton acceptTempButton;
|
||||||
Button quickWizardButton;
|
SingleClickButton quickWizardButton;
|
||||||
|
|
||||||
CheckBox lockScreen;
|
CheckBox lockScreen;
|
||||||
|
|
||||||
|
@ -245,16 +245,16 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
|
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
|
||||||
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
|
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
|
||||||
|
|
||||||
treatmentButton = (Button) view.findViewById(R.id.overview_treatmentbutton);
|
treatmentButton = (SingleClickButton) view.findViewById(R.id.overview_treatmentbutton);
|
||||||
treatmentButton.setOnClickListener(this);
|
treatmentButton.setOnClickListener(this);
|
||||||
wizardButton = (Button) view.findViewById(R.id.overview_wizardbutton);
|
wizardButton = (SingleClickButton) view.findViewById(R.id.overview_wizardbutton);
|
||||||
wizardButton.setOnClickListener(this);
|
wizardButton.setOnClickListener(this);
|
||||||
acceptTempButton = (Button) view.findViewById(R.id.overview_accepttempbutton);
|
acceptTempButton = (SingleClickButton) view.findViewById(R.id.overview_accepttempbutton);
|
||||||
if (acceptTempButton != null)
|
if (acceptTempButton != null)
|
||||||
acceptTempButton.setOnClickListener(this);
|
acceptTempButton.setOnClickListener(this);
|
||||||
quickWizardButton = (Button) view.findViewById(R.id.overview_quickwizardbutton);
|
quickWizardButton = (SingleClickButton) view.findViewById(R.id.overview_quickwizardbutton);
|
||||||
quickWizardButton.setOnClickListener(this);
|
quickWizardButton.setOnClickListener(this);
|
||||||
calibrationButton = (Button) view.findViewById(R.id.overview_calibrationbutton);
|
calibrationButton = (SingleClickButton) view.findViewById(R.id.overview_calibrationbutton);
|
||||||
if (calibrationButton != null)
|
if (calibrationButton != null)
|
||||||
calibrationButton.setOnClickListener(this);
|
calibrationButton.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -321,6 +321,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
return view;
|
return view;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Crashlytics.logException(e);
|
Crashlytics.logException(e);
|
||||||
|
log.debug("Runtime Exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class Notification {
|
||||||
public static final int PUMP_UNREACHABLE = 26;
|
public static final int PUMP_UNREACHABLE = 26;
|
||||||
public static final int BG_READINGS_MISSED = 27;
|
public static final int BG_READINGS_MISSED = 27;
|
||||||
public static final int UNSUPPORTED_FIRMWARE = 28;
|
public static final int UNSUPPORTED_FIRMWARE = 28;
|
||||||
|
public static final int MINIMAL_BASAL_VALUE_REPLACED = 29;
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
public Date date;
|
public Date date;
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class PairingProgressDialog extends DialogFragment implements View.OnClic
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
super.dismiss();
|
super.dismissAllowingStateLoss();
|
||||||
if (helperActivity != null) {
|
if (helperActivity != null) {
|
||||||
helperActivity.finish();
|
helperActivity.finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,12 @@ package info.nightscout.utils;
|
||||||
|
|
||||||
import android.support.v4.util.LongSparseArray;
|
import android.support.v4.util.LongSparseArray;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.util.SparseIntArray;
|
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.format.DateTimeFormatter;
|
||||||
|
import org.joda.time.format.ISODateTimeFormat;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -29,10 +31,6 @@ public class DateUtil {
|
||||||
*/
|
*/
|
||||||
private static String FORMAT_DATE_ISO_OUT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
private static String FORMAT_DATE_ISO_OUT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||||
|
|
||||||
private static String FORMAT_DATE_ISO = "yyyy-MM-dd'T'HH:mm:ssZ";
|
|
||||||
private static String FORMAT_DATE_ISO_MSEC = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
|
||||||
private static String FORMAT_DATE_ISO_MSEC_UTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes in an ISO date string of the following format:
|
* Takes in an ISO date string of the following format:
|
||||||
* yyyy-mm-ddThh:mm:ss.ms+HoMo
|
* yyyy-mm-ddThh:mm:ss.ms+HoMo
|
||||||
|
@ -43,33 +41,10 @@ public class DateUtil {
|
||||||
*/
|
*/
|
||||||
public static Date fromISODateString(String isoDateString)
|
public static Date fromISODateString(String isoDateString)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
SimpleDateFormat f = new SimpleDateFormat(FORMAT_DATE_ISO, Locale.getDefault());
|
|
||||||
Date date;
|
|
||||||
|
|
||||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
DateTimeFormatter parser = ISODateTimeFormat.dateTimeParser();
|
||||||
try {
|
DateTime dateTime = DateTime.parse(isoDateString, parser);
|
||||||
date = f.parse(isoDateString);
|
return dateTime.toDate();
|
||||||
return date;
|
|
||||||
} catch (ParseException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
f = new SimpleDateFormat(FORMAT_DATE_ISO_MSEC, Locale.getDefault());
|
|
||||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
||||||
try {
|
|
||||||
date = f.parse(isoDateString);
|
|
||||||
return date;
|
|
||||||
} catch (ParseException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
f = new SimpleDateFormat(FORMAT_DATE_ISO_MSEC_UTC, Locale.getDefault());
|
|
||||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
||||||
try {
|
|
||||||
date = f.parse(isoDateString);
|
|
||||||
return date;
|
|
||||||
} catch (ParseException e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new ParseException("Unparseable date: " + isoDateString, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,11 +74,8 @@ public class DateUtil {
|
||||||
public static Date toDate(Integer seconds) {
|
public static Date toDate(Integer seconds) {
|
||||||
Calendar calendar = new GregorianCalendar();
|
Calendar calendar = new GregorianCalendar();
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, seconds / 60 / 60);
|
calendar.set(Calendar.HOUR_OF_DAY, seconds / 60 / 60);
|
||||||
String a = calendar.getTime().toString();
|
|
||||||
calendar.set(Calendar.MINUTE, (seconds / 60) % 60);
|
calendar.set(Calendar.MINUTE, (seconds / 60) % 60);
|
||||||
String b = calendar.getTime().toString();
|
|
||||||
calendar.set(Calendar.SECOND, 0);
|
calendar.set(Calendar.SECOND, 0);
|
||||||
String c = calendar.getTime().toString();
|
|
||||||
return calendar.getTime();
|
return calendar.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package info.nightscout.utils;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 22.12.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PercentageSplitter {
|
||||||
|
public static String pureName(String name) {
|
||||||
|
String newName = name;
|
||||||
|
String s = "(.*)\\((\\d+)\\%\\)";
|
||||||
|
Pattern r = Pattern.compile(s);
|
||||||
|
Matcher m = r.matcher(name);
|
||||||
|
if (m.find()) {
|
||||||
|
newName = m.group(1);
|
||||||
|
}
|
||||||
|
return newName;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package info.nightscout.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 22.12.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SingleClickButton extends android.support.v7.widget.AppCompatButton implements View.OnClickListener {
|
||||||
|
private static Logger log = LoggerFactory.getLogger(SingleClickButton.class);
|
||||||
|
|
||||||
|
Context context;
|
||||||
|
OnClickListener listener = null;
|
||||||
|
|
||||||
|
public SingleClickButton(Context context) {
|
||||||
|
super(context);
|
||||||
|
this.context = context;
|
||||||
|
super.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SingleClickButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
this.context = context;
|
||||||
|
super.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SingleClickButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
this.context = context;
|
||||||
|
super.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOnClickListener(@Nullable OnClickListener l) {
|
||||||
|
listener = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(final View v) {
|
||||||
|
setEnabled(false);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
SystemClock.sleep(3000);
|
||||||
|
Activity activity = (Activity) context;
|
||||||
|
if (activity != null)
|
||||||
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
setEnabled(true);
|
||||||
|
log.debug("Button enabled");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
if (listener != null)
|
||||||
|
listener.onClick(v);
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/actions_profileswitch"
|
android:id="@+id/actions_profileswitch"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
android:drawableTop="@drawable/icon_actions_profileswitch"
|
android:drawableTop="@drawable/icon_actions_profileswitch"
|
||||||
android:text="@string/careportal_profileswitch" />
|
android:text="@string/careportal_profileswitch" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/actions_temptarget"
|
android:id="@+id/actions_temptarget"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
android:drawableTop="@drawable/icon_actions_temptarget"
|
android:drawableTop="@drawable/icon_actions_temptarget"
|
||||||
android:text="@string/careportal_temporarytarget" />
|
android:text="@string/careportal_temporarytarget" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/actions_settempbasal"
|
android:id="@+id/actions_settempbasal"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
android:drawableTop="@drawable/icon_actions_starttempbasal"
|
android:drawableTop="@drawable/icon_actions_starttempbasal"
|
||||||
android:text="@string/overview_tempbasal_button" />
|
android:text="@string/overview_tempbasal_button" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/actions_canceltempbasal"
|
android:id="@+id/actions_canceltempbasal"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
android:drawableTop="@drawable/icon_cancelbasal"
|
android:drawableTop="@drawable/icon_cancelbasal"
|
||||||
android:text="Cancel temp basal" />
|
android:text="Cancel temp basal" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/actions_extendedbolus"
|
android:id="@+id/actions_extendedbolus"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
android:drawableTop="@drawable/icon_actions_startextbolus"
|
android:drawableTop="@drawable/icon_actions_startextbolus"
|
||||||
android:text="@string/overview_extendedbolus_button" />
|
android:text="@string/overview_extendedbolus_button" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/actions_extendedbolus_cancel"
|
android:id="@+id/actions_extendedbolus_cancel"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
android:drawableTop="@drawable/icon_actions_cancelextbolus"
|
android:drawableTop="@drawable/icon_actions_cancelextbolus"
|
||||||
android:text="@string/overview_extendedbolus_cancel_button" />
|
android:text="@string/overview_extendedbolus_cancel_button" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/actions_fill"
|
android:id="@+id/actions_fill"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
android:padding="10dip"
|
android:padding="10dip"
|
||||||
app:columnCount="3">
|
app:columnCount="3">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_bgcheck"
|
android:id="@+id/careportal_bgcheck"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="0" />
|
app:layout_row="0" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_exercise"
|
android:id="@+id/careportal_exercise"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="0" />
|
app:layout_row="0" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_temporarytarget"
|
android:id="@+id/careportal_temporarytarget"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
android:padding="10dip"
|
android:padding="10dip"
|
||||||
app:columnCount="3">
|
app:columnCount="3">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_snackbolus"
|
android:id="@+id/careportal_snackbolus"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="1" />
|
app:layout_row="1" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_mealbolus"
|
android:id="@+id/careportal_mealbolus"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="1" />
|
app:layout_row="1" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_correctionbolus"
|
android:id="@+id/careportal_correctionbolus"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="1" />
|
app:layout_row="1" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_carbscorrection"
|
android:id="@+id/careportal_carbscorrection"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="2" />
|
app:layout_row="2" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_combobolus"
|
android:id="@+id/careportal_combobolus"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="2" />
|
app:layout_row="2" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_tempbasalstart"
|
android:id="@+id/careportal_tempbasalstart"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -195,7 +195,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="2" />
|
app:layout_row="2" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_tempbasalend"
|
android:id="@+id/careportal_tempbasalend"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -225,7 +225,7 @@
|
||||||
android:padding="10dip"
|
android:padding="10dip"
|
||||||
app:columnCount="3">
|
app:columnCount="3">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_cgmsensorstart"
|
android:id="@+id/careportal_cgmsensorstart"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -240,7 +240,7 @@
|
||||||
app:layout_row="1" />
|
app:layout_row="1" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_cgmsensorinsert"
|
android:id="@+id/careportal_cgmsensorinsert"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
app:layout_row="1" />
|
app:layout_row="1" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_openapsoffline"
|
android:id="@+id/careportal_openapsoffline"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -270,7 +270,7 @@
|
||||||
app:layout_row="1" />
|
app:layout_row="1" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_announcement"
|
android:id="@+id/careportal_announcement"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -284,7 +284,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="4" />
|
app:layout_row="4" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_question"
|
android:id="@+id/careportal_question"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -298,7 +298,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="4" />
|
app:layout_row="4" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_note"
|
android:id="@+id/careportal_note"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -328,7 +328,7 @@
|
||||||
android:padding="10dip"
|
android:padding="10dip"
|
||||||
app:columnCount="3">
|
app:columnCount="3">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_pumpsitechange"
|
android:id="@+id/careportal_pumpsitechange"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -342,7 +342,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="0" />
|
app:layout_row="0" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_insulincartridgechange"
|
android:id="@+id/careportal_insulincartridgechange"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -356,7 +356,7 @@
|
||||||
app:layout_gravity="fill"
|
app:layout_gravity="fill"
|
||||||
app:layout_row="0" />
|
app:layout_row="0" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_profileswitch"
|
android:id="@+id/careportal_profileswitch"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -371,7 +371,7 @@
|
||||||
app:layout_row="0" />
|
app:layout_row="0" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/careportal_pumpbatterychange"
|
android:id="@+id/careportal_pumpbatterychange"
|
||||||
style="@style/ButtonSmallFontStyle"
|
style="@style/ButtonSmallFontStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -381,7 +381,7 @@
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_accepttempbutton"
|
android:id="@+id/overview_accepttempbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -398,7 +398,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_treatmentbutton"
|
android:id="@+id/overview_treatmentbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -413,7 +413,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_wizardbutton"
|
android:id="@+id/overview_wizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -428,7 +428,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_calibrationbutton"
|
android:id="@+id/overview_calibrationbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -443,7 +443,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_quickwizardbutton"
|
android:id="@+id/overview_quickwizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
|
|
@ -593,7 +593,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_treatmentbutton"
|
android:id="@+id/overview_treatmentbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -607,7 +607,7 @@
|
||||||
android:textColor="@color/colorTreatmentButton"
|
android:textColor="@color/colorTreatmentButton"
|
||||||
android:textSize="10sp" />
|
android:textSize="10sp" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_wizardbutton"
|
android:id="@+id/overview_wizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -622,7 +622,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_quickwizardbutton"
|
android:id="@+id/overview_quickwizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
|
|
@ -691,7 +691,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_treatmentbutton"
|
android:id="@+id/overview_treatmentbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -705,7 +705,7 @@
|
||||||
android:textColor="@color/colorTreatmentButton"
|
android:textColor="@color/colorTreatmentButton"
|
||||||
android:textSize="10sp" />
|
android:textSize="10sp" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_wizardbutton"
|
android:id="@+id/overview_wizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -720,7 +720,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_calibrationbutton"
|
android:id="@+id/overview_calibrationbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -735,7 +735,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_quickwizardbutton"
|
android:id="@+id/overview_quickwizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
|
|
@ -360,7 +360,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_accepttempbutton"
|
android:id="@+id/overview_accepttempbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
@ -377,7 +377,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_treatmentbutton"
|
android:id="@+id/overview_treatmentbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -391,7 +391,7 @@
|
||||||
android:textColor="@color/colorTreatmentButton"
|
android:textColor="@color/colorTreatmentButton"
|
||||||
android:textSize="10sp" />
|
android:textSize="10sp" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_wizardbutton"
|
android:id="@+id/overview_wizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -406,7 +406,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_calibrationbutton"
|
android:id="@+id/overview_calibrationbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
@ -421,7 +421,7 @@
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<info.nightscout.utils.SingleClickButton
|
||||||
android:id="@+id/overview_quickwizardbutton"
|
android:id="@+id/overview_quickwizardbutton"
|
||||||
style="?android:attr/buttonStyle"
|
style="?android:attr/buttonStyle"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
|
|
|
@ -8,6 +8,14 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="10dp">
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:text="@string/virtualpump_extendedbolus_label"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/careportal_newnstreatment_insulin_layout"
|
android:id="@+id/careportal_newnstreatment_insulin_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -791,6 +791,7 @@
|
||||||
<string name="key_dexcomg5_xdripupload" translatable="false">dexcomg5_xdripupload</string>
|
<string name="key_dexcomg5_xdripupload" translatable="false">dexcomg5_xdripupload</string>
|
||||||
<string name="dexcomg5_xdripupload_summary">In xDrip+ select 640g/Eversense data source</string>
|
<string name="dexcomg5_xdripupload_summary">In xDrip+ select 640g/Eversense data source</string>
|
||||||
<string name="nsclientbg">NSClient BG</string>
|
<string name="nsclientbg">NSClient BG</string>
|
||||||
|
<string name="minimalbasalvaluereplaced">Basal value replaced by minimal supported value</string>
|
||||||
<string name="bolusstopping">Stopping bolus delivery</string>
|
<string name="bolusstopping">Stopping bolus delivery</string>
|
||||||
<string name="bolusstopped">Bolus delivery stopped</string>
|
<string name="bolusstopped">Bolus delivery stopped</string>
|
||||||
<string name="combo_programming_bolus">Programming pump for bolusing</string>
|
<string name="combo_programming_bolus">Programming pump for bolusing</string>
|
||||||
|
|
|
@ -3,7 +3,9 @@ package info.nightscout.utils;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 20.11.2017.
|
* Created by mike on 20.11.2017.
|
||||||
|
@ -20,7 +22,12 @@ public class DateUtilTest {
|
||||||
assertEquals(1511124634417L, DateUtil.fromISODateString("2017-11-19T22:50:34.417+0200").getTime());
|
assertEquals(1511124634417L, DateUtil.fromISODateString("2017-11-19T22:50:34.417+0200").getTime());
|
||||||
assertEquals(1511124634000L, DateUtil.fromISODateString("2017-11-19T22:50:34+0200").getTime());
|
assertEquals(1511124634000L, DateUtil.fromISODateString("2017-11-19T22:50:34+0200").getTime());
|
||||||
assertEquals(1512317365000L, DateUtil.fromISODateString("2017-12-03T16:09:25.000Z").getTime());
|
assertEquals(1512317365000L, DateUtil.fromISODateString("2017-12-03T16:09:25.000Z").getTime());
|
||||||
|
assertEquals(1513902750000L, DateUtil.fromISODateString("2017-12-22T00:32:30Z").getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void toISOStringTest() throws Exception {
|
||||||
|
assertEquals("2017-12-22T00:32:30Z", DateUtil.toISOString(new Date(1513902750000L)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package info.nightscout.utils;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mike on 22.12.2017.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PercentageSplitterTest {
|
||||||
|
public PercentageSplitterTest() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void pureNameTest() throws Exception {
|
||||||
|
assertEquals("Fiasp", PercentageSplitter.pureName("Fiasp(101%)"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue