applist的弧形列表合并,显示方式界面解决内存泄露
authorluozheng <1732036298@qq.com>
Tue, 20 May 2025 03:50:26 +0000 (11:50 +0800)
committerluozheng <1732036298@qq.com>
Tue, 20 May 2025 03:50:26 +0000 (11:50 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/include/AppItemView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/include/ApplistAdapter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/include/ApplistModel.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/include/ApplistPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/include/ApplistView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/AppItemView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistAdapter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistModel.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp

index 077e4c1..bd89ec7 100644 (file)
@@ -13,6 +13,9 @@
 #include "components/ui_image_view.h"
 #include "ApplistModel.h"
 #include "UiConfig.h"
+#include "components/ui_transform_group.h"
+#include "components/ui_label_ext.h"
+#include "ui_resource_string.h"
 
 namespace OHOS {
 class AppItemView : public UIViewGroup {
@@ -73,6 +76,29 @@ private:
     WaterfallItemView &operator = (const WaterfallItemView &);
     AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr };
 };
+
+//弧形列表ItemView
+class ArcScaleListItemView : public UITransformGroup
+{
+public:
+    ArcScaleListItemView();
+    ~ArcScaleListItemView();
+
+    void SetItemInfo(const AppItem &itemInfo);
+    AppViewId GetViewId();
+    const char * GetAppUid();
+    void SetUpChild();
+    UILabelExt *GetLabel(void);
+    UIImageView *GetImage(void);
+
+    ArcScaleListItemView(const ArcScaleListItemView &) = delete;
+    ArcScaleListItemView &operator=(const ArcScaleListItemView &) = delete;
+
+private:
+    UIImageView * image_{nullptr};
+    UILabelExt * label_{nullptr};
+    AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr, nullptr, 0 };
+};
 }
 
 #endif
index 5302fbc..3be80b8 100644 (file)
@@ -50,5 +50,25 @@ private:
     std::list<AppItem> listData_;
     UIView::OnClickListener *itemClickListener_;
 };
+
+class ArcScaleListItemAdapter : public AbstractAdapter 
+{
+public:
+    ArcScaleListItemAdapter();
+    ~ArcScaleListItemAdapter() override;
+
+    UIView* GetView(UIView* inView, int16_t index) override;
+    uint16_t GetCount() override;
+    void AddListItem(const AppItem &item);
+
+    void SetItemClickListener(UIView::OnClickListener *itemClickListener)
+    {
+        itemClickListener_ = itemClickListener;
+    }
+
+private:
+    List<AppItem> nodeList_;
+    UIView::OnClickListener * itemClickListener_;
+};
 }
 #endif
\ No newline at end of file
index 7038967..8127fce 100644 (file)
@@ -46,6 +46,13 @@ public:
     AppListStyle GetCurrentStyle(void);
     void SetInitFlag(bool flag);
 
+    /* ---------------------------------- 弧形列表 ---------------------------------- */
+    void SetArcListStartIndex(uint16_t index);
+    uint16_t GetArcListStartIndex(void);
+    void GetArcListHeadItemY(int y);
+    int GetArcListHeadItemY(void);
+    /* -------------------------------------------------------------------------- */
+
 private:
     ApplistModel();
     ApplistModel(const ApplistModel &);
@@ -61,6 +68,11 @@ private:
     uint16_t startIndex = 0;
     int headItemY = 0;
     bool initFlag{false};
+
+    /* ---------------------------------- 弧形列表 ---------------------------------- */
+    uint16_t arcListstartIndex = 0; // 圆弧列表起始位置
+    int arcListheadItemY = 0;       // 圆弧列表头部位置
+    /* -------------------------------------------------------------------------- */
 };
 }
 
