#503手表,语音助手无法使用
authorCaisking <3449750381@qq.com>
Wed, 2 Oct 2024 09:28:22 +0000 (17:28 +0800)
committerCaisking <3449750381@qq.com>
Wed, 2 Oct 2024 09:28:22 +0000 (17:28 +0800)
code/sdk/application/wearable/fd230app/nativeui/assistant/include/AssistantModel.h
code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantModel.cpp

index beb08a0..4ee1d8a 100644 (file)
@@ -24,6 +24,8 @@ public:
   bool StartAssistant(void);
   //关闭语音助手
   void StopAssistant(void);
+  //跳转界面
+  bool ChangeToMainView(void); 
 
 private:
   // 禁止拷贝构造和赋值操作
index 4352f7e..75ccc7e 100644 (file)
@@ -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