From 32e3c255cb4f4a4a93880bc6ec9418cb71c19f00 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Sun, 3 Mar 2024 16:50:53 +0800 Subject: [PATCH] =?utf8?q?1.=E6=9B=B4=E6=AD=A3=E4=B8=8A=E6=8B=89=E7=95=8C?= =?utf8?q?=E9=9D=A2=E7=9A=84=E9=BB=91=E5=B1=8Fbug=EF=BC=9B2.=E4=BC=98?= =?utf8?q?=E5=8C=96=E5=8A=9F=E8=83=BD=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/applist/src/ApplistView.cpp | 6 ++-- .../heart_blood/src/BloodCardView.cpp | 31 +---------------- .../nativeui/message/include/MessageView.h | 1 + .../nativeui/message/src/MessageCardView.cpp | 1 + .../nativeui/message/src/MessagePresenter.cpp | 1 - .../nativeui/message/src/MessageView.cpp | 33 +++++++++---------- 6 files changed, 22 insertions(+), 51 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp index 695e06de5..0c615681b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp @@ -129,14 +129,16 @@ namespace OHOS } contentList_->SetPosition(0, 0); contentList_->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - contentList_->SetScrollBlankSize(VERTICAL_RESOLUTION / NUM_2); - contentList_->SetSelectPosition(VERTICAL_RESOLUTION / NUM_2); // middle position + contentList_->SetScrollBlankSize(100); + contentList_->SetSelectPosition(60); // middle position contentList_->SetDraggable(true); contentList_->SetThrowDrag(true); contentList_->EnableAutoAlign(true); contentList_->SetScrollStateListener(this); contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS); contentList_->SetYScrollBarVisible(true); // 启动列表滚动条 + // contentList_->EnableAutoAlign(true); + // contentList_->SetAutoAlignTime(100); SetContainerView(contentList_); dragListener = new AppListOnDragListener(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/src/BloodCardView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/src/BloodCardView.cpp index 4c4103c97..f2d6d526a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/src/BloodCardView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/src/BloodCardView.cpp @@ -41,36 +41,7 @@ namespace OHOS */ bool BloodCardView::AddButton() { -#if 0 - // Add Button to App - if (warnButton == nullptr) - { - warnButton = new UIButton(); - } - warnButton->SetPosition(300, 102); // widget's left position and top position - warnButton->Resize(26, 26); // widget's width and height - warnButton->SetViewId(WARNING); // Set style - warnButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); - warnButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - char *button1defaultImgSrc = "/user/res/Blood/Vector.bin"; - char *button1triggeredImgSrc = nullptr; - warnButton->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc); - warnButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - Add(warnButton); - // Add LabelButtonExt to App - if (monitorButton == nullptr) - { - monitorButton = new UILabelButton(); - } - monitorButton->SetPosition(118, 336); // widget's left position and top position - monitorButton->Resize(230, 80); // widget's width and height - monitorButton->SetViewId(CHECK); // Set style - monitorButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffcd492c); - monitorButton->SetText("检测"); - monitorButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); - monitorButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - Add(monitorButton); -#endif + return true; } /*** 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 39d43d24b..c678b105c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h @@ -28,6 +28,7 @@ namespace OHOS void AddMessageToList(const MessageListItem &item); bool InitPage(); bool SetupViewPage(MessageView *messageView); + UIList *GetList(); private: void InitView(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageCardView.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageCardView.cpp index 134e1cb03..856346e6a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageCardView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageCardView.cpp @@ -49,6 +49,7 @@ namespace OHOS return false; } Add(messageview); + messageview->GetList()->RefreshList(); // 刷新列表 return true; } 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 29c241070..581d7b90b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp @@ -41,7 +41,6 @@ namespace OHOS void MessagePresenter::OnResume(void) { - // 把歌曲信息数据拿到存储到list中 if (view_ == nullptr) { return; 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 2155af506..62b6a8fd9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp @@ -66,7 +66,7 @@ namespace OHOS MessageList = new UIList(); } MessageList->SetPosition(43, 120, 380, 600); - MessageList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + MessageList->SetStyle(STYLE_BACKGROUND_COLOR, 0x00000000); } void MessageView::DeInitView() @@ -114,6 +114,7 @@ namespace OHOS View::OnSetUpView(); scrollView->Add(title); scrollView->Add(MessageList); + scrollView->SetBackgroundBlur(10000); RootView::GetInstance()->Add(scrollView); MessageList->SetAdapter(p_MessageListAdapter); MessageList->RefreshList(); // 刷新列表 @@ -138,21 +139,6 @@ namespace OHOS // 初始化页面 bool MessageView::InitPage() { -#if 0 - if (scrollView == nullptr) - { - scrollView = new UIScrollView(); - } - scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - scrollView->SetScrollBlankSize(20); - scrollView->SetReboundSize(50); - scrollView->SetTouchable(true); - scrollView->SetDraggable(false); - draglistener = static_cast(MessagePresenter::GetInstance()); - scrollView->SetOnDragListener(draglistener); - /* -------------------------------------------------------------------------- */ -#endif // UIList 的适配器 p_MessageListAdapter = new MessageListAdapter(); p_MessageListAdapter->SetItemClickListener(presenter_); @@ -162,10 +148,16 @@ namespace OHOS } MessageList->SetPosition(0, 0, 380, 600); MessageList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + MessageList->SetScrollBlankSize(10); + MessageList->EnableAutoAlign(true); + MessageList->RefreshList(); // 刷新列表 + MessageList->SetDraggable(true); + MessageList->SetThrowDrag(false); + MessageList->SetLoopState(true); + + // MessageList->SetYScrollBarVisible(true); Add(MessageList); MessageList->SetAdapter(p_MessageListAdapter); - MessageList->SetLoopState(true); - MessageList->RefreshList(); // 刷新列表 MessageList->SetVisible(true); return true; } @@ -183,4 +175,9 @@ namespace OHOS } return true; } + + UIList *MessageView::GetList() + { + return MessageList; + } } \ No newline at end of file -- 2.17.1