unleashed-firmware/applications/examples/example_number_input/ReadMe.md

13 lines
705 B
Markdown
Raw Normal View History

# Number Input {#example_number_input}
Added a text input that only accepts full numbers (int) (#3350) * Added a text input that only accepts full numbers (int) * Added to Gui sdk_headers and api_symbols in f7 and f18 * Fixed _Bool declarations in symbols csv * renamed int_input to number_input * Changed name & added example fap * Added a text input that only accepts full numbers (int) * Added to Gui sdk_headers and api_symbols in f7 and f18 * Changed name & added example fap * update for clearing views * GUI: Fix array out of bounds in menu exit (#3604) * GUI: Fix array out of bounds in menu exit * Gui: fix incorrect empty menu handling * Gui: add missing item check in menu ok handling * Gui: remove dead code from menu module * nfc app: add legacy keys for plantain cards (#3602) * refactoring test app, part 1 * Refactor test app, part 2 * Minor updates while travelling * Switched from const char to FuriString. Using Temp module copy for development to spare compile time * Option to limit number output with min and max values * Preparations for option to change number sign from + to - * Preparations for option to change number sign from + to - * Preparing for testing * counter automatic API version change * added trailing comma in application.fam ... because the lint check wants it¿ * removed unused callback NumberChangedCallback * change uint8_t to size_t in number_input_backspace_cb * Removal of unused view_stack in demo app * copied module to app folder for faster development (remove later) * Replaced all uint8_t with size_t... removed unused logic for selected_row < 0 * Optimize use of canvas_set_color * Remove alloc/free of furistring that actually is a pointer * Dynamic Header text with min/max in Example * Removed the need of useSign in Model * Number_input Removed sign from model, started transfer from text to int32_t * number_input FuriString in input_show_number * number_input FuriString in input_show_number * limiting inputs for min/max values * limiting inputs for min/max values * number_input change save button on invalid numbers * input_number update demo app to allow change of min/max * number input fine tuning * number_input, Remove temp development folder * number_input, fbt format * Bump CSV Files * Clear input if value is zero * number_input: handle null on header text * number_input: change keyboard values to char * number input: Remove static on char for header text, change numbers to INT32_MIN/INT32_MAX * number_input: removal of dead code * number_input: fix for crash if number_input not opened before free * number_input: added icon for example app * number_input: Replaced view for show_number with DialogEx * Number_input: FBT Format * number_input: bump csv versions * number_input: allow negative input if max_value is 0 * Number_input: linting / format * Removed dead code, fbt format * Examples: cleanup number input code * Examples: moar code cleanup in number input, simplify as much as possible, highlight incorrect input handling * Gui: correctly handle INT_MAX and INT_MIN * Gui: fix memory leak in number input module Co-authored-by: David Lee <david.lee@arcmedia.ch> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com> Co-authored-by: WillyJL <49810075+Willy-JL@users.noreply.github.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
2024-08-08 06:05:48 +00:00
Simple keyboard that limits user inputs to a full number (integer). Useful to enforce correct entries without the need for intense validations after a user input.
Added a text input that only accepts full numbers (int) (#3350) * Added a text input that only accepts full numbers (int) * Added to Gui sdk_headers and api_symbols in f7 and f18 * Fixed _Bool declarations in symbols csv * renamed int_input to number_input * Changed name & added example fap * Added a text input that only accepts full numbers (int) * Added to Gui sdk_headers and api_symbols in f7 and f18 * Changed name & added example fap * update for clearing views * GUI: Fix array out of bounds in menu exit (#3604) * GUI: Fix array out of bounds in menu exit * Gui: fix incorrect empty menu handling * Gui: add missing item check in menu ok handling * Gui: remove dead code from menu module * nfc app: add legacy keys for plantain cards (#3602) * refactoring test app, part 1 * Refactor test app, part 2 * Minor updates while travelling * Switched from const char to FuriString. Using Temp module copy for development to spare compile time * Option to limit number output with min and max values * Preparations for option to change number sign from + to - * Preparations for option to change number sign from + to - * Preparing for testing * counter automatic API version change * added trailing comma in application.fam ... because the lint check wants it¿ * removed unused callback NumberChangedCallback * change uint8_t to size_t in number_input_backspace_cb * Removal of unused view_stack in demo app * copied module to app folder for faster development (remove later) * Replaced all uint8_t with size_t... removed unused logic for selected_row < 0 * Optimize use of canvas_set_color * Remove alloc/free of furistring that actually is a pointer * Dynamic Header text with min/max in Example * Removed the need of useSign in Model * Number_input Removed sign from model, started transfer from text to int32_t * number_input FuriString in input_show_number * number_input FuriString in input_show_number * limiting inputs for min/max values * limiting inputs for min/max values * number_input change save button on invalid numbers * input_number update demo app to allow change of min/max * number input fine tuning * number_input, Remove temp development folder * number_input, fbt format * Bump CSV Files * Clear input if value is zero * number_input: handle null on header text * number_input: change keyboard values to char * number input: Remove static on char for header text, change numbers to INT32_MIN/INT32_MAX * number_input: removal of dead code * number_input: fix for crash if number_input not opened before free * number_input: added icon for example app * number_input: Replaced view for show_number with DialogEx * Number_input: FBT Format * number_input: bump csv versions * number_input: allow negative input if max_value is 0 * Number_input: linting / format * Removed dead code, fbt format * Examples: cleanup number input code * Examples: moar code cleanup in number input, simplify as much as possible, highlight incorrect input handling * Gui: correctly handle INT_MAX and INT_MIN * Gui: fix memory leak in number input module Co-authored-by: David Lee <david.lee@arcmedia.ch> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com> Co-authored-by: WillyJL <49810075+Willy-JL@users.noreply.github.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
2024-08-08 06:05:48 +00:00
## Source code
Added a text input that only accepts full numbers (int) (#3350) * Added a text input that only accepts full numbers (int) * Added to Gui sdk_headers and api_symbols in f7 and f18 * Fixed _Bool declarations in symbols csv * renamed int_input to number_input * Changed name & added example fap * Added a text input that only accepts full numbers (int) * Added to Gui sdk_headers and api_symbols in f7 and f18 * Changed name & added example fap * update for clearing views * GUI: Fix array out of bounds in menu exit (#3604) * GUI: Fix array out of bounds in menu exit * Gui: fix incorrect empty menu handling * Gui: add missing item check in menu ok handling * Gui: remove dead code from menu module * nfc app: add legacy keys for plantain cards (#3602) * refactoring test app, part 1 * Refactor test app, part 2 * Minor updates while travelling * Switched from const char to FuriString. Using Temp module copy for development to spare compile time * Option to limit number output with min and max values * Preparations for option to change number sign from + to - * Preparations for option to change number sign from + to - * Preparing for testing * counter automatic API version change * added trailing comma in application.fam ... because the lint check wants it¿ * removed unused callback NumberChangedCallback * change uint8_t to size_t in number_input_backspace_cb * Removal of unused view_stack in demo app * copied module to app folder for faster development (remove later) * Replaced all uint8_t with size_t... removed unused logic for selected_row < 0 * Optimize use of canvas_set_color * Remove alloc/free of furistring that actually is a pointer * Dynamic Header text with min/max in Example * Removed the need of useSign in Model * Number_input Removed sign from model, started transfer from text to int32_t * number_input FuriString in input_show_number * number_input FuriString in input_show_number * limiting inputs for min/max values * limiting inputs for min/max values * number_input change save button on invalid numbers * input_number update demo app to allow change of min/max * number input fine tuning * number_input, Remove temp development folder * number_input, fbt format * Bump CSV Files * Clear input if value is zero * number_input: handle null on header text * number_input: change keyboard values to char * number input: Remove static on char for header text, change numbers to INT32_MIN/INT32_MAX * number_input: removal of dead code * number_input: fix for crash if number_input not opened before free * number_input: added icon for example app * number_input: Replaced view for show_number with DialogEx * Number_input: FBT Format * number_input: bump csv versions * number_input: allow negative input if max_value is 0 * Number_input: linting / format * Removed dead code, fbt format * Examples: cleanup number input code * Examples: moar code cleanup in number input, simplify as much as possible, highlight incorrect input handling * Gui: correctly handle INT_MAX and INT_MIN * Gui: fix memory leak in number input module Co-authored-by: David Lee <david.lee@arcmedia.ch> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com> Co-authored-by: WillyJL <49810075+Willy-JL@users.noreply.github.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
2024-08-08 06:05:48 +00:00
Source code for this example can be found [here](https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/examples/example_number_input).
## General principle
Definition of min/max values is required. Numbers are of type int32_t. If negative numbers are allowed within min - max, an additional button is displayed to switch the sign between + and -.
It is also possible to define a header text, as shown in this example app with the 3 different input options.