修改每日目标达成显示效果
authorhcj <1224667075@qq.com>
Tue, 5 Nov 2024 08:46:40 +0000 (16:46 +0800)
committerhcj <1224667075@qq.com>
Tue, 5 Nov 2024 08:46:40 +0000 (16:46 +0800)
code/sdk/application/wearable/fd230app/nativeui/activity/src/ActivityModel.cpp
code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp
code/sdk/application/wearable/service/msg_center/include/notify/goal_notification.h
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp

index a05caf5..5eb74d0 100644 (file)
@@ -165,7 +165,7 @@ static void Notify(void *args, const Topic topic, Request* request)
         {
 
             goal_type=GOAL_STEP;
-            if(get_Is_shouw_falg(goal_type))
+            if(get_Is_show_flag(goal_type))
             {   
                 if(OHOS::GoalModel::GetInstance().get_step_goal_show())
                 {
@@ -177,7 +177,7 @@ static void Notify(void *args, const Topic topic, Request* request)
         if(OHOS::GoalModel::GetInstance().is_goal_DISTANCE_done())
         {
             goal_type=GOAL_DISTANCE;
-            if(get_Is_shouw_falg(goal_type))
+            if(get_Is_show_flag(goal_type))
             {   
                 if(OHOS::GoalModel::GetInstance().get_other_goal_show())
                 {
@@ -190,7 +190,7 @@ static void Notify(void *args, const Topic topic, Request* request)
         if(OHOS::GoalModel::GetInstance().is_goal_fatburning_done())
         {
             goal_type=GOAL_FAT;
-            if(get_Is_shouw_falg(goal_type))
+            if(get_Is_show_flag(goal_type))
             {   
                 if(OHOS::GoalModel::GetInstance().get_other_goal_show())
                 {
@@ -202,9 +202,9 @@ static void Notify(void *args, const Topic topic, Request* request)
         if(OHOS::GoalModel::GetInstance().is_goal_stand_done())
         {
             goal_type=GOAL_STAND;
-            if(get_Is_shouw_falg(goal_type))
+            if(get_Is_show_flag(goal_type))
             {   
-            if(OHOS::GoalModel::GetInstance().get_other_goal_show())
+                if(OHOS::GoalModel::GetInstance().get_other_goal_show())
                 {
                     CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&goal_type,1);
                 }
@@ -214,7 +214,7 @@ static void Notify(void *args, const Topic topic, Request* request)
         if(OHOS::GoalModel::GetInstance().is_goal_calories_done())
         {
             goal_type=GOAL_CALOREIE;
-            if(get_Is_shouw_falg(goal_type))
+            if(get_Is_show_flag(goal_type))
             {   
             if(OHOS::GoalModel::GetInstance().get_other_goal_show())
                 {
index acb6229..2d12c49 100644 (file)
@@ -26,11 +26,11 @@ namespace OHOS
 
    void GoalModel::GoalModelInitdata()
    {
-      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME),OHOS::GOAL_CALOREIE);
-      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES_TIME),OHOS::GOAL_STAND);
-      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION_TIME),OHOS::GOAL_FAT);
-      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE_TIME),OHOS::GOAL_DISTANCE);
-      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT_TIME),OHOS::GOAL_STEP);
+      OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME),OHOS::GOAL_CALOREIE);
+      OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES_TIME),OHOS::GOAL_STAND);
+      OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION_TIME),OHOS::GOAL_FAT);
+      OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE_TIME),OHOS::GOAL_DISTANCE);
+      OHOS::set_Is_show_flag(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT_TIME),OHOS::GOAL_STEP);
 
       step_goal_show=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEP);
       other_goal_show=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER);
index e96dd06..336a850 100644 (file)
@@ -23,9 +23,9 @@ namespace OHOS
     UIViewGroup *GoalviewShow(void);
     void set_goal_flag_view(uint8_t falg);
 
-    uint8_t get_Is_shouw_falg(uint8_t type);
+    uint8_t get_Is_show_flag(uint8_t type);
     
-    uint8_t set_Is_shouw_falg(uint8_t flag,uint8_t type);
+    uint8_t set_Is_show_flag(uint8_t flag,uint8_t type);
 
    
     class GoalViewEventListener : public OHOS::UIView::OnClickListener,
index 8ccff45..36248f2 100644 (file)
@@ -369,9 +369,7 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req)
         SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
    }
     
