Merge #282 into sdk602patch0521 from refs/changes/282/head 285/target/1
author胡传军 <1224667075@qq.com>
Fri, 14 Jun 2024 08:03:41 +0000 (08:03 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Fri, 14 Jun 2024 08:03:41 +0000 (08:03 +0000)
主界面活动卡片增加

* refs/changes/282/head: (1 commits squashed)

  - 主界面活动卡片增加

Signed-off-by: aliyun8003852482 <1224667075@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/282
13 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h
code/sdk/application/wearable/fd230app/nativeui/goal/include/goalControlView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/goal/include/goalview.h
code/sdk/application/wearable/fd230app/nativeui/goal/src/goalControlView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp
code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp
code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h
code/sdk/application/wearable/fd230app/nativeui/main/src/MainModel.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp
code/sdk/application/wearable/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/step_b.bin [new file with mode: 0644]

index c053490..f17a043 100644 (file)
@@ -651,6 +651,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/Maingoalview.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalother.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalhint.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalControlView.cpp
     #${CMAKE_CURRENT_SOURCE_DIR} /service/acc_service.c
 )
 if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES)
index 0e3820e..073804d 100644 (file)
@@ -25,7 +25,8 @@ namespace OHOS
         WEATHER,
         TRAINING,
         ACTIVITY,
-        SETCARD,     
+        SETCARD, 
+        GOAL,    
         MAX_CARD,
     } CardId;
 
diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalControlView.h b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalControlView.h
new file mode 100644 (file)
index 0000000..f112ca1
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef GOAL_CONTROL_VIEW_H
+#define GOAL_CONTROL_VIEW_H
+/*该视图主要放在主视图*/
+
+#include "components/root_view.h"
+#include "components/ui_card_page.h"
+#include "wearable_log.h"
+#include "goal/include/Maingoalview.h"
+namespace OHOS
+{
+    class goalControlView : public UICardPage
+    {
+    public:
+        goalControlView();
+        virtual ~goalControlView();
+        bool InitView(void);
+        void PreLoad(void) override;
+        void UnLoad(void) override;
+
+    private:
+        void ClearAll(void);
+        MaingoalrView *maingoalView{nullptr};
+        UISwipeView::OnSwipeListener *goalOnSwipeListener{nullptr};
+        bool viewiInitStatus{false};
+    };
+}
+#endif
\ No newline at end of file
index 9d4ad69..f5ed139 100644 (file)
@@ -39,7 +39,7 @@ namespace OHOS
         void ClearAll();
         bool GetInitViewState(void);
         void GoalViewrefresh();
-        
+
     private:
         UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight);
 
@@ -53,7 +53,7 @@ namespace OHOS
         UILabelExt *goalTitle{nullptr};          // 目标
         UILabelExt *goalstepLabel{nullptr};          // 目标
         UILabelExt *nowstepLabel{nullptr};          // 完成
-
+        UIImageView* circleProgressimage{nullptr};      
         UIImageAnimatorView *PullUpAnimatorView{nullptr};   // 上拉动画
         UIImageAnimatorView *stepAnimatorView{nullptr};   // 走路动画
         const char **PullUpPathsArray{nullptr};
diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalControlView.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalControlView.cpp
new file mode 100644 (file)
index 0000000..78d8b43
--- /dev/null
@@ -0,0 +1,84 @@
+#include "goal/include/goalControlView.h"
+#include "goal/include/Maingoalpresenter.h"
+namespace OHOS
+{
+    goalControlView::goalControlView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "goalControlView::goalControlView");
+        SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+    }
+
+    goalControlView::~goalControlView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "goalControlView::~goalControlView");
+        ClearAll();
+    }
+
+    void goalControlView::ClearAll(void)
+    {
+        if (viewiInitStatus == true)
+        {
+            RemoveAll();
+            if (maingoalView != nullptr)
+            {
+                if (goalOnSwipeListener != nullptr)
+                {
+                    delete goalOnSwipeListener;
+                    goalOnSwipeListener = nullptr;
+                }
+                
+                if (maingoalView != nullptr)
+                {
+                    delete maingoalView;
+                    maingoalView = nullptr;
+                }
+            }
+        }
+    }
+
+    bool goalControlView::InitView(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goalControlView::InitView");
+        maingoalView = new MaingoalrView();
+        if (maingoalView == nullptr)
+        {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherView::new mainweatherView fail!");
+            return false;
+        }
+
+      
+        UISwipeView *goalSwipView = dynamic_cast<UISwipeView *>(maingoalView->GetGoalPageView());
+        if (goalSwipView == nullptr)
+        {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "mainWeatherView->MainWeatherViewInit() == nullptr!!");
+            return false;
+        }
+
+        goalOnSwipeListener = static_cast<UISwipeView::OnSwipeListener *>(new GoalControlViewOnSwipeListener());
+        if (goalOnSwipeListener == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnSwipeListener new fail");
+            return false;
+        }
+        goalSwipView->SetOnSwipeListener(goalOnSwipeListener);
+        Add(goalSwipView);
+       
+        return true;
+    }
+
+    void goalControlView::PreLoad(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goalControlView::PreLoad");
+        if (!viewiInitStatus)
+        {
+            InitView();
+            viewiInitStatus = true;
+        }
+    }
+
+    void goalControlView::UnLoad(void)
+    {
+        // Weather's usage scenes is complicated, so we do not release it's resources inner slice.
+    }
+
+}
\ No newline at end of file
index bef09fb..d7e8a46 100644 (file)
@@ -28,7 +28,12 @@ namespace OHOS
     {
         int stepgoal= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);
         int stepdata= OHOS::ActivityModel::GetInstance()->GetStepCounter();
-        return stepdata/stepgoal *100;
+        int value=  stepdata/stepgoal *100;
+        if(value>100)
+        {
+            value=100;
+        }
+        return value;
     }
     char stepgoalstr[20];
     char* GoalModel::getstepGoal()
index efc442f..387ddd7 100644 (file)
@@ -47,9 +47,10 @@ namespace OHOS
     {
         nowstepLabel->SetText(GoalModel::GetInstance().getstepnew());
         goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal());
-
         circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue());
 
+        RootView::GetInstance()->Invalidate();
+
     }
 
     void GoalView::ClearAll()
@@ -86,6 +87,13 @@ namespace OHOS
             delete PullUpAnimatorView;
             PullUpAnimatorView = nullptr;
         }
+        if (circleProgressimage != nullptr)
+        {
+
+            delete circleProgressimage;
+            circleProgressimage = nullptr;
+        }
+        
         FreeImagePathsArray(PullUpPathsArray, PULLUP_ANIMATOR_VIEW_NUM_FRAMES);
         FreeImagePathsArray(PullUpPathsArray, 20);
         
@@ -177,32 +185,59 @@ namespace OHOS
 
         /*----------------------------------------------------------------------------- */
 
+            // Add ImageView to App
+        if (circleProgressimage == nullptr) {
+            circleProgressimage = new UIImageView();
+        }
+        circleProgressimage->SetPosition(28, 80);         // widget's left position and top position
+        circleProgressimage->Resize(100, 100);          // widget's width and height
+        circleProgressimage->SetViewId("image5");// Set style
+
+     
+        char* image5imagesPath = "/user/res/step/step_b.bin";
+
+        circleProgressimage->SetSrc(image5imagesPath);
+
+            // Add to rootView
+      
+        circleProgressimage->SetVisible(true);
+        if(circleProgressimage!=NULL)
+        {
+             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "circleProgressimage");
+        }
+
+
         if (circleProgress1_ == nullptr) {
-        circleProgress1_ = new UICircleProgress();
+            circleProgress1_ = new UICircleProgress();
         }
-        circleProgress1_->SetPosition(0, 0);         // widget's left position and top position
+        circleProgress1_->SetPosition(-1, 0);         // widget's left position and top position
         circleProgress1_->Resize(466, 466);          // widget's width and height
         circleProgress1_->SetViewId("circleProgress1");// Set style
         circleProgress1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
