--[[ 作者Shizuku(QQ2843833170) B站靓女空白 此UI是我自己做给以后的自制游戏脚本的UI,不过由于特殊原因,以后一段时间将无法玩GG,因此将暂时搁置此UI的制作,秉承开源精神,我决定将此半成品UI开源供使用和学习 由于没有正式投入使用,因此没有做功能封装,使用该UI需要有一定的luaj基础 UI添加功能教程 哔哩哔哩BV号 BV1DGBsYxE7m 该UI目前功能主要是高度自定义的主题功能和音乐功能 另外由于半成品,很多地方写法还未优化和精简,请自行处理 再就是开源时删除了部分只开发了一半的东西,如果因为没删干净出现bug也麻烦自行排查 有什么UI上的bug或者改进和新增功能的建议可以反馈给作者哟 如果想给作者喂猫粮,给作者b站充电就好啦 ELGG可以直接运行 ]] if type(getwigyz) ~= "function" then local a = "请使用ELGG执行\n下载:https://xiaoman.top/elgg" print(a) gg.alert(a) os.exit() end ueiejsj = "/sdcard/.txj/半成品暂时开源" if io.open(ueiejsj) == nil then gg.toast("第一次打开,正在下载资源配置") local loadingBox = getLoadingBox("开始下载资源文件...") loadingBox["显示"]() file.mkdir("/sdcard/.txj") file.mkdir("/sdcard/.Luajr/") file.download("https://vip.123pan.cn/1813873690/luaj%E6%A8%A1%E5%9D%97/%E8%B5%84%E6%BA%90%E5%8C%85/luajr.zip", "/sdcard/res.zip") gg.sleep(1000) file.zip("/sdcard/res.zip", "/sdcard/.Luajr/", "password", "unzip") io.open(ueiejsj, "w"):write("喵喵喵") loadingBox["关闭"]() gg.toast("下载完毕") end if gg.getWindowOrientation() == 0 then gg.alert("请在横屏模式下打开") os.exit() end import "android.app.*" import "android.os.*" import "android.widget.*" import "android.view.*" import "android.content.*" import "java.util.*" import "java.lang.*" import "android.*" import "android.graphics.drawable.*" import "android.graphics.PixelFormat" import "android.view.animation.Animation" import "android.view.animation.RotateAnimation" import "android.animation.ObjectAnimator" import "android.view.animation.ScaleAnimation" import "android.view.animation.Animation" import "android.view.animation.*" import "android.view.animation.DecelerateInterpolator" import "android.ext.*" import "android.ext.MainService" import "android.graphics.drawable.GradientDrawable" import "android.graphics.Typeface" import "java.io.File" import "luaj.lib.ModLib" import "android.ext.Tools" import "android.view.inputmethod.InputMethodManager" import "android.graphics.PorterDuffColorFilter" import "android.graphics.PorterDuff" import "android.graphics.*" import "android.graphics.drawable.ColorDrawable" import "android.content.Context" import "android.media.AudioManager" import "android.webkit.MimeTypeMap" import "android.text.format.Formatter" --格式化文件大小 import "android.text.format.Formatter" import "android.text.format.DateUtils" import "android.text.style.*" import "android.text.SpannableString" import "android.text.Spanned" import "android.util.AttributeSet"; import "android.view.inputmethod.InputMethodManager" import "android.content.pm.PackageManager" import "android.webkit.MimeTypeMap" import "android.content.Intent" import "android.net.Uri" import "android.view.*" context = activity window = context.getSystemService("window") -- 获取窗口管理器 function threadStart(runnable1) --线程 local newRun = luajava.createProxy("java.lang.Runnable", runnable1) subThread = luajava.newInstance("java.lang.Thread", newRun) subThread:start() return subThread end function loading() pm = activity.getPackageManager(); ooo1 = tonumber(device.getWidth) ooo2 = tonumber(device.getHeight) xfc_Alpha = 1; if Build.VERSION.SDK_INT >= 26 then windowtype = 2038 else windowtype = 2003 end loadfile("/sdcard/.Luajr/config/theme.lua")() xfc_cr_1 = themes_chice[1] xfc_cr_21 = themes_chice[2] xfc_cr_22 = themes_chice[3] xfc_cr_3 = themes_chice[4] xfc_cr_41 = themes_chice[5] xfc_cr_42 = themes_chice[6] loadfile("/sdcard/.Luajr/config/settings.lua")() rescolor = lua_sets["rescolor"] day_switch = lua_sets["day"] if day_switch then local current_hour = tonumber(os.date("%H")) if current_hour < 18 and current_hour > 6 then xfc_cr_1 = '#FFF9F9F9' xfc_cr_21 = '#FF274B7C' xfc_cr_22 = 4280765308 xfc_cr_3 = 4278224127 xfc_cr_41 = '#FFFFFFFF' xfc_cr_42 = 4294967295 rescolor = "#FF303030" mmmmm1 = "白天" mmmmm2 = "亮色" elseif current_hour < 6 or current_hour > 18 then xfc_cr_1 = '#FF4A4458' xfc_cr_21 = '#FFD8CEE8' xfc_cr_22 = 4292398824 xfc_cr_3 = 4291869951 xfc_cr_41 = '#FF5A5468' xfc_cr_42 = 4284109928 rescolor = "#FFDADFE3" mmmmm1 = "黑夜" mmmmm2 = "暗色" end end toastt = lua_sets["toastt"] isplaymusic = lua_sets["music"] pageani = lua_sets["pageani"] tipstyle = lua_sets["tip"] sw_key = lua_sets["key"] xfq_fq = lua_sets["fq"] swtype = lua_sets["switch"] loadfile("/sdcard/.Luajr/scripts/pageani" .. pageani .. ".lua")() --加载换页动画 loadfile("/sdcard/.Luajr/scripts/switch" .. swtype .. ".lua")() --加载换页动画 nummm = 1 menuaaa = {} tipshow = true function getShepeBackground(color, radiu) --设置背景函数 drawable = luajava.new(GradientDrawable) drawable.setShape(GradientDrawable.RECTANGLE) drawable.setColor(color) drawable.setCornerRadii({ radiu, radiu, radiu, radiu, radiu, radiu, radiu, radiu }) return drawable end function rotation_animation(view, time, ras) --旋转动画 local xObjectAnimator = ObjectAnimator.ofFloat(view, "rotation", 0, ras) xObjectAnimator.setDuration(time) -- 动画时间 xObjectAnimator.setInterpolator(DecelerateInterpolator()) -- 动画插值器,减速 xObjectAnimator.start() end function hc_animation(view, lios) rotate = RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5, Animation.RELATIVE_TO_SELF, 0.5) rotate.setDuration(lios) rotate.setRepeatCount(lios) view.startAnimation(rotate) end function sparkle_animation(view, t, d1, d2) -- 闪耀动画 mObjectAnimator = ObjectAnimator.ofFloat(view, "alpha", d1, d2) mObjectAnimator.setDuration(t) --动画时间 mObjectAnimator.setInterpolator(DecelerateInterpolator()) --动画插值器,减速 mObjectAnimator.start() end function addMargin(id, mm) local margin = dp2px(mm) local params = id.getLayoutParams() params.setMargins(margin, margin, margin, margin) id.setLayoutParams(params) end function addWeight(id, mm) local params = mm.getLayoutParams() params.weight = 1 id.setLayoutParams(params) end function dp2px(dpValue) --dp转px值 local scale = activity.getResources().getDisplayMetrics().scaledDensity return dpValue * scale + 0.5 end function px2dp(pxValue) local scale = activity.getResources().getDisplayMetrics().scaledDensity return pxValue / scale + 0.5 end function addlog(color1, color2, funcname, tip) local text = SpannableString.new(os.date("%H:%M:%S", os.time()) .. " " .. funcname .. " " .. tip) local long = utf8.len(funcname) text.setSpan(ForegroundColorSpan.new(color1), 9, 9 + long, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) text.setSpan(ForegroundColorSpan.new(color2), 10 + long, 10 + long + utf8.len(tip), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) local logview = loadlayout({ TextView, text = text, textColor = xfc_cr_22, gravity = "center", textSize = "12sp", ellipsize = "marquee", selected = true, singleLine = true, layout_width = "wrap", layout_height = "25dp", }) gg_log.addView(logview) end function functip(text1, text2) threadStart({ run = function() activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() tiplay1.setText(text1) tiplay2.setText(text2) tiplay.setVisibility(View.VISIBLE) tiplay.startAnimation(ScaleAnimation(0, 1, 0, 1, 1, 0, 1, 0).setDuration(300)) end })) gg.sleep(2200) if tipshow then tiplay.startAnimation(ScaleAnimation(1, 0, 1, 0, 1, 0, 1, 0).setDuration(300)) gg.sleep(300) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() tiplay.setVisibility(View.GONE) end })) else tipshow = true end end }) end function switch_color(id) id.TrackDrawable.setColorFilter(PorterDuffColorFilter(xfc_cr_3, PorterDuff.Mode.SRC_ATOP)) id.ThumbDrawable.setColorFilter(PorterDuffColorFilter(xfc_cr_3, PorterDuff.Mode.SRC_ATOP)); end function seekcolor(id, color1, color2, r, min, max) progressBg = GradientDrawable() progressBg.setCornerRadii({ r, r, r, r, r, r, r, r }); progressBg.setColor(color1) thumbDrawable = GradientDrawable() thumbDrawable.setCornerRadii({ r, r, r, r, r, r, r, r }); thumbDrawable.setColor(0x00FFFFFF) id.setThumb(thumbDrawable) progressContent = ClipDrawable( GradientDrawable() .setCornerRadius(r) .setColor(color2), Gravity.LEFT, ClipDrawable.HORIZONTAL) progressDrawable = id.getProgressDrawable() progressBgIndex = progressDrawable.findIndexByLayerId(android.R.id.background) progressContentIndex = progressDrawable.findIndexByLayerId(android.R.id.progress) progressDrawable.setDrawable(progressBgIndex, progressBg) progressDrawable.setDrawable(progressContentIndex, progressContent) id.setMinHeight(dp2px(min)) id.setMaxHeight(dp2px(max)) end function layDialog(arr) local create_dlg = AlertDialog.Builder(activity) create_dlg.setView(arr["view"]) create_dlg.setTitle(arr["title"]) create_dlg.setCancelable(false) if arr["potext"] then create_dlg.setPositiveButton(arr["potext"], { onClick = function(v) pcall(arr["pofunc"], arr) end }) end if arr["neutext"] then create_dlg.setNeutralButton(arr["neutext"], { onClick = function(v) pcall(arr["neufunc"]) end }) end local create1 = create_dlg.create() create1.getWindow().setType(windowtype) local dialogView = create1.getWindow() local drawable = luajava.new(GradientDrawable) drawable.setColor(xfc_cr_42) drawable.setCornerRadius(20) dialogView.setBackgroundDrawable(drawable) create1.show() end function cotbtn1(text, func) local se1 = { TextView, layout_width = -1, layout_height = -1, layout_weight = 1, textSize = "14sp", text = text, layout_margin = "4dp", textColor = xfc_cr_22, background = miaobian(1, 20, xfc_cr_1, xfc_cr_21), onClick = function() pcall(func) end, gravity = "center", } return se1 end function diline(text) local dilien = { LinearLayout, layout_width = -1, layout_height = "26dp", gravity = "center", { View, layout_width = "40dp", background = getShepeBackground(xfc_cr_3, 0), layout_height = "2dp" }, { TextView, layout_width = "wrap", layout_height = -1, layout_marginLeft = "5dp", layout_marginRight = "5dp", textSize = "14sp", gravity = "center", textColor = xfc_cr_3, text = text }, { View, layout_width = -1, background = getShepeBackground(xfc_cr_3, 0), layout_height = "2dp", }, } return dilien end function textdlg(tittle, text) local dlgview = loadlayout({ RelativeLayout, layout_width = "fill", gravity = "center", layout_height = "fill", { LinearLayout, layout_width = "405dp", layout_height = "186dp", gravity = "center", background = miaobian(4, 16, xfc_cr_1, xfc_cr_21), { LinearLayout, layout_width = "225dp", layout_height = -1, gravity = "center", layout_margin = "5dp", orientation = "vertical", { TextView, layout_width = -1, layout_height = "30dp", textSize = "14sp", gravity = "center", textColor = xfc_cr_3, text = tittle }, { ScrollView, layout_width = -1, layout_height = -1, layout_margin = "5dp", VerticalScrollBarEnabled = false, { TextView, layout_width = -1, layout_height = -1, textSize = "12sp", textColor = xfc_cr_22, text = text }, }, }, { LinearLayout, layout_width = -1, layout_height = -1, gravity = "center", layout_margin = "4dp", orientation = "vertical", { ImageView, layout_width = "160dp", layout_height = "134dp", src = "/sdcard/.Luajr/res/tip.png" }, { LinearLayout, layout_width = -1, layout_height = -1, cotbtn1("确定", function() dlg_create.dismiss() end), }, }, }, }) local create_dlg = AlertDialog.Builder(activity) create_dlg.setView(dlgview) create_dlg.setCancelable(false) dlg_create = create_dlg.create() dlg_create.getWindow().setType(windowtype) dlg_create.getWindow().setBackgroundDrawable(ColorDrawable(0x00FFFFFF)) dlg_create.show() end function choosedlg(arr, num) local dlgview = loadlayout({ RelativeLayout, layout_width = "fill", gravity = "center", layout_height = "fill", { LinearLayout, layout_width = "390dp", layout_height = "200dp", gravity = "center", background = miaobian(4, 16, xfc_cr_1, xfc_cr_21), { LinearLayout, layout_width = "150dp", layout_height = -1, gravity = "center", layout_margin = "5dp", orientation = "vertical", { TextView, layout_width = -1, layout_height = "30dp", textSize = "14sp", gravity = "center|left", textColor = xfc_cr_22, id = "cse_t", text = "当前 " .. arr[2][num][1] }, { ScrollView, layout_width = -1, layout_height = -1, VerticalScrollBarEnabled = false, { RadioGroup, layout_width = -1, id = "rd_gp1", layout_height = -1, background = miaobian(2, 5, xfc_cr_1, xfc_cr_21), }, }, }, { LinearLayout, layout_width = -1, layout_height = -1, gravity = "center", layout_margin = "5dp", orientation = "vertical", { TextView, layout_width = -1, layout_height = "30dp", textSize = "14sp", gravity = "center", textColor = xfc_cr_22, text = arr[1] }, { RelativeLayout, layout_width = -1, layout_height = "120dp", { VideoView, layout_width = -1, id = "chs_video", layout_height = -1, }, }, { LinearLayout, layout_width = -1, layout_height = -1, cotbtn1("取消", function() dlg_create.dismiss() chs_target = nil end), cotbtn1("重播", function() if chs_target then chs_video.start() end end), cotbtn1("应用", function() pcall(arr[3]) dlg_create.dismiss() chs_target = nil end), }, }, }, }) for i = 1, #arr[2] do local tbl = arr[2][i] local radbtn = loadlayout({ RadioButton, layout_width = -1, layout_height = "30dp", text = tbl[1], textColor = xfc_cr_3, onClick = function() chs_target = i cse_t.setText("当前 " .. arr[2][i][1]) chs_video.setVideoPath(tbl[2]) chs_video.start() end }) rd_gp1.addView(radbtn) end local create_dlg = AlertDialog.Builder(activity) create_dlg.setView(dlgview) create_dlg.setCancelable(false) dlg_create = create_dlg.create() dlg_create.getWindow().setBackgroundDrawable(ColorDrawable(0x00FFFFFF)) dlg_create.getWindow().setType(windowtype) dlg_create.show() end function getLayoutParams() local LayoutParams = WindowManager.LayoutParams local 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 layoutParams.gravity = Gravity.CENTER -- 重力设置 layoutParams.width = LayoutParams.WRAP_CONTENT -- 布局宽度 layoutParams.height = LayoutParams.WRAP_CONTENT -- 布局高度 return layoutParams end function getLayoutParams1() local LayoutParams = WindowManager.LayoutParams local 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 layoutParams.gravity = Gravity.RIGHT|Gravity.BOTTOM -- 重力设置 layoutParams.width = LayoutParams.WRAP_CONTENT -- 布局宽度 layoutParams.height = LayoutParams.WRAP_CONTENT -- 布局高度 return layoutParams end function xfq_addfunc() function suspended_ball.onClick(v) --悬浮球点击事件 xfq.setVisibility(View.GONE) xfc.setVisibility(View.VISIBLE) window.updateViewLayout(xfc, XFCparams) touch.startAnimation(ScaleAnimation(0, 1, 1, 1, 1, 0, 1, 1).setDuration(500)) end function suspended_ball.onTouch(v, event) --移动事件 local Action = event.getAction() if Action == MotionEvent.ACTION_DOWN then RawX = event.getRawX() -- 获取X坐标 RawY = event.getRawY() -- 获取Y坐标 x = XFQparams.x -- 申明变量xmX为原X坐标 y = XFQparams.y -- 申明变量xmY为原Y坐标 elseif Action == MotionEvent.ACTION_MOVE then XFQparams.x = tonumber(x) + (event.getRawX() - RawX) XFQparams.y = tonumber(y) + (event.getRawY() - RawY) window.updateViewLayout(xfq, XFQparams) end end end function process_chooser() --进程图片 threadStart({ run = function() local info = gg.getTargetInfo() local info1 = info["label"] local info2 = info["cmdLine"] local icon = pm.getApplicationInfo(info2, 0) local icon = icon.loadIcon(pm); activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() packagepic.setImageDrawable(icon) Lpic.setImageDrawable(icon) end })) end }) end function miaobian(d, r, t, y) local InsideColor = Color.parseColor(t) local drawable = GradientDrawable() drawable.setShape(GradientDrawable.RECTANGLE) drawable.setColor(InsideColor) drawable.setCornerRadii({ r, r, r, r, r, r, r, r }); drawable.setStroke(d, Color.parseColor(y)) return drawable end function c_page(btn, layout) if btn then local tp = ObjectAnimator.ofFloat(an_line, "Y", an_line.getY(), btn.getY()) tp.setDuration(400) tp.start() current_btn.setAlpha(0.65) current_btn = btn current_btn.setAlpha(1) end c_page_ani(btn, layout) end function imgbtn(img, func) local layout = { ImageView, layout_width = "42dp", layout_height = "42dp", layout_margin = "10dp", onClick = function() pcall(func) end, layout_gravity = 'center', src = img, } return layout end function cotbtn(text, func) local se1 = { TextView, layout_width = -1, layout_height = "40dp", textSize = "14sp", text = text, layout_margin = "4dp", textColor = xfc_cr_22, background = miaobian(1, 20, xfc_cr_1, xfc_cr_21), onClick = function() pcall(func) end, gravity = "center", } return se1 end function shu_text(height, width, color, size1, size2, text1, text2) local layout = { RelativeLayout, layout_width = width, layout_height = height, { TextView, textColor = color, textSize = size1, text = text1, gravity = "center", layout_height = "18dp", layout_width = -1, layout_alignParentTop = true, layout_marginTop = "6dp", }, { TextView, textColor = color, textSize = size2, text = text2, layout_height = "18dp", layout_width = -1, gravity = "center", layout_alignParentBottom = true, layout_marginBottom = "6dp", }, } return layout end function basic_switch(id, text, func) local sw = { Switch, id = id, layout_width = -1, padding = "3dp", layout_height = "40dp", text = text, textColor = xfc_cr_22, onClick = function() pcall(func) end } return sw end function choice_btn(pic, text, id, func) local layout = { CardView, id = id, layout_width = -1, layout_height = "40dp", layout_marginLeft = "9dp", layout_marginRight = "7dp", layout_marginTop = "8dp", CardBackgroundColor = xfc_cr_42, radius = '12', Elevation = '10', onClick = function() pcall(func) end, onTouch = function(v, event) local event = event.getAction() if event == MotionEvent.ACTION_DOWN then pcall(load(id .. ".setAlpha(0.85)")) elseif event == MotionEvent.ACTION_UP or event == MotionEvent.ACTION_CANCEL then pcall(load(id .. ".setAlpha(0.65)")) end end, { RelativeLayout, gravity = "center", { ImageView, layout_alignParentLeft = "true", layout_marginLeft = "3dp", layout_alignParentTop = "true", layout_marginTop = "7dp", layout_width = "26dp", layout_height = "26dp", padding = "4dp", src = pic, ColorFilter = rescolor, }, { TextView, textColor = xfc_cr_22, textSize = "12sp", text = text, layout_alignParentTop = "true", layout_marginTop = "4dp", layout_height = "32dp", layout_alignParentLeft = "true", layout_marginLeft = "29dp", layout_width = -1, gravity = "center", }, }, } return layout end function shu_button(id, pic, text, func) local layout = { CardView, layout_margin = "3dp", layout_gravity = 'center', Elevation = '5', layout_width = -1, layout_height = '50dp', layout_weight = 1, radius = '12', id = id, CardBackgroundColor = xfc_cr_42, { LinearLayout, layout_width = -1, layout_height = -1, gravity = "center", orientation = "vertical", onTouch = function(v, event) local event = event.getAction() if event == MotionEvent.ACTION_DOWN then pcall(load(id .. ".setAlpha(0.8)")) elseif event == MotionEvent.ACTION_UP or event == MotionEvent.ACTION_CANCEL then pcall(load(id .. ".setAlpha(1)")) end end, onClick = function() pcall(func) end, { ImageView, layout_width = "32dp", layout_height = "32dp", padding = "4dp", ColorFilter = rescolor, src = pic, }, { TextView, textColor = xfc_cr_22, textSize = "11sp", text = text, layout_height = "18dp", layout_width = -1, gravity = "center", }, }, } return layout end function picbtn(id, pic, text, text2, func, color, nooo) if not color then color = xfc_cr_22 end if nooo then rescolor1 = 0x00000000 else rescolor1 = rescolor end local sw = { CardView, radius = '14', layout_height = "35dp", layout_width = -1, Elevation = '8', layout_margin = "5dp", id = id, CardBackgroundColor = xfc_cr_41, onClick = function() pcall(func) end, onTouch = function(v, event) local event = event.getAction() if event == MotionEvent.ACTION_DOWN then pcall(load(id .. ".setAlpha(0.8)")) elseif event == MotionEvent.ACTION_UP or event == MotionEvent.ACTION_CANCEL then pcall(load(id .. ".setAlpha(1)")) end end, { RelativeLayout, gravity = "center", { ImageView, layout_alignParentLeft = "true", layout_marginLeft = "3dp", layout_alignParentTop = "true", layout_marginTop = "5dp", ColorFilter = rescolor1, layout_width = "24dp", layout_height = "24dp", onClick = function() functip(text, text2) end, src = pic }, { TextView, textColor = color, textSize = "13sp", text = text, layout_alignParentTop = "true", layout_marginTop = "2dp", layout_height = "30dp", layout_centerVertical = true, layout_alignParentLeft = "true", layout_marginLeft = "34dp", layout_width = "wrap", gravity = "center", }, { ImageView, layout_alignParentRight = "true", layout_alignParentTop = "true", layout_marginTop = "7dp", layout_marginRight = "4dp", ColorFilter = rescolor, layout_centerVertical = true, layout_width = "21dp", layout_height = "21dp", src = "/sdcard/.Luajr/res/btn1.png" }, }, } return sw end function picswitch(id, pic, text, text2, func, color) if not color then color = xfc_cr_22 end local sw = { CardView, radius = '14', layout_height = "40dp", layout_width = -1, Elevation = '8', layout_margin = "5dp", id = id, CardBackgroundColor = xfc_cr_41, { RelativeLayout, gravity = "center", { ImageView, layout_alignParentLeft = "true", layout_marginLeft = "3dp", layout_alignParentTop = "true", layout_marginTop = "7dp", ColorFilter = rescolor, layout_width = "24dp", layout_height = "24dp", layout_centerVertical = true, onClick = function() functip(text, text2) end, src = pic }, { Switch, textColor = color, textSize = "13sp", onClick = function() pcall(func) end, onTouch = function(v, event) local event = event.getAction() if event == MotionEvent.ACTION_DOWN then pcall(load(id .. ".setAlpha(0.8)")) elseif event == MotionEvent.ACTION_UP or event == MotionEvent.ACTION_CANCEL then pcall(load(id .. ".setAlpha(1)")) end end, text = text, layout_alignParentTop = "true", layout_marginTop = "4dp", layout_height = "30dp", layout_centerVertical = true, layout_alignParentLeft = "true", layout_marginLeft = "34dp", layout_width = -1, gravity = "center|left", }, }, } return sw end function bottom_button(id, pic, text, func) local layout = { LinearLayout, layout_width = "50dp", layout_height = "30dp", layout_weight = 1, gravity = "center", orientation = "vertical", id = id, onClick = function() pcall(func) end, { ImageView, layout_width = "18dp", ColorFilter = rescolor, layout_height = "18dp", padding = "2dp", src = pic, }, { TextView, textColor = xfc_cr_22, textSize = "8sp", text = text, layout_height = "12dp", layout_width = -1, gravity = "center", }, } return layout end end loading() function shengcheng_xfc() xfc = { RelativeLayout, layout_height = "fill", layout_width = "fill", id = "touch1", { LinearLayout, layout_height = -1, id = "touch", layout_width = -1, background = miaobian(5, 20, xfc_cr_1, xfc_cr_21), orientation = "vertical", { HorizontalScrollView, layout_height = "60dp", layout_width = -1, horizontalScrollBarEnabled = false, { LinearLayout, --顶栏 layout_width = -1, layout_height = -1, gravity = "center", orientation = "horizontal", id = "func_dingl", { ImageView, --图标 layout_width = "45dp", layout_height = "45dp", id = "Lpic", onClick = function() gg.setProcessX() threadStart({ run = function() gg.sleep(2500) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() process_chooser() end })) end }) end, }, shu_text("50dp", "76dp", xfc_cr_22, "12sp", "10sp", "ShizuKU", "Beta 1.4"), { View, layout_height = -1, layout_marginLeft = "3dp", layout_width = "1dp", background = getShepeBackground(xfc_cr_22, 0), }, }, }, { View, layout_height = "1dp", layout_width = -1, background = getShepeBackground(xfc_cr_22, 0), }, { LinearLayout, --功能区 layout_width = -1, layout_height = -1, orientation = "horizontal", { ScrollView, id = "choice_scroll", layout_width = "110dp", layout_height = -1, VerticalScrollBarEnabled = false, { RelativeLayout, --菜单栏 layout_width = -1, layout_height = -1, id = "frelalay", { CardView, layout_width = "3dp", id = "an_line", layout_height = "40dp", layout_marginTop = "8dp", radius = '10', Elevation = '10', CardBackgroundColor = xfc_cr_3, layout_marginLeft = "4dp", }, }, }, { View, layout_height = -1, layout_width = "1dp", background = getShepeBackground(xfc_cr_22, 0), }, { ScrollView, layout_width = -1, layout_height = -1, VerticalScrollBarEnabled = false, { RelativeLayout, --功能栏 layout_width = -1, layout_height = -1, id = "scriptslist", { LinearLayout, --公告区 layout_width = -1, id = "gg_gg", Visibility = 8, layout_margin = "6dp", orientation = "vertical", layout_height = -1, { RelativeLayout, --海报栏 layout_width = -1, layout_height = "100dp", { PageView, layout_width = -1, id = "post_page", layout_height = -1, }, }, { RelativeLayout, --计时栏 layout_width = -1, layout_height = "30dp", { Chronometer, id = "pagetime", textSize = "12sp", gravity = "center|left", layout_width = "wrap", layout_alignParentBottom = "true", layout_alignParentLeft = "true", layout_marginLeft = "82dp", textColor = xfc_cr_3, layout_height = "30dp", }, { TextView, layout_width = "80dp", layout_height = "30dp", gravity = "center", textSize = "11sp", layout_alignParentBottom = "true", text = "已运行时长:", textColor = xfc_cr_3, }, }, { TextView, --公告区 layout_width = -1, layout_height = -1, id = "gg_gg_text", textSize = "15sp", textColor = xfc_cr_22, }, }, { LinearLayout, --主题区 layout_width = -1, layout_margin = "3dp", id = "gg_theme", layout_height = -1, background = miaobian(5, 20, "#00000000", xfc_cr_21), Visibility = 8, }, { LinearLayout, --日志区 layout_width = -1, layout_margin = "3dp", Visibility = 8, id = "gg_log", layout_height = -1, orientation = "vertical", }, { LinearLayout, --音乐区 layout_width = -1, layout_margin = "3dp", id = "gg_music", layout_height = -1, Visibility = 8, background = miaobian(5, 20, "#00000000", xfc_cr_21) }, { LinearLayout, --设置区 layout_width = -1, layout_margin = "3dp", Visibility = 8, id = "gg_set", layout_height = -1, }, }, }, }, }, { View, id = "td_line", layout_height = -1, layout_width = "18dp", layout_alignParentRight = "true", }, { ImageView, layout_alignParentLeft = "true", layout_marginLeft = "5dp", layout_alignParentBottom = "true", layout_marginBottom = "5dp", ColorFilter = rescolor, layout_width = "20dp", layout_height = "20dp", onTouch = function(v, event) local Action = event.getAction() if Action == MotionEvent.ACTION_DOWN then xfc.setAlpha(0) elseif Action == MotionEvent.ACTION_UP or event == MotionEvent.ACTION_CANCEL then xfc.setAlpha(1) end return true end, src = "/sdcard/.Luajr/res/ship.png" }, { CardView, --功能提示 radius = '20', Elevation = '20dp', Visibility = 8, layout_width = "150dp", layout_height = "100dp", layout_margin = "2dp", id = "tiplay", CardBackgroundColor = xfc_cr_1, { RelativeLayout, layout_width = -1, layout_margin = "3dp", layout_height = -1, { TextView, layout_width = -1, layout_height = "38dp", gravity = "center", id = "tiplay1", text = "Shizuku", textSize = "14sp", textColor = xfc_cr_3 }, { TextView, layout_width = -1, layout_height = "56dp", id = "tiplay2", gravity = "center", text = "喵喵喵喵喵喵喵喵喵喵", textSize = "13sp", layout_alignParentTop = "true", layout_marginTop = "38dp", textColor = xfc_cr_22 }, { ImageView, layout_alignParentRight = "true", ColorFilter = rescolor, layout_width = "24dp", layout_height = "24dp", onClick = function() tiplay.setVisibility(View.GONE) tipshow = false end, src = "/sdcard/.Luajr/res/mexit.png" }, }, }, } return xfc end function LoadUI() local LayoutParams = WindowManager.LayoutParams loadfile("/sdcard/.Luajr/config/settings.lua")() qd_sw = lua_sets["qidong"] if qd_sw == true then loadfile("/sdcard/.Luajr/scripts/qidong.dex")() end function loadui() loadfile("/sdcard/.Luajr/scripts/xfq_fq" .. xfq_fq .. ".lua")() --加载悬浮球样式 xfq = loadlayout(xfq) --加载悬浮球 activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() XFQparams = getLayoutParams() window.addView(xfq, XFQparams) xfq.setVisibility(View.GONE) end })) xfc = loadlayout(shengcheng_xfc()) --加载悬浮窗 local mainLooper = Looper.getMainLooper() --线程 local handler = Handler(mainLooper) handler.post(function() XFCparams = getLayoutParams() XFCparams.x = -ooo1 / 2 XFCparams.width = ooo1 * 2 / 5 XFCparams.height = ooo2 window.addView(xfc, XFCparams) xfc.setVisibility(View.GONE) current_page = gg_gg --初始化加载布局 -- 顶栏按钮 菜单按钮 控制摇杆 控制键盘 提示样式 键盘 设置界面 主题界面 音乐 vip区 threadStart({ run = function() local btnlay = loadlayout({ LinearLayout, --顶栏功能按钮去 layout_width = -1, layout_height = -1, layout_margin = "3dp", gravity = "center", orientation = "horizontal", shu_button("shu_se", "/sdcard/.Luajr/res/search.png", "测试", function() gg.toast("功能名称", "开启成功喵喵", 0xFF00FF00) nummm = nummm + 1 addlog(0xFFFFFFFF, 0xFF0000FF, "猫羽雫", "喵喵喵") end), shu_button("shu_log", "/sdcard/.Luajr/res/log.png", "日志", function() c_page(nil, gg_log) end), shu_button("shu_theme", "/sdcard/.Luajr/res/color.png", "主题", function() if XFCparams.width < dp2px(540) then XFCparams.width = dp2px(540) window.updateViewLayout(xfc, XFCparams) end c_page(nil, gg_theme) end), }) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() func_dingl.addView(btnlay) end })) local btnlay = loadlayout({ LinearLayout, --菜单栏 layout_width = -1, layout_height = -1, orientation = "vertical", choice_btn("/sdcard/.Luajr/res/notice.png", "使用公告", "btn_gg", function() c_page(btn_gg, gg_gg) end), choice_btn("/sdcard/.Luajr/res/music.png", "音乐专区", "btn_music", function() c_page(btn_music, gg_music) if XFCparams.width < dp2px(485) then XFCparams.width = dp2px(485) window.updateViewLayout(xfc, XFCparams) end end), choice_btn("/sdcard/.Luajr/res/setting.png", "脚本设置", "btn_set", function() c_page(btn_set, gg_set) end), }) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() frelalay.addView(btnlay) current_btn = btn_gg bottom_btns = { btn_gg, btn_set, btn_music } for i = 1, #bottom_btns do bottom_btns[i].getChildAt(0).getChildAt(1).getPaint().setFakeBoldText(true) bottom_btns[i].setAlpha(0.65) end bottom_btns[1].setAlpha(1) end })) --加载提示 loadfile("/sdcard/.Luajr/scripts/tipstyle" .. tipstyle .. ".lua")() --加载提示样式 activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() if day_switch then gg.toast("昼夜适应警告", "昼夜适应已开启,检测当前为" .. mmmmm1 .. ",已设置主题为" .. mmmmm2, 0xFFFFFF00) end end })) --加载键 function addkeys(text, wid, func, id) if not wid then wid = "26dp" end if not func then func = function() clicktext(text) end end local keys = { CardView, radius = '14', layout_margin = "4dp", layout_height = "32dp", onClick = function() pcall(func) end, layout_width = wid, Elevation = '7', CardBackgroundColor = xfc_cr_1, { TextView, textSize = "15sp", text = text, layout_width = -1, layout_height = -1, gravity = "center", textColor = xfc_cr_22, }, } if id then keys["id"] = id end return keys end keyboardlay = loadlayout({ CardView, radius = '14', Elevation = '5', CardBackgroundColor = xfc_cr_1, { RelativeLayout, layout_width = "350dp", gravity = "center", { LinearLayout, layout_margin = "5dp", layout_width = "340dp", gravity = "center", orientation = "vertical", { EditText, textSize = "12sp", layout_height = "30dp", id = "keyedit", Hint = "请输入内容", layout_width = -1, Visibility = 8, padding = 0, textColor = xfc_cr_22, background = miaobian(1, 2, xfc_cr_1, xfc_cr_21) }, { LinearLayout, layout_height = "40dp", layout_width = -1, addkeys("1"), addkeys("2"), addkeys("3"), addkeys("4"), addkeys("5"), addkeys("6"), addkeys("7"), addkeys("8"), addkeys("9"), addkeys("0"), }, { LinearLayout, layout_height = "40dp", layout_marginLeft = "5dp", layout_marginRight = "5dp", layout_width = -1, addkeys("粘贴", "55dp", function() barid.setText(barid.getText().toString() .. gg.getClipboard()) barid.setSelection(barid.getText().length()) end), addkeys("A"), addkeys("B"), addkeys("C"), addkeys("D"), addkeys("E"), addkeys("F"), addkeys("删除", "55dp", function() barid.setText(string.sub(barid.getText().toString(), 1, -2)) barid.setSelection(barid.getText().length()) end), }, { LinearLayout, layout_height = "40dp", layout_width = -1, addkeys("键盘输入", "90dp", function() if keyes == false then keyedit.setVisibility(View.VISIBLE) keyeditbtn.getChildAt(0).setTextColor(xfc_cr_3) JPparams.flags = 1056 window.updateViewLayout(keyboardlay, JPparams) keyes = true elseif keyes == true then keyedit.setVisibility(View.GONE) keyeditbtn.getChildAt(0).setTextColor(xfc_cr_22) JPparams.flags = 131080 window.updateViewLayout(keyboardlay, JPparams) keyes = false end end, "keyeditbtn"), addkeys(" ", "137dp", function() end, "keybtn"), addkeys("确定", "90dp", function() window.removeView(keyboardlay) end), }, }, }, }) function clicktext(v) barid.setText(barid.getText().toString() .. v) barid.setSelection(barid.getText().length()) end function printedit(id) if sw_key == true then window.addView(keyboardlay, JPparams) barid = id elseif sw_key == false then XFCparams.flags = 1056 window.updateViewLayout(xfc, XFCparams) end end function keybtn.onTouch(v, event) local Action = event.getAction() if Action == MotionEvent.ACTION_DOWN then RawX = event.getRawX() RawY = event.getRawY() x = JPparams.x y = JPparams.y elseif Action == MotionEvent.ACTION_MOVE then JPparams.x = tonumber(x) + (event.getRawX() - RawX) JPparams.y = tonumber(y) + (event.getRawY() - RawY) window.updateViewLayout(keyboardlay, JPparams) end end keyedit.addTextChangedListener({ onTextChanged = function(v, start, before, count) barid.setText(keyedit.getText().toString()) barid.setSelection(barid.getText().length()) end }) JPparams = getLayoutParams() keyes = false --加设置界面 setlay = loadlayout({ LinearLayout, layout_width = -1, layout_height = -1, orientation = "vertical", picbtn("s_exit", "/sdcard/.Luajr/res/exit.png", "关闭脚本", "退出脚本", function() gg.playMusic("stop") luajava.exit() end), diline("脚本内设"), picswitch("GG_hide_s", "/sdcard/.Luajr/res/yinc.png", "隐藏修改器", "隐藏修改器的图标\n只保留脚本UI的图标", function() local idt = GG_hide_s.getChildAt(0).getChildAt(1) if idt.isChecked() == true then gg.hide(true) elseif idt.isChecked() == false then gg.hide(false) end end), picswitch("GG_sw_key", "/sdcard/.Luajr/res/key.png", "内置键盘", "脚本自带的输入键盘\n无需调用系统输入法更方便", function() local idt = GG_sw_key.getChildAt(0).getChildAt(1) if idt.isChecked() == true then sw_key = true lua_sets["key"] = true io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) elseif idt.isChecked() == false then sw_key = false lua_sets["key"] = false io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end end), picswitch("GG_vt", "/sdcard/.Luajr/res/vtls.png", "纵向拉伸", "悬浮窗右侧拉伸区也可以调整UI高度", function() local idt = GG_vt.getChildAt(0).getChildAt(1) if idt.isChecked() == true then lua_sets["vt"] = true io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) loadfile("/sdcard/.Luajr/scripts/ls.lua")() elseif idt.isChecked() == false then lua_sets["vt"] = false io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) loadfile("/sdcard/.Luajr/scripts/ls.lua")() end end), picswitch("GG_qd", "/sdcard/.Luajr/res/qdtc.png", "启动窗口", "脚本启动时弹出一个动画窗口\n美观的同时后台加载UI", function() local idt = GG_qd.getChildAt(0).getChildAt(1) if idt.isChecked() == true then lua_sets["qidong"] = true io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) elseif idt.isChecked() == false then lua_sets["qidong"] = false io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end end), diline("拓展功能"), picswitch("GG_music_sii", "/sdcard/.Luajr/res/yinfu.png", "音乐播放器", "脚本菜单添加音乐区\n边玩游戏边听歌~", function() local idt = GG_music_sii.getChildAt(0).getChildAt(1) if idt.isChecked() == true then threadStart({ run = function() activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() touch.startAnimation(ScaleAnimation(1, 0, 1, 1, 1, 0, 1, 1).setDuration(350)) end })) gg.sleep(380) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() loadfile( "/sdcard/.Luajr/scripts/MusicScript[V1.0].dex")() btn_music.setVisibility(View.VISIBLE) xfc.setVisibility(View.VISIBLE) touch.startAnimation(ScaleAnimation(0, 1, 1, 1, 1, 0, 1, 1) .setDuration(350)) gg.toast("音乐已加载", "下次打开将自动加载", 0xFFFF0000) end })) end }) lua_sets["music"] = "true" io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) elseif idt.isChecked() == false then lua_sets["music"] = "#false" io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) gg.toast("音乐已关闭", "下次打开将不会加载", 0xFFFF0000) end end), picbtn("delete_data", "/sdcard/.Luajr/res/empty.png", "清空配置数据", "删除脚本所有本地配置文件", function() threadStart({ run = function() local alr = gg.alert("确定清空脚本配置数据吗\n清除后不可恢复", "确定", "取消") if alr == 1 then gg.command("rm -rf /sdcard/.Luajr/") gg.playMusic("stop") luajava.exit() end end }) end, 0xFFFF0000), { LinearLayout, --图标栏 layout_height = "52dp", gravity = "center", layout_width = -1, imgbtn("/sdcard/.Luajr/res/bilibili.png", function() app.openUrl("https://space.bilibili.com/1710190893") end), imgbtn("/sdcard/.Luajr/res/QQpiv.png", function() qq.join("2843833170") end), imgbtn("/sdcard/.Luajr/res/qun.png", function() qq.joinGroup("544812163") end), }, }) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() gg_set.addView(setlay) picswitch_color(GG_hide_s) picswitch_color(GG_music_sii) picswitch_color(GG_qd) picswitch_color(GG_sw_key) picswitch_color(GG_vt) if lua_sets["music"] == "true" then GG_music_sii.getChildAt(0).getChildAt(1).setChecked(true) end if lua_sets["qidong"] == true then GG_qd.getChildAt(0).getChildAt(1).setChecked(true) end if lua_sets["key"] == true then GG_sw_key.getChildAt(0).getChildAt(1).setChecked(true) end if lua_sets["vt"] == true then GG_vt.getChildAt(0).getChildAt(1).setChecked(true) end end })) --加主题 local function addedit(text, id, hint, id1) local editlay = { LinearLayout, layout_width = -1, layout_height = "50dp", gravity = "center", layout_margin = "2dp", orientation = "vertical", { TextView, layout_width = -1, layout_height = "23dp", textSize = "12sp", text = text, padding = "3dp", textColor = xfc_cr_22, gravity = "center|top", }, { EditText, Hint = hint, layout_width = -1, id = id, padding = 0, onClick = function() printedit(usizlay.getChildAt(id1).getChildAt(1)) end, textSize = "12sp", layout_height = "27dp", textColor = xfc_cr_22, background = miaobian(1, 2, xfc_cr_1, xfc_cr_21), }, } return editlay end local tlay = loadlayout({ LinearLayout, layout_width = -1, layout_height = "280dp", { ScrollView, paddingTop = "5dp", paddingBottom = "5dp", layout_width = "160dp", layout_height = -1, VerticalScrollBarEnabled = true, { LinearLayout, layout_height = -1, layout_width = -1, orientation = "vertical", picbtn("theme_to", "/sdcard/.Luajr/res/text.png", "使用说明", "主题功能的相关功能说明", function() local th_text = [[ 主题-定制UI外观,动画 此界面可滑动! 提示时长下方还有功能! 使用预设主题 直接点击最右边的主题即可 自定义主题颜色 中间的拉条和输入框是用于自定义UI的配色的地方 通过拉条调色出自己喜欢的颜色 然后点击颜色代码复制并粘贴到右边对应的输入框 输入框内应填8位ARGB颜色码,如(FAEEDDCC) 将4个输入框全部填完后点击应用即可 主题配置存放目录 /sdcard/.Luajr/config/theme.lua ]] textdlg("主题功能使用说明书", th_text) end), picswitch("GG_rescolor", "/sdcard/.Luajr/res/ssicon.png", "深色图标", "将按钮上的图标着色为深色", function() local idt = GG_rescolor.getChildAt(0).getChildAt(1) if idt.isChecked() == true then lua_sets["rescolor"] = "#FF303030" io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) request1() elseif idt.isChecked() == false then lua_sets["rescolor"] = "#FFDADFE3" io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) request1() end end), picswitch("GG_day", "/sdcard/.Luajr/res/moon.png", "昼夜适应", "根据系统时间自动切换UI主题\n白天浅色 黑夜深色", function() local idt = GG_day.getChildAt(0).getChildAt(1) if idt.isChecked() == true then lua_sets["day"] = true io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) request1() elseif idt.isChecked() == false then lua_sets["day"] = false io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) request1() end end), picbtn("kdkskwk", "/sdcard/.Luajr/res/hydh.png", "换页动画", "修改切换页面时的动画", function() local tablebb = { "换页动画切换", { { "左上-右上", "/sdcard/.Luajr/res/hyani1.mp4" }, { "左上-右下", "/sdcard/.Luajr/res/hyani2.mp4" }, { "上-下", "/sdcard/.Luajr/res/hyani3.mp4" }, { "左-右", "/sdcard/.Luajr/res/hyani4.mp4" }, { "渐隐-渐显", "/sdcard/.Luajr/res/hyani5.mp4" }, { "无动画", "/sdcard/.Luajr/res/hyani6.mp4" }, }, function() if chs_target then lua_sets["pageani"] = chs_target pageani = chs_target io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) loadfile("/sdcard/.Luajr/scripts/pageani" .. pageani .. ".lua")() end end } choosedlg(tablebb, pageani) end), picbtn("oxoos", "/sdcard/.Luajr/res/swtype.png", "开关样式", "修改开关按钮的开关样式", function() local tablebb = { "开关样式切换", { { "包裹", "/sdcard/.Luajr/res/sw1.mp4" }, { "原生", "/sdcard/.Luajr/res/sw2.mp4" }, { "矩形", "/sdcard/.Luajr/res/sw3.mp4" }, }, function() if chs_target then lua_sets["switch"] = chs_target swtype = chs_target io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) request1() end end } choosedlg(tablebb, tipstyle) end), picbtn("kdkskewk", "/sdcard/.Luajr/res/fq.png", "浮球样式", "修改悬浮球的图标样式", function() local tablebb = { "悬浮球样式切换", { { "矩形", "/sdcard/.Luajr/res/xfq1.mp4" }, { "图标", "/sdcard/.Luajr/res/xfq2.mp4" }, }, function() if chs_target then lua_sets["fq"] = chs_target xfq_fq = chs_target window.removeView(xfq) io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) loadfile("/sdcard/.Luajr/scripts/xfq_fq" .. xfq_fq .. ".lua")() xfq = loadlayout(xfq) window.addView(xfq, XFQparams) xfq.setVisibility(View.GONE) process_chooser() xfq_addfunc() end end } choosedlg(tablebb, xfq_fq) end), picbtn("idiskw", "/sdcard/.Luajr/res/toast.png", "提示样式", "修改功能提示时的弹窗样式", function() local tablebb = { "提示样式切换", { { "顶部弹窗(单)", "/sdcard/.Luajr/res/tip1.mp4" }, { "右上角弹窗(单)", "/sdcard/.Luajr/res/tip2.mp4" }, { "侧弹滑条(多)", "/sdcard/.Luajr/res/tip3.mp4" }, }, function() if chs_target then lua_sets["tip"] = chs_target tipstyle = chs_target io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) loadfile("/sdcard/.Luajr/scripts/tipstyle" .. tipstyle .. ".lua")() end end } choosedlg(tablebb, tipstyle) end), picbtn("s_time", "/sdcard/.Luajr/res/time.png", "提示时长", "修改功能提示时的持续时长", function() threadStart({ run = function() local pro = gg.prompt({ "请输入提示持续时长(毫秒)\n建议在1200~2500之间" }, { nil }, { "number" }) toastt = pro[1] lua_sets["toastt"] = toastt io.open("/sdcard/.Luajr/config/settings.lua", "w"):write( "lua_sets=" .. tostring(lua_sets)) end }) end), { CardView, radius = '14', layout_height = "35dp", layout_width = -1, Elevation = '8', layout_margin = "5dp", CardBackgroundColor = xfc_cr_41, { RelativeLayout, gravity = "center", { ImageView, layout_alignParentLeft = "true", layout_marginLeft = "3dp", layout_alignParentTop = "true", layout_marginTop = "5dp", ColorFilter = rescolor1, layout_width = "24dp", layout_height = "24dp", src = "/sdcard/.Luajr/res/alpha.png" }, { SeekBar, id = "seek_alpha", layout_alignParentTop = "true", layout_marginTop = "5dp", layout_width = -1, layout_centerVertical = true, layout_height = "24dp", layout_marginLeft = "30dp", layout_marginRight = "3dp", background = ColorDrawable(0x00000000), min = 1, max = 100, padding = "5dp", }, }, }, }, }, { View, layout_height = -1, layout_width = "1dp", background = getShepeBackground(xfc_cr_22, 0), }, { LinearLayout, layout_width = "120dp", layout_height = -1, gravity = "center", id = "t_s_l", orientation = "vertical", layout_margin = "2dp", { View, id = "colorCard", background = getShepeBackground(xfc_cr_22, 30), layout_width = "85dp", layout_height = "85dp" }, { TextView, layout_width = -1, layout_height = "25dp", textSize = "14sp", id = "colorText", text = "Shizuku", onClick = function() gg.copyText(colorText.getText()) end, textColor = xfc_cr_3, gravity = "center", }, { TextView, layout_width = -1, layout_height = "20dp", textSize = "9sp", text = "点我复制颜色代码", onClick = function() gg.copyText(colorText.getText()) end, textColor = xfc_cr_3, gravity = "center", }, }, { LinearLayout, layout_width = "110dp", layout_height = -1, id = "usizlay", orientation = "vertical", addedit("背景色", "t_e_1", "背景色颜色", 0), addedit("边框色", "t_e_2", "边框色颜色", 1), addedit("高亮色", "t_e_3", "高亮色颜色", 2), addedit("暗淡色", "t_e_4", "暗淡色颜色", 3), cotbtn("应用", function() if utf8.len(tostring(t_e_1.getText())) ~= 0 and utf8.len(tostring(t_e_2.getText())) ~= 0 and utf8.len(tostring(t_e_3.getText())) ~= 0 and utf8.len(tostring(t_e_4.getText())) ~= 0 then threadStart({ run = function() activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() XFCparams.flags = 131080 window.updateViewLayout(xfc, XFCparams) xfc_cr_1 = "#" .. tostring(t_e_1.getText()) xfc_cr_21 = "#" .. tostring(t_e_2.getText()) xfc_cr_22 = "0x" .. tostring(t_e_2.getText()) xfc_cr_3 = "0x" .. tostring(t_e_3.getText()) xfc_cr_41 = "#" .. tostring(t_e_4.getText()) xfc_cr_42 = "0x" .. tostring(t_e_4.getText()) themes_chice = { xfc_cr_1, xfc_cr_21, xfc_cr_22, xfc_cr_3, xfc_cr_41, xfc_cr_42 } io.open("/sdcard/.Luajr/config/theme.lua", "w") :write("themes_chice=" .. tostring(themes_chice)) end })) request1() end }) else gg.toast("错误", "未填完内容", 0xFFFF0000) end end), }, { View, layout_height = -1, layout_width = "1dp", background = getShepeBackground(xfc_cr_22, 0), }, { ListView, layout_width = -1, layout_height = -1, id = "rp_lay", }, }) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() gg_theme.addView(tlay) if lua_sets["rescolor"] == "#FF303030" then GG_rescolor.getChildAt(0).getChildAt(1) .setChecked(true) end if lua_sets["day"] == true then GG_day.getChildAt(0).getChildAt(1).setChecked(true) end picswitch_color(GG_rescolor) picswitch_color(GG_day) seekcolor(seek_alpha, xfc_cr_42, xfc_cr_3, 20, 15, 15) seek_alpha.setProgress(100) seek_alpha.setOnSeekBarChangeListener { onProgressChanged = function(view, i) xfc_Alpha = tonumber(seek_alpha.getProgress()) * 1.000001 / 100.00001 xfc.setAlpha(xfc_Alpha) end } for o = 1, 4 do local seek = loadlayout({ SeekBar, id = "color" .. o .. "1", padding = "6dp", background = ColorDrawable(0x00000000), layout_width = -1, layout_height = "wrap", }) seek.setMax(255) seek.setMin(1) seekcolor(seek, xfc_cr_42, xfc_cr_3, 20, 15, 15) seek.setProgress(255) seek.setOnSeekBarChangeListener { onProgressChanged = function(view, i) updateArgb() end } t_s_l.addView(seek) end function updateArgb() local a = color11.getProgress() local r = color21.getProgress() local g = color31.getProgress() local b = color41.getProgress() local argb_hex = (a << 24|r << 16|g << 8|b) colorText.Text = string.format("%#x", argb_hex) colorCard.setBackground(getShepeBackground(argb_hex, 30)) end themes_list = { { "暗紫色", "暗色主题", { "#FF4A4458", "#FFD8CEE8", 0xFFD8CEE8, 0xFFD0BCFF, "#FF5A5468", 0xFF5A5468 } }, { "亮白色", "亮色主题", { "#FFF9F9F9", "#FF274B7C", 0xFF274B7C, 0xFF0084FF, "#FFFFFFFF", 0xFFFFFFFF } }, { "淡绿色", "亮色主题", { "#FFFAFAFA", "#FF4E5864", 0xFF4E5864, 0xFF008577, "#FFE5F3F1", 0xFFE5F3F1 } } } --整体背景色,边框外亮色,滑条色,局部暗色 local theme_adp = ArrayListAdapter(activity) rp_lay.setAdapter(theme_adp) local ooospan = SpannableString("预设主题") ooospan.setSpan(ForegroundColorSpan(xfc_cr_3), 0, utf8.len("预设主题"), 33); theme_adp.add(ooospan) for i = 1, #themes_list do local str = themes_list[i][1] .. "\n" .. themes_list[i][2] local spant = SpannableString(str) spant.setSpan(RelativeSizeSpan(0.85), 0, utf8.len(themes_list[i][1]), 33) spant.setSpan(ForegroundColorSpan(themes_list[i][3][4]), 0, utf8.len(str), 33); spant.setSpan(RelativeSizeSpan(0.76), utf8.len(themes_list[i][1]), utf8.len(str), 33) theme_adp.add(spant) end rp_lay.onItemClick = function(l, v, p, s) threadStart({ run = function() themes_chice = themes_list[p][3] io.open("/sdcard/.Luajr/config/theme.lua", "w"):write( "themes_chice=" .. tostring(themes_chice)) loadfile("/sdcard/.Luajr/config/theme.lua")() xfc_cr_1 = themes_chice[1] xfc_cr_21 = themes_chice[2] xfc_cr_22 = themes_chice[3] xfc_cr_3 = themes_chice[4] xfc_cr_41 = themes_chice[5] xfc_cr_42 = themes_chice[6] request1() end }) end end })) --加载音乐 if isplaymusic == "true" then loadfile("/sdcard/.Luajr/scripts/MusicScript[V1.1].lua")() else activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() btn_music.setVisibility(View.GONE) end })) end end }) --选择进程 process_chooser() --加载海报 pagetime.setBase(SystemClock.elapsedRealtime()) pagetime.start() pageadp = ArrayPageAdapter() post_page.setAdapter(pageadp) post_list = { "post1", "post2", "post3", "post4", "post5" } for i = 1, #post_list do local pic = loadlayout({ ImageView, layout_width = -1, layout_height = "100dp", adjustViewBounds = "true", padding = "3dp", scaleType = "centerInside", ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/" .. post_list[i] .. ".png"), }) pageadp.add(pic) end pagenum = 0 pagetime.setOnChronometerTickListener { onChronometerTick = function() local numm = tonumber(string.replace((SystemClock.elapsedRealtime() - pagetime.getBase()) // 1000, ".0", "")) if numm % 4 == 0 then if pagenum <= #post_list then pagenum = pagenum + 1 else pagenum = 0 end post_page.showPage(pagenum) end end } --初始化隐藏 gg_gg.setVisibility(View.VISIBLE) notice_gg = [[ Beta 1.4 不会还有呆猫不知道拖动最后边可以调节悬浮窗大小吧 1.4更新 主题界面重置 美化弹窗界面 新增切换换页动画 新增切换提示样式 联系区块修改 1.3更新 添加音乐播放器功能 音乐开关在脚本设置里面 1.2更新 美化了下UI(设置区) 加了弹窗功能提示,点顶上搜索按钮就看得见了 去除了底盘,退出脚本在设置区 添加启动界面和动画 启用线程方案,极大加快UI启动速度 1.1更新 摇杆支持控制单位 模块添加版本号 新增模拟键盘功能 此版本为测试版 是1.16版本脚本的体验 用于反馈bug与内测部分功能 务必向作者反馈遇到的UI问题 摇杆目前只支持控制一个建筑,控制多个以及控制单位还没做 另外脚本是自动云更新,说不定下次你一打开就更新了😺 点击左上角图标可以换进程 左下角按钮可以退出脚本 也可以点击GG修改器图标,然后点击屏幕上一个矩形灰色方块强制退出脚本 ]] local text = SpannableString.new(notice_gg) gg_gg_text.setText(text) --悬浮球加拖动 xfq_addfunc() --加拉伸 loadfile("/sdcard/.Luajr/scripts/ls.lua")() function func_dingl.onClick(v) --悬浮窗点击事件 XFCparams.flags = 131080 window.updateViewLayout(xfc, XFCparams) touch.startAnimation(ScaleAnimation(1, 0, 1, 1, 1, 0, 1, 1).setDuration(400)) threadStart({ run = function() gg.sleep(200) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() suspended_ball.startAnimation(ScaleAnimation(0, 1, 0, 1, 1, 0.5, 1, 0.5).setDuration(200)) xfq.setVisibility(View.VISIBLE) end })) gg.sleep(200) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() xfc.setVisibility(View.GONE) end })) end }) end if qd_sw == false and not diidizisj then xfq.setVisibility(View.VISIBLE) end suspended_ball.startAnimation(ScaleAnimation(0, 1, 0, 1, 1, 0.5, 1, 0.5).setDuration(600)) function request1() --刷新 threadStart({ run = function() activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() touch.startAnimation(ScaleAnimation(1, 0, 1, 1, 1, 0, 1, 1).setDuration(350)) end })) gg.sleep(380) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() window.removeView(xfc) window.removeView(xfq) loading() threadStart({ run = function() diidizisj = true loadui() activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() xfc.setVisibility(View.VISIBLE) touch.startAnimation(ScaleAnimation(0, 1, 1, 1, 1, 0, 1, 1) .setDuration(350)) end })) end }) end })) end }) end end) end threadStart({ run = function() loadui() end }) activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); end Lock.Ui(LoadUI, nil, function(err) print(err) luajava.exit() end)