本帖最后由 hoibo 于 2023-9-14 13:52 编辑
require "import"
import "android.widget.*"
import "android.view.*"
layout=
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="增大音量",
onClick="zdyl",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="上一曲",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="音频闪避",
onClick="ypsb",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="快退",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="播放暂停",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{Button,
text="快进",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
{LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="减小音量",
onClick="jxyl",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
{Button,
text="下一曲",
onClick="mtgn",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
{Button,
text="链接蓝牙读屏是否留在手机",
onClick="qhly",
textColor="#ff00ff00",
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
}
dlg=LuaDialog()
.setView(loadlayout(layout))
.show()
function mtgn(v)
service.execute(v.getText(),node)
end
function ypsb()
if ypkg
service.setAudioFocus(true)
service.asyncSpeak("打开音频闪避")
ypkg=nil
else
service.setAudioFocus(false)
service.asyncSpeak("关闭音频闪避")
ypkg=true
end
end
function qhly()
if qhtd
service.setUseNoBluetooth(false)
service.asyncSpeak("跟随蓝牙")
qhtd=nil
else
service.setUseNoBluetooth(true)
service.asyncSpeak("留在手机")
qhtd=true
end
end
function zdyl()
task(100,function()
service.raiseVolume()
end)
end
function jxyl()
task(100,function()
service.lowerVolume()
end)
end |