Merge #962 into sdk602patch0626 from refs/changes/962/head 963/target/1 964/target/1
author罗正 <1732036298@qq.com>
Fri, 13 Sep 2024 07:30:45 +0000 (07:30 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Fri, 13 Sep 2024 07:30:45 +0000 (07:30 +0000)
Code review from 罗正

* refs/changes/962/head: (18 commits squashed)

  - 闹钟UI优化:
    1.#636,解决,手表,闹钟只响铃3次bug
    2.闹钟编辑界面优化
    3.闹钟界面中星期缩写中文为:一,二...日,其他语言为:Mon,Tue...Sun

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - #534,解决闹钟设置多个闹钟,只响第一个,后续的没有提示闹钟bug

  - 解决#534,解决闹钟设置多个闹钟,只响第一个,后续的没有提示闹钟bug
    修改闹钟弹窗无操作50s后自动关闭

  - #642,解决:删除多余闹钟后,界面不能显示剩余闹钟bug

  - Merge branch &#39;sdk602patch0626&#39; 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 &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - #663,解决:手表,APP开启消息提醒后,手表喝水提醒不弹窗bug

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - #644,解决,计时器显示问题bug
    #645,解决,  计时器显示错误bug

  - Merge branch &#39;sdk602patch0626&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626

  - #661,解决,手表,天气天气图标显示多云,文字显示中雨bug

Signed-off-by: 罗正 <1732036298@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/962
code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp
code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h
code/sdk/application/wearable/fd230app/nativeui/weather/src/WeatherModel.cpp
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp

index c1f5b4c..55a1cc7 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-04-07 18:15:53\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-09-07 17:12:44\r
+ * @LastEditTime: 2024-09-13 09:41:37\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp\r
  */\r
 #include "countdown/include/CountDownModel.h"\r
@@ -231,7 +231,7 @@ namespace OHOS
      */\r
     int CountDownModel::StopRingtonePlaybackAndReleaseResources(void)\r
     {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownModel::StopRingtonePlaybackAndReleaseResources");\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CountDownModel::StopRingtonePlaybackAndReleaseResources");\r
         int32_t ret = 0;\r
         int32_t state = 0;\r
         AudioManager &amIntance = AudioManager::GetInstance();\r
index 9574f68..319005d 100644 (file)
@@ -167,22 +167,25 @@ namespace OHOS
                 CountDownModel::GetInstance()->SetRingTime(timePicker->GetSelectValue());      // 设置响铃时间\r
             }\r
 \r
-            if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0)\r
+            if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0) // 如果自定义时间设置为0\r
             {\r
                 p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, COUNTDOWN_TIMENOTNULL);\r
                 return true;\r
             }\r
             else\r
             {\r
-                if (p_MainCountDownView->GetStartCountDownView() != nullptr)\r
+                p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, START_COUNTDOWN);\r
+                if (p_StartCountDownView != nullptr)\r
                 {\r
-                    p_MainCountDownView->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str());\r
-                    p_MainCountDownView->GetStartCountDownView()->GetShowTheRingTimelabel()->SetText(CountDownModel::GetInstance()->GetRingTime().c_str());\r
-                    p_MainCountDownView->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(true);\r
-                    p_MainCountDownView->GetStartCountDownView()->GetRepeatButton()->SetVisible(false);\r
+                    std::string CountDownTime = CountDownModel::GetInstance()->GetCountDownTime();\r
+                    std::string RingTime = CountDownModel::GetInstance()->GetRingTime();\r
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTime = %s RingTime = %s", CountDownTime.c_str(),RingTime.c_str());\r
+                    p_StartCountDownView->GetShowCountDownTimelabel()->SetText(CountDownTime.c_str());\r
+                    p_StartCountDownView->GetShowTheRingTimelabel()->SetText(RingTime.c_str());\r
+                    p_StartCountDownView->GetPlayOrPauseToggleButton()->SetVisible(true);\r
+                    p_StartCountDownView->GetRepeatButton()->SetVisible(false);\r
                 }\r
 \r
-                p_MainCountDownView->ChangeView(TIMECONFIG_COUNTDOWN, START_COUNTDOWN);\r
                 return true;\r
             }\r
         }\r
@@ -202,9 +205,10 @@ namespace OHOS
             CountDownModel::GetInstance()->SetCountDownTime("00:00:00");\r
             CountDownModel::GetInstance()->SetRingTime("00:00:00");\r
             CountDownModel::GetInstance()->StopRingtonePlaybackAndReleaseResources();\r
-            MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetTouchable(true);\r
-            MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetState(false);\r
+            p_StartCountDownView->GetPlayOrPauseToggleButton()->SetTouchable(true);\r
+            p_StartCountDownView->GetPlayOrPauseToggleButton()->SetState(false);\r
             p_MainCountDownView->ChangeView(START_COUNTDOWN, MAIN_COUNTDOWN);\r
+            p_StartCountDownView->ShowEndView(false);\r
 \r
             return true;\r
         }\r
index fbfe362..749f3fc 100644 (file)
@@ -244,11 +244,12 @@ namespace OHOS
         button->SetLabelPosition(0, 61);\r
         button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
         button->SetStyle(STYLE_LINE_HEIGHT, 35);\r
-        button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        button->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
         button->SetStyleForState(STYLE_BORDER_RADIUS, 50, UIButton::PRESSED);\r
         return button;\r
     }\r
 \r
+    //获取开始倒计时视图\r
     StartCountDownView *MainCountDownView::GetStartCountDownView(void)\r
     {\r
         return p_StartCountDownView;\r
index 00d3bb3..8b7fbc6 100644 (file)
@@ -270,6 +270,7 @@ namespace OHOS
 \r
         vectorbigImage->SetVisible(state);\r
         showTheEndRingTime->SetVisible(state);\r
+        showTheEndRingTime->SetText(showTheRingTime->GetText());\r
     }\r
     void StartCountDownView::UpdateimageAndLabelPosition(void)\r
     {\r
index 2d92052..daad9d7 100644 (file)
@@ -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;
index b4bb564..7a5412b 100644 (file)
@@ -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);
         }
-
     }
 
     /*更新天气界面的时间显示*/
index 2f1ddd1..0ff8da9 100644 (file)
@@ -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);
index f7db40c..0d5b337 100644 (file)
@@ -16,7 +16,8 @@
 #include <custom_utils.h>
 #include "vibrator_service.h"
 #include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
-
+#include <ui_service.h>
+#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!!");
         }