From 6d40caf86e595b327fc97d01e0065c71e9997993 Mon Sep 17 00:00:00 2001 From: cheng Date: Mon, 2 Sep 2024 11:57:51 +0800 Subject: [PATCH] =?utf8?q?=E9=97=B9=E9=92=9F=E5=A2=9E=E5=8A=A0=E7=82=B9?= =?utf8?q?=E5=87=BB=E6=97=B6=E9=97=B4=E8=BF=9B=E5=85=A5=E7=BC=96=E8=BE=91?= =?utf8?q?=E5=92=8C=E5=B7=A6=E6=BB=91=E6=8C=89=E9=92=AE=E5=88=A0=E9=99=A4?= =?utf8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/alarm/include/AlarmConfigView.h | 8 +- .../nativeui/alarm/include/AlarmJudgeView.h | 22 +- .../nativeui/alarm/include/AlarmPresenter.h | 3 + .../nativeui/alarm/include/AlarmSetTimeView.h | 3 +- .../nativeui/alarm/src/AlarmConfigView.cpp | 187 +++++++------ .../nativeui/alarm/src/AlarmJudgeView.cpp | 248 ++++++++++++++---- .../nativeui/alarm/src/AlarmPresenter.cpp | 39 ++- .../nativeui/alarm/src/AlarmSetTimeView.cpp | 104 +++++--- .../nativeui/alarm/src/MainAlarmView.cpp | 29 +- .../nativeui/schedule/src/ScheduleView.cpp | 4 +- 10 files changed, 458 insertions(+), 189 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmConfigView.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmConfigView.h index 869934e4d..1187f4958 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmConfigView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmConfigView.h @@ -31,7 +31,7 @@ public: static AlarmConfigView *GetInstance(void); void RefreshConfig(const uint32 time, uint8 week, uint16_t alarmNum); private: - UILabelButton *deleteImage{nullptr}; + // UILabelButton *deleteImage{nullptr}; UIScrollView *configScroll{nullptr}; UIScrollView *group{nullptr}; UILabel *editLabel{nullptr}; @@ -39,11 +39,11 @@ private: UILabel *labelSetTime{nullptr}; UILabel *labelDay{nullptr}; UILabel *labelSetWeek{nullptr}; - UILabel *labelChangeName{nullptr}; - UILabel *labelSetName{nullptr}; + // UILabel *labelChangeName{nullptr}; + // UILabel *labelSetName{nullptr}; UIImageView *changeIcon1{nullptr}; UIImageView *changeIcon2{nullptr}; - UIImageView *changeIcon3{nullptr}; + // UIImageView *changeIcon3{nullptr}; UILabel *CreateConfigLabel(const char *buttonText, int16_t labelFont, int16_t x, int16_t y, int16_t width); void CreateConfigButton(void); void CreateChangeIcons(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmJudgeView.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmJudgeView.h index 996dfdf7d..f6349e4ad 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmJudgeView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmJudgeView.h @@ -18,6 +18,7 @@ #include "components/ui_digital_clock.h" #include "components/ui_scroll_view.h" #include "components/ui_view_group.h" +#include "components/ui_label_button_ext.h" #include "layout/grid_layout.h" #include "font/ui_font.h" #include "BaseView.h" @@ -35,11 +36,22 @@ public: void OnTearDownView(); void OnStop(); private: - void CreateImage(void); - UIScrollView *container{nullptr}; - UILabel *labelText{nullptr}; - UIImageView *imageViewDelete{nullptr}; - UIImageView *imageViewTrue{nullptr}; + // void CreateImage(void); + // UIScrollView *container{nullptr}; + // UILabel *labelText{nullptr}; + // UIImageView *imageViewDelete{nullptr}; + // UIImageView *imageViewTrue{nullptr}; + + UIScrollView * InitDeleteScreen(); + void DeinitDeleteScreen(); + UIScrollView * DeleteGroup_{nullptr}; + UILabelExt * DeleteTitleLabelExt_{nullptr}; + UILabelExt * DeletePromptLabelExt_{nullptr}; + UILabelButtonExt * DeleteCancelButton_{nullptr}; + UILabelButtonExt * DeleteOKButton_{nullptr}; + + #define SCREEN_WIDTH (Screen::GetInstance().GetWidth()) + #define SCREEN_HEIGHT (Screen::GetInstance().GetHeight()) }; } // namespace OHOS #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmPresenter.h index 508c38108..8d8ce065f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmPresenter.h @@ -162,6 +162,9 @@ public: void ClickAlarmNext(uint16_t alarmNum); void OnTimePickerInaction(uint32_t hour, uint32_t min); uint8_t alarmWeek[7] = {1, 1, 1, 1, 1, 1, 1}; // 闹钟默认所有的日期都选中,因此初始值为1,7是指一个星期中七天 + + void ClickDeleteButtonAlarmClockDelete(uint16_t num); + private: uint32_t timeHour{0}; uint32_t timeMin{0}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmSetTimeView.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmSetTimeView.h index 72769ebfd..eb668c522 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmSetTimeView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmSetTimeView.h @@ -28,7 +28,8 @@ public: void RefreshSetTime(uint32_t time); private: UIScrollView *group{nullptr}; - UILabelButton *timeImage{nullptr}; + // UILabelButton *timeImage{nullptr}; + UILabelButton * labelButton{nullptr}; UILabel *title{nullptr}; UITimePicker *picker{nullptr}; UILabel *GetTitleLabel(const char *titleName); diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmConfigView.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmConfigView.cpp index 171caef71..ffc42d652 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmConfigView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmConfigView.cpp @@ -38,10 +38,10 @@ constexpr int16_t LABEL_WID = 250; constexpr int16_t MAX_LABEL_H_LEN = 80; constexpr int16_t MAX_DATA_W_LEN = 275; constexpr int16_t DIGITAL_CLOCK_FONT = 45; -constexpr int16_t MAX_LABEL_TIME_Y_LEN = 195; -constexpr int16_t LABEL_SET_TIME_Y = 245; -constexpr int16_t MAX_LABEL_DAY_Y_LEN = 320; -constexpr int16_t MAX_LABEL_SET_WEEK_Y_LEN = 380; +constexpr int16_t MAX_LABEL_TIME_Y_LEN = 195 - 25; +constexpr int16_t LABEL_SET_TIME_Y = 245 - 25; +constexpr int16_t MAX_LABEL_DAY_Y_LEN = 320 - 30; +constexpr int16_t MAX_LABEL_SET_WEEK_Y_LEN = 380 - 30; constexpr int16_t MAX_LABEL_LABEL_CHANGE_NAME_Y_LEN = 460; constexpr int16_t MAX_LABEL_SET_NAME_Y_LEN = 505; constexpr int16_t MAX_DEFAULT_FONT_LEN = 34; @@ -56,8 +56,8 @@ constexpr int16_t MAX_DELETE_BUTTON_H_LEN = 100; constexpr int16_t MAX_DELETE_BUTTON_X_LEN = 63; constexpr int16_t MAX_DELETE_BUTTON_Y_LEN = 365; constexpr int16_t MAX_IMAGE_CHANGE_X_LEN = 370; -constexpr int16_t MAX_IMAGE_CHANGE1_Y_LEN = 210; -constexpr int16_t MAX_IMAGE_CHANGE2_Y_LEN = 350; +constexpr int16_t MAX_IMAGE_CHANGE1_Y_LEN = 210 - 25; +constexpr int16_t MAX_IMAGE_CHANGE2_Y_LEN = 350 - 30; constexpr int16_t MAX_IMAGE_CHANGE3_Y_LEN = 470; constexpr int16_t MAX_IMAGE_CHANGE_WIDTH = 50; constexpr int16_t MAX_IMAGE_CHANGE_HEIGHT = 60; @@ -72,34 +72,63 @@ AlarmConfigView::AlarmConfigView() AlarmConfigView::~AlarmConfigView() { - group->RemoveAll(); - configScroll->RemoveAll(); - delete editLabel; - editLabel = nullptr; - delete deleteImage; - deleteImage = nullptr; - delete configScroll; - configScroll = nullptr; - delete labelTime; - labelTime = nullptr; - delete labelSetTime; - labelSetTime = nullptr; - delete labelDay; - labelDay = nullptr; - delete labelSetWeek; - labelSetWeek = nullptr; - delete labelChangeName; - labelChangeName = nullptr; - delete labelSetName; - labelSetName = nullptr; - delete changeIcon1; - changeIcon1 = nullptr; - delete changeIcon2; - changeIcon2 = nullptr; - delete changeIcon3; - changeIcon3 = nullptr; - delete group; - group = nullptr; + if(nullptr != group) + { + group->RemoveAll(); + + if(nullptr != configScroll) + { + configScroll->RemoveAll(); + if(nullptr != editLabel) + { + delete editLabel; + editLabel = nullptr; + } + // delete deleteImage; + // deleteImage = nullptr; + if(nullptr != labelTime) + { + delete labelTime; + labelTime = nullptr; + } + if(nullptr != labelSetTime) + { + delete labelSetTime; + labelSetTime = nullptr; + } + if(nullptr != labelDay) + { + delete labelDay; + labelDay = nullptr; + } + if(nullptr != labelSetWeek) + { + delete labelSetWeek; + labelSetWeek = nullptr; + } + // delete labelChangeName; + // labelChangeName = nullptr; + // delete labelSetName; + // labelSetName = nullptr; + if(nullptr != changeIcon1) + { + delete changeIcon1; + changeIcon1 = nullptr; + } + if(nullptr != changeIcon2) + { + delete changeIcon2; + changeIcon2 = nullptr; + } + // delete changeIcon3; + // changeIcon3 = nullptr; + + delete configScroll; + configScroll = nullptr; + } + delete group; + group = nullptr; + } g_pAlarmConfigView = nullptr; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmConfigView::~AlarmConfigView"); } @@ -147,14 +176,14 @@ void AlarmConfigView::CreateChangeIcons(void) changeIcon2->SetSrc(PNG_SETTTING_BUTTON_IMAGE); configScroll->Add(changeIcon2); - changeIcon3 = new UIImageView(); - if (changeIcon3 == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new changeIcon3 fail"); - return; - } - changeIcon3->SetPosition(MAX_IMAGE_CHANGE_X_LEN, MAX_IMAGE_CHANGE3_Y_LEN, MAX_IMAGE_CHANGE_WIDTH, MAX_IMAGE_CHANGE_HEIGHT); - changeIcon3->SetSrc(PNG_SETTTING_BUTTON_IMAGE); - configScroll->Add(changeIcon3); + // changeIcon3 = new UIImageView(); + // if (changeIcon3 == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new changeIcon3 fail"); + // return; + // } + // changeIcon3->SetPosition(MAX_IMAGE_CHANGE_X_LEN, MAX_IMAGE_CHANGE3_Y_LEN, MAX_IMAGE_CHANGE_WIDTH, MAX_IMAGE_CHANGE_HEIGHT); + // changeIcon3->SetSrc(PNG_SETTTING_BUTTON_IMAGE); + // configScroll->Add(changeIcon3); UIView::OnDragListener *configDragListener = (UIView::OnDragListener *)OHOS::AlarmPresenter::GetInstance(); if (configDragListener == nullptr) { @@ -166,7 +195,8 @@ void AlarmConfigView::CreateChangeIcons(void) void AlarmConfigView::CreateConfigButton(void) { - editLabel = CreateConfigLabel(SET_ALARM, MAX_DEFAULT_FONT_LEN, TITLE_X_LEN, MAX_TITLE_Y_LEN, LABEL_WID); + // editLabel = CreateConfigLabel(SET_ALARM, MAX_DEFAULT_FONT_LEN, TITLE_X_LEN, MAX_TITLE_Y_LEN, LABEL_WID); + editLabel = CreateConfigLabel(SET_ALARM, 30, 83, 50, 300); if (editLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new editLabel fail"); return; @@ -232,42 +262,43 @@ UIScrollView *AlarmConfigView::InitConfigView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new configScroll fail"); return nullptr; } - configScroll->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION - MAX_BACK_BUTTON_HEIGHT_LEN); + configScroll->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + // configScroll->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION - MAX_BACK_BUTTON_HEIGHT_LEN); configScroll->SetReboundSize(CONFIG_SCROLL_SIZE); configScroll->SetHorizontalScrollState(false); CreateConfigButton(); - labelChangeName = CreateConfigLabel(CHANGE_NAME, MAX_DEFAULT_FONT_LEN, MAX_TITLE_X_LEN, - MAX_LABEL_LABEL_CHANGE_NAME_Y_LEN, LABEL_WID); - if (labelChangeName == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new labelChangeName fail"); - return nullptr; - } - configScroll->Add(labelChangeName); - labelSetName = CreateConfigLabel(SET_NAME, LITTLE_LABEL_FONT, MAX_TITLE_X_LEN, MAX_LABEL_SET_NAME_Y_LEN, LABEL_WID); - if (labelSetName == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new labelSetName fail"); - return nullptr; - } - labelSetName->SetStyle(STYLE_TEXT_OPA, LABEL_SEMITRANSPARENT); - configScroll->Add(labelSetName); - deleteImage = new UILabelButton(); - if (deleteImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new deleteImage fail"); - return nullptr; - } - deleteImage->SetPosition(MAX_DELETE_BUTTON_X_LEN, MAX_DELETE_BUTTON_Y_LEN, MAX_DELETE_BUTTON_W_LEN, MAX_DELETE_BUTTON_H_LEN); - deleteImage->SetText(DELETE_INTERFACES); - deleteImage->SetTouchable(true); - deleteImage->SetViewId(ALARM_CLOCK_DELETE); - deleteImage->SetTextColor(Color::Red()); - deleteImage->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MAX_DEFAULT_LIT_FONT2_LEN); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); - deleteImage->SetOnClickListener(clickListener); - deleteImage->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE); + // labelChangeName = CreateConfigLabel(CHANGE_NAME, MAX_DEFAULT_FONT_LEN, MAX_TITLE_X_LEN, + // MAX_LABEL_LABEL_CHANGE_NAME_Y_LEN, LABEL_WID); + // if (labelChangeName == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new labelChangeName fail"); + // return nullptr; + // } + // configScroll->Add(labelChangeName); + // labelSetName = CreateConfigLabel(SET_NAME, LITTLE_LABEL_FONT, MAX_TITLE_X_LEN, MAX_LABEL_SET_NAME_Y_LEN, LABEL_WID); + // if (labelSetName == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new labelSetName fail"); + // return nullptr; + // } + // labelSetName->SetStyle(STYLE_TEXT_OPA, LABEL_SEMITRANSPARENT); + // configScroll->Add(labelSetName); + // deleteImage = new UILabelButton(); + // if (deleteImage == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new deleteImage fail"); + // return nullptr; + // } + // deleteImage->SetPosition(MAX_DELETE_BUTTON_X_LEN, MAX_DELETE_BUTTON_Y_LEN, MAX_DELETE_BUTTON_W_LEN, MAX_DELETE_BUTTON_H_LEN); + // deleteImage->SetText(DELETE_INTERFACES); + // deleteImage->SetTouchable(true); + // deleteImage->SetViewId(ALARM_CLOCK_DELETE); + // deleteImage->SetTextColor(Color::Red()); + // deleteImage->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MAX_DEFAULT_LIT_FONT2_LEN); + // UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); + // deleteImage->SetOnClickListener(clickListener); + // deleteImage->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE); CreateChangeIcons(); group->Add(configScroll); - group->Add(deleteImage); + // group->Add(deleteImage); return group; } @@ -314,11 +345,11 @@ void AlarmConfigView::RefreshConfig(const uint32_t time, uint8_t week, uint16_t WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView::RefreshStep labelTime error!"); return; } - if (alarmNum == 0) { - deleteImage->SetVisible(false); - } else if (alarmNum >= SET_ONE && alarmNum <= SET_FOUR) { - deleteImage->SetVisible(true); - } + // if (alarmNum == 0) { + // deleteImage->SetVisible(false); + // } else if (alarmNum >= SET_ONE && alarmNum <= SET_FOUR) { + // deleteImage->SetVisible(true); + // } labelTime->SetTime24Hour(hour, min, 0); labelDay->SetText(weekStr.c_str()); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmJudgeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmJudgeView.cpp index 9e6c2ea72..ee1a7d307 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmJudgeView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmJudgeView.cpp @@ -9,6 +9,7 @@ #include "UiConfig.h" #include #include "AlarmPresenter.h" +#include "ui_resource_string.h" namespace OHOS { #define DELETE_INETERFACES "是否删除此闹钟?" @@ -36,73 +37,206 @@ AlarmJudgeView::AlarmJudgeView() AlarmJudgeView::~AlarmJudgeView() { - container->RemoveAll(); - delete labelText; - labelText = nullptr; - delete imageViewDelete; - imageViewDelete = nullptr; - delete container; - container = nullptr; + DeinitDeleteScreen(); + + // container->RemoveAll(); + // delete labelText; + // labelText = nullptr; + // delete imageViewDelete; + // imageViewDelete = nullptr; + // delete container; + // container = nullptr; g_JudgeView = nullptr; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView::~AlarmJudgeView"); } -void AlarmJudgeView::CreateImage(void) +// void AlarmJudgeView::CreateImage(void) +// { +// UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); +// if (clickListener == nullptr) { +// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new OnClickListener fail"); +// return; +// } +// imageViewDelete = new UIImageView(); +// if (imageViewDelete == nullptr) { +// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new imageViewDelete fail"); +// return; +// } +// imageViewDelete->SetPosition(MAX_IMAGE_DELETE_X_LEN, MAX_IMAGE_DELETE_Y_LEN); +// imageViewDelete->SetSrc(ALARM_DELETE_ADD_PATH); +// imageViewDelete->SetViewId(JUDGE_DELETE); +// imageViewDelete->SetWidth(MAX_IMAGE_DELETE_WIDTH_LEN); +// imageViewDelete->SetTouchable(true); +// imageViewDelete->SetOnClickListener(clickListener); +// container->Add(imageViewDelete); + +// imageViewTrue = new UIImageView(); +// if (imageViewTrue == nullptr) { +// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new imageViewTrue fail"); +// return; +// } +// imageViewTrue->SetPosition(MAX_IMAGE_TRUE_X_LEN, MAX_IMAGE_TRUE_Y_LEN); // 50 : size +// imageViewTrue->SetSrc(ALARM_TRUE_ADD_PATH); +// imageViewTrue->SetViewId(JUDGE_TRUE); +// imageViewTrue->SetWidth(MAX_IMAGE_TRUE_WIDTH_LEN); +// imageViewTrue->SetTouchable(true); +// imageViewTrue->SetOnClickListener(clickListener); +// container->Add(imageViewTrue); +// } + +UIScrollView *AlarmJudgeView::InitJudgeView(void) { - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); - if (clickListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new OnClickListener fail"); - return; - } - imageViewDelete = new UIImageView(); - if (imageViewDelete == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new imageViewDelete fail"); - return; - } - imageViewDelete->SetPosition(MAX_IMAGE_DELETE_X_LEN, MAX_IMAGE_DELETE_Y_LEN); - imageViewDelete->SetSrc(ALARM_DELETE_ADD_PATH); - imageViewDelete->SetViewId(JUDGE_DELETE); - imageViewDelete->SetWidth(MAX_IMAGE_DELETE_WIDTH_LEN); - imageViewDelete->SetTouchable(true); - imageViewDelete->SetOnClickListener(clickListener); - container->Add(imageViewDelete); - - imageViewTrue = new UIImageView(); - if (imageViewTrue == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new imageViewTrue fail"); - return; - } - imageViewTrue->SetPosition(MAX_IMAGE_TRUE_X_LEN, MAX_IMAGE_TRUE_Y_LEN); // 50 : size - imageViewTrue->SetSrc(ALARM_TRUE_ADD_PATH); - imageViewTrue->SetViewId(JUDGE_TRUE); - imageViewTrue->SetWidth(MAX_IMAGE_TRUE_WIDTH_LEN); - imageViewTrue->SetTouchable(true); - imageViewTrue->SetOnClickListener(clickListener); - container->Add(imageViewTrue); + // container = new UIScrollView(); + // if (container == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new container fail"); + // return nullptr; + // } + // container->SetPosition(CONTAINER_X, CONTAINER_Y); + // container->SetWidth(HORIZONTAL_RESOLUTION); + // container->SetHeight(VERTICAL_RESOLUTION); + + // labelText = new UILabel(); + // if (container == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new labelText fail"); + // return nullptr; + // } + // labelText->SetPosition(MAX_LABEL_X_LEN, MAX_LABEL_Y_LEN, MAX_LABEL_LENGTH_LEN, MAX_LABEL_WIDTH_LEN); + // labelText->SetText(DELETE_INETERFACES); + // labelText->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MAX_LABEL_FONT_LEN); + // container->Add(labelText); + + // CreateImage(); + // return container; + + return InitDeleteScreen(); } -UIScrollView *AlarmJudgeView::InitJudgeView(void) + +void AlarmJudgeView::DeinitDeleteScreen() { - container = new UIScrollView(); - if (container == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new container fail"); - return nullptr; + if(nullptr != DeleteGroup_) + { + DeleteGroup_->RemoveAll(); + if(nullptr != DeleteTitleLabelExt_) + { + delete DeleteTitleLabelExt_; + DeleteTitleLabelExt_ = nullptr; + } + if(nullptr != DeletePromptLabelExt_) + { + delete DeletePromptLabelExt_; + DeletePromptLabelExt_ = nullptr; + } + if(nullptr != DeleteCancelButton_) + { + delete DeleteCancelButton_; + DeleteCancelButton_ = nullptr; + } + if(nullptr != DeleteOKButton_) + { + delete DeleteOKButton_; + DeleteOKButton_ = nullptr; + } + + delete DeleteGroup_; + DeleteGroup_ = nullptr; } - container->SetPosition(CONTAINER_X, CONTAINER_Y); - container->SetWidth(HORIZONTAL_RESOLUTION); - container->SetHeight(VERTICAL_RESOLUTION); - - labelText = new UILabel(); - if (container == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView:: new labelText fail"); - return nullptr; +} + +UIScrollView * AlarmJudgeView::InitDeleteScreen() +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]", __LINE__); + if(nullptr == DeleteGroup_) + { + DeleteGroup_ = new UIScrollView(); + if(nullptr == DeleteGroup_) + return nullptr; + + DeleteGroup_->SetPosition(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + // DeleteGroup_->SetViewId(SCHEDULE_ViewId_DeleteGroup_); + DeleteGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); + DeleteGroup_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + // DeleteGroup_->SetTouchable(true); + // DeleteGroup_->SetDraggable(true); + // DeleteGroup_->SetOnDragListener(presenter_); + + if(nullptr == DeleteTitleLabelExt_) + { + DeleteTitleLabelExt_ = new UILabelExt(); + if(nullptr == DeleteTitleLabelExt_) + return nullptr; + + DeleteTitleLabelExt_->SetPosition(83, 50, 300, 35); + DeleteTitleLabelExt_->SetStyle(STYLE_TEXT_FONT, 30); + DeleteTitleLabelExt_->SetStyle(STYLE_LINE_HEIGHT, 35); + DeleteTitleLabelExt_->SetTextId(STR_DELETE); + DeleteTitleLabelExt_->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + DeleteTitleLabelExt_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + DeleteTitleLabelExt_->SetRollSpeed(70); + DeleteTitleLabelExt_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + DeleteTitleLabelExt_->SetStyle(STYLE_TEXT_COLOR, Color::White().full); + } + + if(nullptr == DeletePromptLabelExt_) + { + DeletePromptLabelExt_ = new UILabelExt(); + if(nullptr == DeletePromptLabelExt_) + return nullptr; + + DeletePromptLabelExt_->SetPosition(98, 187, 270, 35); + DeletePromptLabelExt_->SetStyle(STYLE_TEXT_FONT, 30); + DeletePromptLabelExt_->SetStyle(STYLE_LINE_HEIGHT, 35); + DeletePromptLabelExt_->SetText(DELETE_INETERFACES); + DeletePromptLabelExt_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + DeletePromptLabelExt_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + DeletePromptLabelExt_->SetRollSpeed(70); + DeletePromptLabelExt_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + DeletePromptLabelExt_->SetStyle(STYLE_TEXT_COLOR, 0xff999999); + } + + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); + if(nullptr == DeleteCancelButton_) + { + DeleteCancelButton_ = new UILabelButtonExt(); + if(nullptr == DeleteCancelButton_) + return nullptr; + + DeleteCancelButton_->SetPosition(111, 299, 100, 100); + DeleteCancelButton_->SetViewId(JUDGE_DELETE); + DeleteCancelButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + DeleteCancelButton_->SetStyle(STYLE_BACKGROUND_OPA, 25); // 10% + DeleteCancelButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED); + DeleteCancelButton_->SetStyleForState(STYLE_BACKGROUND_OPA, 25, UIButton::PRESSED); + DeleteCancelButton_->SetStyle(STYLE_BORDER_RADIUS, 100); + DeleteCancelButton_->SetImagePosition(0, 0); + DeleteCancelButton_->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE); + DeleteCancelButton_->SetOnClickListener(clickListener); + } + + if(nullptr == DeleteOKButton_) + { + DeleteOKButton_ = new UILabelButtonExt(); + if(nullptr == DeleteOKButton_) + return nullptr; + + DeleteOKButton_->SetPosition(256, 299, 100, 100); + DeleteOKButton_->SetViewId(JUDGE_TRUE); + DeleteOKButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + DeleteOKButton_->SetStyle(STYLE_BACKGROUND_OPA, 25); // 10% + DeleteOKButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED); + DeleteOKButton_->SetStyleForState(STYLE_BACKGROUND_OPA, 25, UIButton::PRESSED); + DeleteOKButton_->SetStyle(STYLE_BORDER_RADIUS, 100); + DeleteOKButton_->SetImagePosition(0, 0); + DeleteOKButton_->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE); + DeleteOKButton_->SetOnClickListener(clickListener); + } + + DeleteGroup_->Add(DeleteTitleLabelExt_); + DeleteGroup_->Add(DeletePromptLabelExt_); + DeleteGroup_->Add(DeleteCancelButton_); + DeleteGroup_->Add(DeleteOKButton_); } - labelText->SetPosition(MAX_LABEL_X_LEN, MAX_LABEL_Y_LEN, MAX_LABEL_LENGTH_LEN, MAX_LABEL_WIDTH_LEN); - labelText->SetText(DELETE_INETERFACES); - labelText->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MAX_LABEL_FONT_LEN); - container->Add(labelText); - CreateImage(); - return container; + return DeleteGroup_; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp index 3d4047f41..36bb5c7cc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp @@ -177,6 +177,7 @@ void AlarmPresenter::ClickJudgeTrue(uint16_t num) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter JUDGE_DELETE"); UNUSED(num); uint32_t clockTime; + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[@CHENG][%d]:%d,%d", __LINE__, alarmListener, clockQty); AlarmClockModel::GetInstance()->DeleteClockModel(alarmListener); if (MainAlarmView::GetInstance() == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::ClickJudgeTrue new MainAlarmView::GetInstance() error"); @@ -185,8 +186,10 @@ void AlarmPresenter::ClickJudgeTrue(uint16_t num) MainAlarmView::GetInstance()->RefreshAlarm(); clockQty--; for (uint16_t alarmNum = 0; alarmNum < clockQty; alarmNum++) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[@CHENG][%d]:%d", __LINE__, alarmNum); + if (!(AlarmClockModel::GetInstance()->GetClockTime(alarmNum, &clockTime))) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickJudgeTrue error"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickJudgeTrue error"); return; } MainAlarmView::GetInstance()->RefreshAlarm(); @@ -461,9 +464,43 @@ bool AlarmPresenter::OnKeyAct(UIView &view, const KeyEvent &event) return true; } +void AlarmPresenter::ClickDeleteButtonAlarmClockDelete(uint16_t num) +{ + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[@CHENG][%d]:%d", __LINE__, num); + UNUSED(num); + alarmListener = num; + MainAlarmView::GetInstance()->ChangeView(MAIN_INTERFACE, CHANGE_INTERFACE_JUDGE); + // if (MainAlarmView::GetInstance() == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::ClickDeleteButtonAlarmClockDelete error"); + // return; + // } +} + +static const AlarmPresentMapper1 DeleteButtonPresentMapper[] = +{ + {ALARM_ITEM_DELETE[THE_FIRST_ALARM], &AlarmPresenter::ClickDeleteButtonAlarmClockDelete}, + {ALARM_ITEM_DELETE[SECOND_ALARM], &AlarmPresenter::ClickDeleteButtonAlarmClockDelete}, + {ALARM_ITEM_DELETE[THIRD_ALARM], &AlarmPresenter::ClickDeleteButtonAlarmClockDelete}, + {ALARM_ITEM_DELETE[FOURTH_ALARM], &AlarmPresenter::ClickDeleteButtonAlarmClockDelete}, + {ALARM_ITEM_DELETE[FIVE_ALARM], &AlarmPresenter::ClickDeleteButtonAlarmClockDelete}, + {ALARM_ITEM_DELETE[SIX_ALARM], &AlarmPresenter::ClickDeleteButtonAlarmClockDelete}, +}; + bool AlarmPresenter::OnClick(UIView &view, const ClickEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnClick "); + + uint16_t num; + for (num = 0; num < CLOCK_NUM; num++) + { + if (0 == strcmp(view.GetViewId(), ALARM_ITEM_DELETE[num])) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[@CHENG][%d]:%d", __LINE__, num); + (this->*(DeleteButtonPresentMapper[num].func))(num); + return true; + } + } + bool jug = ClickFuncId(view.GetViewId()); if (!jug) { ClickFuncView(view); diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmSetTimeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmSetTimeView.cpp index be9ff6075..91fce4d83 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmSetTimeView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmSetTimeView.cpp @@ -22,7 +22,7 @@ constexpr int16_t CONTAINER_Y = 0; constexpr int16_t TITLE_X = 153; constexpr int16_t TITLE_Y = 30; constexpr int16_t LABEL_X = 0; -constexpr int16_t LABEL_Y = 30; +constexpr int16_t LABEL_Y = 45; // 30; constexpr int16_t LABEL_FONT = 40; constexpr int16_t TIME_PICKER_X = 75; constexpr int16_t TIME_PICKER_WIDTH = 250; @@ -31,7 +31,7 @@ constexpr int16_t TIME_LABEL_BUTTON_X = 63; constexpr int16_t TIME_LABEL_BUTTON_Y = 360; constexpr int16_t LABEL_BLANK = 38; constexpr int16_t LIST_W = 300; -constexpr int16_t LIST_H = 250; +constexpr int16_t LIST_H = 260; // 250; constexpr int16_t TITLE_LABEL_DEFAULT_HEIGHT = 50; constexpr int16_t BUTTON_WIDHT3 = 320; constexpr int16_t BUTTON_HEIGHT3 = 101; @@ -48,15 +48,30 @@ AlarmSetTimeView::AlarmSetTimeView() AlarmSetTimeView::~AlarmSetTimeView() { - group->RemoveAll(); - delete timeImage; - timeImage = nullptr; - delete picker; - picker = nullptr; - delete title; - title = nullptr; - delete group; - group = nullptr; + if(nullptr != group) + { + group->RemoveAll(); + // delete timeImage; + // timeImage = nullptr; + if(nullptr != labelButton) + { + delete labelButton; + labelButton = nullptr; + } + if(nullptr != picker) + { + delete picker; + picker = nullptr; + } + if(nullptr != title) + { + delete title; + title = nullptr; + } + + delete group; + group = nullptr; + } g_pAlarmSetTimeView = nullptr; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView::~AlarmSetTimeView"); } @@ -85,25 +100,44 @@ UILabel *AlarmSetTimeView::GetTitleLabel(const char *titleName) void AlarmSetTimeView::SetLabelButton(void) { - timeImage = new UILabelButton(); - if (timeImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new timeImage fail"); - return; - } - timeImage->SetPosition(TIME_LABEL_BUTTON_X, TIME_LABEL_BUTTON_Y, BUTTON_WIDHT3, BUTTON_HEIGHT3); - timeImage->SetText(SURE); - timeImage->SetTouchable(true); - timeImage->SetViewId(ALARM_OK); - if (OHOS::AlarmPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView:: new ShadowBlue fail"); - return; + // timeImage = new UILabelButton(); + // if (timeImage == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new timeImage fail"); + // return; + // } + // timeImage->SetPosition(TIME_LABEL_BUTTON_X, TIME_LABEL_BUTTON_Y, BUTTON_WIDHT3, BUTTON_HEIGHT3); + // timeImage->SetText(SURE); + // timeImage->SetTouchable(true); + // timeImage->SetViewId(ALARM_OK); + // if (OHOS::AlarmPresenter::GetInstance() == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView:: new ShadowBlue fail"); + // return; + // } + // timeImage->SetTextColor(OHOS::AlarmPresenter::GetInstance()->ShadowBlue()); + // timeImage->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_TIME_FONT); + // UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); + // timeImage->SetOnClickListener(clickListener); + // timeImage->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE); + // group->Add(timeImage); + + + labelButton = new UILabelButton(); + if (labelButton == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView::SetLabelButton"); + return ; } - timeImage->SetTextColor(OHOS::AlarmPresenter::GetInstance()->ShadowBlue()); - timeImage->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_TIME_FONT); + + labelButton->SetPosition(0, 366, 466, 100); + labelButton->SetViewId(ALARM_OK); + labelButton->SetText(SURE); + labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + labelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + labelButton->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE); + labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED); + labelButton->SetTouchable(true); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); - timeImage->SetOnClickListener(clickListener); - timeImage->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE); - group->Add(timeImage); + labelButton->SetOnClickListener(clickListener); + group->Add(labelButton); } UIScrollView *AlarmSetTimeView::InitSetTimeView(void) @@ -123,7 +157,12 @@ UIScrollView *AlarmSetTimeView::InitSetTimeView(void) return nullptr; } group->Add(title); - title->SetPosition(TITLE_X, TITLE_Y); // 672: x-coordinate + // title->SetPosition(TITLE_X, TITLE_Y); // 672: x-coordinate + title->SetPosition(83, 50, 300, 35); + title->SetStyle(STYLE_TEXT_FONT, 30); + title->SetStyle(STYLE_LINE_HEIGHT, 35); + title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); title->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); picker = new UITimePicker(); if (picker == nullptr) { @@ -139,8 +178,11 @@ UIScrollView *AlarmSetTimeView::InitSetTimeView(void) picker->EnableSecond(false); picker->SetPosition(TIME_PICKER_X, LABEL_Y + LABEL_BLANK, LIST_W, LIST_H); // 652: x-coordinate picker->SetItemHeight(TIME_ITEM_HEIGHT); - picker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, BACKGROUND_FONT); - picker->SetHighlightFont(DEFAULT_VECTOR_FONT_FILENAME, HIGHTLIGHT_FONT); + // picker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, BACKGROUND_FONT); + // picker->SetHighlightFont(DEFAULT_VECTOR_FONT_FILENAME, HIGHTLIGHT_FONT); + picker->SetHighlightFont(GILROY_BOLD_FONT, 65); // 设置突出显示文本的字体名称和大小。 + picker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, 50); + picker->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); picker->SetLoopState(0, true); picker->SetLoopState(1, true); picker->SetTouchable(true); diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/MainAlarmView.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/MainAlarmView.cpp index f2611d0d6..0234beab0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/MainAlarmView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/MainAlarmView.cpp @@ -219,7 +219,6 @@ UIViewGroup * MainAlarmView::NewClockCtlExt(int16_t alarmNum, uint8_t index) TempGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); TempGroup_->SetStyle(STYLE_BORDER_RADIUS, 100); - // UIView::OnClickListener *clockListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); dClock[alarmNum] = new UIDigitalClock(); if (dClock[alarmNum] == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new dClock fail"); @@ -227,7 +226,8 @@ UIViewGroup * MainAlarmView::NewClockCtlExt(int16_t alarmNum, uint8_t index) } dClock[alarmNum]->SetViewId(ALARM_CLOCK[alarmNum]); dClock[alarmNum]->SetTouchable(true); - // dClock[alarmNum]->SetOnClickListener(clockListener); + UIView::OnClickListener *clockListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); + dClock[alarmNum]->SetOnClickListener(clockListener); dClock[alarmNum]->SetPosition(50, 10, 110, 50); dClock[alarmNum]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, D_CLOCK_FONT_SIZE); dClock[alarmNum]->SetDisplayMode(UIDigitalClock::DISPLAY_24_HOUR_NO_SECONDS); @@ -267,8 +267,8 @@ UIViewGroup * MainAlarmView::NewClockCtlExt(int16_t alarmNum, uint8_t index) } else { - TempGroup_->SetPosition(0, 0, 100 + 10, 100); - TempGroup_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); + TempGroup_->SetPosition(0, 0, 100 + 15, 100); + TempGroup_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); TempGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); TempGroup_->SetStyle(STYLE_BORDER_RADIUS, 100); @@ -276,7 +276,7 @@ UIViewGroup * MainAlarmView::NewClockCtlExt(int16_t alarmNum, uint8_t index) if(nullptr == DeleteButton_[alarmNum]) return nullptr; - DeleteButton_[alarmNum]->SetPosition(10, 0, 100, 100); + DeleteButton_[alarmNum]->SetPosition(15, 0, 100, 100); DeleteButton_[alarmNum]->SetViewId(ALARM_ITEM_DELETE[alarmNum]); DeleteButton_[alarmNum]->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); DeleteButton_[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, 25); // 10% @@ -309,7 +309,7 @@ void MainAlarmView::NewClockCtl(int16_t alarmNum) SwipeView_[alarmNum]->SetOnSwipeListener(presenter_); SwipeView_[alarmNum]->SetAnimatorTime(50); // 200:animator drag time(ms) // SwipeView_[alarmNum]->SetOnDragListener(presenter_); - SwipeView_[alarmNum]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); + SwipeView_[alarmNum]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); SwipeView_[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); SwipeView_[alarmNum]->SetStyle(STYLE_BORDER_RADIUS, 100); // SwipeView_[alarmNum]->SetBlankSize(0); @@ -317,10 +317,17 @@ void MainAlarmView::NewClockCtl(int16_t alarmNum) // SwipeView_[alarmNum]->SetElastic(true); SwipeViewItem_[alarmNum][0] = NewClockCtlExt(alarmNum, 0); - SwipeViewItem_[alarmNum][1] = NewClockCtlExt(alarmNum, 1); - SwipeView_[alarmNum]->Add(SwipeViewItem_[alarmNum][0]); - SwipeView_[alarmNum]->Add(SwipeViewItem_[alarmNum][1]); + if(0 != alarmNum) + { + SwipeViewItem_[alarmNum][1] = NewClockCtlExt(alarmNum, 1); + SwipeView_[alarmNum]->Add(SwipeViewItem_[alarmNum][1]); + } + // SwipeViewItem_[alarmNum][0] = NewClockCtlExt(alarmNum, 0); + // SwipeViewItem_[alarmNum][1] = NewClockCtlExt(alarmNum, 1); + + // SwipeView_[alarmNum]->Add(SwipeViewItem_[alarmNum][0]); + // SwipeView_[alarmNum]->Add(SwipeViewItem_[alarmNum][1]); SwipeView_[alarmNum]->SetCurrentPage(0); SwipeView_[alarmNum]->SetIntercept(false); @@ -381,6 +388,8 @@ void MainAlarmView::RefreshAlarmStatus(uint8_t alarmEnable, int16_t num) reflashStatus = false; dClock[num]->SetVisible(true); statusButton[num]->SetVisible(true); + + SwipeView_[num]->SetCurrentPage(0); } void MainAlarmView::OnStart() @@ -590,7 +599,7 @@ bool MainAlarmView::ChangeSetWeek(int16_t thisView) bool MainAlarmView::ChangeJudge(int16_t thisView) { if (container[thisView] == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainAlarmView::AlarmSetWeekView"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainAlarmView::ChangeJudge"); judgeView = new AlarmJudgeView(); if (judgeView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new container[%d] fail", thisView); diff --git a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp index 546a190f3..6cd8b2832 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/schedule/src/ScheduleView.cpp @@ -672,7 +672,7 @@ namespace OHOS DeleteTitleLabelExt_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); DeleteTitleLabelExt_->SetRollSpeed(70); DeleteTitleLabelExt_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - DeleteTitleLabelExt_->SetStyle(STYLE_TEXT_COLOR, 0xffff5a36); + DeleteTitleLabelExt_->SetStyle(STYLE_TEXT_COLOR, Color::White().full); } if(nullptr == DeletePromptLabelExt_) @@ -689,7 +689,7 @@ namespace OHOS DeletePromptLabelExt_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); DeletePromptLabelExt_->SetRollSpeed(70); DeletePromptLabelExt_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - DeletePromptLabelExt_->SetStyle(STYLE_TEXT_COLOR, Color::White().full); + DeletePromptLabelExt_->SetStyle(STYLE_TEXT_COLOR, 0xff999999); } if(nullptr == DeleteCancelButton_) -- 2.17.1