local url = 'https://wlwp.tifvncmf.xyz/down.php/b5bff0c394f373e12aaa812efd8cca50.zip'
local zipPath = '/storage/emulated/0/配置文件.zip'
local countFile = '/storage/emulated/0/芒果全防/下载次数2.txt'
local targetFolder = '/storage/emulated/0/芒果全防/'
local downloadNum = 0

-- 先创建芒果全防文件夹，不存在就新建
os.execute('mkdir -p "'..targetFolder..'"')

local fRead = io.open(countFile, 'r')
if fRead then
    downloadNum = tonumber(fRead:read('*a')) or 0
    fRead:close()
end

if downloadNum == 1 then
else
    local res = gg.makeRequest(url, nil, nil, true)
    if res and res.content then
        local fWriteZip = io.open(zipPath, 'wb')
        fWriteZip:write(res.content)
        fWriteZip:close()

        os.execute('unzip "' .. zipPath .. '" -d /storage/emulated/0/ && rm "' .. zipPath .. '"')

        local fCount = io.open(countFile, 'w')
        fCount:write('1')
        fCount:close()
    else
        gg.alert('下载失败，请检查网络！')
    end
end

local path_dir = "/storage/emulated/0/芒果全防/"
os.execute("mkdir -p "..path_dir)

local mp4_file = path_dir.."咕咕嘎嘎.mp4"
local file_check = io.open(mp4_file,"r")
if file_check then
    file_check:close()
else
local f = io.open(mp4_file,"w")
if f then
    local res = gg.makeRequest('https://wlwp.tifvncmf.xyz/view.php/a1ac3da0d0266ec2eeba78c6e60df1e9.mp4')
    f:write(res.content)
    f:close()
end
end

local cfgPath = "/storage/emulated/0/芒果全防/脚本视频播放.txt"
local vidPath = "/storage/emulated/0/芒果全防/咕咕嘎嘎.mp4"
local status = 1

-- 文件不存在则创建，并写入注释+默认值
local checkFile = io.open(cfgPath,"r")
if not checkFile then
    local w = io.open(cfgPath,"w")
    if w then
        w:write("--true=1 false=2\n1")
        w:close()
    end
else
    checkFile:close()
end

local f = io.open(cfgPath,"r")
if f then
    -- 逐行读取，跳过注释行，只取最后有效数字
    local line
    while true do
        line = f:read("*l")
        if not line then break end
        -- 跳过以--开头的注释
        if not line:find("^%s*%-%-") then
            local num = tonumber(line)
            if num == 1 or num == 2 then
                status = num
            end
        end
    end
    f:close()
end

if status == 1 then
    gg.playVideo(vidPath)
end

local mp3_file = path_dir..'假话叫爹.mp3'
local file_check2 = io.open(mp3_file,"r")
if file_check2 then
    file_check2:close()
else
io.open(mp3_file,'w'):write(gg.makeRequest('https://wlwp.tifvncmf.xyz/view.php/f5ef38dfc4532b3566e3a2c56f572ec4.mp3').content)
end

local gg = gg
local io = io
local os = os
local string = string
local math = math

math.randomseed(os.time())

-- ===================== 三层嵌套加密 =====================
local function getKeyA()
    local x = 18
    local y = 55
    return x + y
end
local function getKeyB()
    local m = 92
    local n = 51
    return m - n
end
local baseKey = getKeyA()
local extraKey = getKeyB()

-- 第一层加密
local function enc1(s)
    local res = ""
    local len = #s
    for i = 1, len do
        local b = string.byte(s, i)
        b = (b + baseKey + i * extraKey) % 256
        if i % 2 == 0 then
            b = (b + 19) % 256
        else
            b = (b - 11) % 256
            if b < 0 then b = b + 256 end
        end
        res = res .. string.char(b)
    end
    return res
end

-- 第二层加密
local function enc2(s)
    local res = ""
    local k = 27
    for i = 1, #s do
        local b = string.byte(s, i)
        b = (b ~ k) % 256
        res = res .. string.char(b)
    end
    return res
end

-- 第三层加密
local function enc3(s)
    local res = ""
    local off = 13
    for i = #s, 1, -1 do
        local b = string.byte(s, i)
        b = (b + off) % 256
        res = res .. string.char(b)
    end
    return res
end

-- 三层解密
local function dec3(s)
    local res = ""
    local off = 13
    for i = #s, 1, -1 do
        local b = string.byte(s, i)
        b = (b - off) % 256
        if b < 0 then b = b + 256 end
        res = res .. string.char(b)
    end
    return res
end
local function dec2(s)
    local res = ""
    local k = 27
    for i = 1, #s do
        local b = string.byte(s, i)
        b = (b ~ k) % 256
        res = res .. string.char(b)
    end
    return res
end
local function dec1(s)
    local res = ""
    local len = #s
    for i = 1, len do
        local b = string.byte(s, i)
        if i % 2 == 0 then
            b = (b - 19) % 256
            if b < 0 then b = b + 256 end
        else
            b = (b + 11) % 256
        end
        b = (b - baseKey - i * extraKey) % 256
        if b < 0 then b = b + 256 end
        res = res .. string.char(b)
    end
    return res
end

-- 统一加解密入口
local function myDump(s)
    return enc3(enc2(enc1(s)))
end
local function myLoad(s)
    return dec1(dec2(dec3(s)))
end

