活动界面上拉动画改成图片
authorluozheng <1732036298@qq.com>
Thu, 19 Mar 2026 10:14:05 +0000 (18:14 +0800)
committerluozheng <1732036298@qq.com>
Thu, 19 Mar 2026 10:14:05 +0000 (18:14 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalother.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/include/goalview.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalother.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/goal/src/goalview.cpp

index 58f8822..2ad212f 100644 (file)
@@ -69,17 +69,14 @@ namespace OHOS
         UILabel *fatburninggoaldataLabel{nullptr};          // 目标
         UILabel *fatburningnowdataLabel{nullptr};          // 完成
 
-        
         UILabel *standgoaldataLabel{nullptr};          // 目标
         UILabel *standnowdataLabel{nullptr};          // 完成
 
-        UIImageAnimatorView *PullUpAnimatorView{nullptr};   // 上拉动画
-
         UIImageView *transverseline_1{nullptr}; 
         UIImageView *transverseline_2{nullptr}; 
         UIImageView *verticalline{nullptr}; 
+        UIImageView *PullUpImage{nullptr};
 
-        const char **PullUpPathsArray{nullptr};
         bool viewInitStatus{false};
     };
 } // namespace OHOS
index adb4350..75fb64b 100644 (file)
@@ -8,7 +8,6 @@
 #ifndef GOAL_VIEW_H
 #define GOAL_VIEW_H
 
-
 #include "View.h"
 
 #include "components/root_view.h"
 
 namespace OHOS
 {
-    //static constexpr const char *WeatherBackground = "/user/res/weather/WEATHER_BACKGROUND.bin"; // 天气背景
     class GoalView : public AppGroupView
     {
 
     public:
-         
         GoalView();
         virtual ~GoalView();
         static GoalView *GetInstance(void);
@@ -45,21 +42,16 @@ namespace OHOS
     private:
         UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight);
 
-
     private:
-        UICircleProgress * circleProgress1_{nullptr};   //步数进度条
-
-        UILabelExt *goalTitle{nullptr};          // 目标
-        UILabelExt *goalstepLabel{nullptr};          // 目标
-        UILabelExt *nowstepLabel{nullptr};          // 完成
-        UIImageView* circleProgressimage{nullptr};      
-        UIImageAnimatorView *PullUpAnimatorView{nullptr};   // 上拉动画
-        UIImageAnimatorView *stepAnimatorView{nullptr};   // 走路动画
+        UICircleProgress *circleProgress1_{nullptr}; // 步数进度条
+        UILabelExt *goalTitle{nullptr};     // 目标
+        UILabelExt *goalstepLabel{nullptr}; // 目标
+        UILabelExt *nowstepLabel{nullptr};  // 完成
+        UIImageView *circleProgressimage{nullptr};
+        UIImageView *PullUpImage{nullptr};
+        UIImageAnimatorView *stepAnimatorView{nullptr}; // 走路动画
         ImageAnimatorInfo goalAnimatorInfo[20]{0};
-        const ImageInfo** goalAnimator_imageInfo{nullptr};
-        const ImageInfo** PullUpimageAnimator_imageInfo{nullptr};
-        // const char **PullUpPathsArray{nullptr};
-        // const char **goalPathsArray{nullptr};
+        const ImageInfo **goalAnimator_imageInfo{nullptr};
         bool viewInitStatus{false};
     };
 } // namespace OHOS
