Replace deprecated functions in many scripts

This commit is contained in:
Evgeny
2025-06-05 17:05:34 +08:00
parent aa215947c9
commit 2ab316efd6
12 changed files with 34 additions and 34 deletions

View File

@@ -2,7 +2,7 @@
-- description = "AIO wrapper for the Amdroid Next alarm app widget" -- description = "AIO wrapper for the Amdroid Next alarm app widget"
-- type = "widget" -- type = "widget"
-- author = "Theodor Galanis (t.me/TheodorGalanis)" -- author = "Theodor Galanis (t.me/TheodorGalanis)"
-- version = "1.10" -- version = "1.11"
-- foldable = "false" -- foldable = "false"
-- uses_app = "com.amdroidalarmclock.amdroid" -- uses_app = "com.amdroidalarmclock.amdroid"
@@ -46,7 +46,7 @@ function on_click(idx)
end end
function on_settings() function on_settings()
ui:show_dialog("Amdroid app Next Alarm widget", "This script wrapper uses Amdroid app's Next alarm widget to display the next scheduled alarm. No settings are required.") dialogs:show_dialog("Amdroid app Next Alarm widget", "This script wrapper uses Amdroid app's Next alarm widget to display the next scheduled alarm. No settings are required.")
end end
function setup_app_widget() function setup_app_widget()

View File

@@ -3,7 +3,7 @@
-- description = "Shows upcoming birthdays from the contacts" -- description = "Shows upcoming birthdays from the contacts"
-- type = "widget" -- type = "widget"
-- author = "Andrey Gavrilov" -- author = "Andrey Gavrilov"
-- version = "1.2" -- version = "1.3"
local prefs = require "prefs" local prefs = require "prefs"
local fmt = require "fmt" local fmt = require "fmt"
@@ -104,7 +104,7 @@ function on_click(idx)
end end
function on_settings() function on_settings()
ui:show_radio_dialog("Number of events", {1,2,3,4,5,6,7,8,9,10}, prefs.count) dialogs:show_radio_dialog("Number of events", {1,2,3,4,5,6,7,8,9,10}, prefs.count)
end end
function on_dialog_action(idx) function on_dialog_action(idx)

View File

@@ -2,7 +2,7 @@
-- description = "Скрипт показывает историю вызов через прямое чтение базы звонков" -- description = "Скрипт показывает историю вызов через прямое чтение базы звонков"
-- type = "widget" -- type = "widget"
-- author = "Andrey Gavrilov" -- author = "Andrey Gavrilov"
-- version = "1.0" -- version = "1.1"
-- lang = "ru" -- lang = "ru"
-- root = "true" -- root = "true"
@@ -77,7 +77,7 @@ end
function on_click(idx) function on_click(idx)
if math.ceil(idx/3) > #tab then if math.ceil(idx/3) > #tab then
ui:show_radio_dialog("Выберите тип вызовов",types,typ) dialogs:show_radio_dialog("Выберите тип вызовов",types,typ)
else else
local cmd = "am start -a android.intent.action.DIAL -d tel:"..tab[math.ceil(idx/3)].number local cmd = "am start -a android.intent.action.DIAL -d tel:"..tab[math.ceil(idx/3)].number
system:exec(cmd) system:exec(cmd)

View File

@@ -2,7 +2,7 @@
-- description = "Game" -- description = "Game"
-- type = "widget" -- type = "widget"
-- author = "Andrey Gavrilov" -- author = "Andrey Gavrilov"
-- version = "1.0" -- version = "1.1"
local json = require "json" local json = require "json"
local folded = "15 puzzle" local folded = "15 puzzle"
@@ -96,7 +96,7 @@ end
function on_click(idx) function on_click(idx)
if idx == 0 then if idx == 0 then
ui:show_dialog("Select Action","","Cancel","Reload") dialogs:show_dialog("Select Action","","Cancel","Reload")
return return
else else
local tab = tabs_to_tab(tabs_to_desk(tab_to_tabs(json.decode(files:read("fifteen"))))) local tab = tabs_to_tab(tabs_to_desk(tab_to_tabs(json.decode(files:read("fifteen")))))

View File