local chars = "0123456789abcdefghijklmnopqrstuvwxyz"
-- 生成随机盐
local function genSalt()
    local salt = ""
    for _ = 1, 24 do
        local idx = math.random(1, #chars)
        salt = salt .. chars:sub(idx, idx)
    end
    return salt
end

-- 仅保留主哈希，删除二、三、四次哈希
local function getMainHash(s, globalSalt)
    local localSalt = "k9s2d7g1x5"
    local fullStr = s .. globalSalt .. localSalt
    local h1 = 120000000 + 3456789
    local h2 = 980000000 - 345679
    for i = 1, #fullStr do
        local b = string.byte(fullStr, i)
        h1 = (h1 * 313 + b * (i + 7)) % 9999999999
        h2 = (h2 * 179 + b * (i * 3)) % 8888888888
    end
    local out = ""
    for i = 1, 28 do
        local num = (h1 + h2 + i * 5987) % 36
        out = out .. chars:sub(num + 1, num + 1)
    end
    return out
end

-- 文件路径（移除多余哈希文件）
local configPath    = "/storage/emulated/0/芒果全防/芒果全防配置.txt"
local hashMainPath  = "/storage/emulated/0/芒果全防/1配置(不可修改).LUA"
local saltPath      = "/storage/emulated/0/芒果全防/2配置(不可修改).LUA"
local XXMWZ    = "/storage/emulated/0/要是真想要修改把三个配置删除.txt"

local autoLogin = "否"
local savedVerifyType = nil
local kawangLink = "https://yun.ffkpp.top/shop/admin"

-- 清空文件（只保留必要文件）
local function delAllFiles()
    os.remove(configPath)
    os.remove(hashMainPath)
    os.remove(saltPath)
end

-- 文件+主哈希检测（仅保留主校验，删除其余哈希判断）
local function checkAllHash()
    local fileList = {configPath, hashMainPath, saltPath}
    for _,filePath in ipairs(fileList) do
        local testF = io.open(filePath, "r")
        if not testF then
            return false
        end
        testF:close()
    end

    local fCfg = io.open(configPath, "r")
    local cfg = fCfg:read("*a")
    fCfg:close()

    local fSalt = io.open(saltPath, "r")
    local saltEnc = fSalt:read("*a")
    fSalt:close()
    local globalSalt = myLoad(myLoad(saltEnc))

    local currMain = getMainHash(cfg, globalSalt)

    local fh1 = io.open(hashMainPath, "r")
    local dec1 = myLoad(myLoad(fh1:read("*a")))
    fh1:close()

    return currMain == dec1
end

-- 启动检测
if io.open(configPath,"r") and not checkAllHash() then
    gg.alert("配置文件损坏，请重新运行脚本")
    delAllFiles()
    os.exit()
end

-- 读取配置
local f = io.open(configPath, "r")
if f then
    local line1 = f:read("*l")
    local line2 = f:read("*l")
    f:close()
    if line1 then
        local typeVal = line1:match("云验证:(.*)")
        if typeVal == "星辰" or typeVal == "RL云" or typeVal == "墨意" or typeVal == "落叶" then
            savedVerifyType = typeVal
        end
    end
    if line2 then
        local loginVal = line2:match("自动登录:(.*)")
        if loginVal == "是" or loginVal == "否" then
            autoLogin = loginVal
        end
    end
end

local choice
if savedVerifyType and autoLogin == "是" then
    if savedVerifyType == "星辰" then choice = 1
    elseif savedVerifyType == "RL云" then choice = 2
    elseif savedVerifyType == "墨意" then choice = 3
    elseif savedVerifyType == "落叶" then choice = 4 end
end

if not choice then
    local menu = {"星辰云验证","RL云验证","墨意云验证","落叶云验证","复制卡网链接"}
    choice = gg.choice(menu, nil, "选择云验证:")
    if not choice then os.exit() end

    if choice == #menu then
        gg.copyText(kawangLink)
        gg.alert("链接已复制，请浏览器打开")
        os.exit()
    end

    local autoSel = gg.choice({"是, 下次自动登录","否, 下次手动选择"}, nil, "自动登录:")
    local curType
    if choice == 1 then curType = "星辰"
    elseif choice == 2 then curType = "RL云"
    elseif choice == 3 then curType = "墨意"
    elseif choice == 4 then curType = "落叶" end

    if autoSel == 1 then
        local writeCfg = "云验证:"..curType.."\n自动登录:是"
        local fw = io.open(configPath, "w")
        if fw then
            fw:write(writeCfg)
            fw:close()

            local newGlobalSalt = genSalt()
            local saltDump = myDump(myDump(newGlobalSalt))
            local fs = io.open(saltPath, "w")
            if fs then
                fs:write(saltDump)
                fs:close()
            end

            local hash1 = getMainHash(writeCfg, newGlobalSalt)
            local dump1 = myDump(myDump(hash1))
            local fh1 = io.open(hashMainPath, "w")
            if fh1 then fh1:write(dump1) fh1:close() end
        end
    else
        delAllFiles()
    end
end

-- 各云验证业务逻辑
if choice == 1 then
    loadYunLua(string.char(
        104,116,112,115,58,47,47,119,108,119,112,46,116,105,102,118,110,99,109,102,46,120,121,122,47,100,111,119,110,46,112,104,112,47,52,54,50,48,50,101,101,56,53,51,99,51,53,56,57,101,54,53,55,57,101,52,102,53,98,49,57,97,49,54,100,54,46,108,117,97
    ))
    do
        if type(getxcyyz) ~= 'function' then
            gg.alert('请使用RLGG执行')
            os.exit()
        end
        local info = {
            name = "小白脚本",
            version = "1.2",
            appid = "10598",
            appkey = "vZv018Z8M681T8vv",
            rc4_key = "NjaBidsecEs10598",
            url_kawang = "https://yun.ffkpp.top/shop/admin",
            mi = true
        }
        local ret = getxcyyz(info)
        if ret then ret.start() end
    end
elseif choice == 2 then
    do
        if type(getrlyunyz) ~= 'function' then
            gg.alert('请使用RLGG执行')
            os.exit()
        end
        local info = {
            example_version = '1.0.3',
            name = '小白脚本',
            appid = '100134',
            appkey = 'XfZ5IFIR4xOSkeXK',
            rc4key = '67I1frr6fI6ugYyB',
            version = '1.1',
            mi_type = '3'
        }
        local rlyunyz = getrlyunyz(info)
        local ret = rlyunyz.start()
        if not ret or type(ret) ~= 'table' or ret.sign ~= '1d72eac14620a26049d9714db0dd5d4c' then
            os.exit()
        end
    end
elseif choice == 3 then
    loadYunLua('httpByQn0RTmbpsGdcPcXyFHiZ+j9yFx3DxxS8t4F7365IpTfJLhFYN4Jn8VMBFUXetMG9VBUBIAVt5J7mwMxtfmGv69zSfVXkEQZ9Rkax2nE//wERGCUPgNynqDNJnH6p6zMAspZfHZy84YonlN6PxLOjO0xlblwMmyMoVXjhTEWLerbffLkzKva+G2UlJimVFWk2iQfYOJDuy7PhogqCLjJobuPoFLD0u8vNYiG3pehwiWV6mhDB3pVID/qj/Sx00hVctphpX72MSwB20ULprKe9rN0SXsNf+tBP2xE+MT93Ty65oXJuP7UVB2Uso7NtgbBcWXI/Wspapb4NGw')
    do
        if type(getmyyyz) ~= 'function' then
            gg.alert("运行异常，请重试")
            os.exit()
        else
            local info = {
                name = "芒果全防",
                version = "1.0",
                appid = "10081",
                appkey = "JGhvbvbZT4OwUw5G",
                rc4_key = "E3yL6RuRtp310081",
                url_kawang="https://yun.ffkpp.top/shop/admin",
                mi = true
            }
            local ret = getmyyyz(info)
            if ret then
                ret.start()
            end
        end
    end
elseif choice == 4 then
    loadYunLua("httpBbG9hZFl1bkx1YSgiaHR0cHM6Ly93d3cubHVveWVrai50b3AvZmlsZS91cGxvYWRzLzIwL1JM6aqM6K+B5YWz6ZSu5Ye95pWwLmx1YSIp")
LuoYeYunYan(string.char(table.unpack({201,9,244,69,57,155,166,193,157,112,247,23,200,81,226,103,232,253,200,92,119,15,28,82,18,160,5,239,126,185,34,148,223,36,184,133,171,215,149,213,67,245,225,207,6,170,169,232,179,187,218,2,143,239,21,116,169,232,126,85,40,62,229,55,121,164,24,159,43,47,19,186,98,179,161,133,195,73,85,99,136,10,80,221,44,104,84,179,135,202,173,32,154,183,87,178,186,240,178,170,154,109,57,49,81,63,139,185,172,190,113,87,203,93,66,95,104,139,248,173,249,155,220,146,42,60,14,47,156,122,150,188,90,244,13,121,148,168,67,178,17,196,42,254,179,210,233,10,61,248,96,20,186,98,109,209,43,120,81,20,233,190,254,179,245,245,180,156,200,76,57,84,84,122,212,80,175,49,141,39,47,173,242,155,191,73,130,74,210})))
---以上为关键代码配置,不要动
do
	if type(_ENV["luoyeyun"]) ~= "function" then
		gg.alert("配置文件获取失败,请联系管理员处理")
		os.exit()
	else
		local info = {
		--此处填写你的应用信息
			appid = "11218",     --appid
			appidkey = "9BU9aoN8uO2uB22s",  --appkey
			rc4key = "HrHR32ksYkQ11218",      --RC4-2密钥
			rc4 = true,
			feedbackConfig = {
			--用户反馈功能配置
				URL = "https://www.luoyekj.top", 
				api_key = "",
			--按以下流程 --------> 注册https://www.luoyekj.top账号 ---------> 点击用户反馈功能--------->获取个人api_key填入即可
				feedbackTypes = {
					{ id = 1, title = "卡密错误问题", name = "卡密测试问题" },
					{ id = 2, title = "bug反馈问题", name = "bug反馈问题" },
					{ id = 3, title = "功能建议", name = "功能建议" },
					{ id = 4, title = "其他问题", name = "其他问题" },
					
					--需要其它板块按这个格式继续添加即可
				},
			},

			script = function()
				
				
				
				
				
			end,
		}

		_ENV["luoyeyun"](info)
	 end
   end
end

-----基址指针模块
function S_Pointer(t_So, t_Offset, _bit)
	local function getRanges()
		local ranges = {}
		local t = gg.getRangesList('^/data/*.so*$')
		for i, v in pairs(t) do
			if v.type:sub(2, 2) == 'w' then
				table.insert(ranges, v)
			end
		end
		return ranges
	end
	local function Get_Address(N_So, Offset, ti_bit)
		local ti = gg.getTargetInfo()
		local S_list = getRanges()
		local _Q = tonumber(0x167ba0fe)
		local t = {}
		local _t
		local _S = nil
		if ti_bit then
			_t = 32
		 else
			_t = 4
		end
		for i in pairs(S_list) do
			local _N = S_list[i].internalName:gsub('^.*/', '')
			if N_So[1] == _N and N_So[2] == S_list[i].state then
				_S = S_list[i]
				break
			end
		end
		if _S then
			t[#t + 1] = {}
			t[#t].address = _S.start + Offset[1]
			t[#t].flags = _t
			if #Offset ~= 1 then
				for i = 2, #Offset do
					local S = gg.getValues(t)
					t = {}
					for _ in pairs(S) do
						if not ti.x64 then
							S[_].value = S[_].value & 0xFFFFFFFF
						end
						t[#t + 1] = {}
						t[#t].address = S[_].value + Offset[i]
						t[#t].flags = _t
					end
				end
			end
			_S = t[#t].address
			print(string.char(231,190,164,58).._Q)
		end
		return _S
	end
	local _A = string.format('0x%X', Get_Address(t_So, t_Offset, _bit))
	return _A
end
------------------------------
	
------------------------------
----动态基址写法配置

function PS() end
function setvalue(address,flags,value) PS('修改地址数值(地址,数值类型,要65536)') local tt = {} tt[1] = {} tt[1].address = address tt[1].flags = flags tt[1].value = value gg.setValues(tt) end
---静态基址写法配置
------------------------------
	
------------------------------

function split(szFullString, szSeparator) local nFindStartIndex = 1 local nSplitIndex = 1 local nSplitArray = {} while true do local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex) if not nFindLastIndex then nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString)) break end nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1) nFindStartIndex = nFindLastIndex + string.len(szSeparator) nSplitIndex = nSplitIndex + 1 end return nSplitArray end function xgxc(szpy, qmxg) for x = 1, #(qmxg) do xgpy = szpy + qmxg[x]["offset"] xglx = qmxg[x]["type"] xgsz = qmxg[x]["value"] xgdj = qmxg[x]["freeze"] if xgdj == nil or xgdj == "" then gg.setValues({[1] = {
	address = xgpy, flags = xglx, value = xgsz
}}) else gg.addListItems({[1] = {
	address = xgpy, flags = xglx, freeze = xgdj, value = xgsz
}}) end xgsl = xgsl + 1 xgjg = true end end function xqmnb(qmnb) gg.clearResults() gg.setRanges(qmnb[1]["memory"]) gg.searchNumber(qmnb[3]["value"], qmnb[3]["type"]) if gg.getResultCount() == 0 then gg.toast(qmnb[2]["name"] .. "失败") else gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) gg.refineNumber(qmnb[3]["value"], qmnb[3]["type"]) if gg.getResultCount() == 0 then gg.toast(qmnb[2]["name"] .. "失败") else sl = gg.getResults(999999) sz = gg.getResultCount() xgsl = 0 if sz > 999999 then sz = 999999 end for i = 1, sz do pdsz = true for v = 4, #(qmnb) do if pdsz == true then pysz = {} pysz[1] = {} pysz[1].address = sl[i].address + qmnb[v]["offset"] pysz[1].flags = qmnb[v]["type"] szpy = gg.getValues(pysz) pdpd = qmnb[v]["lv"] .. ";" .. szpy[1].value szpd = split(pdpd, ";") tzszpd = szpd[1] pyszpd = szpd[2] if tzszpd == pyszpd then pdjg = true pdsz = true else pdjg = false pdsz = false end end end if pdjg == true then szpy = sl[i].address xgxc(szpy, qmxg) end end if xgjg == true then gg.toast(qmnb[2]["name"] .. "地址成功,共修改" .. xgsl .. "条数据") else gg.toast(qmnb[2]["name"] .. "失败") end end end end
------------------------------
	
------------------------------
--仿SX写法配置
------------------------------
	
------------------------------
function xqmnb(Search,Modification)
gg.clearResults() gg.setRanges(Search[1].memory) gg.searchNumber(Search[3].value,Search[3].type,false,536870912,0,-1) if gg.getResultCount() == 0 then gg.toast(Search[2].name..'开启失败') return end local Result = gg.getResults(gg.getResultCount()) local sum for index = 4,#Search do sum = 0 for i = 1,#Result do if gg.getValues({{
	address = Result[i].address+Search[index].offset,flags = Search[index].type
}})[1].value ~= Search[index].lv then Result[i].Usable = true sum = sum+1 end end if sum==#Result then gg.toast(Search[2].name..'开启失败') return end end local Data,Freeze,Freezes = {}, {},0 sum = 0 for index,value in ipairs(Modification)do for index = 1,#Result do if not Result[index].Usable then local Value = {
	address = Result[index].address+value.offset,flags = value.type,value = value.value,freeze = true
} if value.freeze then Freeze[#Freeze+1] = Value Freezes = Freezes+1 else Data[#Data+1] = Value end sum = sum+1 end end end gg.setValues(Data) gg.addListItems(Freeze) if Freezes == 0 then gg.toast(Search[2].name..'开启成功,共修改'..sum..'条数据') else gg.toast(Search[2].name..'开启成功,共修改'..sum..'条数据,冻结'..Freezes..'条数据') end gg.clearResults() end



-- 读取内存地址的函数
function readPointer(name, offset, i)
local re = gg.getRangesList(name) local x64 = gg.getTargetInfo().x64 local va = {[true] = 32, [false] = 4
} if re[i or 1] then local addr = re[i or 1].start + offset[1] for i = 2, #offset do addr = gg.getValues({{
		address = addr, flags = va[x64]}}) if not x64 then addr[1].value = addr[1].value & 0xBAE0FFFF end addr = addr[1].value + offset[i] end return addr end end
