disable entering basals in profiles only if pump is not tempbasal capable

This commit is contained in:
Milos Kozak 2017-01-01 14:34:57 +01:00
parent ef2e7b1a62
commit 4408146f23
5 changed files with 23 additions and 0 deletions

View file

@ -29,6 +29,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.FragmentBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.DecimalFormatter;
@ -55,6 +56,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
TextView profileView; TextView profileView;
TextView baseprofileIC; TextView baseprofileIC;
TextView baseprofileBasal; TextView baseprofileBasal;
LinearLayout baseprofileBasalLayout;
TextView baseprofileISF; TextView baseprofileISF;
Button profileswitchButton; Button profileswitchButton;
ImageView percentageIcon; ImageView percentageIcon;
@ -79,6 +81,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
timeshiftView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_timeshift); timeshiftView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_timeshift);
profileView = (TextView) layout.findViewById(R.id.circadianpercentageprofile_profileview); profileView = (TextView) layout.findViewById(R.id.circadianpercentageprofile_profileview);
baseprofileBasal = (TextView) layout.findViewById(R.id.circadianpercentageprofile_baseprofilebasal); baseprofileBasal = (TextView) layout.findViewById(R.id.circadianpercentageprofile_baseprofilebasal);
baseprofileBasalLayout = (LinearLayout) layout.findViewById(R.id.circadianpercentageprofile_baseprofilebasal_layout);
baseprofileIC = (TextView) layout.findViewById(R.id.circadianpercentageprofile_baseprofileic); baseprofileIC = (TextView) layout.findViewById(R.id.circadianpercentageprofile_baseprofileic);
baseprofileISF = (TextView) layout.findViewById(R.id.circadianpercentageprofile_baseprofileisf); baseprofileISF = (TextView) layout.findViewById(R.id.circadianpercentageprofile_baseprofileisf);
percentageIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_percentageicon); percentageIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_percentageicon);
@ -89,6 +92,11 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
iceditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_icedit); iceditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_icedit);
isfeditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_isfedit); isfeditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_isfedit);
PumpInterface pump = MainApp.getConfigBuilder();
if (!pump.getPumpDescription().isTempBasalCapable) {
layout.findViewById(R.id.circadianpercentageprofile_baseprofilebasal_layout).setVisibility(View.GONE);
}
mgdlView.setChecked(circadianPercentageProfilePlugin.mgdl); mgdlView.setChecked(circadianPercentageProfilePlugin.mgdl);
mmolView.setChecked(circadianPercentageProfilePlugin.mmol); mmolView.setChecked(circadianPercentageProfilePlugin.mmol);

View file

@ -25,6 +25,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.FragmentBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.utils.SafeParse; import info.nightscout.utils.SafeParse;
@ -70,6 +71,11 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label), getPlugin().targetLow, getPlugin().targetHigh, new DecimalFormat("0.0"), save); targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label), getPlugin().targetLow, getPlugin().targetHigh, new DecimalFormat("0.0"), save);
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch); profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
PumpInterface pump = MainApp.getConfigBuilder();
if (!pump.getPumpDescription().isTempBasalCapable) {
layout.findViewById(R.id.localprofile_basal).setVisibility(View.GONE);
}
onStatusEvent(null); onStatusEvent(null);
mgdlView.setChecked(localProfilePlugin.mgdl); mgdlView.setChecked(localProfilePlugin.mgdl);

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.FragmentBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
@ -68,6 +69,12 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh); targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh);
profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch); profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch);
PumpInterface pump = MainApp.getConfigBuilder();
if (!pump.getPumpDescription().isTempBasalCapable) {
layout.findViewById(R.id.simpleprofile_basalrate).setVisibility(View.GONE);
layout.findViewById(R.id.simpleprofile_basalrate_label).setVisibility(View.GONE);
}
onStatusEvent(null); onStatusEvent(null);
mgdlView.setChecked(simpleProfilePlugin.mgdl); mgdlView.setChecked(simpleProfilePlugin.mgdl);

View file

@ -110,6 +110,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cardColorBackground" android:background="@color/cardColorBackground"
android:orientation="horizontal" android:orientation="horizontal"
android:id="@+id/circadianpercentageprofile_baseprofilebasal_layout"
android:textAppearance="?android:attr/textAppearanceSmall"> android:textAppearance="?android:attr/textAppearanceSmall">
<TextView <TextView

View file

@ -89,6 +89,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/simpleprofile_basalrate_label"
android:text="@string/basal_rate" android:text="@string/basal_rate"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />