|
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);
- }
¸´ÖÆ´úÂë
|
|