From cf07c7f4e5222f13860dc9123361032682be3bb8 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 31 Aug 2024 16:15:41 +0800 Subject: [PATCH] =?utf8?q?=E5=A4=A9=E6=B0=94=E5=8A=A8=E7=94=BB=E6=94=B9?= =?utf8?q?=E4=B8=BAImageinfo=E4=BF=9D=E5=AD=98=E5=92=8C=E9=87=8A=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../weather/include/WeatherReportView.h | 6 ++-- .../weather/src/WeatherReportView.cpp | 34 ++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h index a88438626..f4b922ca6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h @@ -75,9 +75,9 @@ namespace OHOS UIImageAnimatorView *WindSpeedImageAnimatorView{nullptr}; // 风速动画 UIImageAnimatorView *HumidityImageAnimatorView{nullptr}; // 湿度动画 - const char **UVPathsArray{nullptr}; - const char **WindSpeedPathsArray{nullptr}; - const char **HumidityPathsArray{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/fd230app/nativeui/weather/src/WeatherReportView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp index 2aa956335..9405ffc28 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp @@ -99,11 +99,15 @@ namespace OHOS delete HumidityImageAnimatorView; HumidityImageAnimatorView = nullptr; - FreeImagePathsArray(UVPathsArray, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(UVPathsArray, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - FreeImagePathsArray(WindSpeedPathsArray, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(WindSpeedPathsArray, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - FreeImagePathsArray(HumidityPathsArray, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(HumidityPathsArray, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + + FreeImageInfoArray(UVPathsArray, UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(UVPathsArray, WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(HumidityPathsArray, HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); } } @@ -256,7 +260,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherReportView::WeatherReportViewImageAnimatorViewInit"); /* ----------------------------- UVImageAnimatorView---------------------------- */ - UVPathsArray = CreateImagePathsArray(UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + UVPathsArray = CreateImageInfoArray(UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (UVImageAnimatorView == nullptr) { UVImageAnimatorView = new UIImageAnimatorView(); @@ -267,8 +271,10 @@ 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].imagePath = UVPathsArray[i]; + // UVimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + UVimageAnimatorInfo[i].imageInfo = UVPathsArray[i]; + UVimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; 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; @@ -282,7 +288,7 @@ namespace OHOS UVImageAnimatorView->Start(); } /* ----------------------- WindSpeedImageAnimatorView ----------------------- */ - WindSpeedPathsArray = CreateImagePathsArray(WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + WindSpeedPathsArray = CreateImageInfoArray(WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (WindSpeedImageAnimatorView == nullptr) { WindSpeedImageAnimatorView = new UIImageAnimatorView(); @@ -293,8 +299,10 @@ 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].imagePath = WindSpeedPathsArray[i]; + // WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + WindSpeedimageAnimatorInfo[i].imageInfo = WindSpeedPathsArray[i]; + WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; 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; @@ -308,7 +316,7 @@ namespace OHOS WindSpeedImageAnimatorView->Start(); } /* ------------------------ HumidityImageAnimatorView ----------------------- */ - HumidityPathsArray = CreateImagePathsArray(HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + HumidityPathsArray = CreateImageInfoArray(HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (HumidityImageAnimatorView == nullptr) { HumidityImageAnimatorView = new UIImageAnimatorView(); @@ -319,8 +327,10 @@ 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].imagePath = HumidityPathsArray[i]; + // HumidityimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + HumidityimageAnimatorInfo[i].imageInfo = HumidityPathsArray[i]; + HumidityimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; 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