index cba9c05..9b5672a 100644 (file)
@@ -13,7 +13,6 @@
 
 namespace OHOS
 {
-    
 
     static constexpr int16_t PULLUP_ANIMATOR_VIEW_X = 213;
     static constexpr int16_t PULLUP_ANIMATOR_VIEW_Y = 430;
@@ -21,12 +20,11 @@ namespace OHOS
     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 ImageAnimatorInfo PullUpimageAnimatorInfo[PULLUP_ANIMATOR_VIEW_NUM_FRAMES];
+    // static ImageAnimatorInfo PullUpimageAnimatorInfo[PULLUP_ANIMATOR_VIEW_NUM_FRAMES];
 
     static ImageAnimatorInfo goalAnimatorInfo[20];
     static constexpr const char *PullUpPaths = "/user/res/weather/PullUp/PullUp_";
 
-
     static GoalotherView *g_pgoalView{nullptr};
     GoalotherView::GoalotherView()
     {
@@ -46,22 +44,22 @@ namespace OHOS
 
     void GoalotherView::GoalViewrefresh()
     {
-        if(mileagenowdataLabel)
-        mileagenowdataLabel->SetText(GoalModel::GetInstance().getdistancenew().c_str());
-        if(mileagegoaldataLabel)
-        mileagegoaldataLabel->SetText(GoalModel::GetInstance().getdistanceGoal().c_str());
-        if(fatburningnowdataLabel)
-        fatburningnowdataLabel->SetText(GoalModel::GetInstance().getfatburningnew().c_str());
-        if(fatburninggoaldataLabel)
-        fatburninggoaldataLabel->SetText(GoalModel::GetInstance().getfatburninggoal().c_str());
-        if(standnowdataLabel)
-        standnowdataLabel->SetText(GoalModel::GetInstance().getstandnew().c_str());
-        if(standgoaldataLabel)
-        standgoaldataLabel->SetText(GoalModel::GetInstance().getstandgoal().c_str());
-        if(calorienowdataLabel)
-        calorienowdataLabel->SetText(GoalModel::GetInstance().getcaloriespnew().c_str());
-        if(caloriegoaldataLabel)
-        caloriegoaldataLabel->SetText(GoalModel::GetInstance().getcaloriesGoal().c_str());
+        if (mileagenowdataLabel)
+            mileagenowdataLabel->SetText(GoalModel::GetInstance().getdistancenew().c_str());
+        if (mileagegoaldataLabel)
+            mileagegoaldataLabel->SetText(GoalModel::GetInstance().getdistanceGoal().c_str());
+        if (fatburningnowdataLabel)
+            fatburningnowdataLabel->SetText(GoalModel::GetInstance().getfatburningnew().c_str());
+        if (fatburninggoaldataLabel)
+            fatburninggoaldataLabel->SetText(GoalModel::GetInstance().getfatburninggoal().c_str());
+        if (standnowdataLabel)
+            standnowdataLabel->SetText(GoalModel::GetInstance().getstandnew().c_str());
+        if (standgoaldataLabel)
+            standgoaldataLabel->SetText(GoalModel::GetInstance().getstandgoal().c_str());
+        if (calorienowdataLabel)
+            calorienowdataLabel->SetText(GoalModel::GetInstance().getcaloriespnew().c_str());
+        if (caloriegoaldataLabel)
+            caloriegoaldataLabel->SetText(GoalModel::GetInstance().getcaloriesGoal().c_str());
 
         Invalidate();
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GoalViewrefresh Invalidat ");
@@ -96,7 +94,7 @@ namespace OHOS
             delete caloriegoaldataLabel;
             caloriegoaldataLabel = nullptr;
         }
-         if (calorienowdataLabel != nullptr)
+        if (calorienowdataLabel != nullptr)
         {
             delete calorienowdataLabel;
             calorienowdataLabel = nullptr;
@@ -150,15 +148,11 @@ namespace OHOS
             delete verticalline;
             verticalline = nullptr;
         }
-
-        if (PullUpAnimatorView != nullptr)
+        if (PullUpImage != nullptr)
         {
-            PullUpAnimatorView->Stop();
-            delete PullUpAnimatorView;
-            PullUpAnimatorView = nullptr;
+            delete PullUpImage;
+            PullUpImage = nullptr;
         }
-        //FreeImagePathsArray(PullUpPathsArray, PULLUP_ANIMATOR_VIEW_NUM_FRAMES);
-
     }
 
     GoalotherView *GoalotherView::GetInstance()
@@ -187,106 +181,101 @@ namespace OHOS
     // 初始化天气页面
     bool GoalotherView::InitPage(void)
     {
-       /////////////////////////////////线////////////////////////////////////////////////
-        if (transverseline_1 == nullptr) {
-        transverseline_1 = new UIImageView();
+        /////////////////////////////////线////////////////////////////////////////////////
+        if (transverseline_1 == nullptr)
+        {
+            transverseline_1 = new UIImageView();
         }
-        transverseline_1->SetPosition(0, 169);         
-        transverseline_1->Resize(466, 2);          
+        transverseline_1->SetPosition(0, 169);
+        transverseline_1->Resize(466, 2);
         transverseline_1->SetStyle(STYLE_BACKGROUND_COLOR, 0xff333333);
         transverseline_1->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         transverseline_1->SetVisible(true);
-        
-        // Add ImageView to App
-        if (transverseline_2 == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (transverseline_2 == nullptr)
+        {
             transverseline_2 = new UIImageView();
         }
-        transverseline_2->SetPosition(232, 191);         
-        transverseline_2->Resize(2, 82);          
+        transverseline_2->SetPosition(232, 191);
+        transverseline_2->Resize(2, 82);
         transverseline_2->SetStyle(STYLE_BACKGROUND_COLOR, 0xff333333);
         transverseline_2->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         transverseline_2->SetVisible(true);
-        
-        // Add ImageView to App
-        if (verticalline == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (verticalline == nullptr)
+        {
             verticalline = new UIImageView();
         }
-        verticalline->SetPosition(0, 296);         
-        verticalline->Resize(466, 2);          
+        verticalline->SetPosition(0, 296);
+        verticalline->Resize(466, 2);
         verticalline->SetStyle(STYLE_BACKGROUND_COLOR, 0xff333333);
         verticalline->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         verticalline->SetVisible(true);
-
-
         /////////////////////////////////标题/////////////////////////////////////////
-        if (mileagegoalTitle == nullptr) {
+        if (mileagegoalTitle == nullptr)
+        {
             mileagegoalTitle = new UILabelExt();
         }
-        mileagegoalTitle->SetPosition(113, 61);         
-        mileagegoalTitle->Resize(240, 35);          
+        mileagegoalTitle->SetPosition(113, 61);
+        mileagegoalTitle->Resize(240, 35);
         mileagegoalTitle->SetStyle(STYLE_TEXT_FONT, 30);
-
-        // mileagegoalTitle->SetText("里程(KM)");
         mileagegoalTitle->SetTextId(STR_MILEAGE);
         mileagegoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         mileagegoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         mileagegoalTitle->SetRollSpeed(0);
         mileagegoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         mileagegoalTitle->SetVisible(true);
-
-        if (fatburninggoalTitle == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (fatburninggoalTitle == nullptr)
+        {
             fatburninggoalTitle = new UILabelExt();
         }
-        fatburninggoalTitle->SetPosition(8, 188);         
-        fatburninggoalTitle->Resize(200, 35);          
+        fatburninggoalTitle->SetPosition(8, 188);
+        fatburninggoalTitle->Resize(200, 35);
         fatburninggoalTitle->SetStyle(STYLE_TEXT_FONT, 30);
-
-        // fatburninggoalTitle->SetText("燃脂时间");
         fatburninggoalTitle->SetTextId(STR_FAT_BURNING_TIME);
         fatburninggoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         fatburninggoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         fatburninggoalTitle->SetRollSpeed(0);
         fatburninggoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         fatburninggoalTitle->SetVisible(true);
-
-        if (standgoalTitle == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (standgoalTitle == nullptr)
+        {
             standgoalTitle = new UILabelExt();
         }
-        standgoalTitle->SetPosition(257, 188);         
-        standgoalTitle->Resize(200, 35);          
+        standgoalTitle->SetPosition(257, 188);
+        standgoalTitle->Resize(200, 35);
         standgoalTitle->SetStyle(STYLE_TEXT_FONT, 30);
-        // standgoalTitle->SetText("站立次数");
         standgoalTitle->SetTextId(STR_NUMBER_OF_STANDS);
         standgoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         standgoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         standgoalTitle->SetRollSpeed(0);
         standgoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         standgoalTitle->SetVisible(true);
-    
-        if (caloriegoalTitle == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (caloriegoalTitle == nullptr)
+        {
             caloriegoalTitle = new UILabelExt();
         }
-        caloriegoalTitle->SetPosition(53, 317);         
-        caloriegoalTitle->Resize(360, 35);          
+        caloriegoalTitle->SetPosition(53, 317);
+        caloriegoalTitle->Resize(360, 35);
         caloriegoalTitle->SetStyle(STYLE_TEXT_FONT, 30);
-        // Set additional property
-        // caloriegoalTitle->SetText("消耗卡路里");
         caloriegoalTitle->SetTextId(STR_CONSUME_CALORIES);
         caloriegoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         caloriegoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         caloriegoalTitle->SetRollSpeed(0);
         caloriegoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         caloriegoalTitle->SetVisible(true);
-
+        /* -------------------------------------------------------------------------- */
         ////////////////////////里程///////////////////////////
-        if (mileagenowdataLabel == nullptr) {
+        if (mileagenowdataLabel == nullptr)
+        {
             mileagenowdataLabel = new UILabel();
         }
-        mileagenowdataLabel->SetPosition(163-20+10, 87);         
-        mileagenowdataLabel->Resize(75, 60);          
+        mileagenowdataLabel->SetPosition(163 - 20 + 10, 87);
+        mileagenowdataLabel->Resize(75, 60);
         mileagenowdataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
         mileagenowdataLabel->SetText(GoalModel::GetInstance().getdistancenew().c_str());
         mileagenowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         mileagenowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff));
@@ -294,16 +283,14 @@ namespace OHOS
         mileagenowdataLabel->SetRollSpeed(0);
         mileagenowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
         mileagenowdataLabel->SetVisible(true);
-
-        // Add Label to App
-        if (mileagegoaldataLabel == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (mileagegoaldataLabel == nullptr)
+        {
             mileagegoaldataLabel = new UILabel();
         }
-        mileagegoaldataLabel->SetPosition(243-20+10, 86);         
-        mileagegoaldataLabel->Resize(82, 60);          
+        mileagegoaldataLabel->SetPosition(243 - 20 + 10, 86);
+        mileagegoaldataLabel->Resize(82, 60);
         mileagegoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
         mileagegoaldataLabel->SetText(GoalModel::GetInstance().getdistanceGoal().c_str());
         mileagegoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         mileagegoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
@@ -311,16 +298,15 @@ namespace OHOS
         mileagegoaldataLabel->SetRollSpeed(0);
         mileagegoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
         mileagegoaldataLabel->SetVisible(true);
-
+        /* -------------------------------------------------------------------------- */
         ///////////////////////燃脂///////////////////////////
-        if (fatburningnowdataLabel == nullptr) {
+        if (fatburningnowdataLabel == nullptr)
+        {
             fatburningnowdataLabel = new UILabel();
         }
-        fatburningnowdataLabel->SetPosition(47-20-10, 223);         
-        fatburningnowdataLabel->Resize(75, 60);          
+        fatburningnowdataLabel->SetPosition(47 - 20 - 10, 223);
+        fatburningnowdataLabel->Resize(75, 60);
         fatburningnowdataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
         fatburningnowdataLabel->SetText(GoalModel::GetInstance().getfatburningnew().c_str());
         fatburningnowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         fatburningnowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff));
@@ -328,15 +314,14 @@ namespace OHOS
         fatburningnowdataLabel->SetRollSpeed(0);
         fatburningnowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
         fatburningnowdataLabel->SetVisible(true);
-        // Add Label to App
-        if (fatburninggoaldataLabel == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (fatburninggoaldataLabel == nullptr)
+        {
             fatburninggoaldataLabel = new UILabel();
         }
-        fatburninggoaldataLabel->SetPosition(128-20-10, 223);        
-        fatburninggoaldataLabel->Resize(82, 60);          
+        fatburninggoaldataLabel->SetPosition(128 - 20 - 10, 223);
+        fatburninggoaldataLabel->Resize(82, 60);
         fatburninggoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
         fatburninggoaldataLabel->SetText(GoalModel::GetInstance().getfatburninggoal().c_str());
         fatburninggoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         fatburninggoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
@@ -344,16 +329,15 @@ namespace OHOS
         fatburninggoaldataLabel->SetRollSpeed(0);
         fatburninggoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
         fatburninggoaldataLabel->SetVisible(true);
+        /* -------------------------------------------------------------------------- */
         ///////////////////////站立///////////////////////////
-        if (standnowdataLabel == nullptr) {
+        if (standnowdataLabel == nullptr)
+        {
             standnowdataLabel = new UILabel();
         }
-        standnowdataLabel->SetPosition(47+200+10, 223);        
-        standnowdataLabel->Resize(75, 60);          
+        standnowdataLabel->SetPosition(47 + 200 + 10, 223);
+        standnowdataLabel->Resize(75, 60);
         standnowdataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
-        
         standnowdataLabel->SetText(GoalModel::GetInstance().getstandnew().c_str());
         standnowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         standnowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff));
@@ -361,31 +345,29 @@ namespace OHOS
         standnowdataLabel->SetRollSpeed(0);
         standnowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
         standnowdataLabel->SetVisible(true);
-
-        if (standgoaldataLabel == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (standgoaldataLabel == nullptr)
+        {
             standgoaldataLabel = new UILabel();
         }
-        standgoaldataLabel->SetPosition(128+200+10, 223);         
-        standgoaldataLabel->Resize(82, 60);          
+        standgoaldataLabel->SetPosition(128 + 200 + 10, 223);
+        standgoaldataLabel->Resize(82, 60);
         standgoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
         standgoaldataLabel->SetText(GoalModel::GetInstance().getstandgoal().c_str());
         standgoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         standgoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
         standgoaldataLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
         standgoaldataLabel->SetRollSpeed(0);
         standgoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
-
+        /* -------------------------------------------------------------------------- */
         ///////////////////////卡路里///////////////////////////
-        if (calorienowdataLabel == nullptr) {
+        if (calorienowdataLabel == nullptr)
+        {
             calorienowdataLabel = new UILabel();
         }
-        calorienowdataLabel->SetPosition(163-20-10, 353);         
-        calorienowdataLabel->Resize(75, 60);         
+        calorienowdataLabel->SetPosition(163 - 20 - 10, 353);
+        calorienowdataLabel->Resize(75, 60);
         calorienowdataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
         calorienowdataLabel->SetText(GoalModel::GetInstance().getcaloriespnew().c_str());
         calorienowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         calorienowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff));
@@ -393,72 +375,46 @@ namespace OHOS
         calorienowdataLabel->SetRollSpeed(0);
         calorienowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
         calorienowdataLabel->SetVisible(true);
-
-        if (caloriegoaldataLabel == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (caloriegoaldataLabel == nullptr)
+        {
             caloriegoaldataLabel = new UILabel();
         }
-        caloriegoaldataLabel->SetPosition(243-20-10, 353);         
-        caloriegoaldataLabel->Resize(82+40, 60);          
+        caloriegoaldataLabel->SetPosition(243 - 20 - 10, 353);
+        caloriegoaldataLabel->Resize(82 + 40, 60);
         caloriegoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40);
-
-        // Set additional property
         caloriegoaldataLabel->SetText(GoalModel::GetInstance().getcaloriesGoal().c_str());
-
         caloriegoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         caloriegoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
         caloriegoaldataLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
         caloriegoaldataLabel->SetRollSpeed(0);
         caloriegoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
         caloriegoaldataLabel->SetVisible(true);
-
-        if (PullUpAnimatorView == nullptr)
-        {
-            PullUpAnimatorView = new UIImageAnimatorView();
-            if (PullUpAnimatorView == nullptr)
-            {
-                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpAnimatorView new fail");
-                return false;
-            }
-            if(GoalView::GetInstance())
-            {
-                // PullUpPathsArray = CreateImagePathsArray(PullUpPaths, "bin", PULLUP_ANIMATOR_VIEW_NUM_FRAMES);
-                for (uint8_t i = 0; i < PULLUP_ANIMATOR_VIEW_NUM_FRAMES; i++)
-                {
-                  GoalView::GetInstance()->PullUpimageAnimatorInfo[i].pos.y = PULLUP_ANIMATOR_VIEW_Y;
-                }
-                // 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(GoalView::GetInstance()->PullUpimageAnimatorInfo, PULLUP_ANIMATOR_VIEW_NUM_FRAMES, PULLUP_ANIMATOR_VIEW_TIME);
-                PullUpAnimatorView->SetRepeat(true);
-                PullUpAnimatorView->Start();
-                Add(PullUpAnimatorView);
-            }
-        }
-              
-
-            
-        
+        /* -------------------------------------------------------------------------- */
+        PullUpImage = new UIImageView();
+        if (PullUpImage == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalView::new PullUpImage fail!");
+            return false;
+        }
+        PullUpImage->SetPosition(213, 400, 40, 40);
+        PullUpImage->SetAutoEnable(false);
+        PullUpImage->SetResizeMode(UIImageView::CONTAIN);
+        PullUpImage->SetSrc("/user/res/Sleep/up.bin");
         /* -------------------------------- 将组件添加到根视图 ------------------------------- */
+        Add(PullUpImage);
         Add(caloriegoalTitle);
         Add(mileagegoalTitle);
         Add(fatburninggoalTitle);
         Add(standgoalTitle);
-
         Add(caloriegoaldataLabel);
         Add(calorienowdataLabel);
-
         Add(mileagegoaldataLabel);
         Add(mileagenowdataLabel);
-
         Add(fatburninggoaldataLabel);
         Add(fatburningnowdataLabel);
-
         Add(standgoaldataLabel);
         Add(standnowdataLabel);
-
-       
-
         Add(transverseline_1);
         Add(transverseline_2);
         Add(verticalline);
@@ -484,5 +440,4 @@ namespace OHOS
         return viewInitStatus;
     }
 
-
 }
\ No newline at end of file
index 4a4c64c..d60ac1f 100644 (file)
@@ -5,12 +5,10 @@
 #include "gfx_utils/mem_api.h"
 #include "uicomponents/UIComponents.h"
 
-
 // #include "goal_notification.h"
 
 namespace OHOS
 {
-   
 
     static constexpr int16_t PULLUP_ANIMATOR_VIEW_X = 213;
     static constexpr int16_t PULLUP_ANIMATOR_VIEW_Y = 360;
@@ -18,8 +16,7 @@ namespace OHOS
     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/";
@@ -27,7 +24,6 @@ namespace OHOS
     static GoalView *g_pgoalView{nullptr};
     GoalView::GoalView()
     {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GoalView::GoalView");
         SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
         SetViewIndex(0); // 视图索引
         GoalModel::GetInstance().GoalModelInitdata();
@@ -36,27 +32,19 @@ namespace OHOS
 
     GoalView::~GoalView()
     {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " GoalView::~GoalView");
         ClearAll();
         g_pgoalView = nullptr;
     }
-  
 
     void GoalView::GoalViewrefresh()
     {
-        if(nowstepLabel)
-        nowstepLabel->SetText(GoalModel::GetInstance().getstepnew().c_str());
-        if(goalstepLabel)
-        goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal().c_str());
-        if(circleProgress1_)
-        circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue());
-
-       
-
+        if (nowstepLabel)
+            nowstepLabel->SetText(GoalModel::GetInstance().getstepnew().c_str());
+        if (goalstepLabel)
+            goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal().c_str());
+        if (circleProgress1_)
+            circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue());
         Invalidate();
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GoalViewrefresh Invalidat ");
-        // RootView::GetInstance()->Invalidate();
-
     }
 
     void GoalView::ClearAll()
@@ -85,39 +73,22 @@ namespace OHOS
         if (stepAnimatorView != nullptr)
         {
             stepAnimatorView->Stop();
-            //stepAnimatorView->ClearImagesCache();
             delete stepAnimatorView;
             stepAnimatorView = nullptr;
         }
-        if (PullUpAnimatorView != nullptr)
-        {
-            PullUpAnimatorView->Stop();
-            delete PullUpAnimatorView;
-            PullUpAnimatorView = nullptr;
-        }
         if (circleProgressimage != nullptr)
         {
             delete circleProgressimage;
             circleProgressimage = nullptr;
         }
-        // for(int i=0;i<20;i++)
-        // {
-            
-        // }
+        if(PullUpImage)
+        {
+            delete PullUpImage;
+            PullUpImage = nullptr;  
+        }
         ImageCacheManager::GetInstance().UnloadSingleRes("/user/res/step/step_b.bin");
-        FreeImageInfoArray(goalAnimator_imageInfo,stepPaths, 20);
-        FreeImageInfoArray(PullUpimageAnimator_imageInfo,PullUpPaths, PULLUP_ANIMATOR_VIEW_NUM_FRAMES);
-        // FreeImagePathsArray(PullUpPathsArray, PULLUP_ANIMATOR_VIEW_NUM_FRAMES);
-        // FreeImagePathsArray(goalPathsArray, 20);
-
-        // if(goalAnimatorInfo)
-        // {
-
-        //     delete goalAnimatorInfo;
-        //     goalAnimatorInfo= nullptr;
-        // }
-        
-    }
+        FreeImageInfoArray(goalAnimator_imageInfo, stepPaths, 20);
+        }
 
     GoalView *GoalView::GetInstance()
     {
@@ -145,46 +116,40 @@ namespace OHOS
     // 初始化天气页面
     bool GoalView::InitPage(void)
     {
-    
         /* --------------------------------goalTitle--------------------------------- */
-         if (goalTitle == nullptr) {
+        if (goalTitle == nullptr)
+        {
             goalTitle = new UILabelExt();
         }
-        goalTitle->SetPosition(83, 50);         
-        goalTitle->Resize(300, 35);          
+        goalTitle->SetPosition(83, 50);
+        goalTitle->Resize(300, 35);
         goalTitle->SetStyle(STYLE_TEXT_FONT, 30);
-
-        // goalTitle->SetText("今日步数");
         goalTitle->SetTextId(STR_STEPS_OF_THE_DAY);
         goalTitle->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
         goalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         goalTitle->SetRollSpeed(0);
         goalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         /*----------------------------------------------------------------------------- */
-
-
-        // Add Label to App
-        if (nowstepLabel == nullptr) {
+        if (nowstepLabel == nullptr)
+        {
             nowstepLabel = new UILabelExt();
         }
-        nowstepLabel->SetPosition(121-40, 201);         
-        nowstepLabel->Resize(223+80, 94);          
+        nowstepLabel->SetPosition(121 - 40, 201);
+        nowstepLabel->Resize(223 + 80, 94);
         nowstepLabel->SetStyle(STYLE_TEXT_FONT, 80);
-        nowstepLabel->SetText(GoalModel::GetInstance().getstepnew().c_str());//);
+        nowstepLabel->SetText(GoalModel::GetInstance().getstepnew().c_str()); //);
         nowstepLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
-        //nowstepLabel->SetTextColor(0x4FC34C);
         nowstepLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff));
         nowstepLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         nowstepLabel->SetRollSpeed(0);
         nowstepLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 80);
-
-        
-        // Add Label to App
-        if (goalstepLabel == nullptr) {
+        /* -------------------------------------------------------------------------- */
+        if (goalstepLabel == nullptr)
+        {
             goalstepLabel = new UILabelExt();
         }
-        goalstepLabel->SetPosition(157, 297);        
-        goalstepLabel->Resize(152, 47);          
+        goalstepLabel->SetPosition(157, 297);
+        goalstepLabel->Resize(152, 47);
         goalstepLabel->SetStyle(STYLE_TEXT_FONT, 40);
         goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal().c_str());
         goalstepLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
@@ -192,33 +157,29 @@ namespace OHOS
         goalstepLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         goalstepLabel->SetRollSpeed(0);
         goalstepLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
-
-
         /*----------------------------------------------------------------------------- */
-        if (circleProgressimage == nullptr) {
+        if (circleProgressimage == nullptr)
+        {
             circleProgressimage = new UIImageView();
         }
-        circleProgressimage->SetPosition(28, 80-5);         
-        circleProgressimage->Resize(100, 100);          
-        char* image5imagesPath = "/user/res/step/step_b.bin";
-        ImageInfo *info= ImageCacheManager::GetInstance().LoadSingleRes(image5imagesPath);
+        circleProgressimage->SetPosition(28, 80 - 5);
+        circleProgressimage->Resize(100, 100);
+        char *image5imagesPath = "/user/res/step/step_b.bin";
+        ImageInfo *info = ImageCacheManager::GetInstance().LoadSingleRes(image5imagesPath);
         circleProgressimage->SetSrc(info);
         circleProgressimage->SetVisible(true);
-
-        if (circleProgress1_ == nullptr) {
+        if (circleProgress1_ == nullptr)
+        {
             circleProgress1_ = new UICircleProgress();
         }
-        circleProgress1_->SetPosition(0, -5);         
-        circleProgress1_->Resize(466, 466);          
+        circleProgress1_->SetPosition(0, -5);
+        circleProgress1_->Resize(466, 466);
         circleProgress1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
         circleProgress1_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
         circleProgress1_->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0x00);
         circleProgress1_->SetBackgroundStyle(STYLE_LINE_HEIGHT, 200);
         circleProgress1_->SetBackgroundStyle(STYLE_LINE_WIDTH, 21);
         circleProgress1_->SetBackgroundStyle(STYLE_LINE_OPA, 0x00);
-
-
-        // Set ForegroundStyle
         circleProgress1_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195F6);
         circleProgress1_->SetForegroundStyle(STYLE_BORDER_WIDTH, 200);
         circleProgress1_->SetForegroundStyle(STYLE_BORDER_RADIUS, 200);
@@ -233,9 +194,8 @@ namespace OHOS
         circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue());
         circleProgress1_->SetBackgroundImagePosition(36, 26);
         circleProgress1_->SetCapType(CAP_ROUND);
-
-         /*----------------------------------------------------------------------------- */
-        goalAnimator_imageInfo=CreateImageInfoArray(stepPaths, 20);
+        /*----------------------------------------------------------------------------- */
+        goalAnimator_imageInfo = CreateImageInfoArray(stepPaths, 20);
         if (stepAnimatorView == nullptr)
         {
             stepAnimatorView = new UIImageAnimatorView();
@@ -246,73 +206,40 @@ namespace OHOS
             }
             for (uint8_t i = 0; i < 20; i++)
             {
-                //goalAnimatorInfo[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(goalPathsArray[i]);
-                //goalAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO;
-                //goalAnimatorInfo=new ImageAnimatorInfo [20];
-                //goalAnimatorInfo[i].imageInfo=nullptr;
                 goalAnimatorInfo[i].imageInfo = goalAnimator_imageInfo[i];
                 goalAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO;
-
-                //goalAnimatorInfo[i].imagePath = goalPathsArray[i];
-                //goalAnimatorInfo[i].imageInfo=nullptr;
-                //goalAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH;
                 goalAnimatorInfo[i].pos.x = 193;
                 goalAnimatorInfo[i].pos.y = 90;
                 goalAnimatorInfo[i].width = 100;
                 goalAnimatorInfo[i].height = 100;
-                
             }
             stepAnimatorView->SetPosition(183, 90, 100, 100);
             stepAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
             stepAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-            //这里出现内存泄露
+            // 这里出现内存泄露
             stepAnimatorView->SetImageAnimatorSrc(goalAnimatorInfo, 20, 50);
-
             stepAnimatorView->SetRepeat(true);
             stepAnimatorView->Start();
         }
