闹钟界面修改:闹钟列表、新建闹钟设置时间星期 821/1 821/head 822/target/1 823/target/1
authorcheng <chengyf@zhihuishixun.com>
Thu, 29 Aug 2024 03:46:46 +0000 (11:46 +0800)
committercheng <chengyf@zhihuishixun.com>
Thu, 29 Aug 2024 03:46:46 +0000 (11:46 +0800)
code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmPresenter.h
code/sdk/application/wearable/fd230app/nativeui/alarm/include/MainAlarmView.h
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmNewTimeView.cpp
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmSetWeekView.cpp
code/sdk/application/wearable/fd230app/nativeui/alarm/src/MainAlarmView.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Alarm/alarm_delete.bin [new file with mode: 0644]

index af32345..b572a51 100644 (file)
@@ -25,6 +25,7 @@
 #include "components/ui_label_button.h"\r
 #include "components/ui_time_picker.h"\r
 #include "components/ui_digital_clock.h"\r
+#include "components/ui_swipe_view.h"\r
 #include "gfx_utils/graphic_log.h"\r
 #include "AlarmClockModel.h"\r
 #include "wearable_log.h"\r
@@ -84,6 +85,16 @@ constexpr char* ALARM_CLOCK[6] = {ALARM_CLOCK_ONE, ALARM_CLOCK_TWO, ALARM_CLOCK_
     ALARM_CLOCK_FOUR, ALARM_CLOCK_FIVE, ALARM_CLOCK_SIX};\r
 constexpr char* WEEK_CONTAINER[7] = {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY}; // 日期按钮最大个数为7个\r
 \r
+\r
+constexpr char * ALARM_ITEM_DELETE_00 = (char *)"ALARM_ITEM_DELETE_00";\r
+constexpr char * ALARM_ITEM_DELETE_01 = (char *)"ALARM_ITEM_DELETE_01";\r
+constexpr char * ALARM_ITEM_DELETE_02 = (char *)"ALARM_ITEM_DELETE_02";\r
+constexpr char * ALARM_ITEM_DELETE_03 = (char *)"ALARM_ITEM_DELETE_03";\r
+constexpr char * ALARM_ITEM_DELETE_04 = (char *)"ALARM_ITEM_DELETE_04";\r
+constexpr char * ALARM_ITEM_DELETE_05 = (char *)"ALARM_ITEM_DELETE_05";\r
+constexpr char * ALARM_ITEM_DELETE[6] = {ALARM_ITEM_DELETE_00, ALARM_ITEM_DELETE_01, ALARM_ITEM_DELETE_02, \r
+                                            ALARM_ITEM_DELETE_03, ALARM_ITEM_DELETE_04, ALARM_ITEM_DELETE_05};\r
+\r
 typedef enum {\r
     MAIN_INTERFACE = 0,\r
     CHANGE_INTERFACE_CONFIG,\r
@@ -116,7 +127,7 @@ private:
 \r
 class MainAlarmView;\r
 class AlarmPresenter : public Presenter<MainAlarmView>, public UIView::OnClickListener, public RootView::OnKeyActListener, \r
- public UITimePicker::SelectedListener, public UIView::OnDragListener {\r
+ public UITimePicker::SelectedListener, public UIView::OnDragListener, public UISwipeView::OnSwipeListener {\r
 public:\r
     AlarmPresenter();\r
     ~AlarmPresenter() override;\r
@@ -131,6 +142,7 @@ public:
     bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件\r
     bool OnClick(UIView &view, const ClickEvent &event) override;\r
     bool OnDrag(UIView& view, const DragEvent& event) override;\r
+    void OnSwipe(UISwipeView &view) override;\r
     bool ClickFuncId(const char *buttonName);\r
     bool ClickFuncView(UIView &view);\r
     void OnTimePickerStoped(UITimePicker &picker) override;\r
index 9140a47..6deb8aa 100644 (file)
@@ -21,6 +21,8 @@
 #include "ChangeSliceListener.h"
 #include "components/ui_digital_clock.h"
 #include "components/ui_toggle_button.h"
+#include "components/ui_swipe_view.h"
+#include "components/ui_label_button_ext.h"
 #include "AlarmPresenter.h"
 #include "AlarmSetTimeView.h"
 #include "AlarmSetWeekView.h"
@@ -33,7 +35,7 @@
 namespace OHOS {
 constexpr int16_t D_CLOCK_Y = 210;
 constexpr int16_t LABEL_ZERO_Y = 270;
-constexpr int16_t ALARM_INTER_ADD = 150;
+constexpr int16_t ALARM_INTER_ADD = 130; // 150;
 
 class AlarmPresenter;
 class MainAlarmView : public View<AlarmPresenter> {
@@ -47,7 +49,7 @@ public:
     void OnStop() override;
     void ChangeView(int16_t hideView, int16_t showView);
     void DropView(UIView& view);
-    void CreateImage();
+    // void CreateImage();
     void RefreshAlarm(void);
     bool ChangeMainAlarm(int16_t thisView);
     bool ChangeConfig(int16_t thisView);
@@ -62,6 +64,11 @@ private:
     void LabelGetWeek(uint8_t week, int16_t alarmNum);
     void RefreshAlarmStatus(uint8_t alarmEnable, int16_t num);
     void NewClockCtl(int16_t alarmNum);
+    UIViewGroup * NewClockCtlExt(int16_t alarmNum, uint8_t index);
+    void AlarmTitleCreate(void);
+    void AlarmAddButtonCreate(void);
+    void AlarmAddButtonUpdate(uint8_t count);
+
     AlarmConfigView *configView{nullptr};
     AlarmSetTimeView *setTimeView{nullptr};
     AlarmSetWeekView *setWeekView{nullptr};
@@ -69,8 +76,11 @@ private:
     AlarmNewTimeView *newTimeView{nullptr};
     AlarmMaxClock *maxClockView{nullptr};
     UIScrollView *group{nullptr};
+    UISwipeView * SwipeView_[6]{nullptr};
+    UIViewGroup * SwipeViewItem_[6][2]{nullptr};
+    UILabelButtonExt * DeleteButton_[6]{nullptr};
     UIToggleButton *statusButton[6]{nullptr}; // 6代表界面中最多存在六个按键
-    UIImageView *addButton{nullptr};
+    // UIImageView *addButton{nullptr};
     UIDigitalClock *dClock[6]{nullptr}; // 6代表界面中最多存在六个闹钟
     UILabel *dLabel[6]{nullptr}; // 6代表界面中显示闹钟日期的控件个数
     UIScrollView *container[7]{nullptr}; // 7代表容器存有主界面以及跳转的四个副界面,用于跳转后显示或隐藏界面
@@ -81,6 +91,10 @@ private:
     int16_t labelPositionY{LABEL_ZERO_Y};
     int16_t alarmInterval{ALARM_INTER_ADD};
     bool reflashStatus{false};
+    UILabelExt * TitleLabelExt_{nullptr}; 
+    UILabelButtonExt * AddButton_{nullptr};
+
+    #define ALARM_DELETE_IMAGE "/user/res/Alarm/alarm_delete.bin"
 };
 } // namespace OHOS
 #endif // MAIN_ALARM_VIEW_Ha
\ No newline at end of file
index 55db62d..65faf0c 100644 (file)
@@ -16,7 +16,8 @@
 \r
 namespace OHOS {\r
 #ifndef NEW_TIME\r
-#define NEW_TIME "设置时间"\r
+// #define NEW_TIME "设置时间"\r
+#define NEW_TIME "时间"\r
 #endif\r
 #define NEXT "下一步"\r
 \r
@@ -45,7 +46,7 @@ constexpr uint16_t LABEL_FONT = 40;
 \r
 AlarmNewTimeView::AlarmNewTimeView()\r
 {\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::AlarmNewTimeView");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::AlarmNewTimeView");\r
     g_pAlarmNewTimeView = this;\r
 }\r
 \r
@@ -61,7 +62,7 @@ AlarmNewTimeView::~AlarmNewTimeView()
     delete group;\r
     group = nullptr;\r
     g_pAlarmNewTimeView = nullptr;\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::~AlarmNewTimeView");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::~AlarmNewTimeView");\r
 }\r
 \r
 AlarmNewTimeView *AlarmNewTimeView::GetInstance(void)\r
@@ -94,7 +95,13 @@ void AlarmNewTimeView::CreateLabelTime(void)
         return;\r
     }\r
     group->Add(title);\r