-  
-    
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
    calories_history_save();
    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
    distances_history_save();
@@ -387,10 +385,10 @@ void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req)
 
         uint8_t* data=(uint8_t*)req->data;
        
-        if(get_Is_shouw_falg(data[0]))
+        if(get_Is_show_flag(data[0]))
         {   
             set_goal_flag_view(data[0]);
-            set_Is_shouw_falg(0,data[0]);
+            set_Is_show_flag(0,data[0]);
 
              const power_display_svr_api_t *display_api = power_display_svr_get_api();
 
@@ -602,13 +600,18 @@ void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
                   OHOS::BloodOxygenModel::GetInstance()));
     printf("health end\n");
     /* --------------------------------- 每日目标相关 --------------------------------- */
+    cywee_reset_history_daily_data(); //清除运动相关数据
+
     // 午夜清除运动数据
     for(int i=1;i<6;i++)
     {
-        set_Is_shouw_falg(1,i);
+        set_Is_show_flag(1,i);
     }
-    cywee_reset_history_daily_data(); //清除运动相关数据
+   
+
     do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
+
+    // SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
     printf("sport end\n");
     /* ---------------------------------- 呼吸训练相关 ---------------------------------- */
     RespiratoryTrainingModel::GetInstance().ClearTotalRespiratoryTrainingTime();
@@ -977,7 +980,6 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req)
 
     CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
 
-    //暂时关闭该功能,易导致系统音频锁死
     SetMicMutecat1(false);
 
     cat1_phone_state_change_cb(OPERATE_WATCH_ACTIVE);
@@ -997,6 +999,7 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
     unused(req);
      if (req == NULL) return ;
     char* call_data = (char*)malloc(req->len);
+    if(call_data==NULL) return;
     int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
     if (ret != EOK) {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!");
@@ -1004,8 +1007,6 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
 
     // int ret = PlayersModel::GetInstance()->PlayerStop();
     stopPlayingMusic();
-    
-   
 
     if(strcmp(call_data,"SOS")==0)
     {
@@ -1014,17 +1015,17 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req)
         return;
     }
     
-        cat1_call_dial(call_data);
-  
-        CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+    cat1_call_dial(call_data);
 
-        CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
-        NotificationManager::GetInstance()->SetWatchCallStatus(true);
+    CallerLogModel::GetInstance()->SetoperateNumber(call_data,req->len);
+
+    CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourceCat1);
+    NotificationManager::GetInstance()->SetWatchCallStatus(true);
 
 
-        cat1_phone_state_change_cb(OPERATE_DIALING);
-   
-        do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
+    cat1_phone_state_change_cb(OPERATE_DIALING);
+
+    do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_START, nullptr, 0);
         
      
    
@@ -1048,6 +1049,11 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
 
     if (req == NULL) return ;
     char* call_data = (char*)malloc(req->len);
+
+    if(call_data==NULL)
+    {
+        return;
+    }
     int32 ret = memcpy_s(call_data, req->len, req->data, req->len);
 
     if(strcmp("callfail",call_data)==0)
index 41dbdfa..7cf2eb2 100644 (file)
@@ -170,7 +170,7 @@ namespace OHOS
     //     }
     // }
 
-    uint8_t get_Is_shouw_falg(uint8_t type)
+    uint8_t get_Is_show_flag(uint8_t type)
     {
         switch (type) {
         case GOAL_CALOREIE:
@@ -195,13 +195,13 @@ namespace OHOS
     }
 
 
-    uint8_t set_Is_shouw_falg(uint8_t flag,uint8_t type)
+    uint8_t set_Is_show_flag(uint8_t flag,uint8_t type)
     {
         switch (type) {
         case GOAL_CALOREIE:
 
             GOAL_CALOREIE_falg=flag;
-            ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME,flag);
+           ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME,flag);
             break;
 
         case GOAL_FAT:
@@ -271,6 +271,7 @@ namespace OHOS
     InitLabel(labeltag, 70, 215, 326, 97, "label2", tagString.c_str(),
                 DEFAULT_VECTOR_FONT_FILENAME, 80);
     labeltag->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+    labeltag->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
     getView->Add(labeltag);
 
     // 初始化图片数组以及动画
@@ -413,6 +414,7 @@ namespace OHOS
                 break;
             }
             labeltag->SetText(tagString.c_str());
+            labeltag->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
             getView->Invalidate();
 
         }