From: Caisking <3449750381@qq.com> Date: Wed, 2 Oct 2024 09:28:22 +0000 (+0800) Subject: #503手表,语音助手无法使用 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=e401d69b5037c58e81ab005dcb309df515f32a19;p=mirrors%2FFD230.git #503手表,语音助手无法使用 --- 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