From aaa142afa8ce7ad5221f56e2ef03c7b3d9028fa7 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 28 May 2024 20:50:17 +0800 Subject: [PATCH] =?utf8?q?indoorwalk=20=E6=96=87=E4=BB=B6=E5=A4=B9?= =?utf8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../indoorwalk/include/CustomizationView.h | 2 +- .../indoorwalk/include/IndoorWalkModel.h | 91 +++++++++---------- .../indoorwalk/include/IndoorWalkMotionView.h | 2 - .../indoorwalk/include/IndoorWalkPresenter.h | 4 +- .../indoorwalk/include/MotionPageFifth.h | 2 +- .../indoorwalk/include/MotionPageFirst.h | 2 +- .../indoorwalk/include/MotionPageFourth.h | 2 +- .../indoorwalk/include/MotionPageSecond.h | 2 +- .../indoorwalk/include/MotionPageThird.h | 2 +- .../indoorwalk/src/CustomizationView.cpp | 4 +- .../indoorwalk/src/IndoorWalkEndView.cpp | 4 +- .../indoorwalk/src/IndoorWalkModel.cpp | 80 ++++++++-------- .../indoorwalk/src/IndoorWalkPreparedView.cpp | 8 +- .../indoorwalk/src/IndoorWalkPresenter.cpp | 72 ++++++--------- .../indoorwalk/src/IndoorWalkView.cpp | 4 +- .../indoorwalk/src/MotionPageFifth.cpp | 7 +- .../indoorwalk/src/MotionPageFirst.cpp | 26 +++--- .../indoorwalk/src/MotionPageFourth.cpp | 9 +- .../indoorwalk/src/MotionPageSecond.cpp | 21 ++--- .../indoorwalk/src/MotionPageThird.cpp | 14 +-- .../offlinevoice/src/VocassistView.cpp | 2 +- .../nativeui/saveele/src/SaveElePresenter.cpp | 2 +- .../screennotify/src/ui_screennotify.cpp | 4 +- .../set_dial/src/SetDialPresenter.cpp | 2 +- 24 files changed, 175 insertions(+), 193 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/CustomizationView.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/CustomizationView.h index 557cde567..6ad618fbd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/CustomizationView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/CustomizationView.h @@ -20,7 +20,7 @@ namespace OHOS { class IndoorWalkUIScrollView : public UIScrollView { public: IndoorWalkUIScrollView() {} - virtual ~IndoorWalkUIScrollView() {} + ~IndoorWalkUIScrollView() override {} bool OnDragEvent(const DragEvent& event) override { diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkModel.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkModel.h index 679802aec..2afd4efd3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkModel.h @@ -7,7 +7,7 @@ #ifndef INDOORWALK_MODEL_H #define INDOORWALK_MODEL_H -#include "stdio.h" +#include #include "string" #include "gfx_utils/list.h" #include "components/ui_label.h" @@ -24,46 +24,45 @@ void DisableIndoorWalkTimer(); #endif namespace OHOS { -using namespace std; class IndoorWalkModel { public: ~IndoorWalkModel(); static IndoorWalkModel *GetInstance(void); - string GetConnectionView(); + std::string GetConnectionView(); void SetConnectionView(const char* id); void SetTextLableFirstTop(const char *lable, const char *lableUnit); - string GetTextLableFirstTop(); - string GetTextLableUnitFirstTop(); + std::string GetTextLableFirstTop(); + std::string GetTextLableUnitFirstTop(); void SetTextLableFirstLeft(const char *lable, const char *lableUnit); - string GetTextLableFirstLeft(); - string GetTextLableUnitFirstLeft(); + std::string GetTextLableFirstLeft(); + std::string GetTextLableUnitFirstLeft(); void SetTextLableFirstRight(const char *lable, const char *lableUnit); - string GetTextLableFirstRight(); - string GetTextLableUnitFirstRight(); + std::string GetTextLableFirstRight(); + std::string GetTextLableUnitFirstRight(); void SetTextLableFirstBottom(const char *lable, const char *lableUnit); - string GetTextLableFirstBottom(); - string GetTextLableUnitFirstBottom(); + std::string GetTextLableFirstBottom(); + std::string GetTextLableUnitFirstBottom(); void SetTextLableSecondTop(const char *lable, const char *lableUnit); - string GetTextLableSecondTop(); - string GetTextLableUnitSecondTop(); + std::string GetTextLableSecondTop(); + std::string GetTextLableUnitSecondTop(); void SetTextLableSecondLeft(const char *lable, const char *lableUnit); - string GetTextLableSecondLeft(); - string GetTextLableUnitSecondLeft(); + std::string GetTextLableSecondLeft(); + std::string GetTextLableUnitSecondLeft(); void SetTextLableSecondRight(const char *lable, const char *lableUnit); - string GetTextLableSecondRight(); - string GetTextLableUnitSecondRight(); + std::string GetTextLableSecondRight(); + std::string GetTextLableUnitSecondRight(); void SetTextLableThirdTop(const char *lable, const char *lableUnit); - string GetTextLableThirdTop(); - string GetTextLableUnitThirdTop(); + std::string GetTextLableThirdTop(); + std::string GetTextLableUnitThirdTop(); void SetTextLableThirdBottom(const char *lable, const char *lableUnit); - string GetTextLableThirdBottom(); - string GetTextLableUnitThirdBottom(); + std::string GetTextLableThirdBottom(); + std::string GetTextLableUnitThirdBottom(); void SetTextLableFourth(const char *lable, const char *lableUnit); - string GetTextLableFourth(); - string GetTextLableUnitFourth(); + std::string GetTextLableFourth(); + std::string GetTextLableUnitFourth(); void SetInitialStep(const uint32_t &value); int GetInitialStep(); - char *DisplayMotionDuration(); + std::string& DisplayMotionDuration(); bool OpenDistancesSensor(void); bool CloseDistancesSensor(void); void SetInitialDistances(const float &value); @@ -73,32 +72,32 @@ public: private: IndoorWalkModel(); - string selectPropertiesID; + std::string selectPropertiesID; uint32_t initialStep; float initialDistances; float currentDistances; - string textLableFirstTop{"00:00:00"}; - string textLableUnitFirstTop{"时间"}; - string textLableFirstLeft{"00:00:00"}; - string textLableUnitFirstLeft{"时间"}; - string textLableFirstRight{"00:00:00"}; - string textLableUnitFirstRight{"时间"}; - string textLableFirstBottom{"00:00:00"}; - string textLableUnitFirstBottom{"时间"}; - string textLableSecondTop{"00:00:00"}; - string textLableUnitSecondTop{"时间"}; - string textLableSecondLeft{"00:00:00"}; - string textLableUnitSecondLeft{"时间"}; - string textLableSecondRight{"00:00:00"}; - string textLableUnitSecondRight{"时间"}; - string textLableThirdTop{"00:00:00"}; - string textLableUnitThirdTop{"时间"}; - string textLableThirdBottom{"00:00:00"}; - string textLableUnitThirdBottom{"时间"}; - string textLableFourth{"00:00:00"}; - string textLableUnitFourth{"时间"}; + std::string textLableFirstTop{"00:00:00"}; + std::string textLableUnitFirstTop{"时间"}; + std::string textLableFirstLeft{"00:00:00"}; + std::string textLableUnitFirstLeft{"时间"}; + std::string textLableFirstRight{"00:00:00"}; + std::string textLableUnitFirstRight{"时间"}; + std::string textLableFirstBottom{"00:00:00"}; + std::string textLableUnitFirstBottom{"时间"}; + std::string textLableSecondTop{"00:00:00"}; + std::string textLableUnitSecondTop{"时间"}; + std::string textLableSecondLeft{"00:00:00"}; + std::string textLableUnitSecondLeft{"时间"}; + std::string textLableSecondRight{"00:00:00"}; + std::string textLableUnitSecondRight{"时间"}; + std::string textLableThirdTop{"00:00:00"}; + std::string textLableUnitThirdTop{"时间"}; + std::string textLableThirdBottom{"00:00:00"}; + std::string textLableUnitThirdBottom{"时间"}; + std::string textLableFourth{"00:00:00"}; + std::string textLableUnitFourth{"时间"}; - string motionDuration; + std::string motionDuration; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkMotionView.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkMotionView.h index 303045f66..40e0e4502 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkMotionView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkMotionView.h @@ -48,8 +48,6 @@ private: MotionPageFifth *motionPageFifth{nullptr}; AppGroupView *recordCard[MAX_MOTIONPAGE]{nullptr}; bool pageStatus[MAX_MOTIONPAGE]{false}; - UISwipeView::OnSwipeListener* motionclickListener{nullptr}; - UIView::OnDragListener* motionDragListener{nullptr}; }; } // namespace OHOS #endif // INDOORWALK_MOTION_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkPresenter.h index b3f4c7df5..20755a196 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/IndoorWalkPresenter.h @@ -66,7 +66,7 @@ class IndoorWalkPresenter : public Presenter, public UISwipeView public UIView::OnDragListener { public: IndoorWalkPresenter(); - virtual ~IndoorWalkPresenter(); + ~IndoorWalkPresenter() override; static IndoorWalkPresenter *GetInstance(); void OnStart() override; void OnPause() override; @@ -75,7 +75,7 @@ public: bool OnClick(UIView& view, const ClickEvent& event) override; bool OnDrag(UIView& view, const DragEvent& event) override; bool OnLongPress(UIView& view, const LongPressEvent& event) override; - virtual void OnSwipe(UISwipeView& view) override; + void OnSwipe(UISwipeView& view) override; void HidePageImageView(void); void ModifiesProperties(const char* id, const char *lable, const char *lableUnit); void ModifiesPageFirstTop(const char *lable, const char *lableUnit); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFifth.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFifth.h index 745f0fce0..61f676d58 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFifth.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFifth.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageFifth : public AppGroupView { public: MotionPageFifth(); - virtual ~MotionPageFifth(); + ~MotionPageFifth() override; static MotionPageFifth *GetInstance(void); bool InitView(void *caller) override; bool InitPageFifthLableView(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFirst.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFirst.h index 8b0c1d188..78259fe71 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFirst.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFirst.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageFirst : public AppGroupView { public: MotionPageFirst(); - virtual ~MotionPageFirst(); + ~MotionPageFirst() override; static MotionPageFirst *GetInstance(void); bool InitView(void *caller) override; bool InitPageFirstImageView(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFourth.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFourth.h index f141257d1..34dc3168f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFourth.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageFourth.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageFourth : public AppGroupView { public: MotionPageFourth(); - virtual ~MotionPageFourth(); + ~MotionPageFourth() override; static MotionPageFourth *GetInstance(void); bool InitView(void *caller) override; bool InitPageFourthLableView(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageSecond.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageSecond.h index 005178aa7..2297aa614 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageSecond.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageSecond.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageSecond : public AppGroupView { public: MotionPageSecond(); - virtual ~MotionPageSecond(); + ~MotionPageSecond() override; static MotionPageSecond *GetInstance(void); bool InitView(void *caller) override; bool InitPageSecondImageView(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageThird.h b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageThird.h index de2e51743..e26fcc392 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageThird.h +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/include/MotionPageThird.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageThird : public AppGroupView { public: MotionPageThird(); - virtual ~MotionPageThird(); + ~MotionPageThird() override; static MotionPageThird *GetInstance(void); bool InitView(void *caller) override; bool InitPageThirdImageView(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/CustomizationView.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/CustomizationView.cpp index 1762a8b00..4e3e637ea 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/CustomizationView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/CustomizationView.cpp @@ -353,8 +353,8 @@ UIViewGroup *CustomizationView::InitPropertiesView() group->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); group->SetHorizontalScrollState(false); - if ((ShowUpTitleLabel() == false) || (InitTimeView() == false) || (InitDistancesView() == false) || - (InitHeartView() == false) || (InitSpeedView() == false) || (InitStepsView() == false)) { + if ((!ShowUpTitleLabel()) || (!InitTimeView()) || (!InitDistancesView()) || + (!InitHeartView()) || (!InitSpeedView()) || (!InitStepsView())) { return nullptr; } group->Add(lable); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkEndView.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkEndView.cpp index ae3972416..bcaa1e761 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkEndView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkEndView.cpp @@ -104,12 +104,12 @@ UIViewGroup *IndoorWalkEndView::InitShowUpView() group->SetWidth(HORIZONTAL_RESOLUTION); group->SetHeight(VERTICAL_RESOLUTION); ret = ShowUpTitleLabel(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(titleLabel); ret = CreateUIButton(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(cancelButton); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkModel.cpp index ebfb885d6..a89626e86 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkModel.cpp @@ -17,7 +17,7 @@ typedef struct { } fa_treadmill_distance_result; static int g_motionTimes{0}; -osTimerId_t g_startCounting = NULL; // 定时器 +osTimerId_t g_startCounting = nullptr; // 定时器 static constexpr uint64_t MS_ONE_SECONDS = 1000; static constexpr uint16_t NUM_TEN = 10; static constexpr uint16_t NUM_TIME_MIN = 60; @@ -40,7 +40,7 @@ void IndoorWalkModel::SetConnectionView(const char* id) selectPropertiesID = id; } -string IndoorWalkModel::GetConnectionView() +std::string IndoorWalkModel::GetConnectionView() { return selectPropertiesID; } @@ -51,12 +51,12 @@ void IndoorWalkModel::SetTextLableFirstTop(const char *lable, const char *lableU textLableUnitFirstTop = lableUnit; } -string IndoorWalkModel::GetTextLableFirstTop() +std::string IndoorWalkModel::GetTextLableFirstTop() { return textLableFirstTop; } -string IndoorWalkModel::GetTextLableUnitFirstTop() +std::string IndoorWalkModel::GetTextLableUnitFirstTop() { return textLableUnitFirstTop; } @@ -67,12 +67,12 @@ void IndoorWalkModel::SetTextLableFirstLeft(const char *lable, const char *lable textLableUnitFirstLeft = lableUnit; } -string IndoorWalkModel::GetTextLableFirstLeft() +std::string IndoorWalkModel::GetTextLableFirstLeft() { return textLableFirstLeft; } -string IndoorWalkModel::GetTextLableUnitFirstLeft() +std::string IndoorWalkModel::GetTextLableUnitFirstLeft() { return textLableUnitFirstLeft; } @@ -83,12 +83,12 @@ void IndoorWalkModel::SetTextLableFirstRight(const char *lable, const char *labl textLableUnitFirstRight = lableUnit; } -string IndoorWalkModel::GetTextLableFirstRight() +std::string IndoorWalkModel::GetTextLableFirstRight() { return textLableFirstRight; } -string IndoorWalkModel::GetTextLableUnitFirstRight() +std::string IndoorWalkModel::GetTextLableUnitFirstRight() { return textLableUnitFirstRight; } @@ -99,12 +99,12 @@ void IndoorWalkModel::SetTextLableFirstBottom(const char *lable, const char *lab textLableUnitFirstBottom = lableUnit; } -string IndoorWalkModel::GetTextLableFirstBottom() +std::string IndoorWalkModel::GetTextLableFirstBottom() { return textLableFirstBottom; } -string IndoorWalkModel::GetTextLableUnitFirstBottom() +std::string IndoorWalkModel::GetTextLableUnitFirstBottom() { return textLableUnitFirstBottom; } @@ -115,12 +115,12 @@ void IndoorWalkModel::SetTextLableSecondTop(const char *lable, const char *lable textLableUnitSecondTop = lableUnit; } -string IndoorWalkModel::GetTextLableSecondTop() +std::string IndoorWalkModel::GetTextLableSecondTop() { return textLableSecondTop; } -string IndoorWalkModel::GetTextLableUnitSecondTop() +std::string IndoorWalkModel::GetTextLableUnitSecondTop() { return textLableUnitSecondTop; } @@ -131,12 +131,12 @@ void IndoorWalkModel::SetTextLableSecondLeft(const char *lable, const char *labl textLableUnitSecondLeft = lableUnit; } -string IndoorWalkModel::GetTextLableSecondLeft() +std::string IndoorWalkModel::GetTextLableSecondLeft() { return textLableSecondLeft; } -string IndoorWalkModel::GetTextLableUnitSecondLeft() +std::string IndoorWalkModel::GetTextLableUnitSecondLeft() { return textLableUnitSecondLeft; } @@ -147,12 +147,12 @@ void IndoorWalkModel::SetTextLableSecondRight(const char *lable, const char *lab textLableUnitSecondRight = lableUnit; } -string IndoorWalkModel::GetTextLableSecondRight() +std::string IndoorWalkModel::GetTextLableSecondRight() { return textLableSecondRight; } -string IndoorWalkModel::GetTextLableUnitSecondRight() +std::string IndoorWalkModel::GetTextLableUnitSecondRight() { return textLableUnitSecondRight; } @@ -163,12 +163,12 @@ void IndoorWalkModel::SetTextLableThirdTop(const char *lable, const char *lableU textLableUnitThirdTop = lableUnit; } -string IndoorWalkModel::GetTextLableThirdTop() +std::string IndoorWalkModel::GetTextLableThirdTop() { return textLableThirdTop; } -string IndoorWalkModel::GetTextLableUnitThirdTop() +std::string IndoorWalkModel::GetTextLableUnitThirdTop() { return textLableUnitThirdTop; } @@ -179,12 +179,12 @@ void IndoorWalkModel::SetTextLableThirdBottom(const char *lable, const char *lab textLableUnitThirdBottom = lableUnit; } -string IndoorWalkModel::GetTextLableThirdBottom() +std::string IndoorWalkModel::GetTextLableThirdBottom() { return textLableThirdBottom; } -string IndoorWalkModel::GetTextLableUnitThirdBottom() +std::string IndoorWalkModel::GetTextLableUnitThirdBottom() { return textLableUnitThirdBottom; } @@ -195,12 +195,12 @@ void IndoorWalkModel::SetTextLableFourth(const char *lable, const char *lableUni textLableUnitFourth = lableUnit; } -string IndoorWalkModel::GetTextLableFourth() +std::string IndoorWalkModel::GetTextLableFourth() { return textLableFourth; } -string IndoorWalkModel::GetTextLableUnitFourth() +std::string IndoorWalkModel::GetTextLableUnitFourth() { return textLableUnitFourth; } @@ -236,12 +236,12 @@ float IndoorWalkModel::GetCurrentDistances() } /* 时间显示 */ -char *IndoorWalkModel::DisplayMotionDuration() +std::string& IndoorWalkModel::DisplayMotionDuration() { motionDuration.erase(); - string hours; - string minute; - string seconds; + std::string hours; + std::string minute; + std::string seconds; if (g_motionTimes >= NUM_TIME_DAY) { g_motionTimes = 0; } @@ -249,23 +249,23 @@ char *IndoorWalkModel::DisplayMotionDuration() int min = (g_motionTimes % NUM_TIME_HOUR) / NUM_TIME_MIN; int sec = (g_motionTimes % NUM_TIME_HOUR) % NUM_TIME_MIN; if (hour >= 0 && hour < NUM_TEN) { - hours = "0" + to_string(hour); + hours = "0" + std::to_string(hour); } else { - hours = to_string(hour); + hours = std::to_string(hour); } if (min >= 0 && min < NUM_TEN) { - minute = "0" + to_string(min); + minute = "0" + std::to_string(min); } else { - minute = to_string(min); + minute = std::to_string(min); } if (sec >= 0 && sec < NUM_TEN) { - seconds = "0" + to_string(sec); + seconds = "0" + std::to_string(sec); } else { - seconds = to_string(sec); + seconds = std::to_string(sec); } motionDuration = hours + ":" + minute + ":" + seconds; - return (char *)motionDuration.c_str(); + return motionDuration; } #ifdef __cplusplus @@ -287,12 +287,12 @@ void IndoorWalkTimerCallback() /* 开启定时器 */ void InitIndoorWalkTimer() { - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer already exists!!"); return; } - g_startCounting = osTimerNew((osTimerFunc_t)IndoorWalkTimerCallback, osTimerPeriodic, NULL, NULL); - if (g_startCounting == NULL) { + g_startCounting = osTimerNew((osTimerFunc_t)IndoorWalkTimerCallback, osTimerPeriodic, nullptr, nullptr); + if (g_startCounting == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer osTimerNew failed!!"); return; } @@ -300,13 +300,13 @@ void InitIndoorWalkTimer() osStatus_t retTimer = osTimerStart(g_startCounting, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer osTimerStart failed, ret = %lx!!", retTimer); - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { retTimer = osTimerDelete(g_startCounting); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::osTimerDelete failed, ret = %lx!!", retTimer); return; } - g_startCounting = NULL; + g_startCounting = nullptr; } return; } @@ -314,13 +314,13 @@ void InitIndoorWalkTimer() /* 关闭定时器 */ void DisableIndoorWalkTimer() { - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { osStatus_t ret = osTimerDelete(g_startCounting); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); return; } - g_startCounting = NULL; + g_startCounting = nullptr; g_motionTimes = 0; } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp index 326e8605f..6f3efcd2b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp @@ -135,7 +135,7 @@ bool IndoorWalkPreparedView::InitBatteryView() // 加载电量 return false; } battery->SetPosition(BATTERY_X, BATTERY_Y); - // ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, battery, DROPDOWN_DROPDOWN_BATTERY); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, battery, DROPDOWN_DROPDOWN_BATTERY); group->Add(battery); batteryLable = new UILabel(); @@ -247,15 +247,15 @@ UIViewGroup *IndoorWalkPreparedView::InitShowUpView() walkButton->SetViewId(WALK_BUTTON); group->Add(walkButton); ret = InitBatteryView(); - if (ret == false) { + if (!ret) { return nullptr; } ret = InitHeartbeatView(); - if (ret == false) { + if (!ret) { return nullptr; } ret = InitLableVIew(); - if (ret == false) { + if (!ret) { return nullptr; } UIView::OnDragListener *indoorWalkDragListener = (UIView::OnDragListener *)OHOS::IndoorWalkPresenter::GetInstance(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp index 6e33f8f50..6f817f0c0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp @@ -15,7 +15,7 @@ namespace OHOS { static IndoorWalkPresenter *g_pIndoorWalkPresenter = nullptr; -static string g_distancesChar; +static std::string g_distancesChar; static constexpr uint16_t CENTERED_Y = 192; static constexpr uint32_t CONVERSION_NUM = 100000; static constexpr uint16_t STEP_CHAR_NUM = 255; @@ -78,35 +78,36 @@ void IndoorWalkPresenter::WalkButtonOnClick(const char* id) void IndoorWalkPresenter::TimeViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); - ModifiesProperties(selectPropertiesid.c_str(), IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string duration = IndoorWalkModel::GetInstance()->DisplayMotionDuration(); + ModifiesProperties(selectPropertiesid.c_str(), duration.c_str(), "时间"); } void IndoorWalkPresenter::DistancesViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); ModifiesProperties(selectPropertiesid.c_str(), "0.00", "距离(km)"); } void IndoorWalkPresenter::HeartViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); ModifiesProperties(selectPropertiesid.c_str(), "--", "心率(bpm)"); } void IndoorWalkPresenter::SpeedViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); ModifiesProperties(selectPropertiesid.c_str(), "0.00", "速度(km/h)"); } void IndoorWalkPresenter::StepsViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); char stepChar[STEP_CHAR_NUM] = {0}; InitStepsValue(stepChar); ModifiesProperties(selectPropertiesid.c_str(), stepChar, "步数(steps)"); @@ -419,71 +420,61 @@ static const IndoorWalkPropertiesMapper g_pWalkPropertiesMapper[] = { void IndoorWalkPresenter::SetPropertiesPageFirstTop() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFirstLeft() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFirstRight() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFirstBottom() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageSecondTop() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageSecondLeft() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageSecondRight() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageThirdTop() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageThirdBottom() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFourth() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth(); SetCustomizationState(lableUnit.c_str()); } @@ -550,39 +541,36 @@ void IndoorWalkPresenter::SetCustomizationState(const char *lableUnit) void IndoorWalkPresenter::ModifiesTime() { - if (IndoorWalkModel::GetInstance()->DisplayMotionDuration() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::GetInstance()->DisplayMotionDuration() nullptr"); - return; - } + std::string duration = IndoorWalkModel::GetInstance()->DisplayMotionDuration(); if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop().c_str(), "时间") == 0) { - ModifiesPageFirstTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstTop(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft().c_str(), "时间") == 0) { - ModifiesPageFirstLeft(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstLeft(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight().c_str(), "时间") == 0) { - ModifiesPageFirstRight(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstRight(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom().c_str(), "时间") == 0) { - ModifiesPageFirstBottom(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstBottom(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop().c_str(), "时间") == 0) { - ModifiesPageSecondTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageSecondTop(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft().c_str(), "时间") == 0) { - ModifiesPageSecondLeft(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageSecondLeft(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight().c_str(), "时间") == 0) { - ModifiesPageSecondRight(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageSecondRight(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop().c_str(), "时间") == 0) { - ModifiesPageThirdTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageThirdTop(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom().c_str(), "时间") == 0) { - ModifiesPageThirdBottom(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageThirdBottom(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFourth().c_str(), "时间") == 0) { - ModifiesPageFourth(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFourth(duration.c_str(), "时间"); } } @@ -591,7 +579,7 @@ void IndoorWalkPresenter::ModifiesDistances(float value) g_distancesChar.erase(); value -= IndoorWalkModel::GetInstance()->GetInitialDistances(); value /= CONVERSION_NUM; - string g_distancesChar = to_string(value).substr(0, to_string(value).find(".") + 3); + g_distancesChar = std::to_string(value).substr(0, std::to_string(value).find(".") + 3); if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop().c_str(), "距离(km)") == 0) { ModifiesPageFirstTop(g_distancesChar.c_str(), "距离(km)"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkView.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkView.cpp index 23bd60810..9c7e85fb4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/IndoorWalkView.cpp @@ -183,14 +183,14 @@ void IndoorWalkView::ChangeView(int16_t hideView, int16_t showView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::ChangeView %d, %d", hideView, showView); - if (CheckViewParam(hideView, showView) == false) { + if (!CheckViewParam(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::CheckViewParam failed."); return; } PreprosssChangeView tmpPreProcessView = preProcessView[showView]; - if ((this->*tmpPreProcessView)(hideView, showView) == false) { + if (!(this->*tmpPreProcessView)(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::ChangeView %d %dfailed", showView, hideView); return; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFifth.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFifth.cpp index 8a5be9cf7..a3da2bbde 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFifth.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFifth.cpp @@ -83,13 +83,12 @@ bool MotionPageFifth::InitPageFifthImageView() bool MotionPageFifth::InitView(void *caller) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionPageFifth InitView %p", caller); - bool ret; - ret = InitPageFifthLableView(); - if (ret == false) { + bool ret = InitPageFifthLableView(); + if (!ret) { return false; } ret = InitPageFifthImageView(); - if (ret == false) { + if (!ret) { return false; } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFirst.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFirst.cpp index 02dbf591f..c16b941d5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFirst.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFirst.cpp @@ -107,8 +107,8 @@ void MotionPageFirst::SetUnitLableTemplate(UILabel *label) bool MotionPageFirst::InitPageFirstLableTopView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstTop(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -139,8 +139,8 @@ bool MotionPageFirst::InitPageFirstLableTopView() bool MotionPageFirst::InitPageFirstLableLeftView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstLeft(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -172,8 +172,8 @@ bool MotionPageFirst::InitPageFirstLableLeftView() bool MotionPageFirst::InitPageFirstLableRightView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstRight(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -204,8 +204,8 @@ bool MotionPageFirst::InitPageFirstLableRightView() bool MotionPageFirst::InitPageFirstLableBottomView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstBottom(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -357,23 +357,23 @@ bool MotionPageFirst::InitView(void *caller) backGroundFirst->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundFirst); ret = InitPageFirstLableTopView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstLableLeftView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstLableRightView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstLableBottomView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageFirstImageView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFourth.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFourth.cpp index 4c7274096..a43ab8ff6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFourth.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageFourth.cpp @@ -44,8 +44,8 @@ MotionPageFourth *MotionPageFourth::GetInstance() bool MotionPageFourth::InitPageFourthLableView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFourth(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -153,16 +153,15 @@ bool MotionPageFourth::InitView(void *caller) backGroundFourth->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundFourth); ret = InitPageFourthLableView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFourthImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageFourthImageView(); SetTouchable(true); return true; - } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageSecond.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageSecond.cpp index 545fb6947..34e136df5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageSecond.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageSecond.cpp @@ -81,8 +81,8 @@ void MotionPageSecond::SetLableTemplate(UILabel *label) bool MotionPageSecond::InitPageSecondLableTopView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableSecondTop(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -114,8 +114,8 @@ bool MotionPageSecond::InitPageSecondLableTopView() bool MotionPageSecond::InitPageSecondLableLeftView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableSecondLeft(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -147,8 +147,8 @@ bool MotionPageSecond::InitPageSecondLableLeftView() bool MotionPageSecond::InitPageSecondLableRightView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableSecondRight(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -292,24 +292,23 @@ bool MotionPageSecond::InitView(void *caller) backGroundSecond->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundSecond); ret = InitPageSecondLableTopView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageSecondLableLeftView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageSecondLableRightView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageSecondImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageSecondImageView(); SetTouchable(true); return true; - } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageThird.cpp b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageThird.cpp index a0898bac4..668d78cd4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageThird.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/indoorwalk/src/MotionPageThird.cpp @@ -71,8 +71,8 @@ void MotionPageThird::SetLableTemplate(UILabel *label) bool MotionPageThird::InitPageThirdLableTopView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableThirdTop(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -115,8 +115,8 @@ void MotionPageThird::SetUnitLableTemplate(UILabel *label) bool MotionPageThird::InitPageThirdLableBottomView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableThirdBottom(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -227,15 +227,15 @@ bool MotionPageThird::InitView(void *caller) backGroundThird->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundThird); ret = InitPageThirdLableTopView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageThirdLableBottomView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageThirdImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageThirdImageView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp b/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp index 98705f63c..777adfe73 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/offlinevoice/src/VocassistView.cpp @@ -636,7 +636,7 @@ void VoiceAssistance::ExitProgress() return; } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Too long no operate, now exit vocassist"); - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); return; } else if (quitStatus == CONTINUTE_EXIT_MODE2) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Too long no operate, now change model to vocassist label"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp index bf9e632f0..9ddd6d911 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp @@ -70,7 +70,7 @@ namespace OHOS // if (strcmp(view.GetViewId(), 控件ID) == 0) if (strcmp(view.GetViewId(), "button1") == 0) { - // NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + // NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(preSlice); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/screennotify/src/ui_screennotify.cpp b/code/sdk/application/wearable/fd230app/nativeui/screennotify/src/ui_screennotify.cpp index 564409805..b9ea61dd2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/screennotify/src/ui_screennotify.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/screennotify/src/ui_screennotify.cpp @@ -49,8 +49,8 @@ static void ChangeToHomeView(void) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetNativeAbilityState = %u", OHOS::NativeAbility::GetInstance().GetNativeAbilityState()); if (OHOS::NativeAbility::GetInstance().GetNativeAbilityState() == STATE_ACTIVE) { - if (current_slice_id != VIEW_MAIN_SAMPLE) { // 主表盘 - OHOS::NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + if (current_slice_id != VIEW_MAIN) { // 主表盘 + OHOS::NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); } else { if (!OHOS::MainViewSample::GetInstance()->IsMainClockPage()) { // 当前页面为主表盘的其他页面时,切换回主表盘页面 diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp index 2c3ae789d..6ad00d507 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp @@ -51,7 +51,7 @@ namespace OHOS { { uint8_t pageIndex = view_->GetCoverflowPage(); model->SaveDialSetting(pageIndex); - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); } bool SetDialPresenter::OnClick(UIView &view, const ClickEvent &event) -- 2.17.1