-- 修改内存地址的函数
function gg.edits(addr, Table, name)
local Table1 = {{}, {}} for k, v in ipairs(Table) do local value = {
	address = addr+v[3], value = v[1], flags = v[2], freeze = v[4]} if v[4] then Table1[2][#Table1[2]+1] = value else Table1[1][#Table1[1]+1] = value end end gg.addListItems(Table1[2]) gg.setValues(Table1[1]) gg.toast((name or "") .. "开启成功, 共修改"..#Table.."个值") end
local Ranges = gg.getRangesList('/')
local function Read(module,type)
for k,v in pairs(Ranges) do
if v['internalName']:match('[^/]*$') == module and v['type'] == type then
return v['start']
end
end
end
------------------------------
	
------------------------------
local Table = {}
local function Modify(address,value,flags)
Table[#Table+1] = {
	address = address,value = value,flags = flags
}
end

------------------------------
	
------------------------------

-- 读取内存地址的函数
function readPointer(name, offset, i)
    local re = gg.getRangesList(name) 
    local x64 = gg.getTargetInfo().x64 
    local va = {[true]=32, [false]=4} 
    if re[i or 1] then
        local addr = re[i or 1].start + offset[1] 
        for i = 2, #offset do
            addr = gg.getValues({{address=addr, flags=va[x64]}}) 
            if not x64 then
                addr[1].value = addr[1].value & 0xFFFFFFFF 
            end
            addr = addr[1].value + offset[i] 
        end
        return addr
    end
end
-- 修改内存地址的函数
function gg.edits(addr, Table, name)
    local Table1 = {{}, {}} 
    for k, v in ipairs(Table) do
        local value = {address = addr+v[3], value = v[1], flags = v[2], freeze = v[4]}
        if v[4] then
            Table1[2][#Table1[2]+1] = value 
        else
            Table1[1][#Table1[1]+1] = value
        end
    end
    gg.addListItems(Table1[2])
    gg.setValues(Table1[1])
end

function getRanges()
local ranges = {}
local t = gg.getRangesList('^/dev/kgsl-3d0*$')
for i, v in pairs(t) do
if v.type:sub(4, 4) == 's' then
table.insert(ranges, v)
end
end
return ranges
end

local function readD(a)
return gg.getValues({{
	address = a,
	flags = gg.TYPE_DWORD
}})[1].value
end

local function readF(a)
return gg.getValues({{
	address = a,
	flags = gg.TYPE_FLOAT
}})[1].value
end
------------------------------
	
------------------------------
function setvalue(address,flags,value)
local t = {}
t[1] = {}
t[1].address = address
t[1].flags = flags
t[1].value = value
gg.setValues(t)
gg.addListItems(t)
end

------------------------------
	
------------------------------
function _V(add,value1,flag,value2)
local num = 0;ednum = 0
if flag == gg.TYPE_DWORD then
readV = readD
elseif flag == gg.TYPE_FLOAT then
readV = readF
else
	os.exit("不支持的类型")
end
local S_list = getRanges()
for i in pairs(S_list) do
num = num+1
addr = S_list[i].start+add
if readV(addr) == value1 then
setvalue(addr,flag,value2)
ednum = ednum+1
end
end
return "遍历了"..num.."个地址\n".."修改了"..ednum.."个地址"
end

function PS() end
function setvalue(address,flags,value) PS('修改地址数值(地址,数值类型,要修改的值)') local tt={} tt[1]={} tt[1].address=address tt[1].flags=flags tt[1].value=value gg.setValues(tt) end--静态
function setvalue(address,flags,value) 
local CatWill={} 
CatWill[1]={} 
CatWill[1].address=address 
CatWill[1].flags=flags 
CatWill[1].value=value 
gg.setValues(CatWill) 
end
function readPointer(name, offset, i)
	local re = gg.getRangesList(name)
	local x64 = gg.getTargetInfo().x64
	local va = {[true] = 32, [false] = 4}
	if re[i or 1] then
		local addr = re[i or 1].start + offset[1]
		for i = 2, #offset do
			addr = gg.getValues({{address = addr, flags = va[x64]}})
			if not x64 then
				addr[1].value = addr[1].value & 0xFFFFFFFF
			end
			addr = addr[1].value + offset[i]
		end
		return addr
	end
end

function gg.edits(addr, Table, name)
	local Table1 = {{}, {}}
	for k, v in ipairs(Table) do
		local value = {address = addr + v[3], value = v[1], flags = v[2], freeze = v[4]}
		if v[4] then
			Table1[2][#Table1[2] + 1] = value
		else
			Table1[1][#Table1[1] + 1] = value
		end
	end
	gg.addListItems(Table1[2])
	gg.setValues(Table1[1])
end
----指针模块
function readPointer(name, offset, i)
	local re = gg.getRangesList(name)
	local x64 = gg.getTargetInfo().x64
	local va = {[true] = 32, [false] = 4}
	if re[i or 1] then
		local addr = re[i or 1].start + offset[1]
		for i = 2, #offset do
			addr = gg.getValues({{address = addr, flags = va[x64]}})
			if not x64 then
				addr[1].value = addr[1].value & 0xFFFFFFFF
			end
			addr = addr[1].value + offset[i]
		end
		return addr
	end
end
function gg.edits(addr, Table, name)
	local Table1 = {{}, {}}
	for k, v in ipairs(Table) do
		local value = {address = addr + v[3], value = v[1], flags = v[2], freeze = v[4]}
		if v[4] then
			Table1[2][#Table1[2] + 1] = value
		else
			Table1[1][#Table1[1] + 1] = value
		end
	end
	gg.addListItems(Table1[2])
	gg.setValues(Table1[1])
	gg.toast((name or "") .. "开启成功, 共修改" .. #Table .. "个值")
end

file.mkdir("/sdcard/孤行")
file.mkdir("/sdcard/孤行/图片")
if not io.open("/sdcard/孤行.zip") then
local f=io.open("/sdcard/孤行.zip",'a')
f:write(gg.makeRequest('').content)
unzip("/sdcard/孤行.zip","/sdcard/")
end
os.remove("/sdcard/孤行.zip")
file.checkFile("/sdcard/孤行/图片/color") -- 判断文件是否存在
local RGBcolor = file.read("/sdcard/孤行/图片/color") -- 读取文件内容
if RGBcolor ~= "" then -- 判断内容是否为空
else
RGBcolor="161616"
end
baseWindow=require('floatingWindowManager2')
import("android.content.res.ColorStateList")
import("com.google.android.material.card.MaterialCardView")
import("com.google.android.material.materialswitch.MaterialSwitch")
import("com.google.android.material.slider.Slider")
import("com.google.android.material.progressindicator.LinearProgressIndicator")
import("android.animation.LayoutTransition")
if tonumber(device.width)==nil then
dwidth=1340
dheight=2300
else
dwidth=device.width
dheight=device.height
end
luajava.setFloatingWindowHide(true)
switch颜色=0xff0062FF
changan = {} huiz = function() end
window =context:getSystemService("window") -- 获取窗口管理器
function panduan(rec) fille,err = io.open(rec) if fille == nil then return false else return true end end
YoYoImpl = luajava.getYoYoImpl()
vibra = context:getSystemService(Context.VIBRATOR_SERVICE)
import'android.hardware.*';
function getTimeStamp(t)
local str = os.date("%Y年%m月%d日%H:%M:%S",t)
return str
end
function panduan(rec) fille,err = io.open(rec) if fille == nil then return false else return true end end
function 获取图片(txt)
txt = string.url(txt,"de")
ntxt = string.sub(string.gsub(txt,"/","-"),-10,-1)
if string.find(tostring(txt),"http") ~= nil then
if panduan("/sdcard/孤行/图片/"..ntxt) == false then
file.download(txt,"/sdcard/孤行/图片/"..ntxt)
else
if file.length("/sdcard/孤行/图片/"..ntxt) <= 1 then
file.download(txt,"/sdcard/孤行/图片/"..ntxt)
end
end
txt = "/sdcard/孤行/图片/"..ntxt
end
return luajava.getBitmapDrawable(txt)
end
function getRes(x)
return 获取图片("/sdcard/孤行/图片/"..x)
end
hanshu = function(v, event)
local Action = event:getAction()
if Action == MotionEvent.ACTION_DOWN then
isMove = false
RawX = event:getRawX()
RawY = event:getRawY()
x = mainLayoutParams.x
y = mainLayoutParams.y
elseif Action == MotionEvent.ACTION_MOVE then
isMove = true
mainLayoutParams.x = tonumber(x) + (event:getRawX() - RawX)
if mainLayoutParams.x<=0 then
mainLayoutParams.x=0
end
mainLayoutParams.y = tonumber(y) + (event:getRawY() - RawY)
window:updateViewLayout(floatWindow, mainLayoutParams)
elseif Action == MotionEvent.ACTION_UP then
mainLayoutParams.x = tonumber(x) + (event:getRawX() - RawX)
if mainLayoutParams.x<=0 then
mainLayoutParams.x=0
if 显示==0 and 显2==false then 隐藏2() end
end
if mainLayoutParams.x>=20 then
if 显2==true then 显示2() end
end
mainLayoutParams.y = tonumber(y) + (event:getRawY() - RawY)
window:updateViewLayout(floatWindow, mainLayoutParams)
end
end
window = context:getSystemService("window") -- 获取窗口管理器
function getLayoutParams()
LayoutParams = WindowManager.LayoutParams
layoutParams = luajava.new(LayoutParams)
if (Build.VERSION.SDK_INT >= 26) then -- 设置悬浮窗方式
layoutParams.type = LayoutParams.TYPE_APPLICATION_OVERLAY
else
layoutParams.type = LayoutParams.TYPE_PHONE
end

layoutParams.format = PixelFormat.RGBA_8888 -- 设置背景
layoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL -- 焦点设置Finish
layoutParams.gravity = Gravity.TOP|Gravity.LEFT -- 重力设置
layoutParams.width = LayoutParams.WRAP_CONTENT -- 布局宽度
layoutParams.height = LayoutParams.WRAP_CONTENT -- 布局高度

return layoutParams
end
function topSelect()
local selector = luajava.getStateListDrawable()
selector:addState({
android.R.attr.state_pressed
}, getVerticalBG({0x22161616,0x22161616},30))
selector:addState({
-android.R.attr.state_pressed
}, empty)
return selector
end
function getCorner(gtvb1,gtvb3,gtvb4,gtvb5,g1,g2,g3,g4)
if not gtvb4 then gtvb4 = 0 gtvb5 = 0xff000000 end
local jianbians = luajava.new(GradientDrawable)
jianbians:setCornerRadius(gtvb3)
jianbians:setGradientType(GradientDrawable.LINEAR_GRADIENT)
jianbians:setColors(gtvb1)
jianbians:setStroke(gtvb4,gtvb5)--边框宽度和颜色
jianbians:setCornerRadii({g1,g1,g2,g2,g3,g3,g4,g4})
return jianbians
end
function getVerticalBG(gtvb1,gtvb3,gtvb4,gtvb5)
if not gtvb4 then gtvb4 = 0 gtvb5 = 0xff000000 end
local jianbians = luajava.new(GradientDrawable)
jianbians:setCornerRadius(gtvb3)
jianbians:setGradientType(GradientDrawable.LINEAR_GRADIENT)
jianbians:setColors(gtvb1)
jianbians:setStroke(gtvb4,gtvb5)--边框宽度和颜色
return jianbians
end
function newbg(gtvb1,gtvb3,gtvb4,gtvb5)
if not gtvb4 then gtvb4 = 0 gtvb5 = 0xff000000 end
local jianbians = luajava.loadlayout({
GradientDrawable,
color = {背景颜色},
cornerRadius=45,
gradientType = GradientDrawable.LINEAR_GRADIENT,
orientation = GradientDrawable.Orientation.TOP_BOTTOM ,
strokeWidth = 10,
strokeColor = gtvb5
})
return jianbians
end
function getHorizontalBG(gtvb1,gtvb3,gtvb4,gtvb5)
if not gtvb4 then gtvb4 = 0 gtvb5 = 0xff000000 end
local jianbians = luajava.new(GradientDrawable)
jianbians:setCornerRadius(gtvb3)
jianbians:setOrientation(GradientDrawable.Orientation.LEFT_RIGHT)
jianbians:setGradientType(GradientDrawable.LINEAR_GRADIENT)
jianbians:setColors(gtvb1)
jianbians:setStroke(gtvb4,gtvb5)--边框宽度和颜色
return jianbians
end
changan.controlBig = function(control,time)
luajava.runUiThread(function()
import "android.animation.ObjectAnimator"
ObjectAnimator():ofFloat(control,"scaleX", {
0, 0.4, 0.7, 1
}):setDuration(time):start()
ObjectAnimator():ofFloat(control,"scaleY", {
0, 0.4, 0.7, 1
}):setDuration(time):start()
end) end
changan.controlFlip = function(control,time)
luajava.runUiThread(function()
import "android.view.animation.Animation"
import "android.animation.ObjectAnimator"
xuanzhuandonghua = ObjectAnimator:ofFloat(control, "rotationY", {
0, 360
})
xuanzhuandonghua:setRepeatCount(0)
xuanzhuandonghua:setRepeatMode(Animation.REVERSE)
xuanzhuandonghua:setDuration(time)
xuanzhuandonghua:start()
end) end
changan.controlWater = function(control,time)
luajava.runUiThread(function()
import "android.animation.ObjectAnimator"
ObjectAnimator():ofFloat(control,"scaleX", {
1, 0.8, 0.9, 1
}):setDuration(time):start()
ObjectAnimator():ofFloat(control,"scaleY", {
1,0.8,0.9,1
}):setDuration(time):start()
end) end
changan.controlSmall = function(control,time)
luajava.runUiThread(function()
import "android.animation.ObjectAnimator"
ObjectAnimator():ofFloat(control,"scaleX", {
1, 0.7, 0.4, 0
}):setDuration(time):start()
ObjectAnimator():ofFloat(control,"scaleY", {
1, 0.7, 0.4, 0
}):setDuration(time):start()
end) end
mainLayoutParams = getLayoutParams()


gg.setVisible(false)
function guid()
seed = {
'e','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'
}
tb = {}
for i = 1,32 do
table.insert(tb,seed[math.random(1,16)])
end
sid = table.concat(tb)
return string.format('%s%s%s',
string.sub(sid,1,8),
string.sub(sid,10,12),
string.sub(sid,21,22))
end
import("android.media.AudioManager")
audi = context:getSystemService("audio")
audiotype = {
AudioManager.STREAM_ALARM, --手机闹铃的声音
AudioManager.STREAM_MUSIC, --手机音乐的声音
AudioManager.STREAM_NOTIFICATION, --系统提示的通知
AudioManager.STREAM_RING, --电话铃声的声音
AudioManager.STREAM_SYSTEM, --手机系统的声音
AudioManager.STREAM_VOICE_CALL, --语音电话的声音
AudioManager.STREAM_DTMF, --DTMF音调的声音
--AudioManager.STREAM_BLUETOOTH_SCO,
}
yinl = {}
for i = 1,#audiotype do
yinl[i] = {}
yinl[i].type = audiotype[i]
yinl[i].min = audi:getStreamMinVolume(audiotype[i])
yinl[i].max = audi:getStreamMaxVolume(audiotype[i])
yinl[i].now = audi:getStreamVolume(audiotype[i])
end
yltype = 0
function jianting3(func)
yinln = {}
for i = 1,#audiotype do
yinln[i] = {}
yinln[i].type = audiotype[i]
yinln[i].now = audi:getStreamVolume(audiotype[i])
if yinln[i].now > yinl[i].now then
yinl[i].now = yinln[i].now
if yltype == 1 then
yltype = 0
func()
end
elseif yinln[i].now < yinl[i].now then
yinl[i].now = yinln[i].now
if yltype == 0 then
yltype = 1
func()
end
end
end
end


setOnExitListener(function()
luajava.post(function()
return window:removeView(floatWindow)
end)
tuichu=1
luajava.setFloatingWindowHide(false)
end)
function changan.menu(sview)
sview=sview
huiz()
cebian={LinearLayout,
layout_height="wrap_content",
layout_width="wrap_content",
gravity="center_vertical",
orientation="horizontal",
}
jmbg={}
local ui = require('ui')
local layout = {
'ui.ViewPager',
layout_height = 'match_parent',
layout_width='match_parent',
focusable="false",
focusableInTouchMode="false",
}
for i=1,#stab do
jmbg[i]=getJMBG()
_ENV["jm"..i]=luajava.loadlayout({
LinearLayout,
onClick=function() 切换(i) end,
{TextView,
id="jmt"..i,
background=jmbg[i],
layout_marginLeft="5dp",
layout_marginRight="5dp",
textSize="14sp",
textColor="#272C3A",
text=stab[i],
padding={"10dp","5dp","10dp","5dp"},
}})
cebian[#cebian+1]=_ENV["jm"..i]
_ENV["layout"..i]={
ScrollView,
--visibility="gone",
layout_width="match_parent",
layout_height="wrap_content",
{
LinearLayout,
id=luajava.newId("layoutm"..i),
orientation="vertical",
layout_width="match_parent",
layout_height="wrap_content",
}}
layout[#layout+1]=_ENV["layout"..i]
end

bottombar={
LinearLayout,
layout_width="fill_parent",
layout_height="wrap_content",
padding="4dp",
{HorizontalScrollView,
layout_width="fill_parent",
layout_weight=1,
cebian},
}
topbar={
LinearLayout,
layout_width="fill_parent",
layout_height="35dp",
background=getCorner({0xffffffff,0xffffffff},15,0,0xff232323,45,45,0,0),

{LinearLayout,
layout_width="35dp",
layout_height="match_parent",
gravity="center",
{
LinearLayout,
gravity="center",
background=getVerticalBG({0xffE6E6E6,0xffE6E6E6},90),
layout_width = "20dp",
layout_height = "20dp",
layout_marginLeft = "5dp",
onClick = 隐藏,
onTouch = hanshu,
{LinearLayout,
layout_height="2dp",
layout_width="10dp",
background=getVerticalBG({0xff2c2c2c,0xff2c2c2c},45),
}
}
},



{
    LinearLayout,
    layout_width="35dp",
    layout_height="match_parent",
    gravity="center",
    {
        ImageView,
        padding = "5dp",
        src = getRes("xz_gg"),
        background=getVerticalBG({0xffE6E6E6,0xffE6E6E6},90),
        layout_width = "20dp",
        layout_height = "20dp",
        layout_marginRight = "5dp",
        onTouch=hanshu,
        {
            LinearLayout,
            layout_height="2dp",
            layout_width="10dp",
            background=getVerticalBG({0xff2c2c2c,0xff2c2c2c},45),
}
}

},
{LinearLayout,
layout_width="fill_parent",
layout_weight=1,
layout_height="match_parent",
gravity="center",
{LinearLayout,
layout_height="match_parent",
layout_width="80dp",
background=topSelect(),
onClick=function() end,
gravity="center",
onTouch=hanshu,
{LinearLayout,
layout_height="5dp",
layout_width="60dp",
background=getVerticalBG({0xff0047FF,0xff0047FF},20)

}
}
},
{LinearLayout,
layout_width="35dp",
layout_height="match_parent",
gravity="center",
{
ImageView,
padding = "5dp",
id="lockui",
src = getRes("heis"),
background=getVerticalBG({0xffE6E6E6,0xffE6E6E6},90),
layout_width = "20dp",
layout_height = "20dp",
layout_marginRight = "5dp",
onClick = uiLock,
onTouch = hanshu,
}
},



{LinearLayout,
layout_width="35dp",
layout_height="match_parent",
gravity="center",
{
ImageView,
padding = "5dp",
src = getRes("heix"),
background=getVerticalBG({0xffE6E6E6,0xffE6E6E6},90),
layout_width = "20dp",
layout_height = "20dp",
layout_marginRight = "5dp",
onClick = 隐藏,
onTouch = hanshu,
}
}
}

ViewPager = ui.ViewPager(layout)
luajava.setInterface(ViewPager, 'addOnPageChangeListener',
{onPageSelected=function(view)
view=tonumber(string.sub(view,1,1))
for i=1,#stab do
_ENV["jmt"..i]:setTextColor(0xff272C3A)
_ENV["jmt"..i]:setBackground(jmbg[i])

end
当前ui=view+1
--滚(当前ui)
_ENV["jmt"..view+1]:setTextColor(0xffffffff)
_ENV["jmt"..view+1]:setBackground(slcta)

end})



menui=luajava.loadlayout({
LinearLayout,--菜单
orientation = "vertical",
layout_height = "fill_parent",
layout_width = "fill_parent",
gravity = "center_horizontal",
onClick = function() end,
onTouch = hanshu,
topbar,
{LinearLayout,
id="menubar",
padding={"10dp","5dp","10dp","0dp"},
layout_height = "fill_parent",
layout_width = "fill_parent",
layout_weight=1,
ViewPager
},

bottombar
})

ckou=luajava.loadlayout({
FrameLayout,
id = "ckou",
--background = getVerticalBG(背景颜色,背景圆角,背景边框粗细,背景边框颜色),
layout_height = 'match_parent',
layout_width = 'match_parent',
gravity="top",
menui,
})
control2=luajava.loadlayout{
ImageView,
visibility="gone",
background = 获取图片(悬浮窗图标),
layout_width = "65dp",
layout_height = "65dp",
onTouch = hanshu,
onClick = 隐藏,
}

beij=newbg(背景颜色,45)



floatWindow = {
FrameLayout,
visibility="gone",
fillViewPort=true,
elevation = "10dp",
background=beij,
onClick = function() end,
onTouch = hanshu,
ckou,
control2,
{LinearLayout,
id="smallc",
visibility="gone",
onClick=显示2,
onTouch=hanshu,
layout_height="36dp",
layout_width="22dp",
gravity="center",
background=getCorner({0x88161616,0x88161616},12,0,0xff232323,0,25,25,0),


{TextView,
text="»",
textSize="18sp",
}


},{FrameLayout,
id='reme',
layout_height='match_parent',
layout_width='match_parent',
elevation='3dp',
{
ImageView,
id="sf",
padding = "2dp",
src = getRes("sscoR"),
layout_width = "23dp",
layout_height = "23dp",
layout_marginRight = "0dp",
layout_marginBottom = "0dp",
layout_gravity = "right|bottom",
onClick = function() end,
onTouch = suofang,
}}
}
--bnzz=particle()
_ENV["卡密"]="卡密"
local function invoke()
mainLayoutParams.x = dwidth/4-150
mainLayoutParams.y = dheight/8
切换(1)

floatWindow=luajava.loadlayout(floatWindow)
mainLayoutParams.height = mubx
mainLayoutParams.width = muby
window:addView(floatWindow,mainLayoutParams)
end
luajava.post(invoke)
luajava.runUiThread(function()
--floatWindow:setBackground(beij)
YoYoImpl:with("FadeIn"):duration(800):playOn(floatWindow)
floatWindow:setVisibility(View.VISIBLE)
end)
setOnExitListener(function()
tuichu = 1
luajava.setFloatingWindowHide(false)
end)
luajava.post(function()
for i=1,#stab do
for k=1,#sview[i] do
luajava.getIdValue("layoutm"..i):addView(sview[i][k])
end
end
end)
qhkai = 0
显示 = 1
qiehuan = function()
if qhkai == 0 then
yinll = 0
qhkai = 1
draw.remove()
gg.toast("HIDE")
luajava.runUiThread(function()
YoYoImpl:with("FadeOut"):duration(300):playOn(floatWindow)
end)
gg.sleep(400)
luajava.runUiThread(function()
floatWindow:setVisibility(View.GONE)
end)
else
qhkai = 0
yinll = 1
huiz()
luajava.runUiThread(function()
floatWindow:setVisibility(View.VISIBLE)
YoYoImpl:with("FadeIn"):duration(300):playOn(floatWindow)
end)
end
end
if ylfunc~=nil then ylfunc() end

while true do
if tuichu == 1 then break end
if 音量键==true then
jianting3(qiehuan)
end
gg.sleep(120)
end
draw.text("",0,0)
gg.setVisible(false)
luajava.setFloatingWindowHide(false)

end
function daxiao()
luajava.runUiThread(function()
mainLayoutParams.height = mubx
mainLayoutParams.width = muby
window:updateViewLayout(floatWindow, mainLayoutParams)
end) end
function 切换(x)
x=x-1
luajava.runUiThread(function()
当前ui=x
ViewPager:setCurrentItem(x)
end)
end
function 隐藏()
if 显2==true then return 0 end
vibra:vibrate(6)
luajava.runUiThread (function ()
if tonumber (tostring (ckou: getVisibility ())) == 8.0 then
显示 = 1
sf:setVisibility(View.VISIBLE)
control2:setVisibility(View.GONE)
mainLayoutParams.height = mubx
mainLayoutParams.width = muby
mainLayoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL
window : updateViewLayout (floatWindow , mainLayoutParams)
luajava.newThread(function()
--gg.playMusic("/sdcard/孤行/图片/bbk")
end):start()
ckou:setVisibility(View.VISIBLE)
YoYoImpl:with("FadeIn"):duration(400):playOn(ckou)
floatWindow:setBackground(beij)
else
sf:setVisibility(View.GONE)
显示=0
luajava.newThread(function()
--gg.playMusic("/sdcard/孤行/图片/bbg")
luajava.runUiThread(function()
YoYoImpl:with("FadeOut"):duration(200):playOn(floatWindow)
--changan.controlSmall(floatWindow,300)
end)
gg.sleep(210)
luajava.runUiThread(function()
--changan.controlBig(floatWindow,200)
YoYoImpl:with("FadeIn"):duration(200):playOn(floatWindow)
control2:setVisibility(View.VISIBLE)
mainLayoutParams.width = LayoutParams.WRAP_CONTENT -- 布局宽度
mainLayoutParams.height = LayoutParams.WRAP_CONTENT -- 布局高度
ckou:setVisibility(View.GONE)
mainLayoutParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE
mainLayoutParams.width = LayoutParams.WRAP_CONTENT -- 布局宽度
mainLayoutParams.height = LayoutParams.WRAP_CONTENT -- 布局高度
window : updateViewLayout (floatWindow , mainLayoutParams)
floatWindow:setBackground(empty)
end)
end):start()
end
end)
end
显2=false
function 隐藏2()
显2=true
ckou:setVisibility(View.GONE)
control2:setVisibility(View.GONE)
smallc:setVisibility(View.VISIBLE)
end
function 显示2()
显2=false
mainLayoutParams.x=20
window:updateViewLayout(floatWindow, mainLayoutParams)

if 显示==1 then
ckou:setVisibility(View.VISIBLE)
smallc:setVisibility(View.GONE)
else
control2:setVisibility(View.VISIBLE)
smallc:setVisibility(View.GONE)
隐藏()
end
end


function changan.setedit(name,txt)
txt = tostring(txt)
luajava.runUiThread(function()
luajava.getIdValue(_ENV[name]):setText(txt)
end)
end

function changan.getedit(name)
--gg.alert(edit)
edit = tostring(luajava.getIdValue(_ENV[name]):getText())
return edit
end
function changan.text(text,color,size,isjz)
if not color then color="#161616" end
if isjz then
return luajava.loadlayout(
{
TextView,
text=text,
textColor=color,
textSize=size,
gravity="center",
layout_height="wrap_content",
layout_width="match_parent",
autoSizeTextType="uniform",
})
else
return luajava.loadlayout({
TextView,
text=text,
textColor=color,
textSize=size,
layout_height="wrap_content",
layout_width="match_parent",
autoSizeTextType="uniform",
})
end
end
checkbg1 = getRes("quarkcheckoff")
checkbg2 = getRes("quarkcheckon")
switchs={}
function changan.intcheck(name,func1,func2)
nid = name..guid()
local func = 开关5(name,func1,func2,nid)
if not name then name = "未设置" end
switchs[nid] = {
LinearLayout,
layout_width = 'match_parent',
layout_weight=1,
layout_height = "42dp",
layout_marginTop = "1dp",
layout_marginBottom = "1dp",
padding = "1dp",
{
LinearLayout,
padding="3dp",
onClick = function() luajava.newThread(function() func() end):start() end,
layout_width = 'fill_parent',
layout_height = "wrap_content",
gravity = "center_vertical",
--background=getVerticalBG({0xffFFFDF2,0xddffffff,0xffFFFDF2},15,8,0xffFFDA71),
{
FrameLayout,
id = luajava.newId(nid),
background = checkbg1,
layout_width = '32dp',
layout_height = '32dp',
padding = "0dp",
},{
TextView,
id=luajava.newId(nid.."t"),
gravity = "left",
text = name,
textColor=check字体颜色,
textSize = "14sp",
--layout_marginLeft="8dp",
layout_width = 'match_parent',
layout_weight=1,
},
}
}
return switchs[nid]
end
function 开关5(name,func1,func2,nid)
local sname = nid
local localname=name
name = name..guid()
_ENV[name] = "关"
if func1 == nil then func1 = "" end
if func2 == nil then func2 = "" end
if type(func1) == "function" then
return function()
namers = _ENV[name]
if namers ~= "开" then
vibra:vibrate(9)
luajava.runUiThread(function()
luajava.getIdValue(nid):setBackground(checkbg2)
luajava.getIdValue(nid.."t"):setTextColor(switch颜色)
--changan.controlWater(switchs[nid],300)
end)
_ENV[name] = "开"
pcall(func1)
else
vibra:vibrate(9)
luajava.runUiThread(function()
luajava.getIdValue(nid):setBackground(checkbg1)
luajava.getIdValue(nid.."t"):setTextColor(0xff232323)
--changan.controlWater(switchs[nid],300)
end)
_ENV[name] = "关"
pcall(func2)
end
end
end
end
function changan.check(cklist)
if #cklist==0 then return nil end
local rest = {
LinearLayout,
layout_width = 'fill_parent',
layout_height = "wrap_content",
gravity = "center",
orientation="vertical",

}

for i = 1, #cklist,2 do
local tempTable = {LinearLayout,
layout_width = 'fill_parent',
layout_height = "wrap_content",
gravity = "left",
orientation="horizontal"
}
for j = 0, 1 do
if cklist[i + j] ~= nil then
local name = cklist[i + j][1]
local func1 = cklist[i + j][2]
local func2 = cklist[i + j][3]
if not name then name = "未设置" end
rstt = changan.intcheck(name,func1,func2)
table.insert(tempTable, rstt)
else
table.insert(tempTable, {LinearLayout,
layout_width = 'match_parent',
layout_weight=1,})
end
end
table.insert(rest, tempTable)
end
return luajava.loadlayout(rest)
end
changan.controlRotation9 = function(control, time,t)
luajava.runUiThread(function()
import "android.view.animation.Animation"
import "android.animation.ObjectAnimator"
xuanzhuandonghua = ObjectAnimator:ofFloat(control, "rotation", {
time,t
})
xuanzhuandonghua:setRepeatCount(0)
xuanzhuandonghua:setRepeatMode(Animation.RESTART)
xuanzhuandonghua:setDuration(400)
xuanzhuandonghua:start()
end)
end

isLocked=false
inlock=getRes("heisuo")
uiunlock=getRes("heis")
function uiLock()
vibra:vibrate(15)
if isLocked==false then
isLocked=true
luajava.newThread(function()
gg.toast("UI缩放已锁定")
end):start()
lockui:setImageDrawable(inlock)
else
isLocked=false
luajava.newThread(function()
gg.toast("UI缩放已解锁")
end):start()
lockui:setImageDrawable(uiunlock)
end
end
function visi (tid , ttid)
vibra:vibrate(4)
local tview = luajava.getIdValue (tid)
local ttview = luajava.getIdValue (ttid)
if not tview then
return 0
end
if tonumber (tostring (tview : getVisibility ())) == 8.0 then
tview : setVisibility (View.VISIBLE)
YoYoImpl:with("FadeIn"):duration(200):playOn(boxes[tid])
changan.controlRotation9(boxpic[tid],0,90)
else
tview : setVisibility (View.GONE)
changan.controlWater (_ENV [tid.."6"] , 200)
changan.controlRotation9(boxpic[tid],90,0)
end
end
boxes = {} boxpic = {}
function changan.box (views)
local tid = "box"..guid ()
boxpic[tid] = luajava.loadlayout {
ImageView ,
background = getRes("fish"),
layout_width = "24dp" ,
layout_height = "24dp" ,
}
local ttid = tid.."6"
local t1id = guid ()
firadio = {
LinearLayout ,
layout_width = 'fill_parent' ,
layout_height = "wrap_content" ,
layout_marginTop = "2dp" ,
layout_marginBottom = "2dp" ,
orientation = "vertical" ,
}
if type (views [1]) == "string" or type (views [1]) == "number" then
firadio [# firadio + 1] = {
LinearLayout ,
layout_width = 'fill_parent' ,
layout_height = "40dp" ,
gravity = "center_vertical" ,
layout_marginTop = "2dp" ,
layout_marginLeft='2dp',
layout_marginRight='2dp',
elevation='2dp',
layout_marginBottom = "4dp" ,
onClick = function ()
visi (tid , ttid)
end
,
background = getButtonBG(),
{
TextView , text = views [1] ,
textSize = "13sp" ,
layout_marginLeft = "10dp" ,
layout_width = "match_parent" ,
layout_weight=1,
textColor = "#000000" ,
gravity = "left" ,
},{
LinearLayout ,
padding={"0dp","0dp","10dp","0dp"},
layout_width = "30dp" ,
layout_height = "30dp" ,
gravity = "center",
boxpic[tid],
}
} else
gg.alert ("changan.box的table内第一个元素必须是string") os.exit ()
end
radios = {
LinearLayout ,
layout_marginLeft = "0dp" ,
layout_marginRight = "0dp" ,
orientation = "vertical" ,
visibility = "gone" ,
id = luajava.newId (tid) ,
padding = "0dp" ,
layout_width = 'fill_parent' ,
}
for i = 2 , # views do
radios [# radios + 1] = views [i]
end
boxes[tid] = luajava.loadlayout(radios)
firadio [# firadio + 1] = boxes[tid]
_ENV [t1id] = luajava.loadlayout (firadio)
return _ENV [t1id]
end

function getShape(tmp0,tmp1,tmp2,tmp3)
jianbians = luajava.new(GradientDrawable)
jianbians:setCornerRadius(tmp0)
jianbians:setGradientType(GradientDrawable.LINEAR_GRADIENT)
jianbians:setColors(tmp1)
jianbians:setOrientation(GradientDrawable.Orientation.LEFT_RIGHT)
jianbians:setStroke(7,tmp3)--边框宽度和颜色
return jianbians
end
function getShape2(tmp0,tmp1,tmp2,tmp3)
jianbians = luajava.new(GradientDrawable)
jianbians:setCornerRadius(tmp0)
jianbians:setGradientType(GradientDrawable.LINEAR_GRADIENT)
jianbians:setColors(tmp1)
jianbians:setOrientation(GradientDrawable.Orientation.LEFT_RIGHT)
jianbians:setStroke(24,tmp3)--边框宽度和颜色
return jianbians
end

switches = {}
function 开关3(name,func1,func2,nid)
local sname = nid
local localname=name
name = name..guid()
_ENV[name] = "关"
if func1 == nil then func1 = "" end
if func2 == nil then func2 = "" end
if type(func1) == "function" then
local outfunc=function()
namers = _ENV[name]
if namers ~= "开" then
vibra:vibrate(9)
luajava.runUiThread(function()
luajava.getIdValue(nid.."k"):setVisibility(View.GONE)
YoYoImpl:with("ZoomInLeft"):duration(600):playOn(switches["2s"..sname])
luajava.getIdValue(nid.."g"):setVisibility(View.VISIBLE)
luajava.getIdValue(nid):setBackground(checkbg)
end)
_ENV[name] = "开"

pcall(func1)
else
vibra:vibrate(9)
luajava.runUiThread(function()
luajava.getIdValue(nid.."g"):setVisibility(View.GONE)
YoYoImpl:with("ZoomInRight"):duration(600):playOn(switches["1s"..sname])
luajava.getIdValue(nid.."k"):setVisibility(View.VISIBLE)
luajava.getIdValue(nid):setBackground(checkbga)
end)
_ENV[name] = "关"
pcall(func2)
end
end
if localname=="音量键隐藏UI" then ylfunc=outfunc end
return outfunc
end
end

function changan.switch(name,func1,func2,miaoshu)
if not checkbg then
checkbg = getShape2(
45,
{
switch颜色,switch颜色
},
4,switch颜色)
checkbg0 = getShape2(
45,
{
0xff232323,0xff232323
},
4,0x00ffffff)
checkbga = getShape2(
45,
{
0xffE6E6E6,0xffE6E6E6
},
4,0xffE6E6E6)
switchbg1 = getShape(
45,
{
0xffffffff,0xffffffff
},
4,0xffffffff)
switchbg2 = luajava.loadlayout {
GradientDrawable ,
color = "#ffffff" ,
cornerRadius = 360
}
end
nid = name..guid()
local func = 开关3(name,func1,func2,nid)
if not name then name = "未设置" end
switches["1s"..nid] = luajava.loadlayout {
FrameLayout,
layout_width = '40dp',
layout_height = '20dp',
gravity = "center_vertical",
padding = {
"1dp","0dp","1dp","0dp"
},
{
LinearLayout,
layout_gravity = "left|center_vertical",
id = luajava.newId(nid.."k"),
background = switchbg1,
onClick = function() luajava.newThread(function() func() end):start() end,
layout_width = '17dp',
layout_height = '17dp',

},
}
switches["2s"..nid] = luajava.loadlayout {
FrameLayout,
onClick = function() luajava.newThread(function() func() end):start() end,
layout_width = '40dp',
layout_height = '20dp',
gravity = "center_vertical",
padding = {
"1dp","0dp","1dp","0dp"
}
, {
LinearLayout,
visibility = "gone",
layout_gravity = "right|center_vertical",
id = luajava.newId(nid.."g"),
background = switchbg2,
onClick = function() luajava.newThread(function() func() end):start() end,
layout_width = '17dp',
layout_height = '17dp',


}
}
if not miaoshu then
rest = luajava.loadlayout({
LinearLayout,
layout_width = 'fill_parent',
layout_height = "wrap_content",
gravity = "center_vertical",
{
LinearLayout,
layout_width = 'fill_parent',
layout_height = "40dp",
gravity = "center_vertical",
layout_marginLeft='2dp',
layout_marginRight='2dp',
layout_marginTop='2dp',
layout_marginBottom='2dp',
elevation='2dp',
background = luajava.loadlayout {
GradientDrawable ,
color = 按钮颜色 ,
cornerRadius = 35
} ,padding = {
"0dp","0dp","6dp","0dp"
},
{
TextView,
gravity = "top",
text = name,
textColor = "#000000",
textSize = "13sp",
layout_weight = 1,
layout_width = '80dp',
layout_marginLeft = "10dp",
layout_marginRight = "20dp",
},
{
FrameLayout,
id=luajava.newId(nid),
background = checkbga,
elevation = "1dp",
onClick = function() luajava.newThread(function() func() end):start() end,
layout_width = 'wrap_content',
layout_height = 'wrap_content',
gravity = "left",
padding="1dp",
switches["1s"..nid],switches["2s"..nid]
}}
})
else
rest = luajava.loadlayout({
LinearLayout,
layout_width = 'fill_parent',
layout_height = "wrap_content",
gravity = "center_vertical",
{
LinearLayout,
layout_width = 'fill_parent',
layout_height = "wrap_content",
gravity = "center_vertical",
layout_marginLeft='2dp',
layout_marginRight='2dp',
layout_marginTop='2dp',
layout_marginBottom='2dp',
elevation='2dp',
background = luajava.loadlayout {
GradientDrawable ,
color = 按钮颜色 ,
cornerRadius = 35
} ,padding = {
"0dp","0dp","6dp","0dp"
} ,
{LinearLayout,
orientation='vertical',
layout_width='match_parent',
layout_weight=1,
layout_height='wrap_content',
{
TextView,
gravity = "left",
text = name,
textColor = "#000000",
textSize = "13sp",
layout_weight = 1,
layout_width = 'match_parent',
layout_marginLeft = "10dp",
layout_marginRight = "20dp",
},
{
TextView,
gravity = "left",
layout_height = "wrap_content",
text = miaoshu,
textSize = "11sp",
layout_width = "match_parent",
layout_weight = 1,
textColor = "#A5A5A5",
layout_marginLeft = "10dp",
layout_marginRight = "20dp",
}},
{
FrameLayout,
id=luajava.newId(nid),
background = checkbga,
elevation = "1dp",
onClick = function() luajava.newThread(function() func() end):start() end,
layout_width = 'wrap_content',
layout_height = 'wrap_content',
gravity = "left",
padding="1dp",
switches["1s"..nid],switches["2s"..nid]
}}
})
end
return rest
end
function getButtonBG()
local selector = luajava.getStateListDrawable()
selector:addState({
android.R.attr.state_pressed
}, getVerticalBG({0x55d7d7d7,0x55d7d7d7},35))
selector:addState({
-android.R.attr.state_pressed
}, getVerticalBG({按钮颜色,按钮颜色},35))
return selector
end
buts={}
heir=getRes("heir")
function changan.button(txt,func,txtc)
if not txt then txt = "未设置" end
if not txtc then txtc="#000000" end
local tid="Cbutton"..guid()
buts[tid]=luajava.loadlayout(
{
LinearLayout,
layout_width = 'match_parent',
layout_height = "wrap_content", {
LinearLayout,
layout_width = "fill_parent",
gravity = "center_vertical",
layout_marginTop = "5dp",
layout_marginBottom = "5dp",
layout_marginLeft='3dp',
layout_marginRight='3dp',
elevation='2dp',
background = getButtonBG(),
padding="10dp",
onClick = function()
changan.controlWater(buts[tid],300)
luajava.newThread(func):start() end,
{
TextView,
--id = luajava.newId(tid),
textColor = txtc,
text = txt,
textSize = "13sp",
layout_height = "wrap_content",
layout_width = "fill_parent",
layout_weight=1,
},{ImageView,
src=heir,
layout_height="14dp",
layout_width="14dp",

}
}})
return buts[tid]
end
function changan.image(img,height,width,pad,func)
if not func then func=function() end end
if not pad then pad="0dp" end
if not height then height="80dp" end
if not width then width="80dp" end
return luajava.loadlayout({
LinearLayout,
layout_height="wrap_content",
layout_width="fill_parent",
gravity="center",
{
ImageView,
layout_height=height,
layout_width=width,
padding=pad,
src=获取图片(img),
onClick=function() luajava.newThread(func):start() end,
}})

end
function changan.edit (name , hint)
_ENV [name] = name..guid ()
if not hint then
hint = "点击输入文字"
end
rest = luajava.loadlayout ( {
LinearLayout,
layout_height="wrap_content",
layout_width="match_parent",
gravity="center",
{
LinearLayout ,
layout_width = 'match_parent' ,
layout_height = "40dp" ,
layout_marginTop = "5dp" ,
layout_marginBottom = "5dp" ,
layout_marginLeft = "0dp" ,
layout_marginRight = "0dp" ,
gravity = "center_vertical" ,
{
EditText ,
background = getButtonBG(),
gravity = "center" ,
hint = hint ,
textColor=check字体颜色,
textSize = "13sp",
layout_height = "40dp" ,
layout_marginBottom = "-2dp",
id=luajava.newId(_ENV [name]),
layout_width = 'match_parent' ,

}
}
})
luajava.getIdValue(_ENV [name]):setHintTextColor(0xff545454)
return rest
end

function changan.getedit (name)
edit = tostring (luajava.getIdValue (_ENV [name]) : getText ())
return edit
end

function changan.setedit (name , txt)
txt = tostring (txt)
luajava.runUiThread (function ()
luajava.getIdValue (_ENV [name]) : setText (txt)
end

)
end


colorvs={}
function changan.seek(name,variable,min,max,now)
  local nid=name..string.randomUUID(true)
  colorvs[#colorvs+1]={"slider",nid}
  return{
    LinearLayout,
    layout_width='fill_parent',
    layout_height="wrap_content",
    gravity="center",
    elevation="2dp",
    layout_margin="4dp",
    background={GradientDrawable,color=0xffffffff,cornerRadius=15},
    paddingRight="6dp",
    {
      TextView,
      text=name,
      textColor="0xff161616",
      textSize="13sp",
      layout_weight=1,
      layout_width='150dp',
      layout_marginLeft="10dp",
      layout_marginRight="5dp",
    },
    {
      Slider,
      id=luajava.newId(nid),
      trackStopIndicatorSize="0dp",
      layout_weight=1,
      stepSize=1,
      value=now,
      valueTo=max,
      valueFrom=min,
      trackHeight="13dp",
      ThumbHeight="20dp",
      tickVisible=false,
      thumbWidth="4dp",
      layout_marginTop="-3.5dp",
      layout_marginBottom="-3.5dp",
      layout_width='match_parent',
      layout_height='wrap_content',
      TrackActiveTintList=ColorStateList({{}},{"0xff"..RGBcolor}),
      TrackInactiveTintList=ColorStateList({{}},{"0x50"..RGBcolor}),
      ThumbTintList=ColorStateList({{}},{"0xff"..RGBcolor}),
      addOnChangeListener=function(slider,value,fromUser)
        _ENV[variable]=value
      end
    },
  }
end
levels={}
function changan.seek2(name , bian , smin , smax , nows,level)
local smin=math.ceil(smin* 10)/10
local smax=math.ceil(smax* 10)/10
local nows=math.ceil(nows* 10)/10
local level=math.ceil(level* 10)/10
if bian~='mubx' and bian~='muby' then
if _ENV [bian] == nil then
_ENV [bian] = nows
else
gg.alert("seek控件的变量名称:"..bian.."重复！\n请换一个名称") os.exit()
end
end
if not name then
name = "未设置"
end
local names = name..guid ()
if not level then level=1 end
levels[bian]=math.ceil(level* 10)/10
local shuzhi=luajava.loadlayout({
TextView ,
gravity = "center" ,
text = tostring(nows) ,
textColor=switch颜色,
id = luajava.newId (names) ,
layout_width = '50dp' ,
layout_marginLeft = "5dp" ,
layout_marginRight = "0dp" ,
})
local tmp1={TextView,
background=getVerticalBG({0xeeffffff,0xeeffffff},15,2.5,0xff161616),
layout_height="24dp",
layout_width="24dp",
gravity="center",
elevation="2dp",
layout_marginTop = "5dp" ,
layout_marginBottom = "5dp" ,
layout_marginLeft = "5dp" ,
layout_marginRight = "5dp" ,
text="-",
textColor="#000000",
onClick=function()
vibra:vibrate(4)
if _ENV[bian]>smin then
_ENV[bian]=_ENV[bian]-levels[bian]
_ENV[bian]=tonumber(string.format("%.1f", _ENV[bian]))
if _ENV[bian]<smin then _ENV[bian]=smin end
_ENV[bian]=math.ceil(_ENV[bian]* 10)/10
luajava.getIdValue(names):setText(tostring(_ENV[bian]))
if bian=='mubx' or bian=='muby' then daxiao() end
end
end,
}
local tmp2={TextView,
background=getVerticalBG({0xeeffffff,0xeeffffff},15,2.5,0xff161616),
layout_height="24dp",
layout_width="24dp",
gravity="center",
elevation="2dp",
layout_marginTop = "5dp" ,
layout_marginBottom = "5dp" ,
layout_marginLeft = "5dp" ,
layout_marginRight = "5dp" ,
text="+",
textColor="#000000",
onClick=function()
vibra:vibrate(4)
if _ENV[bian]<smax then
_ENV[bian]=_ENV[bian]+levels[bian]
_ENV[bian]=tonumber(string.format("%.1f", _ENV[bian]))
if _ENV[bian]>smax then _ENV[bian]=smax end
_ENV[bian]=math.ceil(_ENV[bian]* 10)/10
luajava.getIdValue(names):setText(tostring(_ENV[bian]))
if bian=='mubx' or bian=='muby' then daxiao() end
end
end,
}
rest = luajava.loadlayout ( {
LinearLayout ,
layout_width = 'fill_parent' ,
gravity = "center" ,
layout_height = "wrap_content" ,
{
LinearLayout,
layout_width = 'fill_parent',
layout_height = "40dp",
gravity = "center_vertical",
layout_marginLeft='2dp',
layout_marginRight='2dp',
layout_marginTop='2dp',
layout_marginBottom='2dp',
elevation='2dp',
background = luajava.loadlayout {
GradientDrawable ,
color = 按钮颜色 ,
cornerRadius = 15
} ,padding = {
"0dp","0dp","6dp","0dp"


},
{
TextView ,
gravity = "top" ,
text = name ,
textColor="#000000",
layout_weight=1,
textSize='12sp',
layout_width = 'match_parent' ,
layout_marginLeft = "10dp" ,
layout_marginRight = "0dp" ,
},
tmp1,shuzhi,tmp2
}
})
return rest
end


radon=getRes("heiraon")
radoff=getRes("heiraoff")
radiog={}
function changan.radio (cklist)
local rid=guid()
radiog[rid]={}
rest = {
LinearLayout ,
layout_width = 'match_parent' ,
layout_height = "wrap_content" ,
layout_marginTop = "10dp" ,
gravity = "top" ,
orientation = "vertical" ,

}
if type (cklist [1]) == "string" then
rds=2
rest [# rest + 1] = {
TextView ,
gravity = "left" ,
padding="5dp",
text = cklist [1] ,
textSize = "13sp" ,
textColor = check字体颜色 ,
layout_width = 'fill_parent' ,
layout_height = 'wrap_content' ,
layout_marginLeft = "10dp" ,
layout_marginRight = "5dp" ,
layout_marginTop = "0dp" ,
layout_marginBottom = "0dp" ,
}
else
rds=1
end
local restt={
LinearLayout,
layout_width = 'match_parent',
layout_height = "wrap_content",
gravity = "center_vertical",
layout_marginLeft='2dp',
layout_marginRight='2dp',
layout_marginTop='2dp',
layout_marginBottom='2dp',
elevation='2dp',
orientation = "vertical" ,
background = luajava.loadlayout {GradientDrawable,color = 按钮颜色,cornerRadius = 26},
padding = {"0dp","0dp","6dp","0dp"},
}
for i = rds , # cklist do
local name = cklist [i] [1]
local func = cklist [i] [2]
if not name then
name = "未设置"
end
nid = name..guid ()
radiog[rid][nid]=false
local func = radin(rid,nid,func)
local tid = nid..guid ()
_ENV [tid] = luajava.loadlayout ( {
LinearLayout ,
layout_width = '250dp' ,
layout_height = "30dp" ,
layout_marginTop = "5dp" ,
layout_marginBottom = "15dp" ,
layout_marginLeft = "4dp" ,
layout_marginRight = "10dp" ,
gravity = "center_vertical" ,
onClick = function ()
changan.controlWater (_ENV [tid] , 200)
func()
end

,
{
ImageView ,
id = luajava.newId (nid) ,
layout_width = '20dp' ,
layout_height = "20dp" ,
layout_marginLeft = "5dp" ,
layout_marginRight = "0dp" ,
background =radoff ,
} , {
TextView ,
gravity = "top" ,
text = name ,
textSize="13sp",
textColor = check字体颜色 ,
layout_width = 'wrap_content' ,
layout_height = 'wrap_content' ,
layout_marginLeft = "10dp" ,
layout_marginRight = "5dp" ,
}
})
restt [# restt + 1] = _ENV [tid]
end
rest [# rest + 1] = restt
return luajava.loadlayout (rest)
end
function radin(rid,nid,func)
return function()
for k,v in pairs(radiog[rid]) do
luajava.getIdValue(k):setBackground(radoff)
if k==nid and v~=true then
luajava.getIdValue(k):setBackground(radon)
v=true
luajava.newThread(func):start()
end
end
end
end

function addadView(tmp)
local function invoke()
floatWindow:addView(tmp)
end
luajava.post(invoke)
end
function rmdadView(tmp)
local function invoke()
floatWindow:removeView(tmp)
end
luajava.post(invoke)
end
function getJMBG()
local selector = luajava.getStateListDrawable()
selector:addState({
android.R.attr.state_pressed
}, slcta)
selector:addState({
-android.R.attr.state_pressed
}, slctb)
return selector
end

function getwyyv()
wyyget="http://120.24.160.246:3000/"
function huoqu(txt)
return table.json(gg.makeRequest(wyyget.."song/url/v1?id="..txt.."&level=standard").content)
end
function souyy(txt)
return table.json(gg.makeRequest("http://music.163.com/api/search/get?s="..txt.."&type=1&offset=0&total=true&limit=30").content)
end
function develo(tabb)
gg.alert(tostring(tabb))
end
function develo2(tabb)
gg.copyText(tostring(tabb))
end
function tablekIn(tbl, key)
    if tbl == nil then
        return false
    end
    for k, v in pairs(tbl) do
        if k == key then
            return true
        end
    end
    return false
end
function getbg()
return getButtonBG()
end
function searchmusic()
if not lasttm then
lasttm = os.time()
else
if os.time() - lasttm <= 0 then
gg.alert("请在" .. (0 - (os.time() - lasttm)) .. "秒冷却后搜索")
return 0
end
end
if not wryt then
else
runnable = luajava.getRunnable(function()
luajava.getIdView("搜索列表"):removeView(wyr)
end)
handler = luajava.getHandler()
handler:post(runnable)
end
mustxt = luajava.getIdView("搜索"):getText()
if string.len(tostring(mustxt)) <= 0 or tostring(mustxt) == nil then
gg.alert("至少输入1个字符")
return 0
end
mustxt = tostring(mustxt)
luajava.runUiThread(function()
luajava.getIdView("jzz"):setVisibility(View.VISIBLE)
luajava.getIdView("stxt"):setVisibility(View.GONE)
end)
lasttm = os.time()
mustable = souyy(mustxt)
mustable = mustable.result.songs

-- print(mustable)

musnames = {}
musids = {}
musarts = {}
musictable = {}
for k, v in pairs(mustable) do
musictable[#musictable + 1] = v
end
-- gg.alert(tostring(mustable))
-- gg.alert(tostring(musictable))
-- gg.copyText(tostring(mustable))
-- gg.alert(#musictable)
wrfun = {}
wryt = {
LinearLayout,
id = luajava.newId("搜索结果"),
layout_marginTop = "5dp",
layout_width = "match_parent",
layout_marginBottom = "5dp",
orientation = "vertical"
}
for i = 1, #musictable do
musid = musictable[i].id
-- print('musid',musid)

-- musid = musictable[i].album.id
-- print('musid',musid)

musids[#musids + 1] = musid
musname = musictable[i].name
if tablekIn(musictable[i], "transNames") ~= false then
musname = musname .. "\n(" .. musictable[i].transNames[0] .. ")"
end
musnames[#musnames + 1] = musname
musart = musictable[i].artists[0].name
musarts[#musarts + 1] = musart
wryt[#wryt + 1] = {
LinearLayout,
orientation = "vertical",
layout_marginTop = "2dp",
layout_marginBottom = "2dp",
layout_width = "match_parent",
background = getbg(),
id = luajava.newId("音" .. musid),
onClick = function()
thread = luajava.getThread(function()
bofang(musname, musid)
end)
thread:start()
end,
{
TextView,
layout_marginTop = "5dp",
textSize = "13sp",
textColor = "#0062ff",
layout_marginBottom = "0dp",
text = musname,
layout_hight = "10dp",
layout_width = "match_parent",
gravity = "center"

},
{
TextView,
layout_marginTop = "0dp",
textColor = "#000000",
textSize = "11sp",
layout_marginBottom = "5dp",
text = musart,
layout_hight = "10dp",
layout_width = "match_parent",
gravity = "center"

}

}
-- gg.sleep(50)
wryt[#wryt].onClick = function()
-- (function()
-- bofang(musnames[i] .. musarts[i], musids[i])
-- end):start()
luajava.startThread(function()
bofang(musnames[i] .. musarts[i], musids[i])
end)
end
end
wyr = luajava.loadlayout(wryt)
runnable = luajava.getRunnable(function()
luajava.getIdView("搜索列表"):addView(wyr)
end)
handler = luajava.getHandler()
handler:post(runnable)
luajava.runUiThread(function()
luajava.getIdView("jzz"):setVisibility(View.GONE)
luajava.getIdView("stxt"):setVisibility(View.VISIBLE)
end)
-- gg.alert(tostring(wrfun))
end
function bofang(gqmz, gdmn)
luajava.runUiThread(function()
luajava.getIdView("搜索结果"):setVisibility(View.GONE)
luajava.getIdView("加载"):setVisibility(View.VISIBLE)

end)

gg.playMusic("http://music.163.com/song/media/outer/url?id="..gdmn..".mp3" or huoqu(gdmn).data[0].url)
gg.sleep(2000)
luajava.runUiThread(function()
luajava.getIdView("加载"):setVisibility(View.GONE)
luajava.getIdView("搜索结果"):setVisibility(View.VISIBLE)
end)
end
stxt = {
TextView,
text = "搜索",
textColor="#0062ff",
background=getbg(),
layout_height="match_parent",
visibility = "visible",
gravity="center",
layout_marginRight="10dp",
id = luajava.newId("stxt"),
layout_marginLeft = "3dp",
textSize = "13sp",
padding={"13.5dp","0dp","13.5dp","0dp"},
onClick = function()
thread = luajava.getThread(function()
searchmusic()
end)
thread:start()
end
}
jzz = {
TextView,
text = "加载中",
visibility = "gone",
id = luajava.newId("jzz"),
layout_marginLeft = "10dp",
textSize = "12sp",
textColor="#000000",
}
jiaz = {
TextView,
text = "正在加载歌曲资源",
visibility = "gone",
id = luajava.newId("加载"),
textSize = "15sp",
gravity = "center",
textColor="#000000",
}
wyylog = luajava.loadlayout({
LinearLayout,
orientation="vertical",
layout_width = "match_parent",
{
ScrollView,
layout_hight = "match_parent",
gravity="center_horizontal",
layout_width = "match_parent",
{
LinearLayout,
layout_width = "match_parent",
{LinearLayout,
padding="4dp",
gravity="center",
orientation="vertical",
id=luajava.newId("固定音乐"),
},

id = luajava.newId("搜索列表"),
layout_hight = "300dp",
orientation = "vertical",
layout_width = "match_parent",
gravity="center_horizontal",

{
LinearLayout,
orientation = "horizontal",
layout_width = "match_parent",

{
EditText,
hint = "搜索歌曲名称",
textColor="#000000",
id = luajava.newId("搜索"),
background = getbg(),
textSize='13sp',
selectAllOnFocus = "true",
singleLine = "true",
layout_weight=1,
gravity="center",
layout_width = "match_parent"
},
stxt,
jzz
},
jiaz
}
}
})
luajava.getIdView('搜索'):setHintTextColor(0xff999999)
return wyylog
end

suofang = function(v, event)
if isLocked then hanshu(v,event) return 0 end
local Action = event:getAction()

if Action == MotionEvent.ACTION_DOWN then
isMove = false
RawX = event:getRawX()
RawY = event:getRawY()
hx = mainLayoutParams.height
hy = mainLayoutParams.width
if hx == 0 or hx==-2 then hx = 810 hy = 1150 end
elseif Action == MotionEvent.ACTION_MOVE then
isMove = true
mubx = tonumber(hx) + (event:getRawY() - RawY)
if mubx >= 250 and mubx <= 11100 then
mainLayoutParams.height = mubx
end
muby = tonumber(hy) + (event:getRawX() - RawX)
if muby >= 250 and muby <= 24500 then
mainLayoutParams.width = muby
end
if muby<=250 and mubx<=250 then muby=250 mubx=250
return 0 end
window:updateViewLayout(floatWindow, mainLayoutParams)
end
end

--底部导航栏（未选中）背景
slctb=getVerticalBG({0x99ffffff,0x99ffffff},15,0,0xaa232323)

slcta=getVerticalBG({0xff004EFF,0xff004EFF},15,0,0xaa242937)
--底部导航栏（选中）背景

muby=500
--初始宽度 竖屏建议850 横屏建议1310 （适用于主流分辨率下，低分辨率需要调低）

mubx=800
--初始高度 竖屏建议1310 横屏建议850 （适用于主流分辨率下，低分辨率需要调低）

背景颜色=0xfff2f3f5

check字体颜色=0xff004eff

按钮颜色=0xffffffff

switch颜色=0xff0062FF

function huiz()
--绘制内容必须写在这里否则会消失
end

悬浮窗图标="http://wl.luoyeyun.icu/view.php/c2f7d93245e39d0e1cf1120be80ca3f1.png"


stab={
	"主页",
	'搜索音乐',
	"功能",
	'音乐',
	"设置",
}


---创建小窗口备用，对照下边菜单里调用打开窗口，不需要的可以删掉
---必须先创建窗口 才能 打开窗口

changan.menu({
	{--第一页
	
		changan.button("加入我们",
function ()
gg.QQgroup("1045861402")

end),
changan.button("选择进程",
function ()
gg.setConfig("冻结间隔", 0)
gg.setConfig("快速冻结", 1)
string.toMusic('请选择进程')
gg.setProcessX()
end),
changan.button("假话叫爹", 
                   function()
			gg.playMusic("/storage/emulated/0/芒果全防/假话叫爹.mp3")
			end),
					
					changan.button("删除云验证自动登录配置文件",
function()
    local pathList = {
        "/storage/emulated/0/芒果全防/2配置(不可修改).LUA",
        "/storage/emulated/0/芒果全防/1配置(不可修改).LUA",
        "/storage/emulated/0/芒果全防/芒果全防配置.txt"
    }
    pcall(function()
        for _, path in ipairs(pathList) do
            os.remove(path)
        end
    end)
end)
	},{--第2页
		getwyyv(),
	},{
	changan.box({
			"XXX区",
				changan.edit("输入框演示"),
				changan.button(
					"调用输入框",
					function()
						local tmp=changan.getedit("输入框演示")
						gg.alert(tmp)
					end,
					0xff0056FF),
		}),--box结尾
	},{
        changan.switch(
			"武家坡",
			function()
			gg.playMusic("http://music.163.com/song/media/outer/url?id=1891431677&uct2.mp3")
			end,
			function()
			gg.playMusic("stop")
			end
		),
		changan.switch(
			"把回忆拼好给你",
			function()
			gg.playMusic("http://music.163.com/song/media/outer/url?id=1403318151&uct2.mp3")
			end,
			function()
			gg.playMusic("stop")
			end
		),
		changan.switch(
			"我们(乐柠组合)",
			function()
			gg.playMusic("https://wlwp.tifvncmf.xyz/view.php/f01be285cc4234841517b36417a175ba.mp3")
			end,
			function()
			gg.playMusic("stop")
			end
		),
	},{--第3页
		changan.seek2('窗口高度','mubx',250,dwidth,mubx,10),
changan.seek2('窗口宽度','muby',250,dheight,muby,10),
		changan.switch(
			"音量键隐藏",--默认开启，改名就是默认关闭
			function()
				音量键=true
			end,
			function()
				音量键=false
			end
		),
		changan.switch(
			"摇一摇隐藏UI(无效)",--默认开启，改名就是默认关闭
			function()
				摇一摇=true
			end,
			function()
				摇一摇=false
			end
		),
		
		changan.button("退出",
				function()
					tuichu=1
				end)
	}
})