-
-
-
-         PullUpimageAnimator_imageInfo =CreateImageInfoArray(PullUpPaths, PULLUP_ANIMATOR_VIEW_NUM_FRAMES);
-        if (PullUpAnimatorView == nullptr)
+        /* -------------------------------- 将组件添加到根视图 ------------------------------- */
+        PullUpImage = new UIImageView();
+        if (PullUpImage == nullptr)
         {
-            PullUpAnimatorView = new UIImageAnimatorView();
-            if (PullUpAnimatorView == nullptr)
-            {
-                WEARABLE_LOGD(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();
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalView::new PullUpImage fail!");
+            return false;
         }
-        /* -------------------------------- 将组件添加到根视图 ------------------------------- */
+        PullUpImage->SetPosition(213, 420, 40, 40);
+        PullUpImage->SetAutoEnable(false);
+        PullUpImage->SetResizeMode(UIImageView::CONTAIN);
+        PullUpImage->SetSrc("/user/res/Sleep/up.bin");
+        /* -------------------------------------------------------------------------- */
         Add(circleProgressimage);
-
         Add(circleProgress1_);
-
         Add(goalstepLabel);
         Add(nowstepLabel);
-        Add(PullUpAnimatorView);
         Add(goalTitle);
         Add(stepAnimatorView);
-       
+        Add(PullUpImage);
 
         viewInitStatus = true;
         return true;
@@ -336,7 +263,5 @@ namespace OHOS
     {
         return viewInitStatus;
     }
-   
-
 
 }
\ No newline at end of file