From: 罗正 <1732036298@qq.com> Date: Sat, 31 Aug 2024 09:19:32 +0000 (+0000) Subject: Merge #848 into sdk602patch0626 from refs/changes/848/head X-Git-Tag: release_V1.2.70_20241020_135402~545^2~2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=6b98956a34e955b55ba166d97bb2967ff52adcb7;p=mirrors%2FFD230.git Merge #848 into sdk602patch0626 from refs/changes/848/head Code review from 罗正 * refs/changes/848/head: (16 commits squashed) - 秒表界面计数条数去掉数字0 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 1.倒计时界面取消长亮屏,并在倒计时结束时添加一个亮屏5s操作 2.优化自定义倒计时时间总时长文字不居中 - 解决闹钟界面右滑容易退出问题 - 补交闹钟少提交文件 - 倒计时界面使用%02d解决计数少于两位数补零 - 闹钟退出逻辑改为OnDragEnd - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 修复下拉界面关闭4g开关,而4G开关界面中没有同步关闭问题 #406 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 天气动画改为Imageinfo保存和释放 - AI语音优化修改: 1.动画改为imageinfo创建和释放改善内存泄漏 2.添加对应回应类型的错误弹窗 - 查找手机和配对动画改成Imageinfo减少内存泄漏 - 开机动画使用Imageinfo创建和释放,解决动画内存泄漏 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/848 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceConnectingView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceConnectingView.h index dfeb450d6..4f69a4e44 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceConnectingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceConnectingView.h @@ -1,4 +1,4 @@ -/*** +/*** * @Date: 2024-08-19 19:20:08 * @LastEditors: Caisking 3449750381@qq.com * @LastEditTime: 2024-08-30 18:57:30 @@ -8,7 +8,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-03 11:09:56 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-19 16:19:42 + * @LastEditTime: 2024-08-31 15:11:11 * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceConnectingView.h */ @@ -53,7 +53,7 @@ namespace OHOS int16_t width; int16_t height; ImageAnimatorInfo *imageInfoArray; - const char *const *pathsArray; + const ImageInfo **pathsArray; uint8_t numFrames; int delay; }; @@ -63,6 +63,7 @@ namespace OHOS static AiVoiceConnectingView *GetInstance(void); UIScrollView *CreateAiVoiceConnectingView(void); UIScrollView *CreateAiVoiceConnectingView(uint8_t); + private: UIImageAnimatorView *connectingImageAnimatorInit(ImageAnimatorConfig &imageanimatorconfig); UILabelExt *AiVoiceConnectingViewLabelInit(LabelConfig &labelconfig); @@ -79,7 +80,7 @@ namespace OHOS UIButton *cancelButton{nullptr}; UIImageAnimatorView *connectingAnimatorView{nullptr}; ImageAnimatorInfo connectingImageInfo[AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; - const char **connectingPathsArray{nullptr}; + const ImageInfo **connectingPathsArray{nullptr}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h index 87b1d09b1..ddee102c4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:14:43 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-28 17:45:47 + * @LastEditTime: 2024-08-31 16:14:37 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h */ #ifndef AI_VOICE_MODEL_H @@ -38,6 +38,7 @@ namespace OHOS static AiVoiceModel &GetInstance(void); // 获取单例实例 bool ChangeToReturnResultTextView(void); bool ChangeToAIVoiceListeningView(bool value); + bool ChangeToAIVoiceConnectTimeoutView(); void FunctionKeyOnClickToChangeAIModel(void); // 初始化和状态管理 bool CreateIfNotExists(); @@ -51,6 +52,10 @@ namespace OHOS void SetAiVoiceConnectStatus(bool state); void QuerySelectedAiModelIsConnect(); void CancelCurAIChat(void); + int GetAIResponseType(void); + std::string GetErrnote(void); + void SetCurView(int16_t viewNum); + int GetCurView(void); // 聊天内容管理 bool InitchatContentItems(void); @@ -116,6 +121,8 @@ namespace OHOS std::map> selectAiModelToTextId; // pair的参数类型<模型的textid,查询模型是否可用id> bool AiVoiceConnectStatus{false}; //与AI模型的连接状态 uint8_t AIResponseType; + std::string errnote; //错误信息 + int16_t curView{0}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h index 25cf52333..8768583ce 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 14:44:22 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-09 19:52:53 + * @LastEditTime: 2024-08-31 16:13:42 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h */ #ifndef AI_VOICE_PRESENTER_H @@ -45,6 +45,7 @@ namespace OHOS bool JumpToReturnResultTextView(void); bool ChangeToAIVoiceListeningView(bool val); + bool ChangeToAIVoiceConnectTimeoutView(); bool ChangeViewAndLogicOperator(int16_t hideView, int16_t showView); void FunctionKeyOnClickToChangeAIModel(void); void DragLeftToRightChangeAIModel(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceConnectTimeoutView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceConnectTimeoutView.h index 25d25e4ff..187c2a579 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceConnectTimeoutView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceConnectTimeoutView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-22 16:46:26 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-22 17:00:33 + * @LastEditTime: 2024-08-31 16:14:01 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceConnectTimeoutView.h */ @@ -53,7 +53,8 @@ namespace OHOS ~AivoiceConnectTimeoutView(); static AivoiceConnectTimeoutView *GetInstance(void); UIScrollView *CreateAivoiceConnectTimeoutView(void); - + void UpdateTitleTextId(int textId); + void UpdateNoteText(); private: void ClearAll(void); UILabelExt *AivoiceConnectTimeoutLabelInit(LabelConfig &labelconfig); @@ -66,7 +67,7 @@ namespace OHOS UIScrollView *scrollView{nullptr}; UILabelExt *title{nullptr}; UIImageView *attentionImage{nullptr}; - UILabelExt *label[2]{nullptr}; + UILabelExt *NoteLabel{nullptr}; UILabelExt *ensure{nullptr}; UIButton *ensureButton{nullptr}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceListeningView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceListeningView.h index c89704334..3c001b7f6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceListeningView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceListeningView.h @@ -1,4 +1,4 @@ -/*** +/*** * @Date: 2024-06-26 16:59:51 * @LastEditors: Caisking 3449750381@qq.com * @LastEditTime: 2024-08-30 18:57:36 @@ -8,7 +8,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-22 16:46:26 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-25 15:39:07 + * @LastEditTime: 2024-08-31 14:56:06 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceListeningView.h */ @@ -60,8 +60,8 @@ namespace OHOS int16_t y; int16_t width; int16_t height; - ImageAnimatorInfo* imageInfoArray; - const char* const* pathsArray; + ImageAnimatorInfo *imageInfoArray; + const ImageInfo **pathsArray; uint8_t numFrames; int delay; }; @@ -86,7 +86,7 @@ namespace OHOS UIButton *finishSpeakButton{nullptr}; UIImageAnimatorView *AiVoiceListeningImageAnimatorView{nullptr}; ImageAnimatorInfo AiVoiceListeningImageInfo[AIVOICE_LISTENING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; - const char **AiVoiceListeningPathsArray{nullptr}; + const ImageInfo **AiVoiceListeningPathsArray{nullptr}; }; } #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceThinkingView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceThinkingView.h index cad3da12f..685791b33 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceThinkingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceThinkingView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-22 16:46:26 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-31 11:33:33 + * @LastEditTime: 2024-08-31 15:08:52 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceThinkingView.h */ @@ -55,7 +55,7 @@ namespace OHOS int16_t width; int16_t height; ImageAnimatorInfo *imageInfoArray; - const char *const *pathsArray; + const ImageInfo **pathsArray; uint8_t numFrames; int delay; }; @@ -80,7 +80,7 @@ namespace OHOS UIButton *cancelThinkButton{nullptr}; UIImageAnimatorView *AiVoiceThinkingImageAnimatorView{nullptr}; ImageAnimatorInfo AiVoiceThinkingImageInfo[AIVOICE_THINKING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; - const char **AiVoiceThinkingPathsArray{nullptr}; + const ImageInfo **AiVoiceThinkingPathsArray{nullptr}; }; } #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp index 2df64ab0c..7405572fc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-03 11:10:08 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-19 16:41:43 + * @LastEditTime: 2024-08-31 15:11:39 * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceConnectingView.cpp */ #include "aivoice/include/AiVoiceConnectingView.h" @@ -50,7 +50,8 @@ namespace OHOS connectingAnimatorView->Stop(); delete connectingAnimatorView; connectingAnimatorView = nullptr; - FreeImagePathsArray(connectingPathsArray, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(connectingPathsArray, AIVoiceListeningImagePaths, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + } if (cancelLabel) { @@ -118,10 +119,10 @@ namespace OHOS for (uint8_t i = 0; i < imageanimatorconfig.numFrames; i++) { - // imageanimatorconfig.imageInfoArray[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(imageanimatorconfig.pathsArray[i]); - // imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_IMAGE_INFO; - imageanimatorconfig.imageInfoArray[i].imagePath = (imageanimatorconfig.pathsArray[i]); - imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_FILE_PATH; + imageanimatorconfig.imageInfoArray[i].imageInfo = (imageanimatorconfig.pathsArray[i]); + imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_IMAGE_INFO; + // imageanimatorconfig.imageInfoArray[i].imagePath = (imageanimatorconfig.pathsArray[i]); + // imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_FILE_PATH; imageanimatorconfig.imageInfoArray[i].pos.x = imageanimatorconfig.x; imageanimatorconfig.imageInfoArray[i].pos.y = imageanimatorconfig.y; imageanimatorconfig.imageInfoArray[i].width = imageanimatorconfig.width; @@ -209,7 +210,7 @@ namespace OHOS bool AiVoiceConnectingView::CreateAivoiceConnectingImageAnimator(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::CreateAivoiceConnectingImageAnimator"); - connectingPathsArray = CreateImagePathsArray(AIVoiceListeningImagePaths, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + connectingPathsArray = CreateImageInfoArray(AIVoiceListeningImagePaths, AIVOICE_CONNECTING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (connectingPathsArray == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceConnectingView::connectingPathsArray is nullptr!!"); 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 c457ba92c..3e03713cd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:14:50 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-28 17:46:07 + * @LastEditTime: 2024-08-31 16:13:29 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp */ #include "aivoice/include/AiVoiceModel.h" @@ -42,6 +42,7 @@ namespace OHOS return instance; } + // 跳转到返回结果界面 bool AiVoiceModel::ChangeToReturnResultTextView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::ChangeToReturnResultTextView"); @@ -69,6 +70,21 @@ namespace OHOS return true; } + // 切换到AI回应错误界面 + bool AiVoiceModel::ChangeToAIVoiceConnectTimeoutView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::ChangeToAIVoiceConnectTimeoutView"); + AiVoicePresenter *Aipresenter_ = AiVoicePresenter::GetInstance(); + if (Aipresenter_ == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::GetInstance() fail!!"); + return false; + } + Aipresenter_->ChangeToAIVoiceConnectTimeoutView(); + return true; + } + + // 功能键切换模型 void AiVoiceModel::FunctionKeyOnClickToChangeAIModel(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::FunctionKeyOnClickToChangeAIModel"); @@ -166,12 +182,34 @@ namespace OHOS } } - /*取消当前AI对话*/ + /*取消当前AI对话*/ void AiVoiceModel::CancelCurAIChat(void) { cancel_AI_cur_chat(); } + int AiVoiceModel::GetAIResponseType(void) + { + return AIResponseType; + } + + std::string AiVoiceModel::GetErrnote(void) + { + return errnote; + } + + /*设置当前哪个子视图是可见的*/ + void AiVoiceModel::SetCurView(int16_t viewNum) + { + curView = viewNum; + } + + /*获取当前哪个子视图是可见的*/ + int AiVoiceModel::GetCurView(void) + { + return curView; + } + /*列表数量*/ uint8_t AiVoiceModel::GetChatContentListCount(void) { @@ -306,6 +344,9 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::UpdateUserQuestionStr"); RemoveLastTwoItemsOrClear(); + /* -------------------------------------------------------------------------- */ + ScreenTurnOn(5 * 1000); // 有消息来就亮屏5秒 + /* -------------------------------------------------------------------------- */ if (!AddUserQuestionToChatItems()) { @@ -425,7 +466,7 @@ namespace OHOS std::string AiVoiceModel::GetAiAnswerStr(void) { // aiAnswerStr = "春风化雨,时光荏苒。百年之内,生命如白驹过隙,转瞬即逝。唯有心存善念,用爱化解芥蒂,用智慧建构未来,才是人生的真正意义。让我们携手共进,用每一分时光去关爱他人,用每一滴汗水去创造奇迹,用每一个眼神去传递温暖。让这个世界因我们的存在而变得更加美好。生命短暂,但只要我们怀着虔诚的心,坚韧前行,我们就一定能在有限的时光里留下无限的可能。"; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetAiAnswerStr:%s\n", aiAnswerStr.c_str()); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetAiAnswerStr:%s", aiAnswerStr.c_str()); return aiAnswerStr; } @@ -449,8 +490,16 @@ namespace OHOS void AiVoiceModel::SetAiAnswerStrStr(std::string str, uint8_t type) { - aiAnswerStr += str; AIResponseType = type; + errnote = str; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AIResponseType = %d,errnote = %s\n", AIResponseType, errnote.c_str()); + if (AIResponseType == AiVoiceModel::AI_RECORDING_PARSING_ERROR || AIResponseType == AiVoiceModel::AI_RESPONSE_ERROR) + { + SendMsgToUIService(UI_AI_JUMP_TO_RESPONDERR_VIEW, 0, (void *)errnote.c_str(), errnote.length()); + ScreenTurnOn(5 * 1000); // 有消息来就亮屏5秒 + return; + } + aiAnswerStr += str; SendMsgToUIService(UI_UPDATE_AI_ANSWER_STR, 0, nullptr, 0); } @@ -597,7 +646,7 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AIVoice_TimerCallbackProc,AiModelConnectTimeout = %d", AiModelConnectTimeout); AiModelConnectTimeout--; - if (AiModelConnectTimeout < 0) + if (AiModelConnectTimeout < 0) // 模型连接失败有5秒超时 { AiVoiceModel::GetInstance().AIVoice_StopTimer(); AiVoiceView *view_ = AiVoiceView::GetInstance(); @@ -619,6 +668,8 @@ namespace OHOS if (Time == 30) { AiVoiceModel::GetInstance().CheckFileAndSendAIIsReady(); + AiVoiceModel::GetInstance().AIVoice_StopTimer(); + return; } if (Time < 0) // 如果思考时间超时30s,进入连接超时界面 { 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 35c490adf..40ccaab12 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: 2024-08-28 17:46:50 + * @LastEditTime: 2024-08-31 16:13:34 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp */ #include "AppViewIDs.h" @@ -127,6 +127,21 @@ namespace OHOS return true; } + bool AiVoicePresenter::ChangeToAIVoiceConnectTimeoutView() + { + if ((view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID) != nullptr) && + (view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID)->IsVisible())) + { + ChangeViewAndLogicOperator(AiVoiceModel::GetInstance().GetCurView(), AIVOICE_CONNECT_TIMEOUT_VIEWID); + AivoiceConnectTimeoutView *p_AivoiceConnectTimeoutView = AivoiceConnectTimeoutView::GetInstance(); + if (p_AivoiceConnectTimeoutView) + { + p_AivoiceConnectTimeoutView->UpdateNoteText(); + } + } + return true; + } + void AiVoicePresenter::FunctionKeyOnClickToChangeAIModel(void) { int index = model->GetSelectAiModel() + 1; 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 2343c9df6..1af83f7a8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-28 17:47:15 + * @LastEditTime: 2024-08-31 14:32:02 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp */ #include "aivoice/include/AiVoicePresenter.h" @@ -797,6 +797,7 @@ namespace OHOS AiVoiceScrollView[showView]->SetVisible(true); Draw(); DestroyTempView(hideView); + AiVoiceModel::GetInstance().SetCurView(showView); return; } @@ -870,6 +871,10 @@ namespace OHOS { p_AivoiceMobileDataFailedStartView->UpdateTitleTextId(textId); } + if (p_AivoiceConnectTimeoutView) + { + p_AivoiceConnectTimeoutView->UpdateTitleTextId(textId); + } } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceConnectTimeoutView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceConnectTimeoutView.cpp index 3687cca0c..03ff9a1bf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceConnectTimeoutView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceConnectTimeoutView.cpp @@ -2,11 +2,12 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-02 15:44:02 + * @LastEditTime: 2024-08-31 16:13:53 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AivoiceConnectTimeoutView.cpp */ #include "aivoice/include/AiVoicePresenter.h" #include "aivoice/include/AivoiceConnectTimeoutView.h" +#include "aivoice/include/AiVoiceModel.h" #include "wearable_log.h" #include "ui_resource_string.h" #include @@ -40,40 +41,31 @@ namespace OHOS if (scrollView != nullptr) { scrollView->RemoveAll(); - if (title != nullptr) { delete title; title = nullptr; } - if (attentionImage != nullptr) { delete attentionImage; attentionImage = nullptr; } - - for (int i = 0; i < 2; i++) + if (NoteLabel != nullptr) { - if (label[i] != nullptr) - { - delete label[i]; - label[i] = nullptr; - } + delete NoteLabel; + NoteLabel = nullptr; } - if (ensure != nullptr) { delete ensure; ensure = nullptr; } - if (ensureButton != nullptr) { delete ensureButton; ensureButton = nullptr; } - delete scrollView; scrollView = nullptr; } @@ -91,7 +83,6 @@ namespace OHOS label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh); label->SetTextId(labelconfig.textId); label->SetLineBreakMode(labelconfig.lineBreakMode); - label->SetRollSpeed(70); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize); label->SetRollSpeed(LABEL_ROLL_SPEED); @@ -158,7 +149,7 @@ namespace OHOS .height = 35, .fontSize = 30, .lineHeigh = 35, - .textId = STR_AI_INTELLIGENT_ASSISTANT, + .textId = AiVoiceModel::GetInstance().GetAiModelTextId(), .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; title = AivoiceConnectTimeoutLabelInit(labelconfig); @@ -168,20 +159,19 @@ namespace OHOS return false; } /* -------------------------------------------------------------------------- */ - labelconfig.left = 53; - labelconfig.width = 360; - int textId[] = {STR_CONNECT_TIMEOUT, STR_PLEASE_RESTART_CHAT}; - for (int i = 0; i < 2; i++) + NoteLabel = new UILabelExt(); + if (NoteLabel == nullptr) { - labelconfig.top = 222 + i * labelconfig.height; - labelconfig.textId = textId[i]; - label[i] = AivoiceConnectTimeoutLabelInit(labelconfig); - if (label[i] == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AivoiceConnectTimeoutView::label[%d] is nullptr!", i); - return false; - } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "NoteLabel is nullptr!"); + return false; } + NoteLabel->SetPosition(53, 222, 360, 70); + NoteLabel->SetStyle(STYLE_TEXT_FONT, 30); + NoteLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + NoteLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + NoteLabel->SetRollSpeed(70); + NoteLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + NoteLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ labelconfig = { .left = 133, @@ -264,12 +254,32 @@ namespace OHOS } scrollView->Add(title); scrollView->Add(attentionImage); - scrollView->Add(label[0]); - scrollView->Add(label[1]); + scrollView->Add(NoteLabel); scrollView->Add(ensureButton); scrollView->Add(ensure); } return scrollView; } + void AivoiceConnectTimeoutView::UpdateTitleTextId(int textId) + { + if (title) + { + title->SetTextId(textId); + title->ForceResetText(); + } + } + + // 更新错误信息内容 + void AivoiceConnectTimeoutView::UpdateNoteText() + { + if (NoteLabel) + { + NoteLabel->SetText(""); + std::string text = AiVoiceModel::GetInstance().GetErrnote(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "text = %s", text.c_str()); + NoteLabel->SetText(text.c_str()); + NoteLabel->Invalidate(); + } + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceListeningView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceListeningView.cpp index 237a34224..ddfd2fb6b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceListeningView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceListeningView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-02 15:44:32 + * @LastEditTime: 2024-08-31 15:12:44 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AivoiceListeningView.cpp */ #include "aivoice/include/AiVoicePresenter.h" @@ -54,7 +54,7 @@ namespace OHOS delete AiVoiceListeningImageAnimatorView; AiVoiceListeningImageAnimatorView = nullptr; - FreeImagePathsArray(AiVoiceListeningPathsArray, AIVOICE_LISTENING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(AiVoiceListeningPathsArray, AIVoiceListeningImagePaths, AIVOICE_LISTENING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); } if (finishSpeak != nullptr) @@ -119,9 +119,10 @@ namespace OHOS for (uint8_t i = 0; i < imageanimatorconfig.numFrames; i++) { - // imageanimatorconfig.imageInfoArray[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(imageanimatorconfig.pathsArray[i]); - imageanimatorconfig.imageInfoArray[i].imagePath = (imageanimatorconfig.pathsArray[i]); - imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_FILE_PATH; + imageanimatorconfig.imageInfoArray[i].imageInfo = imageanimatorconfig.pathsArray[i]; + // imageanimatorconfig.imageInfoArray[i].imagePath = (imageanimatorconfig.pathsArray[i]); + // imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_FILE_PATH; + imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_IMAGE_INFO; imageanimatorconfig.imageInfoArray[i].pos.x = imageanimatorconfig.x; imageanimatorconfig.imageInfoArray[i].pos.y = imageanimatorconfig.y; imageanimatorconfig.imageInfoArray[i].width = imageanimatorconfig.width; @@ -231,7 +232,7 @@ namespace OHOS bool AivoiceListeningView::CreateAivoiceListeningImageAnimator(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AivoiceListeningView::CreateAivoiceListeningImageAnimator"); - AiVoiceListeningPathsArray = CreateImagePathsArray(AIVoiceListeningImagePaths, AIVOICE_LISTENING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + AiVoiceListeningPathsArray = CreateImageInfoArray(AIVoiceListeningImagePaths, AIVOICE_LISTENING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (AiVoiceListeningPathsArray == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AivoiceListeningView::AiVoiceListeningPathsArray is nullptr!!"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceThinkingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceThinkingView.cpp index 40654518e..e8054a6d9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceThinkingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceThinkingView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-02 15:44:41 + * @LastEditTime: 2024-08-31 15:09:13 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AivoiceThinkingView.cpp */ #include "aivoice/include/AiVoicePresenter.h" @@ -54,7 +54,8 @@ namespace OHOS delete AiVoiceThinkingImageAnimatorView; AiVoiceThinkingImageAnimatorView = nullptr; - FreeImagePathsArray(AiVoiceThinkingPathsArray, AIVOICE_THINKING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(AiVoiceThinkingPathsArray, AIVOICE_THINKING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(AiVoiceThinkingPathsArray, AIVoiceThinkingImagePaths, AIVOICE_THINKING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); } if (cancelThink != nullptr) @@ -119,9 +120,10 @@ namespace OHOS for (uint8_t i = 0; i < imageanimatorconfig.numFrames; i++) { - // imageanimatorconfig.imageInfoArray[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(imageanimatorconfig.pathsArray[i]); - imageanimatorconfig.imageInfoArray[i].imagePath = (imageanimatorconfig.pathsArray[i]); - imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_FILE_PATH; + imageanimatorconfig.imageInfoArray[i].imageInfo = (imageanimatorconfig.pathsArray[i]); + // imageanimatorconfig.imageInfoArray[i].imagePath = (imageanimatorconfig.pathsArray[i]); + // imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_FILE_PATH; + imageanimatorconfig.imageInfoArray[i].imageType = IMG_SRC_IMAGE_INFO; imageanimatorconfig.imageInfoArray[i].pos.x = imageanimatorconfig.x; imageanimatorconfig.imageInfoArray[i].pos.y = imageanimatorconfig.y; imageanimatorconfig.imageInfoArray[i].width = imageanimatorconfig.width; @@ -232,7 +234,7 @@ namespace OHOS bool AivoiceThinkingView::CreateAivoiceThinkingImageAnimator(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AivoiceThinkingView::CreateAivoiceThinkingImageAnimator"); - AiVoiceThinkingPathsArray = CreateImagePathsArray(AIVoiceThinkingImagePaths, AIVOICE_THINKING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + AiVoiceThinkingPathsArray = CreateImageInfoArray(AIVoiceThinkingImagePaths, AIVOICE_THINKING_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (AiVoiceThinkingPathsArray == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AivoiceThinkingView::AiVoiceThinkingPathsArray is nullptr!!"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h b/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h index e6cb3916c..940f76b64 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h @@ -1,3 +1,11 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-31 09:52:34 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-31 16:38:04 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #ifndef FIND_PHONE_VIEW_H #define FIND_PHONE_VIEW_H @@ -41,7 +49,7 @@ namespace OHOS UIImageAnimatorView *FindPhoneImageAnimator = nullptr; UILabelButtonExt *FindPhoneLabelButton = nullptr; UIImageView *FindPhoneImageView{nullptr}; - const char **FindPhonePathsArray{nullptr}; + const ImageInfo **FindPhonePathsArray{nullptr}; ImageAnimatorInfo FindPhoneImageInfo[FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; bool viewInitStatus{false}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp index 33c5fce71..941ba0dd4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-27 10:47:40 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-07 18:21:37 + * @LastEditTime: 2024-08-31 16:43:28 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp */ #include "AppViewIDs.h" @@ -88,7 +88,7 @@ namespace OHOS } return true; } - + bool FindPhonePresenter::OnDragEnd(UIView &view, const DragEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDragEnd"); @@ -96,6 +96,11 @@ namespace OHOS if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && FindPhonePresenter::X_DRAG_FLAG) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + // 发送指令停止震动 + if (FindPhoneModel::GetInstance().GetBlueToothConnectedState()) + { + senfindphoneSend(FINDPHONE_STOP); + } FindPhonePresenter::X_DRAG_FLAG = false; } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp index f01084c02..cde95682b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp @@ -8,7 +8,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-27 10:47:46 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-19 15:36:22 + * @LastEditTime: 2024-08-31 16:40:57 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp */ #include "findphone/include/FindPhoneView.h" @@ -24,6 +24,7 @@ namespace OHOS { static FindPhoneView *g_pFindPhoneView{nullptr}; + static constexpr const char *FIND_PONE_IMAGE_SRC = "/user/res/findphone/"; FindPhoneView::FindPhoneView() { @@ -68,7 +69,8 @@ namespace OHOS FindPhoneImageAnimator->Stop(); delete FindPhoneImageAnimator; FindPhoneImageAnimator = nullptr; - FreeImagePathsArray(FindPhonePathsArray, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(FindPhonePathsArray, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(FindPhonePathsArray, FIND_PONE_IMAGE_SRC, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); } if (FindPhoneLabel != nullptr) @@ -201,7 +203,7 @@ namespace OHOS FindPhoneTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); FindPhoneTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* ----------------------- FindPhoneImageAnimator ---------------------- */ - FindPhonePathsArray = CreateImagePathsArray("/user/res/findphone/",FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FindPhonePathsArray = CreateImageInfoArray(FIND_PONE_IMAGE_SRC, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (FindPhoneImageAnimator == nullptr) { FindPhoneImageAnimator = new UIImageAnimatorView(); @@ -212,8 +214,10 @@ namespace OHOS } for (uint8_t i = 0; i < FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - FindPhoneImageInfo[i].imagePath = (FindPhonePathsArray[i]); - FindPhoneImageInfo[i].imageType = IMG_SRC_FILE_PATH; + // FindPhoneImageInfo[i].imagePath = (FindPhonePathsArray[i]); + // FindPhoneImageInfo[i].imageType = IMG_SRC_FILE_PATH; + FindPhoneImageInfo[i].imageInfo = (FindPhonePathsArray[i]); + FindPhoneImageInfo[i].imageType = IMG_SRC_IMAGE_INFO; FindPhoneImageInfo[i].pos.x = FINDPHONE_IMAGE_ANIMATOR_VIEW_X; FindPhoneImageInfo[i].pos.y = FINDPHONE_IMAGE_ANIMATOR_VIEW_Y; FindPhoneImageInfo[i].width = FINDPHONE_IMAGE_ANIMATOR_VIEW_W; diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp index ec122c9b1..6f51b8737 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-21 11:54:00 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-28 20:38:05 + * @LastEditTime: 2024-08-31 11:05:12 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp */ #include "main/include/dropdown/DropDownCardPage1.h" @@ -97,9 +97,14 @@ namespace OHOS } else { +#if defined(A5133_DEMO_CLIENT) || defined(A5133_DEMO_SERVER) + uapi_set4GCapability(true); +#else + uapi_set4GCapability(false); +#endif state = toggleButton[DropDownCardPage1::toggleButton_4G]->GetState(); - Updat4GState(state); - ConfigModel::GetInstance()->SetCat1_4Gability(state); + Updat4GState(uapi_cat1_get_power_stat()); + ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat()); } } else if (viewId == DROPDOWN_ALIPAY_TOGGLEBUTTON_VIEWID) // 支付宝 diff --git a/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h b/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h index cfeef57bc..99efadec4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h +++ b/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h @@ -8,7 +8,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-12 11:44:04 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-29 18:44:06 + * @LastEditTime: 2024-08-31 14:20:21 * @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/uiservice/include/ui_service.h */ /* @@ -81,6 +81,7 @@ typedef enum { UI_AI_JUMP_TO_RESULT_VIEW, //跳转到返回结果视图 UI_AI_JUMP_TO_LISTENING_VIEW,//跳转到AI聆听界面 + UI_AI_JUMP_TO_RESPONDERR_VIEW,//处理跳转AI回应错误界面 UI_UPDATE_USER_QUESTION_STR,//更新用户问题的字符串 UI_UPDATE_AI_ANSWER_STR, //更新AI答案的字符串 UI_HAND_WATCH_FIRST_PAIRED, //手表已配对:给第一次手表启动用配对成功调用 diff --git a/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp b/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp index 25ddee6a4..6a9d493fb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp @@ -116,6 +116,7 @@ extern "C" static void HandleUpdateMusicPlayerList(Request *request); static void HandleAiJumpToResultView(Request *request); static void HandleAiJumpToListeningMessage(Request *request); + static void HandleAiJumpToRespondErrMessage(Request *request); static void HandleUpdateUserQuestionStr(Request *request); static void HandleUpdateAIAnswerStr(Request *request); static void HandleWatchFirstPaired(Request *request); @@ -155,6 +156,7 @@ extern "C" {UI_HAND_WATCH_FIRST_PAIRED, HandleWatchFirstPaired}, {UI_UPDATE_OBU_MESSAGE, HandleUpdateOBUMessage}, {UI_AI_JUMP_TO_LISTENING_VIEW, HandleAiJumpToListeningMessage}, + {UI_AI_JUMP_TO_RESPONDERR_VIEW, HandleAiJumpToRespondErrMessage}, {UI_UPDATE_RECORDPROCESS, HandleUpdateRecordProcess}, {UI_UPDATE_PLAYERPROCESS, HandleUpdatePlayerProcess}, @@ -613,6 +615,14 @@ extern "C" std::bind(&OHOS::AiVoiceModel::ChangeToAIVoiceListeningView, &OHOS::AiVoiceModel::GetInstance(), state)); } + // 处理更新查询AI模型是否连接成功的状态 + void HandleAiJumpToRespondErrMessage(Request *request) + { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_UI_SERVICE, "HandleAiJumpToRespondErrMessage"); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::AiVoiceModel::ChangeToAIVoiceConnectTimeoutView, &OHOS::AiVoiceModel::GetInstance())); + } + //处理更新录音进度条 void HandleUpdateRecordProcess(Request *request) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h index a88438626..f4b922ca6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherReportView.h @@ -75,9 +75,9 @@ namespace OHOS UIImageAnimatorView *WindSpeedImageAnimatorView{nullptr}; // 风速动画 UIImageAnimatorView *HumidityImageAnimatorView{nullptr}; // 湿度动画 - const char **UVPathsArray{nullptr}; - const char **WindSpeedPathsArray{nullptr}; - const char **HumidityPathsArray{nullptr}; + const ImageInfo **UVPathsArray{nullptr}; + const ImageInfo **WindSpeedPathsArray{nullptr}; + const ImageInfo **HumidityPathsArray{nullptr}; bool viewInitStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp index 2aa956335..9405ffc28 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherReportView.cpp @@ -99,11 +99,15 @@ namespace OHOS delete HumidityImageAnimatorView; HumidityImageAnimatorView = nullptr; - FreeImagePathsArray(UVPathsArray, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(UVPathsArray, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - FreeImagePathsArray(WindSpeedPathsArray, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(WindSpeedPathsArray, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); - FreeImagePathsArray(HumidityPathsArray, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(HumidityPathsArray, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + + FreeImageInfoArray(UVPathsArray, UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(UVPathsArray, WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(HumidityPathsArray, HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); } } @@ -256,7 +260,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherReportView::WeatherReportViewImageAnimatorViewInit"); /* ----------------------------- UVImageAnimatorView---------------------------- */ - UVPathsArray = CreateImagePathsArray(UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + UVPathsArray = CreateImageInfoArray(UVPaths, UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (UVImageAnimatorView == nullptr) { UVImageAnimatorView = new UIImageAnimatorView(); @@ -267,8 +271,10 @@ namespace OHOS } for (uint8_t i = 0; i < UV_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - UVimageAnimatorInfo[i].imagePath = UVPathsArray[i]; - UVimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + // UVimageAnimatorInfo[i].imagePath = UVPathsArray[i]; + // UVimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + UVimageAnimatorInfo[i].imageInfo = UVPathsArray[i]; + UVimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; UVimageAnimatorInfo[i].pos.x = UV_IMAGE_ANIMATOR_VIEW_X; UVimageAnimatorInfo[i].pos.y = UV_IMAGE_ANIMATOR_VIEW_Y; UVimageAnimatorInfo[i].width = UV_IMAGE_ANIMATOR_VIEW_W; @@ -282,7 +288,7 @@ namespace OHOS UVImageAnimatorView->Start(); } /* ----------------------- WindSpeedImageAnimatorView ----------------------- */ - WindSpeedPathsArray = CreateImagePathsArray(WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + WindSpeedPathsArray = CreateImageInfoArray(WindSpeedPaths, WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (WindSpeedImageAnimatorView == nullptr) { WindSpeedImageAnimatorView = new UIImageAnimatorView(); @@ -293,8 +299,10 @@ namespace OHOS } for (uint8_t i = 0; i < WINDSPEED_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - WindSpeedimageAnimatorInfo[i].imagePath = WindSpeedPathsArray[i]; - WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + // WindSpeedimageAnimatorInfo[i].imagePath = WindSpeedPathsArray[i]; + // WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + WindSpeedimageAnimatorInfo[i].imageInfo = WindSpeedPathsArray[i]; + WindSpeedimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; WindSpeedimageAnimatorInfo[i].pos.x = WINDSPEED_IMAGE_ANIMATOR_VIEW_X; WindSpeedimageAnimatorInfo[i].pos.y = UV_IMAGE_ANIMATOR_VIEW_Y; WindSpeedimageAnimatorInfo[i].width = UV_IMAGE_ANIMATOR_VIEW_W; @@ -308,7 +316,7 @@ namespace OHOS WindSpeedImageAnimatorView->Start(); } /* ------------------------ HumidityImageAnimatorView ----------------------- */ - HumidityPathsArray = CreateImagePathsArray(HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + HumidityPathsArray = CreateImageInfoArray(HumidityPaths, HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (HumidityImageAnimatorView == nullptr) { HumidityImageAnimatorView = new UIImageAnimatorView(); @@ -319,8 +327,10 @@ namespace OHOS } for (uint8_t i = 0; i < HUMIDITY_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - HumidityimageAnimatorInfo[i].imagePath = HumidityPathsArray[i]; - HumidityimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + // HumidityimageAnimatorInfo[i].imagePath = HumidityPathsArray[i]; + // HumidityimageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH; + HumidityimageAnimatorInfo[i].imageInfo = HumidityPathsArray[i]; + HumidityimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; HumidityimageAnimatorInfo[i].pos.x = HUMIDITY_IMAGE_ANIMATOR_VIEW_X; HumidityimageAnimatorInfo[i].pos.y = UV_IMAGE_ANIMATOR_VIEW_Y; HumidityimageAnimatorInfo[i].width = UV_IMAGE_ANIMATOR_VIEW_W; diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp index dc90b53cc..ff9564d58 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 10:04:36 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-08-02 19:27:15 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-31 16:49:39 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp */ #include "notification_manager.h" @@ -49,7 +49,7 @@ namespace OHOS static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_H = 80; static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_TIMEOFUPDATE = 100; static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 25; // 解绑动画帧数 - const char **UnBindPathsArray{nullptr}; + const ImageInfo **UnBindPathsArray{nullptr}; ImageAnimatorInfo UnBindImageInfo[UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; UIViewGroup *DeviceUnbindingRequestGroupView{nullptr}; @@ -310,7 +310,7 @@ namespace OHOS DeviceUnBindingView->SetDraggable(true); DeviceUnBindingView->SetTouchable(true); /* ----------------------- DeviceUnBindingAnimatorView ---------------------- */ - UnBindPathsArray = CreateImagePathsArray("/user/res/remind/unbind/", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + UnBindPathsArray = CreateImageInfoArray("/user/res/remind/unbind/", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (DeviceUnBindingAnimatorView == nullptr) { DeviceUnBindingAnimatorView = new UIImageAnimatorView(); @@ -321,8 +321,8 @@ namespace OHOS } for (uint8_t i = 0; i < UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - UnBindImageInfo[i].imagePath = (UnBindPathsArray[i]); - UnBindImageInfo[i].imageType = IMG_SRC_FILE_PATH; + UnBindImageInfo[i].imageInfo = (UnBindPathsArray[i]); + UnBindImageInfo[i].imageType = IMG_SRC_IMAGE_INFO; UnBindImageInfo[i].pos.x = UNBIND_IMAGE_ANIMATOR_VIEW_X; UnBindImageInfo[i].pos.y = UNBIND_IMAGE_ANIMATOR_VIEW_Y; UnBindImageInfo[i].width = UNBIND_IMAGE_ANIMATOR_VIEW_W; @@ -598,7 +598,7 @@ namespace OHOS delete DeviceUnBindingViewTitleLabel; DeviceUnBindingViewTitleLabel = nullptr; - FreeImagePathsArray(UnBindPathsArray, UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(UnBindPathsArray, "/user/res/remind/unbind/", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); DeviceUnBindingAnimatorView->Stop(); delete DeviceUnBindingAnimatorView; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp index 0aec8fa8e..133454f75 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp @@ -28,6 +28,7 @@ #include "custom_utils.h" #include "components/ui_image_animator.h" #include "wearable_log.h" +#include "uicomponents/UIComponents.h" #ifdef __cplusplus extern "C" { @@ -67,7 +68,7 @@ static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_X = 0; static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_Y = 0; static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_W = 466; static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_H = 466; -const char **ReBootPathsArray{nullptr}; // 开机图片路径数组 +const OHOS::ImageInfo **ReBootPathsArray{nullptr}; // 开机图片路径数组 static OHOS::UIImageAnimatorView::AnimatorStopListener *bootStoplistener{nullptr}; static bool boot_animation_flag = false; static app_task_definition_t taskcfg={0}; @@ -115,7 +116,8 @@ static void ClearAll(void) bootStoplistener = nullptr; } - FreeImagePathsArray(ReBootPathsArray, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(ReBootPathsArray, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + OHOS::FreeImageInfoArray(ReBootPathsArray, ReBootPaths, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); delete group; group = nullptr; @@ -163,7 +165,7 @@ static const char ** CreateImagePathsArray(const char *basePath, const char *fil bool ShowReBootAnimatorView() { - ReBootPathsArray = CreateImagePathsArray(ReBootPaths, "bin", REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + ReBootPathsArray = OHOS::CreateImageInfoArray(ReBootPaths, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (ReBootImageAnimatorView == nullptr) { @@ -175,8 +177,8 @@ bool ShowReBootAnimatorView() } for (uint8_t i = 0; i < REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - ReBootImageInfo[i].imagePath = (ReBootPathsArray[i]); - ReBootImageInfo[i].imageType = OHOS::IMG_SRC_FILE_PATH; + ReBootImageInfo[i].imageInfo = (ReBootPathsArray[i]); + ReBootImageInfo[i].imageType = OHOS::IMG_SRC_IMAGE_INFO; ReBootImageInfo[i].pos.x = REBOOT_IMAGE_ANIMATOR_VIEW_X; ReBootImageInfo[i].pos.y = REBOOT_IMAGE_ANIMATOR_VIEW_Y; ReBootImageInfo[i].width = REBOOT_IMAGE_ANIMATOR_VIEW_W;