-    title->SetPosition(TITLE_X, TITLE_Y); // 672: x-coordinate\r
+    // title->SetPosition(TITLE_X, TITLE_Y); // 672: x-coordinate\r
+    title->SetPosition(83, 50, 300, 35);\r
+    title->SetStyle(STYLE_TEXT_FONT, 30);\r
+    title->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+    title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+    title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+\r
     title->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);\r
     picker = new UITimePicker();\r
     if (picker == nullptr) {\r
@@ -113,15 +120,18 @@ void AlarmNewTimeView::CreateLabelTime(void)
     picker->SetItemHeight(TIME_ITEM_HEIGHT);\r
     picker->SetLoopState(0, true);\r
     picker->SetLoopState(1, true);\r
-    picker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, BACKGROUND_FONT);\r
-    picker->SetHighlightFont(DEFAULT_VECTOR_FONT_FILENAME, HIGHTLIGHT_FONT);\r
+    // picker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, BACKGROUND_FONT);\r
+    // picker->SetHighlightFont(DEFAULT_VECTOR_FONT_FILENAME, HIGHTLIGHT_FONT);\r
+    picker->SetHighlightFont(GILROY_BOLD_FONT, 65);                    // 设置突出显示文本的字体名称和大小。\r
+    picker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, 50); \r
+    picker->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));\r
     picker->RegisterSelectedListener(selectedListener);\r
     group->Add(picker);\r
 }\r
 \r
 UIScrollView *AlarmNewTimeView::InitNewTimeView(void)\r
 {\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::OnStart");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::OnStart");\r
     group = new UIScrollView();\r
     if (group == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView:: new group fail");\r
@@ -138,18 +148,28 @@ UIScrollView *AlarmNewTimeView::InitNewTimeView(void)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView:: new labelButton fail");\r
         return group;\r
     }\r
-    labelButton->Resize(BUTTON_WIDHT3, BUTTON_HEIGHT3);\r
-    labelButton->SetPosition(TIME_LABEL_BUTTON_X, TIME_LABEL_BUTTON_Y);\r
-    labelButton->SetText(NEXT);\r
+    // labelButton->Resize(BUTTON_WIDHT3, BUTTON_HEIGHT3);\r
+    // labelButton->SetPosition(TIME_LABEL_BUTTON_X, TIME_LABEL_BUTTON_Y);\r
+    // labelButton->SetText(NEXT);\r
+    // labelButton->SetViewId(ALARM_NEXT);\r
+    // labelButton->SetTouchable(true);\r
+    // labelButton->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE);\r
+    // labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT);\r
+\r
+    labelButton->SetPosition(0, 366, 466, 100);\r
     labelButton->SetViewId(ALARM_NEXT);\r
+    labelButton->SetText(NEXT);\r
+    labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+    labelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));\r
+    labelButton->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE);\r
+    labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED);\r
     labelButton->SetTouchable(true);\r
-    labelButton->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE);\r
-    labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT);\r
+\r
     if (OHOS::AlarmPresenter::GetInstance() == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView:: new ShadowBlue fail");\r
         return group;\r
     }\r
-    labelButton->SetTextColor(OHOS::AlarmPresenter::GetInstance()->ShadowBlue());\r
+    // labelButton->SetTextColor(OHOS::AlarmPresenter::GetInstance()->ShadowBlue());\r
     UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance();\r
     labelButton->SetOnClickListener(clickListener);\r
     group->Add(labelButton);\r
@@ -166,7 +186,7 @@ UIScrollView *AlarmNewTimeView::InitNewTimeView(void)
 \r
 void AlarmNewTimeView::RefreshNewTime(void)\r
 {\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::RefreshStep");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::RefreshStep");\r
     struct tm local_time;\r
     time_t seconds = time(nullptr);\r
     if (localtime_r(&seconds, &local_time) == nullptr) {\r
@@ -178,7 +198,7 @@ void AlarmNewTimeView::RefreshNewTime(void)
     ostrHour << local_time.tm_hour;\r
     ostMin << local_time.tm_min;\r
     std::string weekStr = ostrHour.str() + ":" + ostMin.str();\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "time = %s!", weekStr.c_str());\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "time = %s!", weekStr.c_str());\r
     picker->SetSelected(weekStr.c_str()); // 添加的时间默认初始时间为0点\r
     uint32_t timeHour = stoi(ostrHour.str());\r
     uint32_t timeMin = stoi(ostMin.str());\r
index 37f304c..f112e54 100644 (file)
@@ -415,14 +415,20 @@ bool AlarmPresenter::ClickFuncView(UIView &view)
             alarmWeek[num] = alarmWeek[num] ? CANCEL_DATA: SELECT_DATA;\r
             if (alarmWeek[num] == CANCEL_DATA) {\r
                 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "alarmWeek[num] = %u", alarmWeek[num]);\r
