From 142317e7930c9efdedafe6adedac2b4265c4da10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Thu, 24 Oct 2024 12:41:28 +0000 Subject: [PATCH] Merge #1256 into sdk602patch0911 from refs/changes/1256/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1256/head: (28 commits squashed) - 来电界面,禁止双击进入AI - 录音列表视图修改为右滑退出到录音主视图 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 1.一个分区模式下修改音乐和录音文件夹 2.录音添加空间判断管理 3.录音添加”空间已满弹窗“:在总时长大于20分钟或总数大于等于99,录音总空间大于等于10M,弹出 4.判断录音空间大小是否超出采用指令队列读职 5.修改底层录音文件audio_capture_wrapper.cpp大小参数使之录取一个录音最长时间在20分钟左右 - 修改音乐播放器函数名英文错误拼写 - 如果手表在播放本地音乐,AI界面点击开始对话会暂停本地音乐播放,避免混音 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 优化查找手表的播放音频逻辑 - 修复录音播放完后等待一段时间再去点击录音播放,需要点击两次bug - 修复音乐播放器在切换到手机音乐无法调节音量bug - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - AI语音界面修改,提示将英文改为中文提醒 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 实现AI答案恢复,列表同步滚动 - 将power键;亮屏改为release触发 - #477,系统更新界面提示,改成灰色透明弹窗提示,这个不显眼(需求) - 修改applist退出和进入统一动画,只有蜂窝才有 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - #1066,解决,手表端连续创建三个闹钟,再接着删除第二个闹钟,同步IOS APP成功,APP闹钟界面第三个闹钟显示为00:00(必现) bug #1065,解决APP创建5个闹钟后再删除一个,同步手表成功,手表端无法再新增闹钟(必现) - #1026,解决,天气显示不同,无法同步bug - 应用的按键监听改为释放退出 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 根据客户要求修改:press亮屏,press退出应用,取消在applsit界面双击切换applist样式 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - #1060,解决,手表,AI全家桶偶尔点击1次继续对话,会有不灵敏的情况,需要点击第2次才能继续bug 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/1256 --- .../brandy/brandy_standard/input_app.c | 13 +---- .../aivoice/include/AiVoicePresenter.h | 3 +- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 53 +++++++++++++---- .../src/RebootAndShutdownModel.cpp | 5 +- .../src/RebootAndShutdownPresenter.cpp | 6 +- .../nativeui/weather/src/WeatherModel.cpp | 57 ++++++++++--------- 6 files changed, 85 insertions(+), 52 deletions(-) diff --git a/code/sdk/application/brandy/brandy_standard/input_app.c b/code/sdk/application/brandy/brandy_standard/input_app.c index 6e582f9a3..9e6ebc070 100755 --- a/code/sdk/application/brandy/brandy_standard/input_app.c +++ b/code/sdk/application/brandy/brandy_standard/input_app.c @@ -200,16 +200,6 @@ void button_report_event(button_id_t id, event_button_t event) switch (event) { case BUTTON_PWR_PRESS: - // #ifdef SUPPORT_POWER_MANAGER - // if (!lcd_get_status()) { - // button_report_event_to_pms(); - // return; - // } - // button_report_event_to_pms(); - // #endif - button_report_event_to_gui(id, 1); // 1:press - break; - case BUTTON_PWR_CLICKUP: #ifdef SUPPORT_POWER_MANAGER if (!lcd_get_status()) { button_report_event_to_pms(); @@ -217,6 +207,9 @@ void button_report_event(button_id_t id, event_button_t event) } button_report_event_to_pms(); #endif + button_report_event_to_gui(id, 1); // 1:press + break; + case BUTTON_PWR_CLICKUP: button_report_event_to_gui(id, 0); // 0:release break; case BUTTON_PWR_LONGPRESS_3S: 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 60257671e..106c4ec99 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-10-23 11:22:25 + * @LastEditTime: 2024-10-24 17:42:07 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h */ #ifndef AI_VOICE_PRESENTER_H @@ -57,6 +57,7 @@ namespace OHOS private: bool OnClick(UIView &view, const ClickEvent &event) override; + bool OnPress(UIView& view, const PressEvent& event) override; bool OnRelease(UIView &view, const ReleaseEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; bool OnDragEnd(UIView &view, const DragEvent &event) override; 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 998281a51..4f7a05809 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-10-23 15:07:12 + * @LastEditTime: 2024-10-24 18:35:43 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp */ #include "AppViewIDs.h" @@ -283,6 +283,39 @@ namespace OHOS return true; } + bool AiVoicePresenter::OnPress(UIView& view, const PressEvent& event) + { + UNUSED(event); + std::string viewId = view.GetViewId(); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRelease %s", viewId.c_str()); + /* ----------------------------- 重置60s取消常亮屏timer ---------------------------- */ + model->reset_ai_screen60s_timer_time(); + /* -------------------------------------------------------------------------- */ + std::unordered_map> viewIdMap = { + {AIVOICERETURNRESULTTEXT_RETURN_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_STARTCHAT_VIEWID}}, // 返回一级界面,并清除手表聊天记录 + {AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_LISTENING_VIEWID}}, // 返回继续聆听,并清除手表聊天记录 + }; + auto it = viewIdMap.find(viewId); + if (it != viewIdMap.end()) + { + if (it->first == AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID) // 点击继续对话按钮要发取消当前对话指令,避免AI回应中途按继续对话按钮没有取消上一次对话问题 + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CancelCurAIChat"); + AiVoiceModel::GetInstance().CancelCurAIChat(); + PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐 + PlayersModel::GetInstance()->PlayerPause(); // 暂停手机音乐 + } + ChangeViewAndLogicOperator(it->second.first, it->second.second); + return true; + } + else + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Return false if viewId doesn't match any entry in the map"); + return false; + } + return true; + } + bool AiVoicePresenter::OnRelease(UIView &view, const ReleaseEvent &event) { UNUSED(event); @@ -353,19 +386,19 @@ namespace OHOS {AIVOICECONNECTTIMEOUT_ENSURE_BUTTON_VIEW_ID, {AIVOICE_CONNECT_TIMEOUT_VIEWID, AIVOICE_STARTCHAT_VIEWID}}, // 返回一级界面 {CANCEL_THINKING_BUTTON_VIEW_ID, {AIVOICE_THINKING_VIEWID, AIVOICE_STARTCHAT_VIEWID}}, // 返回一级界面 {AIVOICECONNECTINGVIEW_CANCEL_BUTTON_VIEW_ID, {AIVOICE_AIMODE_CONNECTING, AIVOICE_STARTCHAT_VIEWID}}, // 返回一级界面 - {AIVOICERETURNRESULTTEXT_RETURN_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_STARTCHAT_VIEWID}}, // 返回一级界面,并清除手表聊天记录 - {AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_LISTENING_VIEWID}}, // 返回继续聆听,并清除手表聊天记录 + // {AIVOICERETURNRESULTTEXT_RETURN_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_STARTCHAT_VIEWID}}, // 返回一级界面,并清除手表聊天记录 + // {AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_LISTENING_VIEWID}}, // 返回继续聆听,并清除手表聊天记录 }; auto it = viewIdMap.find(viewId); if (it != viewIdMap.end()) { - if (it->first == AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID) // 点击继续对话按钮要发取消当前对话指令,避免AI回应中途按继续对话按钮没有取消上一次对话问题 - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CancelCurAIChat"); - AiVoiceModel::GetInstance().CancelCurAIChat(); - PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐 - PlayersModel::GetInstance()->PlayerPause(); // 暂停手机音乐 - } + // if (it->first == AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID) // 点击继续对话按钮要发取消当前对话指令,避免AI回应中途按继续对话按钮没有取消上一次对话问题 + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CancelCurAIChat"); + // AiVoiceModel::GetInstance().CancelCurAIChat(); + // PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐 + // PlayersModel::GetInstance()->PlayerPause(); // 暂停手机音乐 + // } ChangeViewAndLogicOperator(it->second.first, it->second.second); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 04b422da8..545c7ae07 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:55:27 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-21 10:23:23 + * @LastEditTime: 2024-10-24 20:17:13 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp */ @@ -52,6 +52,7 @@ namespace OHOS { if (ConfigModel::GetInstance()->GetisFirstTimeStart() == true) { + uapi_set_screen_on_api(); ConfigModel::GetInstance()->SetisFirstTimeStart(false); NativeAbility::GetInstance().SetDefaultSliceId(VIEW_MAIN); @@ -559,7 +560,7 @@ namespace OHOS /*注册所有按键事件*/ void RebootAndShutdownModel::RegisterAllKeyEvents(void) { - RegisterPowerKeyDoubleClickEvent(); + // RegisterPowerKeyDoubleClickEvent(); RegisterPowerKeyLongPressEvent(); RegisterFuncKeyPressEvent(); RegisterFuncKeyLongPressEvent(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp index 362a82631..3b057c6b7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:11:17 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-29 18:14:14 + * @LastEditTime: 2024-10-24 20:17:39 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/RebootAndShutdownPresenter.cpp */ #include "AppViewIDs.h" @@ -135,7 +135,7 @@ namespace OHOS { if (strcmp(view.GetViewId(), REBOOT_AND_SHUTDOWN_GROUPVIEW) == 0) { - NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + NativeAbility::GetInstance().Back(); } else if (strcmp(view.GetViewId(), FACTORY_RESET_GROUPVIEW) == 0) { @@ -219,7 +219,7 @@ namespace OHOS { if (!isShutDownImageAnimatorStart) { - NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + NativeAbility::GetInstance().Back(); } } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp index b03817003..ac06afb6f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-08 18:40:09 - * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-09-28 17:27:46 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-10-24 15:32:28 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp */ #include "weather/include/WeatherModel.h" @@ -172,14 +172,16 @@ namespace OHOS { // int index = Weather_data_t_now.iconNight;//夜晚天气图标 int index; - if (IsNightTime()) - { - index = Weather_data_t_now.iconNight; // 夜晚天气图标 - } - else - { - index = Weather_data_seven_data[0].iconDay; // 白天天气图标 - } + // if (IsNightTime()) + // { + // index = Weather_data_t_now.iconNight; // 夜晚天气图标 + // } + // else + // { + // index = Weather_data_seven_data[0].iconDay; // 白天天气图标 + // } + index = Weather_data_seven_data[0].iconDay; // 白天天气图标 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Weather_data_t_now.iconNight = %d", index); return weather65x65[index]; } @@ -194,14 +196,16 @@ namespace OHOS std::string WeatherModel::GetWeatherDescription() { std::string WeatherDescription; - if (IsNightTime()) - { - WeatherDescription = Weather_data_t_now.textNight; - } - else - { - WeatherDescription = Weather_data_seven_data[0].textDay; - } + // if (IsNightTime()) + // { + // WeatherDescription = Weather_data_t_now.textNight; + // } + // else + // { + // WeatherDescription = Weather_data_seven_data[0].textDay; + // } + WeatherDescription = Weather_data_seven_data[0].textDay; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WeatherDescription:%s", WeatherDescription.c_str()); return WeatherDescription; } @@ -346,14 +350,15 @@ namespace OHOS if (DialModelWeather::GetInstance()) { int index; - if(IsNightTime()) - { - index = Weather_data_t_now.iconNight; // 夜晚天气图标 - } - else - { - index = Weather_data_seven_data[0].iconDay; //白天天气图标 - } + // if(IsNightTime()) + // { + // index = Weather_data_t_now.iconNight; // 夜晚天气图标 + // } + // else + // { + // index = Weather_data_seven_data[0].iconDay; //白天天气图标 + // } + index = Weather_data_seven_data[0].iconDay; //白天天气图标 DialModelWeather::GetInstance()->UpdateWeather(index); // 更新主界面天气图标 // const std::string str = GetWeatherTemperature() + " "+GetWeatherDescription(); const std::string str = GetWeatherTemperature(); -- 2.17.1