Code cleanup in RileyLinkStatusGeneralFragment

This commit is contained in:
Bart Sopers 2020-12-25 12:57:28 +01:00
parent 33297ae4cf
commit bc04f8137f
3 changed files with 27 additions and 60 deletions

View file

@ -40,29 +40,24 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
@Inject RileyLinkServiceData rileyLinkServiceData; @Inject RileyLinkServiceData rileyLinkServiceData;
@Inject DateUtil dateUtil; @Inject DateUtil dateUtil;
TextView connectionStatus; private TextView connectionStatus;
TextView configuredAddress; private TextView configuredAddress;
TextView connectedRileyLinkName; private TextView connectedRileyLinkName;
TextView connectedDevice; private TextView connectedDevice;
TextView connectionError; private TextView connectionError;
TextView deviceType; private TextView deviceType;
TextView deviceModel; private TextView deviceModel;
TextView serialNumber; private TextView serialNumber;
TextView pumpFrequency; private TextView pumpFrequency;
TextView lastUsedFrequency; private TextView lastUsedFrequency;
TextView lastDeviceContact; private TextView lastDeviceContact;
TextView firmwareVersion; private TextView firmwareVersion;
boolean first = false;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.rileylink_status_general, container, false); return inflater.inflate(R.layout.rileylink_status_general, container, false);
return rootView;
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
@ -80,28 +75,10 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
this.lastDeviceContact = getActivity().findViewById(R.id.rls_t1_last_device_contact); this.lastDeviceContact = getActivity().findViewById(R.id.rls_t1_last_device_contact);
this.firmwareVersion = getActivity().findViewById(R.id.rls_t1_firmware_version); this.firmwareVersion = getActivity().findViewById(R.id.rls_t1_firmware_version);
// BS: FIXME Remove
if (!first) {
// 7-14
int[] ids = {R.id.rls_t1_tv02, R.id.rls_t1_tv14, R.id.rls_t1_tv03, R.id.rls_t1_tv04, R.id.rls_t1_tv05, R.id.rls_t1_tv07, //
R.id.rls_t1_tv08, R.id.rls_t1_tv09, R.id.rls_t1_tv10, R.id.rls_t1_tv11, R.id.rls_t1_tv12, R.id.rls_t1_tv13};
for (int id : ids) {
TextView tv = getActivity().findViewById(id);
tv.setText(tv.getText() + ":");
}
first = true;
}
refreshData(); refreshData();
} }
public void refreshData() { public void refreshData() {
RileyLinkTargetDevice targetDevice = rileyLinkServiceData.targetDevice; RileyLinkTargetDevice targetDevice = rileyLinkServiceData.targetDevice;
this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId())); this.connectionStatus.setText(resourceHelper.gs(rileyLinkServiceData.rileyLinkServiceState.getResourceId()));

View file

@ -37,7 +37,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv02"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -65,7 +64,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv14"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -93,7 +91,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv03"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -122,7 +119,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv04"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -151,7 +147,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv05"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -179,7 +174,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv13"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -222,7 +216,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv07"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -251,7 +244,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv08"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -280,13 +272,12 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv09"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
android:layout_weight="35" android:layout_weight="35"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/medtronic_serial_number" /> android:text="@string/rileylink_pump_serial_number" />
<TextView <TextView
android:id="@+id/rls_t1_serial_number" android:id="@+id/rls_t1_serial_number"
@ -309,13 +300,12 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv10"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
android:layout_weight="35" android:layout_weight="35"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/medtronic_pump_frequency" /> android:text="@string/rileylink_pump_frequency" />
<TextView <TextView
android:id="@+id/rls_t1_pump_frequency" android:id="@+id/rls_t1_pump_frequency"
@ -337,7 +327,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv11"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"
@ -366,7 +355,6 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/rls_t1_tv12"
android:layout_width="58dp" android:layout_width="58dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="30dp" android:layout_marginLeft="30dp"

View file

@ -20,16 +20,19 @@
<string name="medtronic_pump_status">Pump Status</string> <string name="medtronic_pump_status">Pump Status</string>
<string name="title_activity_rileylink_settings">RileyLink Settings</string> <string name="title_activity_rileylink_settings">RileyLink Settings</string>
<string name="rileylink_title">RileyLink</string> <string name="rileylink_title">RileyLink</string>
<string name="rileylink_configured_address">Configured Address</string> <string name="rileylink_configured_address">Configured Address:</string>
<string name="rileylink_connected_device">Connected Device</string> <string name="rileylink_connected_device">Connected Device:</string>
<string name="rileylink_connection_status">Connection Status</string> <string name="rileylink_connection_status">Connection Status:</string>
<string name="rileylink_connection_error">Connection Error</string> <string name="rileylink_connection_error">Connection Error:</string>
<string name="rileylink_device">Device</string> <string name="rileylink_device">Device</string>
<string name="rileylink_device_type">Device Type</string> <string name="rileylink_device_type">Device Type:</string>
<string name="rileylink_device_model">Device Model</string> <string name="rileylink_device_model">Device Model:</string>
<string name="rileylink_last_used_frequency">Last used frequency</string> <string name="rileylink_last_used_frequency">Last Used Frequency:</string>
<string name="rileylink_last_device_contact">Last device contact</string> <string name="rileylink_last_device_contact">Last Device Contact:</string>
<string name="rileylink_firmware_version">Firmware</string> <string name="rileylink_firmware_version">Firmware Version:</string>
<string name="rileylink_connected_riley_link_name">Connected RileyLink Name:</string>
<string name="rileylink_pump_serial_number">Pump Serial Number:</string>
<string name="rileylink_pump_frequency">Pump Frequency:</string>
<!-- RL State --> <!-- RL State -->
@ -64,7 +67,6 @@
<string name="key_medtronic_encoding" translatable="false">pref_medtronic_encoding</string> <string name="key_medtronic_encoding" translatable="false">pref_medtronic_encoding</string>
<string name="mdt_last_bolus" translatable="false">%1$.1f %2$s (%3$s)</string> <string name="mdt_last_bolus" translatable="false">%1$.1f %2$s (%3$s)</string>
<string name="rileylink_connected_riley_link_name">Connected RileyLink name</string>
<plurals name="duration_days"> <plurals name="duration_days">
<item quantity="one">%1$d day</item> <item quantity="one">%1$d day</item>