自动发帖软件

标题: AIWROK软件安卓工具箱悬浮窗 [打印本页]

作者: 发帖软件    时间: 2025-9-26 07:58
标题: AIWROK软件安卓工具箱悬浮窗
AIWROK软件安卓工具箱悬浮窗


AIWROK软件安卓工具箱悬浮窗 群发软件发帖工具

AIWROK软件安卓工具箱悬浮窗 群发软件发帖工具

AIWROK软件安卓工具箱悬浮窗 群发软件发帖工具

  1. //🍎交流QQ群711841924群一,苹果内测群,528816639
  2. // 安卓工具箱悬浮窗
  3. // 适用于ES5系统安卓 JavaScript引擎Rhino
  4. // 基于AIWORK软件安卓开发框架
  5. // 提供工具箱功能集合

  6. function 工具箱悬浮窗() {
  7.     this.screenHeight = 1920; // 默认值  
  8.     this.screenWidth = 1080;  // 默认值
  9.     this.isExpanded = false;   // 展开状态
  10.     this.currentTool = null;   // 当前选中工具
  11. }

  12. // 创建悬浮窗实例
  13. var 工具箱窗口 = new 工具箱悬浮窗();

  14. // 创建悬浮窗方法
  15. 工具箱悬浮窗.prototype.create = function() {
  16.     try {
  17.         printl("===== 开始创建工具箱悬浮窗 =====");
  18.         
  19.         // 创建 floatUI 实例
  20.         var fui = new floatUI();
  21.         
  22.         // 获取屏幕尺寸
  23.         try {
  24.             var metrics = context.getResources().getDisplayMetrics();
  25.             this.screenHeight = metrics.heightPixels;
  26.             this.screenWidth = metrics.widthPixels;
  27.             printl("✅ 获取屏幕尺寸: " + this.screenWidth + "x" + this.screenHeight);
  28.         } catch(e) {
  29.             printl("⚠️ 获取屏幕尺寸失败,使用默认值: " + e);
  30.         }
  31.         
  32.         // 加载工具箱悬浮窗XML布局
  33.         fui.loadXML(`
  34.         <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  35.             android:layout_width="wrap_content"
  36.             android:layout_height="wrap_content"
  37.             android:background="#CC2C2C2C"
  38.             android:orientation="horizontal"
  39.             android:padding="6dp"
  40.             android:elevation="8dp">
  41.             
  42.             <!-- 工具按钮区域 -->
  43.             <LinearLayout
  44.                 android:layout_width="wrap_content"
  45.                 android:layout_height="wrap_content"
  46.                 android:orientation="vertical"
  47.                 android:layout_marginRight="6dp">
  48.                
  49.                 <!-- 主按钮 -->
  50.                 <Button
  51.                     android:id="btn_main"
  52.                     android:layout_width="50dp"
  53.                     android:layout_height="50dp"
  54.                     android:text="&#128295;"
  55.                     android:textSize="20sp"
  56.                     android:background="#4A90E2"/>
  57.                
  58.                 <!-- 展开区域 -->
  59.                 <LinearLayout
  60.                     android:id="tools_layout"
  61.                     android:layout_width="50dp"
  62.                     android:layout_height="wrap_content"
  63.                     android:orientation="vertical"
  64.                     android:layout_marginTop="5dp"
  65.                     android:visibility="gone">
  66.                     
  67.                     <Button
  68.                         android:id="btn_screenshot"
  69.                         android:layout_width="50dp"
  70.                         android:layout_height="50dp"
  71.                         android:text="&#128248;"
  72.                         android:textSize="20sp"
  73.                         android:background="#28A745"
  74.                         android:layout_marginBottom="3dp"/>
  75.                         
  76.                     <Button
  77.                         android:id="btn_ocr"
  78.                         android:layout_width="50dp"
  79.                         android:layout_height="50dp"
  80.                         android:text="&#128269;"
  81.                         android:textSize="20sp"
  82.                         android:background="#17A2B8"
  83.                         android:layout_marginBottom="3dp"/>
  84.                         
  85.                     <Button
  86.                         android:id="btn_click_record"
  87.                         android:layout_width="50dp"
  88.                         android:layout_height="50dp"
  89.                         android:text="&#128433;️"
  90.                         android:textSize="20sp"
  91.                         android:background="#FFC107"
  92.                         android:layout_marginBottom="3dp"/>
  93.                         
  94.                     <Button
  95.                         android:id="btn_color_picker"
  96.                         android:layout_width="50dp"
  97.                         android:layout_height="50dp"
  98.                         android:text="&#127912;"
  99.                         android:textSize="20sp"
  100.                         android:background="#6F42C1"/>
  101.                 </LinearLayout>
  102.             </LinearLayout>
  103.             
  104.             <!-- 工具详情区域 -->
  105.             <LinearLayout
  106.                 android:id="detail_layout"
  107.                 android:layout_width="180dp"
  108.                 android:layout_height="220dp"
  109.                 android:background="#E6E6E6"
  110.                 android:orientation="vertical"
  111.                 android:padding="8dp"
  112.                 android:visibility="gone">
  113.                
  114.                 <TextView
  115.                     android:id="tool_title"
  116.                     android:layout_width="match_parent"
  117.                     android:layout_height="wrap_content"
  118.                     android:text="工具详情"
  119.                     android:textSize="16sp"
  120.                     android:textStyle="bold"
  121.                     android:textColor="#000000"
  122.                     android:layout_marginBottom="5dp"/>
  123.                
  124.                 <TextView
  125.                     android:id="tool_description"
  126.                     android:layout_width="match_parent"
  127.                     android:layout_height="wrap_content"
  128.                     android:text="选择一个工具查看说明"
  129.                     android:textSize="12sp"
  130.                     android:textColor="#333333"
  131.                     android:layout_marginBottom="10dp"/>
  132.                
  133.                 <Button
  134.                     android:id="btn_execute_tool"
  135.                     android:layout_width="match_parent"
  136.                     android:layout_height="35dp"
  137.                     android:text="执行工具"
  138.                     android:textSize="14sp"
  139.                     android:background="#4A90E2"
  140.                     android:textColor="#FFFFFF"/>
  141.                
  142.                 <ScrollView
  143.                     android:layout_width="match_parent"
  144.                     android:layout_height="match_parent"
  145.                     android:layout_marginTop="8dp">
  146.                     <TextView
  147.                         android:id="tool_output"
  148.                         android:layout_width="match_parent"
  149.                         android:layout_height="wrap_content"
  150.                         android:text="工具输出将显示在这里"
  151.                         android:textSize="10sp"
  152.                         android:textColor="#666666"/>
  153.                 </ScrollView>
  154.             </LinearLayout>
  155.         </LinearLayout>
  156.         `);
  157.         
  158.         // 保存floatUI实例
  159.         this.ui = fui;
  160.         
  161.         // 设置初始位置(屏幕左侧居中)
  162.         var posY = (this.screenHeight - 250) / 2;
  163.         this.setPos(20, posY);
  164.         
  165.         // 获取UI元素
  166.         this.btn_main = fui.findViewById("btn_main");
  167.         this.tools_layout = fui.findViewById("tools_layout");
  168.         this.detail_layout = fui.findViewById("detail_layout");
  169.         this.btn_screenshot = fui.findViewById("btn_screenshot");
  170.         this.btn_ocr = fui.findViewById("btn_ocr");
  171.         this.btn_click_record = fui.findViewById("btn_click_record");
  172.         this.btn_color_picker = fui.findViewById("btn_color_picker");
  173.         this.tool_title = fui.findViewById("tool_title");
  174.         this.tool_description = fui.findViewById("tool_description");
  175.         this.btn_execute_tool = fui.findViewById("btn_execute_tool");
  176.         this.tool_output = fui.findViewById("tool_output");
  177.         
  178.         // 初始化按钮事件
  179.         this.initButtons();
  180.         
  181.         printl("✅ 工具箱悬浮窗创建成功");
  182.         toast.show("&#128295; 工具箱已就绪,点击主按钮展开工具");
  183.         
  184.     } catch (err) {
  185.         printl("❌ 悬浮窗创建失败: " + err);
  186.     }
  187. };

  188. // 初始化按钮事件
  189. 工具箱悬浮窗.prototype.initButtons = function() {
  190.     var self = this;
  191.    
  192.     // 主按钮点击事件(展开/收起工具栏)
  193.     this.btn_main.setOnClickListener(function() {
  194.         self.toggleTools();
  195.     });
  196.    
  197.     // 截图工具
  198.     this.btn_screenshot.setOnClickListener(function() {
  199.         self.showToolDetail("截图工具", "用于截取当前屏幕并保存到相册", "点击执行按钮进行截图");
  200.         self.currentTool = "screenshot";
  201.     });
  202.    
  203.     // OCR工具
  204.     this.btn_ocr.setOnClickListener(function() {
  205.         self.showToolDetail("OCR识别", "识别屏幕中的文字内容", "框选区域后进行文字识别");
  206.         self.currentTool = "ocr";
  207.     });
  208.    
  209.     // 点击录制工具
  210.     this.btn_click_record.setOnClickListener(function() {
  211.         self.showToolDetail("点击录制", "录制并回放点击操作序列", "开始录制后点击屏幕任意位置");
  212.         self.currentTool = "click_record";
  213.     });
  214.    
  215.     // 取色器工具
  216.     this.btn_color_picker.setOnClickListener(function() {
  217.         self.showToolDetail("屏幕取色器", "获取屏幕上任意点的颜色值", "点击屏幕任意位置获取颜色");
  218.         self.currentTool = "color_picker";
  219.     });
  220.    
  221.     // 执行工具按钮
  222.     this.btn_execute_tool.setOnClickListener(function() {
  223.         self.executeCurrentTool();
  224.     });
  225. };

  226. // 展开/收起工具栏
  227. 工具箱悬浮窗.prototype.toggleTools = function() {
  228.     if (this.isExpanded) {
  229.         // 收起
  230.         this.tools_layout.setVisibility(View.GONE);
  231.         this.detail_layout.setVisibility(View.GONE);
  232.         this.isExpanded = false;
  233.         printl("&#128316; 工具箱已收起");
  234.     } else {
  235.         // 展开
  236.         this.tools_layout.setVisibility(View.VISIBLE);
  237.         this.isExpanded = true;
  238.         printl("&#128317; 工具箱已展开");
  239.     }
  240. };

  241. // 显示工具详情
  242. 工具箱悬浮窗.prototype.showToolDetail = function(title, description, output) {
  243.     this.tool_title.setText(title);
  244.     this.tool_description.setText(description);
  245.     this.tool_output.setText(output);
  246.     this.detail_layout.setVisibility(View.VISIBLE);
  247.     printl("&#128203; 查看工具: " + title);
  248. };

  249. // 执行当前选中工具
  250. 工具箱悬浮窗.prototype.executeCurrentTool = function() {
  251.     var self = this;
  252.    
  253.     if (!this.currentTool) {
  254.         toast.show("❌ 请先选择一个工具");
  255.         return;
  256.     }
  257.    
  258.     switch(this.currentTool) {
  259.         case "screenshot":
  260.             this.tool_output.setText("&#128248; 正在执行截图...");
  261.             toast.show("&#128248; 截图功能执行中...");
  262.             
  263.             // 模拟截图操作
  264.             setTimeout(function() {
  265.                 self.tool_output.setText("✅ 截图已完成,保存至相册");
  266.                 toast.show("✅ 截图保存成功");
  267.             }, 1500);
  268.             break;
  269.             
  270.         case "ocr":
  271.             this.tool_output.setText("&#128269; 正在初始化OCR识别...");
  272.             toast.show("&#128269; OCR识别准备中...");
  273.             
  274.             // 模拟OCR操作
  275.             setTimeout(function() {
  276.                 self.tool_output.setText("&#128269; 请在屏幕上框选需要识别的区域");
  277.                 toast.show("&#128269; 请框选识别区域");
  278.             }, 1000);
  279.             break;
  280.             
  281.         case "click_record":
  282.             this.tool_output.setText("&#128433;️ 点击录制已启动,点击屏幕任意位置开始录制");
  283.             toast.show("&#128433;️ 点击录制已启动");
  284.             break;
  285.             
  286.         case "color_picker":
  287.             this.tool_output.setText("&#127912; 屏幕取色器已启动,点击屏幕任意位置获取颜色");
  288.             toast.show("&#127912; 取色器已启动");
  289.             break;
  290.             
  291.         default:
  292.             this.tool_output.setText("❌ 未知工具");
  293.             toast.show("❌ 无法执行未知工具");
  294.     }
  295. };

  296. // 设置悬浮窗位置
  297. 工具箱悬浮窗.prototype.setPos = function(x, y) {
  298.     this.ui.setPosition(x, y);
  299.     printl("&#128205; 悬浮窗位置设置为: (" + x + ", " + y + ")");
  300. };

  301. // 关闭悬浮窗
  302. 工具箱悬浮窗.prototype.close = function() {
  303.     this.ui.close();
  304.     printl("✅ 工具箱悬浮窗已关闭");
  305. };

  306. // 启动悬浮窗
  307. try {
  308.     工具箱窗口.create();
  309.     printl("===== 工具箱悬浮窗启动成功 =====");
  310. } catch (err) {
  311.     printl("❌ 工具箱悬浮窗启动失败: " + err);
  312. }
复制代码







欢迎光临 自动发帖软件 (http://www.fatiegongju.com/) Powered by Discuz! X3.2