From: Caisking <3449750381@qq.com> Date: Tue, 2 Jul 2024 07:55:58 +0000 (+0800) Subject: 增加睡眠弹窗 睡眠开启勿扰模式 X-Git-Tag: release_V1.2.70_20241020_135402~901 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=dd1eed08e5890c8fae20e672aad4f1bc801f9884;p=mirrors%2FFD230.git 增加睡眠弹窗 睡眠开启勿扰模式 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModel.h b/code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModel.h index 8651b3d7f..9784305f7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModel.h @@ -109,6 +109,7 @@ namespace OHOS std::string sleepStr{"--"}; std::string walkStr{"--"}; std::string goalStr{"--"}; + std::string goalnotifyStr{"--"}; std::string goalsleepStr{"--"}; std::string goalwalkStr{"--"}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp index 2c1731a33..843d782e9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp @@ -239,8 +239,8 @@ namespace OHOS void SleepModel::set_sleep_goal() { // 将原3个字符串清空 - goalsleepStr.clear(); goalnotifyStr.clear(); + goalsleepStr.clear(); goalwalkStr.clear(); int goal_sleep = get_sleep_time_from_config_model(); @@ -306,32 +306,33 @@ namespace OHOS { return sleep_total_time; } - // 获取入睡时间 + // 获取实际入睡时间str std::string SleepModel::get_rest_str() { return sleepStr; } - // 获取醒来时间 + // 获取实际醒来时间str std::string SleepModel::get_walk_str() { return walkStr; } - // 获取目标休息时间 + // 获取目标休息时间str std::string SleepModel::get_goal_str() { return goalStr; } - // 获取提醒时间 - std::string SleepModel::get_sleep_notifiy() - { - return goalsleepStr; - } - // 获取睡眠时间 + // 获取 目标睡眠提醒 时间点str std::string SleepModel::get_notifiy() { return goalnotifyStr; } - // 获取起床时间 + // 获取 目标睡眠 时间点str + std::string SleepModel::get_sleep_notifiy() + { + return goalsleepStr; + } + + // 获取 目标起床 时间点str std::string SleepModel::get_walk_notifiy() { return goalwalkStr; diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp index c1f4af6c5..e13c539eb 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp @@ -102,11 +102,13 @@ namespace OHOS textId = STR_DISTURB; // 即将开启勿扰 break; case SLEEPSTATE::SLEPP: - titleStr = SleepModel::GetInstance().get_rest_str(); + titleStr = SleepModel::GetInstance().get_sleep_notifiy(); textId = STR_DISTURBNOTE; // 开启勿扰 + ConfigModel::GetInstance()->SetDnotdisturb(true); break; case SLEEPSTATE::WALK: - titleStr = SleepModel::GetInstance().get_walk_str(); + titleStr = SleepModel::GetInstance().get_walk_notifiy(); + ConfigModel::GetInstance()->SetDnotdisturb(false); // 关闭勿扰 break; default: break; @@ -122,10 +124,10 @@ namespace OHOS } sleeptitle->SetPosition(83, 60, 300, 35); sleeptitle->SetText(titleStr.c_str()); - sleeptitle->SetStyle(STYLE_TEXT_FONT, 30); + sleeptitle->SetStyle(STYLE_TEXT_FONT, 40); sleeptitle->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); sleeptitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - sleeptitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + sleeptitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); sleeptitle->SetVisible(true); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sleeptitle is ok!"); /* -------------------------------------------------------------------------- */ @@ -142,7 +144,7 @@ namespace OHOS } sleepnotifylabel->SetPosition(53, 220, 360, 144); sleepnotifylabel->SetViewId("sleepnotifylabel"); - sleepnotifylabel->SetTextId(textId); // 将开启勿扰模式 + sleepnotifylabel->SetTextId(textId); sleepnotifylabel->SetTextColor(Color::Gray()); sleepnotifylabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); sleepnotifylabel->SetLineBreakMode(UILabel::LINE_BREAK_CLIP); // 换行裁剪