From 8f820c2a3c51cebe151d95c74213fb6806c2a00a Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 25 Jun 2024 18:44:52 +0800 Subject: [PATCH] =?utf8?q?=E9=97=B9=E9=92=9F=E7=95=8C=E9=9D=A2=E6=B7=BB?= =?utf8?q?=E5=8A=A0=E6=8C=89=E9=94=AE=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativelauncher/src/NativeLauncher.cpp | 4 ++-- .../nativeui/alarm/src/AlarmPresenter.cpp | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 3b646de74..e619457a1 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -37,8 +37,8 @@ #include "MainCallingView.h" #include "MainCallingPresenter.h" #include "ActivityPresenter.h" -#include "MainAlarmView.h" -#include "AlarmPresenter.h" +#include "alarm/include/MainAlarmView.h" +#include "alarm/include/AlarmPresenter.h" #include "AlarmPopUpPresenter.h" #include "AlarmPopUpView.h" #include "MainBluetoothView.h" diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp index 5a2bb94bb..186a213ce 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp @@ -5,12 +5,13 @@ * Create: 2021-09-11 */ -#include "AlarmPresenter.h" -#include "MainAlarmView.h" +#include "alarm/include/AlarmPresenter.h" +#include "alarm/include/MainAlarmView.h" #include "ChangeSliceListener.h" #include "string" #include "iostream" #include "sstream" +#include namespace OHOS { @@ -431,16 +432,15 @@ bool AlarmPresenter::ClickFuncView(UIView &view) bool AlarmPresenter::OnKeyAct(UIView &view, const KeyEvent &event) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnKeyAct"); -#if 0 -uint16 keyID = event.GetKeyId(); -// 如果是power键就返回上一级 -if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) -{ - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); -} -#endif + UNUSED(view); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnKeyAct"); + 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) + { + NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + } return true; } -- 2.17.1