Merge remote-tracking branch 'origin/dev' into combo
* origin/dev: 1.5e Let CircadianPercentageProfileFragment inherit from SubscriberFragment. Fix after merge-conflict cleanup Files renamed Added icons for home, actions and care portal screens update bg translation synchronize interval access from other classes remove unnecessary semicolons spanish emptiy string remove extra strings self asignment -> comment string comparison Add color of chart to corresponding lables/scale Update InsulinFastactingProlongedFragment.java Update InsulinFastactingFragment.java Extract SubscriberFragment base class. Have most fragments update their content in onResume.
|
@ -44,7 +44,7 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 1500
|
||||
version "1.5d"
|
||||
version "1.5e"
|
||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class TempTarget implements Interval {
|
|||
return false;
|
||||
if (high != other.high)
|
||||
return false;
|
||||
if (reason != other.reason)
|
||||
if (!Objects.equals(reason, other.reason))
|
||||
return false;
|
||||
if (!Objects.equals(_id, other._id))
|
||||
return false;
|
||||
|
|
|
@ -31,11 +31,12 @@ import info.nightscout.androidaps.plugins.Actions.dialogs.NewTempBasalDialog;
|
|||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
*/
|
||||
public class ActionsFragment extends Fragment implements View.OnClickListener {
|
||||
public class ActionsFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
|
||||
static ActionsPlugin actionsPlugin = new ActionsPlugin();
|
||||
|
||||
|
@ -82,43 +83,32 @@ public class ActionsFragment extends Fragment implements View.OnClickListener {
|
|||
tempBasal.setOnClickListener(this);
|
||||
fill.setOnClickListener(this);
|
||||
|
||||
updateGUIIfVisible();
|
||||
updateGUI();
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventInitializationChanged ev) {
|
||||
updateGUIIfVisible();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventRefreshOverview ev) {
|
||||
updateGUIIfVisible();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventExtendedBolusChange ev) {
|
||||
updateGUIIfVisible();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTempBasalChange ev) {
|
||||
updateGUIIfVisible();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
void updateGUIIfVisible() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -19,9 +19,10 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.events.EventCareportalEventChange;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
|
||||
|
||||
public class CareportalFragment extends Fragment implements View.OnClickListener {
|
||||
public class CareportalFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
|
||||
static CareportalPlugin careportalPlugin;
|
||||
|
||||
|
@ -178,24 +179,13 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
|
|||
newDialog.show(manager, "NewNSTreatmentDialog");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventCareportalEventChange c) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
updateAge(activity, sage, iage, cage, pbage);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package info.nightscout.androidaps.plugins.Common;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
||||
abstract public class SubscriberFragment extends Fragment {
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
protected abstract void updateGUI();
|
||||
}
|
|
@ -83,7 +83,6 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
MainApp.bus().register(this);
|
||||
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
|
||||
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "ConfigBuilderPlugin");
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,6 +63,7 @@ public class ActivityGraph extends GraphView {
|
|||
getViewport().setMaxX(hours * 60);
|
||||
getGridLabelRenderer().setNumHorizontalLabels(hours + 1);
|
||||
getGridLabelRenderer().setHorizontalAxisTitle("[min]");
|
||||
getGridLabelRenderer().setVerticalLabelsColor(activitySeries.getColor());
|
||||
|
||||
DataPoint[] iobDataPoints = new DataPoint[iobArray.size()];
|
||||
iobDataPoints = iobArray.toArray(iobDataPoints);
|
||||
|
@ -72,5 +73,6 @@ public class ActivityGraph extends GraphView {
|
|||
iobSeries.setBackgroundColor(Color.argb(70, 255, 0, 255));
|
||||
getSecondScale().setMinY(0);
|
||||
getSecondScale().setMaxY(1);
|
||||
getGridLabelRenderer().setVerticalLabelsSecondScaleColor(Color.MAGENTA);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,12 +35,22 @@ public class InsulinFastactingFragment extends Fragment {
|
|||
insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
|
||||
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
|
||||
|
||||
insulinName.setText(insulinFastactingPlugin.getFriendlyName());
|
||||
insulinComment.setText(insulinFastactingPlugin.getComment());
|
||||
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingPlugin.getDia()).toString() + "h");
|
||||
insulinGraph.show(insulinFastactingPlugin);
|
||||
updateGUI();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
private void updateGUI() {
|
||||
insulinName.setText(insulinFastactingPlugin.getFriendlyName());
|
||||
insulinComment.setText(insulinFastactingPlugin.getComment());
|
||||
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingPlugin.getDia()).toString() + "h");
|
||||
insulinGraph.show(insulinFastactingPlugin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,12 +36,22 @@ public class InsulinFastactingProlongedFragment extends Fragment {
|
|||
insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
|
||||
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
|
||||
|
||||
insulinName.setText(insulinFastactingProlongedPlugin.getFriendlyName());
|
||||
insulinComment.setText(insulinFastactingProlongedPlugin.getComment());
|
||||
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingProlongedPlugin.getDia()).toString() + "h");
|
||||
insulinGraph.show(insulinFastactingProlongedPlugin);
|
||||
updateGUI();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
private void updateGUI() {
|
||||
insulinName.setText(insulinFastactingProlongedPlugin.getFriendlyName());
|
||||
insulinComment.setText(insulinFastactingProlongedPlugin.getComment());
|
||||
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinFastactingProlongedPlugin.getDia()).toString() + "h");
|
||||
insulinGraph.show(insulinFastactingProlongedPlugin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.Loop;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -19,10 +18,11 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui;
|
||||
import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui;
|
||||
|
||||
public class LoopFragment extends Fragment implements View.OnClickListener {
|
||||
public class LoopFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(LoopFragment.class);
|
||||
|
||||
private static LoopPlugin loopPlugin;
|
||||
|
@ -61,18 +61,6 @@ public class LoopFragment extends Fragment implements View.OnClickListener {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
|
@ -110,7 +98,8 @@ public class LoopFragment extends Fragment implements View.OnClickListener {
|
|||
}
|
||||
|
||||
|
||||
void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -28,12 +28,13 @@ import org.slf4j.LoggerFactory;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class NSClientInternalFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
||||
public class NSClientInternalFragment extends SubscriberFragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
||||
private static Logger log = LoggerFactory.getLogger(NSClientInternalFragment.class);
|
||||
|
||||
static NSClientInternalPlugin nsClientInternalPlugin;
|
||||
|
@ -150,25 +151,13 @@ public class NSClientInternalFragment extends Fragment implements View.OnClickLi
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNSClientUpdateGUI ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
private void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BroadcastStatus {
|
|||
bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
};
|
||||
}
|
||||
bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName);
|
||||
bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode);
|
||||
bundle.putString("status", status.getData().toString());
|
||||
|
|
|
@ -207,8 +207,6 @@ public class NSSettingsStatus {
|
|||
return ret;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
private Integer getIntegerOrNull(String key) {
|
||||
Integer ret = null;
|
||||
if (data.has(key)) {
|
||||
|
@ -221,8 +219,6 @@ public class NSSettingsStatus {
|
|||
return ret;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
private Long getLongOrNull(String key) {
|
||||
Long ret = null;
|
||||
if (data.has(key)) {
|
||||
|
@ -235,8 +231,6 @@ public class NSSettingsStatus {
|
|||
return ret;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
private Date getDateOrNull(String key) {
|
||||
Date ret = null;
|
||||
if (data.has(key)) {
|
||||
|
@ -249,8 +243,6 @@ public class NSSettingsStatus {
|
|||
return ret;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
private boolean getBooleanOrNull(String key) {
|
||||
boolean ret = false;
|
||||
if (data.has(key)) {
|
||||
|
|
|
@ -24,7 +24,7 @@ public class NSSgv {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
private Integer getIntegerOrNull(String key) {
|
||||
Integer ret = null;
|
||||
|
@ -36,7 +36,7 @@ public class NSSgv {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
private Long getLongOrNull(String key) {
|
||||
Long ret = null;
|
||||
|
@ -48,7 +48,7 @@ public class NSSgv {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
public JSONObject getData () { return data; }
|
||||
public Integer getMgdl () { return getIntegerOrNull("mgdl"); }
|
||||
|
|
|
@ -25,7 +25,7 @@ public class NSTreatment {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
private Double getDoubleOrNull(String key) {
|
||||
Double ret = null;
|
||||
|
@ -37,7 +37,7 @@ public class NSTreatment {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
private Integer getIntegerOrNull(String key) {
|
||||
Integer ret = null;
|
||||
|
@ -49,7 +49,7 @@ public class NSTreatment {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
private Long getLongOrNull(String key) {
|
||||
Long ret = null;
|
||||
|
@ -61,7 +61,7 @@ public class NSTreatment {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
private Date getDateOrNull(String key) {
|
||||
Date ret = null;
|
||||
|
@ -73,7 +73,7 @@ public class NSTreatment {
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
public String getAction() { return action; }
|
||||
public JSONObject getData() { return data; }
|
||||
|
|
|
@ -43,7 +43,7 @@ public class DetermineBasalResultAMA extends APSResult {
|
|||
}
|
||||
if (result.contains("duration")) {
|
||||
duration = result.getInteger("duration");
|
||||
changeRequested = changeRequested;
|
||||
//changeRequested as above
|
||||
} else {
|
||||
duration = -1;
|
||||
changeRequested = false;
|
||||
|
|
|
@ -20,11 +20,12 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
import info.nightscout.utils.JSONFormatter;
|
||||
|
||||
public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener {
|
||||
public class OpenAPSAMAFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(OpenAPSAMAFragment.class);
|
||||
|
||||
private static OpenAPSAMAPlugin openAPSAMAPlugin;
|
||||
|
@ -81,18 +82,6 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventOpenAPSUpdateGui ev) {
|
||||
updateGUI();
|
||||
|
@ -103,7 +92,8 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
|||
updateResultGUI(ev.text);
|
||||
}
|
||||
|
||||
void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DetermineBasalResultMA extends APSResult {
|
|||
}
|
||||
if (result.contains("duration")) {
|
||||
duration = result.getInteger("duration");
|
||||
changeRequested = changeRequested;
|
||||
//changeRequested as above
|
||||
} else {
|
||||
duration = -1;
|
||||
changeRequested = false;
|
||||
|
|
|
@ -18,11 +18,12 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
import info.nightscout.utils.JSONFormatter;
|
||||
|
||||
public class OpenAPSMAFragment extends Fragment implements View.OnClickListener {
|
||||
public class OpenAPSMAFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(OpenAPSMAFragment.class);
|
||||
|
||||
private static OpenAPSMAPlugin openAPSMAPlugin;
|
||||
|
@ -75,18 +76,6 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventOpenAPSUpdateGui ev) {
|
||||
updateGUI();
|
||||
|
@ -97,7 +86,8 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener
|
|||
updateResultGUI(ev.text);
|
||||
}
|
||||
|
||||
void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
@ -123,7 +113,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener
|
|||
});
|
||||
}
|
||||
|
||||
void updateResultGUI(final String text) {
|
||||
private void updateResultGUI(final String text) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -213,9 +213,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
bgTrendInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bgtrendinsulin);
|
||||
cobLayout = (LinearLayout) view.findViewById(R.id.treatments_wizard_cob_layout);
|
||||
cob = (TextView) view.findViewById(R.id.treatments_wizard_cob);
|
||||
;
|
||||
cobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_cobinsulin);
|
||||
;
|
||||
|
||||
bgCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_bgcheckbox);
|
||||
bolusIobCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_bolusiobcheckbox);
|
||||
|
|
|
@ -39,10 +39,11 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
|||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
||||
public class CircadianPercentageProfileFragment extends Fragment {
|
||||
public class CircadianPercentageProfileFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfileFragment.class);
|
||||
|
||||
private static CircadianPercentageProfilePlugin circadianPercentageProfilePlugin = new CircadianPercentageProfilePlugin();
|
||||
|
@ -309,16 +310,14 @@ public class CircadianPercentageProfileFragment extends Fragment {
|
|||
percentageView.addTextChangedListener(textWatch);
|
||||
timeshiftView.addTextChangedListener(textWatch);
|
||||
|
||||
updateGui();
|
||||
updateGUI();
|
||||
|
||||
onStatusEvent(new EventInitializationChanged());
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
public void updateGui() {
|
||||
|
||||
|
||||
public void updateGUI() {
|
||||
updateProfileInfo();
|
||||
|
||||
diaView.removeTextChangedListener(textWatch);
|
||||
|
@ -434,7 +433,6 @@ public class CircadianPercentageProfileFragment extends Fragment {
|
|||
|
||||
if (i == 0) {
|
||||
copyprevbutton.setVisibility(View.INVISIBLE);
|
||||
;
|
||||
} else {
|
||||
final int j = i; //needs to be final to be passed to inner class.
|
||||
copyprevbutton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -485,15 +483,12 @@ public class CircadianPercentageProfileFragment extends Fragment {
|
|||
}
|
||||
basalEditDialog = null;
|
||||
|
||||
MainApp.bus().unregister(this);
|
||||
fl.requestFocusFromTouch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateGui();
|
||||
MainApp.bus().register(this);
|
||||
onStatusEvent(new EventInitializationChanged());
|
||||
fl.requestFocusFromTouch();
|
||||
}
|
||||
|
@ -521,7 +516,7 @@ public class CircadianPercentageProfileFragment extends Fragment {
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateGui();
|
||||
updateGUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -27,10 +27,11 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
|||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.TimeListEdit;
|
||||
|
||||
public class LocalProfileFragment extends Fragment {
|
||||
public class LocalProfileFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(LocalProfileFragment.class);
|
||||
|
||||
private static LocalProfilePlugin localProfilePlugin = new LocalProfilePlugin();
|
||||
|
@ -73,7 +74,7 @@ public class LocalProfileFragment extends Fragment {
|
|||
layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
onStatusEvent(null);
|
||||
updateGUI();
|
||||
|
||||
mgdlView.setChecked(localProfilePlugin.mgdl);
|
||||
mmolView.setChecked(localProfilePlugin.mmol);
|
||||
|
@ -130,26 +131,18 @@ public class LocalProfileFragment extends Fragment {
|
|||
|
||||
diaView.addTextChangedListener(textWatch);
|
||||
|
||||
onStatusEvent(null);
|
||||
updateGUI();
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
onStatusEvent(null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventInitializationChanged e) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -13,10 +13,11 @@ import com.squareup.otto.Subscribe;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateGUI;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
public class NSProfileFragment extends Fragment {
|
||||
public class NSProfileFragment extends SubscriberFragment {
|
||||
private static NSProfilePlugin nsProfilePlugin = new NSProfilePlugin();
|
||||
|
||||
public static NSProfilePlugin getPlugin() {
|
||||
|
@ -50,18 +51,6 @@ public class NSProfileFragment extends Fragment {
|
|||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNSProfileUpdateGUI ev) {
|
||||
Activity activity = getActivity();
|
||||
|
@ -74,7 +63,8 @@ public class NSProfileFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
private void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
if (MainApp.getConfigBuilder().getProfile() == null) {
|
||||
noProfile.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
|
|
|
@ -25,9 +25,10 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
|||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
||||
public class SimpleProfileFragment extends Fragment {
|
||||
public class SimpleProfileFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(SimpleProfileFragment.class);
|
||||
|
||||
private static SimpleProfilePlugin simpleProfilePlugin = new SimpleProfilePlugin();
|
||||
|
@ -66,7 +67,7 @@ public class SimpleProfileFragment extends Fragment {
|
|||
layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
onStatusEvent(null);
|
||||
updateGUI();
|
||||
|
||||
mgdlView.setChecked(simpleProfilePlugin.mgdl);
|
||||
mmolView.setChecked(simpleProfilePlugin.mmol);
|
||||
|
@ -138,26 +139,18 @@ public class SimpleProfileFragment extends Fragment {
|
|||
targetlowView.addTextChangedListener(textWatch);
|
||||
targethighView.addTextChangedListener(textWatch);
|
||||
|
||||
onStatusEvent(null);
|
||||
updateGUI();
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
onStatusEvent(null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventInitializationChanged e) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -27,6 +27,7 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRStatsActivity;
|
||||
|
@ -35,7 +36,7 @@ import info.nightscout.utils.DateUtil;
|
|||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SetWarnColor;
|
||||
|
||||
public class DanaRFragment extends Fragment {
|
||||
public class DanaRFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(DanaRFragment.class);
|
||||
|
||||
private static DanaRPlugin danaRPlugin;
|
||||
|
@ -156,18 +157,6 @@ public class DanaRFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventPumpStatusChanged c) {
|
||||
Activity activity = getActivity();
|
||||
|
@ -204,7 +193,8 @@ public class DanaRFragment extends Fragment {
|
|||
}
|
||||
|
||||
// GUI functions
|
||||
private void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && basaBasalRateView != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -27,6 +27,7 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
|
||||
|
@ -36,7 +37,7 @@ import info.nightscout.utils.DateUtil;
|
|||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SetWarnColor;
|
||||
|
||||
public class DanaRKoreanFragment extends Fragment {
|
||||
public class DanaRKoreanFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(DanaRKoreanFragment.class);
|
||||
|
||||
private static DanaRKoreanPlugin danaRKoreanPlugin = new DanaRKoreanPlugin();
|
||||
|
@ -154,18 +155,6 @@ public class DanaRKoreanFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventPumpStatusChanged c) {
|
||||
Activity activity = getActivity();
|
||||
|
@ -202,7 +191,8 @@ public class DanaRKoreanFragment extends Fragment {
|
|||
}
|
||||
|
||||
// GUI functions
|
||||
private void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && basaBasalRateView != null)
|
||||
|
|
|
@ -27,6 +27,7 @@ import info.nightscout.androidaps.R;
|
|||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
|
||||
|
@ -36,7 +37,7 @@ import info.nightscout.utils.DateUtil;
|
|||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SetWarnColor;
|
||||
|
||||
public class DanaRv2Fragment extends Fragment {
|
||||
public class DanaRv2Fragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(DanaRv2Fragment.class);
|
||||
|
||||
private static DanaRv2Plugin danaRPlugin;
|
||||
|
@ -153,18 +154,6 @@ public class DanaRv2Fragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventPumpStatusChanged c) {
|
||||
Activity activity = getActivity();
|
||||
|
@ -201,7 +190,8 @@ public class DanaRv2Fragment extends Fragment {
|
|||
}
|
||||
|
||||
// GUI functions
|
||||
private void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && basaBasalRateView != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.app.Activity;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -16,13 +15,12 @@ import com.squareup.otto.Subscribe;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui;
|
||||
|
||||
public class VirtualPumpFragment extends Fragment {
|
||||
public class VirtualPumpFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class);
|
||||
|
||||
TextView basaBasalRateView;
|
||||
|
@ -63,24 +61,13 @@ public class VirtualPumpFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventVirtualPumpUpdateGui ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
public void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && basaBasalRateView != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -20,13 +20,14 @@ import java.util.Comparator;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
*/
|
||||
public class SmsCommunicatorFragment extends Fragment {
|
||||
public class SmsCommunicatorFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(SmsCommunicatorFragment.class);
|
||||
|
||||
private static SmsCommunicatorPlugin smsCommunicatorPlugin;
|
||||
|
@ -56,25 +57,14 @@ public class SmsCommunicatorFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventSmsCommunicatorUpdateGui ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
|
||||
private void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -188,11 +188,13 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
}
|
||||
|
||||
if (!MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses())
|
||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||
ExtendedBolus e = extendedBoluses.get(pos);
|
||||
if (e.date > time) continue;
|
||||
IobTotal calc = e.iobCalc(time);
|
||||
total.plus(calc);
|
||||
synchronized (extendedBoluses) {
|
||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||
ExtendedBolus e = extendedBoluses.get(pos);
|
||||
if (e.date > time) continue;
|
||||
IobTotal calc = e.iobCalc(time);
|
||||
total.plus(calc);
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
@ -292,20 +294,24 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
@Override
|
||||
public IobTotal getCalculationToTimeTempBasals(long time) {
|
||||
IobTotal total = new IobTotal(time);
|
||||
for (Integer pos = 0; pos < tempBasals.size(); pos++) {
|
||||
TemporaryBasal t = tempBasals.get(pos);
|
||||
if (t.date > time) continue;
|
||||
IobTotal calc = t.iobCalc(time);
|
||||
//log.debug("BasalIOB " + new Date(time) + " >>> " + calc.basaliob);
|
||||
total.plus(calc);
|
||||
synchronized (tempBasals) {
|
||||
for (Integer pos = 0; pos < tempBasals.size(); pos++) {
|
||||
TemporaryBasal t = tempBasals.get(pos);
|
||||
if (t.date > time) continue;
|
||||
IobTotal calc = t.iobCalc(time);
|
||||
//log.debug("BasalIOB " + new Date(time) + " >>> " + calc.basaliob);
|
||||
total.plus(calc);
|
||||
}
|
||||
}
|
||||
if (MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) {
|
||||
IobTotal totalExt = new IobTotal(time);
|
||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||
ExtendedBolus e = extendedBoluses.get(pos);
|
||||
if (e.date > time) continue;
|
||||
IobTotal calc = e.iobCalc(time);
|
||||
totalExt.plus(calc);
|
||||
synchronized (extendedBoluses) {
|
||||
for (Integer pos = 0; pos < extendedBoluses.size(); pos++) {
|
||||
ExtendedBolus e = extendedBoluses.get(pos);
|
||||
if (e.date > time) continue;
|
||||
IobTotal calc = e.iobCalc(time);
|
||||
totalExt.plus(calc);
|
||||
}
|
||||
}
|
||||
// Convert to basal iob
|
||||
totalExt.basaliob = totalExt.iob;
|
||||
|
@ -420,12 +426,18 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
|
|||
@Override
|
||||
public long oldestDataAvailable() {
|
||||
long oldestTime = System.currentTimeMillis();
|
||||
if (tempBasals.size() > 0)
|
||||
oldestTime = Math.min(oldestTime, tempBasals.get(0).date);
|
||||
if (extendedBoluses.size() > 0)
|
||||
oldestTime = Math.min(oldestTime, extendedBoluses.get(0).date);
|
||||
if (treatments.size() > 0)
|
||||
oldestTime = Math.min(oldestTime, treatments.get(treatments.size() - 1).date);
|
||||
synchronized (tempBasals) {
|
||||
if (tempBasals.size() > 0)
|
||||
oldestTime = Math.min(oldestTime, tempBasals.get(0).date);
|
||||
}
|
||||
synchronized (extendedBoluses) {
|
||||
if (extendedBoluses.size() > 0)
|
||||
oldestTime = Math.min(oldestTime, extendedBoluses.get(0).date);
|
||||
}
|
||||
synchronized (treatments) {
|
||||
if (treatments.size() > 0)
|
||||
oldestTime = Math.min(oldestTime, treatments.get(treatments.size() - 1).date);
|
||||
}
|
||||
oldestTime -= 15 * 60 * 1000L; // allow 15 min before
|
||||
return oldestTime;
|
||||
}
|
||||
|
|
|
@ -37,13 +37,14 @@ import info.nightscout.androidaps.db.Treatment;
|
|||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class TreatmentsBolusFragment extends Fragment implements View.OnClickListener {
|
||||
public class TreatmentsBolusFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(TreatmentsBolusFragment.class);
|
||||
|
||||
RecyclerView recyclerView;
|
||||
|
@ -205,19 +206,6 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTreatmentChange ev) {
|
||||
updateGUI();
|
||||
|
@ -228,7 +216,8 @@ public class TreatmentsBolusFragment extends Fragment implements View.OnClickLis
|
|||
updateGUI();
|
||||
}
|
||||
|
||||
public void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -30,13 +30,14 @@ import info.nightscout.androidaps.db.ExtendedBolus;
|
|||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
import info.nightscout.androidaps.data.Intervals;
|
||||
|
||||
|
||||
public class TreatmentsExtendedBolusesFragment extends Fragment {
|
||||
public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(TreatmentsExtendedBolusesFragment.class);
|
||||
|
||||
RecyclerView recyclerView;
|
||||
|
@ -181,18 +182,6 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventExtendedBolusChange ev) {
|
||||
updateGUI();
|
||||
|
@ -203,7 +192,8 @@ public class TreatmentsExtendedBolusesFragment extends Fragment {
|
|||
updateGUI();
|
||||
}
|
||||
|
||||
public void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && recyclerView != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -30,6 +30,7 @@ import info.nightscout.androidaps.db.Source;
|
|||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
@ -40,7 +41,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 13/01/17.
|
||||
*/
|
||||
|
||||
public class TreatmentsProfileSwitchFragment extends Fragment implements View.OnClickListener {
|
||||
public class TreatmentsProfileSwitchFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
|
||||
RecyclerView recyclerView;
|
||||
LinearLayoutManager llm;
|
||||
|
@ -180,24 +181,13 @@ public class TreatmentsProfileSwitchFragment extends Fragment implements View.On
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventProfileSwitchChange ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -26,6 +26,7 @@ import info.nightscout.androidaps.Services.Intents;
|
|||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
@ -36,7 +37,7 @@ import info.nightscout.utils.SP;
|
|||
* Created by mike on 13/01/17.
|
||||
*/
|
||||
|
||||
public class TreatmentsTempTargetFragment extends Fragment implements View.OnClickListener {
|
||||
public class TreatmentsTempTargetFragment extends SubscriberFragment implements View.OnClickListener {
|
||||
|
||||
RecyclerView recyclerView;
|
||||
LinearLayoutManager llm;
|
||||
|
@ -210,24 +211,13 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTempTargetChange ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -30,13 +30,14 @@ import info.nightscout.androidaps.db.Source;
|
|||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
import info.nightscout.androidaps.data.Intervals;
|
||||
|
||||
|
||||
public class TreatmentsTemporaryBasalsFragment extends Fragment {
|
||||
public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(TreatmentsTemporaryBasalsFragment.class);
|
||||
|
||||
RecyclerView recyclerView;
|
||||
|
@ -200,18 +201,6 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventTempBasalChange ev) {
|
||||
updateGUI();
|
||||
|
@ -222,7 +211,8 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment {
|
|||
updateGUI();
|
||||
}
|
||||
|
||||
public void updateGUI() {
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -173,7 +173,7 @@ public class ActionStringHandler {
|
|||
rTitle += " LOOP";
|
||||
rMessage = "TARGETS:\n" + getTargetsStatus();
|
||||
rMessage += "\n\n" + getLoopStatus();
|
||||
rMessage += "\n\nOAPS RESULT:\n" + getOAPSResultStatus();;
|
||||
rMessage += "\n\nOAPS RESULT:\n" + getOAPSResultStatus();
|
||||
}
|
||||
|
||||
} else if ("wizard".equals(act[0])) {
|
||||
|
|
BIN
app/src/main/res/drawable-hdpi/icon_actions_cancelextbolus.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_actions_profileswitch.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_actions_refill.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_actions_startextbolus.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_actions_starttempbasal.png
Normal file
After Width: | Height: | Size: 745 B |
BIN
app/src/main/res/drawable-hdpi/icon_actions_temptarget.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_aaps_offline.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_age_battery.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_age_canula.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_age_insulin.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_age_sensor.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_announcement.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_basal_end.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_basal_start.png
Normal file
After Width: | Height: | Size: 698 B |
BIN
app/src/main/res/drawable-hdpi/icon_cp_bgcheck.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_bolus_carbs.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_bolus_combo.png
Normal file
After Width: | Height: | Size: 771 B |
BIN
app/src/main/res/drawable-hdpi/icon_cp_bolus_correction.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_bolus_meal.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_bolus_snack.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_cgm_insert.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_cgm_profile.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_cgm_start.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_cgm_target.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_exercise.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_note.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_pump_battery.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_pump_canula.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_pump_cartridge.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_cp_question.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_home_loop.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_home_profile.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_home_target.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_actions_cancelextbolus.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_actions_profileswitch.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_actions_refill.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_actions_startextbolus.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_actions_starttempbasal.png
Normal file
After Width: | Height: | Size: 651 B |
BIN
app/src/main/res/drawable-mdpi/icon_actions_temptarget.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_aaps_offline.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_age_battery.png
Normal file
After Width: | Height: | Size: 911 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_age_canula.png
Normal file
After Width: | Height: | Size: 806 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_age_insulin.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_age_sensor.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_announcement.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_basal_end.png
Normal file
After Width: | Height: | Size: 867 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_basal_start.png
Normal file
After Width: | Height: | Size: 616 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_bgcheck.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_bolus_carbs.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_bolus_combo.png
Normal file
After Width: | Height: | Size: 687 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_bolus_correction.png
Normal file
After Width: | Height: | Size: 948 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_bolus_meal.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_bolus_snack.png
Normal file
After Width: | Height: | Size: 1,007 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_cgm_insert.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_cgm_profile.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_cgm_start.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_cgm_target.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_exercise.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_note.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_pump_battery.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
app/src/main/res/drawable-mdpi/icon_cp_pump_canula.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_pump_cartridge.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-mdpi/icon_cp_question.png
Normal file
After Width: | Height: | Size: 913 B |
BIN
app/src/main/res/drawable-mdpi/icon_home_loop.png
Normal file
After Width: | Height: | Size: 931 B |