From 71b82c893dba1b37e1f8c0a1cfc27bab7ca6bd26 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 29 Oct 2024 16:27:47 +0800 Subject: [PATCH] =?utf8?q?#1078,=E8=A7=A3=E5=86=B3=EF=BC=8C=E9=97=B9?= =?utf8?q?=E9=92=9F=E6=98=AF=E5=85=B3=E9=97=AD=E7=8A=B6=E6=80=81=EF=BC=8C?= =?utf8?q?=E8=BF=98=E4=BC=9A=E5=93=8D=E8=B5=B7=E9=97=B9=E9=93=83bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/alarm/include/AlarmJudgeView.h | 19 ++-- .../nativeui/alarm/include/MainAlarmView.h | 17 ++-- .../nativeui/alarm/src/AlarmJudgeView.cpp | 88 +------------------ .../nativeui/alarm/src/MainAlarmView.cpp | 18 ++-- 4 files changed, 22 insertions(+), 120 deletions(-) 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 f6349e4ad..9147ad4cd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmJudgeView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmJudgeView.h @@ -1,8 +1,10 @@ /* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: Alarm - * Author: - * Create: 2021-09-11 + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-09-02 20:04:12 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-10-29 16:26:10 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmJudgeView.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ #ifndef ALARM_JUDGE_VIEW_H @@ -32,16 +34,7 @@ public: AlarmJudgeView(); virtual ~AlarmJudgeView(); UIScrollView *InitJudgeView(); - void OnSetUpView(); - void OnTearDownView(); - void OnStop(); private: - // void CreateImage(void); - // UIScrollView *container{nullptr}; - // UILabel *labelText{nullptr}; - // UIImageView *imageViewDelete{nullptr}; - // UIImageView *imageViewTrue{nullptr}; - UIScrollView * InitDeleteScreen(); void DeinitDeleteScreen(); UIScrollView * DeleteGroup_{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/MainAlarmView.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/MainAlarmView.h index 3bd0e33c5..77e39fcd1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/MainAlarmView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/MainAlarmView.h @@ -33,8 +33,6 @@ #include "AlarmClockModel.h" namespace OHOS { -constexpr int16_t D_CLOCK_Y = 210; -constexpr int16_t LABEL_ZERO_Y = 270; constexpr int16_t ALARM_INTER_ADD = 120; // 120; class AlarmPresenter; @@ -49,7 +47,6 @@ public: void OnStop() override; void ChangeView(int16_t hideView, int16_t showView); void DropView(UIView& view); - // void CreateImage(); void RefreshAlarm(void); bool ChangeMainAlarm(int16_t thisView); bool ChangeConfig(int16_t thisView); @@ -69,9 +66,10 @@ private: void AlarmAddButtonCreate(void); void AlarmAddButtonUpdate(uint8_t count); - AlarmConfigView *configView{nullptr}; - AlarmSetTimeView *setTimeView{nullptr}; - AlarmSetWeekView *setWeekView{nullptr}; +private: + AlarmConfigView *configView{nullptr}; //编辑闹钟页面【包括更改时间和更改星期】 + AlarmSetTimeView *setTimeView{nullptr};//时间设置页面 + AlarmSetWeekView *setWeekView{nullptr};//星期设置页面 AlarmJudgeView *judgeView{nullptr}; AlarmNewTimeView *newTimeView{nullptr}; AlarmMaxClock *maxClockView{nullptr}; @@ -80,20 +78,17 @@ private: UIViewGroup * SwipeViewItem_[6][2]{nullptr}; UILabelButtonExt * DeleteButton_[6]{nullptr}; UIToggleButton *statusButton[6]{nullptr}; // 6代表界面中最多存在六个按键 - // UIImageView *addButton{nullptr}; UIDigitalClock *dClock[6]{nullptr}; // 6代表界面中最多存在六个闹钟 UILabelExt *dLabel[6]{nullptr}; // 6代表界面中显示闹钟日期的控件个数 UIScrollView *container[7]{nullptr}; // 7代表容器存有主界面以及跳转的四个副界面,用于跳转后显示或隐藏界面 uint8_t alarmHour, alarmMin; int8_t dClockNum{-1}; int16_t weekStatus{-1}; - // int16_t alarmPositionY{D_CLOCK_Y}; - // int16_t labelPositionY{LABEL_ZERO_Y}; - int16_t alarmInterval{ALARM_INTER_ADD}; + int16_t alarmInterval{ALARM_INTER_ADD}; // 闹钟之间的间隔 bool reflashStatus{false}; UILabelExt * TitleLabelExt_{nullptr}; UILabelButtonExt * AddButton_{nullptr}; - UICheckBox::OnChangeListener *statusListener{nullptr}; + UICheckBox::OnChangeListener *statusListener[6]{nullptr}; bool viewInitstatus_{false}; #define ALARM_DELETE_IMAGE "/user/res/Alarm/alarm_delete.bin" 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 c8d5cb4b4..82d725b92 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmJudgeView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmJudgeView.cpp @@ -5,30 +5,14 @@ * Create: 2021-09-11 */ -#include "AlarmJudgeView.h" +#include "alarm/include/AlarmJudgeView.h" #include "UiConfig.h" #include -#include "AlarmPresenter.h" +#include "alarm/include/AlarmPresenter.h" #include "ui_resource_string.h" namespace OHOS { -#define DELETE_INETERFACES "是否删除此闹钟?" - static AlarmJudgeView *g_JudgeView = nullptr; -constexpr int16_t CONTAINER_X = 0; -constexpr int16_t CONTAINER_Y = 0; -constexpr int16_t MAX_LABEL_X_LEN = 120; -constexpr int16_t MAX_LABEL_Y_LEN = 160; -constexpr int16_t MAX_LABEL_LENGTH_LEN = 400; -constexpr int16_t MAX_LABEL_WIDTH_LEN = 50; -constexpr int16_t MAX_LABEL_FONT_LEN = 30; -constexpr int16_t MAX_IMAGE_DELETE_X_LEN = 90; -constexpr int16_t MAX_IMAGE_DELETE_Y_LEN = 300; -constexpr int16_t MAX_IMAGE_TRUE_X_LEN = 270; -constexpr int16_t MAX_IMAGE_TRUE_Y_LEN = 300; -constexpr int16_t MAX_IMAGE_DELETE_WIDTH_LEN = 91; -constexpr int16_t MAX_IMAGE_TRUE_WIDTH_LEN = 91; - AlarmJudgeView::AlarmJudgeView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmJudgeView::AlarmJudgeView"); @@ -38,76 +22,12 @@ AlarmJudgeView::AlarmJudgeView() AlarmJudgeView::~AlarmJudgeView() { 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) -// { -// 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) { - // 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(); } @@ -153,12 +73,8 @@ UIScrollView * AlarmJudgeView::InitDeleteScreen() 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_) { 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 7318afc8f..76382d370 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/MainAlarmView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/MainAlarmView.cpp @@ -67,8 +67,6 @@ MainAlarmView::~MainAlarmView() alarmMin = 0; dClockNum = 0; weekStatus = 0; - // delete addButton; - // addButton = nullptr; if(group) { group->ClearFocus(); @@ -105,11 +103,6 @@ MainAlarmView::~MainAlarmView() delete maxClockView; maxClockView = nullptr; } - if(statusListener) - { - delete statusListener; - statusListener = nullptr; - } if(nullptr != TitleLabelExt_) { delete TitleLabelExt_; @@ -142,6 +135,11 @@ MainAlarmView::~MainAlarmView() delete dLabel[alarmNum]; dLabel[alarmNum] = nullptr; } + if(statusListener[alarmNum] != nullptr) + { + delete statusListener[alarmNum]; + statusListener[alarmNum] = nullptr; + } delete SwipeViewItem_[alarmNum][0]; SwipeViewItem_[alarmNum][0] = nullptr; @@ -307,14 +305,14 @@ UIViewGroup * MainAlarmView::NewClockCtlExt(int16_t alarmNum, uint8_t index) // statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, alarmNum); // statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff29b862); // statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); - if(statusListener == nullptr){ - statusListener = new AlarmStatusBtnChangeListener(reinterpret_cast(statusButton[alarmNum])); + if(statusListener[alarmNum] == nullptr){ + statusListener[alarmNum] = new AlarmStatusBtnChangeListener(reinterpret_cast(statusButton[alarmNum])); if (statusListener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView::NewStatusButton statusListener nullptr!"); return nullptr; } } - statusButton[alarmNum]->SetOnChangeListener((UICheckBox::OnChangeListener *)statusListener); + statusButton[alarmNum]->SetOnChangeListener((UICheckBox::OnChangeListener *)statusListener[alarmNum]); /* ----------------------------------- Add ---------------------------------- */ TempGroup_->Add(dClock[alarmNum]); TempGroup_->Add(dLabel[alarmNum]); -- 2.17.1