index 5849d2d..9185875 100644 (file)
@@ -35,6 +35,13 @@ namespace OHOS {
         ApplistView* GetAppListView();
         AppListStyle GetCurrentStyle(void);
 
+        /* ---------------------------------- 弧形列表 ---------------------------------- */
+        void SetArcListStartIndex(uint16_t index);
+        uint16_t GetArcListStartIndex(void);
+        void SetArcListHeadItemY(int y);
+        int GetArcListHeadItemY(void);
+        /* -------------------------------------------------------------------------- */
+
     private:
         AppItemView *itemViewSele{nullptr};
         AppItemView *preItemViewSele{nullptr};
index 36cb49b..6908ae7 100644 (file)
@@ -24,6 +24,7 @@
 #include "ChangeSliceListener.h"
 #include "drag_event.h"
 #include "UiConfig.h"
+#include "components/ui_transform_list.h"
 
 namespace OHOS {
 class AppListOnDragListener : public UIView::OnDragListener {
@@ -149,6 +150,15 @@ private:
     void WaterfallStyleOnStop();
     UIWaterfallList* waterfallList_{nullptr};
     List<WaterfallItemView*> waterfallItemList_;
+
+    // arc scale list
+    void ArcScaleListStyleOnStart(void);
+    void ArcScaleListStyleOnSetUpView(void);
+    void ArcScaleListStyleOnStop(void);
+    UIViewGroup * ArcScaleListGroup_{nullptr};
+    UITransformList * ArcScaleList_{nullptr};
+    ArcScaleListItemAdapter * ArcScaleListAdapter_{nullptr};
+    UIView::OnDragListener * ArcScaleListDragListener_{nullptr};
 };
 }
 #endif // APPLIST_VIEW_H
\ No newline at end of file
index e4193a9..ec02338 100644 (file)
@@ -134,4 +134,94 @@ namespace OHOS {
     {
         return itemInfo_.uid;
     }
+    /* ---------------------------------- 弧形列表 ---------------------------------- */
+    #define ARC_SCALE_LIST_ITEM_WIDTH (400)
+    #define ARC_SCALE_LIST_ITEM_HEIGHT (110) 
+    
+    #define ARC_SCALE_LIST_IMAGE_X (0)
+    #define ARC_SCALE_LIST_IMAGE_WIDTH  (ARC_SCALE_LIST_ITEM_HEIGHT - 10)
+    #define ARC_SCALE_LIST_IMAGE_HEIGHT (ARC_SCALE_LIST_ITEM_HEIGHT - 10)
+    #define ARC_SCALE_LIST_IMAGE_Y ((ARC_SCALE_LIST_ITEM_HEIGHT - ARC_SCALE_LIST_IMAGE_HEIGHT) / 2)
+
+    #define ARC_SCALE_LIST_TEXT_X (ARC_SCALE_LIST_IMAGE_X + ARC_SCALE_LIST_IMAGE_WIDTH + 20)
+    #define ARC_SCALE_LIST_TEXT_WIDTH (ARC_SCALE_LIST_ITEM_WIDTH - ARC_SCALE_LIST_TEXT_X)
+    #define ARC_SCALE_LIST_TEXT_HEIGHT (44)
+    #define ARC_SCALE_LIST_TEXT_Y ((ARC_SCALE_LIST_ITEM_HEIGHT - ARC_SCALE_LIST_TEXT_HEIGHT) / 2)
+
+    ArcScaleListItemView::ArcScaleListItemView()
+    {
+        Resize(ARC_SCALE_LIST_ITEM_WIDTH, ARC_SCALE_LIST_ITEM_HEIGHT);
+        SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        SetTouchable(true);
+        SetUpChild();
+    }
+
+    ArcScaleListItemView::~ArcScaleListItemView()
+    {
+        RemoveAll();
+        if (image_ != nullptr) {
+            delete image_;
+            image_ = nullptr;
+        }
+        if (label_ != nullptr) {
+            delete label_;
+            label_ = nullptr;
+        }
+    }
+
+    void ArcScaleListItemView::SetItemInfo(const AppItem &itemInfo)
+    {
+        itemInfo_ = itemInfo;
+        image_->SetSrc(itemInfo.iconSmall);
+        label_->SetTextId(itemInfo.TextId);
+    }
+
+    void ArcScaleListItemView::SetUpChild()
+    {
+        if (image_ == nullptr) {
+            image_ = new UIImageView();
+            if (image_ == nullptr) {
+                return ;
+            }
+        }
+        image_->SetPosition(ARC_SCALE_LIST_IMAGE_X, ARC_SCALE_LIST_IMAGE_Y, ARC_SCALE_LIST_IMAGE_WIDTH, ARC_SCALE_LIST_IMAGE_HEIGHT);
+        image_->SetAutoEnable(false);
+        image_->SetResizeMode(UIImageView::FILL);
+        Add(image_);
+        /* -------------------------------------------------------------------------- */
+        if (label_ == nullptr) {
+            label_ = new UILabelExt();
+            if (label_ == nullptr) {
+                delete image_;
+                image_ = nullptr;
+                return ;
+            }
+        }
+        label_->SetPosition(ARC_SCALE_LIST_TEXT_X, ARC_SCALE_LIST_TEXT_Y, ARC_SCALE_LIST_TEXT_WIDTH, ARC_SCALE_LIST_TEXT_HEIGHT);
+        label_->SetStyle(STYLE_LINE_HEIGHT,44);
+        label_->SetStyle(STYLE_TEXT_FONT,38);
+        label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 38);  
+        label_->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+        label_->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_TOP);
+        Add(label_);
+    }
+    AppViewId ArcScaleListItemView::GetViewId()
+    {
+        return (AppViewId)itemInfo_.id;
+    }
+
+    const char *ArcScaleListItemView::GetAppUid()
+    {
+        return itemInfo_.uid;
+    }    
+
+    UILabelExt *ArcScaleListItemView::GetLabel(void)
+    {
+        return label_;
+    }
+
+    UIImageView *ArcScaleListItemView::GetImage(void)
+    {
+        return image_;
+    }
 }
