From 962d24eddbb20b50057fb862f4099250f0ec9508 Mon Sep 17 00:00:00 2001 From: cheng Date: Thu, 29 Aug 2024 13:00:18 +0800 Subject: [PATCH] =?utf8?q?=E9=97=B9=E9=92=9F=E5=93=8D=E9=93=83=E7=95=8C?= =?utf8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/notify/alarm_notification.cpp | 62 ++++++++++++++++--- .../fd230/fs/user/res/Alarm/alarm_prompt.bin | 3 + 2 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Alarm/alarm_prompt.bin diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp index 3b237ebc7..359d90ac5 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp @@ -10,8 +10,8 @@ #include "UiConfig.h" #include "AlarmPopUpPresenter.h" #include "components/ui_image_view.h" -#include "components/ui_label.h" - +#include "components/ui_label_ext.h" +#include "components/ui_label_button_ext.h" namespace OHOS { static constexpr const char* RING_AGAIN = "响铃将在十分钟后再次响起"; constexpr int32_t NOTIFY_THREE_SECONDS = 3000; @@ -28,10 +28,12 @@ UIViewGroup* g_ringView = nullptr; UIImageView* g_imageClose = nullptr; UIImageView* g_imageRing = nullptr; UIImageView* g_imageDelete = nullptr; +UILabelButtonExt * g_StopBtn = nullptr; +UIImageView * g_ClockPrompt = nullptr; UIImageView* g_imageClock = nullptr; UILabel* g_closeLable = nullptr; UILabel* g_ringLable = nullptr; -UILabel* g_mainLable = nullptr; +UILabelExt* g_mainLable = nullptr; UIDigitalClock* g_dClock = nullptr; // alarm close view @@ -292,6 +294,7 @@ static bool CreateAlarmViewImage(void) UIView::OnClickListener *closeListener = static_cast\ (AlarmViewEventListener::GetInstance()); g_imageDelete->SetOnClickListener(closeListener); + g_imageDelete->SetVisible(false); g_imageClock = new UIImageView(); if (g_imageClock == nullptr) { @@ -309,6 +312,32 @@ static bool CreateAlarmViewImage(void) UIView::OnClickListener *clockListener = static_cast\ (OHOS::AlarmViewEventListener::GetInstance()); g_imageClock->SetOnClickListener(clockListener); + g_imageClock->SetVisible(false); + + + g_ClockPrompt = new UIImageView(); + if (g_ClockPrompt == nullptr) + return false; + + g_ClockPrompt->SetPosition(184, 129, 100, 100); + g_ClockPrompt->SetSrc("/user/res/Alarm/alarm_prompt.bin"); + + + g_StopBtn = new UILabelButtonExt(); + if (g_StopBtn == nullptr) + return false; + + g_StopBtn->SetPosition(0, 366, 466, 100); + g_StopBtn->SetViewId(ALARM_IMAGE_DELETE); + g_StopBtn->SetTextId(STR_STOP); + g_StopBtn->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + g_StopBtn->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0x5A, 0x36)); + g_StopBtn->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE); + g_StopBtn->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED); + g_StopBtn->SetTouchable(true); + // closeListener = static_cast(AlarmViewEventListener::GetInstance()); + g_StopBtn->SetOnClickListener(closeListener); + return true; } @@ -318,6 +347,11 @@ static void FreeAlarmViewImage(void) g_imageDelete = nullptr; delete g_imageClock; g_imageClock = nullptr; + + delete g_StopBtn; + g_StopBtn = nullptr; + delete g_ClockPrompt; + g_ClockPrompt = nullptr; } static bool CreateAlarmViewLabel(void) @@ -326,14 +360,20 @@ static bool CreateAlarmViewLabel(void) int16 thisHour; int16 thisMin; - g_mainLable = new UILabel(); + g_mainLable = new UILabelExt(); // UILabel(); if (g_mainLable == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmViewLabel g_mainLable is nullptr"); return false; } - g_mainLable->SetPosition(LABEL_X, LABEL_Y, LABEL_WIDTH, LABEL_HEIGHT); - g_mainLable->SetText("闹钟"); - g_mainLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); + g_mainLable->SetPosition(83, 50, 300, 35); // (LABEL_X, LABEL_Y, LABEL_WIDTH, LABEL_HEIGHT); + // g_mainLable->SetText("闹钟"); + g_mainLable->SetTextId(STR_ALARM); + g_mainLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); // LABEL_FONT); + g_mainLable->SetStyle(STYLE_TEXT_FONT, 30); + g_mainLable->SetStyle(STYLE_LINE_HEIGHT, 35); + g_mainLable->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + g_mainLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + g_mainLable->SetRollSpeed(70); g_dClock = new UIDigitalClock(); if (g_dClock == nullptr) { @@ -341,9 +381,9 @@ static bool CreateAlarmViewLabel(void) delete g_mainLable; return false; } - g_dClock->SetPosition(CLOCK_X, CLOCK_Y); - g_dClock->Resize(DIGITAL_CLOCK_WIDTH, DIGITAL_CLOCK_HEIGHT); - g_dClock->SetFont(DEFAULT_VECTOR_FONT_FILENAME, CLOCK_FONT); + g_dClock->SetPosition(155, 236, 156, 70); // (CLOCK_X, CLOCK_Y); + // g_dClock->Resize(DIGITAL_CLOCK_WIDTH, DIGITAL_CLOCK_HEIGHT); + g_dClock->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 60); // CLOCK_FONT); time_t seconds = time(nullptr); if (localtime_r(&seconds, &localTime) == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmViewLabel get localtime error!"); @@ -393,6 +433,8 @@ UIViewGroup* CreateAlarmView(void) g_alarmView->Add(g_dClock); g_alarmView->Add(g_imageDelete); g_alarmView->Add(g_imageClock); + g_alarmView->Add(g_ClockPrompt); + g_alarmView->Add(g_StopBtn); g_alarmView->SetDraggable(true); g_alarmView->SetTouchable(true); diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Alarm/alarm_prompt.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Alarm/alarm_prompt.bin new file mode 100644 index 000000000..bc331b6b0 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Alarm/alarm_prompt.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e44aa671389218aaf18a7c4a85012d2f60a393db12236a95ae0d532ad354dc9a +size 6824 -- 2.17.1