From 1ae72aa549176ee83a0f252f5777ef6a2fc367c4 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Sat, 10 Aug 2024 17:49:51 +0800 Subject: [PATCH] =?utf8?q?=E5=85=B3=E9=97=AD=E4=B8=BB=E7=95=8C=E9=9D=A2?= =?utf8?q?=E5=88=B0applist=E7=9A=84=E5=8A=A8=E7=94=BB=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/key/src/KeyInputListener.cpp | 97 +++++++++++-------- 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp b/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp index c6163d9d7..55f9ec153 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp @@ -9,7 +9,7 @@ #include "common/key_code.h" #include "AppViewIDs.h" #include "components/ui_label_ext.h" -#include"ui_resource_string.h" +#include "ui_resource_string.h" #include "View.h" #include "MainViewSample.h" #include "wearable_log.h" @@ -62,8 +62,8 @@ namespace OHOS uint16 keyID = event.GetKeyId(); if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { // 电源按键 - // 切换到关机/重启卡片 - // NativeAbility::GetInstance().ChangeSlice(VIEW_SHUTDOWN_OR_REBOOT); + // 切换到关机/重启卡片 + // NativeAbility::GetInstance().ChangeSlice(VIEW_SHUTDOWN_OR_REBOOT); } else if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_FUNC)) { // 功能按键 @@ -72,42 +72,53 @@ namespace OHOS return; } -void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) -{ - if (MainCallingPresenter::GetInstance() != nullptr && CallerLogModel::GetInstance()->GetCallStatus()) { - if (CallerLogModel::GetInstance()->GetVolumeScreenStatus()) { - VolumeSettingView *settingView = MainCallingPresenter::GetInstance()->GetvolumeSetting(); - if (settingView == nullptr) { - return; + void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) + { + if (MainCallingPresenter::GetInstance() != nullptr && CallerLogModel::GetInstance()->GetCallStatus()) + { + if (CallerLogModel::GetInstance()->GetVolumeScreenStatus()) + { + VolumeSettingView *settingView = MainCallingPresenter::GetInstance()->GetvolumeSetting(); + if (settingView == nullptr) + { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); + if (volumeSliderEventListener == nullptr) + { + return; + } + volumeSliderEventListener->ChangeVolume(status); } - volumeSliderEventListener = settingView->GetVolumeEventListener(); - if (volumeSliderEventListener == nullptr) { - return; + else + { + MainCallingPresenter::GetInstance()->HonrsViewChange(); + CallerLogModel::GetInstance()->SetVolumeScreenStatus(true); } - volumeSliderEventListener->ChangeVolume(status); - } else { - MainCallingPresenter::GetInstance()->HonrsViewChange(); - CallerLogModel::GetInstance()->SetVolumeScreenStatus(true); } - } - if (IsNotifyCallStatus()) { - if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) { - VolumeSettingView *settingView = GetvolumeSetting(); - if (settingView == nullptr) { - return; + if (IsNotifyCallStatus()) + { + if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) + { + VolumeSettingView *settingView = GetvolumeSetting(); + if (settingView == nullptr) + { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); + if (volumeSliderEventListener == nullptr) + { + return; + } + volumeSliderEventListener->ChangeVolume(status); } - volumeSliderEventListener = settingView->GetVolumeEventListener(); - if (volumeSliderEventListener == nullptr) { - return; + else + { + HonrsViewChange(); + NotificationManager::GetInstance()->SetVolumeScreenStatus(true); } - volumeSliderEventListener->ChangeVolume(status); - } else { - HonrsViewChange(); - NotificationManager::GetInstance()->SetVolumeScreenStatus(true); } } -} - extern "C" { @@ -125,17 +136,19 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) if (longPressFlag == 0 && pressFlag == 1) { // 如果当前页面是音量卡片或正在通话中,则执行音量+操作 - if (currentViewId == VIEW_INCOMING_CALL || - NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片 + if (currentViewId == VIEW_INCOMING_CALL || + NotificationManager::GetInstance()->GetWatchCallStatus()) + { // 音量卡片 // 音量+ - CallVolumeDipSwitchControl(VOLUMEUP); + CallVolumeDipSwitchControl(VOLUMEUP); } else if (currentViewId != VIEW_MAIN) // 如果当前页面不是主表盘,如果屏幕亮起,则先处理闹钟通知再切换到主表盘页面 { if (mcu_pms_is_screen_on()) { PressAlarmNotify(); - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TransitionType::TRANSITION_ZOOM); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + // NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TransitionType::TRANSITION_ZOOM); } } else // 如果当前页面是主表盘: @@ -149,7 +162,8 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) } else { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ZOOM); + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ZOOM); // NativeAbility::GetInstance().EnterSlice(VIEW_APPLIST, TransitionType::TRANSITION_ZOOM); } } @@ -162,17 +176,18 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) if (longPressFlag == 0 && pressFlag == 1) { // 如果当前页面是音量卡片或正在通话中,则执行音量减操作 - if (currentViewId == VIEW_INCOMING_CALL || - NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片 + if (currentViewId == VIEW_INCOMING_CALL || + NotificationManager::GetInstance()->GetWatchCallStatus()) + { // 音量卡片 // 音量- - CallVolumeDipSwitchControl(VOLUMEDOWN); + CallVolumeDipSwitchControl(VOLUMEDOWN); } else if (currentViewId != VIEW_MAIN) // 如果当前页面不是主表盘,如果屏幕亮起,则先处理闹钟通知再切换到主表盘页面。 { if (mcu_pms_is_screen_on()) { PressAlarmNotify(); - //NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TransitionType::TRANSITION_ZOOM); + // NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TransitionType::TRANSITION_ZOOM); } } else // 如果当前页面是主表盘,如果屏幕亮起,则先处理闹钟通知再切换到用户配置的快捷卡片 -- 2.17.1