日历增加上拉图标 #775 1048/3 1048/head
authorhcj <1224667075@qq.com>
Sat, 28 Sep 2024 09:32:27 +0000 (17:32 +0800)
committerhcj <1224667075@qq.com>
Sat, 28 Sep 2024 09:32:27 +0000 (17:32 +0800)
code/sdk/application/wearable/fd230app/nativeui/calendar/include/CalendarView.h
code/sdk/application/wearable/fd230app/nativeui/calendar/src/CalendarView.cpp

index 188ee0e..003a872 100644 (file)
@@ -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;
index dad82df..ee3f731 100644 (file)
@@ -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;
 }