|
|
ÔÉúUIAIWROKÈí¼þʼþ¼àÌýʾÀý
- /**
- * AIWROK ʼþ¼àÌýʾÀý
- * ÑÝʾ¸÷ÖÖϵͳʼþ¼àÌý¹¦ÄÜ£º¹ã²¥¡¢Í¨Öª¡¢°´Å¥Ê¼þ¡¢ToastµÈ
- */
- var ac = new activity();
- ac.loadSXML(`
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="16dp"
- android:background="#f5f5f5">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="AIWROK ʼþ¼àÌýʾÀý"
- android:textSize="24sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:gravity="center"
- android:layout_marginBottom="10dp"/>
- <!-- QQȺÐÅÏ¢ -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:background="#FFF3E0"
- android:padding="10dp"
- android:layout_marginBottom="15dp">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="🍎🍎£º711841924"
- android:textSize="14sp"
- android:textColor="#E65100"
- android:gravity="center"
- android:layout_marginBottom="5dp"/>
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="🍎🍎2£º528816639"
- android:textSize="14sp"
- android:textColor="#E65100"
- android:gravity="center"/>
- </LinearLayout>
- <!-- ¼àÌý״̬ÏÔʾ -->
- <TextView
- android:id="@+id/tvListenerStatus"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="¼àÌý״̬: δÆô¶¯"
- android:textSize="16sp"
- android:textColor="#666666"
- android:gravity="center"
- android:padding="10dp"
- android:background="#ffffff"
- android:layout_marginBottom="15dp"/>
- <!-- ¹ã²¥Ê¼þ¼àÌý -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="📡 ¹ã²¥Ê¼þ¼àÌý"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
- <Button
- android:id="@+id/btnBroadcast"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="·¢ËͲâÊԹ㲥"
- android:background="#2196F3"
- android:textColor="#ffffff"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:id="@+id/tvBroadcastLog"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="¹ã²¥ÈÕÖ¾½«ÏÔʾÔÚÕâÀï..."
- android:textSize="14sp"
- android:textColor="#666666"
- android:padding="10dp"
- android:background="#ffffff"
- android:layout_marginBottom="20dp"/>
- <!-- ֪ͨʼþ¼àÌý -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="🔔 ֪ͨʼþ¼àÌý"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="¿ªÆôºó½«¼àÌýϵͳ֪ͨ£¬°´Å¥´¥·¢Ä£Äâ֪ͨ"
- android:textSize="14sp"
- android:textColor="#999999"
- android:layout_marginBottom="10dp"/>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_marginBottom="10dp">
- <Button
- android:id="@+id/btnStartNotificationListener"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="¿ªÆô¼àÌý"
- android:background="#4CAF50"
- android:textColor="#ffffff"
- android:layout_marginRight="5dp"/>
- <Button
- android:id="@+id/btnStopNotificationListener"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="¹Ø±Õ¼àÌý"
- android:background="#F44336"
- android:textColor="#ffffff"
- android:layout_marginLeft="5dp"/>
- </LinearLayout>
- <Button
- android:id="@+id/btnSimulateNotification"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Ä£Äâ֪ͨʼþ"
- android:background="#9C27B0"
- android:textColor="#ffffff"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:id="@+id/tvNotificationLog"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="֪ͨÈÕÖ¾½«ÏÔʾÔÚÕâÀï..."
- android:textSize="14sp"
- android:textColor="#666666"
- android:padding="10dp"
- android:background="#ffffff"
- android:layout_marginBottom="20dp"/>
- <!-- °´Å¥Ê¼þ¼àÌý -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="⏸️ ÔÝÍ£/Í£Ö¹°´Å¥Ê¼þ"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="¼àÌý½Å±¾ÔËÐÐʱµÄÔÝÍ£ºÍÍ£Ö¹°´Å¥"
- android:textSize="14sp"
- android:textColor="#999999"
- android:layout_marginBottom="10dp"/>
- <Button
- android:id="@+id/btnTestPause"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Ä£ÄâÔÝÍ£°´Å¥"
- android:background="#FF9800"
- android:textColor="#ffffff"
- android:layout_marginBottom="10dp"/>
- <Button
- android:id="@+id/btnTestStop"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Ä£ÄâÍ£Ö¹°´Å¥"
- android:background="#F44336"
- android:textColor="#ffffff"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:id="@+id/tvBtnEventLog"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="°´Å¥Ê¼þÈÕÖ¾½«ÏÔʾÔÚÕâÀï..."
- android:textSize="14sp"
- android:textColor="#666666"
- android:padding="10dp"
- android:background="#ffffff"
- android:layout_marginBottom="20dp"/>
- <!-- Toastʼþ¼àÌý -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="🍞 Toastʼþ¼àÌý"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="¼àÌý½Å±¾ÖÐÏÔʾµÄToastÏûÏ¢"
- android:textSize="14sp"
- android:textColor="#999999"
- android:layout_marginBottom="10dp"/>
- <Button
- android:id="@+id/btnShowToast"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="ÏÔʾToastÏûÏ¢"
- android:background="#795548"
- android:textColor="#ffffff"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:id="@+id/tvToastLog"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="ToastÈÕÖ¾½«ÏÔʾÔÚÕâÀï..."
- android:textSize="14sp"
- android:textColor="#666666"
- android:padding="10dp"
- android:background="#ffffff"
- android:layout_marginBottom="20dp"/>
- <!-- ÈÈÐÞ¸´Íê³Éʼþ -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="🔧 ÈÈÐÞ¸´Íê³Éʼþ"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
- <Button
- android:id="@+id/btnSimulateHotfix"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Ä£ÄâÈÈÐÞ¸´Íê³É"
- android:background="#009688"
- android:textColor="#ffffff"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:id="@+id/tvHotfixLog"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="ÈÈÐÞ¸´ÈÕÖ¾½«ÏÔʾÔÚÕâÀï..."
- android:textSize="14sp"
- android:textColor="#666666"
- android:padding="10dp"
- android:background="#ffffff"
- android:layout_marginBottom="20dp"/>
- <!-- ½Å±¾Í£Ö¹Ê¼þ -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="⏹️ ½Å±¾Í£Ö¹Ê¼þ"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
- <Button
- android:id="@+id/btnSimulateStop"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Ä£Äâ½Å±¾Í£Ö¹"
- android:background="#607D8B"
- android:textColor="#ffffff"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:id="@+id/tvStopLog"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="ֹͣʼþÈÕÖ¾½«ÏÔʾÔÚÕâÀï..."
- android:textSize="14sp"
- android:textColor="#666666"
- android:padding="10dp"
- android:background="#ffffff"
- android:layout_marginBottom="20dp"/>
- <!-- ÈÕÖ¾ÏÔÊ¾ÇøÓò -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="📋 ×ÛºÏÈÕÖ¾"
- android:textSize="16sp"
- android:textStyle="bold"
- android:textColor="#333333"
- android:layout_marginBottom="10dp"/>
- <TextView
- android:id="@+id/tvLog"
- android:layout_width="match_parent"
- android:layout_height="200dp"
- android:text="×ÛºÏÈÕÖ¾½«ÏÔʾÔÚÕâÀï...\n\nÌáʾ£º\n1. µã»÷ÉÏ·½¸÷ÇøÓò°´Å¥¿ÉÄ£Äâ¶ÔӦʼþ\n2. ʵ¼ÊʹÓÃʱÕâЩʼþÓÉϵͳ×Ô¶¯´¥·¢\n3. ±¾Ê¾Àý°ïÖúÄãÀí½âʼþ¼àÌýµÄʹÓ÷½·¨"
- android:textSize="14sp"
- android:textColor="#666666"
- android:padding="10dp"
- android:background="#ffffff"
- android:scrollbars="vertical"
- android:gravity="top"/>
- </LinearLayout>
- </ScrollView>
- `);
- // ÈÕÖ¾Ðü¸¡´°
- var ÈÕÖ¾Ðü¸¡´° = new floatUI();
- ÈÕÖ¾Ðü¸¡´°.loadXML(
- '<LinearLayout orientation="vertical" w="8" h="8" gravity="center">' +
- ' <TextView id="rz" textColor="#ff3ee4" background="#000000" layout_width="wrap_content" layout_height="wrap_content" />' +
- '</LinearLayout>'
- );
- var g_ÈÕÖ¾ = ÈÕÖ¾Ðü¸¡´°.findViewById('rz');
- if (g_ÈÕÖ¾) {
- setTimeout(function() {
- ÈÕÖ¾Ðü¸¡´°.setPosition(0, (screen.getScreenHeight() * 0.4));
- g_ÈÕÖ¾.setText("¼àÌýʾÀýÒÑÆô¶¯");
- }, 100);
- }
- // »ñÈ¡¿Ø¼þ
- var tvListenerStatus = ac.findViewById("tvListenerStatus");
- var btnBroadcast = ac.findViewById("btnBroadcast");
- var tvBroadcastLog = ac.findViewById("tvBroadcastLog");
- var btnStartNotificationListener = ac.findViewById("btnStartNotificationListener");
- var btnStopNotificationListener = ac.findViewById("btnStopNotificationListener");
- var btnSimulateNotification = ac.findViewById("btnSimulateNotification");
- var tvNotificationLog = ac.findViewById("tvNotificationLog");
- var btnTestPause = ac.findViewById("btnTestPause");
- var btnTestStop = ac.findViewById("btnTestStop");
- var tvBtnEventLog = ac.findViewById("tvBtnEventLog");
- var btnShowToast = ac.findViewById("btnShowToast");
- var tvToastLog = ac.findViewById("tvToastLog");
- var btnSimulateHotfix = ac.findViewById("btnSimulateHotfix");
- var tvHotfixLog = ac.findViewById("tvHotfixLog");
- var btnSimulateStop = ac.findViewById("btnSimulateStop");
- var tvStopLog = ac.findViewById("tvStopLog");
- var tvLog = ac.findViewById("tvLog");
- // ±ê¼Ç½Å±¾ÊÇ·ñÕýÔÚÔËÐÐ
- var isScriptRunning = true;
- // ÈÕÖ¾¼Ç¼º¯Êý
- function logToAll(source, message) {
- // Êä³öµ½¿ØÖÆÌ¨£¨×ÜÊÇÖ´ÐУ©
- console.log("[" + source + "] " + message);
- // Èç¹û½Å±¾ÒÑÍ£Ö¹»òUIÒÑÏú»Ù£¬²»ÔÙ¸üнçÃæ
- if (!isScriptRunning || !tvLog) {
- return;
- }
- var timestamp = new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date());
- var logEntry = "[" + timestamp + "] " + message;
- // ¸üÐÂ×ÛºÏÈÕÖ¾
- try {
- var currentLog = tvLog.getText();
- if (!currentLog) {
- currentLog = "";
- }
- currentLog = String(currentLog);
- var lines = currentLog.split("\n");
- // ¹ýÂË¿ÕÐÐ
- while (lines.length > 0 && lines[0] === "") {
- lines.shift();
- }
- if (lines.length > 50) {
- lines = lines.slice(-50);
- }
- lines.push(logEntry);
- tvLog.setText(lines.join("\n"));
- } catch (e) {
- // UI¿ÉÄÜÒÑÏú»Ù£¬ºöÂÔ´íÎó
- console.log("¸üÐÂÈÕ־ʧ°Ü: " + e);
- }
- // ¸üÐÂÐü¸¡´°
- if (g_ÈÕÖ¾) {
- try {
- g_ÈÕÖ¾.setText(source + ": " + message);
- } catch (e) {
- // ºöÂÔ
- }
- }
- }
- // °²È«ÉèÖÃÎı¾µÄ¸¨Öúº¯Êý
- function safeSetText(view, text) {
- if (!isScriptRunning || !view) {
- return;
- }
- try {
- view.setText(text);
- } catch (e) {
- // UI¿ÉÄÜÒÑÏú»Ù£¬ºöÂÔ´íÎó
- }
- }
- // ¸üмàÌý״̬
- function updateStatus(status) {
- console.log("¼àÌý״̬: " + status);
- safeSetText(tvListenerStatus, "¼àÌý״̬: " + status);
- }
- // ==================== ÉèÖÃʼþ¼àÌýÆ÷ ====================
- // 1. ¹ã²¥Ê¼þ¼àÌý
- try {
- event.onBroadcastEvent(function(msg) {
- logToAll("¹ã²¥", "ÊÕµ½¹ã²¥: " + msg);
- safeSetText(tvBroadcastLog, "ÊÕµ½¹ã²¥: " + msg);
- });
- logToAll("ϵͳ", "✅ ¹ã²¥Ê¼þ¼àÌýÆ÷ÒÑÉèÖÃ");
- } catch (e) {
- logToAll("´íÎó", "ÉèÖù㲥¼àÌýʧ°Ü: " + e);
- }
- // 2. ֪ͨʼþ¼àÌý
- var notificationListenerEnabled = false;
- try {
- event.onNotificationEvent(function(notification) {
- try {
- var title = notification.getTitle ? notification.getTitle() : "ÎÞ±êÌâ";
- var text = notification.getText ? notification.getText() : "ÎÞÄÚÈÝ";
- logToAll("֪ͨ", "ÊÕµ½Í¨Öª - ±êÌâ: " + title + ", ÄÚÈÝ: " + text);
- safeSetText(tvNotificationLog, "ÊÕµ½Í¨Öª\n±êÌâ: " + title + "\nÄÚÈÝ: " + text);
- } catch (e) {
- logToAll("֪ͨ", "´¦Àí֪ͨʧ°Ü: " + e);
- }
- });
- logToAll("ϵͳ", "✅ ֪ͨʼþ¼àÌýÆ÷ÒÑÉèÖÃ");
- } catch (e) {
- logToAll("´íÎó", "ÉèÖÃ֪ͨ¼àÌýʧ°Ü: " + e);
- }
- // 3. ÔÝÍ£°´Å¥Ê¼þ¼àÌý
- try {
- event.onPauseBtnEvent(function() {
- logToAll("°´Å¥", "ÔÝÍ£°´Å¥±»µã»÷");
- safeSetText(tvBtnEventLog, "ÔÝÍ£°´Å¥±»µã»÷\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- logToAll("ϵͳ", "✅ ÔÝÍ£°´Å¥Ê¼þ¼àÌýÆ÷ÒÑÉèÖÃ");
- } catch (e) {
- logToAll("´íÎó", "ÉèÖÃÔÝÍ£°´Å¥¼àÌýʧ°Ü: " + e);
- }
- // 4. Í£Ö¹°´Å¥Ê¼þ¼àÌý
- try {
- event.onStopBtnEvent(function() {
- logToAll("°´Å¥", "Í£Ö¹°´Å¥±»µã»÷");
- safeSetText(tvBtnEventLog, "Í£Ö¹°´Å¥±»µã»÷\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- logToAll("ϵͳ", "✅ Í£Ö¹°´Å¥Ê¼þ¼àÌýÆ÷ÒÑÉèÖÃ");
- } catch (e) {
- logToAll("´íÎó", "ÉèÖÃÍ£Ö¹°´Å¥¼àÌýʧ°Ü: " + e);
- }
- // 5. ½Å±¾Í£Ö¹Ê¼þ¼àÌý
- try {
- event.onStopEvent(function() {
- isScriptRunning = false;
- console.log("½Å±¾Í£Ö¹Ê¼þ´¥·¢£¬Í£Ö¹¸üÐÂUI");
- safeSetText(tvStopLog, "½Å±¾Í£Ö¹Ê¼þ´¥·¢\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- logToAll("ϵͳ", "✅ ½Å±¾Í£Ö¹Ê¼þ¼àÌýÆ÷ÒÑÉèÖÃ");
- } catch (e) {
- logToAll("´íÎó", "ÉèÖýű¾Í£Ö¹¼àÌýʧ°Ü: " + e);
- }
- // 6. Toastʼþ¼àÌý
- try {
- event.onToastEvent(function(msg) {
- logToAll("Toast", "ÊÕµ½Toast: " + msg);
- safeSetText(tvToastLog, "ÊÕµ½Toast: " + msg);
- });
- logToAll("ϵͳ", "✅ Toastʼþ¼àÌýÆ÷ÒÑÉèÖÃ");
- } catch (e) {
- logToAll("´íÎó", "ÉèÖÃToast¼àÌýʧ°Ü: " + e);
- }
- // 7. ÈÈÐÞ¸´Íê³Éʼþ¼àÌý
- try {
- event.onHotfixFinish(function(success) {
- var result = success ? "³É¹¦" : "ʧ°Ü";
- logToAll("ÈÈÐÞ¸´", "ÈÈÐÞ¸´Íê³É£¬½á¹û: " + result);
- safeSetText(tvHotfixLog, "ÈÈÐÞ¸´Íê³É\n½á¹û: " + result + "\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- logToAll("ϵͳ", "✅ ÈÈÐÞ¸´Íê³Éʼþ¼àÌýÆ÷ÒÑÉèÖÃ");
- } catch (e) {
- logToAll("´íÎó", "ÉèÖÃÈÈÐÞ¸´¼àÌýʧ°Ü: " + e);
- }
- // ==================== °´Å¥µã»÷ʼþ ====================
- // ·¢ËͲâÊԹ㲥
- btnBroadcast.setOnClickListener(function() {
- logToAll("²âÊÔ", "·¢ËͲâÊԹ㲥");
- safeSetText(tvBroadcastLog, "ÒÑ·¢ËͲâÊԹ㲥\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- // ʵ¼Ê·¢Ë͹㲥
- try {
- if (typeof broadcast !== 'undefined') {
- broadcast.send("test_broadcast");
- }
- } catch (e) {
- logToAll("´íÎó", "·¢Ë͹㲥ʧ°Ü: " + e);
- }
- });
- // ¿ªÆô֪ͨ¼àÌý
- btnStartNotificationListener.setOnClickListener(function() {
- notificationListenerEnabled = true;
- logToAll("²âÊÔ", "֪ͨ¼àÌýÒÑ¿ªÆô");
- safeSetText(tvNotificationLog, "֪ͨ¼àÌýÒÑ¿ªÆô\nµÈ´ýϵͳ֪ͨ...");
- });
- // ¹Ø±Õ֪ͨ¼àÌý
- btnStopNotificationListener.setOnClickListener(function() {
- notificationListenerEnabled = false;
- logToAll("²âÊÔ", "֪ͨ¼àÌýÒѹرÕ");
- safeSetText(tvNotificationLog, "֪ͨ¼àÌýÒѹرÕ");
- });
- // Ä£Äâ֪ͨʼþ
- btnSimulateNotification.setOnClickListener(function() {
- logToAll("²âÊÔ", "Ä£Äâ֪ͨʼþ");
- safeSetText(tvNotificationLog, "Ä£Äâ֪ͨ\n±êÌâ: ²âÊÔ֪ͨ\nÄÚÈÝ: ÕâÊÇÒ»ÌõÄ£ÄâµÄ֪ͨÏûÏ¢\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- // Ä£ÄâÔÝÍ£°´Å¥
- btnTestPause.setOnClickListener(function() {
- logToAll("²âÊÔ", "Ä£ÄâÔÝÍ£°´Å¥µã»÷");
- safeSetText(tvBtnEventLog, "Ä£ÄâÔÝÍ£°´Å¥µã»÷\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- // Ä£ÄâÍ£Ö¹°´Å¥
- btnTestStop.setOnClickListener(function() {
- logToAll("²âÊÔ", "Ä£ÄâÍ£Ö¹°´Å¥µã»÷");
- safeSetText(tvBtnEventLog, "Ä£ÄâÍ£Ö¹°´Å¥µã»÷\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- // ÏÔʾToast
- btnShowToast.setOnClickListener(function() {
- var toastMsg = "²âÊÔToastÏûÏ¢ - " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date());
- logToAll("²âÊÔ", "ÏÔʾToast: " + toastMsg);
- safeSetText(tvToastLog, "ÏÔʾToast: " + toastMsg);
- // ʵ¼ÊÏÔʾToast£¨Ê¹ÓüæÈÝ·½Ê½£©
- try {
- // ³¢ÊÔʹÓÃui.toast·½·¨
- if (typeof ui !== 'undefined' && typeof ui.toast === 'function') {
- ui.toast(toastMsg);
- }
- // ³¢ÊÔʹÓÃtoast.show·½·¨
- else if (typeof toast !== 'undefined' && typeof toast.show === 'function') {
- toast.show(toastMsg);
- }
- // Èç¹ûÒÔÉÏ·½·¨¶¼²»¿ÉÓã¬Ê¹ÓÃprintlÊä³öÏûÏ¢
- else {
- printl("ToastÏûÏ¢: " + toastMsg);
- }
- } catch (e) {
- logToAll("´íÎó", "ÏÔʾToastʧ°Ü: " + e);
- // ³ö´íʱʹÓÃprintl×÷Ϊ±¸Ó÷½°¸
- printl("ToastÏûÏ¢: " + toastMsg);
- }
- });
- // Ä£ÄâÈÈÐÞ¸´Íê³É
- btnSimulateHotfix.setOnClickListener(function() {
- logToAll("²âÊÔ", "Ä£ÄâÈÈÐÞ¸´Íê³Éʼþ");
- safeSetText(tvHotfixLog, "Ä£ÄâÈÈÐÞ¸´Íê³É\n½á¹û: ³É¹¦\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- // Ä£Äâ½Å±¾Í£Ö¹
- btnSimulateStop.setOnClickListener(function() {
- logToAll("²âÊÔ", "Ä£Äâ½Å±¾Í£Ö¹Ê¼þ");
- safeSetText(tvStopLog, "Ä£Äâ½Å±¾Í£Ö¹Ê¼þ\nʱ¼ä: " + new java.text.SimpleDateFormat("HH:mm:ss").format(new java.util.Date()));
- });
- // ³õʼ»¯Íê³É
- updateStatus("ÒÑÆô¶¯");
- logToAll("ϵͳ", "ʼþ¼àÌýʾÀýÒÑÆô¶¯£¬ËùÓмàÌýÆ÷ÒÑÉèÖÃÍê±Ï");
- console.log("✅ AIWROKʼþ¼àÌýʾÀýÒÑÆô¶¯");
¸´ÖÆ´úÂë
|
|