Skip to main content

November Update 2

· 3 min read
Hugh Stanway

Further App Improvements

In the second half of the month we starting with making UI improvements to the app. This included added a navbar to basic app navigation and updating the logic for how moving between different content pages was handled. We then added the logic required to save a list of paired devices to the devices storage and finished off the month by writing comments for all code we have written.

1. Added UI to Display List of Already Paired Devices

We added UI to the main page that displays all of the previously and current paired devices to the app. This will be the main interface used to manage the apps currently known devices as well as connect to a given device and remove a given pairing.

When the app first starts the backend queries the device storage to find all the currently saved devices. It will return the result as a list of all the known devices. Each item is then displayed in a list on the devices main page.

For each item in the list we display the device name and its MAC address. Then we also have delete icon for each device which the user can press to delete an item in the list. When this is pressed it will remove the item from the list of paired devices. This removes it from the device storage therefore it won't be displayed anymore unless the user adds it again.

The user can click on a given device in the list and it will start the connection process to that device. Once the app has connected to the device it then will turn to a darker shade of grey to signify which device is the one connected. To then disconnect from that device the user can then click on that device again.

2. Added Support to Store Paired Device Stroage

We defined a 'Target Device' class that each know device will be initiated as. This class contains the reference to that derives name and MAC address as well as its connection status. This class then provides the required getter methods.

We then defined a 'Target Device Storage' class that makes calls to and from the Android devices storage to save and recieve the list of known devices. To achieve this we used the Jackson library to convert the list of Target Device objects to a JSON string which can then be saved to the device storage and vice versa.

Upon app boot the JSON string is retrieved from the device storage and initialised as a list of Target Devices using Jackson. This list is then retrieved and used by other components of the app when needed.

Then when devices are deleted or added the list of saved devices these chanegs are automatically updated in the devices storage.

3. Added Comments To All Files

We went through and added documentation comments and Javadoc comments to all methods and classes within the project to maintain a high level of readability. We will ensure to keep doing this throughout the project.