-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add lockable capability to Submenu module #2289
Add lockable capability to Submenu module #2289
Conversation
This will prevent to break existing apps
Use cases are? |
One use case might be to show the user the ability to perform a certain action, but not at that time because prerequisites are required (e.g., full card reading). For example here: nfc_scene_mf_classic_menu.c#L25 The "Detect Reader" option may always be visible to inform the user that there is an opportunity to run it, but not at this time because the card has not been read. Could be useful in external apps too. |
Sounds like too over specialized feature. |
No problem! |
API additions: - `submenu_add_lockable_item()`: based on flipperdevices#2289 which was rejected, CFWs merged it and improved it over time, theres a few apps that use it by now (example usecase: highlighting that some features are not available in current configuration / state) - `submenu_set_orientation()`: can have vertical submenu (user's preference for ux, same concept works great in infrared app, could be reused there to make more of the app vertical instead of having to keep switching) - `variable_item_list_get()`: get and allow editing an item after creation (example usecase: editing one option changes state of other entries in the list, like if they are locked due to incompatible settings or if they have different labels or values) - `variable_item_list_set_header()`: feature parity with `submenu` widget (example usecase: headers are pretty but want editable options not just a list) - `variable_item_set_item_label()`: allow changing label after adding item (example usecase: want to show index of item, can have value shown and put (1/10) in label dynamically, also probably more, allows more creativity) - `variable_item_set_locked()`: same as above for `submenu`, based on same code but ported to varitemlist by me. also allows setting locked state after the fact, remembers locked message so after creation you can toggle with `set_locked(item, false/true, NULL)` (example usecase, some settings combinations in this screen are incompatible, like GPIO pins overlapping when configuring) General improvements: - Can have header in Variable Item List - Can have a vertical Submenu - Can lock items in Variable Item List and Submenu - Variable Item List label and value scroll if too long - Variable Item List value arrows shrink if value is < 4 characters - More freedom and usefulness in Variable Item List API - Cleaned up some parts of the code and some magic numbers are now defined Acknowlegments: - Original submenu lockable items code by @giacomoferretti in flipperdevices#2289 - Vertical submenu and some code improvements by Unleashed CFW team - Most other edits by me @Willy-JL - Hope I'm not forgetting someone else that was involved
What's new
Verification
Screenshots
Checklist (For Reviewer)