增加对话绑定区分
authorxue <2144439972@qq.com>
Thu, 6 Nov 2025 08:02:07 +0000 (16:02 +0800)
committerxue <2144439972@qq.com>
Thu, 6 Nov 2025 08:02:07 +0000 (16:02 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdDialogueView.h
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp

index 93e2210..b063110 100644 (file)
@@ -6,6 +6,7 @@
 #include "components/ui_label_ext.h"
 #include "components/ui_image_view.h"
 #include "components/ui_image_animator.h"
+#include "components/ui_label_button.h"
 #include "UiConfig.h"
 
 namespace OHOS
@@ -130,6 +131,7 @@ namespace OHOS
         void Show(int16_t showView);
         void UpdateDialogueText(const char *text);
         void AudioPlaybackEnd();
+        void Isband(bool);
 
         enum : int16_t {
             THUNDERBIRD_DIALOGUEVIEW_SPEAKING = 0,     // 说话中
@@ -148,6 +150,10 @@ namespace OHOS
         ImageAnimatorInfo listenImageInfo[TB_LISTEN_ANIM_FRAMES];
         const char **speakPathsArray{nullptr};
         const char **listenPathsArray{nullptr};
+
+        UILabelButton *RemindButton{nullptr};//未绑定时的解绑状态
+        UIImageView *micIcon{nullptr};
+
     };
 }
 
index 776c53a..ba512a7 100644 (file)
@@ -39,6 +39,8 @@ namespace OHOS
         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;}
     }
     bool ThunderBirdDialogueView::EnsureSpeakAnimator()
     {
@@ -157,6 +159,30 @@ namespace OHOS
             listenIcon->SetResizeMode(UIImageView::CONTAIN);
             group->Add(listenIcon);
         }
+        RemindButton = new UILabelButton();
+        if (RemindButton)
+        {
+            RemindButton->SetPosition(16, 114, 320, 40);
+            RemindButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff635d58, UIButton::RELEASED);
+            RemindButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff7c7773, UIButton::RELEASED);
+            RemindButton->SetStyleForState(STYLE_BORDER_WIDTH, 2, UIButton::RELEASED);
+            RemindButton->SetText("长按     绑定设备,可更换角色哦");
+            RemindButton->SetLabelPosition(4, 2);
+            RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+            RemindButton->SetVisible(false);
+            group->Add(RemindButton);
+        }
+
+        micIcon = new UIImageView;
+        if (micIcon)
+        {   
+            micIcon->SetAutoEnable(false);
+            micIcon->SetPosition(16+62, 114+6, 24, 24);
+            micIcon->SetSrc("/user/res/voice.bin");
+            micIcon->SetResizeMode(UIImageView::CONTAIN);
+            micIcon->SetVisible(false);
+            group->Add(micIcon);
+        }
         return group;
     }
 
@@ -232,7 +258,7 @@ namespace OHOS
         {
             // 从ThunderBirdModel获取当前表情和状态文本
             std::string currentStatusText = "发呆中...  ";
-            
+            Isband(true);
             if (ThunderBirdModel::GetInstance()) {
                 currentStatusText = ThunderBirdModel::GetInstance()->GetCurrentStatusText();
             }
@@ -272,6 +298,24 @@ namespace OHOS
         //TextLabel_Y->SetText("还有什么想聊的吗?");
         if(speakAnimator) {speakAnimator->Stop();}
     }
+
+    void ThunderBirdDialogueView::Isband(bool flag)
+    {
+        if(!flag)
+        {
+            speakAnimator->SetVisible(true);
+            // speakAnimator->Stop();
+            RemindButton->SetVisible(true);
+            micIcon->SetVisible(true);
+        }
+        else
+        {
+            speakAnimator->SetVisible(false);
+            speakAnimator->Stop();
+            RemindButton->SetVisible(false);
+            micIcon->SetVisible(false);
+        }
+    }
 }
 
 
index 0796dea..04bb03e 100644 (file)
@@ -754,6 +754,14 @@ namespace OHOS
                 ThunderBirdModel::GetInstance()->LowFrequence();//减低视频帧率
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "进入对话模式");
                 ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_LISTENING);
+                if(currentView == THUNDERBIRD_GUIDEVIEW)
+                {
+                    ThunderBirdDialogueView::GetInstance()->Isband(false);
+                }
+                else
+                {
+                    ThunderBirdDialogueView::GetInstance()->Isband(true);
+                }
                 isDialogueing = true;
                 ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 打开屏幕常亮
                 // 进入对话模式时记录当前表情
index 6a5a228..6a871a5 100644 (file)
@@ -39,6 +39,8 @@ namespace OHOS
         if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
         if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
         if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+        if (RemindButton != nullptr) { delete RemindButton; RemindButton = nullptr;}
+        if (VolumeProgress != nullptr) { delete VolumeProgress; VolumeProgress = nullptr;}
     }
 
     UIViewGroup *ThunderBirdReminderView::ThunderBirdReminderViewInit(void)