-                view.SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
+                // view.SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
+                // dynamic_cast<UIButton &>(view).SetStyleForState(STYLE_BACKGROUND_COLOR,\r
+                //                                                 Color::Black().full, UIButton::PRESSED);\r
+                view.SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x19, 0x19, 0x19).full);\r
                 dynamic_cast<UIButton &>(view).SetStyleForState(STYLE_BACKGROUND_COLOR,\r
-                                                                Color::Black().full, UIButton::PRESSED);\r
+                                                                Color::GetColorFromRGB(0x19, 0x19, 0x19).full, UIButton::PRESSED);                \r
             } else if (alarmWeek[num] == SELECT_DATA) {\r
                 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "alarmWeek[num] = %u", alarmWeek[num]);\r
-                view.SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+                // view.SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+                // dynamic_cast<UIButton &>(view).SetStyleForState(STYLE_BACKGROUND_COLOR,\r
+                //                                                 Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full, UIButton::PRESSED);\r
+                view.SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x4f, 0xc3, 0x4c).full);\r
                 dynamic_cast<UIButton &>(view).SetStyleForState(STYLE_BACKGROUND_COLOR,\r
-                                                                Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full, UIButton::PRESSED);\r
+                                                                Color::GetColorFromRGB(0x4f, 0xc3, 0x4c).full, UIButton::PRESSED);                                    \r
             }\r
         }\r
     }\r
@@ -475,4 +481,11 @@ bool AlarmStatusBtnChangeListener::OnChange(UICheckBox::UICheckBoxState state)
     return true;\r
 }\r
 \r
+void AlarmPresenter::OnSwipe(UISwipeView &view)\r
+{\r
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnSwipe ");\r
+    UNUSED(view);\r
+\r
+    return;\r
+}\r
 }
\ No newline at end of file
index 397430b..d07ae4d 100644 (file)
 #include "components/ui_digital_clock.h"\r
 \r
 namespace OHOS {\r
-#define MON "星期一"\r
-#define TUE "星期二"\r
-#define WED "星期三"\r
-#define THUR "星期四"\r
-#define FRI "星期五"\r
-#define SAT "星期六"\r
-#define SUN "星期天"\r
+// #define MON "星期一"\r
+// #define TUE "星期二"\r
+// #define WED "星期三"\r
+// #define THUR "星期四"\r
+// #define FRI "星期五"\r
+// #define SAT "星期六"\r
+// #define SUN "星期天"\r
+#define MON "一"\r
+#define TUE "二"\r
+#define WED "三"\r
+#define THUR "四"\r
+#define FRI "五"\r
+#define SAT "六"\r
+#define SUN "日"\r
 #define RESPEAT "重复"\r
 #define SURE "确认"\r
 \r
@@ -48,15 +55,15 @@ constexpr int16_t TIME_LABEL_BUTTON_Y = 360;
 constexpr int16_t BUTTON_WIDHT3 = 320;\r
 constexpr int16_t BUTTON_HEIGHT3 = 101;\r
 constexpr int16_t LABEL_WEEK_FONT = 40;\r
-constexpr int16_t BUTTON_WIDHT = 100;\r
-constexpr int16_t BUTTON_HEIGHT = 60;\r
+constexpr int16_t BUTTON_WIDHT = 80; // 100;\r
+constexpr int16_t BUTTON_HEIGHT = 80; // 60;\r
 constexpr int16_t BUTTON_FONT = 20;\r
-constexpr int16_t VIEW_POSITION_X = 60;\r
-constexpr int16_t VIEW_POSITION_X2 = 12;\r
-constexpr int16_t WEEK_Y1 = 130;\r
-constexpr int16_t WEEK_Y2 = 210;\r
-constexpr int16_t WEEK_GAP_X = 112;\r
-constexpr int16_t BUTTON_STYLE_BORDER_RADIUS_VALUE = 30;\r
+constexpr int16_t VIEW_POSITION_X = 27; // 60;\r
+constexpr int16_t VIEW_POSITION_X2 = 83; // 12;\r
+constexpr int16_t WEEK_Y1 = 135; // 130;\r
+constexpr int16_t WEEK_Y2 = 245; // 210;\r
+constexpr int16_t WEEK_GAP_X = 110; // 112;\r
+constexpr int16_t BUTTON_STYLE_BORDER_RADIUS_VALUE = 100; // 30;\r
 constexpr int16_t FONT_DEFAULT_SIZE = 30;\r
 constexpr int16_t WEEK_MON = 1;\r
 constexpr int16_t WEEK_TUE = 2;\r
@@ -66,9 +73,13 @@ constexpr int16_t WEEK_FRI = 5;
 constexpr int16_t WEEK_SAT = 6;\r
 constexpr int16_t WEEK_SUN = 0;\r
 \r
+#define DEFAULT_BG_COLOR (Color::GetColorFromRGB(0x19, 0x19, 0x19))\r
+#define SELECTED_BG_COLOR (Color::GetColorFromRGB(0x4f, 0xc3, 0x4c))\r
+\r
+\r
 AlarmSetWeekView::AlarmSetWeekView()\r
 {\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::AlarmSetWeekView");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::AlarmSetWeekView");\r
     g_pAlarmSetWeekView = this;\r
 }\r
 \r
@@ -86,7 +97,7 @@ AlarmSetWeekView::~AlarmSetWeekView()
     delete group;\r
     group = nullptr;\r
     g_pAlarmSetWeekView = nullptr;\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::~AlarmSetWeekView");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::~AlarmSetWeekView");\r
 }\r
 \r
 AlarmSetWeekView *AlarmSetWeekView::GetInstance(void)\r
@@ -113,18 +124,26 @@ UILabelButton *AlarmSetWeekView::CreateUILabelButton(const char *buttonText, int
     labelButton->SetStyleForState(STYLE_BORDER_RADIUS, BUTTON_STYLE_BORDER_RADIUS_VALUE, UIButton::PRESSED);\r
     labelButton->SetStyleForState(STYLE_BORDER_RADIUS, BUTTON_STYLE_BORDER_RADIUS_VALUE, UIButton::INACTIVE);\r
     labelButton->SetStyleForState(STYLE_BORDER_RADIUS, BUTTON_STYLE_BORDER_RADIUS_VALUE, UIButton::RELEASED);\r
-    labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::RELEASED);\r
-    labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
-    labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::INACTIVE);\r
+    // labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::RELEASED);\r
+    // labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    // labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::INACTIVE);\r
+    labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::RELEASED);\r
+    labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
+    labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::INACTIVE);\r
     labelButton->SetStyleForState(STYLE_BORDER_WIDTH, VIEW_BORDER_SIZE, UIButton::RELEASED);\r
     labelButton->SetStyleForState(STYLE_BORDER_WIDTH, VIEW_BORDER_SIZE, UIButton::PRESSED);\r
     labelButton->SetStyleForState(STYLE_BORDER_WIDTH, VIEW_BORDER_SIZE, UIButton::INACTIVE);\r
