From 97808fa19f33afb56dbeab6afb019af4e5739d7c Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Mon, 23 Dec 2024 11:52:42 +0800 Subject: [PATCH] =?utf8?q?=E8=A1=A8=E7=9B=98=EF=BC=9A=E5=9B=9E=E9=80=80?= =?utf8?q?=E6=AD=A5=E6=95=B0=E7=9B=AE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../main/src/dial/DialModelStepgoal.cpp | 39 +++++++++++++++++++ .../main/src/dial/DialModelStepgoalMapper.cpp | 39 ------------------- 2 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoal.cpp delete mode 100644 code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoalMapper.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoal.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoal.cpp new file mode 100644 index 000000000..a07e2a643 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoal.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) CompanyNameMagicTag 2023. All rights reserved. + * Description: DialModelSteps + * Author: + * Create: 2023-12 + */ + +#include "DialModelStepgoal.h" +#include "DialBoxProgressView.h" +#include "RegisterDialModel.h" +#include "goal/include/goalmodel.h" + +REGIST_DIAL_MODULE(DialDataType::DATA_TYPE_STEPS_GOAL, + OHOS::DialModelStepgoal::GetInstance()); + +namespace OHOS { +bool DialModelStepgoal::GetDialFloatData(DialDataType &type, float &out) { + (void)type; + out = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + DialBoxDataType::STEP_TARGET, stepgoal_); + return true; +} + +void DialModelStepgoal::UpdateStepgoal(uint32_t steps) { + uint32_t step_ = static_cast(steps); + uint32_t goal = GoalModel::GetInstance().getstepgoaldata(); + if (goal > 0) { + stepgoal_ = (static_cast(step_) / goal) * 100; + if (stepgoal_ > 100) + stepgoal_ = 100; + stepgoal_ = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( + DialBoxDataType::STEP_TARGET, stepgoal_); + } + if (onChangeListener_ != nullptr) { + onChangeListener_->OnDialFloatDataUpdate(DialDataType::DATA_TYPE_STEPS_GOAL, + stepgoal_); + } +} +} // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoalMapper.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoalMapper.cpp deleted file mode 100644 index a4dfc57f9..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelStepgoalMapper.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2023. All rights reserved. - * Description: DialModelSteps - * Author: - * Create: 2023-12 - */ - -#include "DialModelStepgoalMapper.h" -#include "DialBoxProgressView.h" -#include "RegisterDialModel.h" -#include "goalMapper/include/goalMappermodel.h" - -REGIST_DIAL_MODULE(DialDataType::DATA_TYPE_STEPS_goalMapper, - OHOS::DialModelStepgoalMapper::GetInstance()); - -namespace OHOS { -bool DialModelStepgoalMapper::GetDialFloatData(DialDataType &type, float &out) { - (void)type; - out = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( - DialBoxDataType::STEP_TARGET, stepgoalMapper_); - return true; -} - -void DialModelStepgoalMapper::UpdateStepgoalMapper(uint32_t steps) { - uint32_t step_ = static_cast(steps); - uint32_t goalMapper = goalMapperModel::GetInstance().getstepgoalMapperdata(); - if (goalMapper > 0) { - stepgoalMapper_ = (static_cast(step_) / goalMapper) * 100; - if (stepgoalMapper_ > 100) - stepgoalMapper_ = 100; - stepgoalMapper_ = DialBoxProgressView::GetInstance()->ConvertToRequiredFormat( - DialBoxDataType::STEP_TARGET, stepgoalMapper_); - } - if (onChangeListener_ != nullptr) { - onChangeListener_->OnDialFloatDataUpdate(DialDataType::DATA_TYPE_STEPS_goalMapper, - stepgoalMapper_); - } -} -} // namespace OHOS -- 2.17.1