-        circleProgress1_->SetStyle(STYLE_BORDER_WIDTH, 10);
 
         // Set additional property
         // Set BackgroundStyle
         circleProgress1_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
-        circleProgress1_->SetBackgroundStyle(STYLE_LINE_WIDTH, 16);
+        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, 80);
-        circleProgress1_->SetForegroundStyle(STYLE_BORDER_RADIUS, 16);
-        circleProgress1_->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff);
+        circleProgress1_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195F6);
+        circleProgress1_->SetForegroundStyle(STYLE_BORDER_WIDTH, 200);
+        circleProgress1_->SetForegroundStyle(STYLE_BORDER_RADIUS, 200);
+        circleProgress1_->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff000000);
         circleProgress1_->SetForegroundStyle(STYLE_LINE_HEIGHT, 35);
         circleProgress1_->SetForegroundStyle(STYLE_LINE_COLOR, 0xff45ff5d);
-        circleProgress1_->SetForegroundStyle(STYLE_LINE_WIDTH, 16);
-        circleProgress1_->SetCenterPosition(224, 220);
-        circleProgress1_->SetRadius(195);
+        circleProgress1_->SetForegroundStyle(STYLE_LINE_WIDTH, 20);
+        circleProgress1_->SetCenterPosition(233, 229);
+        circleProgress1_->SetRadius(205);
         circleProgress1_->SetStartAngle(40);
         circleProgress1_->SetEndAngle(320);
-        circleProgress1_->SetValue(1);
+        circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue());
+        circleProgress1_->SetBackgroundImagePosition(36, 26);
 
          /*----------------------------------------------------------------------------- */
          goalPathsArray = CreateImagePathsArray(stepPaths, "bin", 20);
@@ -259,12 +294,16 @@ namespace OHOS
             PullUpAnimatorView->Start();
         }
         /* -------------------------------- 将组件添加到根视图 ------------------------------- */
+        Add(circleProgressimage);
+
         Add(circleProgress1_);
+
         Add(goalstepLabel);
         Add(nowstepLabel);
         Add(PullUpAnimatorView);
         Add(goalTitle);
         Add(stepAnimatorView);
+       
 
         viewInitStatus = true;
         return true;
index 85e765a..f6a9dee 100644 (file)
@@ -36,6 +36,8 @@
 #include "traing/training_card/include/Training_CardView.h"
 // #include "ApplistCardView.h"
 #include "weather/include/WeatherControlView.h"
+#include "goal/include/goalControlView.h"
+
 #include "message/include/MessageCardView.h"
 #include "set_card/include/SetMainView.h"
 namespace OHOS
@@ -59,6 +61,8 @@ namespace OHOS
         UICardPage *InitMusicPlayerPage(void);
         UICardPage *InitBloodOxygenPage(void);
         UICardPage *InitWeatherPage(void);
+        UICardPage *InitGoalPage(void);
+        
         UICardPage *InitTrainingPage(void);
         UICardPage *InitApplistPage(void);
         UICardPage *InitSetMainPage(void);
@@ -104,9 +108,13 @@ namespace OHOS
         CompassControlView *compassControlView{nullptr};
         HeartRateView *heartRateView{nullptr};
         BloodCardView *bloodView{nullptr};
+
         WeatherControlView *weatherControlView{nullptr};
+        goalControlView *GoalControlView{nullptr};
+
         Training_CardView *traingView{nullptr};
         SetMainView *setmainView{nullptr};
+
         // ApplistCardView *applistCardView{nullptr};
         UIButton *changebut{nullptr};
         UIImageView *disturbIcon{nullptr}; // 勿扰图标
index d0a7815..9d0e6f1 100644 (file)
@@ -25,6 +25,7 @@ namespace OHOS
         {TRAINING, PNG_SET_CARD_TRAIN},\r
         {ACTIVITY, PNG_SET_CARD_ACTIVITY},\r
         {SETCARD, PNG_SET_CARD_ACTIVITY},\r
