allow set profile to pump from simpleprofile plugin

This commit is contained in:
Milos Kozak 2016-12-09 12:40:15 +01:00
parent e9d639c979
commit 4103e4bf4a
5 changed files with 44 additions and 10 deletions

View file

@ -473,6 +473,7 @@ public class ExecutionService extends Service {
mSerialIOThread.sendMessage(msgSet);
MsgSetActivateBasalProfile msgActivate = new MsgSetActivateBasalProfile((byte) 0);
mSerialIOThread.sendMessage(msgActivate);
danaRPump.lastSettingsRead = new Date(0); // force read full settings
getPumpStatus();
return true;
}

View file

@ -462,6 +462,7 @@ public class ExecutionService extends Service {
double[] basal = buildDanaRProfileRecord(profile);
MsgSetSingleBasalProfile msgSet = new MsgSetSingleBasalProfile(basal);
mSerialIOThread.sendMessage(msgSet);
danaRKoreanPump.lastSettingsRead = new Date(0); // force read full settings
getPumpStatus();
return true;
}

View file

@ -8,6 +8,7 @@ import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
@ -16,6 +17,8 @@ import org.slf4j.LoggerFactory;
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.utils.SafeParse;
public class SimpleProfileFragment extends Fragment implements FragmentBase {
@ -36,6 +39,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
EditText basalView;
EditText targetlowView;
EditText targethighView;
Button profileswitchButton;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -50,6 +54,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
basalView = (EditText) layout.findViewById(R.id.simpleprofile_basalrate);
targetlowView = (EditText) layout.findViewById(R.id.simpleprofile_targetlow);
targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh);
profileswitchButton = (Button) layout.findViewById(R.id.simpleprofile_profileswitch);
mgdlView.setChecked(simpleProfilePlugin.mgdl);
mmolView.setChecked(simpleProfilePlugin.mmol);
@ -80,6 +85,17 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
}
});
profileswitchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
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(getFragmentManager(), "NewNSTreatmentDialog");
}
});
TextWatcher textWatch = new TextWatcher() {
@Override

View file

@ -16,7 +16,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Units:"
android:text="@string/units"
android:textAppearance="?android:attr/textAppearanceMedium" />
@ -25,14 +25,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:text="mgdl" />
android:text="@string/mgdl" />
<RadioButton
android:id="@+id/simpleprofile_mmol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="3"
android:text="mmol" />
android:text="@string/mmol" />
</TableRow>
@ -43,7 +43,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DIA:"
android:text="@string/dia"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
@ -61,7 +61,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="IC:"
android:text="@string/nsprofileview_ic_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
@ -79,7 +79,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ISF:"
android:text="@string/nsprofileview_isf_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
@ -97,7 +97,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Absorption rate:"
android:text="@string/absorption_rate"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
@ -115,7 +115,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Basal rate:"
android:text="@string/basal_rate"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
@ -133,7 +133,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Target range:"
android:text="@string/target_range"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
@ -150,6 +150,22 @@
android:layout_column="2"
android:inputType="numberDecimal" />
</TableRow>
<Button
android:id="@+id/simpleprofile_profileswitch"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/send_to_pump"
android:textColor="@color/colorProfileSwitchButton" />
</TableLayout>
</FrameLayout>

View file

@ -241,7 +241,6 @@
<string name="absolute">Absolute</string>
<string name="canceltemp">Cancel temp basal</string>
<string name="smscommunicator">SMS Communicator</string>
<string name="mm640g">MM 640g</string>
<string name="waitingforpumpresult">Waiting for result</string>
<string name="smscommunicator_allowednumbers">Allowed phone numbers</string>
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
@ -377,4 +376,5 @@
<string name="batterydischarged">Pump Battery Discharged</string>
<string name="danarkoreanpump">DanaR Korean</string>
<string name="wrongpumpdriverselected">Wrong pump driver selected</string>
<string name="basal_rate">Basal rate:</string>
</resources>