From: luozheng <1732036298@qq.com> Date: Tue, 11 Mar 2025 07:39:29 +0000 (+0800) Subject: AI界面优化:解决不在AI对话界面滑动,会切换模型的问题 X-Git-Tag: V1.3.115~12 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1690%2F1;p=mirrors%2FFD230.git AI界面优化:解决不在AI对话界面滑动,会切换模型的问题 --- 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的高度