From b4c14f88b3bcc9063cde583854daa26b6188ea62 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 3 Jul 2025 09:41:47 +0800 Subject: [PATCH] =?utf8?q?1.=E8=A7=A3=E5=86=B3ai=E7=95=8C=E9=9D=A2?= =?utf8?q?=E9=87=8D=E5=A4=8D=E6=B7=BB=E5=8A=A0=E7=BB=84=E4=BB=B6=E9=97=AE?= =?utf8?q?=E9=A2=98=202.=E8=A7=A3=E5=86=B3=E5=90=8C=E4=B8=80=E4=B8=AA?= =?utf8?q?=E5=AD=90=E7=95=8C=E9=9D=A2=E5=88=87=E6=8D=A2=E9=BB=91=E5=B1=8F?= =?utf8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/aivoice/src/AiVoiceModel.cpp | 5 ++-- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 12 ++++++-- .../nativeui/aivoice/src/AiVoiceView.cpp | 30 +++++++++---------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp index ad97b1cb7..200e39739 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -982,9 +982,10 @@ namespace OHOS { AiVoiceModel::GetInstance().StopListenAndRecordingUserQuestion(); // 停止聆听用户问题 AiVoiceModel::GetInstance().stop_listening_timer(); // 停止聆听定时器 - if (AiVoiceView::GetInstance() && AivoiceListeningView::GetInstance()) + AiVoicePresenter *p_AiVoicePresenter = AiVoicePresenter::GetInstance(); + if (AiVoicePresenter::GetInstance() && AivoiceListeningView::GetInstance()) { - AiVoiceView::GetInstance()->ChangeView(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID); // 切换到思考中界面 + AiVoicePresenter::GetInstance()->ChangeViewAndLogicOperator(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID); // 切换到思考中界面 } } else diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp index 01ffa305e..5d3af13da 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -282,7 +282,12 @@ namespace OHOS bool AiVoicePresenter::ChangeViewAndLogicOperator(int16_t hideView, int16_t showView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::ChangeViewOperator"); - + bool isSameView = (hideView == showView); + if (isSameView) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Same view no need to change"); + return false; + } if (hideView > MAX_AIVOICE_VIEWID) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Overstep ones bounds"); @@ -412,7 +417,8 @@ namespace OHOS { if (model->GetSelect4gorbt() == AI_SELECT_4G) { - model->cancel_tts_play(); + // model->cancel_tts_play(); + dinit_ai_task(); usleep(50000); } } @@ -771,7 +777,7 @@ namespace OHOS bool AiVoicePresenter::OnRotate(UIView &view, const RotateEvent &event) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRotateEnd"); - ChangeVolume(view,event); + ChangeVolume(view, event); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp index d26ea4e0f..de29cd93a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp @@ -485,22 +485,22 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VolumeProcess new fail"); return false; } + VolumeProcess->SetSliderColor(Color::Gray(), Color::Silver()); + VolumeProcess->SetPosition(-200, 77, 130, 310); + VolumeProcess->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP); + VolumeProcess->SetRange(100, 0); + VolumeProcess->SetStyle(STYLE_BORDER_RADIUS, 100); + VolumeProcess->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + VolumeProcess->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + VolumeProcess->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + VolumeProcess->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff); + VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); + VolumeProcess->RequestFocus(); + VolumeProcess->SetRotateFactor(1.0); + // VolumeProcess->SetVisible(false); + VolumeProcess->SetOnRotateListener(presenter_); + container_->Add(VolumeProcess); } - VolumeProcess->SetSliderColor(Color::Gray(), Color::Silver()); - VolumeProcess->SetPosition(-200, 77, 130, 310); - VolumeProcess->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP); - VolumeProcess->SetRange(100, 0); - VolumeProcess->SetStyle(STYLE_BORDER_RADIUS, 100); - VolumeProcess->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); - VolumeProcess->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); - VolumeProcess->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); - VolumeProcess->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff); - VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); - VolumeProcess->RequestFocus(); - VolumeProcess->SetRotateFactor(1.0); - // VolumeProcess->SetVisible(false); - VolumeProcess->SetOnRotateListener(presenter_); - container_->Add(VolumeProcess); return true; } -- 2.17.1