Merge remote-tracking branch 'origin/dev' into combo-dev-merge
* origin/dev: Don't overlap time ticks with current time history browser chart selection Insulin button: allow negative presets, fix adding TT insulin. Overview: symetric spacing. Carbs button: send carbs to pump if pump supports carbs. Carbs button: fix visibility pref, input type, allow negative increments. Smallscreen fix chart menu 4 chart menu 3 chart menu 2 chart menu 1 # Conflicts: # app/src/main/res/values/strings.xml
This commit is contained in:
commit
612fc09e52
|
@ -2,10 +2,16 @@ package info.nightscout.androidaps;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.jjoe64.graphview.GraphView;
|
||||
|
@ -26,6 +32,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
|||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphData.GraphData;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
@ -34,6 +41,13 @@ import info.nightscout.utils.SP;
|
|||
public class HistoryBrowseActivity extends AppCompatActivity {
|
||||
private static Logger log = LoggerFactory.getLogger(HistoryBrowseActivity.class);
|
||||
|
||||
|
||||
ImageButton chartButton;
|
||||
|
||||
boolean showBasal = true;
|
||||
boolean showIob, showCob, showDev, showRat;
|
||||
|
||||
|
||||
@BindView(R.id.historybrowse_date)
|
||||
Button buttonDate;
|
||||
@BindView(R.id.historybrowse_zoom)
|
||||
|
@ -45,19 +59,6 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
|||
@BindView(R.id.historybrowse_seekBar)
|
||||
SeekBar seekBar;
|
||||
|
||||
@BindView(R.id.overview_showprediction)
|
||||
CheckBox showPredictionCheckbox;
|
||||
@BindView(R.id.overview_showbasals)
|
||||
CheckBox showBasalsCheckbox;
|
||||
@BindView(R.id.overview_showiob)
|
||||
CheckBox showIobCheckbox;
|
||||
@BindView(R.id.overview_showcob)
|
||||
CheckBox showCobCheckbox;
|
||||
@BindView(R.id.overview_showdeviations)
|
||||
CheckBox showDeviationsCheckbox;
|
||||
@BindView(R.id.overview_showratios)
|
||||
CheckBox showRatiosCheckbox;
|
||||
|
||||
private int rangeToDisplay = 24; // for graph
|
||||
private long start;
|
||||
|
||||
|
@ -85,6 +86,8 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
|||
iobGraph.getGridLabelRenderer().setLabelVerticalWidth(50);
|
||||
iobGraph.getGridLabelRenderer().setNumVerticalLabels(5);
|
||||
|
||||
setupChartMenu();
|
||||
|
||||
// set start of current day
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
|
@ -162,15 +165,6 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
|||
void onClickDate() {
|
||||
}
|
||||
|
||||
@OnClick({R.id.overview_showbasals, R.id.overview_showprediction, R.id.overview_showiob, R.id.overview_showcob, R.id.overview_showdeviations, R.id.overview_showratios})
|
||||
void onClickDate(View view) {
|
||||
//((CheckBox) view).toggle();
|
||||
updateGUI("checkboxToggle");
|
||||
iobCobCalculatorPlugin.clearCache();
|
||||
iobCobCalculatorPlugin.runCalculation("onClickDate", start, true, eventCustomCalculationFinished);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventAutosensCalculationFinished e) {
|
||||
Activity activity = this;
|
||||
|
@ -247,7 +241,7 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
|||
graphData.addTreatments(fromTime, toTime);
|
||||
|
||||
// add basal data
|
||||
if (pump.getPumpDescription().isTempBasalCapable && showBasalsCheckbox.isChecked()) {
|
||||
if (pump.getPumpDescription().isTempBasalCapable && showBasal) {
|
||||
graphData.addBasals(fromTime, toTime, lowLine / graphData.maxY / 1.2d);
|
||||
}
|
||||
|
||||
|
@ -263,23 +257,23 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
|||
boolean useDevForScale = false;
|
||||
boolean useRatioForScale = false;
|
||||
|
||||
if (showIobCheckbox.isChecked()) {
|
||||
if (showIob) {
|
||||
useIobForScale = true;
|
||||
} else if (showCobCheckbox.isChecked()) {
|
||||
} else if (showCob) {
|
||||
useCobForScale = true;
|
||||
} else if (showDeviationsCheckbox.isChecked()) {
|
||||
} else if (showDev) {
|
||||
useDevForScale = true;
|
||||
} else if (showRatiosCheckbox.isChecked()) {
|
||||
} else if (showRat) {
|
||||
useRatioForScale = true;
|
||||
}
|
||||
|
||||
if (showIobCheckbox.isChecked())
|
||||
if (showIob)
|
||||
secondGraphData.addIob(fromTime, toTime, useIobForScale, 1d);
|
||||
if (showCobCheckbox.isChecked())
|
||||
if (showCob)
|
||||
secondGraphData.addCob(fromTime, toTime, useCobForScale, useCobForScale ? 1d : 0.5d);
|
||||
if (showDeviationsCheckbox.isChecked())
|
||||
if (showDev)
|
||||
secondGraphData.addDeviations(fromTime, toTime, useDevForScale, 1d);
|
||||
if (showRatiosCheckbox.isChecked())
|
||||
if (showRat)
|
||||
secondGraphData.addRatio(fromTime, toTime, useRatioForScale, 1d);
|
||||
|
||||
// **** NOW line ****
|
||||
|
@ -288,7 +282,7 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
|||
secondGraphData.addNowLine(pointer);
|
||||
|
||||
// do GUI update
|
||||
if (showIobCheckbox.isChecked() || showCobCheckbox.isChecked() || showDeviationsCheckbox.isChecked() || showRatiosCheckbox.isChecked()) {
|
||||
if (showIob || showCob || showDev || showRat) {
|
||||
iobGraph.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iobGraph.setVisibility(View.GONE);
|
||||
|
@ -297,4 +291,90 @@ public class HistoryBrowseActivity extends AppCompatActivity {
|
|||
graphData.performUpdate();
|
||||
secondGraphData.performUpdate();
|
||||
}
|
||||
|
||||
private void setupChartMenu() {
|
||||
chartButton = (ImageButton) findViewById(R.id.overview_chartMenuButton);
|
||||
chartButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MenuItem item;
|
||||
CharSequence title;
|
||||
SpannableString s;
|
||||
PopupMenu popup = new PopupMenu(v.getContext(), v);
|
||||
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, OverviewFragment.CHARTTYPE.BAS.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_basals));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.basal, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(showBasal);
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, OverviewFragment.CHARTTYPE.IOB.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_iob));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.iob, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(showIob);
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, OverviewFragment.CHARTTYPE.COB.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_cob));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.cob, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(showCob);
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, OverviewFragment.CHARTTYPE.DEV.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_deviations));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.deviations, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(showDev);
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, OverviewFragment.CHARTTYPE.SEN.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_sensitivity));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.ratio, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(showRat);
|
||||
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
if (item.getItemId() == OverviewFragment.CHARTTYPE.BAS.ordinal()) {
|
||||
showBasal = !item.isChecked();
|
||||
|
||||
} else if (item.getItemId() == OverviewFragment.CHARTTYPE.IOB.ordinal()) {
|
||||
showIob = !item.isChecked();
|
||||
|
||||
} else if (item.getItemId() == OverviewFragment.CHARTTYPE.COB.ordinal()) {
|
||||
showCob = !item.isChecked();
|
||||
|
||||
} else if (item.getItemId() == OverviewFragment.CHARTTYPE.DEV.ordinal()) {
|
||||
showDev = !item.isChecked();
|
||||
|
||||
} else if (item.getItemId() == OverviewFragment.CHARTTYPE.SEN.ordinal()) {
|
||||
showRat = !item.isChecked();
|
||||
}
|
||||
updateGUI("onGraphCheckboxesCheckedChanged");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
chartButton.setImageResource(R.drawable.ic_arrow_drop_up_white_24dp);
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu menu) {
|
||||
chartButton.setImageResource(R.drawable.ic_arrow_drop_down_white_24dp);
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.HandlerThread;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
|
@ -53,7 +54,6 @@ import info.nightscout.utils.ToastUtils;
|
|||
public class NewCarbsDialog extends DialogFragment implements OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
|
||||
private static Logger log = LoggerFactory.getLogger(NewCarbsDialog.class);
|
||||
|
||||
private EditText foodText;
|
||||
private NumberPicker editCarbs;
|
||||
|
||||
private TextView dateButton;
|
||||
|
@ -66,9 +66,9 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
private Button fav2Button;
|
||||
private Button fav3Button;
|
||||
|
||||
private static final double FAV1_DEFAULT = 5;
|
||||
private static final double FAV2_DEFAULT = 10;
|
||||
private static final double FAV3_DEFAULT = 20;
|
||||
private static final int FAV1_DEFAULT = 5;
|
||||
private static final int FAV2_DEFAULT = 10;
|
||||
private static final int FAV3_DEFAULT = 20;
|
||||
private CheckBox suspendLoopCheckbox;
|
||||
private CheckBox startActivityTTCheckbox;
|
||||
private CheckBox startEatingSoonTTCheckbox;
|
||||
|
@ -120,8 +120,6 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
|
||||
maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||
|
||||
foodText = view.findViewById(R.id.newcarb_food);
|
||||
|
||||
editCarbs = view.findViewById(R.id.newcarb_carbsamount);
|
||||
|
||||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||
|
@ -143,22 +141,17 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
startEatingSoonTTCheckbox.setOnClickListener(this);
|
||||
startActivityTTCheckbox.setOnClickListener(this);
|
||||
|
||||
// TODO prefilling carbs, maybe
|
||||
// TODO maybe update suggested carbs to target TT when checked
|
||||
// APSResult lastAPSResult = ConfigBuilderPlugin.getActiveAPS().getLastAPSResult();
|
||||
// if (lastAPSResult != null && lastAPSResult instanceof DetermineBasalResultSMB && ((DetermineBasalResultSMB) lastAPSResult).carbsReq > 0) {
|
||||
// editCarbs.setValue(((DetermineBasalResultSMB) lastAPSResult).carbsReq);
|
||||
// }
|
||||
|
||||
fav1Button = view.findViewById(R.id.newcarbs_plus1);
|
||||
fav1Button.setOnClickListener(this);
|
||||
fav1Button.setText("+" + SP.getString(R.string.key_carbs_button_increment_1, String.valueOf(FAV1_DEFAULT)));
|
||||
fav1Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT)));
|
||||
|
||||
fav2Button = view.findViewById(R.id.newcarbs_plus2);
|
||||
fav2Button.setOnClickListener(this);
|
||||
fav2Button.setText("+" + SP.getString(R.string.key_carbs_button_increment_2, String.valueOf(FAV2_DEFAULT)));
|
||||
fav2Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT)));
|
||||
|
||||
fav3Button = view.findViewById(R.id.newcarbs_plus3);
|
||||
fav3Button.setOnClickListener(this);
|
||||
fav3Button.setText("+" + SP.getString(R.string.key_carbs_button_increment_3, String.valueOf(FAV3_DEFAULT)));
|
||||
fav3Button.setText(toSignedString(SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT)));
|
||||
|
||||
suspendLoopCheckbox = view.findViewById(R.id.newcarbs_suspend_loop);
|
||||
|
||||
|
@ -167,6 +160,10 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
return view;
|
||||
}
|
||||
|
||||
private String toSignedString(int value) {
|
||||
return value > 0 ? "+" + value : String.valueOf(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onClick(View view) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
@ -201,18 +198,18 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
tpd.show(getActivity().getFragmentManager(), "Timepickerdialog");
|
||||
break;
|
||||
case R.id.newcarbs_plus1:
|
||||
editCarbs.setValue(editCarbs.getValue()
|
||||
+ SP.getDouble(R.string.key_carbs_button_increment_1, FAV1_DEFAULT));
|
||||
editCarbs.setValue(Math.max(0, editCarbs.getValue()
|
||||
+ SP.getInt(R.string.key_carbs_button_increment_1, FAV1_DEFAULT)));
|
||||
validateInputs();
|
||||
break;
|
||||
case R.id.newcarbs_plus2:
|
||||
editCarbs.setValue(editCarbs.getValue()
|
||||
+ SP.getDouble(R.string.key_carbs_button_increment_2, FAV2_DEFAULT));
|
||||
editCarbs.setValue(Math.max(0, editCarbs.getValue()
|
||||
+ SP.getInt(R.string.key_carbs_button_increment_2, FAV2_DEFAULT)));
|
||||
validateInputs();
|
||||
break;
|
||||
case R.id.newcarbs_plus3:
|
||||
editCarbs.setValue(editCarbs.getValue()
|
||||
+ SP.getDouble(R.string.key_carbs_button_increment_3, FAV3_DEFAULT));
|
||||
editCarbs.setValue(Math.max(0, editCarbs.getValue()
|
||||
+ SP.getInt(R.string.key_carbs_button_increment_3, FAV3_DEFAULT)));
|
||||
validateInputs();
|
||||
break;
|
||||
case R.id.newcarbs_activity_tt:
|
||||
|
@ -233,7 +230,6 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
}
|
||||
okClicked = true;
|
||||
try {
|
||||
final String food = StringUtils.trimToNull(foodText.getText().toString());
|
||||
final Integer carbs = SafeParse.stringToInt(editCarbs.getText());
|
||||
Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(carbs);
|
||||
|
||||
|
@ -279,10 +275,6 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
final int finalActivityTTDuration = activityTTDuration;
|
||||
final int finalEatingSoonTTDuration = eatingSoonTTDuration;
|
||||
|
||||
if (StringUtils.isNoneEmpty(food)) {
|
||||
confirmMessage += "<br/>" + "Food: " + food;
|
||||
}
|
||||
|
||||
if (!initialEventTime.equals(eventTime)) {
|
||||
confirmMessage += "<br/> Time: " + DateUtil.dateAndTimeString(eventTime);
|
||||
}
|
||||
|
@ -339,15 +331,30 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
MainApp.getDbHelper().createOrUpdate(tempTarget);
|
||||
}
|
||||
|
||||
if (finalCarbsAfterConstraints > 0 || food != null) {
|
||||
if (finalCarbsAfterConstraints > 0) {
|
||||
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
||||
detailedBolusInfo.date = eventTime.getTime();
|
||||
detailedBolusInfo.eventType = CareportalEvent.CARBCORRECTION;
|
||||
detailedBolusInfo.carbs = finalCarbsAfterConstraints;
|
||||
// detailedBolusInfo.food = food;
|
||||
detailedBolusInfo.context = context;
|
||||
detailedBolusInfo.source = Source.USER;
|
||||
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
|
||||
if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) {
|
||||
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!result.success) {
|
||||
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", result.comment);
|
||||
i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
MainApp.instance().startActivity(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -134,25 +134,28 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
|
|||
dateButton.setOnClickListener(this);
|
||||
timeButton.setOnClickListener(this);
|
||||
|
||||
/*
|
||||
// This makes it to easy to just bolus insulinReq, which is almost always too much
|
||||
APSResult lastAPSResult = ConfigBuilderPlugin.getActiveAPS().getLastAPSResult();
|
||||
if (lastAPSResult != null && lastAPSResult instanceof DetermineBasalResultSMB && ((DetermineBasalResultSMB) lastAPSResult).insulinReq > 0) {
|
||||
editInsulin.setValue(((DetermineBasalResultSMB )lastAPSResult).insulinReq);
|
||||
}
|
||||
*/
|
||||
|
||||
plus1Button = (Button) view.findViewById(R.id.newinsulin_plus05);
|
||||
plus1Button.setOnClickListener(this);
|
||||
plus1Button.setText("+" + SP.getString(MainApp.gs(R.string.key_insulin_button_increment_1), String.valueOf(PLUS1_DEFAULT)));
|
||||
plus1Button.setText(toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT)));
|
||||
plus2Button = (Button) view.findViewById(R.id.newinsulin_plus10);
|
||||
plus2Button.setOnClickListener(this);
|
||||
plus2Button.setText("+" + SP.getString(MainApp.gs(R.string.key_insulin_button_increment_2), String.valueOf(PLUS2_DEFAULT)));
|
||||
plus2Button.setText(toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT)));
|
||||
plus3Button = (Button) view.findViewById(R.id.newinsulin_plus20);
|
||||
plus3Button.setOnClickListener(this);
|
||||
plus3Button.setText("+" + SP.getString(MainApp.gs(R.string.key_insulin_button_increment_3), String.valueOf(PLUS3_DEFAULT)));
|
||||
plus3Button.setText(toSignedString(SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT)));
|
||||
|
||||
startESMCheckbox = (CheckBox) view.findViewById(R.id.newinsulin_start_eating_soon_tt);
|
||||
startESMCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
if (profile != null) {
|
||||
double tt = SP.getDouble(MainApp.gs(R.string.key_eatingsoon_target), 0d);
|
||||
if (tt > 0) {
|
||||
double ttBgAdd = (profile.getTargetLow() - tt) / profile.getIsf();
|
||||
editInsulin.setValue(editInsulin.getValue() + (isChecked ? ttBgAdd : -ttBgAdd));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newinsulin_record_only);
|
||||
recordOnlyCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (dateButton != null) dateButton.setEnabled(isChecked);
|
||||
|
@ -164,6 +167,10 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
|
|||
return view;
|
||||
}
|
||||
|
||||
private String toSignedString(double value) {
|
||||
return value > 0 ? "+" + value : String.valueOf(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onClick(View view) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
@ -197,25 +204,19 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
|
|||
tpd.dismissOnPause(true);
|
||||
tpd.show(getActivity().getFragmentManager(), "Timepickerdialog");
|
||||
break;
|
||||
case R.id.newinsulin_start_eating_soon_tt:
|
||||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
double tt = SP.getDouble(R.string.key_eatingsoon_target, 0d);
|
||||
double ttBgAdd = (tt - profile.getTargetLow()) / profile.getIsf();
|
||||
editInsulin.setValue(editInsulin.getValue() + (startESMCheckbox.isChecked() ? ttBgAdd : -ttBgAdd));
|
||||
break;
|
||||
case R.id.newinsulin_plus05:
|
||||
editInsulin.setValue(editInsulin.getValue()
|
||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT));
|
||||
editInsulin.setValue(Math.max(0, editInsulin.getValue()
|
||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_1), PLUS1_DEFAULT)));
|
||||
validateInputs();
|
||||
break;
|
||||
case R.id.newinsulin_plus10:
|
||||
editInsulin.setValue(editInsulin.getValue()
|
||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT));
|
||||
editInsulin.setValue(Math.max(0, editInsulin.getValue()
|
||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_2), PLUS2_DEFAULT)));
|
||||
validateInputs();
|
||||
break;
|
||||
case R.id.newinsulin_plus20:
|
||||
editInsulin.setValue(editInsulin.getValue()
|
||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT));
|
||||
editInsulin.setValue(Math.max(0, editInsulin.getValue()
|
||||
+ SP.getDouble(MainApp.gs(R.string.key_insulin_button_increment_3), PLUS3_DEFAULT)));
|
||||
validateInputs();
|
||||
break;
|
||||
}
|
||||
|
@ -242,18 +243,20 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
|
|||
|
||||
if (!insulinAfterConstraints.equals(insulin))
|
||||
confirmMessage += "<br/><font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + MainApp.gs(R.string.bolusconstraintapplied) + "</font>";
|
||||
|
||||
double prefTTDuration = SP.getDouble(R.string.key_eatingsoon_duration, 45d);
|
||||
double ttDuration = prefTTDuration > 0 ? prefTTDuration : 45d;
|
||||
double prefTT = SP.getDouble(R.string.key_eatingsoon_target, 80d);
|
||||
double tt = prefTT > 0 ? prefTT : 80d;
|
||||
Profile currentProfile = MainApp.getConfigBuilder().getProfile();
|
||||
if(currentProfile == null)
|
||||
return;
|
||||
double tt;
|
||||
if(currentProfile.getUnits().equals(Constants.MMOL))
|
||||
tt = prefTT > 0 ? Profile.toMgdl(prefTT, Constants.MMOL) : 80d;
|
||||
else
|
||||
tt = prefTT > 0 ? prefTT : 80d;
|
||||
final double finalTT = tt;
|
||||
|
||||
if (startESMCheckbox.isChecked()) {
|
||||
if(currentProfile.getUnits().equals("mmol")){
|
||||
confirmMessage += "<br/>" + "TT: " + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + Profile.toMmol(tt, Constants.MGDL) + " mmol for " + ((int) ttDuration) + " min </font>";
|
||||
|
|
|
@ -16,21 +16,27 @@ import android.support.v4.app.Fragment;
|
|||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.res.ResourcesCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -120,7 +126,7 @@ import info.nightscout.utils.SP;
|
|||
import info.nightscout.utils.SingleClickButton;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class OverviewFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener, View.OnLongClickListener {
|
||||
public class OverviewFragment extends Fragment implements View.OnClickListener, View.OnLongClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(OverviewFragment.class);
|
||||
|
||||
TextView timeView;
|
||||
|
@ -144,25 +150,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
LinearLayout pumpStatusLayout;
|
||||
GraphView bgGraph;
|
||||
GraphView iobGraph;
|
||||
ImageButton chartButton;
|
||||
|
||||
TextView iage;
|
||||
TextView cage;
|
||||
TextView sage;
|
||||
TextView pbage;
|
||||
|
||||
TextView showPredictionLabel;
|
||||
CheckBox showPredictionCheckbox;
|
||||
TextView showBasalsLabel;
|
||||
CheckBox showBasalsCheckbox;
|
||||
TextView showIobLabel;
|
||||
CheckBox showIobCheckbox;
|
||||
TextView showCobLabel;
|
||||
CheckBox showCobCheckbox;
|
||||
TextView showDeviationsLabel;
|
||||
CheckBox showDeviationsCheckbox;
|
||||
TextView showRatiosLabel;
|
||||
CheckBox showRatiosCheckbox;
|
||||
|
||||
RecyclerView notificationsView;
|
||||
LinearLayoutManager llm;
|
||||
|
||||
|
@ -193,6 +187,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
final Object updateSync = new Object();
|
||||
|
||||
public enum CHARTTYPE {PRE,BAS, IOB, COB, DEV, SEN};
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledUpdate = null;
|
||||
|
||||
|
@ -286,38 +281,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
acceptTempLayout = (LinearLayout) view.findViewById(R.id.overview_accepttemplayout);
|
||||
|
||||
showPredictionCheckbox = (CheckBox) view.findViewById(R.id.overview_showprediction);
|
||||
showBasalsCheckbox = (CheckBox) view.findViewById(R.id.overview_showbasals);
|
||||
showIobCheckbox = (CheckBox) view.findViewById(R.id.overview_showiob);
|
||||
showCobCheckbox = (CheckBox) view.findViewById(R.id.overview_showcob);
|
||||
showDeviationsCheckbox = (CheckBox) view.findViewById(R.id.overview_showdeviations);
|
||||
showRatiosCheckbox = (CheckBox) view.findViewById(R.id.overview_showratios);
|
||||
showPredictionCheckbox.setChecked(SP.getBoolean("showprediction", false));
|
||||
showBasalsCheckbox.setChecked(SP.getBoolean("showbasals", true));
|
||||
showIobCheckbox.setChecked(SP.getBoolean("showiob", false));
|
||||
showCobCheckbox.setChecked(SP.getBoolean("showcob", false));
|
||||
showDeviationsCheckbox.setChecked(SP.getBoolean("showdeviations", false));
|
||||
showRatiosCheckbox.setChecked(SP.getBoolean("showratios", false));
|
||||
showPredictionCheckbox.setOnCheckedChangeListener(this);
|
||||
showBasalsCheckbox.setOnCheckedChangeListener(this);
|
||||
showIobCheckbox.setOnCheckedChangeListener(this);
|
||||
showCobCheckbox.setOnCheckedChangeListener(this);
|
||||
showDeviationsCheckbox.setOnCheckedChangeListener(this);
|
||||
showRatiosCheckbox.setOnCheckedChangeListener(this);
|
||||
|
||||
showPredictionLabel = (TextView) view.findViewById(R.id.overview_showprediction_label);
|
||||
showPredictionLabel.setOnClickListener(this);
|
||||
showBasalsLabel = (TextView) view.findViewById(R.id.overview_showbasals_label);
|
||||
showBasalsLabel.setOnClickListener(this);
|
||||
showIobLabel = (TextView) view.findViewById(R.id.overview_showiob_label);
|
||||
showIobLabel.setOnClickListener(this);
|
||||
showCobLabel = (TextView) view.findViewById(R.id.overview_showcob_label);
|
||||
showCobLabel.setOnClickListener(this);
|
||||
showDeviationsLabel = (TextView) view.findViewById(R.id.overview_showdeviations_label);
|
||||
showDeviationsLabel.setOnClickListener(this);
|
||||
showRatiosLabel = (TextView) view.findViewById(R.id.overview_showratios_label);
|
||||
showRatiosLabel.setOnClickListener(this);
|
||||
|
||||
notificationsView = (RecyclerView) view.findViewById(R.id.overview_notifications);
|
||||
notificationsView.setHasFixedSize(true);
|
||||
llm = new LinearLayoutManager(view.getContext());
|
||||
|
@ -345,6 +308,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
});
|
||||
|
||||
setupChartMenu(view);
|
||||
|
||||
lockScreen = (CheckBox) view.findViewById(R.id.overview_lockscreen);
|
||||
if (lockScreen != null) {
|
||||
lockScreen.setChecked(SP.getBoolean("lockscreen", false));
|
||||
|
@ -366,6 +331,106 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
return null;
|
||||
}
|
||||
|
||||
private void setupChartMenu(View view) {
|
||||
chartButton = (ImageButton) view.findViewById(R.id.overview_chartMenuButton);
|
||||
chartButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
|
||||
final boolean predictionsAvailable = finalLastRun != null && finalLastRun.request.hasPredictions;
|
||||
|
||||
MenuItem item;
|
||||
CharSequence title;
|
||||
SpannableString s;
|
||||
PopupMenu popup = new PopupMenu(v.getContext(), v);
|
||||
|
||||
if(predictionsAvailable) {
|
||||
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.PRE.ordinal(), Menu.NONE, "Predictions");
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.prediction, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(SP.getBoolean("showprediction", true));
|
||||
}
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.BAS.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_basals));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.basal, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(SP.getBoolean("showbasals", true));
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.IOB.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_iob));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.iob, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(SP.getBoolean("showiob", true));
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.COB.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_cob));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.cob, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(SP.getBoolean("showcob", true));
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.DEV.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_deviations));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.deviations, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(SP.getBoolean("showdeviations", false));
|
||||
|
||||
item = popup.getMenu().add(Menu.NONE, CHARTTYPE.SEN.ordinal(), Menu.NONE, MainApp.gs(R.string.overview_show_sensitivity));
|
||||
title = item.getTitle();
|
||||
s = new SpannableString(title);
|
||||
s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.ratio, null)), 0, s.length(), 0);
|
||||
item.setTitle(s);
|
||||
item.setCheckable(true);
|
||||
item.setChecked(SP.getBoolean("showratios", false));
|
||||
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
if (item.getItemId() == CHARTTYPE.PRE.ordinal()) {
|
||||
SP.putBoolean("showprediction", !item.isChecked());
|
||||
|
||||
} else if (item.getItemId() == CHARTTYPE.BAS.ordinal()) {
|
||||
SP.putBoolean("showbasals", !item.isChecked());
|
||||
|
||||
} else if (item.getItemId() == CHARTTYPE.IOB.ordinal()) {
|
||||
SP.putBoolean("showiob", !item.isChecked());
|
||||
|
||||
} else if (item.getItemId() == CHARTTYPE.COB.ordinal()) {
|
||||
SP.putBoolean("showcob", !item.isChecked());
|
||||
|
||||
} else if (item.getItemId() == CHARTTYPE.DEV.ordinal()) {
|
||||
SP.putBoolean("showdeviations", !item.isChecked());
|
||||
|
||||
} else if (item.getItemId() == CHARTTYPE.SEN.ordinal()) {
|
||||
SP.putBoolean("showratios", !item.isChecked());
|
||||
}
|
||||
scheduleUpdateGUI("onGraphCheckboxesCheckedChanged");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
chartButton.setImageResource(R.drawable.ic_arrow_drop_up_white_24dp);
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu menu) {
|
||||
chartButton.setImageResource(R.drawable.ic_arrow_drop_down_white_24dp);
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
|
@ -403,35 +468,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
switch (buttonView.getId()) {
|
||||
case R.id.overview_showprediction:
|
||||
case R.id.overview_showbasals:
|
||||
case R.id.overview_showiob:
|
||||
break;
|
||||
case R.id.overview_showcob:
|
||||
showDeviationsCheckbox.setOnCheckedChangeListener(null);
|
||||
showDeviationsCheckbox.setChecked(false);
|
||||
showDeviationsCheckbox.setOnCheckedChangeListener(this);
|
||||
break;
|
||||
case R.id.overview_showdeviations:
|
||||
showCobCheckbox.setOnCheckedChangeListener(null);
|
||||
showCobCheckbox.setChecked(false);
|
||||
showCobCheckbox.setOnCheckedChangeListener(this);
|
||||
break;
|
||||
case R.id.overview_showratios:
|
||||
break;
|
||||
}
|
||||
SP.putBoolean("showiob", showIobCheckbox.isChecked());
|
||||
SP.putBoolean("showprediction", showPredictionCheckbox.isChecked());
|
||||
SP.putBoolean("showbasals", showBasalsCheckbox.isChecked());
|
||||
SP.putBoolean("showcob", showCobCheckbox.isChecked());
|
||||
SP.putBoolean("showdeviations", showDeviationsCheckbox.isChecked());
|
||||
SP.putBoolean("showratios", showRatiosCheckbox.isChecked());
|
||||
scheduleUpdateGUI("onGraphCheckboxesCheckedChanged");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
|
@ -574,24 +610,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
if (ConfigBuilderPlugin.getActivePump().isSuspended() || !ConfigBuilderPlugin.getActivePump().isInitialized())
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("RefreshClicked", null);
|
||||
break;
|
||||
case R.id.overview_showprediction_label:
|
||||
showPredictionCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showbasals_label:
|
||||
showBasalsCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showiob_label:
|
||||
showIobCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showcob_label:
|
||||
showCobCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showdeviations_label:
|
||||
showDeviationsCheckbox.toggle();
|
||||
break;
|
||||
case R.id.overview_showratios_label:
|
||||
showRatiosCheckbox.toggle();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1183,8 +1201,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
// **** Various treatment buttons ****
|
||||
if (carbsButton != null) {
|
||||
if (SP.getBoolean(R.string.key_show_carbs_button, true)
|
||||
&& !ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo ||
|
||||
(pump.isInitialized() && !pump.isSuspended())) {
|
||||
&& (!ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo ||
|
||||
(pump.isInitialized() && !pump.isSuspended()))) {
|
||||
carbsButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
carbsButton.setVisibility(View.GONE);
|
||||
|
@ -1268,14 +1286,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
|
||||
final boolean predictionsAvailable = finalLastRun != null && finalLastRun.request.hasPredictions;
|
||||
if (predictionsAvailable) {
|
||||
showPredictionCheckbox.setVisibility(View.VISIBLE);
|
||||
showPredictionLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
showPredictionCheckbox.setVisibility(View.GONE);
|
||||
showPredictionLabel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// pump status from ns
|
||||
if (pumpDeviceStatusView != null) {
|
||||
pumpDeviceStatusView.setText(NSDeviceStatus.getInstance().getPumpStatus());
|
||||
|
@ -1326,7 +1336,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
final long toTime;
|
||||
final long fromTime;
|
||||
final long endTime;
|
||||
if (predictionsAvailable && showPredictionCheckbox.isChecked()) {
|
||||
if (predictionsAvailable && SP.getBoolean("showprediction", false)) {
|
||||
int predHours = (int) (Math.ceil(finalLastRun.constraintsProcessed.getLatestPredictionsTime() - System.currentTimeMillis()) / (60 * 60 * 1000));
|
||||
predHours = Math.min(2, predHours);
|
||||
predHours = Math.max(0, predHours);
|
||||
|
@ -1353,7 +1363,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
graphData.addInRangeArea(fromTime, endTime, lowLine, highLine);
|
||||
|
||||
// **** BG ****
|
||||
if (predictionsAvailable && showPredictionCheckbox.isChecked())
|
||||
if (predictionsAvailable && SP.getBoolean("showprediction", false))
|
||||
graphData.addBgReadings(fromTime, toTime, lowLine, highLine, finalLastRun.constraintsProcessed);
|
||||
else
|
||||
graphData.addBgReadings(fromTime, toTime, lowLine, highLine, null);
|
||||
|
@ -1365,7 +1375,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
graphData.addTreatments(fromTime, endTime);
|
||||
|
||||
// add basal data
|
||||
if (pump.getPumpDescription().isTempBasalCapable && showBasalsCheckbox.isChecked()) {
|
||||
if (pump.getPumpDescription().isTempBasalCapable && SP.getBoolean("showbasals", true)) {
|
||||
graphData.addBasals(fromTime, now, lowLine / graphData.maxY / 1.2d);
|
||||
}
|
||||
|
||||
|
@ -1386,25 +1396,25 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
boolean useRatioForScale = false;
|
||||
boolean useDSForScale = false;
|
||||
|
||||
if (showIobCheckbox.isChecked()) {
|
||||
if (SP.getBoolean("showiob", true)) {
|
||||
useIobForScale = true;
|
||||
} else if (showCobCheckbox.isChecked()) {
|
||||
} else if (SP.getBoolean("showcob", true)) {
|
||||
useCobForScale = true;
|
||||
} else if (showDeviationsCheckbox.isChecked()) {
|
||||
} else if (SP.getBoolean("showdeviations", false)) {
|
||||
useDevForScale = true;
|
||||
} else if (showRatiosCheckbox.isChecked()) {
|
||||
} else if (SP.getBoolean("showratios", false)) {
|
||||
useRatioForScale = true;
|
||||
} else if (Config.displayDeviationSlope) {
|
||||
useDSForScale = true;
|
||||
}
|
||||
|
||||
if (showIobCheckbox.isChecked())
|
||||
if (SP.getBoolean("showiob", true))
|
||||
secondGraphData.addIob(fromTime, now, useIobForScale, 1d);
|
||||
if (showCobCheckbox.isChecked())
|
||||
if (SP.getBoolean("showcob", true))
|
||||
secondGraphData.addCob(fromTime, now, useCobForScale, useCobForScale ? 1d : 0.5d);
|
||||
if (showDeviationsCheckbox.isChecked())
|
||||
if (SP.getBoolean("showdeviations", false))
|
||||
secondGraphData.addDeviations(fromTime, now, useDevForScale, 1d);
|
||||
if (showRatiosCheckbox.isChecked())
|
||||
if (SP.getBoolean("showratios", false))
|
||||
secondGraphData.addRatio(fromTime, now, useRatioForScale, 1d);
|
||||
if (Config.displayDeviationSlope)
|
||||
secondGraphData.addDeviationSlope(fromTime, now, useDSForScale, 1d);
|
||||
|
@ -1420,7 +1430,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showIobCheckbox.isChecked() || showCobCheckbox.isChecked() || showDeviationsCheckbox.isChecked() || showRatiosCheckbox.isChecked() || Config.displayDeviationSlope) {
|
||||
if (SP.getBoolean("showiob", true) || SP.getBoolean("showcob", true) || SP.getBoolean("showdeviations", false) || SP.getBoolean("showratios", false) || Config.displayDeviationSlope) {
|
||||
iobGraph.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
iobGraph.setVisibility(View.GONE);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M7,10l5,5 5,-5z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M7,14l5,-5 5,5z"/>
|
||||
</vector>
|
|
@ -56,116 +56,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showprediction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/prediction" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showprediction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/predictionshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/prediction"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showbasals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showbasals_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/basalshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/basal"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showiob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showiob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/iob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/cob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showcob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/cob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/cob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showdeviations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/deviations" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showdeviations_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/dev"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/deviations"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showratios"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showratios_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/ratio_short"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -176,11 +66,26 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/historyybrowse_bggraph"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/historyybrowse_bggraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/overview_chartMenuButton"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingTop="5dp"
|
||||
app:srcCompat="@drawable/ic_arrow_drop_down_white_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/historybrowse_iobgraph"
|
||||
|
|
|
@ -238,120 +238,27 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showprediction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:buttonTint="@color/prediction" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showprediction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/predictionshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/prediction"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showbasals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showbasals_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/basalshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/basal"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showiob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showiob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/iob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:buttonTint="@color/cob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showcob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/cob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/cob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showdeviations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:buttonTint="@color/deviations" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showdeviations_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/dev"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/deviations"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showratios"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showratios_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/ratio_short"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/overview_chartMenuButton"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingTop="5dp"
|
||||
app:srcCompat="@drawable/ic_arrow_drop_down_white_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_iobgraph"
|
||||
|
|
|
@ -467,125 +467,31 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showprediction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/prediction" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showprediction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/predictionshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/prediction"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showbasals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showbasals_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/basalshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/basal"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showiob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showiob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/iob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/cob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showcob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/cob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/cob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showdeviations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/deviations" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showdeviations_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/dev"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/deviations"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showratios"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showratios_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/ratio_short"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="160dip" />
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/overview_chartMenuButton"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingTop="5dp"
|
||||
app:srcCompat="@drawable/ic_arrow_drop_down_white_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_iobgraph"
|
||||
|
@ -597,6 +503,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
|
|
|
@ -551,116 +551,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showprediction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/prediction" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showprediction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/predictionshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/prediction"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showbasals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showbasals_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/basalshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/basal"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showiob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showiob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/iob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/cob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showcob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/cob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/cob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showdeviations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/deviations" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showdeviations_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/dev"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/deviations"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showratios"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showratios_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/ratio_short"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/overview_graphs_layout"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -668,11 +558,26 @@
|
|||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/overview_chartMenuButton"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingTop="5dp"
|
||||
app:srcCompat="@drawable/ic_arrow_drop_down_white_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_iobgraph"
|
||||
|
@ -695,6 +600,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
|
|
|
@ -232,130 +232,35 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showprediction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/prediction" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showprediction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/predictionshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/prediction"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showbasals"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/basal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showbasals_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/basalshortlabel"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/basal"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showiob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/iob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showiob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/iob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/iob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showcob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/cob" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showcob_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/cob"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/cob"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showdeviations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:buttonTint="@color/deviations" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showdeviations_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/dev"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@color/deviations"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/overview_showratios"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_showratios_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/ratio_short"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="160dip" />
|
||||
android:layout_height="200dp">
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_bggraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/overview_chartMenuButton"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:paddingTop="5dp"
|
||||
app:srcCompat="@drawable/ic_arrow_drop_down_white_24dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
android:id="@+id/overview_iobgraph"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="100dp" />
|
||||
android:layout_height="150dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -380,6 +285,7 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="5dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
|
@ -394,9 +300,7 @@
|
|||
android:paddingRight="0dp"
|
||||
android:text="@string/overview_treatment_label"
|
||||
android:textColor="@color/colorTreatmentButton"
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
android:textSize="10sp" />
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_insulinbutton"
|
||||
|
@ -425,8 +329,7 @@
|
|||
android:paddingRight="0dp"
|
||||
android:text="@string/overview_carbs_label"
|
||||
android:textColor="@color/colorCarbsButton"
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone"/>
|
||||
android:textSize="10sp" />
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_wizardbutton"
|
||||
|
@ -470,8 +373,7 @@
|
|||
android:paddingRight="0dp"
|
||||
android:text="@string/overview_cgm"
|
||||
android:textColor="@color/colorCalibrationButton"
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone"/>
|
||||
android:textSize="10sp"/>
|
||||
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_quickwizardbutton"
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
android:id="@+id/carbs_eating_soon_tt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/start_eating_soon_tt" />
|
||||
|
||||
<CheckBox
|
||||
|
@ -76,15 +75,6 @@
|
|||
android:text="08:20pm" />
|
||||
</LinearLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/newcarb_food"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="180dp"
|
||||
android:inputType="text|textCapWords"
|
||||
android:visibility="gone" />
|
||||
|
||||
<info.nightscout.utils.NumberPicker
|
||||
android:id="@+id/newcarb_carbsamount"
|
||||
android:layout_width="130dp"
|
||||
|
|
|
@ -986,6 +986,11 @@
|
|||
<string name="ns_autobackfill">Autobackfill missig BGs from NS</string>
|
||||
<string name="key_ns_autobackfill" translatable="false">ns_autobackfill</string>
|
||||
<string name="loop_smbsetbypump_label">SMB set by pump</string>
|
||||
<string name="overview_show_sensitivity">Sensitivity</string>
|
||||
<string name="overview_show_deviations">Deviations</string>
|
||||
<string name="overview_show_cob">Carbs On Board</string>
|
||||
<string name="overview_show_iob">Insulin On Board</string>
|
||||
<string name="overview_show_basals">Basals</string>
|
||||
<string name="pump_basebasalrate">%.2f U/h</string>
|
||||
<string name="combo_actvity_reading_basal_profile">Reading basal profile</string>
|
||||
<string name="combo_bolus_rejected_due_to_pump_history_change">The pump history has changed after the bolus calculation was performed. The bolus was not delivered. Please recalculate if a bolus is still needed. If the same bolus amount is required, please wait two minutes since boluses with the same amount are blocked when requested with less than two minutes between them for safety (regardless of whether they were administered or not).</string>
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||
android:dependency="@string/key_show_insulin_button"
|
||||
validate:testType="floatNumericRange"
|
||||
validate:floatminNumber="0.1"
|
||||
validate:floatminNumber="-5.0"
|
||||
validate:floatmaxNumber="5.0"
|
||||
android:defaultValue="0.5"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:inputType="numberDecimal|numberDecimal|numberSigned"
|
||||
android:maxLines="20"
|
||||
android:title="First insulin increment"
|
||||
android:dialogMessage="@string/insulin_increment_button_message"
|
||||
|
@ -32,12 +32,12 @@
|
|||
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||
android:dependency="@string/key_show_insulin_button"
|
||||
validate:testType="floatNumericRange"
|
||||
validate:floatminNumber="0.1"
|
||||
validate:floatminNumber="-5.0"
|
||||
validate:floatmaxNumber="5.0"
|
||||
android:defaultValue="1.0"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:inputType="numberDecimal|numberSigned"
|
||||
android:maxLines="20"
|
||||
android:title="Second insulin increment"
|
||||
android:dialogMessage="@string/insulin_increment_button_message"
|
||||
|
@ -45,12 +45,12 @@
|
|||
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||
android:dependency="@string/key_show_insulin_button"
|
||||
validate:testType="floatNumericRange"
|
||||
validate:floatminNumber="0.1"
|
||||
validate:floatminNumber="-5.0"
|
||||
validate:floatmaxNumber="5.0"
|
||||
android:defaultValue="2.0"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:inputType="numberDecimal|numberSigned"
|
||||
android:maxLines="20"
|
||||
android:title="Third insulin increment"
|
||||
android:dialogMessage="@string/insulin_increment_button_message"
|
||||
|
@ -62,39 +62,39 @@
|
|||
android:title="Carbs" />
|
||||
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||
android:dependency="@string/key_show_carbs_button"
|
||||
validate:testType="numeric"
|
||||
validate:minNumber="1"
|
||||
validate:testType="numericRange"
|
||||
validate:minNumber="-50"
|
||||
validate:maxNumber="50"
|
||||
android:defaultValue="5"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:inputType="numberSigned"
|
||||
android:maxLines="20"
|
||||
android:title="First carbs increment"
|
||||
android:dialogMessage="@string/carb_increment_button_message"
|
||||
android:key="@string/key_carbs_button_increment_1" />
|
||||
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||
android:dependency="@string/key_show_carbs_button"
|
||||
validate:testType="numeric"
|
||||
validate:minNumber="1"
|
||||
validate:testType="numericRange"
|
||||
validate:minNumber="-50"
|
||||
validate:maxNumber="50"
|
||||
android:defaultValue="10"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:inputType="numberSigned"
|
||||
android:maxLines="20"
|
||||
android:title="Second carbs increment"
|
||||
android:dialogMessage="@string/carb_increment_button_message"
|
||||
android:key="@string/key_carbs_button_increment_2" />
|
||||
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||
android:dependency="@string/key_show_carbs_button"
|
||||
validate:testType="numeric"
|
||||
validate:minNumber="1"
|
||||
validate:testType="numericRange"
|
||||
validate:minNumber="-50"
|
||||
validate:maxNumber="50"
|
||||
android:defaultValue="20"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:inputType="numberSigned"
|
||||
android:maxLines="20"
|
||||
android:title="Third carbs increment"
|
||||
android:dialogMessage="@string/carb_increment_button_message"
|
||||
|
|
|
@ -452,7 +452,7 @@ public class BgGraphBuilder {
|
|||
|
||||
// add all full hours within the timeframe
|
||||
while (hourTick < end_time){
|
||||
if(Math.abs(hourTick - timeNow) > (1000 * 60 * 8 * timespan)){
|
||||
if(Math.abs(hourTick - timeNow) > (8 * (end_time-start_time)/60)){
|
||||
xAxisValues.add(new AxisValue(fuzz(hourTick)).setLabel(timeFormat.format(hourTick)));
|
||||
} else {
|
||||
//don't print hour label if too close to now to avoid overlaps
|
||||
|
|
Loading…
Reference in a new issue