class IndoorWalkUIScrollView : public UIScrollView {\r
public:\r
IndoorWalkUIScrollView() {}\r
- virtual ~IndoorWalkUIScrollView() {}\r
+ ~IndoorWalkUIScrollView() override {}\r
\r
bool OnDragEvent(const DragEvent& event) override\r
{\r
#ifndef INDOORWALK_MODEL_H\r
#define INDOORWALK_MODEL_H\r
\r
-#include "stdio.h"\r
+#include <cstdio>\r
#include "string"\r
#include "gfx_utils/list.h"\r
#include "components/ui_label.h"\r
#endif\r
\r
namespace OHOS {\r
-using namespace std;\r
class IndoorWalkModel {\r
public:\r
~IndoorWalkModel();\r
static IndoorWalkModel *GetInstance(void);\r
- string GetConnectionView();\r
+ std::string GetConnectionView();\r
void SetConnectionView(const char* id);\r
void SetTextLableFirstTop(const char *lable, const char *lableUnit);\r
- string GetTextLableFirstTop();\r
- string GetTextLableUnitFirstTop();\r
+ std::string GetTextLableFirstTop();\r
+ std::string GetTextLableUnitFirstTop();\r
void SetTextLableFirstLeft(const char *lable, const char *lableUnit);\r
- string GetTextLableFirstLeft();\r
- string GetTextLableUnitFirstLeft();\r
+ std::string GetTextLableFirstLeft();\r
+ std::string GetTextLableUnitFirstLeft();\r
void SetTextLableFirstRight(const char *lable, const char *lableUnit);\r
- string GetTextLableFirstRight();\r
- string GetTextLableUnitFirstRight();\r
+ std::string GetTextLableFirstRight();\r
+ std::string GetTextLableUnitFirstRight();\r
void SetTextLableFirstBottom(const char *lable, const char *lableUnit);\r
- string GetTextLableFirstBottom();\r
- string GetTextLableUnitFirstBottom();\r
+ std::string GetTextLableFirstBottom();\r
+ std::string GetTextLableUnitFirstBottom();\r
void SetTextLableSecondTop(const char *lable, const char *lableUnit);\r
- string GetTextLableSecondTop();\r
- string GetTextLableUnitSecondTop();\r
+ std::string GetTextLableSecondTop();\r
+ std::string GetTextLableUnitSecondTop();\r
void SetTextLableSecondLeft(const char *lable, const char *lableUnit);\r
- string GetTextLableSecondLeft();\r
- string GetTextLableUnitSecondLeft();\r
+ std::string GetTextLableSecondLeft();\r
+ std::string GetTextLableUnitSecondLeft();\r
void SetTextLableSecondRight(const char *lable, const char *lableUnit);\r
- string GetTextLableSecondRight();\r
- string GetTextLableUnitSecondRight();\r
+ std::string GetTextLableSecondRight();\r
+ std::string GetTextLableUnitSecondRight();\r
void SetTextLableThirdTop(const char *lable, const char *lableUnit);\r
- string GetTextLableThirdTop();\r
- string GetTextLableUnitThirdTop();\r
+ std::string GetTextLableThirdTop();\r
+ std::string GetTextLableUnitThirdTop();\r
void SetTextLableThirdBottom(const char *lable, const char *lableUnit);\r
- string GetTextLableThirdBottom();\r
- string GetTextLableUnitThirdBottom();\r
+ std::string GetTextLableThirdBottom();\r
+ std::string GetTextLableUnitThirdBottom();\r
void SetTextLableFourth(const char *lable, const char *lableUnit);\r
- string GetTextLableFourth();\r
- string GetTextLableUnitFourth();\r
+ std::string GetTextLableFourth();\r
+ std::string GetTextLableUnitFourth();\r
void SetInitialStep(const uint32_t &value);\r
int GetInitialStep();\r
- char *DisplayMotionDuration();\r
+ std::string& DisplayMotionDuration();\r
bool OpenDistancesSensor(void);\r
bool CloseDistancesSensor(void);\r
void SetInitialDistances(const float &value);\r
\r
private:\r
IndoorWalkModel();\r
- string selectPropertiesID;\r
+ std::string selectPropertiesID;\r
uint32_t initialStep;\r
float initialDistances;\r
float currentDistances;\r
- string textLableFirstTop{"00:00:00"};\r
- string textLableUnitFirstTop{"时间"};\r
- string textLableFirstLeft{"00:00:00"};\r
- string textLableUnitFirstLeft{"时间"};\r
- string textLableFirstRight{"00:00:00"};\r
- string textLableUnitFirstRight{"时间"};\r
- string textLableFirstBottom{"00:00:00"};\r
- string textLableUnitFirstBottom{"时间"};\r
- string textLableSecondTop{"00:00:00"};\r
- string textLableUnitSecondTop{"时间"};\r
- string textLableSecondLeft{"00:00:00"};\r
- string textLableUnitSecondLeft{"时间"};\r
- string textLableSecondRight{"00:00:00"};\r
- string textLableUnitSecondRight{"时间"};\r
- string textLableThirdTop{"00:00:00"};\r
- string textLableUnitThirdTop{"时间"};\r
- string textLableThirdBottom{"00:00:00"};\r
- string textLableUnitThirdBottom{"时间"};\r
- string textLableFourth{"00:00:00"};\r
- string textLableUnitFourth{"时间"};\r
+ std::string textLableFirstTop{"00:00:00"};\r
+ std::string textLableUnitFirstTop{"时间"};\r
+ std::string textLableFirstLeft{"00:00:00"};\r
+ std::string textLableUnitFirstLeft{"时间"};\r
+ std::string textLableFirstRight{"00:00:00"};\r
+ std::string textLableUnitFirstRight{"时间"};\r
+ std::string textLableFirstBottom{"00:00:00"};\r
+ std::string textLableUnitFirstBottom{"时间"};\r
+ std::string textLableSecondTop{"00:00:00"};\r
+ std::string textLableUnitSecondTop{"时间"};\r
+ std::string textLableSecondLeft{"00:00:00"};\r
+ std::string textLableUnitSecondLeft{"时间"};\r
+ std::string textLableSecondRight{"00:00:00"};\r
+ std::string textLableUnitSecondRight{"时间"};\r
+ std::string textLableThirdTop{"00:00:00"};\r
+ std::string textLableUnitThirdTop{"时间"};\r
+ std::string textLableThirdBottom{"00:00:00"};\r
+ std::string textLableUnitThirdBottom{"时间"};\r
+ std::string textLableFourth{"00:00:00"};\r
+ std::string textLableUnitFourth{"时间"};\r
\r
- string motionDuration;\r
+ std::string motionDuration;\r
};\r
}\r
\r
MotionPageFifth *motionPageFifth{nullptr};\r
AppGroupView *recordCard[MAX_MOTIONPAGE]{nullptr};\r
bool pageStatus[MAX_MOTIONPAGE]{false};\r
- UISwipeView::OnSwipeListener* motionclickListener{nullptr};\r
- UIView::OnDragListener* motionDragListener{nullptr};\r
};\r
} // namespace OHOS\r
#endif // INDOORWALK_MOTION_VIEW_H
\ No newline at end of file
public UIView::OnDragListener {\r
public:\r
IndoorWalkPresenter();\r
- virtual ~IndoorWalkPresenter();\r
+ ~IndoorWalkPresenter() override;\r
static IndoorWalkPresenter *GetInstance();\r
void OnStart() override;\r
void OnPause() override;\r
bool OnClick(UIView& view, const ClickEvent& event) override;\r
bool OnDrag(UIView& view, const DragEvent& event) override;\r
bool OnLongPress(UIView& view, const LongPressEvent& event) override;\r
- virtual void OnSwipe(UISwipeView& view) override;\r
+ void OnSwipe(UISwipeView& view) override;\r
void HidePageImageView(void);\r
void ModifiesProperties(const char* id, const char *lable, const char *lableUnit);\r
void ModifiesPageFirstTop(const char *lable, const char *lableUnit);\r
class MotionPageFifth : public AppGroupView {\r
public:\r
MotionPageFifth();\r
- virtual ~MotionPageFifth();\r
+ ~MotionPageFifth() override;\r
static MotionPageFifth *GetInstance(void);\r
bool InitView(void *caller) override;\r
bool InitPageFifthLableView(void);\r
class MotionPageFirst : public AppGroupView {\r
public:\r
MotionPageFirst();\r
- virtual ~MotionPageFirst();\r
+ ~MotionPageFirst() override;\r
static MotionPageFirst *GetInstance(void);\r
bool InitView(void *caller) override;\r
bool InitPageFirstImageView(void);\r
class MotionPageFourth : public AppGroupView {\r
public:\r
MotionPageFourth();\r
- virtual ~MotionPageFourth();\r
+ ~MotionPageFourth() override;\r
static MotionPageFourth *GetInstance(void);\r
bool InitView(void *caller) override;\r
bool InitPageFourthLableView(void);\r
class MotionPageSecond : public AppGroupView {\r
public:\r
MotionPageSecond();\r
- virtual ~MotionPageSecond();\r
+ ~MotionPageSecond() override;\r
static MotionPageSecond *GetInstance(void);\r
bool InitView(void *caller) override;\r
bool InitPageSecondImageView(void);\r
class MotionPageThird : public AppGroupView {\r
public:\r
MotionPageThird();\r
- virtual ~MotionPageThird();\r
+ ~MotionPageThird() override;\r
static MotionPageThird *GetInstance(void);\r
bool InitView(void *caller) override;\r
bool InitPageThirdImageView(void);\r
group->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\r
group->SetHorizontalScrollState(false);\r
\r
- if ((ShowUpTitleLabel() == false) || (InitTimeView() == false) || (InitDistancesView() == false) ||\r
- (InitHeartView() == false) || (InitSpeedView() == false) || (InitStepsView() == false)) {\r
+ if ((!ShowUpTitleLabel()) || (!InitTimeView()) || (!InitDistancesView()) ||\r
+ (!InitHeartView()) || (!InitSpeedView()) || (!InitStepsView())) {\r
return nullptr;\r
}\r
group->Add(lable);\r
group->SetWidth(HORIZONTAL_RESOLUTION);\r
group->SetHeight(VERTICAL_RESOLUTION);\r
ret = ShowUpTitleLabel();\r
- if (ret == false) {\r
+ if (!ret) {\r
return nullptr;\r
}\r
group->Add(titleLabel);\r
ret = CreateUIButton();\r
- if (ret == false) {\r
+ if (!ret) {\r
return nullptr;\r
}\r
group->Add(cancelButton);\r
} fa_treadmill_distance_result;\r
\r
static int g_motionTimes{0};\r
-osTimerId_t g_startCounting = NULL; // 定时器\r
+osTimerId_t g_startCounting = nullptr; // 定时器\r
static constexpr uint64_t MS_ONE_SECONDS = 1000;\r
static constexpr uint16_t NUM_TEN = 10;\r
static constexpr uint16_t NUM_TIME_MIN = 60;\r
selectPropertiesID = id;\r
}\r
\r
-string IndoorWalkModel::GetConnectionView()\r
+std::string IndoorWalkModel::GetConnectionView()\r
{\r
return selectPropertiesID;\r
}\r
textLableUnitFirstTop = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableFirstTop()\r
+std::string IndoorWalkModel::GetTextLableFirstTop()\r
{\r
return textLableFirstTop;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitFirstTop()\r
+std::string IndoorWalkModel::GetTextLableUnitFirstTop()\r
{\r
return textLableUnitFirstTop;\r
}\r
textLableUnitFirstLeft = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableFirstLeft()\r
+std::string IndoorWalkModel::GetTextLableFirstLeft()\r
{\r
return textLableFirstLeft;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitFirstLeft()\r
+std::string IndoorWalkModel::GetTextLableUnitFirstLeft()\r
{\r
return textLableUnitFirstLeft;\r
}\r
textLableUnitFirstRight = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableFirstRight()\r
+std::string IndoorWalkModel::GetTextLableFirstRight()\r
{\r
return textLableFirstRight;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitFirstRight()\r
+std::string IndoorWalkModel::GetTextLableUnitFirstRight()\r
{\r
return textLableUnitFirstRight;\r
}\r
textLableUnitFirstBottom = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableFirstBottom()\r
+std::string IndoorWalkModel::GetTextLableFirstBottom()\r
{\r
return textLableFirstBottom;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitFirstBottom()\r
+std::string IndoorWalkModel::GetTextLableUnitFirstBottom()\r
{\r
return textLableUnitFirstBottom;\r
}\r
textLableUnitSecondTop = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableSecondTop()\r
+std::string IndoorWalkModel::GetTextLableSecondTop()\r
{\r
return textLableSecondTop;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitSecondTop()\r
+std::string IndoorWalkModel::GetTextLableUnitSecondTop()\r
{\r
return textLableUnitSecondTop;\r
}\r
textLableUnitSecondLeft = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableSecondLeft()\r
+std::string IndoorWalkModel::GetTextLableSecondLeft()\r
{\r
return textLableSecondLeft;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitSecondLeft()\r
+std::string IndoorWalkModel::GetTextLableUnitSecondLeft()\r
{\r
return textLableUnitSecondLeft;\r
}\r
textLableUnitSecondRight = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableSecondRight()\r
+std::string IndoorWalkModel::GetTextLableSecondRight()\r
{\r
return textLableSecondRight;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitSecondRight()\r
+std::string IndoorWalkModel::GetTextLableUnitSecondRight()\r
{\r
return textLableUnitSecondRight;\r
}\r
textLableUnitThirdTop = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableThirdTop()\r
+std::string IndoorWalkModel::GetTextLableThirdTop()\r
{\r
return textLableThirdTop;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitThirdTop()\r
+std::string IndoorWalkModel::GetTextLableUnitThirdTop()\r
{\r
return textLableUnitThirdTop;\r
}\r
textLableUnitThirdBottom = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableThirdBottom()\r
+std::string IndoorWalkModel::GetTextLableThirdBottom()\r
{\r
return textLableThirdBottom;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitThirdBottom()\r
+std::string IndoorWalkModel::GetTextLableUnitThirdBottom()\r
{\r
return textLableUnitThirdBottom;\r
}\r
textLableUnitFourth = lableUnit;\r
}\r
\r
-string IndoorWalkModel::GetTextLableFourth()\r
+std::string IndoorWalkModel::GetTextLableFourth()\r
{\r
return textLableFourth;\r
}\r
\r
-string IndoorWalkModel::GetTextLableUnitFourth()\r
+std::string IndoorWalkModel::GetTextLableUnitFourth()\r
{\r
return textLableUnitFourth;\r
}\r
}\r
\r
/* 时间显示 */\r
-char *IndoorWalkModel::DisplayMotionDuration()\r
+std::string& IndoorWalkModel::DisplayMotionDuration()\r
{\r
motionDuration.erase();\r
- string hours;\r
- string minute;\r
- string seconds;\r
+ std::string hours;\r
+ std::string minute;\r
+ std::string seconds;\r
if (g_motionTimes >= NUM_TIME_DAY) {\r
g_motionTimes = 0;\r
}\r
int min = (g_motionTimes % NUM_TIME_HOUR) / NUM_TIME_MIN;\r
int sec = (g_motionTimes % NUM_TIME_HOUR) % NUM_TIME_MIN;\r
if (hour >= 0 && hour < NUM_TEN) {\r
- hours = "0" + to_string(hour);\r
+ hours = "0" + std::to_string(hour);\r
} else {\r
- hours = to_string(hour);\r
+ hours = std::to_string(hour);\r
}\r
if (min >= 0 && min < NUM_TEN) {\r
- minute = "0" + to_string(min);\r
+ minute = "0" + std::to_string(min);\r
} else {\r
- minute = to_string(min);\r
+ minute = std::to_string(min);\r
}\r
if (sec >= 0 && sec < NUM_TEN) {\r
- seconds = "0" + to_string(sec);\r
+ seconds = "0" + std::to_string(sec);\r
} else {\r
- seconds = to_string(sec);\r
+ seconds = std::to_string(sec);\r
}\r
\r
motionDuration = hours + ":" + minute + ":" + seconds;\r
- return (char *)motionDuration.c_str();\r
+ return motionDuration;\r
}\r
\r
#ifdef __cplusplus\r
/* 开启定时器 */\r
void InitIndoorWalkTimer()\r
{\r
- if (g_startCounting != NULL) {\r
+ if (g_startCounting != nullptr) {\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer already exists!!");\r
return;\r
}\r
- g_startCounting = osTimerNew((osTimerFunc_t)IndoorWalkTimerCallback, osTimerPeriodic, NULL, NULL);\r
- if (g_startCounting == NULL) {\r
+ g_startCounting = osTimerNew((osTimerFunc_t)IndoorWalkTimerCallback, osTimerPeriodic, nullptr, nullptr);\r
+ if (g_startCounting == nullptr) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer osTimerNew failed!!");\r
return;\r
}\r
osStatus_t retTimer = osTimerStart(g_startCounting, tick);\r
if (retTimer != osOK) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer osTimerStart failed, ret = %lx!!", retTimer);\r
- if (g_startCounting != NULL) {\r
+ if (g_startCounting != nullptr) {\r
retTimer = osTimerDelete(g_startCounting);\r
if (retTimer != osOK) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::osTimerDelete failed, ret = %lx!!", retTimer);\r
return;\r
}\r
- g_startCounting = NULL;\r
+ g_startCounting = nullptr;\r
}\r
return;\r
}\r
/* 关闭定时器 */\r
void DisableIndoorWalkTimer()\r
{\r
- if (g_startCounting != NULL) {\r
+ if (g_startCounting != nullptr) {\r
osStatus_t ret = osTimerDelete(g_startCounting);\r
if (ret != osOK) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret);\r
return;\r
}\r
- g_startCounting = NULL;\r
+ g_startCounting = nullptr;\r
g_motionTimes = 0;\r
}\r
}\r
return false;\r
}\r
battery->SetPosition(BATTERY_X, BATTERY_Y);\r
- // ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, battery, DROPDOWN_DROPDOWN_BATTERY);\r
+ ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, battery, DROPDOWN_DROPDOWN_BATTERY);\r
group->Add(battery);\r
\r
batteryLable = new UILabel();\r
walkButton->SetViewId(WALK_BUTTON);\r
group->Add(walkButton);\r
ret = InitBatteryView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return nullptr;\r
}\r
ret = InitHeartbeatView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return nullptr;\r
}\r
ret = InitLableVIew();\r
- if (ret == false) {\r
+ if (!ret) {\r
return nullptr;\r
}\r
UIView::OnDragListener *indoorWalkDragListener = (UIView::OnDragListener *)OHOS::IndoorWalkPresenter::GetInstance();\r
\r
namespace OHOS {\r
static IndoorWalkPresenter *g_pIndoorWalkPresenter = nullptr;\r
-static string g_distancesChar;\r
+static std::string g_distancesChar;\r
static constexpr uint16_t CENTERED_Y = 192;\r
static constexpr uint32_t CONVERSION_NUM = 100000;\r
static constexpr uint16_t STEP_CHAR_NUM = 255;\r
void IndoorWalkPresenter::TimeViewOnClick(const char* id)\r
{\r
UNUSED(id);\r
- string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
- ModifiesProperties(selectPropertiesid.c_str(), IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
+ std::string duration = IndoorWalkModel::GetInstance()->DisplayMotionDuration();\r
+ ModifiesProperties(selectPropertiesid.c_str(), duration.c_str(), "时间");\r
}\r
\r
void IndoorWalkPresenter::DistancesViewOnClick(const char* id)\r
{\r
UNUSED(id);\r
- string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
+ std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
ModifiesProperties(selectPropertiesid.c_str(), "0.00", "距离(km)");\r
}\r
\r
void IndoorWalkPresenter::HeartViewOnClick(const char* id)\r
{\r
UNUSED(id);\r
- string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
+ std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
ModifiesProperties(selectPropertiesid.c_str(), "--", "心率(bpm)");\r
}\r
\r
void IndoorWalkPresenter::SpeedViewOnClick(const char* id)\r
{\r
UNUSED(id);\r
- string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
+ std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
ModifiesProperties(selectPropertiesid.c_str(), "0.00", "速度(km/h)");\r
}\r
\r
void IndoorWalkPresenter::StepsViewOnClick(const char* id)\r
{\r
UNUSED(id);\r
- string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
+ std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView();\r
char stepChar[STEP_CHAR_NUM] = {0};\r
InitStepsValue(stepChar);\r
ModifiesProperties(selectPropertiesid.c_str(), stepChar, "步数(steps)");\r
\r
void IndoorWalkPresenter::SetPropertiesPageFirstTop()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageFirstLeft()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageFirstRight()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageFirstBottom()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageSecondTop()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageSecondLeft()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageSecondRight()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageThirdTop()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageThirdBottom()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
void IndoorWalkPresenter::SetPropertiesPageFourth()\r
{\r
- string lableUnit;\r
- lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth();\r
+ std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth();\r
SetCustomizationState(lableUnit.c_str());\r
}\r
\r
\r
void IndoorWalkPresenter::ModifiesTime()\r
{\r
- if (IndoorWalkModel::GetInstance()->DisplayMotionDuration() == nullptr) {\r
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::GetInstance()->DisplayMotionDuration() nullptr");\r
- return;\r
- }\r
+ std::string duration = IndoorWalkModel::GetInstance()->DisplayMotionDuration();\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop().c_str(), "时间") == 0) {\r
- ModifiesPageFirstTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageFirstTop(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft().c_str(), "时间") == 0) {\r
- ModifiesPageFirstLeft(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageFirstLeft(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight().c_str(), "时间") == 0) {\r
- ModifiesPageFirstRight(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageFirstRight(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom().c_str(), "时间") == 0) {\r
- ModifiesPageFirstBottom(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageFirstBottom(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop().c_str(), "时间") == 0) {\r
- ModifiesPageSecondTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageSecondTop(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft().c_str(), "时间") == 0) {\r
- ModifiesPageSecondLeft(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageSecondLeft(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight().c_str(), "时间") == 0) {\r
- ModifiesPageSecondRight(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageSecondRight(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop().c_str(), "时间") == 0) {\r
- ModifiesPageThirdTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageThirdTop(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom().c_str(), "时间") == 0) {\r
- ModifiesPageThirdBottom(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageThirdBottom(duration.c_str(), "时间");\r
}\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFourth().c_str(), "时间") == 0) {\r
- ModifiesPageFourth(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间");\r
+ ModifiesPageFourth(duration.c_str(), "时间");\r
}\r
}\r
\r
g_distancesChar.erase();\r
value -= IndoorWalkModel::GetInstance()->GetInitialDistances();\r
value /= CONVERSION_NUM;\r
- string g_distancesChar = to_string(value).substr(0, to_string(value).find(".") + 3);\r
+ g_distancesChar = std::to_string(value).substr(0, std::to_string(value).find(".") + 3);\r
\r
if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop().c_str(), "距离(km)") == 0) {\r
ModifiesPageFirstTop(g_distancesChar.c_str(), "距离(km)");\r
{\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::ChangeView %d, %d", hideView, showView);\r
\r
- if (CheckViewParam(hideView, showView) == false) {\r
+ if (!CheckViewParam(hideView, showView)) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::CheckViewParam failed.");\r
return;\r
}\r
\r
PreprosssChangeView tmpPreProcessView = preProcessView[showView];\r
\r
- if ((this->*tmpPreProcessView)(hideView, showView) == false) {\r
+ if (!(this->*tmpPreProcessView)(hideView, showView)) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::ChangeView %d %dfailed", showView, hideView);\r
return;\r
}\r
bool MotionPageFifth::InitView(void *caller)\r
{\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionPageFifth InitView %p", caller);\r
- bool ret;\r
- ret = InitPageFifthLableView();\r
- if (ret == false) {\r
+ bool ret = InitPageFifthLableView();\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageFifthImageView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
return true;\r
\r
bool MotionPageFirst::InitPageFirstLableTopView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableFirstTop();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
\r
bool MotionPageFirst::InitPageFirstLableLeftView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableFirstLeft();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
\r
bool MotionPageFirst::InitPageFirstLableRightView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableFirstRight();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
\r
bool MotionPageFirst::InitPageFirstLableBottomView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableFirstBottom();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
backGroundFirst->SetSrc(PNG_WALK_BACK_GROUND);\r
Add(backGroundFirst);\r
ret = InitPageFirstLableTopView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageFirstLableLeftView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageFirstLableRightView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageFirstLableBottomView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageFirstImageView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
HideInitPageFirstImageView();\r
\r
bool MotionPageFourth::InitPageFourthLableView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableFourth();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
backGroundFourth->SetSrc(PNG_WALK_BACK_GROUND);\r
Add(backGroundFourth);\r
ret = InitPageFourthLableView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageFourthImageView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
HideInitPageFourthImageView();\r
SetTouchable(true);\r
return true;\r
-\r
}\r
}
\ No newline at end of file
\r
bool MotionPageSecond::InitPageSecondLableTopView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableSecondTop();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
\r
bool MotionPageSecond::InitPageSecondLableLeftView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableSecondLeft();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
\r
bool MotionPageSecond::InitPageSecondLableRightView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableSecondRight();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
backGroundSecond->SetSrc(PNG_WALK_BACK_GROUND);\r
Add(backGroundSecond);\r
ret = InitPageSecondLableTopView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageSecondLableLeftView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageSecondLableRightView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageSecondImageView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
HideInitPageSecondImageView();\r
SetTouchable(true);\r
return true;\r
-\r
}\r
}
\ No newline at end of file
\r
bool MotionPageThird::InitPageThirdLableTopView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableThirdTop();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
\r
bool MotionPageThird::InitPageThirdLableBottomView()\r
{\r
- string lable;\r
- string lableUnit;\r
+ std::string lable;\r
+ std::string lableUnit;\r
lable = IndoorWalkModel::GetInstance()->GetTextLableThirdBottom();\r
lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom();\r
if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) {\r
backGroundThird->SetSrc(PNG_WALK_BACK_GROUND);\r
Add(backGroundThird);\r
ret = InitPageThirdLableTopView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageThirdLableBottomView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
ret = InitPageThirdImageView();\r
- if (ret == false) {\r
+ if (!ret) {\r
return false;\r
}\r
HideInitPageThirdImageView();\r
return;\r
}\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Too long no operate, now exit vocassist");\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE);\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);\r
return;\r
} else if (quitStatus == CONTINUTE_EXIT_MODE2) {\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Too long no operate, now change model to vocassist label");\r
// if (strcmp(view.GetViewId(), 控件ID) == 0)\r
if (strcmp(view.GetViewId(), "button1") == 0)\r
{\r
- // NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE);\r
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);\r
uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
NativeAbility::GetInstance().ChangeSlice(preSlice);\r
}\r
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()) {
// 当前页面为主表盘的其他页面时,切换回主表盘页面
{
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)