index 8e26721..14f1afd 100644 (file)
@@ -56,4 +56,54 @@ void ApplistAdapter::AddListItem(const AppItem &item)
 {
     listData_.push_back(item);
 }
+/* ---------------------------------- 弧形列表 ---------------------------------- */
+ArcScaleListItemAdapter::ArcScaleListItemAdapter(){}
+
+ArcScaleListItemAdapter::~ArcScaleListItemAdapter()
+{
+    nodeList_.Clear();
+}
+
+uint16_t ArcScaleListItemAdapter::GetCount()
+{
+    return nodeList_.Size();
+}
+
+void ArcScaleListItemAdapter::AddListItem(const AppItem &item)
+{
+    nodeList_.PushBack(item);
+}
+
+UIView * ArcScaleListItemAdapter::GetView(UIView* inView, int16_t index)
+{
+    if (nodeList_.IsEmpty() || index > nodeList_.Size() - 1 || index < 0) {
+        return nullptr;
+    }
+
+    ListNode<AppItem>* node = nodeList_.Begin();
+    for (uint16_t i = 0; i < index; i++) {
+        node = node->next_;
+    }
+
+    ArcScaleListItemView * item = nullptr;
+    if (inView == nullptr) 
+    {
+        item = new ArcScaleListItemView();
+        if (nullptr == item)
+            return nullptr;
+    } 
+    else 
+    {
+        item = static_cast<ArcScaleListItemView*>(inView);
+    }
+
+    if (item != nullptr) 
+    {
+        item->SetViewIndex(index);
+
+        item->SetItemInfo(node->data_);
+        item->SetOnClickListener(itemClickListener_);
+    }
+    return item;
+}
 } // namespace OHOS
index a11a9ab..d6d2bc0 100644 (file)
@@ -144,6 +144,29 @@ namespace OHOS {
         return headItemY;
     }
 
