From 441ed0ff4a229caa50052bb6d682f2f895339ab1 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Thu, 6 Nov 2025 16:02:07 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E8=AF=9D=E7=BB=91?= =?utf8?q?=E5=AE=9A=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/ThunderBirdDialogueView.h | 6 +++ .../src/ThunderBirdDialogueView.cpp | 46 ++++++++++++++++++- .../thunderbird/src/ThunderBirdPresenter.cpp | 8 ++++ .../src/ThunderBirdReminderView.cpp | 2 + 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdDialogueView.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdDialogueView.h index 93e2210e1..b063110fa 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdDialogueView.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdDialogueView.h @@ -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}; + }; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp index 776c53a0a..ba512a7bb 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdDialogueView.cpp @@ -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); + } + } } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp index 0796deaf7..04bb03e31 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp @@ -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); // 打开屏幕常亮 // 进入对话模式时记录当前表情 diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp index 6a5a22819..6a871a57f 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp @@ -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) -- 2.17.1