From: SnickerSun Date: Thu, 14 Dec 2023 13:52:13 +0000 (+0800) Subject: 优化power、button2键,不亮屏不响应。 X-Git-Tag: release_V1.2.70_20241020_135402~1398^2~2 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=efa1d57c7b6b240c313fef6a667db0b68f2d6390;p=mirrors%2FFD230.git 优化power、button2键,不亮屏不响应。 --- 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); + } } } }