+    //设置弧形列表的起始位置
+    void ApplistModel::SetArcListStartIndex(uint16_t index)
+    {
+        arcListstartIndex = index;
+    }
+
+    //获取弧形列表的起始位置
+    uint16_t ApplistModel::GetArcListStartIndex(void)
+    {
+        return arcListstartIndex;
+    }
+
+    //设置弧形列表的头部位置
+    void ApplistModel::GetArcListHeadItemY(int y)
+    {
+        arcListheadItemY = y;
+    }
+    //获取弧形列表的头部位置
+    int ApplistModel::GetArcListHeadItemY(void)
+    {
+        return arcListheadItemY;
+    }
+
     void ApplistModel::ApplistUpdate(void)
     {
         ResolvingJSAppItems();
@@ -164,6 +187,8 @@ namespace OHOS {
 
     AppListStyle ApplistModel::GetCurrentStyle(void)
     {
+        return ThemeStyleModel::GetInstance().GetAppListDisplayStyle(); //根据显示样式界面设置的返回当前applit样式
+        #if 0 
         uint8_t currenStyle = SetDesktopView::GetInstance()->GetCurrentSelectedStyle();
         if (currenStyle == 1) { // 1: hexagons desktop style
             return HEXAGONS_STYLE;
@@ -174,5 +199,6 @@ namespace OHOS {
         } else {
             return APPLIST_STYLE;
         }
+        #endif
     }
 }
index 2d450a2..453781e 100644 (file)
@@ -108,6 +108,15 @@ REGIST_SLICE(VIEW_APPLIST, ApplistView, ApplistPresenter);
             waterfallView->SetDraggable(false);
             waterfallView->Scale(1.0f, itemView->GetViewIndex());
             type = TransitionType::TRANSITION_WATERFALL;
+        } else if (AppListStyle::ARC_SCALE_LIST_STYLE == style) {
+            ArcScaleListItemView *itemView = dynamic_cast<ArcScaleListItemView *>(&view);
+            if (nullptr == itemView)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ArcScaleListItemView or itemView is nullptr");
+                return false;
+            }
+            viewId = itemView->GetViewId();
+            uid = (char *)itemView->GetAppUid();
         } else {
             AppItemView *itemView = dynamic_cast<AppItemView *>(&view);
             if (itemView == nullptr) {
@@ -198,4 +207,29 @@ REGIST_SLICE(VIEW_APPLIST, ApplistView, ApplistPresenter);
         return view_;
     }
 
+    /* ---------------------------------- 弧形列表 ---------------------------------- */
+    //设置弧形列表起始索引
+    void ApplistPresenter::SetArcListStartIndex(uint16_t index)
+    {
+        model->SetArcListStartIndex(index);
+        return;
+    }
+
+    //获取弧形列表起始索引
+    uint16_t ApplistPresenter::GetArcListStartIndex(void)
+    {
+        return model->GetArcListStartIndex();
+    }
+
+    //设置弧形列表头部Item的Y坐标
+    void ApplistPresenter::SetArcListHeadItemY(int y)
+    {
+        model->GetArcListHeadItemY(y);
+    }
+
+    //获取弧形列表头部Item的Y坐标
+    int ApplistPresenter::GetArcListHeadItemY(void)
+    {
+        return model->GetArcListHeadItemY();
+    }
 }
index 11876d2..86d94b7 100644 (file)
@@ -53,17 +53,42 @@ ApplistView::~ApplistView()
         callback_ = nullptr;
     }
     enterAnimator_ = nullptr;