@@ -2,7 +2,7 @@
-- description = "AIO wrapper for the Google search app widget - open widget settings for options" -- description = "AIO wrapper for the Google search app widget - open widget settings for options"
-- type = "widget" -- type = "widget"
-- author = "Theodor Galanis (t.me/TheodorGalanis)" -- author = "Theodor Galanis (t.me/TheodorGalanis)"
-- version = "2.6" -- version = "2.7"
-- foldable = "false" -- foldable = "false"
-- uses_app: "com.google.android.googlequicksearchbox" -- uses_app: "com.google.android.googlequicksearchbox"
@@ -53,13 +53,13 @@ elseif idx == indices[4] then
w_bridge:click("image_11") w_bridge:click("image_11")
elseif idx == indices[5] then elseif idx == indices[5] then
w_bridge:click("image_12") w_bridge:click("image_12")
else return else return
end end
end end
function on_settings() function on_settings()
local tab = {"Left-handed mode with weather", "Left-handed mode, no weather", "Right-handed mode with weather", "Right-handed mode, no weather" } local tab = {"Left-handed mode with weather", "Left-handed mode, no weather", "Right-handed mode with weather", "Right-handed mode, no weather" }
ui:show_radio_dialog("Select mode", tab, mode) dialogs:show_radio_dialog("Select mode", tab, mode)
end end
function on_long_click(idx) function on_long_click(idx)
@@ -70,7 +70,7 @@ ui:show_toast("Google weather")
elseif idx == indices[3] then elseif idx == indices[3] then
ui:show_toast("Google discover") ui:show_toast("Google discover")
elseif idx == indices[4] then elseif idx == indices[4] then
ui:show_toast("Google voice search") ui:show_toast("Google voice search")
elseif idx == indices[5] then elseif idx == indices[5] then
ui:show_toast("Google Lens") ui:show_toast("Google Lens")
end end
@@ -86,7 +86,7 @@ end
function setup_app_widget() function setup_app_widget()
local id = widgets:setup("com.google.android.googlequicksearchbox/com.google.android.googlequicksearchbox.SearchWidgetProvider") local id = widgets:setup("com.google.android.googlequicksearchbox/com.google.android.googlequicksearchbox.SearchWidgetProvider")
if (id ~= nil) then if (id ~= nil) then
prefs.wid = id prefs.wid = id
else else
@@ -125,4 +125,4 @@ tab.category = "MAIN"
tab.package = "com.google.android.googlequicksearchbox" tab.package = "com.google.android.googlequicksearchbox"
tab.component = "com.google.android.googlequicksearchbox/com.google.android.apps.search.weather.WeatherExportedActivity" tab.component = "com.google.android.googlequicksearchbox/com.google.android.apps.search.weather.WeatherExportedActivity"
return tab return tab
end end

View File

@@ -2,7 +2,7 @@
-- data_source = "https://translate.google.com" -- data_source = "https://translate.google.com"
-- type = "widget" -- type = "widget"
-- author = "Andrey Gavrilov" -- author = "Andrey Gavrilov"
-- version = "1.2" -- version = "1.3"
local json = require "json" local json = require "json"
local uri = "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto" local uri = "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto"
@@ -13,7 +13,7 @@ function on_resume()
end end
function on_click() function on_click()
ui:show_edit_dialog("Enter text") dialogs:show_edit_dialog("Enter text")
end end
function on_dialog_action(text) function on_dialog_action(text)

View File

@@ -4,7 +4,7 @@
-- arguments_help = "Long click button for options, open widget settings for list of buttons" -- arguments_help = "Long click button for options, open widget settings for list of buttons"
--foldable = "true" --foldable = "true"
-- author = "Theodor Galanis" -- author = "Theodor Galanis"
-- version = "2.5" -- version = "2.6"
md_colors = require "md_colors" md_colors = require "md_colors"
@@ -35,7 +35,7 @@ function on_long_click(idx)
pos = idx pos = idx
local tab = settings:get() local tab = settings:get()
label = get_label(actions[get_checkbox_idx()[idx]]) label = get_label(actions[get_checkbox_idx()[idx]])
if label == nil then if label == nil then
label = names[get_checkbox_idx()[idx]] label = names[get_checkbox_idx()[idx]]
end end
ui:show_context_menu({{"angle-left",""},{"ban",""},{"angle-right",""},{icons[get_checkbox_idx()[idx]]:gsub("fa:",""),label}}) ui:show_context_menu({{"angle-left",""},{"ban",""},{"angle-right",""},{icons[get_checkbox_idx()[idx]]:gsub("fa:",""),label}})
@@ -66,13 +66,13 @@ axions = aio:actions()
lab = {} lab = {}
for i = 1, #axions do for i = 1, #axions do
lav = get_label(actions[i]) lav = get_label(actions[i])
if lav == nil then if lav == nil then
table.insert(lab,names[i]) table.insert(lab,names[i])
else else
table.insert(lab, lav) table.insert(lab, lav)
end end
end end
ui:show_checkbox_dialog("Select actions", lab, get_checkbox_idx()) dialogs:show_checkbox_dialog("Select actions", lab, get_checkbox_idx())
end end
--utilities-- --utilities--
@@ -140,4 +140,4 @@ axions = aio:actions()
return action["label"] return action["label"]
end end
end end
end end

View File

