From 978497ffe4ef5d8351ae1da151c4377688b3d9f3 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Wed, 29 May 2024 14:56:57 +0800 Subject: [PATCH] =?utf8?q?key=20=E6=96=87=E4=BB=B6=E5=A4=B9=E4=BC=98?= =?utf8?q?=E5=8C=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/key/src/KeyInputListener.cpp | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 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 726f17111..8ea443029 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp @@ -23,22 +23,6 @@ #include "DialViewGroup.h" namespace OHOS { - static bool IsCallingNotify() - { - uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); - if (NotificationManager::GetInstance()->HasNotifyShowing() == true && - (notifyId == TOPIC_EVENT_HFP_INCOMMING || - notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE || - notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH)) - { - return true; - } - else - { - return false; - } - } - static bool IsNotifyCallStatus() { uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); @@ -91,8 +75,12 @@ namespace OHOS void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) { if (MainCallingPresenter::GetInstance() != nullptr && CallerLogModel::GetInstance()->GetCallStatus()) { - if (CallerLogModel::GetInstance()->GetVolumeScreenStatus() == true) { - volumeSliderEventListener = VolumeSliderEventListener::GetInstance(); + if (CallerLogModel::GetInstance()->GetVolumeScreenStatus()) { + VolumeSettingView *settingView = MainCallingPresenter::GetInstance()->GetvolumeSetting(); + if (settingView == nullptr) { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); if (volumeSliderEventListener == nullptr) { return; } @@ -102,9 +90,13 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) CallerLogModel::GetInstance()->SetVolumeScreenStatus(true); } } - if (IsNotifyCallStatus() == true) { - if (NotificationManager::GetInstance()->GetVolumeScreenStatus() == true) { - volumeSliderEventListener = VolumeSliderEventListener::GetInstance(); + if (IsNotifyCallStatus()) { + if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) { + VolumeSettingView *settingView = GetvolumeSetting(); + if (settingView == nullptr) { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); if (volumeSliderEventListener == nullptr) { return; } @@ -116,6 +108,7 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) } } + extern "C" { uint32_t mcu_pm_lcd_on(uint8_t *para, uint32_t para_len); @@ -132,9 +125,10 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) if (longPressFlag == 0 && pressFlag == 1) { // 如果当前页面是音量卡片或正在通话中,则执行音量+操作 - if (currentViewId == VIEW_INCOMING_CALL || IsCallingNotify() == true) // 音量卡片 - { - CallVolumeDipSwitchControl(VOLUMEUP); // 音量+ + if (currentViewId == VIEW_INCOMING_CALL || + NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片 + // 音量+ + CallVolumeDipSwitchControl(VOLUMEUP); } else if (currentViewId != VIEW_MAIN) // 如果当前页面不是主表盘,如果屏幕亮起,则先处理闹钟通知再切换到主表盘页面 { @@ -167,9 +161,10 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) if (longPressFlag == 0 && pressFlag == 1) { // 如果当前页面是音量卡片或正在通话中,则执行音量减操作 - if (currentViewId == VIEW_INCOMING_CALL || IsCallingNotify() == true) // 音量卡片 - { - CallVolumeDipSwitchControl(VOLUMEDOWN); // 音量- + if (currentViewId == VIEW_INCOMING_CALL || + NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片 + // 音量- + CallVolumeDipSwitchControl(VOLUMEDOWN); } else if (currentViewId != VIEW_MAIN) // 如果当前页面不是主表盘,如果屏幕亮起,则先处理闹钟通知再切换到主表盘页面。 { -- 2.17.1