-    labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::White().full, UIButton::RELEASED);\r
-    labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::White().full, UIButton::PRESSED);\r
-    labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::White().full, UIButton::INACTIVE);\r
-    labelButton->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+    // labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::White().full, UIButton::RELEASED);\r
+    // labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::White().full, UIButton::PRESSED);\r
+    // labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::White().full, UIButton::INACTIVE);\r
+    labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::Black().full, UIButton::RELEASED);\r
+    labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    labelButton->SetStyleForState(STYLE_BORDER_COLOR, Color::Black().full, UIButton::INACTIVE);\r
+    // labelButton->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+    labelButton->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
     labelButton->SetStyle(STYLE_BORDER_WIDTH, VIEW_BORDER_SIZE);\r
-    labelButton->SetStyle(STYLE_BORDER_COLOR, Color::White().full);\r
+    // labelButton->SetStyle(STYLE_BORDER_COLOR, Color::White().full);\r
+    labelButton->SetStyle(STYLE_BORDER_COLOR, Color::Black().full);\r
     labelButton->Resize(BUTTON_WIDHT, BUTTON_HEIGHT);\r
 \r
     return labelButton;\r
@@ -134,6 +153,17 @@ void AlarmSetWeekView::CreateWeekButton1(void)
 {\r
     int viewPositionX = VIEW_POSITION_X;   // 60 150\r
     UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance();\r
+\r
+    buttonWeek[WEEK_SUN] = CreateUILabelButton(SUN, viewPositionX, WEEK_Y1);\r
+    if (buttonWeek[WEEK_SUN] == nullptr) {\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView:: new buttonSun fail");\r
+        return;\r
+    }\r
+    group->Add(buttonWeek[WEEK_SUN]);\r
+    buttonWeek[WEEK_SUN]->SetOnClickListener(clickListener);\r
+    buttonWeek[WEEK_SUN]->SetViewId(SUNDAY);\r
+    viewPositionX += WEEK_GAP_X;\r
+\r
     buttonWeek[WEEK_MON] = CreateUILabelButton(MON, viewPositionX, WEEK_Y1);\r
     if (buttonWeek[WEEK_MON] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView:: new buttonMon fail");\r
@@ -199,14 +229,14 @@ void AlarmSetWeekView::CreateWeekButton2(void)
     buttonWeek[WEEK_SAT]->SetViewId(SATURDAY);\r
     viewPositionX2 += WEEK_GAP_X;\r
 \r
-    buttonWeek[WEEK_SUN] = CreateUILabelButton(SUN, viewPositionX2, WEEK_Y2);\r
-    if (buttonWeek[WEEK_SUN] == nullptr) {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView:: new buttonSun fail");\r
-        return;\r
-    }\r
-    group->Add(buttonWeek[WEEK_SUN]);\r
-    buttonWeek[WEEK_SUN]->SetOnClickListener(clickListener);\r
-    buttonWeek[WEEK_SUN]->SetViewId(SUNDAY);\r
+    // buttonWeek[WEEK_SUN] = CreateUILabelButton(SUN, viewPositionX2, WEEK_Y2);\r
+    // if (buttonWeek[WEEK_SUN] == nullptr) {\r
+    //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView:: new buttonSun fail");\r
+    //     return;\r
+    // }\r
+    // group->Add(buttonWeek[WEEK_SUN]);\r
+    // buttonWeek[WEEK_SUN]->SetOnClickListener(clickListener);\r
+    // buttonWeek[WEEK_SUN]->SetViewId(SUNDAY);\r
 }\r
 \r
 void AlarmSetWeekView::SetLabelButton(void)\r
@@ -221,24 +251,34 @@ void AlarmSetWeekView::SetLabelButton(void)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: new weekImage fail");\r
         return;\r
     }\r
-    weekImage->SetPosition(TIME_LABEL_BUTTON_X, TIME_LABEL_BUTTON_Y, BUTTON_WIDHT3, BUTTON_HEIGHT3);\r
+    // weekImage->SetPosition(TIME_LABEL_BUTTON_X, TIME_LABEL_BUTTON_Y, BUTTON_WIDHT3, BUTTON_HEIGHT3);\r
+    // weekImage->SetText(SURE);\r
+    // weekImage->SetTouchable(true);\r
+    // weekImage->SetViewId(ALARM_WEEK_OK);\r
+    // weekImage->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_WEEK_FONT);\r
+\r
+    weekImage->SetPosition(0, 366, 466, 100);\r
+    weekImage->SetViewId(ALARM_WEEK_OK);\r
     weekImage->SetText(SURE);\r
+    weekImage->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+    weekImage->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));\r
+    weekImage->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE);\r
+    weekImage->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED);\r
     weekImage->SetTouchable(true);\r
-    weekImage->SetViewId(ALARM_WEEK_OK);\r
-    weekImage->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_WEEK_FONT);\r
+\r
     if (OHOS::AlarmPresenter::GetInstance() == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView:: new ShadowBlue fail");\r
         return;\r
     }\r
-    weekImage->SetTextColor(OHOS::AlarmPresenter::GetInstance()->ShadowBlue());\r
+    // weekImage->SetTextColor(OHOS::AlarmPresenter::GetInstance()->ShadowBlue());\r
     weekImage->SetOnClickListener(clickListener);\r
-    weekImage->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE);\r
+    // weekImage->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE);\r
     group->Add(weekImage);\r
 }\r
 \r
 UIScrollView *AlarmSetWeekView::InitSetWeekView()\r
 {\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::InitSetWeekView");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::InitSetWeekView");\r
 \r
     group = new UIScrollView();\r
     if (group == nullptr) {\r
@@ -254,8 +294,13 @@ UIScrollView *AlarmSetWeekView::InitSetWeekView()
     }\r
     group->Add(labelRespeat);\r
     labelRespeat->SetText(RESPEAT);\r
-    labelRespeat->SetFont(DEFAULT_VECTOR_FONT_FILENAME, DEFAULT_FONT);\r
-    labelRespeat->SetPosition(TITLE_X, TITLE_Y, HORIZONTAL_RESOLUTION / 2, LABEL_POSITION_SIZE);\r
+    // labelRespeat->SetFont(DEFAULT_VECTOR_FONT_FILENAME, DEFAULT_FONT);\r
+    // labelRespeat->SetPosition(TITLE_X, TITLE_Y, HORIZONTAL_RESOLUTION / 2, LABEL_POSITION_SIZE);\r
+    labelRespeat->SetPosition(83, 50, 300, 35);\r
+    labelRespeat->SetStyle(STYLE_TEXT_FONT, 30);\r
+    labelRespeat->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+    labelRespeat->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+    labelRespeat->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
 \r
     CreateWeekButton1();\r
     CreateWeekButton2();\r