@@ -1,7 +1,7 @@
-- name = "ТВ-Программа" -- name = "ТВ-Программа"
-- description = "Программа передач россиийского ТВ" -- description = "Программа передач россиийского ТВ"
-- type = "widget" -- type = "widget"
-- version = "1.0" -- version = "1.1"
-- lang = "ru" -- lang = "ru"
-- author = "Andrey Gavrilov" -- author = "Andrey Gavrilov"
@@ -23,9 +23,9 @@ end
function on_click(idx) function on_click(idx)
if math.ceil(idx/2) > #tab_desc then if math.ceil(idx/2) > #tab_desc then
ui:show_edit_dialog("Введите название канала","",title) dialogs:show_edit_dialog("Введите название канала","",title)
else else
ui:show_dialog(tab_name[math.ceil(idx/2)].."\n"..tab_time[math.ceil(idx/2)],tab_desc[math.ceil(idx/2)],"Перейти к каналу") dialogs:show_dialog(tab_name[math.ceil(idx/2)].."\n"..tab_time[math.ceil(idx/2)],tab_desc[math.ceil(idx/2)],"Перейти к каналу")
link = tab_link[math.ceil(idx/2)] link = tab_link[math.ceil(idx/2)]
end end
end end

View File

@@ -2,7 +2,7 @@
-- description = "Turns screen widgets on and off when buttons are pressed" -- description = "Turns screen widgets on and off when buttons are pressed"
-- type = "widget" -- type = "widget"
-- author = "Andrey Gavrilov" -- author = "Andrey Gavrilov"
-- version = "3.0" -- version = "3.1"
prefs = require "prefs" prefs = require "prefs"
@@ -56,7 +56,7 @@ function on_dialog_action(data)
end end
function on_settings() function on_settings()
ui:show_checkbox_dialog("Select widgets", widgets.label, indexes) dialogs:show_checkbox_dialog("Select widgets", widgets.label, indexes)
end end
function get_indexes(tab1,tab2) function get_indexes(tab1,tab2)

View File

@@ -32,7 +32,7 @@ end
function on_settings() function on_settings()
dialog_id = "settings" dialog_id = "settings"
ui:show_checkbox_dialog("Check calendars", get_all_cals()[3],cal_id_to_id(settings:get())) dialogs:show_checkbox_dialog("Check calendars", get_all_cals()[3],cal_id_to_id(settings:get()))
end end
function on_click(i) function on_click(i)
@@ -51,7 +51,7 @@ function on_click(i)
on_resume() on_resume()
elseif i > 1 and i < 8 then elseif i > 1 and i < 8 then
dialog_id = "date" dialog_id = "date"
ui:show_edit_dialog("Enter month and year", "Format - 12.2020. Empty value - current month", string.format("%02d.%04d", month, year)) dialogs:show_edit_dialog("Enter month and year", "Format - 12.2020. Empty value - current month", string.format("%02d.%04d", month, year))
return return
elseif (i-1)%8 ~= 0 and tab[i] ~= " " then elseif (i-1)%8 ~= 0 and tab[i] ~= " " then
day = tab[i]:match(">(%d+)<"):gsub("^0","") day = tab[i]:match(">(%d+)<"):gsub("^0","")

View File

@@ -20,7 +20,7 @@ function redraw()
end end
function on_click(idx) function on_click(idx)
ui:show_edit_dialog("Enter command") dialogs:show_edit_dialog("Enter command")
end end
function on_dialog_action(text) function on_dialog_action(text)

View File

@@ -37,10 +37,10 @@ end
function on_click(idx) function on_click(idx)
if idx == 1 then if idx == 1 then
dialog_id ="amount" dialog_id ="amount"
ui:show_edit_dialog("Enter amount", "", amount) dialogs:show_edit_dialog("Enter amount", "", amount)
elseif idx == 2 then elseif idx == 2 then
dialog_id = "unit_from" dialog_id = "unit_from"
ui:show_radio_dialog("Select unit",get_radio_tab(unit),get_radio_idx(unit_from)) dialogs:show_radio_dialog("Select unit",get_radio_tab(unit),get_radio_idx(unit_from))
elseif idx == 3 then elseif idx == 3 then
local unit_tmp = unit_from local unit_tmp = unit_from
unit_from = unit_to unit_from = unit_to
@@ -50,10 +50,10 @@ function on_click(idx)
system:copy_to_clipboard(sum) system:copy_to_clipboard(sum)
elseif idx == 5 then elseif idx == 5 then
dialog_id = "unit_to" dialog_id = "unit_to"
ui:show_radio_dialog("Select unit",get_radio_tab(unit),get_radio_idx(unit_to)) dialogs:show_radio_dialog("Select unit",get_radio_tab(unit),get_radio_idx(unit_to))
elseif idx == 6 then elseif idx == 6 then
dialog_id = "unit" dialog_id = "unit"
ui:show_radio_dialog("Select converter",get_radio_tab(""),get_radio_idx(unit)) dialogs:show_radio_dialog("Select converter",get_radio_tab(""),get_radio_idx(unit))
end end
end end