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

Add lockable capability to Submenu module #2289

Conversation

giacomoferretti
Copy link
Contributor

What's new

  • Submenu items can now be locked. When clicked, they will display a help message.

Verification

  • Read new code (or write a simple app that uses this new function)

Screenshots

lockable1
lock3
lockable2

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

@giacomoferretti giacomoferretti marked this pull request as ready for review January 10, 2023 23:51
@hedger hedger added UI Affects UI New Feature Contains an IMPLEMENTATION of a new feature labels Jan 11, 2023
@skotopes
Copy link
Member

Use cases are?

@giacomoferretti
Copy link
Contributor Author

giacomoferretti commented Jan 17, 2023

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.

@skotopes
Copy link
Member

Sounds like too over specialized feature.
That is kinda contradicts with idea of small and simple toolkit.

@skotopes skotopes closed this Jan 17, 2023
@giacomoferretti
Copy link
Contributor Author

No problem!

Willy-JL added a commit to Willy-JL/flipperzero-firmware that referenced this pull request Apr 30, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Feature Contains an IMPLEMENTATION of a new feature UI Affects UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants