key 文件夹优化更新
authorluozheng <1732036298@qq.com>
Wed, 29 May 2024 06:56:57 +0000 (14:56 +0800)
committerluozheng <1732036298@qq.com>
Wed, 29 May 2024 06:56:57 +0000 (14:56 +0800)
code/sdk/application/wearable/fd230app/nativeui/key/src/KeyInputListener.cpp

index 726f171..8ea4430 100644 (file)
 #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) // 如果当前页面不是主表盘,如果屏幕亮起,则先处理闹钟通知再切换到主表盘页面。
                 {