@@ -274,49 +319,51 @@ UIScrollView *AlarmSetWeekView::InitSetWeekView()
 \r
 void AlarmSetWeekView::RefreshSetWeek1(void)\r
 {\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1");\r
     if (buttonWeek[WEEK_MON] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1 buttonMon nullptr error!");\r
         return;\r
     }\r
-    buttonWeek[WEEK_MON]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
-    buttonWeek[WEEK_MON]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    // buttonWeek[WEEK_MON]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
+    // buttonWeek[WEEK_MON]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    buttonWeek[WEEK_MON]->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
+    buttonWeek[WEEK_MON]->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
     if (buttonWeek[WEEK_TUE] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1 buttonTue nullptr error!");\r
         return;\r
     }\r
-    buttonWeek[WEEK_TUE]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
-    buttonWeek[WEEK_TUE]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    buttonWeek[WEEK_TUE]->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
+    buttonWeek[WEEK_TUE]->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
     if (buttonWeek[WEEK_WED] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1 buttonWed nullptr error!");\r
         return;\r
     }\r
-    buttonWeek[WEEK_WED]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
-    buttonWeek[WEEK_WED]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    buttonWeek[WEEK_WED]->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
+    buttonWeek[WEEK_WED]->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
     if (buttonWeek[WEEK_THUR] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1 buttonThur nullptr error!");\r
         return;\r
     }\r
-    buttonWeek[WEEK_THUR]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
-    buttonWeek[WEEK_THUR]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    buttonWeek[WEEK_THUR]->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
+    buttonWeek[WEEK_THUR]->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
     if (buttonWeek[WEEK_FRI] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1 buttonFri nullptr error!");\r
         return;\r
     }\r
-    buttonWeek[WEEK_FRI]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
-    buttonWeek[WEEK_FRI]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    buttonWeek[WEEK_FRI]->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
+    buttonWeek[WEEK_FRI]->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
     if (buttonWeek[WEEK_SAT] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1 buttonSat nullptr error!");\r
         return;\r
     }\r
-    buttonWeek[WEEK_SAT]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
-    buttonWeek[WEEK_SAT]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    buttonWeek[WEEK_SAT]->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
+    buttonWeek[WEEK_SAT]->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
     if (buttonWeek[WEEK_SUN] == nullptr) {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView::RefreshStep1 buttonSun nullptr error!");\r
         return;\r
     }\r
-    buttonWeek[WEEK_SUN]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
-    buttonWeek[WEEK_SUN]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);\r
+    buttonWeek[WEEK_SUN]->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full);\r
+    buttonWeek[WEEK_SUN]->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BG_COLOR.full, UIButton::PRESSED);\r
 }\r
 \r
 void AlarmSetWeekView::RefreshSetWeek2(uint8_t week)\r
@@ -329,31 +376,32 @@ void AlarmSetWeekView::RefreshSetWeek2(uint8_t week)
     }\r
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetWeekView:: week = %u", week);\r
     if ((week & 0x01) == 1) { // 判断星期天的位数是否为1\r
-        buttonWeek[WEEK_SUN]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        // buttonWeek[WEEK_SUN]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);        buttonWeek[WEEK_SUN]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        buttonWeek[WEEK_SUN]->SetStyle(STYLE_BACKGROUND_COLOR, SELECTED_BG_COLOR.full);\r
         AlarmPresenter::GetInstance()->alarmWeek[WEEK_SUN] = 1;\r
     }\r
     if ((week & 0x02) == 0x02) { // 判断星期一的位数是否为1\r
-        buttonWeek[WEEK_MON]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        buttonWeek[WEEK_MON]->SetStyle(STYLE_BACKGROUND_COLOR, SELECTED_BG_COLOR.full);\r
         AlarmPresenter::GetInstance()->alarmWeek[WEEK_MON] = 1;\r
     }\r
     if ((week & 0x04) == 0x04) { // 判断星期二的位数是否为1\r
-        buttonWeek[WEEK_TUE]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        buttonWeek[WEEK_TUE]->SetStyle(STYLE_BACKGROUND_COLOR, SELECTED_BG_COLOR.full);\r
         AlarmPresenter::GetInstance()->alarmWeek[WEEK_TUE] = 1;\r
     }\r
     if ((week & 0x08) == 0x08) { // 判断星期三的位数是否为1\r
-        buttonWeek[WEEK_WED]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        buttonWeek[WEEK_WED]->SetStyle(STYLE_BACKGROUND_COLOR, SELECTED_BG_COLOR.full);\r
         AlarmPresenter::GetInstance()->alarmWeek[WEEK_WED] = 1;\r
     }\r
     if ((week & 0x10) == 0x10) { // 判断星期四的位数是否为1\r
-        buttonWeek[WEEK_THUR]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        buttonWeek[WEEK_THUR]->SetStyle(STYLE_BACKGROUND_COLOR, SELECTED_BG_COLOR.full);\r
         AlarmPresenter::GetInstance()->alarmWeek[WEEK_THUR] = 1;\r
     }\r
     if ((week & 0x20) == 0x20) { // 判断星期五的位数是否为1\r
-        buttonWeek[WEEK_FRI]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        buttonWeek[WEEK_FRI]->SetStyle(STYLE_BACKGROUND_COLOR, SELECTED_BG_COLOR.full);\r
         AlarmPresenter::GetInstance()->alarmWeek[WEEK_FRI] = 1;\r
     }\r
     if ((week & 0x40) == 0x40) { // 判断星期六的位数是否为1\r
-        buttonWeek[WEEK_SAT]->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x6c, 0xB8, 0xFD).full);\r
+        buttonWeek[WEEK_SAT]->SetStyle(STYLE_BACKGROUND_COLOR, SELECTED_BG_COLOR.full);\r
         AlarmPresenter::GetInstance()->alarmWeek[WEEK_SAT] = 1;\r
     }\r
 }\r
index b21b504..fafef37 100644 (file)
@@ -9,6 +9,7 @@
 #include "UiConfig.h"
 #include "ui_label_button.h"
 #include "PhoneService.h"
