Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Device Hardware json and svg graphics #1449

Merged
merged 10 commits into from
Dec 10, 2024

Conversation

jamesarich
Copy link
Contributor

Adds device_hardware.json, DeviceHardware model, svg device graphics, and convenience methods to parse the json and map it to DeviceHardware model and image resource.

Allows for better hardware device display names, graphics, and indication of support.

image

Allows for better hardware device display names, graphics, and indication of support.
Use the first image name from the `images` list (after removing the ".svg" suffix) to find the corresponding vector drawable resource.
@andrekir
Copy link
Member

andrekir commented Dec 6, 2024

Please move the images from the detail section to a header at the top of the screen. The header should place the image in focus without overwhelming the rest of the screen, so it also needs to work well with both horizontal and vertical images. Maybe use a complementary background with the hardware name under the image.

Updated the device detail layout to group device-specific information under a "Device" category.
Added a circular background with device-specific color behind the device icon.
Moved hardware, support status details to the Device section.
@jamesarich
Copy link
Contributor Author

jamesarich commented Dec 6, 2024

@andrekir - i moved the relevant device info up to a new Device section above the Details. I also restricted the device image size and gave it a circular background with the node color (alpha 50%).

image

@jamesarich jamesarich marked this pull request as ready for review December 6, 2024 15:13
Moves the logic for retrieving device hardware information and image resources from NodeDetail to MetricsViewModel.

Also replaces id lookup with when statement for image resource id mapping.
@jamesarich
Copy link
Contributor Author

@andrekir - I moved the DeviceHardware and image res functions to MetricsViewModel, and added some State variables.

The DeviceHardware json parsing now has exception handling and is cached in the model to avoid expensive rereads.

I also updated the image res function to use when mapping from HardwareModel enum to Drawable resource id. This function will need to be updated when new images are added.

@jamesarich jamesarich requested a review from andrekir December 9, 2024 19:49
@andrekir andrekir merged commit 993f659 into meshtastic:master Dec 10, 2024
5 checks passed
@jamesarich jamesarich deleted the device_hardware branch December 10, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants