Merge branch 'dev' into smb060

This commit is contained in:
Milos Kozak 2017-12-22 21:11:38 +01:00
commit 7380065bd9
24 changed files with 229 additions and 78 deletions

View file

@ -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);
} }

View file

@ -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);
@ -1598,6 +1599,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();

View file

@ -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);

View file

@ -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;
} }

View file

@ -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

View file

@ -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;
} }

View file

@ -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;
} }

View file

@ -757,6 +757,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);
} }

View file

@ -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;
} }

View file

@ -102,6 +102,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;
} }

View file

@ -251,6 +251,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;
} }

View file

@ -52,7 +52,6 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
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;
@ -112,6 +111,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 {
@ -155,11 +155,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;
@ -243,16 +243,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);
@ -319,6 +319,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;

View file

@ -56,6 +56,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;

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -799,5 +799,6 @@
<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>
</resources> </resources>

View file

@ -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%)"));
}
}