From 72ebbe0d8a613cf2e75552255806a71d70fcf329 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Fri, 21 Jun 2024 17:17:41 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E4=B8=8D=E5=BF=85=E8=A6=81?= =?utf8?q?=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/message/include/MessageView.h | 3 +- .../nativeui/message/src/MessageAdapter.cpp | 5 +-- .../nativeui/message/src/MessageItemView.cpp | 12 ++----- .../nativeui/message/src/MessagePresenter.cpp | 5 +-- .../nativeui/message/src/MessageView.cpp | 35 +------------------ 5 files changed, 11 insertions(+), 49 deletions(-) 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 ea3aba438..c165ccef2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h @@ -1,7 +1,7 @@ /*** * @Date: 2024-04-15 10:55:58 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-06-19 17:38:19 + * @LastEditTime: 2024-06-21 17:13:44 * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h */ /*** @@ -62,7 +62,6 @@ namespace OHOS bool SetupViewPage(MessageView *messageView); private: - UIScrollView *container_ = nullptr; /*无消息界面*/ UIScrollView *lackView{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageAdapter.cpp index 4ca0785dd..9b05ec775 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageAdapter.cpp @@ -2,8 +2,8 @@ * @Author: Caisking 3449750381@qq.com * @Date: 2024-01-29 19:58:37 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-03-26 18:16:05 - * @FilePath: /sdk/application/wearable/fd230app/nativeui/message/src/MessageAdapter.cpp + * @LastEditTime: 2024-06-21 10:35:36 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageAdapter.cpp * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -79,6 +79,7 @@ namespace OHOS item = static_cast(inView); } item->SetItemInfo(itemData); + item->SetViewIndex(index); item->SetOnClickListener(itemClickListener); return item; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageItemView.cpp index 974b77ead..f43b38015 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageItemView.cpp @@ -91,23 +91,17 @@ namespace OHOS sIcon.SetStyle(STYLE_IMAGE_OPA, OPA_OPAQUE); stitle.SetPosition(60, 31, 280, 35); - stitle.SetStyle(STYLE_TEXT_FONT, 30); - stitle.SetStyle(STYLE_LINE_HEIGHT, 36); - stitle.SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); - stitle.SetRollSpeed(30); stitle.SetTextColor(Color::White()); stitle.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + stitle.SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + stitle.SetRollSpeed(30); smessgae.SetPosition(40, 69, 300, label_length); - smessgae.SetStyle(STYLE_TEXT_FONT, 30); - smessgae.SetStyle(STYLE_LINE_HEIGHT, 36); smessgae.SetLineBreakMode(UILabel::LINE_BREAK_CLIP); - smessgae.SetTextColor(Color::Gray()); + smessgae.SetTextColor(Color::Gray()); smessgae.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); stime.SetPosition(40, time_top, 300, 33); - stime.SetStyle(STYLE_TEXT_FONT, 30); - stime.SetStyle(STYLE_LINE_HEIGHT, 36); stime.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); stime.SetTextColor(Color::Gray()); stime.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28); 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 4fcdaf32e..2043ac78e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp @@ -52,7 +52,6 @@ namespace OHOS void MessagePresenter::OnStart() { - // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "InitMessageListItem"); p_MessageModel->InitMessageListItems(); Presenter::OnStart(); @@ -62,13 +61,14 @@ namespace OHOS { Presenter::OnPause(); } - void MessagePresenter::OnResume(void) { if (view_ == nullptr) { return; } + + // p_MessageModel->InitMessageListItems(); if (p_MessageModel->GetPopupViewState()) { const MessageListItem *itemInfo = p_MessageModel->GetMessageListItems(); @@ -77,6 +77,7 @@ namespace OHOS view_->AddMessageToList(itemInfo[i]); } } + Presenter::OnResume(); } 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 824a5979e..7a8e38376 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp @@ -19,7 +19,7 @@ namespace OHOS static constexpr int16 LIST_POS = 20; static constexpr int16 SNUM_2 = 2; static constexpr uint8_t NUM_2 = 2; - + static MessageView *g_pMessageView{nullptr}; MessageView::MessageView() @@ -63,7 +63,6 @@ namespace OHOS } void MessageView::DeInitView() { - container_->RemoveAll(); lackView->RemoveAll(); messageView->RemoveAll(); MessageList->RemoveAll(); @@ -115,12 +114,6 @@ namespace OHOS delete messageView; messageView = nullptr; } - if (container_ != nullptr) - { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } delete draglistener; draglistener = nullptr; } @@ -252,39 +245,15 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PopupView is NULL"); return; } - if (container_ != nullptr) - { - container_->SetVisible(!status); - } popupView->SetVisible(status); } /// @brief 页面启动时需要执行的代码逻辑 void MessageView::OnStart() { - container_ = new UIScrollView(); - if (container_ == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "container_ new fail"); - return; - } - container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(MessagePresenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - container_->SetTouchable(true); - container_->SetDraggable(true); - container_->SetStyle(STYLE_BACKGROUND_COLOR, BACK_GROUND_COLOR); - container_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - ShowLackView(); ShowMessageView(); PreLoad(); - RootView::GetInstance()->Add(container_); } void MessageView::AddMessageToList(const MessageListItem &item) { @@ -303,10 +272,8 @@ namespace OHOS { messageView->Add(MessageList); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageList is add"); - messageView->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); RootView::GetInstance()->Add(messageView); MessageList->SetAdapter(p_MessageListAdapter); - MessageList->RefreshList(); // 刷新列表 } Draw(); } -- 2.17.1