From 033579d69ce3c67d04fa87c309dede4fd64dbc54 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Sat, 13 Dec 2025 10:31:58 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E4=BA=AE=E5=B1=8F=E8=B7=91?= =?utf8?q?=E9=A9=AC=E7=81=AF=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/ThunderBirdDialogueView.cpp | 13 +++++++-- .../thunderbird/src/ThunderBirdGuideView.cpp | 27 ++++++++++--------- .../thunderbird/src/ThunderBirdMainView.cpp | 18 +++++++++++++ 3 files changed, 44 insertions(+), 14 deletions(-) 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 097112c1b..a9ce8e158 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 @@ -4,6 +4,7 @@ #include "wearable_log.h" #include #include "ln_api.h" +#include "ai_media.h" namespace OHOS { @@ -241,6 +242,10 @@ namespace OHOS { TextLabel->SetPosition(37, 66, 325, 42); TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + // 先清空文本,重置跑马灯偏移,避免从右侧滚动出来 + TextLabel->SetVisible(false); + TextLabel->SetText(""); + // 再设置真实文本,确保从左侧开始显示 TextLabel->SetText(currentStatusText.c_str()); TextLabel->SetVisible(true); } @@ -254,8 +259,12 @@ namespace OHOS void ThunderBirdDialogueView::UpdateDialogueText(const char *text) { if(!TextLabel) return; - // 设置文本 - TextLabel->SetText(text); + // 先清空文本,重置跑马灯偏移,避免从右侧滚动出来 + TextLabel->SetVisible(false); + TextLabel->SetText(""); + // 再设置真实文本,确保从左侧开始显示 + TextLabel->SetText(text); + TextLabel->SetVisible(true); } void ThunderBirdDialogueView::AudioPlaybackEnd() diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdGuideView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdGuideView.cpp index e72de5f64..1000a967c 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdGuideView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdGuideView.cpp @@ -27,18 +27,21 @@ namespace OHOS void ThunderBirdGuideView::OnWsConnected() { // Called when WS becomes connected: stop band animation and show QR code - if (bandAnimator) { - bandAnimator->Stop(); - bandAnimator->SetVisible(false); - } - if (qrcode_) { - qrcode_->SetQrcodeInfo(ThunderBirdModel::GetInstance()->GetQrcodeContent().c_str()); - qrcode_->SetPosition(119, 157, 111, 111); - qrcode_->SetVisible(true); - } - if (TextLabel) { - TextLabel->SetText("换角色,挑声音,哄睡...\nAmby小程序扫码尽享"); - } + if(ThunderBirdMainView::GetInstance()->GetCurrentSubView() == THUNDERBIRD_GUIDEVIEW_5) + { + if (bandAnimator) { + bandAnimator->Stop(); + bandAnimator->SetVisible(false); + } + if (qrcode_) { + qrcode_->SetQrcodeInfo(ThunderBirdModel::GetInstance()->GetQrcodeContent().c_str()); + qrcode_->SetPosition(119, 157, 111, 111); + qrcode_->SetVisible(true); + } + if (TextLabel) { + TextLabel->SetText("换角色,挑声音,哄睡...\nAmby小程序扫码尽享"); + } + } FirstShow = false; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp index aa975e09a..d9e6cc856 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdMainView.cpp @@ -110,6 +110,24 @@ namespace OHOS { g_videoPlay->ResumeVideoPlay(); } + // 亮屏时,如果当前在状态展示界面,刷新字幕显示(重置跑马灯偏移) + int16_t currentView = ThunderBirdMainView::GetInstance()->GetCurrentView(); + int16_t currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView(); + if (currentView == THUNDERBIRD_DIALOGUEVIEW && + currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW) { + // 刷新字幕显示,重置跑马灯偏移 + ThunderBirdDialogueView *dialogueView = ThunderBirdDialogueView::GetInstance(); + if (dialogueView != nullptr) { + ThunderBirdModel *model = ThunderBirdModel::GetInstance(); + if (model != nullptr) { + std::string currentStatusText = model->GetCurrentStatusText(); + if (currentStatusText.empty()) { + currentStatusText = "发呆中... "; + } + dialogueView->UpdateDialogueText(currentStatusText.c_str()); + } + } + } // ln_ws_exit_sleep(); } g_lastPlayed = temp; -- 2.17.1