123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- -- 设置为竖屏模式
- activity.setRequestedOrientation(1)
- function hexToColor(hex)
- -- 去掉 # 前缀
- hex = hex:gsub("#", "")
- -- 将十六进制转换为数字
- local color = tonumber(hex, 16)
- return color
- end
- local hexColor = "#ff009688"
- local MyColor = hexToColor(hexColor)
- 写入文件(随机色,MyColor)
- 读取颜色(随机色,随机色)
- layout = {
- LinearLayout,
- orientation ='vertical',
- layout_width = 'fill',
- layout_height = 'fill',
- background = '#ffffff',
- {
- TextView,
- text = '常用网站',
- textSize = '20sp',
- textColor = '#333333',
- layout_gravity = "center|bottom",
- layout_marginTop = '35px',
- },
- {
- TextView,
- layout_width = '97.4%w',
- layout_height = '5px',
- layout_marginTop = '10dp',
- layout_marginBottom = '10dp',
- layout_gravity = 'center',
- backgroundColor = MyColor
- },
- {
- GridView,
- id = "list",
- numColumns = 3,
- layout_width = 'fill',
- layout_height = 'fill',
- horizontalSpacing = "3dp",
- verticalSpacing = "0dp",
- layout_gravity = "center",
- OverScrollMode = 2
- }
- }
- webView.addView(loadlayout(layout))
- function 布局边框(边框粗细, 边框颜色, 背景颜色, 圆角大小)
- import "android.graphics.drawable.GradientDrawable"
- drawable = GradientDrawable()
- drawable.setShape(GradientDrawable.RECTANGLE)
- drawable.setStroke(边框粗细, tonumber(边框颜色))
- drawable.setColor(tonumber(背景颜色))
- drawable.setCornerRadius(圆角大小)
- return drawable
- end
- item = {
- LinearLayout,
- layout_height = "48dp",
- layout_width = "fill",
- {
- LinearLayout,
- layout_height = "fill",
- layout_width = "fill",
- layout_margin = "5dp",
- BackgroundDrawable = 布局边框(4,MyColor, 0x00000000, 15),
- {
- TextView,
- id = "name",
- layout_height = "fill",
- layout_width = "fill",
- gravity = "center",
- textColor = "#FF000000"
- },
- {
- TextView,
- id = "tools",
- layout_width = "0dp",
- layout_height = "0dp"
- }
- }
- }
- adapter = LuaAdapter(activity, item)
- function getToolsText(v)
- return v.Tag.tools and v.Tag.tools.text or ""
- end
- list.onItemClick = function(l, v, p, i)
- local toolsText = getToolsText(v)
- if toolsText:find '://' then
- ---------
- if v.Tag.name.text:find '分享迷' then
- 写入文件(UA,塞班)
- 写入文件(UA标识,"塞班")
- 子页面('塞班',toolsText)
- else
- 子页面('安卓',toolsText)
- end
- ----------
- else
- WEB小程序(toolsText)
- ----------
- end
- end
- list.onItemLongClick = function(l, v, p, i)
- local toolsText = getToolsText(v)
- if toolsText:find '://' then
- if toolsText:find 'file://' then return true else
- --print("使用系统默认浏览器打开\n".. toolsText)
- 调用浏览器(toolsText)
- return true
- end
- else
- --print ('暂时没有添加长按功能噢😃!')
- return true
- end
- end
- list.Adapter = adapter
- local dataList = {
- {name="deepseek",tools="https://chat.deepseek.com/"},
- {name="豆包网页版",tools="https://www.doubao.com/chat/"},
- {name="kimi网页版",tools="https://kimi.moonshot.cn/"},
- {name="问小白",tools="https://www.wenxiaobai.com/chat/"},
- {name="更多AI网站",tools="https://hot.browser.miui.com/light/ai-tool-collection.html"},
- {name="永硕发布页",tools="http://cgb0523.ysupan.com/"},
- {name="蓝奏云",tools="https://up.woozooo.com/u"},
- {name="坚果云",tools="https://www.jianguoyun.com/d/home#/home"},
- {name="吾爱云盘",tools="https://wuaipan.com/"},
- {name="小米云",tools="https://i.mi.com/"},
- {name="分享迷",tools="https://www.fenxm.com/tv"},
- {name="盒子应用",tools="http://m.xlhs.com/k/dianshihezirj/"},
- {name="423下载",tools="https://www.423down.com/apk"},
- {name="YZJhr",tools="http://hr.yzjyy.com:8080/sapprd/common/login.jsp"},
- {name="网络剪贴板",tools="https://txtpad.cn/txcgb"},
- {name="学习Web开发",tools="https://developer.mozilla.org/zh-CN/docs/Learn"},
- {name="时间间隔计算",tools="file:///android_asset/htm/time/index.html"},
- {name="进制转换",tools="file:///android_asset/htm/2to10/index.html"},
- }
- for _, data in ipairs(dataList) do
- adapter.add(data)
- end
|