From 7ced070a40bdd28b1cb862ec1c7cacddb29ddcfd Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Fri, 13 Sep 2024 07:30:45 +0000 Subject: [PATCH] Merge #962 into sdk602patch0626 from refs/changes/962/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/962/head: (18 commits squashed) - 闹钟UI优化: 1.#636,解决,手表,闹钟只响铃3次bug 2.闹钟编辑界面优化 3.闹钟界面中星期缩写中文为:一,二...日,其他语言为:Mon,Tue...Sun - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - #534,解决闹钟设置多个闹钟,只响第一个,后续的没有提示闹钟bug - 解决#534,解决闹钟设置多个闹钟,只响第一个,后续的没有提示闹钟bug 修改闹钟弹窗无操作50s后自动关闭 - #642,解决:删除多余闹钟后,界面不能显示剩余闹钟bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - #370,解决:下拉状态栏中,开启4G开关,停留在下拉菜单中,信号格状态不刷新(息屏时不会刷新)bug #618,解决:4G开关开启,重启手表,4G开关状态颜色响应比较慢bug - #639,解决:设置-图标不圆,有缺失,勿扰模式,更换卡片,省电模式bug - #154,解决:手表端超时不操作后,绑定请求会继续留在手表界面bug - 6.天气界面UI修改,与figma上设计保持一致 - 优化弧形列表,调整应用之间间隔,调整文字对齐为左对齐 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - #663,解决:手表,APP开启消息提醒后,手表喝水提醒不弹窗bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - #644,解决,计时器显示问题bug #645,解决, 计时器显示错误bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - #661,解决,手表,天气天气图标显示多云,文字显示中雨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/962 --- .../nativeui/countdown/src/CountDownModel.cpp | 4 +- .../countdown/src/MainCountDownPresenter.cpp | 22 +++++--- .../countdown/src/MainCountDownView.cpp | 3 +- .../countdown/src/StartCountDownView.cpp | 1 + .../nativeui/weather/include/WeatherModel.h | 4 +- .../nativeui/weather/src/WeatherModel.cpp | 56 ++++++++++++++++--- .../msg_center/src/msg_center_customer.cpp | 4 +- .../src/notify/drinkReminder_notification.cpp | 12 +++- 8 files changed, 82 insertions(+), 24 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp index c1f5b4c02..55a1cc71c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-07 18:15:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-07 17:12:44 + * @LastEditTime: 2024-09-13 09:41:37 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp */ #include "countdown/include/CountDownModel.h" @@ -231,7 +231,7 @@ namespace OHOS */ int CountDownModel::StopRingtonePlaybackAndReleaseResources(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownModel::StopRingtonePlaybackAndReleaseResources"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CountDownModel::StopRingtonePlaybackAndReleaseResources"); int32_t ret = 0; int32_t state = 0; AudioManager &amIntance = AudioManager::GetInstance(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp index 9574f6863..319005d54 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp @@ -167,22 +167,25 @@ namespace OHOS CountDownModel::GetInstance()->SetRingTime(timePicker->GetSelectValue()); // 设置响铃时间 } - if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0) + if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0) // 如果自定义时间设置为0 { p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, COUNTDOWN_TIMENOTNULL); return true; } else { - if (p_MainCountDownView->GetStartCountDownView() != nullptr) + p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, START_COUNTDOWN); + if (p_StartCountDownView != nullptr) { - p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str()); - p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(CountDownModel::GetInstance()->GetRingTime().c_str()); - p_MainCountDownView->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(true); - p_MainCountDownView->GetStartCountDownView()->GetRepeatButton()->SetVisible(false); + std::string CountDownTime = CountDownModel::GetInstance()->GetCountDownTime(); + std::string RingTime = CountDownModel::GetInstance()->GetRingTime(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTime = %s RingTime = %s", CountDownTime.c_str(),RingTime.c_str()); + p_StartCountDownView->GetShowCountDownTimelabel()->SetText(CountDownTime.c_str()); + p_StartCountDownView->GetShowTheRingTimelabel()->SetText(RingTime.c_str()); + p_StartCountDownView->GetPlayOrPauseToggleButton()->SetVisible(true); + p_StartCountDownView->GetRepeatButton()->SetVisible(false); } - p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, START_COUNTDOWN); return true; } } @@ -202,9 +205,10 @@ namespace OHOS CountDownModel::GetInstance()->SetCountDownTime("00:00:00"); CountDownModel::GetInstance()->SetRingTime("00:00:00"); CountDownModel::GetInstance()->StopRingtonePlaybackAndReleaseResources(); - MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetTouchable(true); - MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetState(false); + p_StartCountDownView->GetPlayOrPauseToggleButton()->SetTouchable(true); + p_StartCountDownView->GetPlayOrPauseToggleButton()->SetState(false); p_MainCountDownView->ChangeView(START_COUNTDOWN, MAIN_COUNTDOWN); + p_StartCountDownView->ShowEndView(false); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp index fbfe36222..749f3fcc9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp @@ -244,11 +244,12 @@ namespace OHOS button->SetLabelPosition(0, 61); button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); button->SetStyle(STYLE_LINE_HEIGHT, 35); - button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED); + button->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); button->SetStyleForState(STYLE_BORDER_RADIUS, 50, UIButton::PRESSED); return button; } + //获取开始倒计时视图 StartCountDownView *MainCountDownView::GetStartCountDownView(void) { return p_StartCountDownView; diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp index 00d3bb359..8b7fbc60f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp @@ -270,6 +270,7 @@ namespace OHOS vectorbigImage->SetVisible(state); showTheEndRingTime->SetVisible(state); + showTheEndRingTime->SetText(showTheRingTime->GetText()); } void StartCountDownView::UpdateimageAndLabelPosition(void) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h index 2d9205247..daad9d70d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-08 18:40:20 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-23 14:41:27 + * @LastEditTime: 2024-09-13 10:25:12 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h */ #ifndef WEATHER_MODEL_H @@ -111,6 +111,8 @@ namespace OHOS /* -------------------------------------------------------------------------- */ void UpdateMainWeatherData(void); void UpdateWeatherCurTime(void); + /* -------------------------------------------------------------------------- */ + bool IsNightTime(); private: WeatherModel(); WeatherModel(const WeatherModel &) = delete; 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 b4bb5648f..7a5412b0e 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-08-28 17:12:21 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-09-13 10:43:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp */ #include "weather/include/WeatherModel.h" @@ -10,6 +10,7 @@ #include "weather/include/WeatherControlView.h" #include "DialModelWeather.h" #include "DialModelWeatherStr.h" +#include "ConfigModel.h" namespace OHOS { #if __cplusplus @@ -152,11 +153,33 @@ namespace OHOS return weatherTime; } + //判断当前时间是否在晚上 + bool WeatherModel::IsNightTime() + { + struct tm pTM; + time_t seconds; + time(&seconds); + localtime_r(&seconds, &pTM); + + int hour = pTM.tm_hour; + + // 假设晚上是从 18 点到次日 6 点 + return hour >= 18 || hour < 6; + } + // 获取天气图片 std::string WeatherModel::GetWeatherImage() { // int index = Weather_data_t_now.iconNight;//夜晚天气图标 - int index = Weather_data_seven_data[0].iconDay; // 白天天气图标 + int index; + if (IsNightTime()) + { + index = Weather_data_t_now.iconNight; // 夜晚天气图标 + } + else + { + index = Weather_data_seven_data[0].iconDay; // 白天天气图标 + } return weather65x65[index]; } @@ -170,7 +193,15 @@ namespace OHOS // 获取天气描述 std::string WeatherModel::GetWeatherDescription() { - std::string WeatherDescription = Weather_data_t_now.textNight; + std::string WeatherDescription; + if (IsNightTime()) + { + WeatherDescription = Weather_data_t_now.textNight; + } + else + { + WeatherDescription = Weather_data_seven_data[0].textDay; + } return WeatherDescription; } @@ -187,7 +218,16 @@ namespace OHOS { int maxtemperature = Weather_data_seven_data[0].tempMax; int mintemperature = Weather_data_seven_data[0].tempMin; - std::string MaxandMinTemperature = "最高" + std::to_string(maxtemperature) + "°" + " " + "最低" + std::to_string(mintemperature) + "°"; + int language = ConfigModel::GetInstance()->GetLanguage(); + std::string MaxandMinTemperature; + if (language == 0) // 如果系统语言为中文 + { + MaxandMinTemperature = "最高" + std::to_string(maxtemperature) + "°" + " " + "最低" + std::to_string(mintemperature) + "°"; + } + else + { + MaxandMinTemperature = "Max" + std::to_string(maxtemperature) + "°" + " " + "Min" + std::to_string(mintemperature) + "°"; + } return MaxandMinTemperature; } /* -------------------------------------------------------------------------- */ @@ -303,13 +343,13 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "p_WeatherControlView"); p_WeatherControlView->UpdateWeatherControlViewVisibility(); } - if(DialModelWeather::GetInstance()){ - DialModelWeather::GetInstance()->UpdateWeather(Weather_data_seven_data[0].iconDay); //更新主界面天气图标 + if (DialModelWeather::GetInstance()) + { + DialModelWeather::GetInstance()->UpdateWeather(Weather_data_seven_data[0].iconDay); // 更新主界面天气图标 // const std::string str = GetWeatherTemperature() + " "+GetWeatherDescription(); const std::string str = GetWeatherTemperature(); DialModelWeatherStr::GetInstance()->UpdateWeatherStr(str); } - } /*更新天气界面的时间显示*/ diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 2f1ddd19d..0ff8da9f4 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -121,7 +121,7 @@ const PriorityMapper PRI_MAPPER[] = { #endif {TOPIC_EVENT_FIND_WATCH,PRIORITY_TWO},// 找手表 [2] {TOPIC_EVENT_CANCEL_FIND_WATCH,PRIORITY_TWO},// 取消找手表 [2] - {TOPIC_EVENT_DRINKREMINDER,PRIORITY_THREE},//喝水提醒 [3] + {TOPIC_EVENT_DRINKREMINDER,PRIORITY_TWO},//喝水提醒 [2] {TOPIC_EVENT_MESSAGENOTE,PRIORITY_THREE},//消息提醒 [3] {TOPIC_EVENT_MESSAGE_UPDATA,PRIORITY_TWO},//消息更新提醒 [3] {TOPIC_EVENT_SLEEPNOTE,PRIORITY_THREE},//睡眠弹窗 [3] @@ -1126,7 +1126,7 @@ void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req) // unused(topic); unused(req); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDrinkReminderProc !"); - DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration(); + // DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration(); if (CheckPriority(topic)) { NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp index f7db40c09..0d5b33766 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp @@ -16,7 +16,8 @@ #include #include "vibrator_service.h" #include "../../../../../../../drivers/peripheral/utils/custom_runtime.h" - +#include +#include "../../../../../../drivers/peripheral/vibrator/service/vibrator_service.h" namespace OHOS { @@ -209,6 +210,15 @@ namespace OHOS DrinkReminderGroupView->Add(DrinkReminderButton); DrinkReminderGroupView->Add(DrinkReminderLabel); + /* -------------------------------------------------------------------------- */ + if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get())) + { + ui_api_vibrate_once_func(); // 震动一次 + } + + ScreenTurnOn(10 * 1000); // 亮屏操作 10秒关闭 + /* -------------------------------------------------------------------------- */ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Create DrinkReminderView succeed!!"); } -- 2.17.1