走查部分代码
authorCaisking <3449750381@qq.com>
Tue, 9 Jul 2024 01:38:27 +0000 (09:38 +0800)
committerCaisking <3449750381@qq.com>
Tue, 9 Jul 2024 01:38:27 +0000 (09:38 +0800)
code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp
code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h
code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp

index c9d61d0..426e957 100644 (file)
@@ -94,7 +94,7 @@ extern "C"
             {\r
                 free(heartInfo);\r
                 heartInfo = nullptr;\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s heartRateData fail! ret = %d", rets);\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s heartRateData fail! ret = %d", rets);\r
                 return;\r
             }\r
 #endif\r
@@ -631,7 +631,7 @@ namespace OHOS
         if (disvalid_counter_ >= MAX_DISVALID_HRS_COUNT)\r
         {\r
             // 结束本次测试\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"MAX_DISVALID_HRS_COUNT\r\n");\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"MAX_DISVALID_HRS_COUNT");\r
             Heart_Stop();\r
             // 关闭自动检测心率 如果有其他高级心率检测在进行,则不会进行关闭[低优先级]\r
             HeartModel::GetInstance()->Heart_Control(HeartState::End, HeartCheck::PASSIVITY);\r
index ddbc5bc..68d3ddb 100644 (file)
@@ -1,8 +1,8 @@
 /*** 
  * @Date: 2024-06-21 09:56:18
  * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-06-22 18:13:06
- * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h
+ * @LastEditTime: 2024-07-08 09:22:12
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h
  */
 /***
  * @Date: 2024-04-15 10:55:58
@@ -67,7 +67,7 @@ namespace OHOS
         virtual ~MessageModel();
 
         uint8_t numberOfItems;                                                                 // 项数
-        static const uint16_t MaxMessageListCount = 11;                                        // 消息列表最大数量
+        static const uint16_t MaxMessageListCount = 10;                                        // 消息列表最大数量
         MessageListItem Messages[MaxMessageListCount] = {0, false, nullptr, nullptr, nullptr}; // 消息列表
         uint8_t indexCurrent;                                                                  // 选择的项
 
index 80d2e38..93356a6 100644 (file)
@@ -68,6 +68,7 @@ namespace OHOS
 
         bool InitPage();
         bool SetupViewPage(MessageView *messageView);
+        void UpdataButton(int num);
 
     private:
         /*无消息界面*/
index a73fd48..2b7499d 100644 (file)
@@ -51,7 +51,7 @@ namespace OHOS
 
     uint8_t MessageModel::GetMessageCount() const
     {
-        return numberOfItems;
+        return (numberOfItems != 0 ? numberOfItems : MaxMessageListCount);
     }
 
     void MessageModel::PrintData(MessageData messagedata)
@@ -105,7 +105,7 @@ namespace OHOS
         cJSON *root = cJSON_Parse(jsonData.c_str());
         cJSON *dataArray = cJSON_GetObjectItem(root, "infor");
         int dataCount = cJSON_GetArraySize(dataArray);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dataCount is %d", dataCount);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "dataCount is %d", dataCount);
 
         std::vector<MessageData> MessageVector;
         for (int i = 0; i < dataCount; i++)
@@ -145,9 +145,8 @@ namespace OHOS
         if (!messageVector.empty())
         {
             numberOfItems = messageVector.size();
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "the numberOfItems is %d", numberOfItems);
-            // Messages[numberOfItems] = {numberOfItems, true, "", "            全部删除", ""};
-            for (int i = numberOfItems - 1, count = 0; i >= 0 && count < MaxMessageListCount - 1; i--, count++)
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "the numberOfItems is %d", numberOfItems);
+            for (int i = numberOfItems - 1, count = 0; i >= 0 && count < MaxMessageListCount; i--, count++)
             {
                 MessageData messageData;
                 messageData.isRead = messageVector[i].isRead;
index 64e8e11..5da9c52 100644 (file)
@@ -76,6 +76,7 @@ namespace OHOS
             {
                 view_->AddMessageToList(itemInfo[i]);
             }
+            // MessageView::GetInstance()->UpdataButton(p_MessageModel->GetMessageCount());
         }
 
         Presenter<MessageView>::OnResume();
index d49dd74..729e8da 100644 (file)
@@ -234,6 +234,14 @@ namespace OHOS
         messageView->SetVisible(false); // 隐藏界面
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowmessageView end");
     }
+    void MessageView::UpdataButton(int num)
+    {
+        int top = num * 240;
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "old top %d", top);
+        top > 466 ? top += 130 : top -= 100;
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new top %d", top);
+        DeleteButton->SetPosition(43, top);
+    }
     /*控制显示界面*/
     void MessageView::SetPopupViewStatus(PopupMessage view, bool status)
     {