+#include "ui_resource_string.h"
 
 namespace OHOS {
 static MainAlarmView *g_MainAlarmView = nullptr;
@@ -43,8 +44,8 @@ constexpr int16_t STATUS_BUTTON_Y = 210;
 constexpr int16_t STATUS_BUTTON_W = 90;
 constexpr int16_t STATUS_BUTTON_H = 90;
 constexpr int16_t D_CLOCK_X = 80;
-constexpr int16_t D_CLOCK_FONT_SIZE = 55;
-constexpr int16_t D_CLOCK_LABEL_FONT = 25;
+constexpr int16_t D_CLOCK_FONT_SIZE = 40; // 55;
+constexpr int16_t D_CLOCK_LABEL_FONT = 30; // 25;
 constexpr int16_t POSITION_ADD_Y = 110;
 constexpr int16_t POSITION_BUTTON_ADD_Y = 85;
 constexpr int16_t LABEL_SEMITRANSPARENT = 128;
@@ -65,8 +66,8 @@ MainAlarmView::~MainAlarmView()
     alarmMin = 0;
     dClockNum = 0;
     weekStatus = 0;
-    delete addButton;
-    addButton = nullptr;
+    // delete addButton;
+    // addButton = nullptr;
     delete group;
     group = nullptr;
     delete configView;
@@ -79,21 +80,79 @@ MainAlarmView::~MainAlarmView()
     judgeView = nullptr;
     delete newTimeView;
     newTimeView = nullptr;
-    for (int alarmNum = SET_ZERO; alarmNum <= SET_FIVE; alarmNum++) {
-        if (dClock[alarmNum] != nullptr) {
-            delete dClock[alarmNum];
-            dClock[alarmNum] = nullptr;
-        }
-        if (statusButton[alarmNum] != nullptr) {
-            delete statusButton[alarmNum];
-            statusButton[alarmNum] = nullptr;
-        }
-        if (dLabel[alarmNum] != nullptr) {
-            delete dLabel[alarmNum];
-            dLabel[alarmNum] = nullptr;
+    // for (int alarmNum = SET_ZERO; alarmNum <= SET_FIVE; alarmNum++) {
+    //     if (dClock[alarmNum] != nullptr) {
+    //         delete dClock[alarmNum];
+    //         dClock[alarmNum] = nullptr;
+    //     }
+    //     if (statusButton[alarmNum] != nullptr) {
+    //         delete statusButton[alarmNum];
+    //         statusButton[alarmNum] = nullptr;
+    //     }
+    //     if (dLabel[alarmNum] != nullptr) {
+    //         delete dLabel[alarmNum];
+    //         dLabel[alarmNum] = nullptr;
+    //     }
+    //     container[alarmNum] = nullptr;
+    // }
+
+    if(nullptr != TitleLabelExt_)
+    {
+        delete TitleLabelExt_;
+        TitleLabelExt_ = nullptr;
+    }
+    if(nullptr != AddButton_)
+    {
+        delete AddButton_;
+        AddButton_ = nullptr;
+    }
+    for (int alarmNum = SET_ZERO; alarmNum <= SET_FIVE; alarmNum++)
+    {
+        if(nullptr != SwipeView_[alarmNum])
+        {
+            SwipeView_[alarmNum]->RemoveAll();
+
+            if(nullptr != SwipeViewItem_[alarmNum][0])
+            {
+                SwipeViewItem_[alarmNum][0]->RemoveAll();
+
+                if (dClock[alarmNum] != nullptr) {
+                    delete dClock[alarmNum];
+                    dClock[alarmNum] = nullptr;
+                }
+                if (statusButton[alarmNum] != nullptr) {
+                    delete statusButton[alarmNum];
+                    statusButton[alarmNum] = nullptr;
+                }
+                if (dLabel[alarmNum] != nullptr) {
+                    delete dLabel[alarmNum];
+                    dLabel[alarmNum] = nullptr;
+                }
+
+                delete SwipeViewItem_[alarmNum][0];
+                SwipeViewItem_[alarmNum][0] = nullptr;
+            }
+
+            if(nullptr != SwipeViewItem_[alarmNum][1])
+            {
+                SwipeViewItem_[alarmNum][1]->RemoveAll();
+
+                if (nullptr != DeleteButton_[alarmNum])
+                {
+                    delete DeleteButton_[alarmNum];
+                    DeleteButton_[alarmNum] = nullptr;
+                }
+
+                delete SwipeViewItem_[alarmNum][1];
+                SwipeViewItem_[alarmNum][1] = nullptr;
+            }
+
+            delete SwipeView_[alarmNum];
+            SwipeView_[alarmNum] = nullptr;
         }
         container[alarmNum] = nullptr;
     }
+
     g_MainAlarmView = nullptr;
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainAlarmView::~MainAlarmView");
 }
@@ -103,77 +162,204 @@ MainAlarmView *MainAlarmView::GetInstance(void)
     return g_MainAlarmView;
 }
 
-void MainAlarmView::CreateImage(void)
+// void MainAlarmView::CreateImage(void)
+// {
+    // UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance();
+
+    // addButton = new UIImageView();
+    // if (addButton == nullptr) {
+    //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new addButton fail");
+    //     return;
+    // }
+    // addButton->SetPosition(ADD_BUTTON_X, ADD_BUTTON_Y);
+    // addButton->SetWidth(ADD_BUTTON_W);
+    // addButton->SetHeight(ADD_BUTTON_H);
+    // addButton->SetSrc(ALARM_ADD_BUTTON_PATH);
+    // addButton->SetViewId(ADD_BUTTON);
+    // addButton->SetTouchable(true);
+    // addButton->SetOnClickListener(clickListener);
+    // group->Add(addButton);
+// }
+
+void MainAlarmView::AlarmTitleCreate(void)
 {
-    UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance();
+    if(nullptr == TitleLabelExt_)
+    {
+        TitleLabelExt_ = new UILabelExt();
+        if(nullptr == TitleLabelExt_)
+            return;
 
-    addButton = new UIImageView();
-    if (addButton == nullptr) {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new addButton fail");
-        return;
+        TitleLabelExt_->SetPosition(83, 50, 300, 35);
+        TitleLabelExt_->SetStyle(STYLE_TEXT_FONT, 30);
+        TitleLabelExt_->SetStyle(STYLE_LINE_HEIGHT, 35);
+        TitleLabelExt_->SetTextId(STR_ALARM);
+        TitleLabelExt_->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+        TitleLabelExt_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        TitleLabelExt_->SetRollSpeed(70);
+        TitleLabelExt_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+        group->Add(TitleLabelExt_);
     }
-    addButton->SetPosition(ADD_BUTTON_X, ADD_BUTTON_Y);
-    addButton->SetWidth(ADD_BUTTON_W);
-    addButton->SetHeight(ADD_BUTTON_H);
-    addButton->SetSrc(ALARM_ADD_BUTTON_PATH);
-    addButton->SetViewId(ADD_BUTTON);
-    addButton->SetTouchable(true);
-    addButton->SetOnClickListener(clickListener);
-    group->Add(addButton);
 }
 
-void MainAlarmView::NewClockCtl(int16_t alarmNum)
+void MainAlarmView::AlarmAddButtonCreate(void)
 {
-    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");
-        return;
+    if(nullptr == AddButton_)
+    {
+        AddButton_ = new UILabelButtonExt();
+        if(nullptr == AddButton_)
+            return; 
+
+        AddButton_->SetPosition(43, 0, 380, 100);
+        AddButton_->SetViewId(ADD_BUTTON);
+        AddButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        AddButton_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+        AddButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+        AddButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_OPAQUE, UIButton::PRESSED);
+        AddButton_->SetStyle(STYLE_BORDER_RADIUS, 100);
+        AddButton_->SetStyle(STYLE_TEXT_FONT, 30);
+        AddButton_->SetStyle(STYLE_LINE_HEIGHT, 35);
+        AddButton_->SetTextId(STR_ADD_A_NEW_ALARM);
+        // AddButton_->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+        // AddButton_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        // AddButton_->SetRollSpeed(70);
+        AddButton_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+        UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance();
+        AddButton_->SetOnClickListener(clickListener);
+
+        group->Add(AddButton_);
     }
-    dClock[alarmNum]->SetViewId(ALARM_CLOCK[alarmNum]);
-    dClock[alarmNum]->SetTouchable(true);
-    dClock[alarmNum]->SetOnClickListener(clockListener);
-    if (alarmNum == 0) {
-        dClock[0]->SetPosition(D_CLOCK_X, alarmPositionY, ALARM_CLOCK_WIDTH, ALARM_CLOCK_HEIGHT);
-    } else {
-        dClock[alarmNum]->SetPosition(D_CLOCK_X, dClock[0]->GetY() + (alarmInterval * alarmNum), ALARM_CLOCK_WIDTH, ALARM_CLOCK_HEIGHT);
-    }
-    dClock[alarmNum]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, D_CLOCK_FONT_SIZE);
-    dClock[alarmNum]->SetDisplayMode(UIDigitalClock::DISPLAY_24_HOUR_NO_SECONDS);
-    group->Add(dClock[alarmNum]);
+}
 
