From fea1bacc5cb134e86986dfc29d17ac54cd738e39 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Tue, 18 Jun 2024 21:19:09 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=A1=E6=81=AF=E7=95=8C=E9=9D=A2=E5=A2=9E?= =?utf8?q?=E5=8A=A0=E5=88=A0=E9=99=A4button=EF=BC=9B=E9=9C=80=E8=A6=81?= =?utf8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/message/include/MessageModel.h | 4 ++-- .../nativeui/message/include/MessageView.h | 17 ++++------------- .../nativeui/message/src/MessageModel.cpp | 2 +- .../nativeui/message/src/MessagePresenter.cpp | 6 ++++++ .../nativeui/message/src/MessageView.cpp | 9 ++++++++- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h index cf85011f6..58ca2e8b0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h @@ -1,7 +1,7 @@ /*** * @Date: 2024-04-15 10:55:58 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-06-18 11:22:29 + * @LastEditTime: 2024-06-18 20:58:38 * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageModel.h */ /*** @@ -78,7 +78,7 @@ namespace OHOS MessageModel &operator=(const MessageModel &); virtual ~MessageModel(); uint8_t ArrayNum; - static const uint16_t MessageListMaxNum = 10; + static const uint16_t MessageListMaxNum = 11; MessageListItem Messages[MessageListMaxNum] = {0, false, nullptr, nullptr, nullptr}; // std::map MessageIdToViewId; diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h index a02c98713..d87b9179f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h @@ -1,15 +1,4 @@ -/*** - * @Date: 2024-04-15 10:55:58 - * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-06-15 15:47:19 - * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h - */ -/*** - * @Date: 2024-04-15 10:55:58 - * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-04-23 15:32:55 - * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h - */ + #ifndef Message_VIEW_H #define Message_VIEW_H @@ -24,9 +13,10 @@ #include "components/ui_image_view.h" #include "components/ui_label.h" #include "components/ui_label_ext.h" - +#include "components/ui_label_button_ext.h" namespace OHOS { +#define DELETEALLDATA "deletealldata" enum class PopupMessage { LackPopup, @@ -72,6 +62,7 @@ namespace OHOS UILabelExt *title{nullptr}; MessageListAdapter *p_MessageListAdapter{nullptr}; UIList *MessageList = nullptr; + UILabelButtonExt *DeleteButton = nullptr; // 删除按键 UIView::OnDragListener *draglistener{nullptr}; bool viewInitStatus{false}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp index 7336d0012..bbc5740c4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp @@ -46,7 +46,7 @@ namespace OHOS uint8_t MessageModel::GetMessageListNum() const { - return MessageListMaxNum; + return ArrayNum; } /*检查是否存在数据*/ bool MessageModel::CheckDataJson() diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp index 71490c6bb..940eb030d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp @@ -106,6 +106,12 @@ namespace OHOS UNUSED(event); if (MessageModel::GetInstance().GetPopupView()) { + if (strcmp(view.GetViewId(), DELETEALLDATA) == 0) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + return true; + } + /* -------------------------------------------------------------------------- */ MessageItemView *p_MessageItemView = static_cast(&view); int index = p_MessageItemView->GetMessageListIndex(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "the index is %d", index); diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp index ebc96c23e..c4fc68687 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp @@ -214,12 +214,19 @@ namespace OHOS messageView->SetYScrollBarVisible(true); // 设置滑动滚动条 MessageList->SetOnClickListener(static_cast(MessagePresenter::GetInstance())); - UIView::OnDragListener *Messagedraglistener = static_cast(MessagePresenter::GetInstance()); if (Messagedraglistener == nullptr) { return; } +#if 0 + /*删除按键*/ + int top = (MessageModel::GetInstance().GetListNum() * 100); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "num is %d", top); + InitButtonExt(DeleteButton, 43, top, 380, 100, DELETEALLDATA, STR_CLOSE, 30); + DeleteButton->SetOnClickListener(static_cast(MessagePresenter::GetInstance())); + messageView->Add(DeleteButton); +#endif messageView->SetOnDragListener(Messagedraglistener); messageView->SetVisible(false); // 隐藏界面 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowmessageView end"); -- 2.17.1