local function download_resource() local loadingBox = getLoadingBox("开始下载资源文件...") loadingBox["显示"]() file.download( "https://www.xiaoman.top/assets/users/shizuku/NyaOS.zip", "/sdcard/NyaOS.zip" ) gg.sleep(1000) file.zip("/sdcard/NyaOS.zip", "/sdcard", "password", "unzip") loadingBox["关闭"]() end if io.open("/sdcard/.Luajr/scripts/Tools.lua") == nil then download_resource() end import "android.app.*" import "android.os.*" import "android.widget.*" import "android.view.*" import "android.graphics.drawable.*" import "android.animation.ObjectAnimator" import "android.view.animation.*" import "android.graphics.*" import "android.text.style.*" import "android.text.SpannableString" import "android.text.Spanned" import "java.io.File" import "android.graphics.Color" import "android.content.res.ColorStateList" context = activity window = context.getSystemService("window") loadfile("/sdcard/.Luajr/scripts/Tools.lua")() xfc_Alpha = 1 loadfile("/sdcard/.Luajr/config/theme.lua")() xfc_cr_1 = themes_chice[1] xfc_cr_12 = hexToInt(themes_chice[1]) xfc_cr_2 = themes_chice[2] xfc_cr_22 = hexToInt(themes_chice[2]) xfc_cr_3 = themes_chice[3] xfc_cr_32 = hexToInt(themes_chice[3]) xfc_cr_4 = themes_chice[4] xfc_cr_42 = hexToInt(themes_chice[4]) xfc_cr_5 = themes_chice[5] xfc_cr_52 = hexToInt(themes_chice[5]) loadfile("/sdcard/.Luajr/config/settings.lua")() lua_sets["GGhide"] = true gg.hide(true) loadfile("/sdcard/.Luajr/scripts/switch" .. lua_sets["switch"] .. ".lua")() if themes_chice[6] == "auto" then zm_pic = Drawable.createFromPath("/sdcard/.Luajr/theme/" .. lua_sets["co"] .. "/wallpaper.png") else zm_pic = Drawable.createFromPath(themes_chice[6]) end menuaaa = {} post_page = 1 canisland = true canls = true canisland = true sisland = "spage" subwindowtb = {} function openlayout(layout, id1, name, extrafunc) local localparams1 = xfclay_ke.getLayoutParams() wmX = localparams1.width wmY = localparams1.height layout.setVisibility(View.VISIBLE) current_layout = layout current_btn = id1 local wmx = id1.getX() + id1.getWidth() * 0.5 local wmy = id1.getY() + id1.getHeight() * 0.5 local xbeilv = tonumber(string.format("%.2f", wmx)) / wmX local ybeilv = tonumber(string.format("%.2f", wmy)) / wmY scaleAni(layout, 0.05, 1, 0.05, 1, 1, xbeilv, 1, ybeilv, 800, extrafunc or function() xfclay_table.setVisibility(View.GONE) end) if sisland == "spage" then pageshow_ball.setCardBackgroundColor(0xFF00FF00) pageshow_text.setText(name) end end function shengcheng_xfc() local xfc = { CardView, layout_height = "wrap", layout_width = "wrap", radius = '30', id = "touch", Elevation = '12dp', CardBackgroundColor = xfc_cr_1, { RelativeLayout, --外壳 layout_height = "324dp", layout_width = "240dp", id = "xfclay_ke", background = zm_pic or getShepeBackground(xfc_cr_12, 0), { CardView, layout_width = -1, layout_marginTop = "18dp", layout_height = -1, radius = '30', Elevation = '0', CardBackgroundColor = 0x00000000, { AbsoluteLayout, --功能区 layout_width = -1, layout_height = -1, id = "xfc_f", { AbsoluteLayout, --桌面 layout_width = -1, layout_height = -1, id = "xfclay_table", }, }, }, --边缘拉伸 { CardView, layout_width = "10dp", layout_height = -1, Elevation = '0', CardBackgroundColor = 0x00000000, { LinearLayout, orientation = "vertical", layout_width = -1, layout_height = -1, { View, layout_width = -1, layout_height = -1, id = "xfclay_td1", layout_weight = 1 }, { View, layout_width = -1, layout_height = -1, id = "xfclay_ls1", layout_weight = 1 }, }, }, { CardView, layout_width = "10dp", layout_height = -1, layout_alignParentRight = "true", Elevation = '0', CardBackgroundColor = 0x00000000, { LinearLayout, orientation = "vertical", layout_width = -1, layout_height = -1, { View, layout_width = -1, layout_height = -1, id = "xfclay_td2", layout_weight = 1 }, { View, layout_width = -1, layout_height = -1, id = "xfclay_ls2", layout_weight = 1 }, }, }, { CardView, layout_width = -1, layout_height = "10dp", layout_alignParentBottom = "true", Elevation = '0', CardBackgroundColor = 0x00000000, { LinearLayout, layout_width = -1, layout_height = -1, { View, layout_width = -1, layout_height = -1, id = "xfclay_ls11", layout_weight = 1 }, { View, layout_width = -1, layout_height = -1, id = "xfclay_ls22", layout_weight = 1 }, }, }, { CardView, --底部 layout_height = "12dp", layout_width = "102dp", CardBackgroundColor = "#00000000", Elevation = '0dp', id = "xfc_bar", layout_centerHorizontal = true, alpha = 0.5, layout_alignParentBottom = "true", { CardView, layout_height = "5dp", layout_width = "78dp", CardBackgroundColor = xfc_cr_32, Elevation = '5dp', radius = '29', id = "xfclay_daohang", layout_marginTop = "2dp", layout_marginLeft = "12dp" }, }, { CardView, --灵动岛 layout_height = "24dp", layout_width = "108dp", CardBackgroundColor = "#FF000000", Elevation = '3dp', radius = '30', visibility = 4, layout_centerHorizontal = true, layout_margin = "6dp", id = "xfc_island" }, { CardView, --小窗栏 layout_height = -1, layout_width = 0, CardBackgroundColor = xfc_cr_1, Elevation = '3dp', radius = '30', id = "xfc_sublay", { ScrollView, layout_width = -1, layout_height = -1, VerticalScrollBarEnabled = false, { LinearLayout, layout_width = -1, orientation = "vertical", id = "xfclay_subm", layout_height = -1, { TextView, layout_width = -1, layout_height = "36dp", textSize = "13sp", singleLine = true, textColor = xfc_cr_32, text = "小窗菜单", gravity = "center", -- 点击切换小窗菜单展开/收起 onClick = function() local subParams = xfc_sublay.getLayoutParams() if subParams.width == 0 then subParams.width = dp2px(120) xfc_sublay.setLayoutParams(subParams) xfc_sublay.setAlpha(1) else subParams.width = 0 xfc_sublay.setLayoutParams(subParams) xfc_sublay.setAlpha(1) end end }, }, }, }, { LinearLayout, --状态栏 layout_width = -1, id = "xfclay_ztlan", layout_height = "18dp", { TextView, layout_width = -1, layout_height = -1, layout_weight = 1, textSize = "12sp", singleLine = true, textColor = xfc_cr_22, text = " Shizuku", gravity = "center|left", id = "xfclay_tittle", }, { TextView, layout_width = -1, layout_height = -1, textSize = "12sp", textColor = xfc_cr_22, singleLine = true, text = "NyaOS ", gravity = "center|right", layout_weight = 1, id = "xfclay_set", }, }, { CardView, layout_height = 0, layout_width = -1, CardBackgroundColor = xfc_cr_12, Elevation = '240dp', radius = '61', id = "xfclay_notice", { RelativeLayout, layout_width = -1, layout_height = -1, { TextClock, textSize = "24sp", layout_width = -1, layout_height = "36dp", layout_marginRight = "120dp", format12Hour = "HH:mm", id = "textclock", layout_marginTop = "12dp", textColor = xfc_cr_32, format24Hour = "HH:mm", gravity = "center" }, { TextView, layout_width = "120dp", textSize = "12sp", layout_height = "36dp", layout_marginTop = "12dp", textColor = xfc_cr_32, id = "dateclock", gravity = "center", text = datechange(), layout_alignParentRight = "true", }, { CardView, layout_width = "26dp", layout_height = "26dp", layout_marginRight = "12dp", layout_marginBottom = "7dp", id = "notice_btn1", layout_alignParentRight = "true", layout_alignParentBottom = "true", CardBackgroundColor = xfc_cr_4, Elevation = '3dp', radius = '29', onClick = function() threadStart({ run = function() local alert1 = gg.alert("确认清除全部通知?", "确认", "取消") if alert1 == 1 then activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() gg_log.removeAllViews() nya.toast("操作成功", "通知栏已被清空", 0xFF00FF00) end })) end end }) end, { ImageView, layout_width = -1, layout_height = -1, ColorFilter = xfc_cr_5, padding = "4dp", ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/empty.png") } }, { ScrollView, layout_width = -1, layout_height = -1, layout_marginRight = "7dp", layout_marginLeft = "7dp", id = "notice_scr", layout_marginTop = "54dp", layout_marginBottom = "10dp", VerticalScrollBarEnabled = false, { LinearLayout, --日志区 layout_width = -1, layout_marginRight = "7dp", layout_marginLeft = "7dp", layout_height = -1, orientation = "vertical", id = "gg_log", }, }, }, }, { CardView, layout_height = 0, layout_width = -1, CardBackgroundColor = xfc_cr_12, Elevation = '240dp', radius = '61', id = "xfclay_control", { RelativeLayout, layout_width = -1, layout_margin = "12dp", layout_height = -1, { RelativeLayout, layout_width = -1, layout_height = "30dp", { TextView, layout_width = "144dp", textSize = "17sp", layout_height = "29dp", textColor = xfc_cr_32, layout_marginLeft = "12dp", gravity = "center|left", text = "控制中心", }, { ImageView, ColorFilter = xfc_cr_5, ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/qa.png"), layout_height = "29dp", layout_alignParentRight = "true", layout_marginRight = "6dp", layout_width = "29dp", padding = "4dp", onClick = function() nya_alert("控制中心", [[控制中心可供UI进行一些简单调整 1.底部为悬浮窗透明度调节 2.右侧两按钮分别为 缩小悬浮窗(上) 退出脚本(下) 3.左上方界面内部可自由拖动 ①隐藏GG:隐藏/显示GG修改器图标 ②灵动岛:显示当前所在页面 ③固定大小:打开后悬浮窗无法自由拉伸调节大小 ④按压反馈:打开后触摸部分开关和按钮会有按压变色 ]]) end, }, }, { RelativeLayout, layout_width = -1, layout_marginTop = "37dp", layout_marginBottom = "50dp", layout_height = -1, { CardView, layout_width = -1, CardBackgroundColor = xfc_cr_42, Elevation = '0dp', radius = '29', id = "control_layu", layout_marginRight = "48dp", layout_height = -1, { AbsoluteLayout, layout_width = -1, layout_height = -1, { AbsoluteLayout, layout_width = "307dp", layout_height = "312dp", id = "control_t", onTouch = cdhuad, }, }, }, { ImageView, ColorFilter = xfc_cr_5, ImageDrawable = sqDrawable, layout_height = "38dp", layout_marginRight = "2dp", layout_marginTop = "5dp", padding = "6dp", onClick = function() local conParams = xfclay_control.getLayoutParams() conParams.height = 0 xfclay_control.setLayoutParams(conParams) canls = true end, layout_alignParentTop = "true", layout_alignParentRight = "true", background = getShepeBackground(xfc_cr_42, 18), layout_width = "38dp", }, { ImageView, ColorFilter = xfc_cr_5, ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/mexit.png"), layout_height = "38dp", layout_marginRight = "2dp", padding = "6dp", layout_alignBottom = "control_layu", layout_marginBottom = "5dp", onClick = function() gg.playMusic("stop") gg.hide(false) luajava.exit() end, layout_alignParentRight = "true", background = getShepeBackground(xfc_cr_42, 18), layout_width = "38dp", }, }, { CardView, CardBackgroundColor = xfc_cr_42, Elevation = '1dp', radius = '29', layout_alignParentBottom = "true", layout_height = "29dp", layout_margin = "5dp", layout_width = -1, { RelativeLayout, { ImageView, ColorFilter = xfc_cr_5, ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/alpha.png"), layout_height = "29dp", layout_marginRight = "5dp", padding = "4dp", layout_alignParentRight = "true", layout_width = "29dp", }, { ImageView, ColorFilter = xfc_cr_5, alpha = 0.4, ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/alpha.png"), layout_height = "29dp", layout_marginLeft = "5dp", padding = "4dp", layout_width = "29dp", }, { SeekBar, id = "alphaseek", layout_width = -1, layout_marginLeft = "46dp", layout_marginRight = "46dp", max = 100, min = 1, layout_height = "wrap", background = ColorDrawable(0x00000000), padding = "0dp", thumb = ColorDrawable(0x00000000), layout_centerVertical = true, }, }, }, }, }, }, } return xfc end function LoadUI() xfc = loadlayout(shengcheng_xfc()) XFCparams = getLayoutParams1() current_layout = xfclay_table --悬浮球逻辑 function addXFq() loadfile("/sdcard/.Luajr/scripts/xfq_fq" .. lua_sets["fq"] .. ".lua")() window.addView(xfq, XFCparams) xfq.setVisibility(View.GONE) process_chooser() function suspended_ball.onClick(v) sparkleAni(xfq, 400, 1, 0, function() xfq.setVisibility(View.GONE) xfc.setVisibility(View.VISIBLE) window.updateViewLayout(xfc, XFCparams) sparkleAni(xfc, 400, 0, 1) end) end function suspended_ball.onTouch(v, event) local Action = event.getAction() if Action == MotionEvent.ACTION_DOWN then RawX = event.getRawX() RawY = event.getRawY() x = XFCparams.x y = XFCparams.y elseif Action == MotionEvent.ACTION_MOVE then XFCparams.x = tonumber(x) + (event.getRawX() - RawX) XFCparams.y = tonumber(y) + (event.getRawY() - RawY) window.updateViewLayout(xfq, XFCparams) end end end addXFq() --功能菜单 local fun_choice1 = loadlayout({ CardView, layout_width = -1, layout_height = -1, Visibility = 8, id = "gg_c1", CardBackgroundColor = xfc_cr_1, Elevation = '3dp', radius = '31', { LinearLayout, layout_width = -1, orientation = "vertical", layout_height = -1, { RelativeLayout, layout_height = "29dp", layout_width = -1, layout_marginTop = "4dp", { ImageView, layout_width = "26dp", layout_height = "26dp", ColorFilter = xfc_cr_5, padding = "1dp", ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/setting.png"), layout_marginLeft = "12dp", layout_centerVertical = true }, { TextView, layout_width = -1, layout_height = "26dp", text = "菜单", layout_marginLeft = "50dp", layout_centerVertical = true, singleLine = true, gravity = "center|left", textColor = xfc_cr_32, textSize = "16sp" } }, { ScrollView, layout_width = -1, layout_height = -1, VerticalScrollBarEnabled = true, { LinearLayout, layout_width = -1, orientation = "vertical", layout_height = -1, choose_btnGroup("luaj", "功能分区1", { { Switch, "yinfu", "开关1", function() print("开启开关1") end, function() print("关闭开关1") end, true }, { Button, "luaj", "按钮1", function() print("点击按钮1") end }, }, true), choose_btnGroup("luaj", "功能分区2", { { Switch, "yinfu", "开关2", function() print("开启开关2") end, function() print("关闭开关2") end }, { Button, "luaj", "按钮2", function() print("点击按钮2") end }, }), choose_btnGroup("luaj", "功能分区3", { { CheckBox, "yinfu", "开关3", function() print("开启开关3") end, function() print("关闭开关3") end }, { Button, "luaj", "按钮3", function() print("点击按钮3") end }, }), }, }, }, }) colorfulsw(fun_choice1) xfc_f.addView(fun_choice1) addtableicon("btn_c1", "vip", "菜单", "gg_c1") -- 日志演示 nya_log("功能名称1", "功能说明内容", 0xFF00FF00) nya_log("功能名称2", "功能说明内容", 0xFF00FF00) nya_log("功能名称3", "功能说明内容", 0xFF00FF00) nya_log("功能名称4", "功能说明内容", 0xFF00FF00) seekcolor(alphaseek, xfc_cr_12, xfc_cr_32, 12, 7, 10) alphaseek.setProgress(100) alphaseek.setOnSeekBarChangeListener { onProgressChanged = function(view, i) xfc_Alpha = tonumber(alphaseek.getProgress()) * 1.000001 / 100.00001 xfc.setAlpha(xfc_Alpha) end } textclock.getPaint().setFakeBoldText(true) if not lua_sets["vip"] then nya_shownt() loadfile("/sdcard/.Luajr/scripts/login.lua")() end loadfile("/sdcard/.Luajr/scripts/tipstyle" .. lua_sets["tip"] .. ".lua")() loadfile("/sdcard/.Luajr/scripts/tdls.lua")() loadfile("/sdcard/.Luajr/scripts/cPageAnimation" .. lua_sets["cpani"] .. ".lua")() -- ========== 修复:为桌面空白区域添加全局拖动 ========== xfclay_table.setOnTouchListener(luajava.createProxy("android.view.View$OnTouchListener", { onTouch = function(v, event) local action = event.getAction() if action == MotionEvent.ACTION_DOWN then startX = event.getRawX() startY = event.getRawY() startParamsX = XFCparams.x startParamsY = XFCparams.y return true elseif action == MotionEvent.ACTION_MOVE then local dx = event.getRawX() - startX local dy = event.getRawY() - startY XFCparams.x = startParamsX + dx XFCparams.y = startParamsY + dy window.updateViewLayout(xfc, XFCparams) return true end return false end })) -- ===================================================== -- 点击标题栏切换通知栏 xfclay_tittle.setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) local params = xfclay_notice.getLayoutParams() if params.height == 0 then params.height = xfclay_ke.getHeight() - dp2px(60) xfclay_notice.setLayoutParams(params) canls = false else params.height = 0 xfclay_notice.setLayoutParams(params) canls = true xfc_f.setAlpha(1) end end })) -- 点击设置栏切换控制中心 xfclay_set.setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) local params = xfclay_control.getLayoutParams() if params.height == 0 then params.height = xfclay_ke.getHeight() - dp2px(60) xfclay_control.setLayoutParams(params) canls = false else params.height = 0 xfclay_control.setLayoutParams(params) canls = true xfc_f.setAlpha(1) end end })) -- 点击通知栏空白处关闭 xfclay_notice.setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) local params = xfclay_notice.getLayoutParams() if params.height ~= 0 then params.height = 0 xfclay_notice.setLayoutParams(params) canls = true xfc_f.setAlpha(1) end end })) -- 点击控制栏空白处关闭 xfclay_control.setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) local params = xfclay_control.getLayoutParams() if params.height ~= 0 then params.height = 0 xfclay_control.setLayoutParams(params) canls = true xfc_f.setAlpha(1) end end })) -- 隐藏UI按钮 local hideIconDrawable = sqDrawable or Drawable.createFromPath("/sdcard/.Luajr/res/empty.png") local hideBtnLayout = loadlayout({ LinearLayout, layout_width = "wrap_content", layout_height = "wrap_content", orientation = "vertical", gravity = "center", { CardView, layout_width = "55dp", layout_height = "55dp", radius = '29', CardBackgroundColor = xfc_cr_1, Elevation = '3dp', { ImageView, layout_width = "31dp", layout_height = "31dp", ImageDrawable = hideIconDrawable, ColorFilter = xfc_cr_5, rotation = -35, } }, { TextView, layout_width = "wrap_content", layout_height = "wrap_content", text = "隐藏UI", textSize = "12sp", textColor = xfc_cr_22, layout_marginTop = "2dp", gravity = "center" } }) hideBtnLayout.setOnClickListener(luajava.createProxy("android.view.View$OnClickListener", { onClick = function(v) local cParams = xfclay_control.getLayoutParams() if cParams and cParams.height ~= 0 then cParams.height = 0 xfclay_control.setLayoutParams(cParams) end xfc_f.setAlpha(1) canls = true sparkleAni(xfc, 400, 1, 0, function() xfc.setVisibility(View.GONE) xfq.setVisibility(View.VISIBLE) window.updateViewLayout(xfq, XFCparams) sparkleAni(xfq, 400, 0, 1) end) end })) xfc_f.addView(hideBtnLayout) local hParams = hideBtnLayout.getLayoutParams() hParams.x = dp2px(162) hParams.y = dp2px(234) hideBtnLayout.setLayoutParams(hParams) -- 开启动画 window.addView(xfc, XFCparams) sparkleAni(xfc, 900, 0, 1) -- 线程后台加载(灵动岛、控制中心按钮、音乐、主题、设置、浏览器) threadStart({ run = function() -- 加载灵动岛 local islond1 = loadlayout({ RelativeLayout, layout_width = -1, layout_height = -1, id = "island1", alpha = 0, { RelativeLayout, layout_width = -1, layout_height = -1, id = "pageshow", { CardView, layout_width = "13dp", layout_height = "13dp", radius = '30', id = "pageshow_ball", layout_centerVertical = true, Elevation = '12dp', CardBackgroundColor = "#FF0000FF", layout_marginLeft = "10dp", }, { TextView, text = "桌面", textSize = "12sp", id = "pageshow_text", layout_marginLeft = "14dp", layout_centerVertical = true, layout_width = -1, gravity = "center", layout_height = "22dp", }, }, }) local islond2 = loadlayout({ RelativeLayout, layout_width = -1, layout_height = -1, gravity = "center", Visibility = 8, id = "island2", }) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() xfc_island.addView(islond2) xfc_island.addView(islond1) function island1.onTouch(v, event) if canisland == true then if event.getAction() == MotionEvent.ACTION_DOWN then firstY = event.getRawY() island1.setVisibility(View.GONE) localparams = xfc_island.getLayoutParams() wmX = xfc_island.getWidth() wmY = xfc_island.getHeight() maxX = dp2px(144) maxY = dp2px(96) minX = dp2px(108) minY = dp2px(24) elseif event.getAction() == MotionEvent.ACTION_MOVE then deltay = event.getRawY() - firstY if deltay > 0 then local newWidth = wmX + deltay * 0.4 local newHeight = wmY + deltay * 0.6 if newWidth < maxX then localparams.width = newWidth end if newHeight < maxY then localparams.height = newHeight else local beilv8 = tonumber(string.format("%.2f", deltay)) / dp2px(120) if beilv8 < 1.06 then xfc_island.setScaleX(beilv8) end end xfc_island.setLayoutParams(localparams) else beilv1 = tonumber(string.format("%.2f", deltay)) / -dp2px(120) if beilv1 < 0.4 then xfc_island.setScaleX(1 - beilv1) end end elseif event.getAction() == MotionEvent.ACTION_UP then if deltay > 0 then if deltay > dp2px(60) then localparams.width = maxX localparams.height = maxY xfc_island.setLayoutParams(localparams) waterAni(xfc_island, 800, { 1.05, 0.96, 1.02, 0.98, 1 }, { 1, 1, 1, 1, 1 }) island2.setVisibility(View.VISIBLE) sparkleAni(island2, 1000, 0, 1) else localparams.width = minX localparams.height = minY xfc_island.setLayoutParams(localparams) waterAni(xfc_island, 800, { 1.1, 0.95, 1.05, 0.98, 1 }, { 1, 1, 1, 1, 1 }) island1.setVisibility(View.VISIBLE) sparkleAni(island1, 1000, 0, 1) end else if beilv1 > 0.4 then beilv1 = 0.4 end localparams.width = minX localparams.height = minY waterAni(xfc_island, 800, { 1 - beilv1, 0.95, 1.1, 0.95, 1 }, { 1.05, 0.95, 1.02, 0.98, 1 }) island1.setVisibility(View.VISIBLE) xfc_island.setLayoutParams(localparams) sparkleAni(island1, 1000, 0, 1) end end return true end end function island2.onTouch(v, event) if canisland == true then if event.getAction() == MotionEvent.ACTION_DOWN then firstY = event.getRawY() island2.setVisibility(View.GONE) localparams = xfc_island.getLayoutParams() wmX = xfc_island.getWidth() wmY = xfc_island.getHeight() minX = dp2px(108) minY = dp2px(24) elseif event.getAction() == MotionEvent.ACTION_MOVE then deltay = event.getRawY() - firstY if deltay < 0 then local newWidth = wmX + deltay * 0.4 local newHeight = wmY + deltay * 0.6 if newWidth > minX then localparams.width = newWidth end if newHeight > minY then localparams.height = newHeight else local beilv8 = tonumber(string.format("%.2f", deltay)) / -dp2px(120) if beilv8 < 1.1 then xfc_island.setScaleX(2 - beilv8) end end xfc_island.setLayoutParams(localparams) else beilv1 = tonumber(string.format("%.2f", deltay)) / dp2px(240) if beilv1 < 0.2 then xfc_island.setScaleX(1 + beilv1) end end elseif event.getAction() == MotionEvent.ACTION_UP then if deltay < 0 then if deltay < -dp2px(60) then localparams.width = minX localparams.height = minY xfc_island.setLayoutParams(localparams) waterAni(xfc_island, 800, { 1.04, 0.96, 1.02, 0.98, 1 }, { 1, 1, 1, 1, 1 }) sparkleAni(island1, 1000, 0, 1) island1.setVisibility(View.VISIBLE) else localparams.width = wmX localparams.height = wmY xfc_island.setLayoutParams(localparams) waterAni(xfc_island, 800, { 1.03, 0.97, 1.01, 0.98, 1 }, { 1, 1, 1, 1, 1 }) sparkleAni(island2, 1000, 0, 1) island2.setVisibility(View.VISIBLE) end else if beilv1 > 0.2 then beilv1 = 0.2 end waterAni(xfc_island, 800, { 1 + beilv1, 0.96, 1.02, 0.98, 1 }, { 1, 1, 1, 1, 1 }) sparkleAni(island2, 1000, 0, 1) island2.setVisibility(View.VISIBLE) end end return true end end end })) -- 加载控制中心按钮 ctfuncs = { { "yinc", "隐藏GG", function() gg.hide(true); lua_sets["GGhide"] = true; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end, function() gg.hide(false); lua_sets["GGhide"] = false; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end, lua_sets["GGhide"] }, { "island", "灵动岛", function() lua_sets["island"] = true; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)); xfc_island.setVisibility(View.VISIBLE); local locaams8 = xfc_island.getLayoutParams(); OrginIX = locaams8.width; locaams8.width = dp2px(24); xfc_island.setLayoutParams(locaams8); sparkleAni(xfc_island, 1200, 0.6, 1); sparkleAni(xfclay_ztlan, 2400, 1, 0); if island_isshow == nil then mmx21 = tonumber(xfc_island.getY()) - dp2px(48); mmw32 = xfc_island.getY(); else mmx21 = xfc_island.getY(); mmw32 = tonumber(xfc_island.getY()) + dp2px(48); end; tranAni(xfc_island, "Y", 800, mmx21, mmw32, function() locaams8.width = dp2px(108); xfc_island.setLayoutParams(locaams8); sparkleAni(island1, 1000, 0, 1); scaleAni(xfc_island, 0.22222222, 1, 1, 1, 1, 0.5, 0, 0, 800, function() xfc_island.clearAnimation(); island_isshow = true; end); end) end, function() lua_sets["island"] = false; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)); local locaams8 = xfc_island.getLayoutParams(); sparkleAni(island1, 700, 1, 0); scaleAni(xfc_island, 1, 0.22222222, 1, 1, 1, 0.5, 0, 0, 800, function() island_isshow = false; xfc_island.clearAnimation(); locaams8.width = dp2px(24); xfc_island.setLayoutParams(locaams8); sparkleAni(xfclay_ztlan, 1200, 0, 1); sparkleAni(xfc_island, 1000, 1, 0.4); tranAni(xfc_island, "Y", 800, xfc_island.getY(), tonumber(xfc_island.getY()) - dp2px(48), function() xfc_island.setVisibility(View.GONE); end); end) end, lua_sets["island"] }, { "vtls", "固定大小", function() lua_sets["size"] = true; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end, function() lua_sets["size"] = false; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end, lua_sets["size"] }, { "click", "按压反馈", function() lua_sets["click"] = true; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end, function() lua_sets["click"] = false; io.open("/sdcard/.Luajr/config/settings.lua", "w"):write("lua_sets=" .. tostring(lua_sets)) end, lua_sets["click"] }, } function ctcgbtn(btn, num) if ctfuncs[num][5] == true then pcall(ctfuncs[num][4]) btn.setCardBackgroundColor(xfc_cr_12) btn.getChildAt(0).setColorFilter(xfc_cr_52) ctfuncs[num][5] = false elseif ctfuncs[num][5] == false then pcall(ctfuncs[num][3]) btn.setCardBackgroundColor(xfc_cr_32) btn.getChildAt(0).setColorFilter(xfc_cr_12) ctfuncs[num][5] = true end end for i = 1, #ctfuncs do local addbtn = loadlayout({ RelativeLayout, layout_width = "54dp", layout_height = "58dp", gravity = "center", onTouch = cdhuad, { CardView, layout_width = "34dp", layout_height = "34dp", radius = '31', onClick = function(v) waterAni(v, 400, { 0.9, 1.1, 0.95, 1.05, 1 }, { 0.9, 1.1, 0.95, 1.05, 1 }) ctcgbtn(v, i) end, layout_centerHorizontal = true, Elevation = '1dp', CardBackgroundColor = ctfuncs[i][5] and xfc_cr_3 or xfc_cr_1, { ImageView, ImageDrawable = Drawable.createFromPath("/sdcard/.Luajr/res/" .. ctfuncs[i][1] .. ".png"), layout_height = -1, padding = "5dp", layout_width = -1, ColorFilter = ctfuncs[i][5] and xfc_cr_1 or xfc_cr_5, }, }, { TextView, layout_width = "wrap", layout_height = "22dp", layout_centerHorizontal = true, layout_marginTop = "34dp", textColor = xfc_cr_22, text = ctfuncs[i][2], gravity = "center|bottom", textSize = "11sp" }, }) activity.runOnUiThread(luajava.createProxy("java.lang.Runnable", { run = function() if ctfuncs[i][5] == true then pcall(ctfuncs[i][3]) end local dividend = control_t.getChildCount() control_t.addView(addbtn) local xyzb = addbtn.getLayoutParams() xyzb.x = dp2px(12) + dp2px(66) * (dividend % 4) - 1 xyzb.y = dp2px(12) + dp2px(66) * (dividend // 4) - 1 addbtn.setLayoutParams(xyzb) end })) end -- 加载音乐、主题、设置、浏览器 if lua_sets["music"] == true then loadfile("/sdcard/.Luajr/scripts/music.lua")() end if lua_sets["theme"] == true then loadfile("/sdcard/.Luajr/scripts/theme.lua")() end loadfile("/sdcard/.Luajr/scripts/setting.lua")() if lua_sets["web"] == true then loadfile("/sdcard/.Luajr/scripts/webview.lua")() end end }) end Lock.Ui(LoadUI, nil, function(err) print(err) luajava.exit() end)