From: luozheng <1732036298@qq.com> Date: Tue, 21 Oct 2025 12:22:35 +0000 (+0800) Subject: 272:解决压力界面按键无法退出问题 X-Git-Tag: V1.0.9_20251128_194606_LN~180^2~17 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=0e1e9701443d92df1900eb7108209ec2ba3e4e83;p=mirrors%2FFD230.git 272:解决压力界面按键无法退出问题 --- diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestModel.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestModel.h index 98ee175f4..29b7ece91 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestModel.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestModel.h @@ -6,8 +6,8 @@ namespace OHOS { enum FailType :uint8_t { - FAIL_TYPE_NOT_WORN = 0,//未佩戴 - FAIL_TYPE_INVALID_DATA,//数据无效 + FAIL_TYPE_INVALID_DATA = 0,//数据无效 + FAIL_TYPE_NOT_WORN ,//未佩戴 FAIL_TYPE_OTHER,//其他错误 }; @@ -26,7 +26,7 @@ namespace OHOS StressTestModel(const StressTestModel &) = delete; StressTestModel &operator=(const StressTestModel &) = delete; uint8_t currentView{0}; - uint8_t currentFailType{FAIL_TYPE_NOT_WORN};//当前错误类型 + uint8_t currentFailType{FAIL_TYPE_INVALID_DATA};//当前错误类型 }; } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h index 6a364dad5..fa0175781 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h @@ -20,6 +20,7 @@ namespace OHOS static StressTestPresenter *GetInstance(); void OnStart() override; + void OnResume() override; uint8_t GetCurrentFailType(void); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp index 4ba57792c..613088727 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp @@ -211,7 +211,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "error1DescriptionLabel new fail!!"); return nullptr; } - error1DescriptionLabel->SetPosition(53, 230, 360, 70); + error1DescriptionLabel->SetPosition(53, 210, 360, 70); error1DescriptionLabel->SetText("请确认已带上手表,并保持静止"); error1DescriptionLabel->SetStyle(STYLE_TEXT_FONT, 30); error1DescriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); @@ -229,7 +229,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "retryButton new fail!!"); return nullptr; } - retryButton->SetPosition(238, 328,170,90); + retryButton->SetPosition(238, 300,170,90); retryButton->SetText("重测"); retryButton->SetAlign(TEXT_ALIGNMENT_CENTER); retryButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -249,7 +249,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "stopButton new fail!!"); return nullptr; } - stopButton->SetPosition(58, 328,170,90); + stopButton->SetPosition(58, 300,170,90); stopButton->SetText("停止"); stopButton->SetAlign(TEXT_ALIGNMENT_CENTER); stopButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestPresenter.cpp index d2a660982..6325d2c15 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestPresenter.cpp @@ -41,6 +41,11 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StressTestPresenter::OnStart"); } + void StressTestPresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + } + bool StressTestPresenter::OnClick(UIView &view, const ClickEvent &event) { @@ -109,7 +114,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); }