From: xue <2144439972@qq.com> Date: Fri, 28 Nov 2025 05:44:45 +0000 (+0800) Subject: 优化哄睡文本与播放速度 X-Git-Url: http://git.snicker.com.cn/css/html/static/gitweb.css?a=commitdiff_plain;h=61d2b2d8ae8e0b97ad55482505a52ede742419a6;p=mirrors%2FFD230.git 优化哄睡文本与播放速度 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdLullabyView.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdLullabyView.h index 86d8145ac..fcb36626f 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdLullabyView.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdLullabyView.h @@ -8,6 +8,7 @@ #include "components/ui_image_animator.h" #include "components/ui_label_ext_with_shadow.h" #include +#include namespace OHOS { @@ -53,6 +54,9 @@ namespace OHOS UIImageView *RemindIcon2{nullptr}; UIImageView *RemindGround3{nullptr}; + // 保存VIEW_4的文本,用于从VIEW_5回退时恢复 + std::string savedView4Text; + }; } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdLullabyView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdLullabyView.cpp index 28c114b53..17aa907e6 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdLullabyView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdLullabyView.cpp @@ -409,11 +409,20 @@ namespace OHOS if (TextLabel) { TextLabel->SetPosition(35, 64, 300, 42); - TextLabel->SetText("正在准备故事...");//设置初始文字 + // 如果有保存的文本,则恢复它;否则使用默认文本 + if (!savedView4Text.empty()) { + TextLabel->SetText(savedView4Text.c_str()); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdLullabyView::Show: 恢复保存的文本: %s", savedView4Text.c_str()); + // 恢复后清空保存的文本,以便下次进入时使用默认文本 + savedView4Text.clear(); + } else { + TextLabel->SetText("正在准备故事...");//设置初始文字 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdLullabyView::Show: 使用默认文本: 正在准备故事..."); + } TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); TextLabel->SetShadowOffsetX(2); TextLabel->SetShadowOffsetY(2); - TextLabel->SetRollSpeed(65); + TextLabel->SetRollSpeed(75); TextLabel->SetVisible(true); } break; @@ -422,6 +431,17 @@ namespace OHOS { listenAnimator->Stop(); ThunderBirdMainView::GetInstance()->OpenBackGround(); + // 进入VIEW_5之前,保存当前VIEW_4的文本(如果不是默认文本) + if (TextLabel) { + std::string currentText = TextLabel->GetText(); + if (!currentText.empty() && currentText != "正在准备故事...") { + savedView4Text = currentText; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdLullabyView::Show: 保存VIEW_4文本: %s", savedView4Text.c_str()); + } else { + // 如果当前是默认文本,但之前有保存的文本,保持保存的文本不变 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdLullabyView::Show: 当前是默认文本,保持已保存的文本"); + } + } if (TextLabel) { TextLabel->SetPosition(60, 148, 240, 42); 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 19ddbd96f..87f1dd0b2 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 @@ -392,8 +392,7 @@ namespace OHOS if(currentView == THUNDERBIRD_LULLABYVIEW && currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3) { - HandleLullabyFunction(currentView, currentSubView); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKey: KEY_TYPE_FUNC press, lullaby mode"); + HandleLullabyFunction(currentView, currentSubView); // ln_ws_start_audio_chat(LN_AUDIO_CHAT_CHOOSE_STORY_REQUEST); // ThunderBirdLullabyView::GetInstance()->listenAnimator->Start(); }