Add "pump error (message)" as a field in Combo fragement.

This commit is contained in:
Johannes Mockenhaupt 2017-07-19 12:37:16 +02:00
parent 8cdd604b84
commit a7c77bc177
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 54 additions and 6 deletions

View file

@ -34,9 +34,12 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
private Button refresh;
private TextView statusText;
private TextView tbrPercentageText;
private TextView tbrDurationText;
private TextView tbrRateText;
private TextView pumpErrorText;
private TextView lastCmdText;
private TextView lastCmdTimeText;
private TextView lastCmdResultText;
@ -48,9 +51,12 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
refresh = (Button) view.findViewById(R.id.combo_refresh);
statusText = (TextView) view.findViewById(R.id.combo_status);
tbrPercentageText = (TextView) view.findViewById(R.id.combo_tbr_percentage);
tbrDurationText = (TextView) view.findViewById(R.id.combo_tbr_duration);
tbrRateText = (TextView) view.findViewById(R.id.combo_tbr_rate);
pumpErrorText = (TextView) view.findViewById(R.id.combo_pump_error);
lastCmdText = (TextView) view.findViewById(R.id.combo_last_command);
lastCmdTimeText = (TextView) view.findViewById(R.id.combo_last_command_time);
lastCmdResultText = (TextView) view.findViewById(R.id.combo_last_command_result);
@ -113,17 +119,13 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
tbrDurationText.setText("");
tbrRateText.setText("" + getPlugin().getBaseBasalRate() + " U/h");
}
pumpErrorText.setText(ps.errorMsg != null ? ps.errorMsg :"");
if (getPlugin().lastCmd != null) {
lastCmdText.setText("" + getPlugin().lastCmd);
lastCmdTimeText.setText(getPlugin().lastCmdTime.toLocaleString());
if (getPlugin().lastCmdResult != null) {
String message = getPlugin().lastCmdResult.message;
if (ps.errorMsg != null) {
message = message + "\nPump is in error state:\n" + ps.errorMsg;
}
lastCmdResultText.setText(message);
} else {
lastCmdResultText.setText("");
lastCmdResultText.setText(message != null ? message : "");
}
} else {
ComboFragment.this.lastCmdText.setText("");

View file

@ -192,6 +192,52 @@
</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
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="end"
android:paddingRight="5dp"
android:text="Pump error"
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/combo_pump_error"
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"