+    /* -------------------------------------------------------------------------- */
+    if(nullptr != ArcScaleListAdapter_)
+    {
+        delete ArcScaleListAdapter_;
+        ArcScaleListAdapter_ = nullptr;
+    }
+    if(nullptr != ArcScaleList_)
+    {
+        delete ArcScaleList_;
+        ArcScaleList_ = nullptr;
+    }
+    if(nullptr != ArcScaleListGroup_)
+    {
+        delete ArcScaleListGroup_;
+        ArcScaleListGroup_ = nullptr;
+    }
+    if(nullptr != ArcScaleListDragListener_)
+    {
+        delete ArcScaleListDragListener_;
+        ArcScaleListDragListener_ = nullptr;
+    }
+    /* -------------------------------------------------------------------------- */
 }
 
 void ApplistView::OnStart()
 {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStart start...");
     AppListStyle style = presenter_->GetCurrentStyle();
     if (style == AppListStyle::FOOTBALL_STYLE) {
         FootballStyleOnStart();
     } else if (style == AppListStyle::HEXAGONS_STYLE) {
         HexagonsStyleOnStart();
-    } else if (style == AppListStyle::WATERFALL_STYLE) {
-        WaterfallStyleOnStart();
+    } else if(style == AppListStyle::ARC_SCALE_LIST_STYLE) {
+        ArcScaleListStyleOnStart();
+    } else if(style == AppListStyle::CIRCLE_LIST_STYLE) {
+        // CircleListStyleOnStart();
     } else {
         ListStyleOnStart();
     }
@@ -143,6 +168,169 @@ void ApplistView::WaterfallStyleOnStart()
     AddViewToRootContainer(waterfallList_);
 }
 
