add vibrate and alarm functions

This commit is contained in:
Evgeny
2021-09-02 13:29:12 +03:00
parent 6e4bd5c02d
commit 340e342f19
3 changed files with 15 additions and 0 deletions

View File

@@ -83,6 +83,8 @@ When you click on any menu item, the collab `on_context_menu_click(item_idx)` wi
* `system:get_location()` - returns the location in the table with two values (location request is NOT executed, the value previously saved by the system is used);
* `system:copy_to_clipboard(string)` - copies the string to the clipboard;
* `system:get_from_clipboard()` - returns a string from the clipboard:
* `system:vibrate(milliseconds)` - vibrate;
* `system:alarm_sound(seconds)` - make alarm sound;
* `system:share_text(string)` - opens the "Share" system dialog;
* `system:get_lang()` - returns the language selected in the system;
* `system:get_tz_offset()` - returns TimeZone offset in seconds;

View File

@@ -84,6 +84,8 @@ ui:show_context_menu({
* `system:copy_to_clipboard(string)` - копирует строку в буфер обмена;
* `system:get_from_clipboard()` - возвращает строку из буфера обмена:
* `system:share_text(string)` - открывает системный диалог "Поделиться";
* `system:vibrate(milliseconds)` - вибрация;
* `system:alarm_sound(seconds)` - издать звук будильника;
* `system:get_lang()` - возвращает выбранный в системе язык;
* `system:get_tz_offset()` - возвращает time zone offset в секундах.
* `system:get_battery_info()` - возвращает таблицу с информацией о состоянии батареи;

11
samples/alarm-sample.lua Normal file
View File

@@ -0,0 +1,11 @@
function on_resume()
ui:show_lines({ "Vibrate", "Alarm" })
end
function on_click(idx)
if idx == 1 then
system:vibrate(500)
else
system:alarm_sound(5)
end
end