From ae6c954a9022de9521f62ed40a913023fc115881 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 28 Sep 2024 17:32:27 +0800 Subject: [PATCH] =?utf8?q?=20=E6=97=A5=E5=8E=86=E5=A2=9E=E5=8A=A0=E4=B8=8A?= =?utf8?q?=E6=8B=89=E5=9B=BE=E6=A0=87=20#775?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/calendar/include/CalendarView.h | 7 +++ .../nativeui/calendar/src/CalendarView.cpp | 54 ++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/calendar/include/CalendarView.h b/code/sdk/application/wearable/fd230app/nativeui/calendar/include/CalendarView.h index 188ee0e5b..003a872c3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/calendar/include/CalendarView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/calendar/include/CalendarView.h @@ -44,6 +44,13 @@ private: UILabel *week_label[7]{nullptr}; UILabel *day_label[31]{nullptr}; UIImageView *imageview{nullptr}; + + UIImageAnimatorView *PullUpAnimatorView{nullptr}; // 上拉动画 + + ImageAnimatorInfo PullUpimageAnimatorInfo[70]{0}; + + const ImageInfo** PullUpimageAnimator_imageInfo{nullptr}; + uint32_t show_y=0; uint32_t show_m=0; uint32_t show_d=0; diff --git a/code/sdk/application/wearable/fd230app/nativeui/calendar/src/CalendarView.cpp b/code/sdk/application/wearable/fd230app/nativeui/calendar/src/CalendarView.cpp index dad82df23..ee3f7319f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/calendar/src/CalendarView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/calendar/src/CalendarView.cpp @@ -7,6 +7,7 @@ #include "calendar/include/CalendarView.h" #include "calendar/include/CalendarModel.h" +#include "uicomponents/UIComponents.h" #include "wearable_log.h" #include "UiConfig.h" @@ -18,6 +19,18 @@ static CalendarView *g_pMainView_CalendarView = nullptr; static char *dial_id_str[]={"7","8","9","C","%","4","5","6","÷","x","1","2","3","-","+","","0",".","=",""}; +static constexpr int16_t PULLUP_ANIMATOR_VIEW_X = 213; +static constexpr int16_t PULLUP_ANIMATOR_VIEW_Y = 380; +static constexpr int16_t PULLUP_ANIMATOR_VIEW_W = 40; +static constexpr int16_t PULLUP_ANIMATOR_VIEW_H = 40; +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/"; + CalendarView::CalendarView() { @@ -66,6 +79,15 @@ CalendarView::~CalendarView() day_label[i] =nullptr; } } + + if (PullUpAnimatorView != nullptr) + { + PullUpAnimatorView->Stop(); + delete PullUpAnimatorView; + PullUpAnimatorView = nullptr; + } + + FreeImageInfoArray(PullUpimageAnimator_imageInfo,PullUpPaths, PULLUP_ANIMATOR_VIEW_NUM_FRAMES); delete group; group =nullptr; @@ -314,7 +336,37 @@ bool CalendarView::Label_init() } day_label[i]->SetVisible(true); } - + + PullUpimageAnimator_imageInfo =CreateImageInfoArray(PullUpPaths, PULLUP_ANIMATOR_VIEW_NUM_FRAMES); + if (PullUpAnimatorView == nullptr) + { + PullUpAnimatorView = new UIImageAnimatorView(); + if (PullUpAnimatorView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpAnimatorView new fail"); + return false; + } + for (uint8_t i = 0; i < PULLUP_ANIMATOR_VIEW_NUM_FRAMES; i++) + { + //PullUpimageAnimatorInfo[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(PullUpPathsArray[i]); + //PullUpimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + PullUpimageAnimatorInfo[i].imageInfo = PullUpimageAnimator_imageInfo[i]; + //PullUpPathsArray[i]; + PullUpimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + PullUpimageAnimatorInfo[i].pos.x = PULLUP_ANIMATOR_VIEW_X; + PullUpimageAnimatorInfo[i].pos.y = PULLUP_ANIMATOR_VIEW_Y; + PullUpimageAnimatorInfo[i].width = PULLUP_ANIMATOR_VIEW_W; + PullUpimageAnimatorInfo[i].height = PULLUP_ANIMATOR_VIEW_H; + } + PullUpAnimatorView->SetPosition(PULLUP_ANIMATOR_VIEW_X, PULLUP_ANIMATOR_VIEW_Y, PULLUP_ANIMATOR_VIEW_W, PULLUP_ANIMATOR_VIEW_H); + PullUpAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + PullUpAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + PullUpAnimatorView->SetImageAnimatorSrc(PullUpimageAnimatorInfo, PULLUP_ANIMATOR_VIEW_NUM_FRAMES, PULLUP_ANIMATOR_VIEW_TIME); + PullUpAnimatorView->SetRepeat(true); + PullUpAnimatorView->Start(); + } + group->Add(PullUpAnimatorView); + return true; } -- 2.17.1