local function panduan(rec) fille,err = io.open(rec) if fille == nil then return false else return true end end if panduan("/sdcard/林默中野三玖配置/林默.zip") ~= true then gg.toast("正在下载资源林默.zip\n请耐心等待") file.download("https://pan.jl8.top/down.php/2685072d0defb78d2ab0ff703a641945.zip&lmttkx","/sdcard/林默中野三玖配置/林默.zip") end if panduan("/sdcard/林默中野三玖配置/Lottie.dex")~=true then file.unzip("/sdcard/林默中野三玖配置/林默.zip","/sdcard/林默中野三玖配置/") end if io.open("/sdcard/林默中野三玖配置/heir")==nil then file.download("https://fs-im-kefu.7moor-fs1.com/ly/4d2c3f00-7d4c-11e5-af15-41bf63ae4ea0/1730896983736/opo.zip","/sdcard/.林默中野三玖配置/opo.zip") file.download("https://pan.jl8.top/down.php/0ae073b5f96b8283fe9c31749218d213.zip&lmttkx","/sdcard/.林默中野三玖配置/pz.zip") file.mkdir("/sdcard/林默中野三玖配置/") loadingBox = getLoadingBox('正在解压') loadingBox['显示']() unzip("sdcard/林默中野三玖配置/opo.zip","sdcard/林默中野三玖配置/") unzip("sdcard/林默中野三玖配置/pz.zip","sdcard/林默中野三玖配置/") loadingBox['关闭']() end if (rlgg.VERSION < 2.09) then gg.alert('请使用大于等于2.09版本的RLGG') os.exit() end --local typeface = import("android.graphics.Typeface") --local FontPath = "/storage/emulated/0/云烛/配置文件/GoogleSans-Bold.otf"--字体路径 --local font = typeface:createFromFile(FontPath) local baseWindow = require 'floatingWindowManager2' if not baseWindow.getContext then gg.alert('请重启一下RLGG') app.exit() end import "android.graphics.Color" import "android.content.res.ColorStateList" local context = baseWindow:getContext() import "android.view.animation.TranslateAnimation" import "android.view.animation.Animation" import "android.animation.ArgbEvaluator" import "android.animation.LayoutTransition" import "android.graphics.drawable.GradientDrawable" import "android.graphics.drawable.ClipDrawable" import "android.media.MediaPlayer" MediaPlayer=MediaPlayer() import "java.io.File" import "android.graphics.Typeface" import "android.animation.LayoutTransition" layoutTransition=LayoutTransition() layoutTransition:setDuration(500) import 'com.google.android.material.imageview.ShapeableImageView' import 'com.google.android.material.shape.CornerFamily' import 'com.google.android.material.materialswitch.MaterialSwitch' import 'com.google.android.material.button.MaterialButton' import 'com.google.android.material.dialog.MaterialAlertDialogBuilder' import 'com.google.android.material.slider.Slider' import 'com.google.android.material.snackbar.Snackbar' import 'com.google.android.material.sidesheet.SideSheetDialog' import 'com.google.android.material.bottomsheet.BottomSheetDialog' import 'com.google.android.material.bottomsheet.BottomSheetBehavior' import 'com.google.android.material.progressindicator.LinearProgressIndicator' import 'com.google.android.material.progressindicator.CircularProgressIndicator' import 'com.google.android.material.chip.ChipGroup' import 'com.google.android.material.chip.Chip' import 'com.google.android.material.radiobutton.MaterialRadioButton' import 'com.google.android.material.checkbox.MaterialCheckBox' import 'com.google.android.material.dialog.MaterialAlertDialogBuilder' import 'androidx.coordinatorlayout.widget.CoordinatorLayout' import 'androidx.core.widget.NestedScrollView' import 'android.graphics.drawable.Icon' import 'android.widget.LinearLayout' import 'android.widget.Button' import 'android.widget.TextView' import 'android.widget.ScrollView' import 'android.widget.RadioGroup' import 'java.lang.CharSequence' import 'java.lang.Boolean' import 'java.lang.reflect.Array' baseWindow:darkMode() local LottieDex=dex.loadfile('/sdcard/林默中野三玖配置/Lottie.dex') local LottieAnimationView=LottieDex:loadClass("com.airbnb.lottie.LottieAnimationView") dex.loadfile("/sdcard/林默最新UI配置/Lottie.dex") import "com.airbnb.lottie.*" shimmer=dex.loadfile('/sdcard/林默中野三玖配置/Shimmer2.dex') import "com.romainpiel.shimmer.Shimmer" import "com.romainpiel.shimmer.ShimmerTextView" vibra = context:getSystemService(Context.VIBRATOR_SERVICE) changan = {} local changan = changan local android = import('android.*') function write(fileName, content) file.write(fileName, content) end function panduan(rec) fille,err = io.open(rec) if fille == nil then return false else return true end end function pdcf(lujing) rec = "/sdcard/林默中野三玖配置/"..lujing fille,err = io.open(rec) if fille == nil then return false else return true end end sleep = gg.sleep function read(fileName) f = assert(io.open(fileName, 'r')) content = f:read("*all") f:close() return content end function wtcf(lujing,neirong) write("/sdcard/林默中野三玖配置/"..lujing,neirong) end function rdcf(lujing) return read("/sdcard/林默中野三玖配置/"..lujing) end 开 = "开" 关 = "关" function checkimg(tmp,ii) if file.length("/sdcard/林默中野三玖配置/"..tmp[1],false)<200 then gg.toast("正在下载图片"..ii.."/"..#ckimg.."\n请耐心等待") luajava.download(tmp[2],"/sdcard/林默中野三玖配置/"..tmp[1]) end end ckimg = { } for i = 1,#ckimg do checkimg(ckimg[i],i) 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 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 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 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:setGradientType(GradientDrawable.LINEAR_GRADIENT) jianbians:setColors(gtvb1) jianbians:setStroke(gtvb4,gtvb5)--边框宽度和颜色 jianbians:setCornerRadii({g1,g1,g2,g2,g3,g3,g4,g4}) return jianbians end context = app.context 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_FOCUSABLE -- 焦点设置Finish layoutParams.gravity = Gravity.TOP|Gravity.LEFT -- 重力设置 layoutParams.width = LayoutParams.WRAP_CONTENT -- 布局宽度 layoutParams.height = LayoutParams.WRAP_CONTENT -- 布局高度 return layoutParams 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) mainLayoutParams.y = tonumber(y) + (event:getRawY() - RawY) window:updateViewLayout(floatWindow, mainLayoutParams) end end function 获取图片(txt) --gg.toast("正在加载资源...") txt = file.checkUrl(txt) return luajava.getBitmapDrawable(txt) end local isswitch YoYoImpl = luajava.getYoYoImpl() changan.menu = function(sview) if isswitch then return false end beij=getVerticalBG({0xffffffff,0xffffffff},12) isswitch = true cebian = { LinearLayout, layout_height = "match_parent", layout_width = "wrap_content", orientation = "horizontal", gravity = "center", orientation='vertical', --background=getCorner({0xffffffff,0xffffffff},12,0,0xffFFE543,0,12,12,0), } lmttkx = { LinearLayout, layout_height = "50dp", layout_width = "70dp", orientation = "vertical", gravity = "center", } cebianW=luajava.loadlayout{ ShimmerTextView, text = "林 默 U I", gravity = "center", textSize = "17sp", textColor = "#000000", layout_height = "fill_parent", layout_width = "match_parent", reflectionColor="#ffffff"; } for i = 1,#stab do cebian[#cebian+1] = { LinearLayout, id = "jm"..i, gravity="center", layout_height = "wrap_content", layout_width = "wrap_content", layout_marginTop = "3dp", layout_marginBottom = "6dp", layout_marginRight = "3dp", layout_marginLeft = "3dp", elevation='2dp', onClick = function() 切换(i) end, orientation='vertical', {LinearLayout, layout_height='20dp', layout_width='20dp', orientation = "horizontal", id="jmpbj"..i, visibility = "gone", gravity = "center_vertical", {LottieAnimationView, id="jmp"..i, layout_height='20dp', layout_width='20dp', __onFinish = function(v) v:setAnimationFromJson(file.read("/storage/emulated/0/林默中野三玖配置/" .. stab[i][2])) end, }}, { TextView, text = stab[i][1], gravity = "center", textSize = "12sp", id="lmnb"..i, textColor = "#aaaaaa", layout_height = "wrap_content", layout_width = "68dp", }} end for i=1,#stab do lmttkx[#lmttkx+1]= { LottieAnimationView, layout_height='40dp', layout_width='40dp', __onFinish = function(v) v:setAnimationFromJson(file.read("/storage/emulated/0/林默中野三玖配置/" .. stab[i][2])) end, id="lmttkx"..i, layout_gravity = "center", layout_marginTop = "3dp", layout_marginLeft = "5dp", onTouch = hanshu, onClick = 隐藏, layout_marginBottom = "5dp", } end cebian = luajava.loadlayout( { LinearLayout, layout_height = "match_parent", layout_width = "80dp", background=getVerticalBG({0xffeeeeee,0xffeeeeee},12), orientation = "vertical", { LinearLayout, layout_height = "50dp", layout_width = "80dp", orientation = "vertical", layout_gravity = "top|center", lmttkx, }, { ScrollView, gravity = "center", layout_marginLeft = "5dp", --layout_margin = "5dp", layout_height = "215dp", elevation = "3dp", background=getVerticalBG({0xffeeeeee,0xffeeeeee},12), layout_width = "71dp", cebian } , cebianW } ) for i = 1,#stab do _ENV["layout"..i] = luajava.loadlayout({ LinearLayout, layout_width = "275dp", layout_height = "300dp", visibility = "gone", orientation = "vertical", background=getCorner({0xffffffff,0xffffffff},12,0,0xffFFE543,0,12,12,0), { LinearLayout, layout_width = "match_parent", layout_height = "40dp", orientation = "horizontal", {ImageView, layout_height='40dp', layout_width='230dp', layout_marginLeft = "30dp", src=获取图片(logo), }},{ ScrollView, fillViewport = "true", --padding = "10dp", gravity = "center", layout_width = "fill_parent", layout_height = "fill_parent", layout_marginBottom = "3dp", orientation = "horizontal", { LinearLayout, id = "layoutm"..i, layout_marginTop = "3dp", layout_marginRight = "5dp", layout_marginLeft = "5dp", layout_width = "fill_parent", orientation = "vertical", gravity = "center_horizontal", } }}) end ckou = { LinearLayout, layout_width = "wrap_content", layout_height = "wrap_content", cebian, } for i = 1,#stab do ckou[#ckou+1] = _ENV["layout"..i] end ckou = luajava.loadlayout(ckou) floatWindow = { FrameLayout, id = "motion", elevation = "10dp", onTouch = hanshu, onClick = function() end, layout_width = "wrap_content", orientation = "vertical", gravity = "center_vertical", layout_height = "wrap_content", {LinearLayout, orientation='vertical', id='chuangk', visibility='gone', ckou, }, {ImageView, --id="jmp"..i, layout_height='17dp', layout_width='17dp', onTouch = hanshu, onClick = 隐藏, layout_gravity="top|right", layout_marginRight = "20dp", layout_marginTop = "10dp", src=获取图片("/storage/emulated/0/林默中野三玖配置/heix"),}, { ImageView, id = "control", background = 获取图片(xfcpic), layout_width = "40dp", layout_height = "40dp", onTouch = hanshu, onClick = 隐藏, }, } shimmer = Shimmer(); luajava.runUiThread(function() shimmer:setDuration(1000) shimmer:setStartDelay(500) shimmer:start(cebianW) end) local function invoke() local ok local RawX, RawY, x, y mainLayoutParams = getLayoutParams() floatWindow = luajava.loadlayout(floatWindow) local function invoke2() for k = 1,#stab do for i = 1,#sview[k] do _ENV["layoutm"..k]:addView(sview[k][i]) end end for i=1,#MSwitch do SwitchColor(luajava.getIdView(MSwitch[i]),0xff5AA7FF,0xffffffff,0xeeeeeeee,0x88888888) end window:addView(floatWindow, mainLayoutParams) block('end') end 切换(1) local runnable = luajava.getRunnable(invoke2) local handler = luajava.getHandler() handler:post(runnable) block('join') local isMove end invoke(swib1,swib2) 隐藏() --gg.playMusic("/storage/emulated/0/林默中野三玖配置/bbk.mp3") gg.setVisible(false) luajava.setFloatingWindowHide(true) qhkai = 0 qiehuan = function() if qhkai == 0 then qhkai = 1 draw.remove() luajava.runUiThread(function() changan.controlSmall(floatWindow,400) end) gg.sleep(400) luajava.runUiThread(function() floatWindow:setVisibility(View.GONE) end) else qhkai = 0 huiz() --draw.text('.', -9200,-9200) luajava.runUiThread(function() floatWindow:setVisibility(View.VISIBLE) end) luajava.runUiThread(function() changan.controlBig(floatWindow,400) end) end end huiz() --draw.text('.', -9200,-9200) 隐藏() while true do if tuichu == 1 then break end jianting3(qiehuan) gg.sleep(300) end luajava.setFloatingWindowHide(false) end corbk = true 当前ui = 1 function 切换(x) 当前ui = x luajava.runUiThread(function() for i = 1,#stab do _ENV["layout"..i]:setVisibility(View.GONE) _ENV["jmpbj"..i]:setVisibility(View.GONE) _ENV["lmttkx"..i]:setVisibility(View.GONE) _ENV["lmnb" .. i]:setTextColor(0xffaaaaaa) --选中的字体颜色 end _ENV["jmpbj"..当前ui]:setVisibility(View.VISIBLE) _ENV["jmp"..当前ui]:playAnimation() _ENV["lmttkx"..当前ui]:playAnimation() _ENV["lmttkx"..当前ui]:setVisibility(View.VISIBLE) _ENV["lmnb" .. 当前ui]:setTextColor(0xff000000) --选中的字体颜色 _ENV["lmttkx"..当前ui]:setSpeed(1) _ENV["jmp"..当前ui]:setSpeed(1) _ENV["layout"..当前ui]:setVisibility(View.VISIBLE) --YoYoImpl:with("FadeIn"):duration(800):playOn(_ENV["layout"..当前ui]) end) end 显示 = 0 beij2 = luajava.loadlayout({ GradientDrawable, color = "#001E1C27", cornerRadius = 10 }) 显示 = 0 function 隐藏() luajava.runUiThread(function() if tonumber(tostring(chuangk:getVisibility())) == 8.0 then control:setVisibility(View.GONE) 显示 = 1 mainLayoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL window : updateViewLayout (floatWindow , mainLayoutParams) --ggscro:setVisibility(View.VISIBLE) chuangk:setVisibility(View.VISIBLE) _ENV["layout"..当前ui]:setVisibility(View.VISIBLE) changan.controlBig(floatWindow,500) floatWindow:setBackground(beij) else -- ggscro:setVisibility(View.GONE) mainLayoutParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE window : updateViewLayout (floatWindow , mainLayoutParams) chuangk:setVisibility(View.GONE) floatWindow:setBackground(beij2) control:setVisibility(View.VISIBLE) 显示 = 0 _ENV["layout"..当前ui]:setVisibility(View.GONE) end end) 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音调的声音 } 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 function jianting2() yinln = {} for i = 1,#audiotype do yinln[i] = {} yinln[i].type = audiotype[i] yinln[i].min = audi:getStreamMinVolume(audiotype[i]) yinln[i].max = audi:getStreamMaxVolume(audiotype[i]) yinln[i].now = audi:getStreamVolume(audiotype[i]) if yinln[i].now > yinl[i].now then audi:adjustStreamVolume(yinln[i].type,AudioManager.ADJUST_LOWER,0) gg.alert("up") elseif yinln[i].now < yinl[i].now then audi:adjustStreamVolume(yinln[i].type,AudioManager.ADJUST_RAISE,0) gg.alert("down\n"..yinln[i].now.."\n"..yinl[i].now) end end 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 function jianting(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].max then audi:adjustStreamVolume(yinln[i].type,AudioManager.ADJUST_LOWER,0) end if yinln[i].now > yinl[i].now then audi:setStreamVolume(yinln[i].type,yinl[i].now,0) func() end end end 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%s%s', string.sub(sid,1,8), string.sub(sid,10,12), string.sub(sid,21,22)) ..string.format('%s%s%s%s%s', string.sub(sid,1,6), string.sub(sid,21,25) ) end local function exit() tuichu = 1 luajava.setFloatingWindowHide(false) luajava.post(function() window:removeView(floatWindow) end) end setExitEvent(exit) 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 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 function getButtonBG() local selector = luajava.getStateListDrawable() selector:addState({ android.R.attr.state_pressed }, getVerticalBG({0xffd7d7d7,0xffd7d7d7},15)) selector:addState({ -android.R.attr.state_pressed }, getVerticalBG({0xffffffff,0xffffffff},15)) return selector end buts={} function changan.button(txt,func) if not txt then txt = "未设置" end return luajava.loadlayout( { LinearLayout, layout_width = 'match_parent', layout_height = "35dp" , { LinearLayout, layout_width = "fill_parent", gravity = "center_horizontal", layout_margin = "5dp" , background = getButtonBG(), elevation='2dp', onClick = function() luajava.newThread(function() pcall(func) end):start() end, { TextView, --id = luajava.newId(tid), layout_marginTop = "5dp", layout_marginBottom = "5dp", text = txt, textColor='#000000', textSize = "12sp", layout_width = "wrap_content", }, }}) 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 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(700):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 , src = getRes("hei_right"), layout_width = "24dp" , layout_height = "24dp" , colorFilter=0xff000000 } local ttid = tid.."6" local t1id = guid () firadio = { LinearLayout , layout_width = 'fill_parent' , layout_height = "wrap_content" , layout_margin = "2dp" , orientation = "vertical" , } if type (views [1]) == "string" or type (views [1]) == "number" then firadio [# firadio + 1] = { LinearLayout , layout_width = 'fill_parent' , layout_height = "35dp" , gravity = "center_vertical" , layout_margin = "5dp" , onClick = function () visi (tid , ttid) end , elevation='2dp', background = getButtonBG(), { TextView , Typeface=font, text = views [1] , textSize = "12sp" , layout_marginLeft = "15dp" , 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 MSwitch = {} function changan.switch(name,func1,func2) ID = name..guid() MSwitch[#MSwitch+1] = ID Checked = false if name=="音量键隐藏UI" then 音量键 = true Checked = true end if name=="摇一摇隐藏UI" then 摇一摇 = true Checked = true end rest = luajava.loadlayout({ LinearLayout, layout_width="fill_parent", layout_height = "47dp", gravity = "center", { LinearLayout, layout_width = 'fill_parent', layout_height = "40dp", gravity = "center", elevation = "2dp", layout_marginRight = "4dp", layout_marginLeft = "4dp", background = luajava.loadlayout { GradientDrawable , color = 0xffffffff , cornerRadius = 15 } ,padding = { "0dp","0dp","6dp","0dp" }, { TextView, Typeface=font, gravity = "top", text = name, textColor = "0xff000000", textSize = "13sp", layout_weight = 1, layout_width = 'fill_parent', layout_marginLeft = "10dp", layout_marginRight = "20dp", }, { MaterialSwitch, id = luajava.newId(ID), layout_weight = 1, checked = Checked, layout_width = 'fill_parent', layout_height = 'wrap_content', onCheckedChange = function(compoundButton, isChecked) luajava.newThread(function() if isChecked then pcall(func1) else pcall(func2) end end):start() end } } }) return rest end import "android.graphics.Color" import "android.content.res.ColorStateList" function SliderColor(id,color1,color2,color3) id:setTrackActiveTintList(ColorStateList({{}},{color1})) id:setTrackInactiveTintList(ColorStateList({{}},{color2})) id:setThumbTintList(ColorStateList({{}},{color3})) end function SwitchColor(id,color1,color2,color3,color4) id:setTrackTintList(ColorStateList({{android.R.attr.state_checked},{}},{color1,color2})) id:setThumbTintList(ColorStateList({{android.R.attr.state_checked},{-android.R.attr.state_checked}},{color3,color4})) end function 开关(name,func1,func2) local localname=name if func1 == nil then func1 = function() end end if func2 == nil then func2 = function() end end if type(func1) == "function" then return function() namers = _ENV[name] if namers ~= "开" then _ENV[name] = "开" pcall(func1) else _ENV[name] = "关" pcall(func2) end end end end function changan.intcheck(name,func1,func2,size) nid = name..guid() lname=name local func = 开关(nid,func1,func2,lname) if not name then name = "未设置" end ID = name..guid() local rest = { LinearLayout, layout_width = 'match_parent', layout_weight=1, layout_height = "42dp", layout_marginTop = "1dp", layout_marginBottom = "1dp", padding = "1dp", { LinearLayout, padding="3dp", layout_width = 'fill_parent', layout_height = "wrap_content", gravity = "center_vertical", { CheckBox, id = luajava.newId(ID), layout_height = "32dp", layout_width = "32dp", checkedState="indeterminate", buttonTintList=ColorStateList({{android.R.attr.state_checked},{-android.R.attr.state_checked}},{0xff5AA7FF,0xff5AA7FF},{0xff000000,0xff000000}), onClick=function() luajava.newThread(function() pcall(func) end):start() end }, { TextView, text=name, textSize = "13sp", textColor="0xff000000", layout_width = "match_parent", --layout_weight=1, } } } return rest end function changan.check(cklist) if #cklist==0 then return nil end local rest={ LinearLayout, layout_width='fill_parent', layout_height="wrap_content", layout_marginRight="4dp", layout_marginLeft="4dp", layout_marginTop="3.5dp", layout_marginBottom="3.5dp", 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 rest end chazhi={} chajv={} function changan.seek(name,bian,smin,smax,nows) _ENV[bian] =nows smin=tonumber(smin) smax=tonumber(smax) if _ENV[bian] == nil then _ENV[bian] = 1.0 end if not name then name = "未设置" end local names = name..guid() kid=guid().."sk" rest = luajava.loadlayout({ LinearLayout, layout_width = 'match_parent', layout_hight = "match_parent", { LinearLayout, id=luajava.newId(kid), layout_width = 'match_parent', layout_hight = "match_parent", layout_marginTop = "3dp", layout_marginBottom = "3dp", layout_marginLeft = "5dp" , layout_marginRight = "5dp" , gravity = "center_vertical", elevation='3dp', background = getButtonBG(), { TextView, padding={"5dp","10dp","0dp","10dp",}, gravity = "top", textColor='#000000', text = name, id = luajava.newId(names), layout_width = '100dp', --layout_marginLeft = "5dp", layout_marginRight = "0dp", }, { Slider, thumbHeight='23dp', trackHeight='15dp', trackStopIndicatorSize='0dp', tickVisible=false, __onFinish=function(v) v:setTrackActiveTintList(ColorStateList({{},},{0xff5AA7FF})) v:setTrackInactiveTintList(ColorStateList({{},},{0x555AA7FF})) v:setThumbTintList(ColorStateList({{},},{0xff5AA7FF})) luajava.setInterface(v, 'addOnChangeListener', function(SeekBar, var2, var3) _ENV[bian] = var2 end) end, layout_width = 'match_parent', id=luajava.newId(name.."seekbar"), valueFrom=smin, valueTo=smax, value=nows, stepSize=1.0, } }}) luajava.getIdView(name..'seekbar'):setHaloRadius(100)--拖动时背景阴影大小 return rest end function 卡片开关1(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.."t"):setTextColor(0xff5AA7FF) luajava.getIdValue(nid.."p"):setColorFilter(0xff5AA7FF) end) _ENV[name] = "开" pcall(func1) else vibra:vibrate(9) luajava.runUiThread(function() luajava.getIdValue(nid.."t"):setTextColor(0xff000000) luajava.getIdValue(nid.."p"):setColorFilter(0xffffffff) end) _ENV[name] = "关" pcall(func2) end end end end spics={ } for i=1,55 do spics[i]="opo"..i end switchs={} tcheck=10 function changan.int卡片(name,func1,func2,ii,gid,pic) if pic~=nil then tocheck=获取图片(pic) else if tcheck==56 then tcheck=1 else tcheck=tcheck+1 end tocheck=getRes(spics[tcheck]) end local func = 卡片开关1(name,func1,func2,gid..ii) if not name then name = "未设置" end if pic~=nil then switchs[gid..ii] = luajava.loadlayout{ LinearLayout, id = luajava.newId(gid..ii), layout_width = ( (tonumber(string.replace(界面宽度,"dp","")) -16)/3).."dp", layout_height = "wrap_content", 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_horizontal", orientation="vertical", --background=getVerticalBG({0xffFFFDF2,0xddffffff,0xffFFFDF2},15,8,0xffFFDA71), { LinearLayout, layout_width = 'wrap_content', layout_gravity = "center", layout_height = "wrap_content", background = luajava.loadlayout({ GradientDrawable, color = "#000000", cornerRadius = 90 }), { ImageView, id = luajava.newId(gid..ii.."p"), src = tocheck, setColorFilter=0xffffffff, layout_gravity="center", layout_width = '18dp', layout_height = '18dp', layout_margin = "6dp", }},{ TextView, Typeface=font, id=luajava.newId(gid..ii.."t"), gravity = "center", text = name, textColor="#000000", textSize = "9sp", layout_marginLeft="8dp", layout_width = 'match_parent', layout_weight=1, } } } else switchs[gid..ii] = luajava.loadlayout{ LinearLayout, id = luajava.newId(gid..ii), layout_width = ( (tonumber(string.replace(界面宽度,"dp","")) -16)/3).."dp", layout_height = "wrap_content", 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_horizontal", orientation="vertical", --background=getVerticalBG({0xffFFFDF2,0xddffffff,0xffFFFDF2},15,8,0xffFFDA71), { LinearLayout, layout_width = 'wrap_content', layout_height = "wrap_content", background = luajava.loadlayout({ GradientDrawable, color = "#000000", cornerRadius = 90 }),{ ImageView, id = luajava.newId(gid..ii.."p"), src = tocheck, setColorFilter=0xffffffff, gravity="center", layout_width = '18dp', layout_height = '18dp', layout_margin = "6dp", }},{ TextView, Typeface=font, id=luajava.newId(gid..ii.."t"), gravity = "center", text = name, textColor="#000000", textSize = "9sp", --layout_marginLeft="8dp", layout_width = 'match_parent', layout_weight=1, } } } end return switchs[gid..ii] end function changan.groupbox(卡片) local gid=guid() local rest = { GridLayout, id=luajava.newId(gid), columnCount = '3', layout_width = ( tonumber(string.replace(界面宽度,"dp","")) -16).."dp", layout_height = "wrap_content", gravity = "center" } for i = 1,#卡片 do local name = 卡片[i][1] local func1 = 卡片[i][2] local func2 = 卡片[i][3] local pic = 卡片[i][4] if not name then name = "未设置" end rstt = changan.int卡片(name,func1,func2,i,gid,pic) if i<9 then rest[#rest+1] = rstt end end if #卡片>=9 then rstt = changan.checkbox(gid,#卡片+1) rest[#rest+1] = rstt end return luajava.loadlayout({ LinearLayout,rest }) end 界面宽度="275dp" 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=10").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() jianbians = luajava.new(GradientDrawable) jianbians:setCornerRadius(5) jianbians:setGradientType(GradientDrawable.LINEAR_GRADIENT) jianbians:setColors({ 0xFFFFFFFF, 0xFFFFFFFF }) jianbians:setStroke(2, "0x11000000") --边框宽度和颜色 --elevation='3dp', selector = luajava.getStateListDrawable() selector:addState( { android.R.attr.state_pressed, }, luajava.loadlayout({ GradientDrawable, color = "#0x11000000", cornerRadius = 10, }) ) -- 点击时候的背景 selector:addState({ -android.R.attr.state_pressed, }, jianbians) -- 没点击的背景 return selector end function searchmusic() if not lasttm then lasttm = os.time() else if os.time() - lasttm <= 5 then gg.alert("请在" .. (5 - (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)) <= 2 or tostring(mustxt) == nil then gg.alert("至少输入2个字符") 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 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_marginLeft = "5dp", layout_marginRight = "5dp", 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 = "#5C6BC0", layout_marginBottom = "0dp", text = musname, layout_hight = "10dp", layout_width = "match_parent", gravity = "center", }, { TextView, layout_marginTop = "0dp", textColor = "#FF7F7F7F", textSize = "11sp", layout_marginBottom = "5dp", text = musart, layout_hight = "10dp", layout_width = "match_parent", gravity = "center", }, } wryt[#wryt].onClick = function() -- (function() -- bofang(musnames[i] .. musarts[i], musids[i]) -- end):start() luajava.startThread(function() bofang(musnames[i] .. musarts[i], musids[i]) time_MUSIC:setText(musnames[i]) top_music:setText(musnames[i]) end) end end wyr = luajava.loadlayout(wryt) 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) 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 = "#FF000000", background = getbg(), layout_height = "match_parent", visibility = "visible", gravity = "center", layout_marginRight = "5dp", 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 = { LinearLayout, orientation = "vertical", visibility = "gone", id = luajava.newId("加载"), { TextView, text = "正在加载歌曲资源", 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("搜索列表"), 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(), layout_marginLeft = "5dp", focusable = true, focusableInTouchMode = true, textSize = "13sp", singleLine = "true", layout_weight = 1, gravity = "center", layout_width = "match_parent", __onFinish = function(v) v:setHintTextColor(0xff646464) v:requestFocus() end, }, stxt, jzz, }, jiaz, }, }, }) function huiz()---绘制必须放在这里面 --draw.setColor('#FFA042') --draw.setSize(50)draw.setStyle('描边并填充') --绘制内容请写到这里面,否则会消失 -- draw.text('xxxx',270,270) end stab = { --菜单名字,添加即可加页数,需要与结尾配置表对应 {"公告",'coins.json'},--分页名字 不要动json {"防封",'layers.json'}, {"功能",'heart.json'}, {"美化",'edit.json'}, {"音乐",'computer.json'}, {"设置",'error.json'}, } xfcpic = "https://wp.kayyw.com/f/bY4VUv/b1b0ed.png" logo = "/storage/emulated/0/林默中野三玖配置/林默UI.png" --悬浮窗链接或路径 changan.menu( { { changan.box({ "box例子" , ---box示例 可以删掉 changan.groupbox({ { "例子xxxxxx",--名称 function()--开 end, function()--关 end, --check第四个参数图片可自定义,删掉不写就是随机 --"https://postimage.me/images/2024/08/07/709da244ba3f4bb81f8040f9a2b2e09a.png" }, { "例子", function() end, function() end, --没写图片链接就是随机 --"https://rl-1303126286.cos.ap-beijing-fsi.myqcloud.com/XG" }, { "测试1", function() end, function() end }, }), changan.groupbox({ { "例子xxxxxx",--名称 function()--开 end, function()--关 end, --check第四个参数图片可自定义,删掉不写就是随机 --"https://postimage.me/images/2024/08/07/709da244ba3f4bb81f8040f9a2b2e09a.png" }, { "例子", function() end, function() end, --没写图片链接就是随机 --"https://rl-1303126286.cos.ap-beijing-fsi.myqcloud.com/XG" }, { "测试1", function() end, function() end }, }), changan.check({ { "例子", function() end, function() end }, { "例子", function() end, function() end }, { "测试1", function() end, function() end }, }), } ) , changan.button( "按钮例子", function() end), }, { changan.seek("拉条演示","ltxx",1,20,1),--“ltxx”为此拉条变量名字,使用时每个拉条不可重复 changan.button( "调用拉条", function() gg.alert(ltxx) end), }, { changan.switch( "功能", function() end, function() end), }, { }, { wyylog, }, { changan.button("退出脚本",function() luajava.setFloatingWindowHide(false) tuichu=1 end), },{ },{ },{ },{ },{ },{ } }) --配置表添加表即可加页数,只需要与上边菜单标题数对应