From 6fef695cb7516209aa0bfe14d534493148110b97 Mon Sep 17 00:00:00 2001 From: cheng Date: Tue, 16 Sep 2025 14:39:48 +0800 Subject: [PATCH] =?utf8?q?4gAi:=E8=81=86=E5=90=AC=E4=B8=AD=EF=BC=8C?= =?utf8?q?=E6=80=9D=E8=80=83=E4=B8=AD=EF=BC=8C=E8=BF=9E=E6=8E=A5=E4=B8=AD?= =?utf8?q?=E7=95=8C=E9=9D=A2=E9=87=87=E7=94=A8=E7=9B=B4=E6=8E=A5=E5=85=88?= =?utf8?q?=E5=88=9B=E5=BB=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../aivoice/include/AiVoiceConnectingView.h | 1 + .../aivoice/include/Aivoice4gServiceConView.h | 1 + .../aivoice/src/AiVoiceConnectingView.cpp | 15 +++++++- .../nativeui/aivoice/src/AiVoiceView.cpp | 37 ++++++++++++++----- .../aivoice/src/Aivoice4gServiceConView.cpp | 11 ++++++ 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceConnectingView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceConnectingView.h index 2042f7f7b..d044ac042 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceConnectingView.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceConnectingView.h @@ -63,6 +63,7 @@ namespace OHOS static AiVoiceConnectingView *GetInstance(void); UIScrollView *CreateAiVoiceConnectingView(void); UIScrollView *CreateAiVoiceConnectingView(uint8_t); + void StartOrStopAiVoiceConnectingImageAnimatorView(bool val); private: UIImageAnimatorView *connectingImageAnimatorInit(ImageAnimatorConfig &imageanimatorconfig); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/Aivoice4gServiceConView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/Aivoice4gServiceConView.h index 495e68a6b..1e451dec9 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/Aivoice4gServiceConView.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/Aivoice4gServiceConView.h @@ -14,6 +14,7 @@ namespace OHOS ~AiVoice4gServiceConView(); static AiVoice4gServiceConView *GetInstance(void); UIScrollView *CreateAiVoice4gServiceConView(void); + void StartOrStopAiVoice4gServiceConImageAnimatorView(bool val); private: void ClearAll(void); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceConnectingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceConnectingView.cpp index 542b308a1..2b328cf99 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceConnectingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceConnectingView.cpp @@ -201,7 +201,7 @@ namespace OHOS animatorView->SetSizeFixed(true); // animatorView->SetAutoEnable(false); // animatorView->SetResizeMode(UIImageAnimatorView::FILL); - animatorView->Start(); + // animatorView->Start(); return animatorView; } @@ -310,11 +310,22 @@ namespace OHOS connectingAnimatorView->SetRepeat(true); connectingAnimatorView->SetAutoEnable(false); connectingAnimatorView->SetResizeMode(UIImageView::FILL); - connectingAnimatorView->Start(); + // connectingAnimatorView->Start(); return true; } + void AiVoiceConnectingView::StartOrStopAiVoiceConnectingImageAnimatorView(bool val) + { + if (connectingAnimatorView != nullptr) + { + if (val) + connectingAnimatorView->Start(); + else + connectingAnimatorView->Stop(); + } + } + bool AiVoiceConnectingView::CreateAiVoiceConnectingScrollView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::CreateAiVoiceConnectingScrollView"); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp index dbcee4be8..7f5ea7c1a 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp @@ -522,6 +522,12 @@ namespace OHOS void AiVoiceView::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::OnStart"); + ChangeView(MAX_AIVOICE_VIEWID, AIVOICE_AIMODE_CONNECTING); + GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING)->SetVisible(false); + ChangeView(MAX_AIVOICE_VIEWID, AIVOICE_LISTENING_VIEWID); + GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID)->SetVisible(false); + ChangeView(MAX_AIVOICE_VIEWID, AIVOICE_THINKING_VIEWID); + GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID)->SetVisible(false); ChangeView(MAX_AIVOICE_VIEWID, AIVOICE_STARTCHAT_VIEWID); #if defined(AI_VOICE_FD230) || defined(AI_VOICE_N9) CreateAiVoiceVoiceView(); @@ -824,6 +830,10 @@ namespace OHOS AiVoiceScrollView[thisView] = scrollview; AddViewToRootContainer(AiVoiceScrollView[thisView]); } + if(p_AiVoiceConnectingView) + { + p_AiVoiceConnectingView->StartOrStopAiVoiceConnectingImageAnimatorView(true); + } return true; } @@ -870,6 +880,10 @@ namespace OHOS AiVoiceScrollView[thisView] = scrollview; AddViewToRootContainer(AiVoiceScrollView[thisView]); } + if(p_Aivoice4gServiceConView) + { + p_Aivoice4gServiceConView->StartOrStopAiVoice4gServiceConImageAnimatorView(true); + } return true; } @@ -957,10 +971,10 @@ namespace OHOS } static const int16 AiVoiceDestroyMapper[] = { - AIVOICE_AIMODE_CONNECTING, + // AIVOICE_AIMODE_CONNECTING, AIVOICE_4GSERVICECON_VIEW, - AIVOICE_LISTENING_VIEWID, - AIVOICE_THINKING_VIEWID, + // AIVOICE_LISTENING_VIEWID, + // AIVOICE_THINKING_VIEWID, AIVOICE_SELECT_VIEW, AIVOICE_CONNECT_TIMEOUT_VIEWID, AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID, @@ -985,13 +999,15 @@ namespace OHOS break; } } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DestroyTempView:%d",hideView); switch (hideView) { case AIVOICE_AIMODE_CONNECTING: if (p_AiVoiceConnectingView) { - delete p_AiVoiceConnectingView; - p_AiVoiceConnectingView = nullptr; + // delete p_AiVoiceConnectingView; + // p_AiVoiceConnectingView = nullptr; + p_AiVoiceConnectingView->StartOrStopAiVoiceConnectingImageAnimatorView(false); } break; case AIVOICE_4GSERVICECON_VIEW: @@ -999,20 +1015,23 @@ namespace OHOS { delete p_Aivoice4gServiceConView; p_Aivoice4gServiceConView = nullptr; + // p_Aivoice4gServiceConView->StartOrStopAiVoice4gServiceConImageAnimatorView(false); } break; case AIVOICE_LISTENING_VIEWID: if (p_AivoiceListeningView) { - delete p_AivoiceListeningView; - p_AivoiceListeningView = nullptr; + // delete p_AivoiceListeningView; + // p_AivoiceListeningView = nullptr; + p_AivoiceListeningView->StartOrStopAivoiceListeningImageAnimatorView(false); } break; case AIVOICE_THINKING_VIEWID: if (p_AivoiceThinkingView) { - delete p_AivoiceThinkingView; - p_AivoiceThinkingView = nullptr; + // delete p_AivoiceThinkingView; + // p_AivoiceThinkingView = nullptr; + p_AivoiceThinkingView->StartOrStopAiVoiceThinkingImageAnimatorView(false); } break; case AIVOICE_SELECT_VIEW: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/Aivoice4gServiceConView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/Aivoice4gServiceConView.cpp index f51a41253..2089b3018 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/Aivoice4gServiceConView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/Aivoice4gServiceConView.cpp @@ -131,4 +131,15 @@ namespace OHOS return scrollView; } + + void AiVoice4gServiceConView::StartOrStopAiVoice4gServiceConImageAnimatorView(bool val) + { + if (AI4GImageAni != nullptr) + { + if (val) + AI4GImageAni->Start(); + else + AI4GImageAni->Stop(); + } + } } -- 2.17.1