commit
9bb004306a
12 changed files with 234 additions and 51 deletions
|
@ -98,6 +98,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
addPreferencesFromResource(R.xml.pref_mm640g);
|
addPreferencesFromResource(R.xml.pref_mm640g);
|
||||||
if (Config.SMSCOMMUNICATORENABLED)
|
if (Config.SMSCOMMUNICATORENABLED)
|
||||||
addPreferencesFromResource(R.xml.pref_smscommunicator);
|
addPreferencesFromResource(R.xml.pref_smscommunicator);
|
||||||
|
addPreferencesFromResource(R.xml.pref_others);
|
||||||
initSummary(getPreferenceScreen());
|
initSummary(getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@ import info.nightscout.client.data.NSProfile;
|
||||||
*/
|
*/
|
||||||
public interface PumpInterface {
|
public interface PumpInterface {
|
||||||
|
|
||||||
|
boolean isInitialized();
|
||||||
|
|
||||||
boolean isTempBasalInProgress();
|
boolean isTempBasalInProgress();
|
||||||
boolean isExtendedBoluslInProgress();
|
boolean isExtendedBoluslInProgress();
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,11 @@ package info.nightscout.androidaps.plugins.Actions.dialogs;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -24,6 +26,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.PlusMinusEditText;
|
import info.nightscout.utils.PlusMinusEditText;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
|
||||||
|
@ -32,6 +35,10 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
Button deliverButton;
|
Button deliverButton;
|
||||||
TextView insulin;
|
TextView insulin;
|
||||||
|
|
||||||
|
double amount1 = 0d;
|
||||||
|
double amount2 = 0d;
|
||||||
|
double amount3 = 0d;
|
||||||
|
|
||||||
PlusMinusEditText editInsulin;
|
PlusMinusEditText editInsulin;
|
||||||
|
|
||||||
Handler mHandler;
|
Handler mHandler;
|
||||||
|
@ -59,6 +66,42 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
|
|
||||||
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, 0.05d, new DecimalFormat("0.00"), false);
|
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, 0.05d, new DecimalFormat("0.00"), false);
|
||||||
|
|
||||||
|
//setup preset buttons
|
||||||
|
Button button1 = (Button) view.findViewById(R.id.fill_preset_button1);
|
||||||
|
Button button2 = (Button) view.findViewById(R.id.fill_preset_button2);
|
||||||
|
Button button3 = (Button) view.findViewById(R.id.fill_preset_button3);
|
||||||
|
View divider = view.findViewById(R.id.fill_preset_divider);
|
||||||
|
|
||||||
|
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||||
|
amount1 = SafeParse.stringToDouble(DecimalFormatter.to2Decimal(SafeParse.stringToDouble(sp.getString("fill_button1", "0.3"))));
|
||||||
|
amount2 = SafeParse.stringToDouble(DecimalFormatter.to2Decimal(SafeParse.stringToDouble(sp.getString("fill_button2", "0"))));
|
||||||
|
amount3 = SafeParse.stringToDouble(DecimalFormatter.to2Decimal(SafeParse.stringToDouble(sp.getString("fill_button3", "0"))));
|
||||||
|
|
||||||
|
if(amount1 >0) {
|
||||||
|
button1.setVisibility(View.VISIBLE);
|
||||||
|
button1.setText(DecimalFormatter.to2Decimal(amount1) + "U");
|
||||||
|
button1.setOnClickListener(this);
|
||||||
|
} else {
|
||||||
|
button1.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if(amount2 >0) {
|
||||||
|
button2.setVisibility(View.VISIBLE);
|
||||||
|
button2.setText(DecimalFormatter.to2Decimal(amount2) + "U");
|
||||||
|
button2.setOnClickListener(this);
|
||||||
|
} else {
|
||||||
|
button2.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if(amount3 >0) {
|
||||||
|
button3.setVisibility(View.VISIBLE);
|
||||||
|
button3.setText(DecimalFormatter.to2Decimal(amount3) + "U");
|
||||||
|
button3.setOnClickListener(this);
|
||||||
|
} else {
|
||||||
|
button3.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (button1.getVisibility() == View.GONE && button2.getVisibility() == View.GONE && button3.getVisibility() == View.GONE ) {
|
||||||
|
divider.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,9 +116,24 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.treatments_newtreatment_deliverbutton:
|
case R.id.treatments_newtreatment_deliverbutton:
|
||||||
|
|
||||||
try {
|
|
||||||
Double insulin = SafeParse.stringToDouble(this.insulin.getText().toString());
|
Double insulin = SafeParse.stringToDouble(this.insulin.getText().toString());
|
||||||
|
confirmAndDeliver(insulin);
|
||||||
|
break;
|
||||||
|
case R.id.fill_preset_button1:
|
||||||
|
confirmAndDeliver(amount1);
|
||||||
|
break;
|
||||||
|
case R.id.fill_preset_button2:
|
||||||
|
confirmAndDeliver(amount2);
|
||||||
|
break;
|
||||||
|
case R.id.fill_preset_button3:
|
||||||
|
confirmAndDeliver(amount3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void confirmAndDeliver(Double insulin) {
|
||||||
|
try {
|
||||||
|
|
||||||
String confirmMessage = getString(R.string.fillwarning) + "\n";
|
String confirmMessage = getString(R.string.fillwarning) + "\n";
|
||||||
|
|
||||||
|
@ -117,9 +175,6 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -298,6 +298,11 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
*
|
*
|
||||||
* Config builder return itself as a pump and check constraints before it passes command to pump driver
|
* Config builder return itself as a pump and check constraints before it passes command to pump driver
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return activePump.isInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return activePump.isTempBasalInProgress();
|
return activePump.isTempBasalInProgress();
|
||||||
|
@ -533,9 +538,16 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
request.rate = applyBasalConstraints(request.rate);
|
request.rate = applyBasalConstraints(request.rate);
|
||||||
PumpEnactResult result;
|
PumpEnactResult result;
|
||||||
|
|
||||||
|
if (!isInitialized()) {
|
||||||
|
result = new PumpEnactResult();
|
||||||
|
result.comment = MainApp.sResources.getString(R.string.pumpNotInitialized);
|
||||||
|
result.enacted = false;
|
||||||
|
result.success = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.logCongigBuilderActions)
|
if (Config.logCongigBuilderActions)
|
||||||
log.debug("applyAPSRequest: " + request.toString());
|
log.debug("applyAPSRequest: " + request.toString());
|
||||||
if ((request.rate == 0 && request.duration == 0) || Math.abs(request.rate - getBaseBasalRate()) < 0.1) {
|
if ((request.rate == 0 && request.duration == 0) || Math.abs(request.rate - getBaseBasalRate()) < 0.05) {
|
||||||
if (isTempBasalInProgress()) {
|
if (isTempBasalInProgress()) {
|
||||||
if (Config.logCongigBuilderActions)
|
if (Config.logCongigBuilderActions)
|
||||||
log.debug("applyAPSRequest: cancelTempBasal()");
|
log.debug("applyAPSRequest: cancelTempBasal()");
|
||||||
|
@ -550,7 +562,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
if (Config.logCongigBuilderActions)
|
if (Config.logCongigBuilderActions)
|
||||||
log.debug("applyAPSRequest: Basal set correctly");
|
log.debug("applyAPSRequest: Basal set correctly");
|
||||||
}
|
}
|
||||||
} else if (isTempBasalInProgress() && Math.abs(request.rate - getTempBasalAbsoluteRate()) < 0.1) {
|
} else if (isTempBasalInProgress() && Math.abs(request.rate - getTempBasalAbsoluteRate()) < 0.05) {
|
||||||
result = new PumpEnactResult();
|
result = new PumpEnactResult();
|
||||||
result.absolute = getTempBasalAbsoluteRate();
|
result.absolute = getTempBasalAbsoluteRate();
|
||||||
result.duration = activePump.getTempBasal().getPlannedRemainingMinutes();
|
result.duration = activePump.getTempBasal().getPlannedRemainingMinutes();
|
||||||
|
|
|
@ -150,6 +150,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
this.fragmentPumpVisible = fragmentVisible;
|
this.fragmentPumpVisible = fragmentVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return getDanaRPump().lastConnection.getTime() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Pump interface
|
// Pump interface
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
|
|
|
@ -94,6 +94,11 @@ public class MM640gPlugin implements PluginBase, PumpInterface, BgSourceInterfac
|
||||||
* Pump Interface
|
* Pump Interface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -486,7 +486,10 @@ public class OverviewFragment extends Fragment {
|
||||||
runningTempView.setVisibility(View.GONE);
|
runningTempView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
baseBasalView.setText(DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + " U/h");
|
baseBasalView.setText(DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + " U/h");
|
||||||
|
|
||||||
|
if (profile != null && profile.getActiveProfile() != null)
|
||||||
activeProfileView.setText(profile.getActiveProfile());
|
activeProfileView.setText(profile.getActiveProfile());
|
||||||
|
|
||||||
activeProfileView.setOnLongClickListener(new View.OnLongClickListener() {
|
activeProfileView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
|
|
|
@ -77,6 +77,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
||||||
return PluginBase.PUMP;
|
return PluginBase.PUMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInitialized() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTempBasalInProgress() {
|
public boolean isTempBasalInProgress() {
|
||||||
return getTempBasal() != null;
|
return getTempBasal() != null;
|
||||||
|
|
|
@ -73,5 +73,52 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/fill_preset_divider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_gravity="center_horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/fill_preset_button1"
|
||||||
|
style="?android:attr/buttonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.3"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="0.3U"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/fill_preset_button2"
|
||||||
|
style="?android:attr/buttonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.3"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="0.7U"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
<Button
|
||||||
|
android:id="@+id/fill_preset_button3"
|
||||||
|
style="?android:attr/buttonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.3"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="1.2U"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -278,4 +278,18 @@
|
||||||
<string name="overview_editquickwizard_valid">Gültigkeit:</string>
|
<string name="overview_editquickwizard_valid">Gültigkeit:</string>
|
||||||
<string name="overview_editquickwizard_carbs">Kohlenhydrate</string>
|
<string name="overview_editquickwizard_carbs">Kohlenhydrate</string>
|
||||||
<string name="quickwizardsettings">QuickWizard Einstellungen</string>
|
<string name="quickwizardsettings">QuickWizard Einstellungen</string>
|
||||||
|
<string name="actions">Aktionen</string>
|
||||||
|
<string name="androidaps_start">Android APS gestartet</string>
|
||||||
|
<string name="disabledloop">Loop deaktiviert</string>
|
||||||
|
<string name="fillbolus_title">Füllbolus-Standardmengen</string>
|
||||||
|
<string name="fillwarning">Bitte vergewissern Sie sich, dass die Menge der Spezifikation des Katheters entspricht.</string>
|
||||||
|
<string name="ns_upload_only">Zu NightScout nur hochladen (kein sync)</string>
|
||||||
|
<string name="ns_upload_only_enabled">Bitte deaktivieren Sie \"Zu NightScout nur hochladen\" um dieses Feature zu nutzen.</string>
|
||||||
|
<string name="ns_upload_only_summary">Zu NightScout nur hochladen. Nicht wirksam bei SGV wenn nicht eine lokale Quelle wie xDrip gewählt wird. Nicht wirksam bei Profilen, wenn NS-Profile verwendet werden.</string>
|
||||||
|
<string name="othersettings_title">Andere</string>
|
||||||
|
<string name="overview_bolusiprogress_occlusion">Verstopfung</string>
|
||||||
|
<string name="overview_bolusprogress_delivered">Abgegeben</string>
|
||||||
|
<string name="overview_bolusprogress_goingtodeliver">%.2fU werden abgegeben werden</string>
|
||||||
|
<string name="primefill">Füllen</string>
|
||||||
|
<string name="uploading">Hochladen</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -339,6 +339,12 @@
|
||||||
<string name="ns_upload_only">NS upload only (disabled sync)</string>
|
<string name="ns_upload_only">NS upload only (disabled sync)</string>
|
||||||
<string name="ns_upload_only_summary">NS upload only. Not effective on SGV unless a local source like xDrip is selected. Not effective on Profiles while NS-Profiles is used.</string>
|
<string name="ns_upload_only_summary">NS upload only. Not effective on SGV unless a local source like xDrip is selected. Not effective on Profiles while NS-Profiles is used.</string>
|
||||||
<string name="ns_upload_only_enabled">Please deactivate "NS upload only" to use this feature.</string>
|
<string name="ns_upload_only_enabled">Please deactivate "NS upload only" to use this feature.</string>
|
||||||
|
<string name="pumpNotInitialized">Pump not initialized!</string>
|
||||||
<string name="primefill">Prime/Fill</string>
|
<string name="primefill">Prime/Fill</string>
|
||||||
<string name="fillwarning">Please make sure the amount matches the specification of your infusion set!</string>
|
<string name="fillwarning">Please make sure the amount matches the specification of your infusion set!</string>
|
||||||
|
<string name="othersettings_title">Other</string>
|
||||||
|
<string name="fillbolus_title">Fill/Prime standard insulin amounts.</string>
|
||||||
|
<string name="button1">Button 1</string>
|
||||||
|
<string name="button2">Button 2</string>
|
||||||
|
<string name="button3">Button 3</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
28
app/src/main/res/xml/pref_others.xml
Normal file
28
app/src/main/res/xml/pref_others.xml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="others"
|
||||||
|
android:title="@string/othersettings_title">
|
||||||
|
<PreferenceScreen
|
||||||
|
android:title="@string/fillbolus_title">
|
||||||
|
<EditTextPreference
|
||||||
|
android:title="@string/button1"
|
||||||
|
android:key="fill_button1"
|
||||||
|
android:defaultValue="0.3"
|
||||||
|
android:inputType="numberDecimal">
|
||||||
|
</EditTextPreference>
|
||||||
|
<EditTextPreference
|
||||||
|
android:title="@string/button2"
|
||||||
|
android:key="fill_button2"
|
||||||
|
android:defaultValue="0"
|
||||||
|
android:inputType="numberDecimal">
|
||||||
|
</EditTextPreference>
|
||||||
|
<EditTextPreference
|
||||||
|
android:title="@string/button3"
|
||||||
|
android:key="fill_button3"
|
||||||
|
android:defaultValue="0"
|
||||||
|
android:inputType="numberDecimal">
|
||||||
|
</EditTextPreference>
|
||||||
|
</PreferenceScreen>
|
||||||
|
</PreferenceCategory>
|
||||||
|
</PreferenceScreen>
|
Loading…
Reference in a new issue