+        {GOAL, PNG_SET_CARD_TRAIN},\r
     };\r
     /*自定义map?*/\r
     const DialInfo dialInfoMap[] = {\r
index 1073acd..cb289a8 100644 (file)
@@ -37,7 +37,8 @@ namespace OHOS
         {WEATHER, &MainViewSample::InitWeatherPage},
         {TRAINING, &MainViewSample::InitTrainingPage},
         {ACTIVITY, &MainViewSample::InitActivityPage},
-        {SETCARD, &MainViewSample::InitSetMainPage},
+        {SETCARD, &MainViewSample::InitSetMainPage}, 
+        {GOAL, &MainViewSample::InitGoalPage},
     };
     MainViewSample::MainViewSample()
     {
@@ -126,11 +127,18 @@ namespace OHOS
             delete bloodView;
             bloodView = nullptr;
         }
+        
         if (traingView != nullptr)
         {
             traingView->RemoveAll();
-            delete traingView;
+            delete traingView; 
             traingView = nullptr;
+        }
+         if (GoalControlView != nullptr)
+        {
+            GoalControlView->RemoveAll();
+            delete GoalControlView; 
+            GoalControlView = nullptr;
         }
         // if (applistCardView != nullptr)
         // {
@@ -426,6 +434,7 @@ namespace OHOS
         }
         return traingView;
     }
+    
     // 主界面天气卡片
     UICardPage *MainViewSample::InitWeatherPage(void)
     {
@@ -436,7 +445,19 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainweatherView new fail");
             return nullptr;
         }
-        return weatherControlView;
+        return weatherControlView; 
+    }
+
+    UICardPage *MainViewSample::InitGoalPage(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::InitWeatherPage");
+        GoalControlView = new goalControlView();
+        if (GoalControlView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainweatherView new fail");
+            return nullptr;
+        }
+        return GoalControlView; 
     }
     // 主界面心率卡片
     UICardPage *MainViewSample::InitHeartRatePage(void)
index cdb46e3..a58b970 100644 (file)
@@ -24,6 +24,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps
     ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include
     ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits
@@ -128,6 +129,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps
     ${CMAKE_CURRENT_SOURCE_DIR}/../../CustomUIComponentTool/uicomponents/
index 68252f1..bad1b0d 100644 (file)
@@ -47,6 +47,8 @@
 #include "producttest/include/testcat1.h"
 #endif
 #include <cywee_hal.h>
+
+#include "goalview.h"
 //#include "Systemupgrade.h"
 namespace OHOS {
 
@@ -278,8 +280,17 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req)
    calories_history_save();
    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
    distances_history_save();
+}
 
-
+void MsgCenterNotifystepProc(const Topic topic, Request* req)
+{
+    unused(req);
+    if(OHOS::GoalView::GetInstance())
+    {
+        OHOS::GoalView::GetInstance()->GoalViewrefresh();
+    }
+    // The alarm notification is not displayed if the incoming call notification is already being processed
+   // cywee_save_data();
 
 }
 
@@ -1029,6 +1040,7 @@ void MsgCenterNotifybleTransmit(const Topic topic, Request* req)
 static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_ALARM_RING,         MsgCenterNotifyAlarmProc},
     {TOPIC_EVENT_ON_TIME,            MsgCenterNotifyONtimeProc},//增加整点保存数据
+    {TOPIC_EVENT_STEPDATA_UPDATE,    MsgCenterNotifystepProc},
     {TOPIC_EVENT_NEXTDAY_UPDATE,     MsgCenterNotifyNextDayProc},
     {TOPIC_EVENT_HFP_INCOMMING,      MsgCenterNotifyHfpIncomingProc},
     {TOPIC_EVENT_HFP_PHONE_ACTIVE,   MsgCenterNotifyHfpPhoneProc},
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/step_b.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/step_b.bin
new file mode 100644 (file)
index 0000000..06b11e4
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:aa5fbb908c94f811a58664a8d03f44091e4098e6de2b0609101af23c74269c84
+size 98280