1.更正上拉界面的黑屏bug;2.优化功能列表
authorCaisking <3449750381@qq.com>
Sun, 3 Mar 2024 08:50:53 +0000 (16:50 +0800)
committerCaisking <3449750381@qq.com>
Sun, 3 Mar 2024 08:50:53 +0000 (16:50 +0800)
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp
code/sdk/application/wearable/fd230app/nativeui/heart_blood/src/BloodCardView.cpp
code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageCardView.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp

index 695e06d..0c61568 100644 (file)
@@ -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();
index 4c4103c..f2d6d52 100644 (file)
@@ -41,36 +41,7 @@ namespace OHOS
      */\r
     bool BloodCardView::AddButton()\r
     {\r
-#if 0\r
-        // Add Button to App\r
-        if (warnButton == nullptr)\r
-        {\r
-            warnButton = new UIButton();\r
-        }\r
-        warnButton->SetPosition(300, 102); // widget's left position and top position\r
-        warnButton->Resize(26, 26);       // widget's width and height\r
-        warnButton->SetViewId(WARNING);   // Set style\r
-        warnButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
-        warnButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-        char *button1defaultImgSrc = "/user/res/Blood/Vector.bin";\r
-        char *button1triggeredImgSrc = nullptr;\r
-        warnButton->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
-        warnButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-        Add(warnButton);\r
-        // Add LabelButtonExt to App\r
-        if (monitorButton == nullptr)\r
-        {\r
-            monitorButton = new UILabelButton();\r
-        }\r
-        monitorButton->SetPosition(118, 336); // widget's left position and top position\r
-        monitorButton->Resize(230, 80);       // widget's width and height\r
-        monitorButton->SetViewId(CHECK);      // Set style\r
-        monitorButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffcd492c);\r
-        monitorButton->SetText("检测");\r
-        monitorButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
-        monitorButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-        Add(monitorButton);\r
-#endif\r
+\r
         return true;\r
     }\r
     /***\r
index 39d43d2..c678b10 100644 (file)
@@ -28,6 +28,7 @@ namespace OHOS
         void AddMessageToList(const MessageListItem &item);
         bool InitPage();
         bool SetupViewPage(MessageView *messageView);
+        UIList *GetList();
 
     private:
         void InitView(void);
index 134e1cb..856346e 100644 (file)
@@ -49,6 +49,7 @@ namespace OHOS
             return false;
         }
         Add(messageview);
+        messageview->GetList()->RefreshList(); // 刷新列表
         return true;
     }
 
index 29c2410..581d7b9 100644 (file)
@@ -41,7 +41,6 @@ namespace OHOS
 
     void MessagePresenter::OnResume(void)
     {
-        // 把歌曲信息数据拿到存储到list中
         if (view_ == nullptr)
         {
             return;
index 2155af5..62b6a8f 100644 (file)
@@ -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<MessagePresenter>::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<UIView::OnDragListener *>(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