From e401d69b5037c58e81ab005dcb309df515f32a19 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Wed, 2 Oct 2024 17:28:22 +0800 Subject: [PATCH] =?utf8?q?#503=E6=89=8B=E8=A1=A8=EF=BC=8C=E8=AF=AD?= =?utf8?q?=E9=9F=B3=E5=8A=A9=E6=89=8B=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../assistant/include/AssistantModel.h | 2 ++ .../nativeui/assistant/src/AssistantModel.cpp | 35 +++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/assistant/include/AssistantModel.h b/code/sdk/application/wearable/fd230app/nativeui/assistant/include/AssistantModel.h index beb08a0a9..4ee1d8a32 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/assistant/include/AssistantModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/assistant/include/AssistantModel.h @@ -24,6 +24,8 @@ public: bool StartAssistant(void); //关闭语音助手 void StopAssistant(void); + //跳转界面 + bool ChangeToMainView(void); private: // 禁止拷贝构造和赋值操作 diff --git a/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantModel.cpp index 4352f7e53..75ccc7e73 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantModel.cpp @@ -104,20 +104,9 @@ static void Notify(void *args, const Topic topic, Request *request) { } // 退出语音助手 if (request->msgId == TOPIC_EVENT_ASSISTANT_NOTE) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出语音助手\r\n"); - AssistantView *p_AssistantView = AssistantView::GetInstance(); - if (p_AssistantView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, - " AssistantView::GetInstance fail!"); - return; - } - if ((p_AssistantView->GetAssistantScrollView(ASSISTANT_ANSWER_VIEW)) - ->IsVisible() == true && - p_AssistantView->GetAssistantScrollView(ASSISTANT_MAIN_VIEW) - ->IsVisible() == false) { - p_AssistantView->ChangeView(ASSISTANT_ANSWER_VIEW, ASSISTANT_MAIN_VIEW); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出语音助手成功\r\n"); - } + // 界面刷新 + GraphicService::GetInstance()->PostGraphicEvent(std::bind( + &AssistantModel::ChangeToMainView, AssistantModel::GetInstance())); } } #ifdef __cplusplus @@ -174,4 +163,22 @@ void AssistantModel::StopAssistant(void) { } } +//语音回答界面->主界面 +bool AssistantModel::ChangeToMainView(void) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出语音助手\r\n"); + AssistantView *p_AssistantView = AssistantView::GetInstance(); + if (p_AssistantView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " AssistantView::GetInstance fail!"); + return false; + } + if ((p_AssistantView->GetAssistantScrollView(ASSISTANT_ANSWER_VIEW)) + ->IsVisible() == true && + p_AssistantView->GetAssistantScrollView(ASSISTANT_MAIN_VIEW) + ->IsVisible() == false) { + p_AssistantView->ChangeView(ASSISTANT_ANSWER_VIEW, ASSISTANT_MAIN_VIEW); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出语音助手成功\r\n"); + } + return true; +} + } // namespace OHOS \ No newline at end of file -- 2.17.1