-    dLabel[alarmNum] = new UILabel();
-    if (dLabel[alarmNum] == nullptr) {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new dLabel fail");
-        return;
-    }
-    if (alarmNum == 0) {
-        dLabel[0]->SetPosition(D_CLOCK_X, labelPositionY, ALARM_CLOCK_WIDTH, WEEK_LABEL_HEIGHT);
-    } else {
-        dLabel[alarmNum]->SetPosition(D_CLOCK_X, dLabel[0]->GetY() + (alarmInterval * alarmNum), ALARM_CLOCK_WIDTH, WEEK_LABEL_HEIGHT);
-    }
-    group->Add(dLabel[alarmNum]);
+void MainAlarmView::AlarmAddButtonUpdate(uint8_t count)
+{
+    if(nullptr == AddButton_)
+        return; 
 
-    statusButton[alarmNum] = new UIToggleButton();
-    if (statusButton[alarmNum] == nullptr) {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new statusButton[alarmNum] fail");
-        return;
+    // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]: 0_y=%d", __LINE__, SwipeView_[0]->GetY());
+    AddButton_->SetY(SwipeView_[0]->GetY() + (alarmInterval * count));
+}
+
+UIViewGroup * MainAlarmView::NewClockCtlExt(int16_t alarmNum, uint8_t index)
+{
+    UIViewGroup * TempGroup_ = new UIViewGroup();
+    if(nullptr == TempGroup_)
+        return nullptr;
+
+    if(0 == index)
+    {
+        TempGroup_->SetPosition(0, 0, 380, 100);
+        TempGroup_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        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");
+            return nullptr;
+        }
+        dClock[alarmNum]->SetViewId(ALARM_CLOCK[alarmNum]);
+        dClock[alarmNum]->SetTouchable(true);
+        // 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);
+
+        dLabel[alarmNum] = new UILabel();
+        if (dLabel[alarmNum] == nullptr) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new dLabel fail");
+            return nullptr;
+        }
+        dLabel[alarmNum]->SetPosition(50, 60, 200, 35);
+        dLabel[alarmNum]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, D_CLOCK_LABEL_FONT);
+        dLabel[alarmNum]->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+        dLabel[alarmNum]->SetRollSpeed(70);
+
+        statusButton[alarmNum] = new UIToggleButton();
+        if (statusButton[alarmNum] == nullptr) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new statusButton[alarmNum] fail");
+            return nullptr;
+        }
+        statusButton[alarmNum]->SetViewId(ALARM_STATUS[alarmNum]);
+        statusButton[alarmNum]->SetPosition(250, 15, 120, 70);
+        statusButton[alarmNum]->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
+        // statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, alarmNum);
+        // statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff29b862);
+        // statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+        UICheckBox::OnChangeListener *statusListener{nullptr};
+        statusListener = new AlarmStatusBtnChangeListener(reinterpret_cast<UIView*>(statusButton[alarmNum]));
+        if (statusListener == nullptr) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView::NewStatusButton statusListener nullptr!");
+            return nullptr;
+        }
+        statusButton[alarmNum]->SetOnChangeListener((UICheckBox::OnChangeListener *)statusListener);
+
+        TempGroup_->Add(dClock[alarmNum]);
+        TempGroup_->Add(dLabel[alarmNum]);
+        TempGroup_->Add(statusButton[alarmNum]);
     }
