#706手表,8点会自动开启睡眠模式,弹窗提示存在问题
authorCaisking <3449750381@qq.com>
Wed, 18 Sep 2024 08:29:05 +0000 (16:29 +0800)
committerCaisking <3449750381@qq.com>
Wed, 18 Sep 2024 08:29:05 +0000 (16:29 +0800)
code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeModel.cpp
code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp

index c60aeb3..cc330ff 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "sleepmode/include/SleepModeModel.h"
 #include "main/include/MainViewSample.h"
+#include "main/include/dropdown/DropDownCardPage1.h"
 #include "MainModel.h"
 #include "ConfigModel.h"
 #include "custom_runtime.h"
@@ -32,6 +33,12 @@ namespace OHOS
         /*更新主界面配置*/
         MainModel::GetInstance().setDialState(DialState::SLEEP, true);
 
+        //更新下拉界面
+        if(DropDownCardPage1::GetInstance() != nullptr && MainViewSample::GetInstance() != nullptr)
+        {
+           DropDownCardPage1::GetInstance()->UpdateSleepModelState(true);
+        }
+
         // disable flip wrist
         uapi_take_to_wake(0);
 
@@ -50,6 +57,11 @@ namespace OHOS
         /*更新主界面配置*/
         MainModel::GetInstance().setDialState(DialState::SLEEP, false);
 
+        //更新下拉界面
+        if(DropDownCardPage1::GetInstance() != nullptr && MainViewSample::GetInstance() != nullptr)
+        {
+           DropDownCardPage1::GetInstance()->UpdateSleepModelState(false);
+        }
         // enable flip wrist
         if(true == mmi_flip_wrist_switch_get())
         {
index cebf133..76603aa 100644 (file)
@@ -73,20 +73,24 @@ namespace OHOS
         NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeSleepView);
         /*获取最新sleep*/
         SLEEPSTATE sleepsate = SleepModel::GetInstance().get_sleep_state();
-        UIResourceTextId textId = STR_MORNNING;
+        // TODO:适配多国语言
+        // UIResourceTextId textId = STR_MORNNING;
+        std::string sleep_note;
         switch (sleepsate)
         {
         case SLEEPSTATE::SLEEPNOTIFY:
             titleStr = SleepModel::GetInstance().get_notifiy();
-            textId = STR_DISTURB; // 即将开启勿扰
+            // textId = STR_DISTURB; // 即将开启勿扰
+            sleep_note = "手表将在20分钟后开启睡眠模式,关闭请到控制中心";
             break;
         case SLEEPSTATE::SLEPP:
             titleStr = SleepModel::GetInstance().get_sleep_notifiy();
-            textId = STR_DISTURBNOTE;
+            // textId = STR_DISTURBNOTE;
+            sleep_note = "已开启睡眠模式,此模式下手表将关闭所有提醒功能";
             break;
         case SLEEPSTATE::WAKE:
             titleStr = SleepModel::GetInstance().get_wake_notifiy();
-            textId = STR_MORNNING;
+            // textId = STR_MORNNING;
             SetAlarmClockView(); // 设置为早安视图
             return SleepGroupView;
             break;
@@ -124,7 +128,8 @@ namespace OHOS
         }
         sleepnotifylabel->SetPosition(53, 220, 360, 144);
         sleepnotifylabel->SetViewId("sleepnotifylabel");
-        sleepnotifylabel->SetTextId(textId);
+        // sleepnotifylabel->SetTextId(textId);
+        sleepnotifylabel->SetText(sleep_note.c_str());
         sleepnotifylabel->SetTextColor(Color::Gray());
         sleepnotifylabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
         sleepnotifylabel->SetLineBreakMode(UILabel::LINE_BREAK_CLIP);             // 换行裁剪