+/* ---------------------------------- 弧形列表 ---------------------------------- */
+#define ARC_SCALE_LIST_SCALE_FACTOR (400)
+#define ARC_SCALE_LIST_X (25)
+#define ARC_SCALE_LIST_Y (0)
+#define ARC_SCALE_LIST_WIDTH (Screen::GetInstance().GetWidth() - ARC_SCALE_LIST_X)
+#define ARC_SCALE_LIST_HEIGHT (Screen::GetInstance().GetHeight())
+
+/**
+ * @brief 根据位置变换列表项的基础函数
+ * 
+ * 这个函数根据列表项在垂直列表中的位置来调整其缩放比例。它使用一个缓动函数来计算缩放比例,使得列表项在接近列表中心时逐渐放大,远离列表中心时逐渐缩小。
+ * 
+ * @param list 指向 UITransformList 类型的指针,代表要操作的列表。
+ * @param item 指向 UIView 类型的指针,代表要变换的列表项。
+ * @return 如果变换成功,返回 true;否则返回 false。
+ */
+static bool TransformItemBaseOnPosition(UITransformList* list, UIView* item)
+{
+    // 检查传入的参数是否有效
+    if (list == nullptr || item == nullptr) {
+        return false;
+    }
+    // 检查列表项的类型是否为 UI_TRANSFORM_GROUP
+    if (item->GetViewType() != UI_TRANSFORM_GROUP) {
+        return false;
+    }
+    // 将列表项转换为 UITransformGroup 类型
+    UITransformGroup* group = dynamic_cast<UITransformGroup*>(item);
+    // 如果转换失败,返回 false
+    if (group == nullptr) {
+        return false;
+    }
+    // 获取列表项的宽度和高度
+    int16_t w = group->GetWidth();
+    int16_t h = group->GetHeight();
+    // 如果列表的方向是垂直的
+    if (list->GetDirection() == UIList::VERTICAL) {
+        // 计算列表的垂直中心位置
+        int16_t midY = list->GetY() + (list->GetHeight() >> 1);
+        // 获取列表项的垂直位置
+        int16_t y = group->GetY();
+        // 计算列表项到列表中心的垂直偏移量
+        int offset = (y + (h >> 1) - midY);
+        // 使用 SineEaseIn 缓动函数计算缩放比例
+        int temp = EasingEquation::SineEaseIn(0, ARC_SCALE_LIST_SCALE_FACTOR, abs(offset), ARC_SCALE_LIST_SCALE_FACTOR);
+        // 计算最终的缩放比例
+        float scale = 1.0 - (static_cast<float>(temp) / ARC_SCALE_LIST_SCALE_FACTOR);
+        // 应用缩放比例到列表项
+        group->Scale(Vector2<float>(scale, scale), Vector2<float>(w * 0.75,  h >> 1));
+        // 如果列表项在列表的中心区域,返回 true
+        if ((y <= midY) && (y + group->GetHeight() >= midY)) {
+            return true;
+        }
+    }
+    // 如果列表项不在列表的中心区域,返回 false
+    return false;
+}
+
+void ApplistView::ArcScaleListStyleOnStart(void)
+{
+    if(nullptr == ArcScaleListGroup_) {
+        ArcScaleListGroup_ = new UIViewGroup();
+        if(nullptr == ArcScaleListGroup_)
+            return;
+
+        ArcScaleListGroup_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        ArcScaleListGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+        ArcScaleListGroup_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+        AddViewToRootContainer(ArcScaleListGroup_);
+    }
+
+    if(nullptr == ArcScaleListAdapter_)
+    {
+        ArcScaleListAdapter_ = new ArcScaleListItemAdapter();
+        if(nullptr == ArcScaleListAdapter_)
+            return;
+        
+        ArcScaleListAdapter_->SetItemClickListener(presenter_);
+    }
+    
+    if (nullptr == ArcScaleList_)
+    {
+        ArcScaleList_ = new UITransformList(UIList::VERTICAL);
+        if (nullptr == ArcScaleList_)
+            return;
+    
+        ArcScaleList_->SetPosition(ARC_SCALE_LIST_X, ARC_SCALE_LIST_Y, ARC_SCALE_LIST_WIDTH, ARC_SCALE_LIST_HEIGHT);
+        ArcScaleList_->SetItemTransformFunc(&TransformItemBaseOnPosition);
+        // ArcScaleList_->SetAdapter(ArcScaleListAdapter_);
+        ArcScaleList_->SetDraggable(true);
+        ArcScaleList_->SetThrowDrag(true);
+        ArcScaleList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        ArcScaleList_->SetScrollBlankSize(10);//(50);
+        ArcScaleList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
+        ArcScaleList_->SetYScrollBarVisible(true);
+        // ArcScaleList_->SetScrollStateListener(presenter_);
+        ArcScaleList_->SetReboundSize(5);
+        ArcScaleList_->EnableAutoAlign(true);
+        ArcScaleList_->SetItemSpace(0);
+        ArcScaleList_->SetSelectPosition(ARC_SCALE_LIST_HEIGHT / 2);
+        ArcScaleList_->SetRotateFactor(2.0);
+        ArcScaleList_->RequestFocus();
+        ArcScaleList_->RefreshList();
+
+        if(nullptr == ArcScaleListDragListener_)
+        {
+            ArcScaleListDragListener_ = new AppListOnDragListener();
+            if (nullptr == ArcScaleListDragListener_)
+                return;
+        }
+        ArcScaleList_->SetOnDragListener(ArcScaleListDragListener_);
+
+        ArcScaleListGroup_->Add(ArcScaleList_);
+    }
+}
+void ApplistView::ArcScaleListStyleOnSetUpView(void)
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ArcScaleListStyleOnSetUpView [%d]", __LINE__);
+    if (ArcScaleList_ == nullptr || ArcScaleListAdapter_ == nullptr) {
+        return;
+    }
+
+    uint16_t startIndex = 0;
+    int16_t headY = 0;
+    if (presenter_->GetArcListStartIndex() >= presenter_->GetListItemNum()) { 
+        startIndex = presenter_->GetListItemNum() - 1;
+        headY = VERTICAL_RESOLUTION / NUM_2;
+    } else {
+        uint16_t presliceId = NativeAbility::GetInstance().GetPreSliceId();
+        if (presliceId == VIEW_MAIN) //如果是从主页进入的,那么startIndex = 0,headY = 0
+        {
+            startIndex = 0;
+            headY = 0;
+        } else { //如果是从其他页面进入的,那么startIndex = presenter_->GetArcListStartIndex(),headY = presenter_->GetArcListHeadItemY()
+            startIndex = presenter_->GetArcListStartIndex();
+            headY = presenter_->GetArcListHeadItemY();
+        }
+        if (headY == 0) { 
+            // headY = VERTICAL_RESOLUTION / NUM_2;
+            headY = -42;
+        }
+    }
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[%d],startIndex = %d,headY = %d", __LINE__,startIndex,headY);
+    ArcScaleList_->SetStartIndex(startIndex);//设置起始索引。
+    ArcScaleList_->SetAdapter(ArcScaleListAdapter_);
+    ArcScaleList_->ScrollBy(headY);//滚动到指定的 headY 位置。
+    return;
+}
+//弧形列表
+void ApplistView::ArcScaleListStyleOnStop(void)
+{
+    if(nullptr != ArcScaleListGroup_)
+    {
+        ArcScaleListGroup_->RemoveAll();
+    }
+    int16_t arclistHeadY = ArcScaleList_->GetChildrenHead()->GetY();
+    int16_t arclistHeadIndex = ArcScaleList_->GetChildrenHead()->GetViewIndex();
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[%d],listHeadY = %d,listHeadIndex = %d", __LINE__,arclistHeadY,arclistHeadIndex);
+    presenter_->SetArcListHeadItemY(arclistHeadY);         //设置头部Y坐标
+    presenter_->SetArcListStartIndex(arclistHeadIndex);    //设置头部Index
+}
+/* -------------------------------------------------------------------------- */
+
 void ApplistView::ListStyleOnStart()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart");
