|
资讯缩略图:
资讯发布日期:2025-09-26
资讯发布简介:AIWROK软件安卓工具箱悬浮窗
资讯关键词:AIWROK软件安卓工具箱悬浮窗
资讯所属分类:IT资讯
联系:
① 本信息收集于网络,如有不对的地方欢迎联系我纠正! ② 本信息免费收录,不存在价格的问题! ③ 如果您的网站也想这样出现在这里,请您加好友情链接,我当天会审核通过!
④友情链接关键字:软件网站分类目录 网址:http://www.postbbs.com/
资讯详细描述
 | |  |  |
AIWROK软件安卓工具箱悬浮窗
- //🍎交流QQ群711841924群一,苹果内测群,528816639
- // 安卓工具箱悬浮窗
- // 适用于ES5系统安卓 JavaScript引擎Rhino
- // 基于AIWORK软件安卓开发框架
- // 提供工具箱功能集合
- function 工具箱悬浮窗() {
- this.screenHeight = 1920; // 默认值
- this.screenWidth = 1080; // 默认值
- this.isExpanded = false; // 展开状态
- this.currentTool = null; // 当前选中工具
- }
- // 创建悬浮窗实例
- var 工具箱窗口 = new 工具箱悬浮窗();
- // 创建悬浮窗方法
- 工具箱悬浮窗.prototype.create = function() {
- try {
- printl("===== 开始创建工具箱悬浮窗 =====");
-
- // 创建 floatUI 实例
- var fui = new floatUI();
-
- // 获取屏幕尺寸
- try {
- var metrics = context.getResources().getDisplayMetrics();
- this.screenHeight = metrics.heightPixels;
- this.screenWidth = metrics.widthPixels;
- printl("✅ 获取屏幕尺寸: " + this.screenWidth + "x" + this.screenHeight);
- } catch(e) {
- printl("⚠️ 获取屏幕尺寸失败,使用默认值: " + e);
- }
-
- // 加载工具箱悬浮窗XML布局
- fui.loadXML(`
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="#CC2C2C2C"
- android:orientation="horizontal"
- android:padding="6dp"
- android:elevation="8dp">
-
- <!-- 工具按钮区域 -->
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_marginRight="6dp">
-
- <!-- 主按钮 -->
- <Button
- android:id="btn_main"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:text="🔧"
- android:textSize="20sp"
- android:background="#4A90E2"/>
-
- <!-- 展开区域 -->
- <LinearLayout
- android:id="tools_layout"
- android:layout_width="50dp"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_marginTop="5dp"
- android:visibility="gone">
-
- <Button
- android:id="btn_screenshot"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:text="📸"
- android:textSize="20sp"
- android:background="#28A745"
- android:layout_marginBottom="3dp"/>
-
- <Button
- android:id="btn_ocr"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:text="🔍"
- android:textSize="20sp"
- android:background="#17A2B8"
- android:layout_marginBottom="3dp"/>
-
- <Button
- android:id="btn_click_record"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:text="🖱️"
- android:textSize="20sp"
- android:background="#FFC107"
- android:layout_marginBottom="3dp"/>
-
- <Button
- android:id="btn_color_picker"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:text="🎨"
- android:textSize="20sp"
- android:background="#6F42C1"/>
- </LinearLayout>
- </LinearLayout>
-
- <!-- 工具详情区域 -->
- <LinearLayout
- android:id="detail_layout"
- android:layout_width="180dp"
- android:layout_height="220dp"
- android:background="#E6E6E6"
- android:orientation="vertical"
- android:padding="8dp"
- android:visibility="gone">
-
- <TextView
- android:id="tool_title"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="工具详情"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#000000"
- android:layout_marginBottom="5dp"/>
-
- <TextView
- android:id="tool_description"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="选择一个工具查看说明"
- android:textSize="12sp"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
-
- <Button
- android:id="btn_execute_tool"
- android:layout_width="match_parent"
- android:layout_height="35dp"
- android:text="执行工具"
- android:textSize="14sp"
- android:background="#4A90E2"
- android:textColor="#FFFFFF"/>
-
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="8dp">
- <TextView
- android:id="tool_output"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="工具输出将显示在这里"
- android:textSize="10sp"
- android:textColor="#666666"/>
- </ScrollView>
- </LinearLayout>
- </LinearLayout>
- `);
-
- // 保存floatUI实例
- this.ui = fui;
-
- // 设置初始位置(屏幕左侧居中)
- var posY = (this.screenHeight - 250) / 2;
- this.setPos(20, posY);
-
- // 获取UI元素
- this.btn_main = fui.findViewById("btn_main");
- this.tools_layout = fui.findViewById("tools_layout");
- this.detail_layout = fui.findViewById("detail_layout");
- this.btn_screenshot = fui.findViewById("btn_screenshot");
- this.btn_ocr = fui.findViewById("btn_ocr");
- this.btn_click_record = fui.findViewById("btn_click_record");
- this.btn_color_picker = fui.findViewById("btn_color_picker");
- this.tool_title = fui.findViewById("tool_title");
- this.tool_description = fui.findViewById("tool_description");
- this.btn_execute_tool = fui.findViewById("btn_execute_tool");
- this.tool_output = fui.findViewById("tool_output");
-
- // 初始化按钮事件
- this.initButtons();
-
- printl("✅ 工具箱悬浮窗创建成功");
- toast.show("🔧 工具箱已就绪,点击主按钮展开工具");
-
- } catch (err) {
- printl("❌ 悬浮窗创建失败: " + err);
- }
- };
- // 初始化按钮事件
- 工具箱悬浮窗.prototype.initButtons = function() {
- var self = this;
-
- // 主按钮点击事件(展开/收起工具栏)
- this.btn_main.setOnClickListener(function() {
- self.toggleTools();
- });
-
- // 截图工具
- this.btn_screenshot.setOnClickListener(function() {
- self.showToolDetail("截图工具", "用于截取当前屏幕并保存到相册", "点击执行按钮进行截图");
- self.currentTool = "screenshot";
- });
-
- // OCR工具
- this.btn_ocr.setOnClickListener(function() {
- self.showToolDetail("OCR识别", "识别屏幕中的文字内容", "框选区域后进行文字识别");
- self.currentTool = "ocr";
- });
-
- // 点击录制工具
- this.btn_click_record.setOnClickListener(function() {
- self.showToolDetail("点击录制", "录制并回放点击操作序列", "开始录制后点击屏幕任意位置");
- self.currentTool = "click_record";
- });
-
- // 取色器工具
- this.btn_color_picker.setOnClickListener(function() {
- self.showToolDetail("屏幕取色器", "获取屏幕上任意点的颜色值", "点击屏幕任意位置获取颜色");
- self.currentTool = "color_picker";
- });
-
- // 执行工具按钮
- this.btn_execute_tool.setOnClickListener(function() {
- self.executeCurrentTool();
- });
- };
- // 展开/收起工具栏
- 工具箱悬浮窗.prototype.toggleTools = function() {
- if (this.isExpanded) {
- // 收起
- this.tools_layout.setVisibility(View.GONE);
- this.detail_layout.setVisibility(View.GONE);
- this.isExpanded = false;
- printl("🔼 工具箱已收起");
- } else {
- // 展开
- this.tools_layout.setVisibility(View.VISIBLE);
- this.isExpanded = true;
- printl("🔽 工具箱已展开");
- }
- };
- // 显示工具详情
- 工具箱悬浮窗.prototype.showToolDetail = function(title, description, output) {
- this.tool_title.setText(title);
- this.tool_description.setText(description);
- this.tool_output.setText(output);
- this.detail_layout.setVisibility(View.VISIBLE);
- printl("📋 查看工具: " + title);
- };
- // 执行当前选中工具
- 工具箱悬浮窗.prototype.executeCurrentTool = function() {
- var self = this;
-
- if (!this.currentTool) {
- toast.show("❌ 请先选择一个工具");
- return;
- }
-
- switch(this.currentTool) {
- case "screenshot":
- this.tool_output.setText("📸 正在执行截图...");
- toast.show("📸 截图功能执行中...");
-
- // 模拟截图操作
- setTimeout(function() {
- self.tool_output.setText("✅ 截图已完成,保存至相册");
- toast.show("✅ 截图保存成功");
- }, 1500);
- break;
-
- case "ocr":
- this.tool_output.setText("🔍 正在初始化OCR识别...");
- toast.show("🔍 OCR识别准备中...");
-
- // 模拟OCR操作
- setTimeout(function() {
- self.tool_output.setText("🔍 请在屏幕上框选需要识别的区域");
- toast.show("🔍 请框选识别区域");
- }, 1000);
- break;
-
- case "click_record":
- this.tool_output.setText("🖱️ 点击录制已启动,点击屏幕任意位置开始录制");
- toast.show("🖱️ 点击录制已启动");
- break;
-
- case "color_picker":
- this.tool_output.setText("🎨 屏幕取色器已启动,点击屏幕任意位置获取颜色");
- toast.show("🎨 取色器已启动");
- break;
-
- default:
- this.tool_output.setText("❌ 未知工具");
- toast.show("❌ 无法执行未知工具");
- }
- };
- // 设置悬浮窗位置
- 工具箱悬浮窗.prototype.setPos = function(x, y) {
- this.ui.setPosition(x, y);
- printl("📍 悬浮窗位置设置为: (" + x + ", " + y + ")");
- };
- // 关闭悬浮窗
- 工具箱悬浮窗.prototype.close = function() {
- this.ui.close();
- printl("✅ 工具箱悬浮窗已关闭");
- };
- // 启动悬浮窗
- try {
- 工具箱窗口.create();
- printl("===== 工具箱悬浮窗启动成功 =====");
- } catch (err) {
- printl("❌ 工具箱悬浮窗启动失败: " + err);
- }
复制代码
| |  | |  |
|
unto安卓通过floatUI创建悬浮窗H5界面nextAIWROK软件支持悬浮窗自由定位和拖拽功能
|