|
|
IOSÆ»¹û½Å±¾ViewµÄÍêÕû¹¦ÄÜʵÀý
- // 🍎½»Á÷QQȺ711841924Ⱥһ£¬Æ»¹ûÄÚ²âȺ£¬528816639
- // 📱IOSView×ÛºÏÓ¦ÓÃʾÀý - ÖÇÄÜÖúÊÖ¿ØÖÆÌ¨
- // »ùÓÚAIWROK¿ª·¢Æ½Ì¨£¬Õ¹Ê¾IOSViewµÄÍêÕû¹¦ÄÜ
- printl("=== ÖÇÄÜÖúÊÖ¿ØÖÆÌ¨Æô¶¯ÖÐ ===");
- // ´´½¨Ö÷TabView
- var mainTab = new TabView();
- // ÉèÖÃTab±êÌâ
- var tabTitles = ["¿ØÖÆÖÐÐÄ", "ÈÎÎñ¹ÜÀí", "Êý¾Ý¼à¿Ø", "ϵͳÉèÖÃ"];
- mainTab.setTitles(tabTitles);
- // ÏÔʾTabView
- mainTab.show(() => {
- printl("✅ ÖÇÄÜÖúÊÖ¿ØÖÆÌ¨ÒѼÓÔØ");
-
- // Ìí¼Ó¸÷¸öTabÒ³ÃæµÄÄÚÈÝ
- mainTab.addView(0, createControlCenter());
- mainTab.addView(1, createTaskManager());
- mainTab.addView(2, createDataMonitor());
- mainTab.addView(3, createSystemSettings());
-
- printl("✅ ËùÓÐÒ³Ãæ³õʼ»¯Íê³É");
- });
- printl("✅ ÖÇÄÜÖúÊÖ¿ØÖÆÌ¨Æô¶¯³É¹¦");
- // ====================== µÚÒ»Ò³£º¿ØÖÆÖÐÐÄ ======================
- function createControlCenter() {
- var v = new Vertical();
- v.setBackgroundColor(245, 247, 250);
- v.setSpacing(15);
-
- // Ò³Ãæ±êÌâ
- var header = new Horizontal();
- header.setAlignment("center");
-
- var title = new Label();
- title.setText("⚡ ÖÇÄÜ¿ØÖÆÖÐÐÄ");
- title.setTextColor(41, 128, 185);
- title.setFontSize(22);
- header.addView(title);
-
- v.addView(header);
-
- // ·Ö¸ôÏß
- var divider = new Label();
- divider.setHeight(2);
- divider.setBackgroundColor(200, 200, 200);
- v.addView(divider);
-
- // ¿ì½Ý²Ù×÷ÇøÓò
- var quickActions = new Vertical();
- quickActions.setBackgroundColor(255, 255, 255);
-
- var quickTitle = new Label();
- quickTitle.setText("¿ì½Ý²Ù×÷");
- quickTitle.setTextColor(80, 80, 80);
- quickTitle.setFontSize(16);
- quickActions.addView(quickTitle);
-
- // °´Å¥Íø¸ñ
- var buttonGrid = new Horizontal();
- buttonGrid.setSpacing(10);
-
- var btn1 = createQuickButton("🚀 Æô¶¯", 46, 204, 113, () => {
- printl("🚀 Æô¶¯°´Å¥±»µã»÷");
- showToast("ÕýÔÚÆô¶¯·þÎñ...");
- });
- buttonGrid.addView(btn1);
-
- var btn2 = createQuickButton("⏸️ ÔÝÍ£", 241, 196, 15, () => {
- printl("⏸️ ÔÝÍ£°´Å¥±»µã»÷");
- showToast("·þÎñÒÑÔÝÍ£");
- });
- buttonGrid.addView(btn2);
-
- var btn3 = createQuickButton("🔄 ÖØÆô", 52, 152, 219, () => {
- printl("🔄 ÖØÆô°´Å¥±»µã»÷");
- showToast("ÕýÔÚÖØÆô·þÎñ...");
- });
- buttonGrid.addView(btn3);
-
- var btn4 = createQuickButton("⏹️ Í£Ö¹", 231, 76, 60, () => {
- printl("⏹️ Í£Ö¹°´Å¥±»µã»÷");
- showToast("·þÎñÒÑÍ£Ö¹");
- });
- buttonGrid.addView(btn4);
-
- quickActions.addView(buttonGrid);
- v.addView(quickActions);
-
- // ¹¦ÄÜ¿ª¹ØÇøÓò
- var featureSwitches = new Vertical();
- featureSwitches.setBackgroundColor(255, 255, 255);
-
- var switchTitle = new Label();
- switchTitle.setText("¹¦ÄÜ¿ª¹Ø");
- switchTitle.setTextColor(80, 80, 80);
- switchTitle.setFontSize(16);
- featureSwitches.addView(switchTitle);
-
- var switch1 = new CheckBox();
- switch1.setText("ÆôÓÃ×Ô¶¯»¯½Å±¾");
- switch1.setID("auto_script");
- switch1.setDefultSelect();
- featureSwitches.addView(switch1);
-
- var switch2 = new CheckBox();
- switch2.setText("ÆôÓÃÈÕÖ¾¼Ç¼");
- switch2.setID("log_record");
- switch2.setDefultSelect();
- featureSwitches.addView(switch2);
-
- var switch3 = new CheckBox();
- switch3.setText("ÆôÓÃ֪ͨÌáÐÑ");
- switch3.setID("notification");
- featureSwitches.addView(switch3);
-
- var switch4 = new CheckBox();
- switch4.setText("ÆôÓö¨Ê±ÈÎÎñ");
- switch4.setID("scheduled_task");
- featureSwitches.addView(switch4);
-
- v.addView(featureSwitches);
-
- // Ö´Ðа´Å¥
- var executeBtn = new Button();
- executeBtn.setText("Ö´ÐÐÑ¡ÖвÙ×÷");
- executeBtn.setColor(41, 128, 185);
- executeBtn.setTextColor(255, 255, 255);
- executeBtn.setHeight(45);
- executeBtn.onClick(() => {
- var autoScript = switch1.isSelect();
- var logRecord = switch2.isSelect();
- var notification = switch3.isSelect();
- var scheduledTask = switch4.isSelect();
-
- printl("Ö´ÐÐÅäÖÃ:");
- printl(" ×Ô¶¯»¯½Å±¾: " + autoScript);
- printl(" ÈÕÖ¾¼Ç¼: " + logRecord);
- printl(" ֪ͨÌáÐÑ: " + notification);
- printl(" ¶¨Ê±ÈÎÎñ: " + scheduledTask);
-
- showToast("ÅäÖÃÒÑÓ¦ÓÃ");
- });
- v.addView(executeBtn);
-
- // ·µ»Ø°´Å¥
- var backBtn = new Button();
- backBtn.setText("·µ»Ø");
- backBtn.setColor(149, 165, 166);
- backBtn.setTextColor(255, 255, 255);
- backBtn.setHeight(40);
- backBtn.onClick(() => {
- printl("·µ»Ø°´Å¥±»µã»÷");
- mainTab.dismiss();
- });
- v.addView(backBtn);
-
- return v;
- }
- // ====================== µÚ¶þÒ³£ºÈÎÎñ¹ÜÀí ======================
- function createTaskManager() {
- var v = new Vertical();
- v.setBackgroundColor(245, 247, 250);
- v.setSpacing(15);
-
- // Ò³Ãæ±êÌâ
- var header = new Horizontal();
- header.setAlignment("center");
-
- var title = new Label();
- title.setText("📋 ÈÎÎñ¹ÜÀíÖÐÐÄ");
- title.setTextColor(41, 128, 185);
- title.setFontSize(22);
- header.addView(title);
-
- v.addView(header);
-
- // ·Ö¸ôÏß
- var divider = new Label();
- divider.setHeight(2);
- divider.setBackgroundColor(200, 200, 200);
- v.addView(divider);
-
- // ÈÎÎñÊäÈëÇøÓò
- var inputContainer = new Horizontal();
- inputContainer.setAlignment("center_vertical");
-
- var inputLabel = new Label();
- inputLabel.setText("ÐÂÈÎÎñ:");
- inputLabel.setWidth(70);
- inputContainer.addView(inputLabel);
-
- var taskInput = new Input();
- taskInput.setWidth(200);
- taskInput.setID("task_input");
- taskInput.setDefultText("ÊäÈëÈÎÎñÃû³Æ...");
- inputContainer.addView(taskInput);
-
- v.addView(inputContainer);
-
- // ÓÅÏȼ¶Ñ¡Ôñ
- var priorityContainer = new Horizontal();
- priorityContainer.setAlignment("center_vertical");
-
- var priorityLabel = new Label();
- priorityLabel.setText("ÓÅÏȼ¶:");
- priorityLabel.setWidth(70);
- priorityContainer.addView(priorityLabel);
-
- var priorityGroup = new RadioButtonGroup();
- priorityGroup.setID("task_priority");
- priorityGroup.setDefultSelect("ÖÐ");
-
- var highPriority = new RadioButton();
- highPriority.setText("¸ß");
- highPriority.setGroup(priorityGroup);
-
- var mediumPriority = new RadioButton();
- mediumPriority.setText("ÖÐ");
- mediumPriority.setGroup(priorityGroup);
-
- var lowPriority = new RadioButton();
- lowPriority.setText("µÍ");
- lowPriority.setGroup(priorityGroup);
-
- priorityContainer.addView(highPriority);
- priorityContainer.addView(mediumPriority);
- priorityContainer.addView(lowPriority);
-
- v.addView(priorityContainer);
-
- // Ìí¼ÓÈÎÎñ°´Å¥
- var addBtn = new Button();
- addBtn.setText("➕ Ìí¼ÓÈÎÎñ");
- addBtn.setColor(46, 204, 113);
- addBtn.setTextColor(255, 255, 255);
- addBtn.setHeight(40);
- addBtn.onClick(() => {
- var taskName = taskInput.getText();
- var selectedRadio = priorityGroup.currentSelectedRadio();
- var priority = selectedRadio ? selectedRadio.getText() : "";
-
- if (taskName && taskName.length > 0) {
- printl("Ìí¼ÓÈÎÎñ: " + taskName + ", ÓÅÏȼ¶: " + priority);
- showToast("ÈÎÎñÒÑÌí¼Ó: " + taskName);
- taskInput.setText("");
- } else {
- showToast("ÇëÊäÈëÈÎÎñÃû³Æ");
- }
- });
- v.addView(addBtn);
-
- // ÈÎÎñÁбí
- var taskList = new Vertical();
- taskList.setBackgroundColor(255, 255, 255);
-
- var listTitle = new Label();
- listTitle.setText("ÈÎÎñÁбí");
- listTitle.setTextColor(80, 80, 80);
- listTitle.setFontSize(16);
- taskList.addView(listTitle);
-
- // Ìí¼ÓʾÀýÈÎÎñ
- addTaskItem(taskList, "Ö´ÐÐ×Ô¶¯»¯½Å±¾", "¸ß");
- addTaskItem(taskList, "¼ì²éϵͳ״̬", "ÖÐ");
- addTaskItem(taskList, "ÇåÀí»º´æÊý¾Ý", "µÍ");
- addTaskItem(taskList, "¸üÐÂÅäÖÃÎļþ", "ÖÐ");
- addTaskItem(taskList, "Éú³ÉÈÕÖ¾±¨¸æ", "µÍ");
-
- v.addView(taskList);
-
- // ÅúÁ¿²Ù×÷°´Å¥
- var batchContainer = new Horizontal();
- batchContainer.setSpacing(10);
-
- var completeAllBtn = new Button();
- completeAllBtn.setText("È«²¿Íê³É");
- completeAllBtn.setColor(46, 204, 113);
- completeAllBtn.setTextColor(255, 255, 255);
- completeAllBtn.setWidth(100);
- completeAllBtn.setHeight(40);
- completeAllBtn.onClick(() => {
- printl("ËùÓÐÈÎÎñ±ê¼ÇΪÍê³É");
- showToast("ËùÓÐÈÎÎñÒÑÍê³É");
- });
- batchContainer.addView(completeAllBtn);
-
- var clearCompletedBtn = new Button();
- clearCompletedBtn.setText("Çå³ýÒÑÍê³É");
- clearCompletedBtn.setColor(241, 196, 15);
- clearCompletedBtn.setTextColor(50, 50, 50);
- clearCompletedBtn.setWidth(120);
- clearCompletedBtn.setHeight(40);
- clearCompletedBtn.onClick(() => {
- printl("Çå³ýÒÑÍê³ÉÈÎÎñ");
- showToast("ÒÑÍê³ÉÈÎÎñÒÑÇå³ý");
- });
- batchContainer.addView(clearCompletedBtn);
-
- v.addView(batchContainer);
-
- // ·µ»Ø°´Å¥
- var backBtn = new Button();
- backBtn.setText("·µ»Ø");
- backBtn.setColor(149, 165, 166);
- backBtn.setTextColor(255, 255, 255);
- backBtn.setHeight(40);
- backBtn.onClick(() => {
- printl("·µ»Ø°´Å¥±»µã»÷");
- mainTab.dismiss();
- });
- v.addView(backBtn);
-
- return v;
- }
- // ====================== µÚÈýÒ³£ºÊý¾Ý¼à¿Ø ======================
- function createDataMonitor() {
- var v = new Vertical();
- v.setBackgroundColor(245, 247, 250);
- v.setSpacing(15);
-
- // Ò³Ãæ±êÌâ
- var header = new Horizontal();
- header.setAlignment("center");
-
- var title = new Label();
- title.setText("📊 Êý¾Ý¼à¿ØÖÐÐÄ");
- title.setTextColor(41, 128, 185);
- title.setFontSize(22);
- header.addView(title);
-
- v.addView(header);
-
- // ·Ö¸ôÏß
- var divider = new Label();
- divider.setHeight(2);
- divider.setBackgroundColor(200, 200, 200);
- v.addView(divider);
-
- // ʵʱÊý¾Ýͳ¼Æ
- var statsContainer = new Vertical();
- statsContainer.setBackgroundColor(255, 255, 255);
-
- var statsTitle = new Label();
- statsTitle.setText("ʵʱÊý¾Ý");
- statsTitle.setTextColor(80, 80, 80);
- statsTitle.setFontSize(16);
- statsContainer.addView(statsTitle);
-
- // Êý¾ÝÏî
- addStatItem(statsContainer, "ÔËÐÐʱ¼ä", "2Сʱ35·ÖÖÓ", 52, 152, 219);
- addStatItem(statsContainer, "Ö´ÐÐÈÎÎñÊý", "128", 46, 204, 113);
- addStatItem(statsContainer, "³É¹¦ÂÊ", "98.5%", 155, 89, 182);
- addStatItem(statsContainer, "ÄÚ´æÊ¹ÓÃ", "256MB", 241, 196, 15);
- addStatItem(statsContainer, "CPUÕ¼ÓÃ", "12%", 231, 76, 60);
-
- v.addView(statsContainer);
-
- // ·ÖÀàͳ¼Æ
- var categoryContainer = new Vertical();
- categoryContainer.setBackgroundColor(255, 255, 255);
-
- var categoryTitle = new Label();
- categoryTitle.setText("·ÖÀàͳ¼Æ");
- categoryTitle.setTextColor(80, 80, 80);
- categoryTitle.setFontSize(16);
- categoryContainer.addView(categoryTitle);
-
- addStatItem(categoryContainer, "×Ô¶¯»¯ÈÎÎñ", "45", 52, 152, 219);
- addStatItem(categoryContainer, "Êý¾Ý´¦Àí", "32", 46, 204, 113);
- addStatItem(categoryContainer, "ÍøÂçÇëÇó", "28", 155, 89, 182);
- addStatItem(categoryContainer, "Îļþ²Ù×÷", "23", 241, 196, 15);
-
- v.addView(categoryContainer);
-
- // ˢа´Å¥
- var refreshBtn = new Button();
- refreshBtn.setText("🔄 Ë¢ÐÂÊý¾Ý");
- refreshBtn.setColor(52, 152, 219);
- refreshBtn.setTextColor(255, 255, 255);
- refreshBtn.setHeight(45);
- refreshBtn.onClick(() => {
- printl("Êý¾ÝÒÑË¢ÐÂ");
- showToast("Êý¾ÝÒѸüÐÂ");
- });
- v.addView(refreshBtn);
-
- // µ¼³ö°´Å¥
- var exportBtn = new Button();
- exportBtn.setText("📥 µ¼³ö±¨¸æ");
- exportBtn.setColor(155, 89, 182);
- exportBtn.setTextColor(255, 255, 255);
- exportBtn.setHeight(45);
- exportBtn.onClick(() => {
- printl("µ¼³öÊý¾Ý±¨¸æ");
- showToast("±¨¸æÒѵ¼³ö");
- });
- v.addView(exportBtn);
-
- // ·µ»Ø°´Å¥
- var backBtn = new Button();
- backBtn.setText("·µ»Ø");
- backBtn.setColor(149, 165, 166);
- backBtn.setTextColor(255, 255, 255);
- backBtn.setHeight(40);
- backBtn.onClick(() => {
- printl("·µ»Ø°´Å¥±»µã»÷");
- mainTab.dismiss();
- });
- v.addView(backBtn);
-
- return v;
- }
- // ====================== µÚËÄÒ³£ºÏµÍ³ÉèÖà ======================
- function createSystemSettings() {
- var v = new Vertical();
- v.setBackgroundColor(245, 247, 250);
- v.setSpacing(15);
-
- // Ò³Ãæ±êÌâ
- var header = new Horizontal();
- header.setAlignment("center");
-
- var title = new Label();
- title.setText("⚙️ ϵͳÉèÖÃ");
- title.setTextColor(41, 128, 185);
- title.setFontSize(22);
- header.addView(title);
-
- v.addView(header);
-
- // ·Ö¸ôÏß
- var divider = new Label();
- divider.setHeight(2);
- divider.setBackgroundColor(200, 200, 200);
- v.addView(divider);
-
- // »ù±¾ÉèÖÃ
- var basicSettings = new Vertical();
- basicSettings.setBackgroundColor(255, 255, 255);
-
- var basicTitle = new Label();
- basicTitle.setText("»ù±¾ÉèÖÃ");
- basicTitle.setTextColor(80, 80, 80);
- basicTitle.setFontSize(16);
- basicSettings.addView(basicTitle);
-
- var autoSaveCheck = new CheckBox();
- autoSaveCheck.setText("×Ô¶¯±£´æÅäÖÃ");
- autoSaveCheck.setID("auto_save");
- autoSaveCheck.setDefultSelect();
- basicSettings.addView(autoSaveCheck);
-
- var autoStartCheck = new CheckBox();
- autoStartCheck.setText("¿ª»ú×Ô¶¯Æô¶¯");
- autoStartCheck.setID("auto_start");
- basicSettings.addView(autoStartCheck);
-
- var debugModeCheck = new CheckBox();
- debugModeCheck.setText("µ÷ÊÔģʽ");
- debugModeCheck.setID("debug_mode");
- basicSettings.addView(debugModeCheck);
-
- v.addView(basicSettings);
-
- // ֪ͨÉèÖÃ
- var notificationSettings = new Vertical();
- notificationSettings.setBackgroundColor(255, 255, 255);
-
- var notifTitle = new Label();
- notifTitle.setText("֪ͨÉèÖÃ");
- notifTitle.setTextColor(80, 80, 80);
- notifTitle.setFontSize(16);
- notificationSettings.addView(notifTitle);
-
- var soundCheck = new CheckBox();
- soundCheck.setText("ÆôÓÃÉùÒôÌáʾ");
- soundCheck.setID("sound_enable");
- soundCheck.setDefultSelect();
- notificationSettings.addView(soundCheck);
-
- var vibrationCheck = new CheckBox();
- vibrationCheck.setText("ÆôÓÃÕ𶯷´À¡");
- vibrationCheck.setID("vibration_enable");
- vibrationCheck.setDefultSelect();
- notificationSettings.addView(vibrationCheck);
-
- var popupCheck = new CheckBox();
- popupCheck.setText("ÏÔʾµ¯´°Í¨Öª");
- popupCheck.setID("popup_enable");
- popupCheck.setDefultSelect();
- notificationSettings.addView(popupCheck);
-
- v.addView(notificationSettings);
-
- // Ö÷ÌâÉèÖÃ
- var themeContainer = new Horizontal();
- themeContainer.setAlignment("center");
- themeContainer.setSpacing(15);
-
- var themeLabel = new Label();
- themeLabel.setText("Ö÷ÌâÑÕÉ«:");
- themeLabel.setTextColor(80, 80, 80);
- themeContainer.addView(themeLabel);
-
- var lightThemeBtn = new Button();
- lightThemeBtn.setText("dzɫ");
- lightThemeBtn.setColor(255, 255, 255);
- lightThemeBtn.setTextColor(50, 50, 50);
- lightThemeBtn.setWidth(80);
- lightThemeBtn.setHeight(40);
- lightThemeBtn.onClick(() => {
- printl("Çл»µ½Ç³É«Ö÷Ìâ");
- showToast("ÒÑÇл»µ½Ç³É«Ö÷Ìâ");
- });
- themeContainer.addView(lightThemeBtn);
-
- var darkThemeBtn = new Button();
- darkThemeBtn.setText("ÉîÉ«");
- darkThemeBtn.setColor(50, 50, 50);
- darkThemeBtn.setTextColor(255, 255, 255);
- darkThemeBtn.setWidth(80);
- darkThemeBtn.setHeight(40);
- darkThemeBtn.onClick(() => {
- printl("Çл»µ½ÉîÉ«Ö÷Ìâ");
- showToast("ÒÑÇл»µ½ÉîÉ«Ö÷Ìâ");
- });
- themeContainer.addView(darkThemeBtn);
-
- v.addView(themeContainer);
-
- // Êý¾Ý¹ÜÀí
- var dataContainer = new Vertical();
-
- var backupBtn = new Button();
- backupBtn.setText("💾 ±¸·ÝÊý¾Ý");
- backupBtn.setColor(52, 152, 219);
- backupBtn.setTextColor(255, 255, 255);
- backupBtn.setHeight(40);
- backupBtn.onClick(() => {
- printl("±¸·ÝÊý¾ÝÖÐ...");
- showToast("Êý¾Ý±¸·ÝÖÐ...");
- });
- dataContainer.addView(backupBtn);
-
- var restoreBtn = new Button();
- restoreBtn.setText("📂 »Ö¸´Êý¾Ý");
- restoreBtn.setColor(155, 89, 182);
- restoreBtn.setTextColor(255, 255, 255);
- restoreBtn.setHeight(40);
- restoreBtn.onClick(() => {
- printl("»Ö¸´Êý¾ÝÖÐ...");
- showToast("Êý¾Ý»Ö¸´ÖÐ...");
- });
- dataContainer.addView(restoreBtn);
-
- var clearDataBtn = new Button();
- clearDataBtn.setText("🗑️ Çå³ýÊý¾Ý");
- clearDataBtn.setColor(231, 76, 60);
- clearDataBtn.setTextColor(255, 255, 255);
- clearDataBtn.setHeight(40);
- clearDataBtn.onClick(() => {
- printl("Çå³ýËùÓÐÊý¾Ý");
- showToast("Êý¾ÝÒÑÇå³ý");
- });
- dataContainer.addView(clearDataBtn);
-
- v.addView(dataContainer);
-
- // ±£´æÉèÖð´Å¥
- var saveBtn = new Button();
- saveBtn.setText("💾 ±£´æÉèÖÃ");
- saveBtn.setColor(46, 204, 113);
- saveBtn.setTextColor(255, 255, 255);
- saveBtn.setHeight(45);
- saveBtn.onClick(() => {
- printl("ÉèÖÃÒѱ£´æ");
- showToast("ÉèÖÃÒѱ£´æ");
- });
- v.addView(saveBtn);
-
- // ·µ»Ø°´Å¥
- var backBtn = new Button();
- backBtn.setText("·µ»Ø");
- backBtn.setColor(149, 165, 166);
- backBtn.setTextColor(255, 255, 255);
- backBtn.setHeight(40);
- backBtn.onClick(() => {
- printl("·µ»Ø°´Å¥±»µã»÷");
- mainTab.dismiss();
- });
- v.addView(backBtn);
-
- // ¹ØÓÚÐÅÏ¢
- var aboutLabel = new Label();
- aboutLabel.setText("ÖÇÄÜÖúÊÖ¿ØÖÆÌ¨ v1.0\n»ùÓÚAIWROK¿ª·¢Æ½Ì¨");
- aboutLabel.setTextColor(120, 120, 120);
- aboutLabel.setFontSize(12);
- aboutLabel.setTextAlignment("center");
- v.addView(aboutLabel);
-
- return v;
- }
- // ====================== ¸¨Öúº¯Êý ======================
- // ´´½¨¿ì½Ý°´Å¥
- function createQuickButton(text, r, g, b, onClick) {
- var btn = new Button();
- btn.setText(text);
- btn.setColor(r, g, b);
- btn.setTextColor(255, 255, 255);
- btn.setWidth(80);
- btn.setHeight(50);
- btn.onClick(onClick);
- return btn;
- }
- // Ìí¼ÓÈÎÎñÏî
- function addTaskItem(container, taskName, priority) {
- var item = new Horizontal();
- item.setAlignment("center_vertical");
-
- var checkBox = new CheckBox();
- checkBox.setText(taskName);
- checkBox.setWidth(180);
- item.addView(checkBox);
-
- var priorityLabel = new Label();
- priorityLabel.setText(priority);
- priorityLabel.setWidth(50);
-
- if (priority === "¸ß") {
- priorityLabel.setTextColor(231, 76, 60);
- } else if (priority === "ÖÐ") {
- priorityLabel.setTextColor(241, 196, 15);
- } else {
- priorityLabel.setTextColor(46, 204, 113);
- }
-
- item.addView(priorityLabel);
-
- var deleteBtn = new Button();
- deleteBtn.setText("ɾ³ý");
- deleteBtn.setColor(231, 76, 60);
- deleteBtn.setTextColor(255, 255, 255);
- deleteBtn.setWidth(60);
- deleteBtn.setHeight(30);
- deleteBtn.onClick(() => {
- printl("ɾ³ýÈÎÎñ: " + taskName);
- showToast("ÈÎÎñÒÑɾ³ý");
- });
- item.addView(deleteBtn);
-
- container.addView(item);
- }
- // Ìí¼Óͳ¼ÆÏî
- function addStatItem(container, label, value, r, g, b) {
- var item = new Horizontal();
- item.setAlignment("space_between");
- item.setSpacing(10);
-
- var labelView = new Label();
- labelView.setText(label);
- labelView.setTextColor(80, 80, 80);
- labelView.setWidth(120);
- item.addView(labelView);
-
- var valueView = new Label();
- valueView.setText(value);
- valueView.setTextColor(r, g, b);
- valueView.setTextAlignment("right");
- item.addView(valueView);
-
- container.addView(item);
- }
- // ÏÔʾÌáʾÐÅÏ¢
- function showToast(message) {
- printl("Ìáʾ: " + message);
- }
- // ÈÕÖ¾Êä³öº¯Êý
- function printl(message) {
- console.log("[ÖÇÄÜÖúÊÖ] " + message);
- }
¸´ÖÆ´úÂë
|
|