GUI tweaking, small fixes
This commit is contained in:
parent
7f4888978e
commit
04994924c5
6 changed files with 676 additions and 602 deletions
|
@ -58,6 +58,7 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
TextView firmwareView;
|
||||
TextView basalStepView;
|
||||
TextView bolusStepView;
|
||||
TextView serialNumberView;
|
||||
Button viewProfileButton;
|
||||
Button historyButton;
|
||||
Button statsButton;
|
||||
|
@ -106,6 +107,7 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
statsButton = (Button) view.findViewById(R.id.danar_stats);
|
||||
basalStepView = (TextView) view.findViewById(R.id.danar_basalstep);
|
||||
bolusStepView = (TextView) view.findViewById(R.id.danar_bolusstep);
|
||||
serialNumberView = (TextView) view.findViewById(R.id.danar_serialnumber);
|
||||
|
||||
|
||||
viewProfileButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -242,6 +244,7 @@ public class DanaRFragment extends SubscriberFragment {
|
|||
}
|
||||
basalStepView.setText("" + pump.basalStep);
|
||||
bolusStepView.setText("" + pump.bolusStep);
|
||||
serialNumberView.setText("" + pump.serialNumber);
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ public class DanaRS_Packet_General_Initial_Screen_Information extends DanaRS_Pac
|
|||
|
||||
dataIndex += dataSize;
|
||||
dataSize = 2;
|
||||
pump.maxDailyTotalUnits = byteArrayToInt(getBytes(data, dataIndex, dataSize));
|
||||
pump.maxDailyTotalUnits = (int) (byteArrayToInt(getBytes(data, dataIndex, dataSize)) / 100d);
|
||||
|
||||
dataIndex += dataSize;
|
||||
dataSize = 2;
|
||||
|
|
|
@ -64,6 +64,7 @@ import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Se
|
|||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Stop;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Get_Pump_Check;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Get_Shipping_Information;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_General_Initial_Screen_Information;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_History_;
|
||||
|
@ -141,7 +142,8 @@ public class DanaRSService extends Service {
|
|||
|
||||
Date now = new Date();
|
||||
if (danaRPump.lastSettingsRead.getTime() + 60 * 60 * 1000L < now.getTime() || !MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
||||
sendMessage(new DanaRS_Packet_General_Get_Shipping_Information());
|
||||
sendMessage(new DanaRS_Packet_General_Get_Shipping_Information()); // serial no
|
||||
sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
|
||||
sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
|
||||
sendMessage(new DanaRS_Packet_Bolus_Get_Bolus_Option()); // isExtendedEnabled
|
||||
sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // bolusStep, maxBolus
|
||||
|
@ -259,6 +261,7 @@ public class DanaRSService extends Service {
|
|||
}
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||
sendMessage(new DanaRS_Packet_Basal_Set_Temporary_Basal(percent, durationInHours));
|
||||
SystemClock.sleep(200);
|
||||
sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||
loadEvents();
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||
|
@ -283,6 +286,7 @@ public class DanaRSService extends Service {
|
|||
if (!isConnected()) return false;
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingextendedbolus)));
|
||||
sendMessage(new DanaRS_Packet_Bolus_Set_Extended_Bolus(insulin, durationInHalfHours));
|
||||
SystemClock.sleep(200);
|
||||
sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
||||
loadEvents();
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||
|
@ -626,6 +630,7 @@ public class DanaRSService extends Service {
|
|||
|
||||
while (isProcessing) {
|
||||
int length = 0;
|
||||
byte[] inputBuffer = null;
|
||||
synchronized (readBuffer) {
|
||||
// Find packet start [A5 A5]
|
||||
if (bufferLength >= 6) {
|
||||
|
@ -655,10 +660,8 @@ public class DanaRSService extends Service {
|
|||
packetIsValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (packetIsValid) {
|
||||
byte[] inputBuffer = new byte[length + 7];
|
||||
synchronized (readBuffer) {
|
||||
inputBuffer = new byte[length + 7];
|
||||
// copy packet to input buffer
|
||||
System.arraycopy(readBuffer, 0, inputBuffer, 0, length + 7);
|
||||
// Cut off the message from readBuffer
|
||||
|
@ -669,8 +672,10 @@ public class DanaRSService extends Service {
|
|||
throw e;
|
||||
}
|
||||
bufferLength -= (length + 7);
|
||||
}
|
||||
// now we have encrypted packet in inputBuffer
|
||||
}
|
||||
}
|
||||
if (packetIsValid) {
|
||||
try {
|
||||
// decrypt the packet
|
||||
inputBuffer = BleCommandUtil.getInstance().getDecryptedPacket(inputBuffer);
|
||||
|
|
|
@ -5,19 +5,70 @@
|
|||
tools:context="info.nightscout.androidaps.plugins.PumpDanaR.DanaRFragment">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/danar_buttons"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="end"
|
||||
android:paddingRight="5dp"
|
||||
android:text="@string/serialnumber"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:gravity="center_horizontal"
|
||||
android:paddingEnd="2dp"
|
||||
android:paddingStart="2dp"
|
||||
android:text=":"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/danar_serialnumber"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dip"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/listdelimiter" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
|
@ -603,6 +654,17 @@
|
|||
android:layout_marginTop="5dp"
|
||||
android:background="@color/listdelimiter" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/danar_buttons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -630,7 +692,10 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/danar_stats" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
|
@ -381,7 +381,7 @@
|
|||
<Button
|
||||
android:id="@+id/overview_accepttempbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
|
|
|
@ -719,5 +719,6 @@
|
|||
<string name="bolusspeed">Bolus speed</string>
|
||||
<string name="key_danars_bolusspeed">danars_bolusspeed</string>
|
||||
<string name="danar_setbasalstep001">Set basal step to 0.01 U/h</string>
|
||||
<string name="serialnumber">Serial number</string>
|
||||
</resources>
|
||||
|
||||
|
|
Loading…
Reference in a new issue