优化目标达成弹窗
authorluozheng <1732036298@qq.com>
Fri, 6 Feb 2026 12:23:18 +0000 (20:23 +0800)
committerluozheng <1732036298@qq.com>
Fri, 6 Feb 2026 12:23:18 +0000 (20:23 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp
code/sdk/application/wearable/fd272/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/fd272/service/msg_center/src/notify/goal_notification.cpp
code/sdk/zhihui/utils/custom_utils_at_cmd.c
code/sdk/zhihui/utilscpp/custom_utilscpp.cpp

index e6d41d1..76b4172 100644 (file)
@@ -259,7 +259,7 @@ extern "C"
         }\r
         broadcastApi->PublishTopic((IUnknown *)broadcastApi, &request);\r
         broadcastApi->Release((IUnknown *)broadcastApi);\r
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish end!!");\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmEventPublish end!!");\r
 \r
         return;\r
     }\r
index 8e9e857..d5b3010 100644 (file)
      #ifdef SUPPORT_BLE_SERVICE
      //unused(req);
      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyBindProc Bind!");
-     // const power_display_svr_api_t *display_api = power_display_svr_get_api();
-     // if (display_api->get_screen_state() != SCREEN_ON)
-     // {
-     //     display_api->turn_on_screen();
-     // }
+     const power_display_svr_api_t *display_api = power_display_svr_get_api();
+     if (display_api->get_screen_state() != SCREEN_ON)
+     {
+         display_api->turn_on_screen();
+     }
      uint8_t* data=(uint8_t*)req->data;
      /* 安全:固定上限 + 显式终止 */
      const size_t kMaxDevName = 64;
@@ -1328,23 +1328,23 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
  //运动目标通知
  void MsgCenterNotifyGoalShowViewProc(const Topic topic, Request* req)
  {
-     unused(req);
-     if (CheckPriority(topic)) 
-     {
-         uint8_t* data=(uint8_t*)req->data;
-         if(get_Is_show_flag(data[0]))
-         {   
-             set_goal_flag_view(data[0]);
-             set_Is_show_flag(0,data[0]);
- 
-              const power_display_svr_api_t *display_api = power_display_svr_get_api();
- 
-             uapi_set_screen_on_api();
-             
-             NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
-             NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
-         }
-     }
+    unused(req);
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyGoalShowViewProc目标达成 !");
+    if (CheckPriority(topic)) 
+    {
+        uint8_t* data=(uint8_t*)req->data;
+        if(get_Is_show_flag(data[0]))
+        {   
+            set_goal_flag_view(data[0]);
+            set_Is_show_flag(0,data[0]);
+
+            const power_display_svr_api_t *display_api = power_display_svr_get_api();
+            uapi_set_screen_on_api();
+            
+            NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+            NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
+        }
+    }
  }
  //喝水提醒通知
  void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req)
index 3391588..bba70c4 100644 (file)
@@ -8,6 +8,7 @@
 #include "components/ui_label.h"
 #include "components/ui_label_ext.h"
 #include "components/ui_label_button_ext.h"
+#include "components/ui_image_view.h"
 #include "osal_timer.h"
 #include "cmsis_os2.h"
 #include "NativeAbility.h"
@@ -47,6 +48,7 @@ namespace OHOS
     static const ImageInfo **winimageInfos{nullptr};
     static ImageAnimatorInfo *winimageAnimatorInfo{nullptr};
     static std::string winbasePath = "/user/res/Training/training_GIF/win/";
+    static UIImageView *image_goalview = nullptr;
 
     static osTimerId_t GoalviewShow_timer = NULL;
 
@@ -90,6 +92,11 @@ namespace OHOS
                 delete[] winimageAnimatorInfo;
                 winimageAnimatorInfo = nullptr;
             }
+            if (image_goalview)
+            {
+                delete image_goalview;
+                image_goalview = nullptr;
+            }
             if (GoalviewShow_timer)
             {
                 osTimerStop(GoalviewShow_timer);
@@ -263,7 +270,6 @@ namespace OHOS
             break;
         case GOAL_STEP:
             tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);
-            ;
             tagString = std::to_string(tag) + "steps";
             break;
         default:
@@ -274,11 +280,19 @@ namespace OHOS
         labeltag->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
         labeltag->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
         // 初始化图片数组以及动画
-        winimageInfos = CreateImageInfoArray(winbasePath.c_str(), 94);
-        winimageAnimatorInfo = new ImageAnimatorInfo[94];
-        InitImageAnimatorSource(imageAnimator, winimageAnimatorInfo, winimageInfos,
-                                94, 173, 100, 120, 120, "imageAnimator1", 10);
-        imageAnimator->Start();
+        // winimageInfos = CreateImageInfoArray(winbasePath.c_str(), 94);
+        // winimageAnimatorInfo = new ImageAnimatorInfo[94];
+        // InitImageAnimatorSource(imageAnimator, winimageAnimatorInfo, winimageInfos,
+        //                         94, 173, 100, 120, 120, "imageAnimator1", 10);
+        // imageAnimator->Start();
+
+        if(image_goalview == nullptr)
+        {
+            image_goalview = new UIImageView();
+            image_goalview->SetPosition(173,100,120, 120);
+            image_goalview->SetSrc("/user/res/Training/training_GIF/win/10.bin");
+        }
+
     }
 
     static uint8_t GoalviewShowCallBack_FALG = 0;
@@ -371,7 +385,8 @@ namespace OHOS
             getView->Add(labelpre);
             getView->Add(buttonok_);
             getView->Add(labeltag);
-            getView->Add(imageAnimator);
+            // getView->Add(imageAnimator);
+            getView->Add(image_goalview);
             NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(Freegoalview);
         }
         else
index e27023f..6300ce6 100644 (file)
@@ -2283,6 +2283,22 @@ static uint32_t custom_sio_debug_enable(uint8_t *para, uint32_t paraLen, char *s
     return ERRCODE_SUCC;
 }
 
+/**
+ * @brief AT^GOALSHOW - Show goal view
+ * Usage: AT^GOALSHOW
+ */
+static uint32_t custom_goal_show(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+    // 解析参数(如果提供)
+    uint8_t type_2 = 0;
+    if (para != NULL && paraLen > 0) {
+        type_2 = (uint8_t)atoi((char *)para);
+    }
+    CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&type_2,1);
+    return ERRCODE_SUCC;
+}
+
 static const at_cmd_table_t g_custom_utils_cmd[] = {
     { (char *)"AT^CUSTOM_SN",      custom_utils_setsn, (char *)"123456789ABCDEF2345678" },
     { (char *)"AT^CUSTOM_SN_REQ",  custom_utils_getsn, (char *)" " },
@@ -2400,6 +2416,8 @@ static const at_cmd_table_t g_custom_utils_cmd[] = {
     /* SPI1 init/deinit test AT commands */
     { (char *)"AT^SPIINIT",       custom_spi_init_test, (char *)" " },
     { (char *)"AT^SPIDEINIT",     custom_spi_deinit_test, (char *)" " },
+
+    { (char *)"AT^GOALSHOW",      custom_goal_show, (char *)" " },
 };
 
 
index 51e130a..7cc718f 100644 (file)
@@ -569,7 +569,7 @@ void CustomEventPublish(uint16_t topic, uint8_t *data, uint32_t size) {
     }  
 
     broadcastApi->Release((IUnknown *)broadcastApi);  
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChargerEventPublish end!!");  
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CustomEventPublish end!!");  
 
     // // 释放内存  
     // free(publishData);