From 0922b1f2b7835125e65414536067add2f67e81a3 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Wed, 8 Jan 2025 14:13:29 +0800 Subject: [PATCH] Add info and sample for set_edit_mode_button function --- README.md | 7 ++++++- samples/edit_menu_buttons.lua | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 samples/edit_menu_buttons.lua diff --git a/README.md b/README.md index 5301e2b..f40ec99 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ The type of script is determined by the line (meta tag) at the beginning of the # Changelog +### 5.6.0 + +* Added `ui:set_edit_mode_buttons()` method + ### 5.5.4 * Added `icon` meta tag @@ -128,7 +132,8 @@ _AIO Launcher also offers a way to create more complex UIs: [instructions](READM * `ui:set_title()` - changes the title of the widget, should be called before the data display function (empty line - reset to the standard title); * `ui:set_folding_flag(boolean)` - sets the flag of the folded mode of the widget, the function should be called before the data display functions; * `ui:folding_flag()` - returns folding flag; -* `ui:set_progress(float)` - sets current widget progress (like in Player and Health widgets). +* `ui:set_progress(float)` - sets current widget progress (like in Player and Health widgets); +* `ui:set_edit_mode_buttons(table)` - adds icons listed in the table (formatted as `"fa:name"`) to the edit mode. When an icon is clicked, the function `on_edit_mode_button_click(index)` will be called. The `ui:show_chart()` function takes a string as its third argument to format the x and y values on the screen. For example, the string `x: date y: number` means that the X-axis values should be formatted as dates, and the Y-values should be formatted as a regular number. There are four formats in total: diff --git a/samples/edit_menu_buttons.lua b/samples/edit_menu_buttons.lua new file mode 100644 index 0000000..bf8184c --- /dev/null +++ b/samples/edit_menu_buttons.lua @@ -0,0 +1,10 @@ +edit_mode_buttons = { "fa:home", "fa:heart", "fa:gamepad" } + +function on_resume() + ui:set_edit_mode_buttons(edit_mode_buttons) + ui:show_text("Swipe to ppen edit mode") +end + +function on_edit_mode_button_click(idx) + ui:show_toast(edit_mode_buttons[idx]) +end