-    statusButton[alarmNum]->SetViewId(ALARM_STATUS[alarmNum]);
-    if (alarmNum == 0) {
-        statusButton[0]->SetPosition(STATUS_BUTTON_X, alarmPositionY, STATUS_BUTTON_W, STATUS_BUTTON_H);
-    } else {
-        statusButton[alarmNum]->SetPosition(STATUS_BUTTON_X, statusButton[0]->GetY() + (alarmInterval * alarmNum), STATUS_BUTTON_W, STATUS_BUTTON_H);
+    else
+    {
+        TempGroup_->SetPosition(0, 0, 100 + 10, 100);
+        TempGroup_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        TempGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+        TempGroup_->SetStyle(STYLE_BORDER_RADIUS, 100);
+
+        DeleteButton_[alarmNum] = new UILabelButtonExt();
+        if(nullptr == DeleteButton_[alarmNum])
+            return nullptr;
+
+        DeleteButton_[alarmNum]->SetPosition(10, 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%
+        DeleteButton_[alarmNum]->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+        DeleteButton_[alarmNum]->SetStyleForState(STYLE_BACKGROUND_OPA, 25, UIButton::PRESSED);
+        DeleteButton_[alarmNum]->SetStyle(STYLE_BORDER_RADIUS, 100);
+        DeleteButton_[alarmNum]->SetImagePosition(0, 0);
+        DeleteButton_[alarmNum]->SetImageSrc(ALARM_DELETE_IMAGE, ALARM_DELETE_IMAGE);
+        DeleteButton_[alarmNum]->SetOnClickListener(presenter_);
+        
+        TempGroup_->Add(DeleteButton_[alarmNum]);    
     }
-    statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, alarmNum);
-    UICheckBox::OnChangeListener *statusListener{nullptr};
-    statusListener = new AlarmStatusBtnChangeListener(reinterpret_cast<UIView*>(statusButton[alarmNum]));
-    if (statusListener == nullptr) {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView::NewStatusButton statusListener nullptr!");
-        return;
+
+    return TempGroup_;
+}
+
+void MainAlarmView::NewClockCtl(int16_t alarmNum)
+{
+    SwipeView_[alarmNum] = new UISwipeView(UISwipeView::HORIZONTAL);
+    if (0 == alarmNum) 
+    {
+        SwipeView_[alarmNum]->SetPosition(43, 120, 380, 100);
+    } else 
+    {
+        SwipeView_[alarmNum]->SetPosition(43, SwipeView_[0]->GetY() + (alarmInterval * alarmNum), 380, 100);
     }
-    statusButton[alarmNum]->SetOnChangeListener((UICheckBox::OnChangeListener *)statusListener);
-    group->Add(statusButton[alarmNum]);
+    // SwipeView_[alarmNum]->SetViewId(ITEM_SWIPE[alarmNum]);
+    SwipeView_[alarmNum]->SetTouchable(true);
+    SwipeView_[alarmNum]->SetThrowDrag(true);
+    // SwipeView_[alarmNum]->SetOnDragListener(presenter_);
+    SwipeView_[alarmNum]->SetOnSwipeListener(presenter_);
+    SwipeView_[alarmNum]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+    SwipeView_[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+    SwipeView_[alarmNum]->SetStyle(STYLE_BORDER_RADIUS, 100);
+    // SwipeView_[alarmNum]->SetBlankSize(0);
+    // SwipeView_[alarmNum]->SetReboundSize(30); // 200: rebound size
+    // 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]);
+
+    SwipeView_[alarmNum]->SetCurrentPage(0);
+    SwipeView_[alarmNum]->SetIntercept(false);
+    SwipeView_[alarmNum]->SetLoopState(false);
+
+    group->Add(SwipeView_[alarmNum]);
 }
 
 void MainAlarmView::LabelGetWeek(uint8_t week, int16_t alarmNum)
@@ -243,10 +429,12 @@ void MainAlarmView::OnStart()
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: new group fail");
         return;
     }
-    group->SetPosition(CONTAINER_X, CONTAINER_Y, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-    UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance();
-    CreateImage();
+    // group->SetPosition(CONTAINER_X, CONTAINER_Y, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+    group->SetPosition(0, 30, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight() - 60);
 
+    UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance();
+    // CreateImage();
+    group->SetScrollBlankSize(30);
     group->SetTouchable(true);
     group->SetDraggable(true);
     UIView::OnDragListener *alarmDragListener = (UIView::OnDragListener *)OHOS::AlarmPresenter::GetInstance();
@@ -261,7 +449,11 @@ void MainAlarmView::OnSetUpView()
 {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView::OnSetUpView");
     View<AlarmPresenter>::OnSetUpView();
-    OHOS::AlarmClockModel::GetInstance()->InitAlarmData();
+        
+    AlarmTitleCreate();
+    AlarmAddButtonCreate();
+
+    // OHOS::AlarmClockModel::GetInstance()->InitAlarmData();
     RefreshAlarm();
     if (group != nullptr) {
         container[0] = group;
@@ -331,21 +523,53 @@ void MainAlarmView::RefreshAlarm(void)
         RefreshAlarmStatus(alarmEnable, i);
         dClock[i]->SetTime24Hour(refreshHour, refreshMin, 0);
     }
-    group->ScrollBy(0, ADD_BUTTON_Y - addButton->GetY());
+    // group->ScrollBy(0, ADD_BUTTON_Y - addButton->GetY());
     if (dClockNum > (i - 1)) {
-        group->Remove(dClock[dClockNum]);
+        // group->Remove(dClock[dClockNum]);
+        // delete dClock[dClockNum];
+        // dClock[dClockNum] = nullptr;
+
+        // group->Remove(statusButton[dClockNum]);
+        // delete statusButton[dClockNum];
+        // statusButton[dClockNum] = nullptr;
+
+        // group->Remove(dLabel[dClockNum]);
+        // delete dLabel[dClockNum];
+        // dLabel[dClockNum] = nullptr;
+
+        group->Remove(SwipeView_[dClockNum]);
+
+        // 0
+        SwipeView_[dClockNum]->RemoveAll();
+
+        SwipeViewItem_[dClockNum][0]->RemoveAll();
         delete dClock[dClockNum];
         dClock[dClockNum] = nullptr;
 
-        group->Remove(statusButton[dClockNum]);
         delete statusButton[dClockNum];
         statusButton[dClockNum] = nullptr;
 
-        group->Remove(dLabel[dClockNum]);
         delete dLabel[dClockNum];
         dLabel[dClockNum] = nullptr;
+
+        delete SwipeViewItem_[dClockNum][0];
+        SwipeViewItem_[dClockNum][0] = nullptr;
+
+        // 1
+        SwipeViewItem_[dClockNum][1]->RemoveAll();
+        delete DeleteButton_[dClockNum];
+        DeleteButton_[dClockNum] = nullptr;
+
+        delete SwipeViewItem_[dClockNum][1];
+        SwipeViewItem_[dClockNum][1] = nullptr;
+
+        delete SwipeView_[dClockNum];
+        SwipeView_[dClockNum] = nullptr;
     }
     dClockNum = i - 1;
+
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]: dClockNum=%d", __LINE__, dClockNum);
+    AlarmAddButtonUpdate(i);
 }
 
 bool MainAlarmView::ChangeMainAlarm(int16_t thisView)
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Alarm/alarm_delete.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Alarm/alarm_delete.bin
new file mode 100644 (file)
index 0000000..a14a562
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:987a6968d47e9b5b26cc7def3979413af3582be38308de080d95e8d5ea96cddd
+size 6824