hoibo 发表于 2023-9-14 13:48:38

媒体控制面板,包括播放暂停上一曲下一曲快进快退音频闪避和蓝牙时读屏声音通道的切换

本帖最后由 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

talkback 发表于 2023-9-14 22:40:37

快退和快进的秒数能自定义吗?



来自解说社区客户端

hoibo 发表于 2023-9-18 23:34:00

回复 沙发talkback

秒数这个自定义不了啊。这个是调用读屏的功能。



来自解说社区客户端
页: [1]
查看完整版本: 媒体控制面板,包括播放暂停上一曲下一曲快进快退音频闪避和蓝牙时读屏声音通道的切换