优化收音指示灯的显示逻辑
authorxue <2144439972@qq.com>
Thu, 4 Dec 2025 12:01:11 +0000 (20:01 +0800)
committerxue <2144439972@qq.com>
Thu, 4 Dec 2025 12:01:11 +0000 (20:01 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdDialogueView.h
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdMainView.h
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp

index 1daa8d8..91b0371 100644 (file)
@@ -146,7 +146,6 @@ namespace OHOS
             THUNDERBIRD_DIALOGUEVIEW_LISTENING,        // 聆听中
             THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW,      // 状态展示
         };
-        UIImageView *listenIcon{nullptr};
 
     private:
         UIViewGroup *group{nullptr};
index 1847ff3..969375e 100644 (file)
@@ -113,6 +113,7 @@ namespace OHOS
         UIImageView *chargeBatteryicon{nullptr};     // 充电图标
         bool isChargeBatteryIconVisible{false};      // 充电图标是否可见
         UIImageView *earphoneIcon{nullptr};          // 耳机图标
+        UIImageView *listenIcon{nullptr};             // 小绿点(聆听指示器)
 
         int16_t Batteryvalue{0};                    // 电池电量
 
index 1c4aaca..7c60d7b 100644 (file)
@@ -1,5 +1,6 @@
 #include "thunderbird/include/ThunderBirdDialogueView.h"
 #include "thunderbird/include/ThunderBirdModel.h"
+#include "thunderbird/include/ThunderBirdMainView.h"
 #include "wearable_log.h"
 #include <custom_utils.h>
 #include "ln_api.h"
@@ -36,7 +37,6 @@ namespace OHOS
         if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
         if (speakAnimator != nullptr) { delete speakAnimator; speakAnimator = nullptr; }
         if (listenAnimator != nullptr) { delete listenAnimator; listenAnimator = nullptr; }
-        if (listenIcon != nullptr) { delete listenIcon; listenIcon = nullptr; }
         if (RemindButton != nullptr) { delete RemindButton; RemindButton = nullptr;}
         if (micIcon != nullptr) { delete micIcon; micIcon = nullptr;}
     }
@@ -137,16 +137,6 @@ namespace OHOS
         }
         group->Add(speakAnimator);
         group->Add(listenAnimator);
-        listenIcon = new UIImageView();
-        if (listenIcon)
-        {   
-            listenIcon->SetAutoEnable(false);
-            listenIcon->SetPosition(162, 31, 6, 6);
-            listenIcon->SetSrc("/user/res/greenpoint.bin");
-            listenIcon->SetVisible(false);
-            listenIcon->SetResizeMode(UIImageView::CONTAIN);
-            group->Add(listenIcon);
-        }
         RemindButton = new UILabelButton();
         if (RemindButton)
         {
@@ -180,7 +170,6 @@ namespace OHOS
         if (TextLabel) { TextLabel->SetVisible(false);}
         if (speakAnimator) { speakAnimator->SetVisible(false); speakAnimator->Stop(); }
         if (listenAnimator) { listenAnimator->SetVisible(false); listenAnimator->Stop(); }
-        if (listenIcon) { listenIcon->SetVisible(false); }
         switch (showView)
         {
         case THUNDERBIRD_DIALOGUEVIEW_SPEAKING:
@@ -220,7 +209,6 @@ namespace OHOS
 
             //动效图标
             if (listenAnimator) { listenAnimator->SetVisible(true); listenAnimator->Start(); }
-            if  (listenIcon) { listenIcon->SetVisible(false); }
             // // 启动30秒超时定时器
             // if (ThunderBirdModel::GetInstance()) {
             //     ThunderBirdModel::GetInstance()->StartCountUpTimer(8); // 6秒超时
@@ -298,7 +286,6 @@ namespace OHOS
         //     }
             //动效图标
             if (listenAnimator) { listenAnimator->SetVisible(true); listenAnimator->Stop(); }
-            if  (listenIcon) { listenIcon->SetVisible(true); }
 
     }
 }
index f542e71..cbc9dba 100644 (file)
@@ -311,6 +311,11 @@ namespace OHOS
                 delete chargeBatteryicon;
                 chargeBatteryicon = nullptr;
             }
+            if (listenIcon != nullptr)
+            {
+                delete listenIcon;
+                listenIcon = nullptr;
+            }
             
             // 最后删除group1
             delete group1;
@@ -1231,6 +1236,21 @@ namespace OHOS
         group1->Add(chargeBatteryicon);
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "chargeBatteryicon add success");
         /* -------------------------------------------------------------------------- */
+        /* -------------------------------- 小绿点(聆听指示器) -------------------------------- */
+        listenIcon = new UIImageView();
+        if (listenIcon == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listenIcon new fail");
+            return nullptr;
+        }
+        listenIcon->SetAutoEnable(false);
+        listenIcon->SetPosition(80, 10, 8, 8);
+        listenIcon->SetSrc("/user/res/greenpoint.bin");
+        listenIcon->SetResizeMode(UIImageView::CONTAIN);
+        listenIcon->SetVisible(false);
+        group1->Add(listenIcon);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listenIcon add success");
+        /* -------------------------------------------------------------------------- */
         /* -------------------------------------------------------------------------- */
         updateSignalDisplay();
         /* -------------------------------------------------------------------------- */