4GAI聆听中界面切换到思考中界面采用post 2012/1 2012/head 2013/target/1
authorluozheng <1732036298@qq.com>
Mon, 28 Jul 2025 02:03:37 +0000 (10:03 +0800)
committerluozheng <1732036298@qq.com>
Mon, 28 Jul 2025 02:03:37 +0000 (10:03 +0800)
code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceListeningView.cpp
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceThinkingView.cpp

index 2967eb5..3fa2939 100644 (file)
@@ -58,6 +58,7 @@ namespace OHOS
         void DragLeftToRightChangeAIModel(void);
         void DragRightToLetfChangeAIModel(void);
         void ChangeVolume(UIView &view, const RotateEvent &event);
+        void JumpThinkingView(void);
 
     private:
         bool OnClick(UIView &view, const ClickEvent &event) override;
index be9d5d2..5dd8f20 100644 (file)
@@ -25,6 +25,7 @@
 #include "bleService.h"
 #include "player/include/PlayersModel.h"
 #include "aivoice/include/AiVoiceSelectView.h"
+#include "graphic_service.h"
 
 #include "cat1_ws.h"
 #include <mutex>
@@ -371,6 +372,16 @@ namespace OHOS
         return true;
     }
 
+    void AiVoicePresenter::JumpThinkingView(void)
+    {
+        if ((view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID) != nullptr) &&
+            (view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID)->IsVisible()))
+        {
+            ChangeViewAndLogicOperator(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID);
+        }
+        return;
+    }
+
     // 处理手点击屏幕切换AI模型
     bool AiVoicePresenter::OnClick(UIView &view, const ClickEvent &event)
     {
@@ -568,11 +579,12 @@ namespace OHOS
             if (model->GetSelect4gorbt() == AI_SELECT_4G)
             {
                 uapi_UI_stop_asr();
-                usleep(10000);
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FINISH_SPEAKING_BUTTON_VIEW_ID:(%d,%d)",model->is_need_to_jump_result_view(),model->getentryTextViewState());
+                // usleep(10000);
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FINISH_SPEAKING_BUTTON_VIEW_ID:(%d,%d)", model->is_need_to_jump_result_view(), model->getentryTextViewState());
                 if (!model->is_need_to_jump_result_view() && !model->getentryTextViewState()) // 没有数据就跳转到思考中界面
                 {
-                    ChangeViewAndLogicOperator(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID);
+                    GraphicService::GetInstance()->PostGraphicEvent(
+                        std::bind(&OHOS::AiVoicePresenter::JumpThinkingView, OHOS::AiVoicePresenter::GetInstance()));
                 }
             }
             else if (model->GetSelect4gorbt() == AI_SELECT_BT)
index f2d288e..0e9186d 100644 (file)
@@ -109,7 +109,7 @@ namespace OHOS
         button->SetViewId(buttonconfig.ViewId);
         button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         button->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-        button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
 
         return button;
     }
index f77f124..a9c6021 100644 (file)
@@ -104,7 +104,7 @@ namespace OHOS
         button->SetViewId(buttonconfig.ViewId);
         button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
         button->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-        button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
 
         return button;
     }