From 905356c92ef9a616095e94ea8061cb6a6b8914dd Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 11 Mar 2025 15:39:29 +0800 Subject: [PATCH] =?utf8?q?AI=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96=EF=BC=9A?= =?utf8?q?=E8=A7=A3=E5=86=B3=E4=B8=8D=E5=9C=A8AI=E5=AF=B9=E8=AF=9D?= =?utf8?q?=E7=95=8C=E9=9D=A2=E6=BB=91=E5=8A=A8=EF=BC=8C=E4=BC=9A=E5=88=87?= =?utf8?q?=E6=8D=A2=E6=A8=A1=E5=9E=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) 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 5f3f402f6..e302afaab 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:11:17 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2025-03-06 16:10:32 + * @LastEditTime: 2025-03-11 15:33:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp */ #include "AppViewIDs.h" @@ -164,43 +164,52 @@ namespace OHOS void AiVoicePresenter::FunctionKeyOnClickToChangeAIModel(void) { - int index = model->GetSelectAiModel() + 1; - if (index >= AIMODES_MAX_NUM) + if(view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) { - index = 0; + int index = model->GetSelectAiModel() + 1; + if (index >= AIMODES_MAX_NUM) + { + index = 0; + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); + model->SetSelectAiModel(index); + view_->ChangeAiModelAndUpdateComponentsStatus(); + model->reset_ai_screen60s_timer_time(); // 重置60s取消常亮屏timer } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); - model->SetSelectAiModel(index); - view_->ChangeAiModelAndUpdateComponentsStatus(); - model->reset_ai_screen60s_timer_time(); // 重置60s取消常亮屏timer return; } // 右滑切换模型 void AiVoicePresenter::DragLeftToRightChangeAIModel(void) { - int index = model->GetSelectAiModel() + 1; - if (index >= AIMODES_MAX_NUM) + if(view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) { - index = 0; + int index = model->GetSelectAiModel() + 1; + if (index >= AIMODES_MAX_NUM) + { + index = 0; + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); + model->SetSelectAiModel(index); + view_->ChangeAiModelAndUpdateComponentsStatus(); } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); - model->SetSelectAiModel(index); - view_->ChangeAiModelAndUpdateComponentsStatus(); return; } // 左滑切换模型 void AiVoicePresenter::DragRightToLetfChangeAIModel(void) { - int index = model->GetSelectAiModel() - 1; - if (index < 0) + if(view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) { - index = AIMODES_CHATGPT; + int index = model->GetSelectAiModel() - 1; + if (index < 0) + { + index = AIMODES_CHATGPT; + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); + model->SetSelectAiModel(index); + view_->ChangeAiModelAndUpdateComponentsStatus(); } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); - model->SetSelectAiModel(index); - view_->ChangeAiModelAndUpdateComponentsStatus(); return; } @@ -509,8 +518,12 @@ namespace OHOS void AiVoicePresenter::OnPickerStoped(UIPicker &picker) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnPickerStoped,%d", picker.GetSelected()); - model->SetSelectAiModel(picker.GetSelected()); - view_->ChangeAiModelAndUpdateComponentsStatus(); + if(view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) + { + model->SetSelectAiModel(picker.GetSelected()); + view_->ChangeAiModelAndUpdateComponentsStatus(); + } + return; } // 计算聊天内容ItemView的高度 -- 2.17.1