From 4e0b2c0f8f2ffbdb256fc09433a57092e9d5708b Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 28 Mar 2026 11:53:25 +0800 Subject: [PATCH] =?utf8?q?=E5=8A=A8=E7=94=BB=E5=9B=BE=E7=89=87=E4=BC=98?= =?utf8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/goal/include/goalother.h | 8 -- .../nativeui/goal/include/goalview.h | 1 - .../nativeui/goal/src/Maingoalview.cpp | 29 +++-- .../nativeui/goal/src/goalControlView.cpp | 18 ++- .../nativeapp/nativeui/goal/src/goalview.cpp | 31 ++++- .../nativeui/health/BloodCardView.cpp | 17 +-- .../nativeui/sleep/src/SleepCardView.cpp | 4 +- .../weather/include/WeatherReportView.h | 3 - .../weather/src/WeatherReportView.cpp | 111 +++++++++++++----- 9 files changed, 143 insertions(+), 79 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalother.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalother.h index 2ad212f6f..313b43a2f 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalother.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalother.h @@ -44,14 +44,6 @@ namespace OHOS UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight); private: - void DumpWeatherInfo(); - std::string WeatherImag; // 天气图片 - std::string Temperature; // 温度 - std::string WeatherDescription; // 天气描述 - std::string WeatherArea; // 天气地区 - std::string MaxandMinTemperature; // 最高与最低气温 - private: - UILabelExt *caloriegoalTitle{nullptr}; // 卡路里标题 UILabelExt *mileagegoalTitle{nullptr}; // 里程标题 diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalview.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalview.h index 75fb64b93..271fee0d8 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalview.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalview.h @@ -51,7 +51,6 @@ namespace OHOS UIImageView *PullUpImage{nullptr}; UIImageAnimatorView *stepAnimatorView{nullptr}; // 走路动画 ImageAnimatorInfo goalAnimatorInfo[20]{0}; - const ImageInfo **goalAnimator_imageInfo{nullptr}; bool viewInitStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/Maingoalview.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/Maingoalview.cpp index 5cd57b362..3cd979c62 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/Maingoalview.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/Maingoalview.cpp @@ -35,27 +35,32 @@ namespace OHOS if(goalSwipeViewList) { goalSwipeViewList->RemoveAll(); + delete goalSwipeViewList; + goalSwipeViewList = nullptr; - delete goalView; - goalView = nullptr; - - delete goalotherView; - goalotherView = nullptr; + if(goalView) + { + delete goalView; + goalView = nullptr; + } - delete goalhintView; - goalhintView = nullptr; + if(goalotherView) + { + delete goalotherView; + goalotherView = nullptr; + } - - delete goalSwipeViewList; - goalSwipeViewList = nullptr; + if(goalhintView) + { + delete goalhintView; + goalhintView = nullptr; + } for (int32_t i = 0; i < 3; i++) { recordCard[i] = nullptr; } } - - } /* diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalControlView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalControlView.cpp index 51a5465b8..5f1e157b2 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalControlView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalControlView.cpp @@ -29,19 +29,15 @@ namespace OHOS if (viewiInitStatus == true) { RemoveAll(); + if (goalOnSwipeListener != nullptr) + { + delete goalOnSwipeListener; + goalOnSwipeListener = nullptr; + } if (maingoalView != nullptr) { - if (goalOnSwipeListener != nullptr) - { - delete goalOnSwipeListener; - goalOnSwipeListener = nullptr; - } - - if (maingoalView != nullptr) - { - delete maingoalView; - maingoalView = nullptr; - } + delete maingoalView; + maingoalView = nullptr; } } } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalview.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalview.cpp index a4d8c4d28..ba1269bdb 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalview.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalview.cpp @@ -17,10 +17,32 @@ namespace OHOS static constexpr int16_t PULLUP_ANIMATOR_VIEW_NUM_FRAMES = 70; static constexpr int16_t PULLUP_ANIMATOR_VIEW_TIME = 100; - static constexpr const char *PullUpPaths = "/user/res/weather/PullUp/PullUp_"; static constexpr const char *stepPaths = "/user/res/step/"; + const char *stepPathsArray[] = { + "/user/res/step/1.bin", + "/user/res/step/2.bin", + "/user/res/step/3.bin", + "/user/res/step/4.bin", + "/user/res/step/5.bin", + "/user/res/step/6.bin", + "/user/res/step/7.bin", + "/user/res/step/8.bin", + "/user/res/step/9.bin", + "/user/res/step/10.bin", + "/user/res/step/11.bin", + "/user/res/step/12.bin", + "/user/res/step/13.bin", + "/user/res/step/14.bin", + "/user/res/step/15.bin", + "/user/res/step/16.bin", + "/user/res/step/17.bin", + "/user/res/step/18.bin", + "/user/res/step/19.bin", + "/user/res/step/20.bin", + }; + static GoalView *g_pgoalView{nullptr}; GoalView::GoalView() { @@ -86,8 +108,6 @@ namespace OHOS delete PullUpImage; PullUpImage = nullptr; } - ImageCacheManager::GetInstance().UnloadSingleRes("/user/res/step/step_b.bin"); - FreeImageInfoArray(goalAnimator_imageInfo, stepPaths, 20); } GoalView *GoalView::GetInstance() @@ -195,7 +215,6 @@ namespace OHOS circleProgress1_->SetBackgroundImagePosition(36, 26); circleProgress1_->SetCapType(CAP_ROUND); /*----------------------------------------------------------------------------- */ - goalAnimator_imageInfo = CreateImageInfoArray(stepPaths, 20); if (stepAnimatorView == nullptr) { stepAnimatorView = new UIImageAnimatorView(); @@ -206,8 +225,8 @@ namespace OHOS } for (uint8_t i = 0; i < 20; i++) { - goalAnimatorInfo[i].imageInfo = goalAnimator_imageInfo[i]; - goalAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + goalAnimatorInfo[i].imagePath = stepPathsArray[i]; + goalAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; goalAnimatorInfo[i].pos.x = 193; goalAnimatorInfo[i].pos.y = 90; goalAnimatorInfo[i].width = 100; diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/health/BloodCardView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/health/BloodCardView.cpp index 1cd5833c4..c7d980dbe 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/health/BloodCardView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/health/BloodCardView.cpp @@ -128,9 +128,10 @@ namespace OHOS background = new UIImageView(); - background->SetPosition(0, 0); // widget's left position and top position - background->Resize(466, 466); // widget's width and height - background->SetViewId("image1"); // Set style + background->SetPosition(0, 0); + background->Resize(466, 466); + background->SetViewId("image1"); + background->SetSrc("/user/res/Blood/beijing.bin"); Add(background); return true; @@ -163,7 +164,7 @@ namespace OHOS */ void BloodCardView::DeInit() { - UnLoadBloodImageRes(); + // UnLoadBloodImageRes(); RemoveAll(); if (background != nullptr) { @@ -219,19 +220,19 @@ namespace OHOS void BloodCardView::PreLoad(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodCardView::PreLoad"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodCardView::PreLoad"); if (!viewiInitStatus) { InitView(); viewiInitStatus = true; } - PreLoadBloodImageRes(); + // PreLoadBloodImageRes(); } void BloodCardView::UnLoad(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodCardView::UnLoad"); - UnLoadBloodImageRes(); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodCardView::UnLoad"); + // UnLoadBloodImageRes(); } /* -------------------------------------------------------------------------- */ } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/sleep/src/SleepCardView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/sleep/src/SleepCardView.cpp index 97ce35cfc..780d285d7 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/sleep/src/SleepCardView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/sleep/src/SleepCardView.cpp @@ -87,7 +87,7 @@ namespace OHOS } void SleepCardView::PreLoad(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepCardView::PreLoad viewiInitStatus %d",viewiInitStatus); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepCardView::PreLoad viewiInitStatus %d",viewiInitStatus); if (!viewiInitStatus) { InitView(); @@ -97,7 +97,7 @@ namespace OHOS void SleepCardView::UnLoad(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepCardView::UnLoad"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepCardView::UnLoad"); } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/include/WeatherReportView.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/include/WeatherReportView.h index 4e6940fcc..b2fef581a 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/include/WeatherReportView.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/include/WeatherReportView.h @@ -75,9 +75,6 @@ namespace OHOS UIImageAnimatorView *WindSpeedImageAnimatorView{nullptr}; // 风速动画 UIImageAnimatorView *HumidityImageAnimatorView{nullptr}; // 湿度动画 - const ImageInfo **UVPathsArray{nullptr}; - const ImageInfo **WindSpeedPathsArray{nullptr}; - const ImageInfo **HumidityPathsArray{nullptr}; bool viewInitStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/src/WeatherReportView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/src/WeatherReportView.cpp index 54e0ba08e..db849bedd 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/src/WeatherReportView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/weather/src/WeatherReportView.cpp @@ -27,12 +27,85 @@ namespace OHOS static constexpr int16_t HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 20; // 图片帧数 static ImageAnimatorInfo HumidityimageAnimatorInfo[HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; - static constexpr const char *UVPaths = "/user/res/weather/weather60x60gif/UV/"; - static constexpr const char *WindSpeedPaths = "/user/res/weather/weather60x60gif/WindSpeed/"; - static constexpr const char *HumidityPaths = "/user/res/weather/weather60x60gif/Humidity/"; + const char *UVPathsArray[] = { + "/user/res/weather/weather60x60gif/UV/1.bin", + "/user/res/weather/weather60x60gif/UV/2.bin", + "/user/res/weather/weather60x60gif/UV/3.bin", + "/user/res/weather/weather60x60gif/UV/4.bin", + "/user/res/weather/weather60x60gif/UV/5.bin", + "/user/res/weather/weather60x60gif/UV/6.bin", + "/user/res/weather/weather60x60gif/UV/7.bin", + "/user/res/weather/weather60x60gif/UV/8.bin", + "/user/res/weather/weather60x60gif/UV/9.bin", + "/user/res/weather/weather60x60gif/UV/10.bin", + "/user/res/weather/weather60x60gif/UV/11.bin", + "/user/res/weather/weather60x60gif/UV/12.bin", + "/user/res/weather/weather60x60gif/UV/13.bin", + "/user/res/weather/weather60x60gif/UV/14.bin", + "/user/res/weather/weather60x60gif/UV/15.bin", + "/user/res/weather/weather60x60gif/UV/16.bin", + "/user/res/weather/weather60x60gif/UV/17.bin", + "/user/res/weather/weather60x60gif/UV/18.bin", + "/user/res/weather/weather60x60gif/UV/19.bin", + "/user/res/weather/weather60x60gif/UV/20.bin", + "/user/res/weather/weather60x60gif/UV/21.bin", + "/user/res/weather/weather60x60gif/UV/22.bin", + "/user/res/weather/weather60x60gif/UV/23.bin", + "/user/res/weather/weather60x60gif/UV/24.bin", + }; + + const char *WindSpeedPathsArray[] ={ + "/user/res/weather/weather60x60gif/WindSpeed/1.bin", + "/user/res/weather/weather60x60gif/WindSpeed/2.bin", + "/user/res/weather/weather60x60gif/WindSpeed/3.bin", + "/user/res/weather/weather60x60gif/WindSpeed/4.bin", + "/user/res/weather/weather60x60gif/WindSpeed/5.bin", + "/user/res/weather/weather60x60gif/WindSpeed/6.bin", + "/user/res/weather/weather60x60gif/WindSpeed/7.bin", + "/user/res/weather/weather60x60gif/WindSpeed/8.bin", + "/user/res/weather/weather60x60gif/WindSpeed/9.bin", + "/user/res/weather/weather60x60gif/WindSpeed/10.bin", + "/user/res/weather/weather60x60gif/WindSpeed/11.bin", + "/user/res/weather/weather60x60gif/WindSpeed/12.bin", + "/user/res/weather/weather60x60gif/WindSpeed/13.bin", + "/user/res/weather/weather60x60gif/WindSpeed/14.bin", + "/user/res/weather/weather60x60gif/WindSpeed/15.bin", + "/user/res/weather/weather60x60gif/WindSpeed/16.bin", + "/user/res/weather/weather60x60gif/WindSpeed/17.bin", + "/user/res/weather/weather60x60gif/WindSpeed/18.bin", + "/user/res/weather/weather60x60gif/WindSpeed/19.bin", + "/user/res/weather/weather60x60gif/WindSpeed/20.bin", + "/user/res/weather/weather60x60gif/WindSpeed/21.bin", + "/user/res/weather/weather60x60gif/WindSpeed/22.bin", + "/user/res/weather/weather60x60gif/WindSpeed/23.bin", + "/user/res/weather/weather60x60gif/WindSpeed/24.bin", + }; + + const char *HumidityPathsArray[] = { + "/user/res/weather/weather60x60gif/Humidity/1.bin", + "/user/res/weather/weather60x60gif/Humidity/2.bin", + "/user/res/weather/weather60x60gif/Humidity/3.bin", + "/user/res/weather/weather60x60gif/Humidity/4.bin", + "/user/res/weather/weather60x60gif/Humidity/5.bin", + "/user/res/weather/weather60x60gif/Humidity/6.bin", + "/user/res/weather/weather60x60gif/Humidity/7.bin", + "/user/res/weather/weather60x60gif/Humidity/8.bin", + "/user/res/weather/weather60x60gif/Humidity/9.bin", + "/user/res/weather/weather60x60gif/Humidity/10.bin", + "/user/res/weather/weather60x60gif/Humidity/11.bin", + "/user/res/weather/weather60x60gif/Humidity/12.bin", + "/user/res/weather/weather60x60gif/Humidity/13.bin", + "/user/res/weather/weather60x60gif/Humidity/14.bin", + "/user/res/weather/weather60x60gif/Humidity/15.bin", + "/user/res/weather/weather60x60gif/Humidity/16.bin", + "/user/res/weather/weather60x60gif/Humidity/17.bin", + "/user/res/weather/weather60x60gif/Humidity/18.bin", + "/user/res/weather/weather60x60gif/Humidity/19.bin", + "/user/res/weather/weather60x60gif/Humidity/20.bin", + }; - static WeatherReportView *g_pWeatherReportView{nullptr}; + static WeatherReportView *g_pWeatherReportView{nullptr}; WeatherReportView::WeatherReportView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " WeatherReportView::WeatherReportView"); @@ -99,15 +172,6 @@ namespace OHOS delete HumidityImageAnimatorView; HumidityImageAnimatorView = nullptr; - // FreeImagePathsArray(UVPathsArray, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - - // FreeImagePathsArray(WindSpeedPathsArray, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - - // FreeImagePathsArray(HumidityPathsArray, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - - FreeImageInfoArray(UVPathsArray, UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - FreeImageInfoArray(WindSpeedPathsArray, WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - FreeImageInfoArray(HumidityPathsArray, HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); } } @@ -260,7 +324,6 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherReportView::WeatherReportViewImageAnimatorViewInit"); /* ----------------------------- UVImageAnimatorView---------------------------- */ - UVPathsArray = CreateImageInfoArray(UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (UVImageAnimatorView == nullptr) { UVImageAnimatorView = new UIImageAnimatorView(); @@ -271,10 +334,8 @@ namespace OHOS } for (uint8_t i = 0; i < UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - // UVimageAnimatorInfo[i].imagePath = UVPathsArray[i]; - // UVimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; - UVimageAnimatorInfo[i].imageInfo = UVPathsArray[i]; - UVimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + UVimageAnimatorInfo[i].imagePath = UVPathsArray[i]; + UVimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; UVimageAnimatorInfo[i].pos.x = UV_IMAGE_ANIMATOR_VIEW_X; UVimageAnimatorInfo[i].pos.y = UV_IMAGE_ANIMATOR_VIEW_Y; UVimageAnimatorInfo[i].width = UV_IMAGE_ANIMATOR_VIEW_W; @@ -288,7 +349,6 @@ namespace OHOS UVImageAnimatorView->Start(); } /* ----------------------- WindSpeedImageAnimatorView ----------------------- */ - WindSpeedPathsArray = CreateImageInfoArray(WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (WindSpeedImageAnimatorView == nullptr) { WindSpeedImageAnimatorView = new UIImageAnimatorView(); @@ -299,10 +359,8 @@ namespace OHOS } for (uint8_t i = 0; i < WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - // WindSpeedimageAnimatorInfo[i].imagePath = WindSpeedPathsArray[i]; - // WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; - WindSpeedimageAnimatorInfo[i].imageInfo = WindSpeedPathsArray[i]; - WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + WindSpeedimageAnimatorInfo[i].imagePath = WindSpeedPathsArray[i]; + WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; WindSpeedimageAnimatorInfo[i].pos.x = WINDSPEED_IMAGE_ANIMATOR_VIEW_X; WindSpeedimageAnimatorInfo[i].pos.y = UV_IMAGE_ANIMATOR_VIEW_Y; WindSpeedimageAnimatorInfo[i].width = UV_IMAGE_ANIMATOR_VIEW_W; @@ -316,7 +374,6 @@ namespace OHOS WindSpeedImageAnimatorView->Start(); } /* ------------------------ HumidityImageAnimatorView ----------------------- */ - HumidityPathsArray = CreateImageInfoArray(HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (HumidityImageAnimatorView == nullptr) { HumidityImageAnimatorView = new UIImageAnimatorView(); @@ -327,10 +384,8 @@ namespace OHOS } for (uint8_t i = 0; i < HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - // HumidityimageAnimatorInfo[i].imagePath = HumidityPathsArray[i]; - // HumidityimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; - HumidityimageAnimatorInfo[i].imageInfo = HumidityPathsArray[i]; - HumidityimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + HumidityimageAnimatorInfo[i].imagePath = HumidityPathsArray[i]; + HumidityimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; HumidityimageAnimatorInfo[i].pos.x = HUMIDITY_IMAGE_ANIMATOR_VIEW_X; HumidityimageAnimatorInfo[i].pos.y = UV_IMAGE_ANIMATOR_VIEW_Y; HumidityimageAnimatorInfo[i].width = UV_IMAGE_ANIMATOR_VIEW_W; -- 2.17.1