commit
0aa4fbba45
22 changed files with 379 additions and 130 deletions
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.ArrayList;
|
|||
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Actions.ActionsFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
|
@ -62,6 +63,7 @@ public class MainApp extends Application {
|
|||
pluginsList = new ArrayList<>();
|
||||
// Register all tabs in app here
|
||||
pluginsList.add(OverviewFragment.getPlugin());
|
||||
pluginsList.add(ActionsFragment.getPlugin());
|
||||
if (Config.DANAR) pluginsList.add(DanaRFragment.getPlugin());
|
||||
if (Config.MM640G) pluginsList.add(MM640gFragment.getPlugin());
|
||||
if (Config.CAREPORTALENABLED) pluginsList.add(CareportalFragment.getPlugin());
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package info.nightscout.androidaps.plugins.Actions;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.FragmentBase;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewTempBasalDialog;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
*/
|
||||
public class ActionsFragment extends Fragment implements FragmentBase, View.OnClickListener {
|
||||
|
||||
static ActionsPlugin actionsPlugin = new ActionsPlugin();
|
||||
static public ActionsPlugin getPlugin() {
|
||||
return actionsPlugin;
|
||||
}
|
||||
|
||||
public ActionsFragment() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.actions_fragment, container, false);
|
||||
|
||||
view.findViewById(R.id.actions_profileswitch).setOnClickListener(this);
|
||||
view.findViewById(R.id.actions_extendedbolus).setOnClickListener(this);
|
||||
view.findViewById(R.id.actions_settempbasal).setOnClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager manager = getFragmentManager();
|
||||
switch (view.getId()) {
|
||||
case R.id.actions_profileswitch:
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
|
||||
profileswitch.executeProfileSwitch = true;
|
||||
newDialog.setOptions(profileswitch);
|
||||
newDialog.show(manager, "NewNSTreatmentDialog");
|
||||
break;
|
||||
case R.id.actions_extendedbolus:
|
||||
NewExtendedBolusDialog newExtendedDialog = new NewExtendedBolusDialog();
|
||||
newExtendedDialog.show(manager, "NewExtendedDialog");
|
||||
break;
|
||||
case R.id.actions_settempbasal:
|
||||
NewTempBasalDialog newTempDialog = new NewTempBasalDialog();
|
||||
newTempDialog.show(manager, "NewTempDialog");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package info.nightscout.androidaps.plugins.Actions;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.11.2016.
|
||||
*/
|
||||
|
||||
public class ActionsPlugin implements PluginBase {
|
||||
|
||||
boolean fragmentEnabled = true;
|
||||
boolean fragmentVisible = true;
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return PluginBase.GENERAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return ActionsFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainApp.sResources.getString(R.string.actions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int type) {
|
||||
return fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHidden(int type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||
this.fragmentEnabled = fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||
package info.nightscout.androidaps.plugins.Actions.dialogs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||
package info.nightscout.androidaps.plugins.Actions.dialogs;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -151,9 +151,9 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
}
|
||||
if (!result.success) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(getContext().getString(R.string.treatmentdeliveryerror));
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||
builder.setMessage(result.comment);
|
||||
builder.setPositiveButton(getContext().getString(R.string.ok), null);
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||
builder.show();
|
||||
}
|
||||
}
|
|
@ -22,44 +22,6 @@ public class CareportalFragment extends Fragment implements FragmentBase, View.O
|
|||
return careportalPlugin;
|
||||
}
|
||||
|
||||
public class OptionsToShow {
|
||||
public int eventType;
|
||||
public int eventName;
|
||||
public boolean bg;
|
||||
public boolean insulin;
|
||||
public boolean carbs;
|
||||
public boolean prebolus;
|
||||
public boolean duration;
|
||||
public boolean percent;
|
||||
public boolean absolute;
|
||||
public boolean profile;
|
||||
public boolean split;
|
||||
|
||||
public OptionsToShow(int eventType,
|
||||
int eventName,
|
||||
boolean bg,
|
||||
boolean insulin,
|
||||
boolean carbs,
|
||||
boolean prebolus,
|
||||
boolean duration,
|
||||
boolean percent,
|
||||
boolean absolute,
|
||||
boolean profile,
|
||||
boolean split) {
|
||||
this.eventType = eventType;
|
||||
this.eventName = eventName;
|
||||
this.bg = bg;
|
||||
this.insulin = insulin;
|
||||
this.carbs = carbs;
|
||||
this.prebolus = prebolus;
|
||||
this.duration = duration;
|
||||
this.percent = percent;
|
||||
this.absolute = absolute;
|
||||
this.profile = profile;
|
||||
this.split = split;
|
||||
}
|
||||
}
|
||||
|
||||
// bg,insulin,carbs,prebolus,duration,percent,absolute,profile,split
|
||||
final OptionsToShow bgcheck = new OptionsToShow(R.id.careportal_bgcheck, R.string.careportal_bgcheck, true, true, true, false, false, false, false, false, false);
|
||||
final OptionsToShow snackbolus = new OptionsToShow(R.id.careportal_snackbolus, R.string.careportal_snackbolus, true, true, true, true, false, false, false, false, false);
|
||||
|
|
|
@ -2,11 +2,11 @@ package info.nightscout.androidaps.plugins.Careportal.Dialogs;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
@ -43,13 +43,10 @@ import java.util.Date;
|
|||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.PlusMinusEditText;
|
||||
|
@ -62,7 +59,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
|
||||
private FragmentActivity context;
|
||||
|
||||
private static CareportalFragment.OptionsToShow options;
|
||||
private static OptionsToShow options;
|
||||
|
||||
NSProfile profile;
|
||||
String units;
|
||||
|
@ -107,10 +104,23 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
|
||||
Date eventTime;
|
||||
|
||||
public void setOptions(CareportalFragment.OptionsToShow options) {
|
||||
private static Handler sHandler;
|
||||
private static HandlerThread sHandlerThread;
|
||||
|
||||
|
||||
public void setOptions(OptionsToShow options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public NewNSTreatmentDialog() {
|
||||
super();
|
||||
if (sHandlerThread == null) {
|
||||
sHandlerThread = new HandlerThread(NewNSTreatmentDialog.class.getSimpleName());
|
||||
sHandlerThread.start();
|
||||
sHandler = new Handler(sHandlerThread.getLooper());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
context = (FragmentActivity) activity;
|
||||
|
@ -532,6 +542,30 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
builder.setPositiveButton(getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
|
||||
if (options.executeProfileSwitch) {
|
||||
if (data.has("profile")) {
|
||||
sHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String profile = data.getString("profile");
|
||||
NSProfile nsProfile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
nsProfile.setActiveProfile(profile);
|
||||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
if (pump != null) {
|
||||
pump.setNewBasalProfile(nsProfile);
|
||||
log.debug("Setting new profile: " + profile);
|
||||
MainApp.bus().post(new EventNewBasalProfile(nsProfile));
|
||||
} else {
|
||||
log.error("No active pump selected");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getContext().getString(R.string.cancel), null);
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package info.nightscout.androidaps.plugins.Careportal;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.11.2016.
|
||||
*/
|
||||
|
||||
public class OptionsToShow {
|
||||
public int eventType;
|
||||
public int eventName;
|
||||
public boolean bg;
|
||||
public boolean insulin;
|
||||
public boolean carbs;
|
||||
public boolean prebolus;
|
||||
public boolean duration;
|
||||
public boolean percent;
|
||||
public boolean absolute;
|
||||
public boolean profile;
|
||||
public boolean split;
|
||||
|
||||
// perform direct actions
|
||||
public boolean executeProfileSwitch = false;
|
||||
|
||||
public OptionsToShow(int eventType,
|
||||
int eventName,
|
||||
boolean bg,
|
||||
boolean insulin,
|
||||
boolean carbs,
|
||||
boolean prebolus,
|
||||
boolean duration,
|
||||
boolean percent,
|
||||
boolean absolute,
|
||||
boolean profile,
|
||||
boolean split) {
|
||||
this.eventType = eventType;
|
||||
this.eventName = eventName;
|
||||
this.bg = bg;
|
||||
this.insulin = insulin;
|
||||
this.carbs = carbs;
|
||||
this.prebolus = prebolus;
|
||||
this.duration = duration;
|
||||
this.percent = percent;
|
||||
this.absolute = absolute;
|
||||
this.profile = profile;
|
||||
this.split = split;
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ import info.nightscout.androidaps.plugins.Loop.DeviceStatus;
|
|||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResult;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
|
|
@ -202,7 +202,7 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
|||
}
|
||||
if (DanaRPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - DanaRPlugin.getDanaRPump().lastBolusTime.getTime();
|
||||
double agoHours = (int) (agoMsec / 60d / 60d / 1000d);
|
||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||
if (agoHours < 6) // max 6h back
|
||||
lastBolusView.setText(formatTime.format(DanaRPlugin.getDanaRPump().lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(danaRPlugin.getDanaRPump().lastBolusAmount) + " U");
|
||||
else lastBolusView.setText("");
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.json.JSONObject;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
/**
|
||||
|
@ -20,14 +21,15 @@ public class APSResult implements Parcelable {
|
|||
public double rate;
|
||||
public int duration;
|
||||
public boolean changeRequested = false;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final ConfigBuilderPlugin configBuilder = MainApp.getConfigBuilder();
|
||||
if (changeRequested) {
|
||||
if (rate == 0 && duration == 0)
|
||||
return MainApp.sResources.getString(R.string.canceltemp);
|
||||
else
|
||||
return MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h\n" +
|
||||
return MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " +
|
||||
"(" + DecimalFormatter.to2Decimal(rate/configBuilder.getBaseBasalRate() *100) + "%)\n" +
|
||||
MainApp.sResources.getString(R.string.duration) + ": " + DecimalFormatter.to0Decimal(duration) + " min\n" +
|
||||
MainApp.sResources.getString(R.string.reason) + ": " + reason;
|
||||
} else
|
||||
|
@ -35,11 +37,13 @@ public class APSResult implements Parcelable {
|
|||
}
|
||||
|
||||
public Spanned toSpanned() {
|
||||
final ConfigBuilderPlugin configBuilder = MainApp.getConfigBuilder();
|
||||
if (changeRequested) {
|
||||
String ret = "";
|
||||
if (rate == 0 && duration == 0) ret = MainApp.sResources.getString(R.string.canceltemp);
|
||||
else
|
||||
ret = "<b>" + MainApp.sResources.getString(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h<br>" +
|
||||
ret = "<b>" + MainApp.sResources.getString(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " +
|
||||
"(" + DecimalFormatter.to2Decimal(rate/configBuilder.getBaseBasalRate() *100) + "%) <br>" +
|
||||
"<b>" + MainApp.sResources.getString(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration) + " min<br>" +
|
||||
"<b>" + MainApp.sResources.getString(R.string.reason) + "</b>: " + reason.replace("<", "<").replace(">", ">");
|
||||
return Html.fromHtml(ret);
|
||||
|
|
|
@ -59,8 +59,6 @@ import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
|||
import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification;
|
||||
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTempBasalDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension.PointsWithLabelGraphSeries;
|
||||
|
@ -69,7 +67,6 @@ import info.nightscout.utils.BolusWizard;
|
|||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.Round;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
||||
|
||||
public class OverviewFragment extends Fragment {
|
||||
|
@ -90,14 +87,11 @@ public class OverviewFragment extends Fragment {
|
|||
GraphView bgGraph;
|
||||
|
||||
LinearLayout cancelTempLayout;
|
||||
LinearLayout setTempLayout;
|
||||
LinearLayout acceptTempLayout;
|
||||
LinearLayout quickWizardLayout;
|
||||
Button cancelTempButton;
|
||||
Button treatmentButton;
|
||||
Button wizardButton;
|
||||
Button setTempButton;
|
||||
Button setExtenedButton;
|
||||
Button acceptTempButton;
|
||||
Button quickWizardButton;
|
||||
|
||||
|
@ -130,10 +124,7 @@ public class OverviewFragment extends Fragment {
|
|||
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltemp);
|
||||
treatmentButton = (Button) view.findViewById(R.id.overview_treatment);
|
||||
wizardButton = (Button) view.findViewById(R.id.overview_wizard);
|
||||
setExtenedButton = (Button) view.findViewById(R.id.overview_extendedbolus);
|
||||
setTempButton = (Button) view.findViewById(R.id.overview_settempbasal);
|
||||
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltemp);
|
||||
setTempLayout = (LinearLayout) view.findViewById(R.id.overview_settemplayout);
|
||||
cancelTempLayout = (LinearLayout) view.findViewById(R.id.overview_canceltemplayout);
|
||||
acceptTempButton = (Button) view.findViewById(R.id.overview_accepttempbutton);
|
||||
acceptTempLayout = (LinearLayout) view.findViewById(R.id.overview_accepttemplayout);
|
||||
|
@ -182,23 +173,6 @@ public class OverviewFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
setTempButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager manager = getFragmentManager();
|
||||
NewTempBasalDialog newTempDialog = new NewTempBasalDialog();
|
||||
newTempDialog.show(manager, "NewTempDialog");
|
||||
}
|
||||
});
|
||||
|
||||
setExtenedButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager manager = getFragmentManager();
|
||||
NewExtendedBolusDialog newExtendedDialog = new NewExtendedBolusDialog();
|
||||
newExtendedDialog.show(manager, "NewExtendedDialog");
|
||||
}
|
||||
});
|
||||
|
||||
acceptTempButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -429,9 +403,18 @@ public class OverviewFragment extends Fragment {
|
|||
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
|
||||
if (Config.APS) {
|
||||
apsModeView.setVisibility(View.VISIBLE);
|
||||
if (MainApp.getConfigBuilder().isClosedModeEnabled())
|
||||
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
|
||||
else apsModeView.setText(MainApp.sResources.getString(R.string.openloop));
|
||||
apsModeView.setBackgroundResource(R.drawable.loopmodeborder);
|
||||
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
|
||||
if(activeloop != null && activeloop.isEnabled(activeloop.getType())) {
|
||||
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
|
||||
} else {
|
||||
apsModeView.setText(MainApp.sResources.getString(R.string.openloop));
|
||||
}
|
||||
} else {
|
||||
apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder);
|
||||
apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop));
|
||||
}
|
||||
} else {
|
||||
apsModeView.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -455,26 +438,20 @@ public class OverviewFragment extends Fragment {
|
|||
if (pump.isTempBasalInProgress()) {
|
||||
TempBasal activeTemp = pump.getTempBasal();
|
||||
cancelTempLayout.setVisibility(View.VISIBLE);
|
||||
setTempLayout.setVisibility(View.GONE);
|
||||
cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + ": " + activeTemp.toString());
|
||||
runningTempView.setText(activeTemp.toString());
|
||||
} else {
|
||||
cancelTempLayout.setVisibility(View.GONE);
|
||||
setTempLayout.setVisibility(View.VISIBLE);
|
||||
Double currentBasal = pump.getBaseBasalRate();
|
||||
runningTempView.setText(DecimalFormatter.to2Decimal(currentBasal) + " U/h");
|
||||
}
|
||||
|
||||
if (profile == null) {
|
||||
// disable all treatment buttons because we are not able to check constraints without profile
|
||||
setExtenedButton.setVisibility(View.INVISIBLE);
|
||||
setTempLayout.setVisibility(View.INVISIBLE);
|
||||
wizardButton.setVisibility(View.INVISIBLE);
|
||||
treatmentButton.setVisibility(View.INVISIBLE);
|
||||
return;
|
||||
} else {
|
||||
setExtenedButton.setVisibility(View.VISIBLE);
|
||||
setTempLayout.setVisibility(View.VISIBLE);
|
||||
wizardButton.setVisibility(View.VISIBLE);
|
||||
treatmentButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
|
|
@ -349,6 +349,19 @@ public class NSProfile {
|
|||
return activeProfile;
|
||||
}
|
||||
|
||||
public void setActiveProfile(String newProfile) {
|
||||
try {
|
||||
JSONObject store = json.getJSONObject("store");
|
||||
if (newProfile != null && store.has(newProfile)) {
|
||||
activeProfile = newProfile;
|
||||
} else {
|
||||
log.error("Attempt to set wrong active profile");
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Double getMaxDailyBasal() {
|
||||
Double max = 0d;
|
||||
for (Integer hour = 0; hour < 24; hour++) {
|
||||
|
|
7
app/src/main/res/drawable/loopmodedisabledborder.xml
Normal file
7
app/src/main/res/drawable/loopmodedisabledborder.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="@color/colorSetExtendedButton" />
|
||||
<stroke android:width="1dip" android:color="@android:color/white"/>
|
||||
<corners
|
||||
android:radius="2dp" >
|
||||
</corners>
|
||||
</shape>
|
53
app/src/main/res/layout/actions_fragment.xml
Normal file
53
app/src/main/res/layout/actions_fragment.xml
Normal file
|
@ -0,0 +1,53 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.Actions.ActionsFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/actions_profileswitch"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/careportal_profileswitch"
|
||||
android:textColor="@color/colorProfileSwitchButton" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/actions_settempbasal"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/overview_tempbasal_button"
|
||||
android:textColor="@color/colorSetTempButton" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/actions_extendedbolus"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/overview_extendedbolus_button"
|
||||
android:textColor="@color/colorSetExtendedButton" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -136,39 +136,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/overview_settemplayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/overview_settempbasal"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/overview_tempbasal_button"
|
||||
android:textColor="@color/colorSetTempButton" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/overview_extendedbolus"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:text="@string/overview_extendedbolus_button"
|
||||
android:textColor="@color/colorSetExtendedButton" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<string name="basal">Базал</string>
|
||||
<string name="objectives_bgavailableinns">КЗ достъпна в NS</string>
|
||||
<string name="bolus">Болус</string>
|
||||
<string name="bolusconstraintapplied">Приложено ограничение на болус</string>
|
||||
<string name="bolusconstraintapplied">Приложено ограничение за болус</string>
|
||||
<string name="cancel">Откажи</string>
|
||||
<string name="carbs">Въглехидрати</string>
|
||||
<string name="carbsconstraintapplied">Приложено ограничениe за въгл.</string>
|
||||
|
@ -294,8 +294,33 @@
|
|||
<string name="objectives_5_gate">Една седмица успешно дневно използване с редовно въвеждане на въглехидрати</string>
|
||||
<string name="objectives_5_objective">Настройване на базалния инсулин и коефициенти ако е необходимо и активиране на auto-sens</string>
|
||||
<string name="uploading">Uploading</string>
|
||||
<string name="bolusdelivering">Подава %.2fU</string>
|
||||
<string name="bolusdelivering" formatted="false">Подава %.2fU</string>
|
||||
<string name="es_lang">Español</string>
|
||||
<string name="noprofileselected">Не е избран профил</string>
|
||||
<string name="ko_lang">Korean</string>
|
||||
<string name="openapsma_valueoutofrange" formatted="false">%s е недопустима стойност</string>
|
||||
<string name="overview_editquickwizard_buttontext">Текст на бутон:</string>
|
||||
<string name="correctionbous">Корекция</string>
|
||||
<string name="disabledloop">Loop забранен</string>
|
||||
<string name="overview_editquickwizard_carbs">Въглехидрати:</string>
|
||||
<string name="overview_editquickwizard_valid">Валидно:</string>
|
||||
<string name="overview_editquickwizardlistactivity_add">Добави</string>
|
||||
<string name="overview_quickwizard_item_edit_button">Редактирай</string>
|
||||
<string name="overview_quickwizard_item_remove_button">Прехахни</string>
|
||||
<string name="quickwizard">Бърз болус</string>
|
||||
<string name="quickwizardsettings">Настройки за бърз болус</string>
|
||||
<string name="remotebasalnotallowed">Не са позволени отдалечени настройки</string>
|
||||
<string name="smscommunicator_basalreplywithcode" formatted="false">To start basal %.2fU/h reply with code %s</string>
|
||||
<string name="smscommunicator_basalstopreplywithcode" formatted="false">To stop temp basal reply with code %s</string>
|
||||
<string name="smscommunicator_loophasbeendisabled">Loop has been disabled</string>
|
||||
<string name="smscommunicator_loophasbeenenabled">Loop has been enabled</string>
|
||||
<string name="smscommunicator_loopisdisabled">Loop is disabled</string>
|
||||
<string name="smscommunicator_loopisenabled">Loop is enabled</string>
|
||||
<string name="smscommunicator_remotecommandsallowed">Позволи команди през SMS</string>
|
||||
<string name="smscommunicator_tempbasalcanceled">Temp basal canceled</string>
|
||||
<string name="smscommunicator_tempbasalcancelfailed">Canceling temp basal failed</string>
|
||||
<string name="smscommunicator_tempbasalfailed">Temp basal start failed</string>
|
||||
<string name="smscommunicator_tempbasalset" formatted="false">Temp basal %.2fU/h for %d min started successfully</string>
|
||||
<string name="smscommunicator_unknowncommand">Uknonwn command or wrong reply</string>
|
||||
<string name="mealbolus">Болус за хранене</string>
|
||||
</resources>
|
||||
|
|
|
@ -321,4 +321,5 @@
|
|||
<string name="mealbolus">Bolus</string>
|
||||
<string name="ko_lang">Korean</string>
|
||||
<string name="correctionbous">Korekce</string>
|
||||
<string name="actions">Akce</string>
|
||||
</resources>
|
||||
|
|
|
@ -144,7 +144,7 @@
|
|||
<string name="objectives">Objectives</string>
|
||||
<string name="nsprofileview_noprofile_text">KEIN PROFIL GESETZT</string>
|
||||
<string name="nsclientnotinstalled">NSClient nicht installiert. Record lost!</string>
|
||||
<string name="ns_sync_use_absolute_title">Use absolute basal values instead of percent in upload to NS</string>
|
||||
<string name="ns_sync_use_absolute_title">Verwende absolute statt prozentuelle Basalwerte beim Upload zu NightScout</string>
|
||||
<string name="noprofile">Bisher noch kein Profil von NS geladen</string>
|
||||
<string name="nochangerequested">No change requested</string>
|
||||
<string name="noapsselected">NO APS SELECTED OR PROVIDED RESULT</string>
|
||||
|
@ -238,11 +238,44 @@
|
|||
<string name="failedupdatebasalprofile">Fehler beim aktualisieren der Basalrate</string>
|
||||
<string name="hoursago">vor h </string>
|
||||
<string name="smscommunicator">SMS Kommunikator</string>
|
||||
<string name="smscommunicator_allowednumbers">erlaubte TElefonnummern</string>
|
||||
<string name="smscommunicator_allowednumbers">erlaubte Telefonnummern</string>
|
||||
<string name="syncprofiletopump_title">Nightscout Profil zur Pumpe synchronisieren</string>
|
||||
<string name="waitingforpumpresult">auf Pumpenergebnis warten</string>
|
||||
<string name="nobtadapter">Kein Bluetoothadapter gefunden</string>
|
||||
<string name="remotebolusnotallowed">Remote Bolus nicht erlaubt</string>
|
||||
<string formatted="false" name="smscommunicator_bolusreplywithcode">Um Bolus %.2fU bitte mit %s antworten</string>
|
||||
<string name="ko_lang">Korean</string>
|
||||
<string name="youareonallowedlimit">Limit erreicht</string>
|
||||
<string name="wrongpumppassword">Falsches Pumpen-Passwort!</string>
|
||||
<string name="waitingforpump">Warte auf Pumpe</string>
|
||||
<string name="correctionbous">Korr</string>
|
||||
<string name="bolusdelivering">Abgabe %.2fU</string>
|
||||
<string name="bolusdelivered">%.2fU Bolus erfolgreich abgegeben</string>
|
||||
<string name="danar_alarm">Alarm</string>
|
||||
<string name="danar_carbohydrate">Kohlenhydrate</string>
|
||||
<string name="danar_error">Fehler</string>
|
||||
<string name="danar_glucose">Glucose</string>
|
||||
<string name="danar_history">Historie</string>
|
||||
<string name="danar_history_alarm">Alarme</string>
|
||||
<string name="danar_history_bolus">Bolus</string>
|
||||
<string name="danar_history_carbohydrates">Kohlenhydrate</string>
|
||||
<string name="danar_history_dailyinsulin">Inslin-Tagesmengen</string>
|
||||
<string name="danar_history_errors">Fehler</string>
|
||||
<string name="danar_history_glucose">Glucose</string>
|
||||
<string name="danar_history_refill">Füllmenge</string>
|
||||
<string name="danar_history_syspend">Unterbrechungen</string>
|
||||
<string name="danar_password">Pumpen-Passwort</string>
|
||||
<string name="mealbolus">Essensbolus</string>
|
||||
<string name="noprofileselected">Kein Profil gewählt</string>
|
||||
<string name="overview_bolusprogress_stop">Stop</string>
|
||||
<string name="overview_bolusprogress_stoped">Gestoppt</string>
|
||||
<string name="overview_bolusprogress_stoppressed">STOP GEDRÜCKT</string>
|
||||
<string name="overview_quickwizard_item_remove_button">Löschen</string>
|
||||
<string name="overview_editquickwizardlistactivity_add">Hinzufügen</string>
|
||||
<string name="overview_quickwizard_item_edit_button">Bearbeiten</string>
|
||||
<string name="danar_history_basalhours">Basal-Stunden</string>
|
||||
<string name="danar_history_connectingfor">Verbindungsaufbau %d s</string>
|
||||
<string name="overview_editquickwizard_valid">Gültigkeit:</string>
|
||||
<string name="overview_editquickwizard_carbs">Kohlenhydrate</string>
|
||||
<string name="quickwizardsettings">QuickWizard Einstellungen</string>
|
||||
</resources>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<color name="colorCancelTempButton">#47c8ff</color>
|
||||
<color name="colorSetTempButton">#FF478EFF</color>
|
||||
<color name="colorSetExtendedButton">#FFDD7792</color>
|
||||
<color name="colorProfileSwitchButton">#ca77dd</color>
|
||||
|
||||
<color name="colorInProgress">#c45026</color>
|
||||
<color name="colorAffectingIOB">#830400</color>
|
||||
|
|
|
@ -132,6 +132,8 @@
|
|||
|
||||
<string name="closedloop">Closed Loop</string>
|
||||
<string name="openloop">Open Loop</string>
|
||||
<string name="disabledloop">Loop Disabled</string>
|
||||
|
||||
<string name="openloop_newsuggestion">New suggestion available</string>
|
||||
<string name="unsupportedclientver">Unsupported version of NSClient</string>
|
||||
<string name="nsclientnotinstalled">NSClient not installed. Record lost!</string>
|
||||
|
@ -331,5 +333,6 @@
|
|||
<string name="mealbolus">Meal</string>
|
||||
<string name="correctionbous">Corr</string>
|
||||
<string name="ko_lang">Korean</string>
|
||||
<string name="actions">Actions</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue