file.mkdir("/sdcard/孤行") file.mkdir("/sdcard/孤行/图片") 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 luajava.download("https://xuben.top/down.php/18634c6f48b7509155f898066973701a.zip","/sdcard/孤行.zip") file.unzip("/sdcard/孤行.zip","/sdcard/") end os.remove("/sdcard/孤行.zip") if not io.open("/sdcard/孤行/图片/mnsp.zip") then local f=io.open("/sdcard/孤行/图片/mnsp.zip",'a') f:write(gg.makeRequest('https://xuben.top/down.php/81b2089ca1ac97f6d2189fb94693ef39.zip').content) unzip("/sdcard/孤行/图片/mnsp.zip","/sdcard/孤行/图片/") end local menu1 = gg.alert('选择美女视频','其它','2','1') if menu1 == 1 then local menu2 = gg.alert('选择美女视频','5','4','3') if menu2 == 1 then mnsp = "bg5" elseif menu2 == 2 then mnsp = "bg4" elseif menu2 == 3 then mnsp = "bg3" else mnsp = "bg" end elseif menu1 == 2 then mnsp = "bg2" elseif menu1 == 3 then mnsp = "bg1" else mnsp = "bg" end file.checkFile("/sdcard/孤行/图片/color") -- 判断文件是否存在 local RGBcolor = file.read("/sdcard/孤行/图片/color") -- 读取文件内容 if RGBcolor ~= "" then -- 判断内容是否为空 else RGBcolor="161616" end function SwitchDrawable(on,off) local switchSelector = luajava.getStateListDrawable() switchSelector:addState({ android.R.attr.state_checked }, luajava.getBitmapDrawable("/sdcard/孤行/图片/"..on)) switchSelector:addState({ -android.R.attr.state_checked }, luajava.getBitmapDrawable("/sdcard/孤行/图片/"..off)) return switchSelector end local colorvs={} gg.setVisible(false) luajava.setFloatingWindowHide(true) rs=context:getResources():getDisplayMetrics() rs=tostring(rs) rs=string.gsub(rs,',',';') rs=string.gsub(rs,'DisplayMetrics','') load('rs='..rs)() dheight=rs.height dwidth=rs.width if tonumber(dheight)==nil then dwidth=1340 dheight=2300 end if dheight>dwidth then dheight,dwidth=dwidth,dheight end if not UI宽度 then UI宽度="520dp" end if not UI高度 then UI高度="330dp" end if not 项目名字 then 项目名字="孤行UI" end local changan = {} local 音量键=true local 摇一摇=true local baseWindow = require("floatingWindowManager2") local ui = require("ui") local context = material3:getContext() local material3 = require "material3" context:setTheme(R.style.AppTheme) import "com.google.android.material.dialog.MaterialAlertDialogBuilder" import "com.google.android.material.tabs.TabLayout" import "com.google.android.material.tabs.TabItem" import "androidx.coordinatorlayout.widget.CoordinatorLayout" import "com.google.android.material.button.MaterialButton" import "com.google.android.material.slider.Slider" import "com.google.android.material.materialswitch.MaterialSwitch" import "com.google.android.material.card.MaterialCardView" import "com.google.android.material.checkbox.MaterialCheckBox" import "android.view.animation.AccelerateInterpolator" import "android.view.animation.DecelerateInterpolator" import "androidx.interpolator.view.animation.FastOutLinearInInterpolator" import "androidx.interpolator.view.animation.LinearOutSlowInInterpolator" import "android.animation.ValueAnimator$AnimatorUpdateListener" import "android.animation.TypeEvaluator" import "android.graphics.PorterDuff" import "android.graphics.PorterDuffColorFilter" import "android.content.res.ColorStateList" import "android.graphics.Bitmap" import "android.renderscript.Allocation" import "android.renderscript.Element" import "android.renderscript.RenderScript" import "android.renderscript.ScriptIntrinsicBlur" import "android.graphics.Canvas" import "android.graphics.Rect" import "android.animation.ObjectAnimator" import "android.view.animation.Animation" import "android.animation.ArgbEvaluator" import "android.animation.ValueAnimator" import "android.graphics.Color" import "android.view.animation.ScaleAnimation" import "android.view.animation.Animation" import "androidx.transition.Transition" import "androidx.transition.Scene" import "androidx.transition.TransitionManager" import "androidx.transition.TransitionSet" import "androidx.transition.ChangeBounds" import "androidx.transition.Fade" import "androidx.constraintlayout.motion.widget.MotionLayout" import "com.google.android.material.transition.MaterialFadeThrough" import "com.google.android.material.transition.MaterialContainerTransform" import "androidx.appcompat.widget.AppCompatSeekBar" import "android.hardware.SensorManager" import "android.hardware.Sensor" import "android.hardware.SensorEventListener" import "android.view.animation.Animation" import "android.view.animation.Transformation" local window = require("windowManager") local LayoutParams = luajava.bindClass("android.view.WindowManager$LayoutParams") local MDC_R = luajava.bindClass("com.google.android.material.R") local RectF = luajava.bindClass("android.graphics.RectF") YoYoImpl=luajava.getYoYoImpl() transManager=TransitionManager() dex.loadfile("/sdcard/孤行/图片/GifView.dex") import("pl.droidsonroids.gif.GifImageView") dex.loadfile("/sdcard/孤行/图片/sensor.dex") import("com.changan.CACore.*") function getLayoutParam() LayoutParams = window.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.gravity=Gravity.TOP|Gravity.LEFT layoutParams.format = PixelFormat.RGBA_8888 layoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL layoutParams.width = LayoutParams.WRAP_CONTENT layoutParams.height = LayoutParams.WRAP_CONTENT return layoutParams 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 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 vibra=context:getSystemService(Context.VIBRATOR_SERVICE) sensorManager = context:getSystemService(Context.SENSOR_SERVICE) local dpi=context:getResources():getDisplayMetrics().densityDpi function getpx(x) if type(x)=='string' then if string.find(x,'dp') then x=string.gsub(x,'dp','') x=tonumber(x) end return x*(dpi/160) else return x end end function getdp(x) if type(x)=='number' then return x/(dpi/160)..'dp' else return x end end function getdp(x) if type(x)=='number' then return x/(dpi/160)..'dp' else return x end end endViewBG=luajava.loadlayout{ LinearLayout, layout_width=tonumber(string.sub(getdp(UI宽度),1,-3))-40 ..'dp', layout_height='150dp', id=luajava.ids['ldbarbg'], gravity='center', } function defaultP(x) if not screenD then screenD=x return end if x==screenD then return end screenD=x if UI高度 <= UIMAXX then UI高度 = UIMAXX end mainLayoutParams.height = UI宽度 mainLayoutParams.width = UI高度 UI高度, UI宽度 = UI宽度, UI高度 window:updateViewLayout(floatWindow, mainLayoutParams) hx = mainLayoutParams.height hy = mainLayoutParams.width local param = endView:getLayoutParams() param.width = UI宽度 - getpx('40dp') endView:setLayoutParams(param) endViewBG:setLayoutParams(param) end changan.controlBig = function(control,time) luajava.runUiThread(function() 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 hanshu=function(v,event) local Action=event:getAction() if Action==MotionEvent.ACTION_DOWN then RawX=event:getRawX() RawY=event:getRawY() x=mainLayoutParams.x y=mainLayoutParams.y elseif Action==MotionEvent.ACTION_MOVE then mainLayoutParams.x=tonumber(x) +(event:getRawX() - RawX) mainLayoutParams.y=tonumber(y) +(event:getRawY() - RawY) window:updateViewLayout(floatWindow,mainLayoutParams) elseif Action==MotionEvent.ACTION_UP then end end function getRes(x) return 获取图片("/sdcard/孤行/图片/"..x) end function 获取图片(txt) ntxt=string.sub(string.gsub(txt,"/","."),-10,-1) if string.find(tostring(txt),"http")~=nil then if panduan("/sdcard/孤行/图片/"..ntxt)==false then download(txt,"/sdcard/孤行/图片/"..ntxt) end txt="/sdcard/孤行/图片/"..ntxt end return luajava.getBitmapDrawable(txt) end function checkimg(tmp,ii) if file.length("/sdcard/孤行/图片/"..tmp[1],false)<200 then gg.toast("正在下载资源"..ii.."/"..#ckimg.."\n请耐心等待") file.download(tmp[2],"/sdcard/孤行/图片/"..tmp[1]) end end ckimg = { {"classes3.dex","https://xg-cloudreve.cloud-k1.riyx.cn/f/7oKHo/classes3.dex"}, {"Lottie.dex","https://xg-cloudreve.cloud-k1.riyx.cn/f/AkXHV/Lottie.dex"}, {"GifView.dex","https://xg-cloudreve.cloud-k1.riyx.cn/f/e1PHQ/GifView.dex"}, {"blur.dex","https://xg-cloudreve.cloud-k1.riyx.cn/f/PzOfJ/blur.dex"}, {"sensor.dex","https://xg-cloudreve.cloud-k1.riyx.cn/f/GnrF4/sensor.dex"}, {"classes2.dex","https://xg-cloudreve.cloud-k1.riyx.cn/f/bqQu6/classes2.dex"}, {"Gura_Eat","https://xg-cloudreve.cloud-k1.riyx.cn/f/NLoub/Gura_Eat"}, {"heic","https://xg-cloudreve.cloud-k1.riyx.cn/f/neVhm/heic"}, {"heir","https://xg-cloudreve.cloud-k1.riyx.cn/f/0ROHg/heir"}, {"heis","https://xg-cloudreve.cloud-k1.riyx.cn/f/d4VuL/heis"}, {"heisuo","https://xg-cloudreve.cloud-k1.riyx.cn/f/P67cJ/heisuo"}, {"FishBone","https://xg-cloudreve.cloud-k1.riyx.cn/f/Om2iq/FishBone"}, {"heix","https://xg-cloudreve.cloud-k1.riyx.cn/f/GOeF4/heix"}, {"listloop","https://xg-cloudreve.cloud-k1.riyx.cn/f/kEYHg/listloop"}, {"setPlay","https://xg-cloudreve.cloud-k1.riyx.cn/f/NLdFb/setPlay"}, {"last","https://xg-cloudreve.cloud-k1.riyx.cn/f/W1xfJ/last"}, {"next","https://xg-cloudreve.cloud-k1.riyx.cn/f/OmxIq/next"}, {"love","https://xg-cloudreve.cloud-k1.riyx.cn/f/neksm/love"}, {"Pause","https://xg-cloudreve.cloud-k1.riyx.cn/f/0RACg/Pause"}, {"Play-Pause","https://xg-cloudreve.cloud-k1.riyx.cn/f/YPQim/Play-Pause"}, {"playlist","https://xg-cloudreve.cloud-k1.riyx.cn/f/8B8hm/playlist"}, {"unlove","https://xg-cloudreve.cloud-k1.riyx.cn/f/JJpT8/unlove"}, {"repeatone","https://xg-cloudreve.cloud-k1.riyx.cn/f/VKpHe/repeatone"}, {"search","https://xg-cloudreve.cloud-k1.riyx.cn/f/ZkpIm/search"}, {"shark","https://xg-cloudreve.cloud-k1.riyx.cn/f/zm6ha/shark"}, {"LightGura","https://xg-cloudreve.cloud-k1.riyx.cn/f/QDLiD/LightGura"}, {"DarkGura","https://xg-cloudreve.cloud-k1.riyx.cn/f/2nVTo/DarkGura"}, {"sharkC","https://xg-cloudreve.cloud-k1.riyx.cn/f/YzzKfm/sharkC"}, {"sharkTTF.ttf","https://xg-cloudreve.cloud-k1.riyx.cn/f/JjjBT8/sharkTTF.ttf"}, {"sharktab","https://xg-cloudreve.cloud-k1.riyx.cn/f/8RRafm/sharktab"}, {"guralh","https://xg-cloudreve.cloud-k1.riyx.cn/f/Vqq9Ce/guralh"}, {"grb","https://xg-cloudreve.cloud-k1.riyx.cn/f/ZwwBum/grb"}, {"grc","https://xg-cloudreve.cloud-k1.riyx.cn/f/5PPNfX/grc"}, {"FishBone","https://xg-cloudreve.cloud-k1.riyx.cn/f/zggjta/FishBone"}, } local typeface = import("android.graphics.Typeface") local FontPath = "/sdcard/孤行/图片/sharkTTF.ttf"--字体路径 local font = typeface:createFromFile(FontPath) function changan.menu(sview) local UI宽度=getpx(UI宽度) local UI高度=getpx(UI高度) luajava.post(function() floatWindow=luajava.loadlayout{ FrameLayout, layout_width="match_parent", layout_height="match_parent", onTouch=hanshu, { MaterialCardView, layout_height="match_parent", layout_width="match_parent", id=luajava.newId("loading"), useCompatPadding=false, cardElevation="5dp", cardBackgroundColor=0xFF91C3F6, strokeColor=0xFF91C3F6, onClick=function() end, onTouch=hanshu, __onCreate=function(v) v:setRadius(20) local c=ColorStateList({ {android.R.attr.state_pressed}, {-android.R.attr.state_pressed} },{ 0xFF91C3F6, 0xFF91C3F6 }) v:setRippleColor(c) end, { LinearLayout, __onFinish=function(v) _ENV["beforejz"]=v end, layout_height="match_parent", layout_width="match_parent", orientation="vertical", gravity="center", { LinearProgressIndicator, indicatorTrackGapSize="0dp", trackStopIndicatorSize="0dp", id = luajava.ids["下载进度条"], layout_width = "match_parent", layout_height = "wrap_content", min = 0, max = #ckimg, progress=0, trackColor=0xffd7d7d7, __onFinish=function(v) v:setIndicatorColor({0xff161616, 0xff672AFF, 0xff1D8FFF}) end, }, { TextView, layout_marginTop="4dp", text="首次运行,正在下载资源...", textSize="13sp", id=luajava.ids["jzzy"], textColor="#000000", }, { LinearProgressIndicator, layout_marginTop="30dp", id = luajava.ids["加载进度条"], layout_width = "match_parent", layout_height = "wrap_content", indeterminate = true, __onFinish=function(v) v:setIndicatorColor({"0xff1E8FFF", "0xff3555FF", "0xff682BFF"}) v:setIndeterminateAnimationType(0) end, }, {TextView, layout_marginTop="4dp", text=项目名字.." 启动中...", textSize="13sp", textColor="#000000", } }, }, } mainLayoutParams=getLayoutParam() mainLayoutParams.width=UI宽度 mainLayoutParams.height=UI高度 changan.controlBig(floatWindow,800) window:addView(floatWindow,mainLayoutParams) end) local cpIndicator1 = luajava.getIdView("下载进度条") for i = 1,#ckimg do checkimg(ckimg[i],i) cpIndicator1:setProgress(i, true) end luajava.runUiThread(function() luajava.getIdView("jzzy"):setText("资源检查完毕") end) UIMAXY=getpx("255dp") UIMAXX=getpx("360dp") function controlSmall(control,time) luajava.runOnUiThread(function() 缩放动画=ScaleAnimation(1,0,1,0,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0) 缩放动画:setDuration(time) control:startAnimation(缩放动画) end) end function controlBig(control,time) luajava.runOnUiThread(function() 缩放动画=ScaleAnimation(0,1,0,1,Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF,0) 缩放动画:setDuration(time) control:startAnimation(缩放动画) end) end lastTime=0 function 隐藏() vibra:vibrate(6) local nowTime=os.time() if nowTime - lastTime < 0.7 then return 0 end lastTime=nowTime if tonumber(tostring(menuView:getVisibility())) ~=8.0 then luajava.newThread(function() luajava.runOnUiThread(function() controlWindow:setVisibility(View.VISIBLE) controlSmall(menuView,500) controlBig(controlWindow,500) end) gg.sleep(500) luajava.runOnUiThread(function() menuView:setVisibility(View.GONE) ggscro:setVisibility(View.GONE) mainLayoutParams.width=LayoutParams.WRAP_CONTENT -- 布局宽度 mainLayoutParams.height=LayoutParams.WRAP_CONTENT -- 布局高度 mainLayoutParams.flags=LayoutParams.FLAG_NOT_FOCUSABLE window:updateViewLayout(floatWindow,mainLayoutParams) end) end):start() else luajava.newThread(function() luajava.runOnUiThread(function() mainLayoutParams.width=UI宽度 -- 布局宽度 mainLayoutParams.height=UI高度 -- 布局高度 mainLayoutParams.flags=LayoutParams.FLAG_NOT_TOUCH_MODAL window:updateViewLayout(floatWindow,mainLayoutParams) menuView:setVisibility(View.VISIBLE) ggscro:setVisibility(View.VISIBLE) controlSmall(controlWindow,500) controlBig(menuView,500) end) gg.sleep(500) luajava.runOnUiThread(function() controlWindow:setVisibility(View.GONE) ggscro:setVisibility(View.VISIBLE) end) end):start() end end function 滚(x) luajava.runOnUiThread(function() local targetLeft = 0 for i=1, x+1 do local tabView = tab:getTabAt(i-1).view local tabWidth = tabView:getWidth() if i ~= x+1 then targetLeft = targetLeft + tabWidth end end -- 计算 Tab 应该滚动的最终位置,让其居中 local tabView = tab:getTabAt(x).view local scrollWidth = ScrollTab:getWidth() -- ScrollView 的宽度 local tabCenter = targetLeft + (tabView:getWidth() / 2) - (scrollWidth / 2) ScrollTab:smoothScrollTo(tabCenter, 0) -- 平滑滚动 end) end suofang = function(v, event) if isLocked then hanshu(v,event) return 0 end local Action = event:getAction() if Action == MotionEvent.ACTION_DOWN then RawX = event:getRawX() RawY = event:getRawY() hx = mainLayoutParams.height hy = mainLayoutParams.width if hx == 0 or hx==-2 then hx = UIMAXX hy = UIMAXY end elseif Action == MotionEvent.ACTION_MOVE then isMove = true UI高度 = tonumber(hx) + (event:getRawY() - RawY) if UI高度 > UIMAXY then mainLayoutParams.height = UI高度 else UI高度=UIMAXY end UI宽度 = tonumber(hy) + (event:getRawX() - RawX) if UI宽度 > UIMAXX then mainLayoutParams.width = UI宽度 else UI宽度=UIMAXX end --隐藏() window:updateViewLayout(floatWindow, mainLayoutParams) elseif Action == MotionEvent.ACTION_UP then 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 yltype = 0 function jianting3(func) if 音量键==false then return 0 end 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 qhkai = 0 qiehuan = function() if qhkai == 0 then qhkai = 1 draw.remove() luajava.runUiThread(function() YoYoImpl:with("FadeOut"):duration(300):playOn(floatWindow) end) gg.sleep(300) luajava.runUiThread(function() floatWindow:setVisibility(View.GONE) end) else qhkai = 0 huiz() luajava.runUiThread(function() floatWindow:setVisibility(View.VISIBLE) YoYoImpl:with("FadeIn"):duration(500):playOn(floatWindow) end) end end import"android.hardware.*"; local sensor = luajava.createProxy("android.hardware.SensorEventListener", { onSensorChanged = functions.debounce(function() if 摇一摇==false then return 0 end if qhkai~=0 then qhkai=0 huiz() luajava.runUiThread(function() floatWindow:setVisibility(View.VISIBLE) YoYoImpl:with("FadeIn"):duration(300):playOn(floatWindow) end) else qhkai=1 draw.remove() luajava.newThread(function() luajava.runUiThread(function() YoYoImpl:with("FadeOut"):duration(300):playOn(floatWindow) end) gg.sleep(400) luajava.runUiThread(function() floatWindow:setVisibility(View.GONE) end) draw.remove() end):start() end end,500) }) dexloader=dex.loadfile("/sdcard/孤行/图片/classes3.dex") MySensorManager = dexloader:loadClass("yaocn.rlyun.yaoyiyao.MySensorManager") luajava.runOnUiThread(function() MySensorManager(context, sensor) end) Page={ "ui.ViewPager", layout_width="match_parent", layout_height="match_parent", } for i=1,#stab do tmp={ LinearLayout, layout_height="match_parent", layout_width="match_parent", orientation="vertical", } for k=1,#sview[i] do tmp[#tmp+1]=sview[i][k] end _ENV["layout"..i]=luajava.loadlayout{ FrameLayout, layout_height="match_parent", layout_width="match_parent", { ScrollView, layout_height="match_parent", layout_width="match_parent", VerticalScrollBarEnabled=false, layout_marginTop="5dp", layout_marginBottom="5dp", layout_marginLeft="10dp", tmp, } } end for i=1,#stab do Page[#Page+1]=_ENV["layout"..i] end Page=luajava.loadlayout(Page) tab=luajava.loadlayout({ TabLayout, backgroundColor = 0x00000000, layout_width="match_parent", layout_height="match_parent", }) tab:setupWithViewPager(Page) tab:setTabTextColors(0xFFDCF0FE,0xFFFFFFFF) tab:setSelectedTabIndicatorColor(0xFFFFFFFF) tab:setTabMode(1) tab:requestLayout() for i = 1, #stab do local tab = tab:getTabAt(i - 1) if tab then tab:setText(stab[i]) --设置文本 end end luajava.setInterface(Page, "addOnPageChangeListener", {onPageSelected=function(view) view=tonumber(string.sub(view,1,1)) 当前页面=view+1 滚(view) end}) function getTimeStamp(t) local str = os.date("%H:%M:%S",t) return str end function uiadtext(txt,size) if not txt then txt = "" end if not size then size = "12sp" end local tmp=luajava.loadlayout( { TextView, Typeface=font, text = string.fromHtml(" "..getTimeStamp(os.time()).." "..txt..""), textSize = size, gravity="left", layout_width = "wrap_content", }) luajava.post(function() gggscro:addView(tmp) end) luajava.newThread(function() gg.sleep(100) luajava.post(function() ggscro:fullScroll(View.FOCUS_DOWN) end) end):start() 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 getVerticalBG(gtvb1,gtvb3,gtvb4,gtvb5) if not gtvb4 then gtvb4=0 gtvb5=0xff161616 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 getCorner(gtvb1,gtvb3,gtvb4,gtvb5,g1,g2,g3,g4) if not gtvb4 then gtvb4=0 gtvb5=0xff161616 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 menuView= luajava.loadlayout { FrameLayout, background={GradientDrawable,color=0xFF91C3F6,cornerRadius=20}, --主页面 layout_width="match_parent", layout_height="match_parent", { VideoView, id = "bj", layout_width = "match_parent", layout_width="200dp", layout_height="110dp", gravity="right", __onFinish = function(v) v:setVideoPath("/sdcard/孤行/图片/"..mnsp) v.start(v) v:setOnCompletionListener({ onCompletion = function() v.start(v) end }) end }, { TextView, Typeface=font, textSize="12sp", textColor="#ffffff", text=左上角标题, layout_width="210dp", layout_height="15dp", layout_marginTop = "100dp", ellipsize="marquee", singleLine=true, selected=true, marqueeRepeatLimit=-1, background=getCorner({0x66ffffff,0x66ffffff},0,0,0x66ffffff,360,360,360,360), }, { LinearLayout, layout_height="match_parent", layout_width="200dp", orientation="horizontal", { ImageView, layout_width="37dp", layout_height="37dp", layout_marginLeft="5dp", layout_marginTop="120dp", src=getRes("Gura"), onTouch=hanshu, onClick=function() 隐藏() end, }, }, { TextView, id = "time", Typeface=font, gravity = "center", textColor = "#0091EA", background=getCorner({0xFFFFFFFF,0xFFFFFFFF},10,0,0xFFFFFFFF,15,15,15,15), text = ""..os.date("%H:%M:%S"), textSize = "17sp", layout_width = "120dp", layout_height = "43dp", layout_marginLeft="47dp", layout_marginTop = "113dp", elevation="6dp", __onFinish=function(v) v:setTypeface(font) timet=v luajava.startThread(function() while true do luajava.runUiThread(function() timet:setText(getTimeStamp(os.date())) end) gg.sleep(1000) end end) end, }, { GifImageView, layout_width = '48dp', layout_height = '48dp', layout_marginLeft="165dp", layout_marginTop="110dp", src = getRes("Gura_Eat"), id="Gura", onTouch=hanshu, onClick=function() end, }, { LinearLayout, id=luajava.newId("menuview2"), layout_width="match_parent", layout_height="match_parent", orientation="vertical", {LinearLayout, layout_height="fill_parent", layout_width="match_parent", orientation="horizontal", { HorizontalScrollView, layout_height="32dp", layout_marginTop="156dp", id="ScrollTab", layout_width="200dp", HorizontalScrollBarEnabled=false, tab }, { LinearLayout, layout_height="fill_parent", layout_width="200dp", layout_weight=1, layout_marginLeft="10dp", layout_marginRight="10dp", Page }, }, }, { ScrollView, layout_height="fill_parent", layout_width="200dp", layout_marginBottom="5dp", id='ggscro', layout_marginTop="187dp", background=getCorner({0x33ffffff,0x33ffffff},10,4,0xfffffFff,10,10,10,10), --0xFFBCDAF9 layout_marginLeft="5dp", elevation='2dp', { LinearLayout, layout_marginTop="5dp", layout_marginBottom="5dp", layout_marginLeft = "5dp", id='gggscro', orientation='vertical', layout_width='match_parent', layout_height='match_parent', }, }, { ImageView, layout_width="70dp", layout_height="70dp", src=getRes("guralh"), layout_marginLeft="133dp", layout_gravity="bottom", layout_marginBottom="5dp", }, {LinearLayout, layout_height="fill_parent", layout_width="2dp", layout_marginLeft="210dp", background=getCorner({0xffffffff,0xffffffff},10,0,0xffFFE543,10,10,10,10), layout_marginTop="50dp", layout_marginBottom="20dp", } , { LinearLayout, layout_width="25dp", layout_height="25dp", id="jiaobiao", layout_gravity="right|bottom", onClick=function() end, onTouch=suofang } } controlWindow=luajava.loadlayout{ ImageView, onTouch=hanshu, onClick=function() 隐藏() end, src=xfcpic, visibility="gone", layout_width="45dp", layout_height="45dp", } luajava.runOnUiThread(function() luajava.getIdView("loading"):setVisibility(View.GONE) floatWindow:removeView(beforejz) YoYoImpl:with("FadeIn"):duration(600):playOn(luajava.getIdView("menuview2")) floatWindow:addView(menuView) floatWindow:addView(controlWindow) Gura:getDrawable():start() end) setOnExitListener(function() window:removeView(floatWindow) luajava.setFloatingWindowHide(false) gg.setVisible(true) tuichu=1 end) while true do if tuichu==1 then break end jianting3(qiehuan) gg.sleep(100) 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", string.sub(sid,1,8), string.sub(sid,10,12), string.sub(sid,21,22)) 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() 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.controlRotation9 = function(control, time,t) luajava.runUiThread(function() xuanzhuandonghua = ObjectAnimator:ofFloat(control, "rotation", { time,t }) xuanzhuandonghua:setRepeatCount(0) xuanzhuandonghua:setRepeatMode(Animation.RESTART) xuanzhuandonghua:setDuration(400) xuanzhuandonghua:start() end) end function 开关(name , func1 , func2 ) local localname=name local tname=name..guid() if func1 == nil then func1 = "" end if func2 == nil then func2 = "" end if type(func1 ) == "function" then return function() namers = _ENV [ tname ] if namers ~= "开" then _ENV [ tname ] = "开" pcall(func1 ) else _ENV [ tname ] = "关" pcall(func2 ) end end end end swfuncs,buts,checkes,sliders,radios,boxes,textvs={},{},{},{},{},{},{} local swcDraw=ColorStateList({ {android.R.attr.state_checked}, {}, }, { 0xFF91C3F6, 0xFFC7D5E0 }) local swcThumb=ColorStateList({ {android.R.attr.state_checked}, {android.R.attr.state_pressed}, {-android.R.attr.state_pressed}, },{ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }) local RadTint=ColorStateList({ {android.R.attr.state_checked}, {-android.R.attr.state_checked}, {}, },{ 0xFF91C3F6, 0xff49454F, 0xffffffff }) function getButtonBG() local selector = luajava.getStateListDrawable() selector:addState({ android.R.attr.state_pressed }, getVerticalBG({0xffd7d7d7,0xffd7d7d7},20)) selector:addState({ -android.R.attr.state_pressed }, getVerticalBG({0xffffffff,0xffffffff},20)) return selector end function changan.switchM3(name,func1,func2) local nid=name..string.randomUUID(true) colorvs[#colorvs+1]={"switch",nid} if ""..name=="摇一摇隐藏UI" or ""..name=="音量键隐藏UI" then ztai=true else ztai=false end return{ LinearLayout, layout_width='fill_parent', layout_height="40dp", gravity="center", elevation="2dp", layout_margin="4dp", background = luajava.loadlayout {GradientDrawable ,color = 0xffffffff ,cornerRadius = 20}, paddingRight="6dp", { TextView, text=name, ellipsize="marquee", singleLine=true, selected=true, Typeface=font, textColor="0xff161616", textSize="13sp", layout_weight=1, layout_width='fill_parent', layout_marginLeft="10dp", layout_marginRight="20dp", }, { MaterialSwitch, checked=ztai, id=luajava.newId(nid), thumbIconDrawable=SwitchDrawable("xyopen","xyclose"), setThumbIconSize = "24dp", TrackTintList=ColorStateList({{android.R.attr.state_checked}},{0xFF0062FF}), trackTintList=(ColorStateList({{android.R.attr.state_checked},{}},{"0xff"..RGBcolor,0x28FFFFFF})), thumbTintList=(ColorStateList({{android.R.attr.state_checked},{-android.R.attr.state_checked}},{0xFFFFFFFF,0xFF4B484F})), layout_weight=1, layout_marginTop="-3.5dp", layout_marginBottom="-3.5dp", layout_width='match_parent', layout_height='wrap_content', onCheckedChange=function(compoundButton,isChecked) if isChecked then luajava.newThread(function() pcall(func1) Snackbar:make(menuView,getTimeStamp(os.time())..name..'已开启',Snackbar.LENGTH_INDEFINITE) :setBackgroundTint("0xff"..RGBcolor)--背景颜色 :setDuration(1000) --设置自定义时长(毫秒) :show() end):start() else luajava.newThread(function() pcall(func2) Snackbar:make(menuView,getTimeStamp(os.time())..name..'已关闭',Snackbar.LENGTH_INDEFINITE) :setBackgroundTint("0xff"..RGBcolor)--背景颜色 :setDuration(1000) --设置自定义时长(毫秒) :show() end):start() end end } } end function getTimeStamp(t) local str = os.date("%H:%M:%S",t) return str end function changan.text(text,color,size,isjz) if not color then color="#161616" end if color=="跟随主题" then color="#7F5EFF" end if isjz then jzjz="center" else jzjz="left" end return { TextView, Typeface=font, id ="text", text=text, textColor=color, textSize=size, gravity=jzjz, layout_height="wrap_content", layout_width="match_parent", autoSizeTextType="uniform", } end function changan.button(txt,func,txtc) if not txt then txt = "未设置" end if not txtc then txtc="#000000" end if txtc=="跟随主题" then txtc="#190335" end local tid="Cbutton".. guid() return { LinearLayout, layout_width = "match_parent", gravity = "center_vertical", layout_margin = "4dp", background = getButtonBG(), elevation="2dp", padding="10dp", onClick = function(v) changan.controlWater(luajava.getIdView(nid), 300) luajava.newThread(function() pcall(func) Snackbar:make(menuView,getTimeStamp(os.time())..'执行'..name,Snackbar.LENGTH_INDEFINITE) :setBackgroundTint("0xff"..RGBcolor)--背景颜色 :setDuration(1000) --设置自定义时长(毫秒) :show() end):start() end, { TextView, Typeface=font, textColor = txtc, text = txt, textSize = "13sp", layout_height = "wrap_content", layout_width = "match_parent", layout_weight=1, },{ImageView, src=getRes("heir"), layout_height="14dp", layout_width="14dp", } } end function changan.switch(name,func1,func2,miaoshu) local nid = name..guid() swfuncs[nid]= {func1,func2} if not name then name = "未设置" end local rest ={ LinearLayout, layout_width = "match_parent", layout_height = "48dp", gravity = "center_vertical", { LinearLayout, layout_width = "match_parent", layout_height = "40dp", layout_margin="4dp", gravity = "center_vertical", background = luajava.loadlayout {GradientDrawable ,color = 0xffffffff ,cornerRadius = 20}, elevation="2dp", padding = {"0dp","0dp","6dp","0dp"}, { TextView, Typeface=font, gravity = "top", text = name, textColor = "#000000", textSize = "13sp", layout_weight = 1, layout_width = "80dp", layout_marginLeft = "10dp", layout_marginRight = "20dp", }, { TextView, Typeface=font, gravity = "center", layout_height = "match_parent", text = miaoshu, textSize = "11sp", layout_width = "wrap_content", layout_marginLeft = "-50dp", layout_weight = 1, textColor = "#A5A5A5", }, { SwitchButton, ThumbRadius = "2.5dp", BackRadius = "3dp", ThumbRangeRatio = '0.9dp', ThumbMargin = RectF(10,10,10,10), id=luajava.newId(nid), __onFinish=function(v) v:setThumbColor(swcThumb) v:setBackColor(swcDraw) luajava.setInterface(v, "setOnCheckedChangeListener", {onCheckedChanged=function(view,isc) if isc then local func=swfuncs[nid][1] or function() end if func~=nil then luajava.startThread(func) uiadtext( name.." 已开启") end else local func=swfuncs[nid][2] or function() end if func~=nil then luajava.startThread(func) end end end}) end, layout_width = "wrap_content", layout_height = "wrap_content", }} } return rest end function visi (tid) vibra:vibrate(4) if boxes[tid][5] then boxes[tid][5]=false transManager:go(boxes[tid][1],boxes[tid][4]) changan.controlRotation9(boxes[tid][3],90,0) boxes[tid][3]:setColorFilter(0xff161616) else boxes[tid][5]=true transManager:go(boxes[tid][2],boxes[tid][4]) changan.controlRotation9(boxes[tid][6],0,90) boxes[tid][6]:setColorFilter(0xFF91C3F6) end end function changan.box(views) local tid = "box".. guid () boxes[tid]={} local firadio = { LinearLayout , layout_width = "match_parent" , layout_height = "wrap_content" , layout_margin = "4dp" , orientation = "vertical" , background=luajava.loadlayout {GradientDrawable ,color = 0xffffffff ,cornerRadius = 20}, elevation="2dp", __onFinish=function(v) boxes[tid][2]=Scene(v,boxes[tid][2]) boxes[tid][1]=Scene(v,boxes[tid][1]) boxes[tid][4]=luajava.new(TransitionSet) local bds=luajava.new(ChangeBounds) bds:setDuration(500) boxes[tid][4]:addTransition(bds) boxes[tid][4]:setDuration(500) end, } if type (views [1]) == "string" or type (views [1]) == "number" then else gg.alert ("changan.box的table内第一个元素必须是string") os.exit () end local but={ LinearLayout , layout_width = "match_parent" , layout_height = "40dp" , gravity = "center_vertical" , layout_margin = "3dp" , background = getButtonBG(), onClick = function() visi (tid) end, { TextView , text = views [1] , Typeface=font, textSize = "13sp" , 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", { ImageView , src = getRes("FishBone"), layout_width = "22dp" , layout_height = "22dp" , colorFilter=0xff161616 } } } boxes[tid][1]=luajava.loadlayout{ LinearLayout, layout_width="match_parent", { LinearLayout , layout_width = "match_parent" , layout_height = "40dp" , gravity = "center_vertical" , layout_margin = "3dp" , background = getButtonBG(), onClick = function() visi (tid) end, { TextView , text = views [1] , Typeface=font, textSize = "13sp" , 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", { ImageView , src = getRes("FishBone"), layout_width = "22dp" , layout_height = "22dp" , colorFilter=0xff161616, __onFinish=function(v) boxes[tid][3]=v end, } } } } table.insert(firadio,but) local radios = { LinearLayout, orientation = "vertical", layout_width = "match_parent", } for i = 2 , # views do radios [# radios + 1] = views [i] end boxes[tid][2]=luajava.loadlayout{ LinearLayout, layout_width="match_parent", orientation = "vertical" , { LinearLayout , layout_width = "match_parent" , layout_height = "40dp" , gravity = "center_vertical" , layout_margin = "3dp" , background = getButtonBG(), onClick = function() visi (tid) end, { TextView , text = views [1] , Typeface=font, textSize = "13sp" , 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", { ImageView , src = getRes("FishBone"), layout_width = "22dp" , layout_height = "22dp" , colorFilter=0xFF91C3F6, __onFinish=function(v) boxes[tid][6]=v end, } } }, radios } return firadio end function changan.check(cklist) if #cklist==0 then return nil end local rest = { LinearLayout, layout_width = "match_parent", layout_height = "wrap_content", gravity = "center", orientation="vertical", layout_marginLeft="5dp", layout_marginRight="5dp", layout_marginTop = "4dp", layout_marginBottom = "4dp", background=luajava.loadlayout {GradientDrawable ,color = 0xffffffff ,cornerRadius = 20}, } for i = 1, #cklist,2 do local tempTable = {LinearLayout, layout_width = "match_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 function changan.intcheck(name,func1,func2) nid=name..string.randomUUID(true) colorvs[#colorvs+1]={"check",nid} if not name then name="未设置" end check={ LinearLayout, layout_width='match_parent', layout_height="42dp", layout_weight=1, layout_marginTop="1dp", layout_marginBottom="1dp", { CheckBox, id=luajava.newId(nid), buttonTintList=ColorStateList({{android.R.attr.state_checked},{-android.R.attr.state_checked}},{"0xff"..RGBcolor,0xff49454F}), layout_gravity="center", layout_width='match_parent', layout_height='wrap_content', text=name, onCheckedChange=function(compoundButton,isChecked) if isChecked then luajava.newThread(function() pcall(func1) Snackbar:make(menuView,getTimeStamp(os.time())..name..'已开启',Snackbar.LENGTH_INDEFINITE) :setBackgroundTint("0xff"..RGBcolor)--背景颜色 :setDuration(1000) --设置自定义时长(毫秒) :show() end):start() else luajava.newThread(function() pcall(func2) Snackbar:make(menuView,getTimeStamp(os.time())..name..'已关闭',Snackbar.LENGTH_INDEFINITE) :setBackgroundTint("0xff"..RGBcolor)--背景颜色 :setDuration(1000) --设置自定义时长(毫秒) :show() end):start() end end } } return check end 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 = 0xff000000 , Typeface=font, 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={ RadioGroup, layout_width = 'match_parent', layout_height = "wrap_content", gravity = "center_vertical", layout_marginRight = "5dp", layout_marginLeft = "5dp", layout_marginTop='4dp', layout_marginBottom='4dp', elevation='2dp', orientation = "vertical" , background = luajava.loadlayout{GradientDrawable,color = 0xFFFFFFFF,cornerRadius = 20}, 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 local nid = name..guid () radiog[rid][nid]=false local tid = nid..guid () restt [# restt + 1] = { RadioButton , layout_width = '250dp' , layout_height = "wrap_content" , layout_marginLeft = "4dp" , layout_marginRight = "10dp" , text = name , textSize="13sp", Typeface=font, textColor = 0xff000000 , gravity = "center_vertical" , buttonTintList=ColorStateList({{android.R.attr.state_checked},{-android.R.attr.state_checked}},{'0xff'..RGBcolor,0xFF48454C},{0xFF000000,0xFF000000}), onClick = function (v) changan.controlWater (v, 200) luajava.startThread(func) end } end rest [# rest + 1] = restt return luajava.loadlayout (rest) end function changan.edit(name,hint) _ENV[name]=name..string.randomUUID(true) if not hint then hint=name end return { LinearLayout, layout_width='fill_parent', layout_height="44dp", { EditText, background=getButtonBG(), gravity="center", hint=hint, textColor="#161616", textSize="13sp", elevation="2dp", layout_height="38dp", layout_gravity="center", layout_marginRight="4dp", layout_marginLeft="4dp", id=luajava.newId(_ENV[name]), layout_width='match_parent', } } end function changan.getedit(name) edit=tostring(luajava.getIdValue(_ENV[name]):getText()) return edit 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_height = "47dp", padding = { "1dp","1dp","1dp","1dp" }, { LinearLayout, id=luajava.newId(kid), layout_width = 'match_parent', layout_hight = "match_parent", layout_marginTop = "3dp", layout_marginBottom = "3dp", layout_marginRight = "5dp", layout_marginLeft = "5dp", gravity = "center_vertical", elevation='2dp', background = luajava.loadlayout { GradientDrawable , color = 0xffffffff , cornerRadius = 20 } ,padding = { "0dp","0dp"," 6dp","0dp" }, { TextView, padding={"10dp","10dp","0dp","10dp",}, gravity = "top", textSize = "13sp", textColor='#000000', Typeface=font, text = name, id = luajava.newId(names), layout_width = '100dp', --layout_marginLeft = "5dp", layout_marginRight = "0dp", }, { Slider, ThumbWidth='23dp',--宽度 thumbHeight='23dp',--高度 ThumbWidth='4dp',--宽度 thumbHeight='23dp',--高度 trackHeight='16dp', trackStopIndicatorSize='4dp',--后面的小点 ThumbTrackGapSize='6dp',--正中间 TrackInsideCornerSize='2dp',--里面的圆角 ThumbElevation='2dp',--阴影 tickVisible=false,--true __onFinish=function(v) v:setTrackActiveTintList(ColorStateList({{},},{'0xff'..RGBcolor})) v:setTrackInactiveTintList(ColorStateList({{},},{'0x55'..RGBcolor})) v:setThumbTintList(ColorStateList({{},},{'0xff'..RGBcolor})) 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, onClick = function() luajava.newThread(function() func() end):start() end, addOnChangeListener = function(slider, value, fromUser) -- 如果执行的功能不是修改器的函数,或者不带阻塞的,可以不用 window:threadWraper 包裹,性能更好(属于UI线程) -- 如果不是用户触发的,不处理 if not fromUser then return end Snackbar:make(slider,getTimeStamp(os.time())..'拖动条进度 > '..value,Snackbar.LENGTH_INDEFINITE) :setBackgroundTint("0xff"..RGBcolor)--背景颜色 :setDuration(1000) --设置自定义时长(毫秒) :show() end }, }}) return rest 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=0xff0062FF, 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]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 = 0xffffffff , 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 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 dex.loadfile("/sdcard/孤行/图片/sensor.dex") import 'com.changan.CACore.SwitchButton' dex.loadfile("/sdcard/孤行/图片/Lottie.dex") import 'com.airbnb.lottie.LottieAnimationView' import 'com.airbnb.lottie.LottieComposition' import 'com.airbnb.lottie.LottieDrawable' dex.loadfile("/sdcard/孤行/图片/Blur.dex") import 'eightbitlab.com.blurview.BlurView' 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=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() return getButtonBG() 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 -- 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 <= 1110 then mainLayoutParams.height = mubx end muby = tonumber(hy) + (event:getRawX() - RawX) if muby >= 250 and muby <= 2450 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 左上角标题="公告:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 项目名字="孤行UI" stab={ "防封", "功能", "音乐", "设置" } xfcpic="/sdcard/孤行/图片/grc" function huiz() end UI宽度="520dp" UI高度="330dp" changan.menu({{---第一页 changan.text(项目名字,"0xFFFFFFFF","15sp",true), changan.image("/sdcard/孤行/图片/DarkGura","100dp","300dp","0dp", function() end), changan.switch("功能", function() end, function() end), changan.switchM3("功能", function() end, function() end), changan.button("功能", function() end), changan.switch("功能", function() end, function() end), changan.switchM3("功能", function() end, function() end), changan.button("功能", function() end), },{---第二页 changan.text(项目名字,"0xFFFFFFFF","15sp",true), changan.image("/sdcard/孤行/图片/LightGura","100dp","300dp","0dp", function() end), changan.box({"XXX区", changan.seek("拉条演示","ltxx",1,50,1), changan.seek2("小数演示","ltxx2",0.1,2,0.4,0.1), changan.button("调用拉条", function() gg.alert(ltxx) gg.alert(ltxx2) end, 0xffE20C30), changan.edit("输入框演示"), changan.button("调用输入框", function() local tmp=changan.getedit("输入框演示") gg.alert(tmp) end, 0xff0056FF), }),--box结尾 changan.radio({{ "单选1" , function() end },{ "单选2" , function() end },{ "单选3" , function() end },{ "单选4" , function() end },{ "单选5" , function() end },{ "单选6" , function() end }}), changan.check({{ "例子1", function() end, function() end },{ "例子2", function() end, function() end },{ "例子3", function() end, function() end },{ "例子4", function() end, function() end },{ "例子5", function() end, function() end },{ "例子6", function() end, function() end }}), },{---第三页 getwyyv(), changan.button("停止音乐", function() gg.toMusic("stop") end, 0xFFFF0000), },{---第四页 changan.switch("选择进程", function() gg.setProcessX() end), changan.switchM3("随机语录", function() Y=gg.makeRequest("https://v1.hitokoto.cn/").content --获取云端数据 Q=string.match(Y,'hitokoto(.+)type') --模式匹配他们中的一切字符 F=string.gsub(Q,'":"',"") K=string.gsub(F,'","',"") --删除多余垃圾 string.toMusic("\n\n"..""..K.."") QD = gg.alert("今日语录:\n\n"..""..K.."") if QD == 1 then end if QD == 3 then end end), changan.switch("音量键隐藏UI", function() 音量键=true end, function() 音量键=false end), changan.switchM3("摇一摇隐藏UI", function() 摇一摇=true end, function() 摇一摇=false end), changan.button("退出UI", function() tuichu=1 end), }})