From efa1d57c7b6b240c313fef6a667db0b68f2d6390 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Thu, 14 Dec 2023 21:52:13 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96power=E3=80=81button2=E9=94=AE?= =?utf8?q?=EF=BC=8C=E4=B8=8D=E4=BA=AE=E5=B1=8F=E4=B8=8D=E5=93=8D=E5=BA=94?= =?utf8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/key/src/KeyInputListener.cpp | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp b/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp index ede223eed..976e9bd7d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp @@ -91,16 +91,20 @@ void KeyInputListener::OnKeyRelease(const KeyEvent& event) if (longPressFlag == 0 && pressFlag == 1) { // 短按电源键 - if (currentViewId == VIEW_MAEKPHONE_SAMPLE || IsCallingNotify() == true) { // 音量卡片 + if (currentViewId == VIEW_MAEKPHONE_SAMPLE || IsCallingNotify() == true) { // 音量卡片 // 音量+ CallVolumeDipSwitchControl(1); - }else if (currentViewId != VIEW_MAIN_SAMPLE) { // 主表盘 - PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TRANSITION_ZOOM); + }else if (currentViewId != VIEW_MAIN_SAMPLE) { // 主表盘 + if(mcu_pms_is_screen_on()){ //只有亮屏的时候才做界面切换 + PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TRANSITION_ZOOM); + } } else { - PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 if (!MainViewSample::GetInstance()->IsMainView()) { // 当前页面为主表盘的其他页面时,切换回主表盘页面 - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + if(mcu_pms_is_screen_on()){ //只有亮屏的时候才做界面切换 + PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + } } else { //power键要进入休眠 if(mcu_pms_is_screen_on()){ @@ -117,14 +121,18 @@ void KeyInputListener::OnKeyRelease(const KeyEvent& event) // 音量- CallVolumeDipSwitchControl(0); } else if (currentViewId != VIEW_MAIN_SAMPLE) { // 主表盘 - PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TRANSITION_ZOOM); + if(mcu_pms_is_screen_on()){ //只有亮屏的时候才做界面切换 + PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TRANSITION_ZOOM); + } } else { - PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 - if (!MainViewSample::GetInstance()->IsMainView()) { // 当前页面为主表盘的其他页面时,切换回主表盘页面 - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); - } else { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TRANSITION_ZOOM); + if(mcu_pms_is_screen_on()){ //只有亮屏的时候才做界面切换 + PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 + if (!MainViewSample::GetInstance()->IsMainView()) { // 当前页面为主表盘的其他页面时,切换回主表盘页面 + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + } else { + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TRANSITION_ZOOM); + } } } } -- 2.17.1