@@ -200,6 +388,8 @@ void ApplistView::OnStop()
         HexagonsStyleOnStop();
     } else if (style == AppListStyle::WATERFALL_STYLE) {
         WaterfallStyleOnStop();
+    } else if (style == AppListStyle::ARC_SCALE_LIST_STYLE) {
+        ArcScaleListStyleOnStop();
     } else {
         ListStyleOnStop();
     }
@@ -291,6 +481,8 @@ void ApplistView::AddAppItemToList(const AppItem &item)
         itemView->SetOnClickListener(presenter_);
         waterfallList_->Add(itemView);
         waterfallItemList_.PushBack(itemView);
+    } else if(style == AppListStyle::ARC_SCALE_LIST_STYLE) {
+        ArcScaleListAdapter_->AddListItem(item);
     } else {
         listAdapter_->AddListItem(item);
     }
@@ -305,6 +497,8 @@ void ApplistView::ClearAppItemToList()
         HexagonsStyleOnStop();
     } else if (style == AppListStyle::WATERFALL_STYLE) {
         WaterfallStyleOnStop();
+    } else if(AppListStyle::ARC_SCALE_LIST_STYLE == style) {
+        ArcScaleListStyleOnStop();
     } else {
         listAdapter_->ClearItem();
     }
@@ -320,6 +514,8 @@ void ApplistView::RefreshAppList(void)
         hexagonsList_->LayoutChildren(true);
     } else if (style == AppListStyle::WATERFALL_STYLE) {
         waterfallList_->LayoutChildren(true);
+    }  else if (style == AppListStyle::ARC_SCALE_LIST_STYLE) {
+        ArcScaleListStyleOnSetUpView();
     } else {
         uint16_t startIndex = 0;
         int16_t headY = 0;
index a233fb3..f38d8df 100644 (file)
@@ -327,10 +327,6 @@ namespace OHOS
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleView::OnStart");
         View<ThemeStylePresenter>::OnStart();
-        AddViewToRootContainer(new UIViewGroup());
-        GetRootContainer()->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
-        GetRootContainer()->SetTouchable(true);
-        GetRootContainer()->SetDraggable(true);
 
         if (!initViewStatus)
         {