applist1201patch列表样式升级 3365/1
authorluozheng <1732036298@qq.com>
Fri, 24 Apr 2026 08:13:50 +0000 (16:13 +0800)
committerluozheng <1732036298@qq.com>
Fri, 24 Apr 2026 08:13:50 +0000 (16:13 +0800)
19 files changed:
code/sdk/application/wearable/n9/nativeabilityfwk/src/AbilitySlice.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/AppItemView.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ApplistAdapter.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ApplistModel.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ApplistPresenter.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ApplistView.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/DesktopFactory.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/ListDesktopFragment.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/UIDesktopFragment.h
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/AppItemView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ApplistAdapter.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ApplistModel.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ApplistView.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/DesktopFactory.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/ListDesktopFragment.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/UIDesktopFragment.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/key/src/KeyInputListener.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/languagecode/src/LanguageSwitchView.cpp

index 68ab45d..5fdd9e1 100644 (file)
@@ -22,7 +22,6 @@ const uint32_t PAGE_OFFSET = 16;
 
 void AbilitySlice::OnStart(void* data)
 {
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnStart");
     if ((presenter_ == nullptr) || (view_ == nullptr)) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "Presenter or View  was nullptr for slice %s", sliceId_);
         return;
@@ -48,7 +47,6 @@ void AbilitySlice::OnStart(void* data)
 
 void AbilitySlice::OnResume()
 {
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume state_ = %d", state_);
     if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAIN || NativeAbility::GetInstance().GetCurSliceId() == VIEW_APPLIST)
     {
         if (!ImageCacheManager::GetInstance().IsInAod()) {
@@ -63,7 +61,6 @@ void AbilitySlice::OnResume()
         return;
     }
 
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__);
     if (view_->GetRootContainer()->GetParent() == nullptr) {
         RootView::GetInstance()->Add(view_->GetRootContainer());
     }
@@ -84,13 +81,9 @@ void AbilitySlice::OnResume()
         view_->GetRootContainer()->SetOnDragListener(backDragListener);
     }
 
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__);
     slicePageMgr_.ResumeSlicePage();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__);
     presenter_->OnResume();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__);
     view_->Draw();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__);
     state_ = SliceState::RESUME;
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume state_ = %d", state_);
 }
index eebb4af..836127a 100644 (file)
@@ -8,14 +8,11 @@
 #ifndef APP_ITEM_VIEW_H
 #define APP_ITEM_VIEW_H
 
-#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
 #include "components/ui_view_group.h"
 #include "components/ui_image_view.h"
 #include "applist/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 {
@@ -33,71 +30,8 @@ private:
     AppItemView &operator = (const AppItemView &);
 
     UIImageView icon_;
-    UILabel label_;
-    AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr };
-};
-
-class HexagonsItemView : public UIImageView {
-public:
-    explicit HexagonsItemView();
-    ~HexagonsItemView();
-    void SetItemInfo(const AppItem &itemInfo);
-    AppViewId GetViewId();
-    const char *GetAppUid();
-private:
-    HexagonsItemView(const HexagonsItemView &);
-    HexagonsItemView &operator = (const HexagonsItemView &);
-    AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr };
-};
-
-class FootballItemView : public UIImageView {
-public:
-    explicit FootballItemView() {}
-    ~FootballItemView() {}
-    void SetItemInfo(const AppItem &itemInfo);
-    AppViewId GetViewId();
-    const char *GetAppUid();
-private:
-    FootballItemView(const FootballItemView &);
-    FootballItemView &operator = (const FootballItemView &);
-    AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr };
-};
-
-
-class WaterfallItemView : public UIImageView {
-public:
-    explicit WaterfallItemView() {}
-    ~WaterfallItemView() {}
-    void SetItemInfo(const AppItem &itemInfo);
-    AppViewId GetViewId();
-    const char *GetAppUid();
-private:
-    WaterfallItemView(const WaterfallItemView &);
-    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 };
+    UILabelExt label_;
+    AppItem itemInfo_;
 };
 }
 
index 6ccb3a3..bd9c37d 100644 (file)
@@ -51,7 +51,7 @@ private:
     std::list<AppItem> listData_;
     UIView::OnClickListener *itemClickListener_;
 };
-
+#if 0
 /* -------------------------------------------------------------------------- */
 /* ---------------------------------- 弧形列表 ---------------------------------- */
 class ArcScaleListItemAdapter : public AbstractAdapter 
@@ -84,6 +84,7 @@ public:
     static void native_app_position_update(UIImageView ** CircleListAPP,int CircleListAPPNum,UIImageView *CircleListSelectImage_,int startangle,bool isDirectRotate);
     static int angleIncrement;
 };
+#endif
 
 }
 #endif
\ No newline at end of file
index 95d4510..17c8996 100644 (file)
 #include "bundle_info.h"
 #include "AppViewIDs.h"
 #include "ohos_types.h"
-#include "themestyle/include/ThemeStyleModel.h"
 #include "ui_resource_string.h"
 
 #define APP_MAX_NUM 50
 
 namespace OHOS {
-typedef struct {
-    uint16_t id;
-    const char *iconLarge;
-    const char *iconSmall;
-    const char *iconHexagon;
-    const char *label;
-    const char *uid;
-    uint16_t TextId;
-} AppItem;
 
 #define AppListStyle ThemeStyle
+struct AppItem {
+    uint16_t id = VIEW_INVALID;
+    const char *iconLarge = nullptr;
+    const char *iconSmall = nullptr;
+    const char *iconHexagon = nullptr;
+    const char *label = nullptr;
+    const char *uid = nullptr;    
+    uint16_t labelId = STR_MAX_ID;
+
+    AppItem() = default;
+    AppItem(uint16_t id, const char *iconLarge,const char *iconHexagon, const char *label, const char *uid) :
+    id(id),
+    iconLarge(iconLarge),
+    iconHexagon(iconHexagon),
+    label(label),
+    uid(uid){}
+    
+    AppItem(uint16_t id, const char *iconLarge, const char *iconSmall, const char *iconHexagon, const char *label, const char *uid, uint16_t labelId) :
+    id(id),
+    iconLarge(iconLarge),
+    iconSmall(iconSmall),
+    iconHexagon(iconHexagon),
+    label(label),
+    uid(uid),
+    labelId(labelId) {}
+};
 
 class ApplistPresenter;
 class ApplistModel {
@@ -40,28 +56,14 @@ public:
     void ResolvingJSAppItems(void);
     void SetStartIndex(uint16_t index);
     uint16_t GetStartIndex(void);
+    void SetLastOffset(int16_t x, int16_t y);
+    void GetLastOffset(int16_t& x, int16_t& y);
     void SetHeadItemY(int index);
     int GetHeadItemY(void);
     void ApplistUpdate(void);
     void SetPresenter(ApplistPresenter *p);
-    AppListStyle GetCurrentStyle(void);
     void SetInitFlag(bool flag);
-
-    /* -------------------------------------------------------------------------- */
-    /* ---------------------------------- 弧形列表 ---------------------------------- */
-    void SetArcListStartIndex(uint16_t index);
-    uint16_t GetArcListStartIndex(void);
-    void GetArcListHeadItemY(int y);
-    int GetArcListHeadItemY(void);
-    /* -------------------------------------------------------------------------- */
-    /* ----------------------------------- 拨号盘 ---------------------------------- */
-    void SetCircleListStartAngle(int angle);
-    int GetCircleListStartAngle(void);
-    void SetCurselectImageIndex(int index);
-    int GetCurselectImageIndex(void);
-    void SetPreselectImageIndex(int index);
-    int GetPreselectImageIndex(void);
-    /* -------------------------------------------------------------------------- */
+    void CleanupApplistStrings(uint8_t nativeAppNumTotal);
 
 private:
     ApplistModel();
@@ -70,24 +72,16 @@ private:
     virtual ~ApplistModel();
     ApplistPresenter *presenter{nullptr};
 
-    AppItem applist[APP_MAX_NUM] = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr, nullptr ,0};
+    AppItem applist[APP_MAX_NUM];
     BundleInfo *bundleInfos = nullptr;
     int32 bundleLen = 0;
     uint8 appLen = 0;
-
+    uint8 nativeAppNumTotal = 0;
     uint16_t startIndex = 0;
     int headItemY = 0;
+    int16_t lastOffsetX = 0;
+    int16_t lastOffsetY = 0;
     bool initFlag{false};
-
-    /* ---------------------------------- 弧形列表 ---------------------------------- */
-    uint16_t arcListstartIndex = 0; // 圆弧列表起始位置
-    int arcListheadItemY = 0;       // 圆弧列表头部位置
-    /* -------------------------------------------------------------------------- */
-    /* ----------------------------------- 拨号盘 ---------------------------------- */
-    int circleListStartAngle{0};
-    int curselectImageIndex{0};
-    int preselectImageIndex{0};
-    /* -------------------------------------------------------------------------- */
 };
 }
 
index 0945800..77c1ef4 100644 (file)
@@ -8,46 +8,22 @@
 #ifndef APPLIST_PRESENTER_H
 #define APPLIST_PRESENTER_H
 
-#include "key/include/KeyInputListener.h"
 #include "Presenter.h"
-#include "ohos_types.h"
-#include "AppItemView.h"
-#include "ApplistView.h"
+#include "applist/include/ApplistView.h"
 #include "applist/include/ApplistModel.h"
-#include "components/root_view.h"
 
 namespace OHOS {
-    class ApplistPresenter : public Presenter<ApplistView>, public UIView::OnClickListener,
-                             public ListScrollListener, public UIView::OnRotateListener {
-    public:
-        ApplistPresenter();
-        ~ApplistPresenter() override;
+class ApplistPresenter : public Presenter<ApplistView> {
+public:
+    ApplistPresenter();
+    ~ApplistPresenter() override;
+    void OnStart() override;
+    void OnResume() override;
+    ApplistView* GetAppListView();
 
-        void OnStart() override;
-        void OnResume() override;
-        bool OnRotate(UIView& view, const RotateEvent& event) override;
-        bool OnClick(UIView &view, const ClickEvent &event) override;
-        void OnItemSelected(int16 index, UIView *view) override;
-        void SetStartIndex(uint16_t index);
-        uint16_t GetStartIndex(void);
-        void SetHeadItemY(int y);
-        int GetHeadItemY(void);
-        uint8_t GetListItemNum(void);
-        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};
-        ApplistModel *model{nullptr};
-    };
+private:
+    ApplistModel *model{nullptr};
+};
 }
 
 #endif // APPLIST_PRESENTER_H
index 8aa3ff0..7e502f0 100644 (file)
 #define APPLIST_VIEW_H
 
 #include "View.h"
-#include "animator/animator_manager.h"
-#include "components/root_view.h"
-#include "components/ui_view_group.h"
-#include "components/ui_scroll_view.h"
-#include "components/ui_label.h"
-#include "components/ui_list.h"
-#include "components/ui_custom_hexagons_list.h"
-#include "components/ui_waterfall_list.h"
-#include "components/ui_icosahedron_view.h"
-#include "gfx_utils/list.h"
-#include "ohos_types.h"
-#include "ApplistAdapter.h"
-#include "ChangeSliceListener.h"
-#include "drag_event.h"
-#include "UiConfig.h"
-#include "components/ui_transform_list.h"
-#include "components/ui_picker.h"
+#include "UIDesktopFragment.h"
 
 namespace OHOS {
-class AppListOnDragListener : public UIView::OnDragListener {
-public:
-    AppListOnDragListener()
-    {
-        continueDrag = false;
-    }
-    ~AppListOnDragListener() override {}
-    bool OnDragStart(UIView& view, const DragEvent& event) override
-    {
-        UNUSED(view);
-        UNUSED(event);
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondragstart!!");
-        continueDrag = true;
-        return false;
-    }
-
-    bool OnDrag(UIView& view, const DragEvent& event) override
-    {
-        UNUSED(view);
-        if (!continueDrag) {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppList : Can not continue drag!!");
-            return false;
-        }
-        if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) &&
-            (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondrag!!");
-            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TransitionType::TRANSITION_INVALID);
-        }
-
-        return false;
-    }
-
-    bool OnDragEnd(UIView& view, const DragEvent& event) override
-    {
-        UNUSED(view);
-        UNUSED(event);
-        return false;
-    }
-private:
-    bool continueDrag{false};
-};
-
-class FootballAnimatorCallback : public AnimatorCallback {
-public:
-    explicit FootballAnimatorCallback(UIView* view, int16_t startPos, int16_t endPos)
-        : startPos_(startPos),
-          endPos_(endPos),
-          startTime_(0),
-          animator_(new Animator(this, view, 1000, false)) {}  // 1000:duration of animator_, in milliseconds.
-
-    ~FootballAnimatorCallback() override
-    {
-        if (animator_ != nullptr) {
-            delete animator_;
-            animator_ = nullptr;
-        }
-    }
-
-    void Callback(UIView* view) override;
-
-    Animator* GetAnimator() const
-    {
-        return animator_;
-    }
-
-    void SetStartTime(uint32_t time)
-    {
-        isStartAnim_ = false;
-        startTime_ = time;
-    }
-protected:
-    int16_t startPos_;
-    int16_t endPos_;
-    uint32_t startTime_;
-    bool isStartAnim_ = false;
-    Animator* animator_;
-};
-
 class ApplistPresenter;
 class ApplistView : public View<ApplistPresenter> {
 public:
-    ApplistView();
-    ~ApplistView() override;
+    ApplistView() {};
+    ~ApplistView() override {};
 
     void OnStart() override;
     void OnStop() override;
-
+    void OnResume();
     void AddAppItemToList(const AppItem &item);
     void ClearAppItemToList();
-    void RefreshAppList(void);
-    void StartFootBallAnimator();
-    void ResumeWaterFallDraggable();
+    void RefreshAppList();
 
 private:
-    /* for list style */
-    void ListStyleOnStart();
-    void ListStyleOnStop();
-    ApplistAdapter *listAdapter_{nullptr};
-    UIList *contentList_{nullptr};
-    UIView::OnDragListener *dragListener_{nullptr};
-
-    /* for hexagons style */
-    void HexagonsStyleOnStart();
-    void HexagonsStyleOnStop();
-    UICustomHexagonsList* hexagonsList_{nullptr};
-    List<HexagonsItemView*> listHexagonsView_;
-    uint16_t imgSize_ = 0;
-    uint16_t imgDistance_ = 0;
-
-    /* for football style */
-    void FootballStyleOnStart();
-    void FootballStyleOnStop();
-    UIIcosahedronView* footballList_ = nullptr;
-    List<FootballItemView*> footballItemList_;
-    ImageInfo* footballDefaultImg_ = nullptr;
-    FootballAnimatorCallback* callback_ = nullptr;
-    Animator* enterAnimator_ = nullptr;
-
-    /* for waterfall style */
-    void WaterfallStyleOnStart();
-    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};
-
-    //for circleList style
-    void CircleListStyleOnStart(void);
-    void CircleListStyleOnSetUpView(void);
-    void CircleListStyleOnStop(void);
-    UIViewGroup * CircleListGroup_{nullptr};
-    UIImageView * CircleListAPP[12]{nullptr};
-    UIImageView * PointImage{nullptr};
-    UIImageView * CircleListSelectImage{nullptr};
-    UIPicker * CircleListPicker{nullptr};
-    UIScrollView * CircleListScrollView{nullptr};
-    int CircleListAPPNum{0};
+    UIDesktopFragment *desktopFragment_ = nullptr;
 };
 }
-#endif // APPLIST_VIEW_H
\ No newline at end of file
+#endif // APPLIST_VIEW_H
index d50a69c..f95f8af 100644 (file)
@@ -1,71 +1,71 @@
-// /*
-//  * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
-//  * Description: DesktopFactory
-//  * Author:
-//  * Create: 2025-07
-//  */
+/*
+ * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+ * Description: DesktopFactory
+ * Author:
+ * Create: 2025-07
+ */
 
-// #ifndef DESKTOP_FACTORY_H
-// #define DESKTOP_FACTORY_H
+#ifndef DESKTOP_FACTORY_H
+#define DESKTOP_FACTORY_H
 
-// #include <unordered_map>
-// #include "UIDesktopFragment.h"
+#include <unordered_map>
+#include "UIDesktopFragment.h"
 
-// namespace OHOS {
-// class DesktopInterface;
-// class DesktopFactory {
-// public:
-//     static DesktopFactory& GetInstance()
-//     {
-//         static DesktopFactory instance;
-//         return instance;
-//     }
-//     void RegisterDesktopStyle(const uint16_t style, DesktopInterface* desktop);
-//     UIDesktopFragment* CreateDesktopStyle(uint16_t style);
+namespace OHOS {
+class DesktopInterface;
+class DesktopFactory {
+public:
+    static DesktopFactory& GetInstance()
+    {
+        static DesktopFactory instance;
+        return instance;
+    }
+    void RegisterDesktopStyle(const uint16_t style, DesktopInterface* desktop);
+    UIDesktopFragment* CreateDesktopStyle(uint16_t style);
 
-// private:
-//     DesktopFactory() {};
-//     ~DesktopFactory() {};
-//     DesktopFactory(const DesktopFactory&) = delete;
-//     DesktopFactory &operator=(const DesktopFactory&) = delete;
-//     std::unordered_map<uint16_t, DesktopInterface*> desktops_;
-// };
+private:
+    DesktopFactory() {};
+    ~DesktopFactory() {};
+    DesktopFactory(const DesktopFactory&) = delete;
+    DesktopFactory &operator=(const DesktopFactory&) = delete;
+    std::unordered_map<uint16_t, DesktopInterface*> desktops_;
+};
 
-// class DesktopStyleRegister {
-// public:
-//     DesktopStyleRegister(const uint16_t style, DesktopInterface* uiCardPage)
-//     {
-//         DesktopFactory::GetInstance().RegisterDesktopStyle(style, uiCardPage);
-//     }
-// };
+class DesktopStyleRegister {
+public:
+    DesktopStyleRegister(const uint16_t style, DesktopInterface* uiCardPage)
+    {
+        DesktopFactory::GetInstance().RegisterDesktopStyle(style, uiCardPage);
+    }
+};
 
-// class DesktopInterface {
-// public:
-//     virtual UIDesktopFragment* CreateDesktop() = 0;
-//     DesktopInterface() = default;
-//     virtual ~DesktopInterface() = default;
-//     DesktopInterface(const DesktopInterface&) = delete;
-//     DesktopInterface& operator=(const DesktopInterface&) = delete;
-//     DesktopInterface(DesktopInterface&&) = delete;
-//     DesktopInterface& operator=(DesktopInterface&&) = delete;
-// };
+class DesktopInterface {
+public:
+    virtual UIDesktopFragment* CreateDesktop() = 0;
+    DesktopInterface() = default;
+    virtual ~DesktopInterface() = default;
+    DesktopInterface(const DesktopInterface&) = delete;
+    DesktopInterface& operator=(const DesktopInterface&) = delete;
+    DesktopInterface(DesktopInterface&&) = delete;
+    DesktopInterface& operator=(DesktopInterface&&) = delete;
+};
 
-// template <class D>
-// class DesktopProxy : public DesktopInterface {
-// public:
-//     UIDesktopFragment* CreateDesktop() override
-//     {
-//         D* d = new D();
-//         UIDesktopFragment* fragment = dynamic_cast<UIDesktopFragment*>(d);
-//         if (fragment == nullptr) {
-//             delete d;
-//         }
-//         return fragment;
-//     }
-// };
-// } // namespace OHOS
+template <class D>
+class DesktopProxy : public DesktopInterface {
+public:
+    UIDesktopFragment* CreateDesktop() override
+    {
+        D* d = new D();
+        UIDesktopFragment* fragment = dynamic_cast<UIDesktopFragment*>(d);
+        if (fragment == nullptr) {
+            delete d;
+        }
+        return fragment;
+    }
+};
+} // namespace OHOS
 
-// #define REGIST_DESKTOP_STYLE(style, D) \
-//     const static OHOS::DesktopStyleRegister (STATIC_VAR)(static_cast<uint16_t>(style), new DesktopProxy<D>())
+#define REGIST_DESKTOP_STYLE(style, D) \
+    const static OHOS::DesktopStyleRegister (STATIC_VAR)(static_cast<uint16_t>(style), new DesktopProxy<D>())
 
-// #endif // DESKTOP_FACTORY_H
\ No newline at end of file
+#endif // DESKTOP_FACTORY_H
\ No newline at end of file
index 4892e8a..b6d9aca 100644 (file)
@@ -1,81 +1,81 @@
-// /*
-//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
-//  * Description: ListDesktopFragment.h
-//  * Author:
-//  * Create: 2025-07-04
-//  */
+/*
+ * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+ * Description: ListDesktopFragment.h
+ * Author:
+ * Create: 2025-07-04
+ */
 
-// #ifndef LIST_DESKTOP_FRAGMENT_H
-// #define LIST_DESKTOP_FRAGMENT_H
+#ifndef LIST_DESKTOP_FRAGMENT_H
+#define LIST_DESKTOP_FRAGMENT_H
 
-// #include "UIDesktopFragment.h"
-// #include "ApplistAdapter.h"
-// #include "ChangeSliceListener.h"
-// #include "components/ui_list.h"
-// #include "drag_event.h"
+#include "UIDesktopFragment.h"
+#include "ApplistAdapter.h"
+#include "ChangeSliceListener.h"
+#include "components/ui_list.h"
+#include "drag_event.h"
 
-// namespace OHOS {
-// class ListDesktopFragment : public UIDesktopFragment {
-// public:
-//     bool OnClick(UIView &view, const ClickEvent &event) override;
-//     void OnItemSelected(int16 index, UIView *view) override;
-//     void AddAppItemToList(const AppItem &item) override;
-//     void ClearAppItemToList() override;
-//     void RefreshAppList() override;
+namespace OHOS {
+class ListDesktopFragment : public UIDesktopFragment {
+public:
+    bool OnClick(UIView &view, const ClickEvent &event) override;
+    void OnItemSelected(int16 index, UIView *view) override;
+    void AddAppItemToList(const AppItem &item) override;
+    void ClearAppItemToList() override;
+    void RefreshAppList() override;
 
-// protected:
-//     void OnCreateView(void* data) override;
-//     void OnDestroyView() override;
+protected:
+    void OnCreateView(void* data) override;
+    void OnDestroyView() override;
 
-// private:
-//     ApplistAdapter *listAdapter_{nullptr};
-//     UIList *contentList_{nullptr};
-//     UIView::OnDragListener *dragListener_{nullptr};
-//     AppItemView *itemViewSele{nullptr};
-//     AppItemView *preItemViewSele{nullptr};
-// };
+private:
+    ApplistAdapter *listAdapter_{nullptr};
+    UIList *contentList_{nullptr};
+    UIView::OnDragListener *dragListener_{nullptr};
+    AppItemView *itemViewSele{nullptr};
+    AppItemView *preItemViewSele{nullptr};
+};
 
-// class AppListOnDragListener : public UIView::OnDragListener {
-// public:
-//     AppListOnDragListener()
-//     {
-//         continueDrag_ = false;
-//     }
-//     ~AppListOnDragListener() override {}
-//     bool OnDragStart(UIView& view, const DragEvent& event) override
-//     {
-//         UNUSED(view);
-//         UNUSED(event);
-//         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondragstart!!");
-//         continueDrag_ = true;
-//         return false;
-//     }
+class AppListOnDragListener : public UIView::OnDragListener {
+public:
+    AppListOnDragListener()
+    {
+        continueDrag_ = false;
+    }
+    ~AppListOnDragListener() override {}
+    bool OnDragStart(UIView& view, const DragEvent& event) override
+    {
+        UNUSED(view);
+        UNUSED(event);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondragstart!!");
+        continueDrag_ = true;
+        return false;
+    }
 
-//     bool OnDrag(UIView& view, const DragEvent& event) override
-//     {
-//         UNUSED(view);
-//         if (!continueDrag_) {
-//             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppList : Can not continue drag!!");
-//             return false;
-//         }
-//         if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) &&
-//             (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) {
-//             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondrag!!");
-//             NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TransitionType::TRANSITION_ZOOM);
-//         }
+    bool OnDrag(UIView& view, const DragEvent& event) override
+    {
+        UNUSED(view);
+        if (!continueDrag_) {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppList : Can not continue drag!!");
+            return false;
+        }
+        if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) &&
+            (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondrag!!");
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TransitionType::TRANSITION_ZOOM);
+        }
 
-//         return false;
-//     }
+        return false;
+    }
 
-//     bool OnDragEnd(UIView& view, const DragEvent& event) override
-//     {
-//         UNUSED(view);
-//         UNUSED(event);
-//         return false;
-//     }
-// private:
-//     bool continueDrag_{false};
-// };
-// }
+    bool OnDragEnd(UIView& view, const DragEvent& event) override
+    {
+        UNUSED(view);
+        UNUSED(event);
+        return false;
+    }
+private:
+    bool continueDrag_{false};
+};
+}
 
-// #endif // LIST_DESKTOP_FRAGMENT_H
+#endif // LIST_DESKTOP_FRAGMENT_H
index 34758a8..926e2ce 100644 (file)
@@ -1,37 +1,39 @@
-// /*
-//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
-//  * Description: UIDesktopFragment.h
-//  * Author:
-//  * Create: 2025-07-07
-//  */
+/*
+ * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+ * Description: UIDesktopFragment.h
+ * Author:
+ * Create: 2025-07-07
+ */
 
-// #ifndef UI_DESKTOP_FRAGMENT_H
-// #define UI_DESKTOP_FRAGMENT_H
+#ifndef UI_DESKTOP_FRAGMENT_H
+#define UI_DESKTOP_FRAGMENT_H
 
-// #include "applist/include/AppItemView.h"
-// #include "components/ui_fragment.h"
-// #include "components/ui_list.h"
-// #include "components/ui_view_group.h"
-// #include "components/ui_scroll_view.h"
-// #include "TransitionType.h"
-// #include "ohos_types.h"
-// #include "wearable_log.h"
+#include "applist/include/AppItemView.h"
+#include "components/ui_fragment.h"
+#include "components/ui_list.h"
+#include "components/ui_view_group.h"
+#include "components/ui_scroll_view.h"
+#include "TransitionType.h"
+#include "ohos_types.h"
+#include "wearable_log.h"
+#include "themestyle/include/ThemeStyleModel.h"
 
-// namespace OHOS {
-// class UIDesktopFragment : public UIFragment, public UIView::OnClickListener,
-//                           public ListScrollListener, public UIView::OnRotateListener {
-// public:
-//     virtual void AddAppItemToList(const AppItem &item) = 0;
-//     virtual void ClearAppItemToList() = 0;
-//     virtual void RefreshAppList() = 0;
-//     void SetPosition(int16_t x, int16_t y, int16_t width, int16_t height);
 
-// protected:
-//     uint16_t imgSize_ = 0;
-//     uint16_t imgDistance_ = 0;
-//     void OnCreateView(void* data) override {};
-//     void OnDestroyView() override {};
-//     bool SwitchView(AppViewId viewId, char *uid, TransitionType type, DesktopStyle style);
-// };
-// }
-// #endif // UI_DESKTOP_FRAGMENT_H
\ No newline at end of file
+namespace OHOS {
+class UIDesktopFragment : public UIFragment, public UIView::OnClickListener,
+                          public ListScrollListener, public UIView::OnRotateListener {
+public:
+    virtual void AddAppItemToList(const AppItem &item) = 0;
+    virtual void ClearAppItemToList() = 0;
+    virtual void RefreshAppList() = 0;
+    void SetPosition(int16_t x, int16_t y, int16_t width, int16_t height);
+
+protected:
+    uint16_t imgSize_ = 0;
+    uint16_t imgDistance_ = 0;
+    void OnCreateView(void* data) override {};
+    void OnDestroyView() override {};
+    bool SwitchView(AppViewId viewId, char *uid, TransitionType type, ThemeStyle style);
+};
+}
+#endif // UI_DESKTOP_FRAGMENT_H
\ No newline at end of file
index 4b6fa81..30e7d61 100644 (file)
@@ -81,154 +81,4 @@ namespace OHOS {
         label_.SetTextColor(Color::Gray());
         icon_.ResetTransParameter();
     }
-
-    HexagonsItemView::HexagonsItemView()
-    {
-    }
-
-    HexagonsItemView::~HexagonsItemView()
-    {
-    }
-
-    void HexagonsItemView::SetItemInfo(const AppItem &itemInfo)
-    {
-        itemInfo_ = itemInfo;
-    }
-
-    AppViewId HexagonsItemView::GetViewId()
-    {
-        return static_cast<AppViewId>(itemInfo_.id);
-    }
-
-    const char *HexagonsItemView::GetAppUid()
-    {
-        return itemInfo_.uid;
-    }
-
-    void FootballItemView::SetItemInfo(const AppItem &itemInfo)
-    {
-        itemInfo_ = itemInfo;
-    }
-
-    AppViewId FootballItemView::GetViewId()
-    {
-        return static_cast<AppViewId>(itemInfo_.id);
-    }
-
-    const char *FootballItemView::GetAppUid()
-    {
-        return itemInfo_.uid;
-    }
-    
-    void WaterfallItemView::SetItemInfo(const AppItem &itemInfo)
-    {
-        itemInfo_ = itemInfo;
-    }
-
-    AppViewId WaterfallItemView::GetViewId()
-    {
-        return static_cast<AppViewId>(itemInfo_.id);
-    }
-
-    const char *WaterfallItemView::GetAppUid()
-    {
-        return itemInfo_.uid;
-    }
-    /* ---------------------------------- 弧形列表 ---------------------------------- */
-    #define ARC_SCALE_LIST_ITEM_WIDTH (440)
-    #define ARC_SCALE_LIST_ITEM_HEIGHT (120) 
-    
-    #define ARC_SCALE_LIST_IMAGE_X (20)
-    #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_OPAQUE);
-        SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
-        SetStyle(STYLE_BORDER_RADIUS, 100); // 胶囊形状
-        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);
-        if(VIEW_EXTERN_APP != itemInfo.id) {
-            label_->SetTextId(itemInfo.TextId);
-        } else {
-            // printf("ArcScaleListItemView::SetItemInfo:%s\r\n",itemInfo.label);
-            label_->SetText(itemInfo.label);
-        }
-    }
-
-    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 3ce95f3..d90b1ba 100644 (file)
@@ -56,6 +56,7 @@ void ApplistAdapter::AddListItem(const AppItem &item)
 {
     listData_.push_back(item);
 }
+#if 0
 /* -------------------------------------------------------------------------- */
 /* ---------------------------------- 弧形列表 ---------------------------------- */
 ArcScaleListItemAdapter::ArcScaleListItemAdapter(){}
@@ -495,4 +496,5 @@ void CircleListAdapter::native_app_position_update(UIImageView ** CircleListAPP,
 }
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
+#endif
 } // namespace OHOS
index eb0a839..5f851f8 100644 (file)
 #include "utils.h"
 #include "bundlems_slite_client.h"
 #include "wearable_log.h"
-
 #include "UiConfig.h"
 #include "applist/include/ApplistModel.h"
 #include "applist/include/ApplistPresenter.h"
 #include "font/font_global_manager.h"
 #include "NativeRegisterManager.h"
+
 namespace OHOS {
     #define FOOTBALL_PLANE_MAX_NUM 20
 
@@ -54,23 +54,22 @@ namespace OHOS {
         initFlag = flag;
     }
 
-    void ApplistModel::ResolvingJSAppItems(void)
+    void ApplistModel::CleanupApplistStrings(uint8_t nativeAppNumTotal)
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems start\r");
-#ifdef JS_ENABLE
-        if (bundleInfos != nullptr) {
-            for (uint8_t i = 0; i < bundleLen; i++) {
-                ClearBundleInfo(bundleInfos + i);
-            }
-
-            if (bundleInfos != nullptr) {
-                AdapterFree(bundleInfos);
-                bundleInfos = nullptr;
-            }
+        for (uint8_t i = nativeAppNumTotal; i < appLen; i++) {
+                free((void*)applist[i].iconSmall);
+                free((void*)applist[i].iconHexagon);
+                free((void*)applist[i].label);
+                free((void*)applist[i].uid);
+                applist[i].iconSmall = nullptr;
+                applist[i].iconHexagon = nullptr;
+                applist[i].label = nullptr;
+                applist[i].uid = nullptr;
         }
-#endif
-        bundleLen = 0;
-        appLen = 0;
+    }
+
+    void ApplistModel::ResolvingJSAppItems(void)
+    {
         List<AppItem>& nativeAppLists = NativeRegisterManager::GetInstance().GetNativeAppLists();
         uint8_t registerNativeAppNum = nativeAppLists.Size();
         if (registerNativeAppNum > APP_MAX_NUM) {
@@ -83,34 +82,51 @@ namespace OHOS {
             applist[index] = appNode->data_;
             appNode = appNode->next_;
         }
+        CleanupApplistStrings(nativeAppNumTotal);
+        bundleLen = 0;
+        appLen = 0;
         appLen = nativeAppNumTotal;
 #ifdef JS_ENABLE
         int32_t len = 0;
         uint8_t ret = BundleMsClient::GetInstance().GetBundleInfos(0, &bundleInfos, &len);
-        printf("ResolvingJSAppItems GetBundleInfos ret = %d ,len = %d\r\n", ret, len);
         if ((ret == 0) && (len > 0) && (bundleInfos != nullptr)) {
             bundleLen = len;
             if (len > APP_MAX_NUM - nativeAppNumTotal) {
                 len = APP_MAX_NUM - nativeAppNumTotal;
             }
             while (len--) {
-                applist[appLen] = {
-                    VIEW_EXTERN_APP,
-                    bundleInfos[len].smallIconPath,
-                    bundleInfos[len].bigIconPath,
-                    bundleInfos[len].label,
-                    bundleInfos[len].bundleName
-                };
-                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems bundleName is %s \r", bundleInfos[len].bundleName);
-                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems label is %s \r", bundleInfos[len].label);
-                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems smallIconPath is %s \r", bundleInfos[len].smallIconPath);
-                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems bigIconPath is %s \r", bundleInfos[len].bigIconPath);
+                char* smallIconPath = strdup(bundleInfos[len].smallIconPath);
+                char* bigIconPath = strdup(bundleInfos[len].bigIconPath);
+                char* label = strdup(bundleInfos[len].label);
+                char* bundleName = strdup(bundleInfos[len].bundleName);
+                applist[appLen] = AppItem(
+                    VIEW_EXTERN_APP,       // id
+                    smallIconPath,         // iconSmall
+                    bigIconPath,
+                    bigIconPath,           // iconHexagon
+                    label,                 // label
+                    bundleName,             // uid
+                    0                     // labelId
+                );
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems bundleName is %s \r", bundleName);
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems label is %s \r", label);
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems smallIconPath is %s \r", smallIconPath);
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems bigIconPath is %s \r", bigIconPath);
                 appLen++;
                 bundleInfos[len].abilityInfo = nullptr;
             }
         } else {
             WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "ResolvingJSAppItems GetBundleInfos ret = %d \r", ret);
         }
+        if (bundleInfos != nullptr) {
+            for (uint8_t i = 0; i < bundleLen; i++) {
+                ClearBundleInfo(bundleInfos + i);
+            }
+            if (bundleInfos != nullptr) {
+                AdapterFree(bundleInfos);
+                bundleInfos = nullptr;
+            }
+        }
 #endif
     }
 
@@ -133,6 +149,18 @@ namespace OHOS {
         return startIndex;
     }
 
+    void ApplistModel::SetLastOffset(int16_t x, int16_t y)
+    {
+        lastOffsetX = x;
+        lastOffsetY = y;
+    }
+
+    void ApplistModel::GetLastOffset(int16_t& x, int16_t& y)
+    {
+        x = lastOffsetX;
+        y = lastOffsetY;
+    }
+
     void ApplistModel::SetHeadItemY(int y)
     {
         headItemY = y;
@@ -160,74 +188,4 @@ namespace OHOS {
     {
         presenter = p;
     }
-
-    AppListStyle ApplistModel::GetCurrentStyle(void)
-    {
-        return ThemeStyleModel::GetInstance().GetAppListDisplayStyle(); //根据显示样式界面设置的返回当前applit样式
-    }
-
-    /* -------------------------------------------------------------------------- */
-    /* ---------------------------------- 弧形列表 ---------------------------------- */
-    //设置弧形列表的起始位置
-    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::SetCircleListStartAngle(int angle)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"SetCircleListStartAngle:%d\r\n",angle);
-        circleListStartAngle = angle;
-    }
-    
-    // 获取拨号盘的起始角度
-    int ApplistModel::GetCircleListStartAngle(void)
-    {
-        return circleListStartAngle;
-    }
-
-    // 设置当前选中的图片索引
-    void ApplistModel::SetCurselectImageIndex(int index)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"SetCurselectImageIndex:%d\r\n",index);
-        curselectImageIndex = index;
-    }
-    
-    // 获取当前选中的图片索引
-    int ApplistModel::GetCurselectImageIndex(void)
-    {
-        return curselectImageIndex;
-    }
-    
-    // 设置上一次选中的图片索引
-    void ApplistModel::SetPreselectImageIndex(int index)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"SetPreselectImageIndex:%d\r\n",index);
-        preselectImageIndex = index;
-    }
-    
-    // 获取上一次选中的图片索引
-    int ApplistModel::GetPreselectImageIndex(void)
-    {
-        return preselectImageIndex;
-    }
 }
index d18c039..89bfa23 100644 (file)
  */
 
 #include "applist/include/ApplistPresenter.h"
-#include "ability_manager.h"
-#include "securec.h"
-#include "components/ui_hexagons_list.h"
-#include "components/ui_waterfall_list.h"
-#include "TransitionType.h"
 #include "NativeRegisterManager.h"
+#include "wearable_log.h"
 
-#include "health/health_service/health_service.h"
-#ifdef SUPPORT_BATTERY_SERVICE
-#include "battery_hal.h"
-#endif
-#include "ConfigModelC.h"
-#include "ConfigModel.h"
-#include <custom_utils.h>
-#include "custom_runtime.h"
-#include "graphic_service.h"
 namespace OHOS {
-
 REGIST_SLICE(VIEW_APPLIST, ApplistView, ApplistPresenter);
 
-    ApplistPresenter::ApplistPresenter()
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::ApplistPresenter()");
-        model = &ApplistModel::GetInstance();
-        model->Init();
-        model->SetPresenter(this);
-    }
-
-    ApplistPresenter::~ApplistPresenter()
-    {
-        model->SetPresenter(nullptr);
-    }
-
-    void ApplistPresenter::OnStart()
-    {
-        if (view_ == nullptr) {
-            return;
-        }
-        const AppItem *itemInfo = model->GetApplistItems();
-        for (uint8 i = 0; i < model->GetAppListNum(); i++) {
-            view_->AddAppItemToList(itemInfo[i]);
-        }
-        view_->RefreshAppList();
-    }
-
-    void ApplistPresenter::OnResume()
-    {
-        if (GetCurrentStyle() == AppListStyle::FOOTBALL_STYLE) {
-            view_->StartFootBallAnimator();
-        } else if  (GetCurrentStyle() == AppListStyle::WATERFALL_STYLE) {
-            view_->ResumeWaterFallDraggable();
-        }
-        RootView::GetInstance()->SetOnKeyActListener(KeyInputListener::GetInstance());
-    }
-
-    bool ApplistPresenter::OnRotate(UIView& view, const RotateEvent& event)
-    {
-        UICustomHexagonsList* hexagonsView = dynamic_cast<UICustomHexagonsList *>(&view);
-        if (hexagonsView == nullptr) {
-            return false;
-        }
-        int8_t index = hexagonsView->GetFocusedImgIndex();
-        uint8_t focusIndex_ = 0;
-        if (index >= 0) {
-            focusIndex_ = static_cast<uint8_t>(index);
-        }
-        HexagonsItemView *itemView = dynamic_cast<HexagonsItemView *>(hexagonsView->GetViewByIndex(focusIndex_));
-        AppViewId viewId = itemView->GetViewId();
-        if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) { // 2.0 threshold for beginning transition
-            hexagonsView->StopRotateAnimator();
-            NativeAbility::GetInstance().EnterSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
-            hexagonsView->ClearFocus();
-        }
-        return true;
-    }
-
-    bool ApplistPresenter::OnClick(UIView &view, const ClickEvent &event)
-    {
-        UNUSED(event);
-        AppViewId viewId = VIEW_INVALID;
-        char *uid = nullptr;
-        TransitionType type = TransitionType::TRANSITION_INVALID;
-        AppListStyle style = GetCurrentStyle();
-        if (style == AppListStyle::FOOTBALL_STYLE) {
-            FootballItemView *itemView = dynamic_cast<FootballItemView *>(&view);
-            viewId = itemView->GetViewId();
-            uid = (char *)itemView->GetAppUid();
-        } else if (style == AppListStyle::HEXAGONS_STYLE) {
-            HexagonsItemView *itemView = dynamic_cast<HexagonsItemView *>(&view);
-            UIHexagonsList *hexagonsView = dynamic_cast<UIHexagonsList *>(itemView->GetParent());
-            if (hexagonsView == nullptr || itemView == nullptr) {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hexagonsView or itemView is nullptr");
-                return false;
-            }
-            viewId = itemView->GetViewId();
-            uid = (char *)itemView->GetAppUid();
-            hexagonsView->SetDraggable(false);
-            hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view
-            type = TransitionType::TRANSITION_HEXAGONS;
-        } else if (style == AppListStyle::WATERFALL_STYLE) {
-            WaterfallItemView *itemView = dynamic_cast<WaterfallItemView *>(&view);
-            UIWaterfallList *waterfallView = dynamic_cast<UIWaterfallList *>(itemView->GetParent());
-            if (waterfallView == nullptr || itemView == nullptr) {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "waterfallView or itemView is nullptr");
-                return false;
-            }
-            viewId = itemView->GetViewId();
-            uid = (char *)itemView->GetAppUid();
-            waterfallView->SetDraggable(false);
-            waterfallView->Scale(1.0f, itemView->GetViewIndex());
-            type = TransitionType::TRANSITION_WATERFALL;
-        } else if (style == AppListStyle::ARC_SCALE_LIST_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 if(style == AppListStyle::CIRCLE_LIST_STYLE) {
-            UIImageView *itemView = dynamic_cast<UIImageView *>(&view);
-            viewId = (AppViewId)itemView->GetViewIndex();
-            if(viewId == VIEW_INVALID)
-            {
-                WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VIEW_INVALID -> %d", viewId);
-                return false;
-            }
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "viewId = %d", viewId);
-            type = TransitionType::TRANSITION_INVALID;
-        } else {
-            AppItemView *itemView = dynamic_cast<AppItemView *>(&view);
-            if (itemView == nullptr) {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr", viewId);
-                return false;
-            }
-            viewId = itemView->GetViewId();
-            uid = (char *)itemView->GetAppUid();
-        }
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId);
-        if (viewId < VIEW_MAX_INTER_APP)
-        {
-            /*心率Slice需要增加特殊配置*/
-            bool isCharging = false;
-            #ifdef SUPPORT_BATTERY_SERVICE
-            isCharging = get_charge_stat(); // 获取充电状态
-            #endif
-            if (isCharging && viewId == VIEW_HEART_CHART)
-            {
-                HealthState highHealthState;
-                highHealthState.checkType = CHARGE;
-                HealthService::GetInstance()->SetHealthCurrent(highHealthState);
-                viewId = VIEW_CHECK_INVALID;
-            }
-            if(uapi_sleep_mode_flag_get())
-            {
-                if(VIEW_DNOTDISTURB == viewId)
-                    return false; 
-            }
-            NativeAbility::GetInstance().EnterSlice(viewId, type);
-            return true;
-        }
-        else if (viewId == VIEW_EXTERN_APP)
-        {
-#ifdef JS_ENABLE
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick bundleName = %s", uid);
-            Want *want = new Want();
-            memset_s(want, sizeof(Want), 0, sizeof(Want));
-            ElementName startElement = {};
-            startElement.abilityName = (char *)"default";
-            startElement.bundleName = uid;
-            startElement.deviceId = nullptr;
-            SetWantElement(want, startElement);
-            if (viewId == VIEW_SETTING && style == AppListStyle::APPLIST_STYLE) {
-                StartAbilityWithAnimation(want, static_cast<uint8_t>(type), true);
-            } else {
-                StartAbilityWithAnimation(want, static_cast<uint8_t>(type), false);
-            }
-            ClearWant(want);
-            delete want;
-            return true;
-#endif
-        }
-        return false;
-    }
-
-    void ApplistPresenter::OnItemSelected(int16 index, UIView *view)
-    {
-        UNUSED(index);
-        if (view != nullptr) {
-            itemViewSele = static_cast<AppItemView *>(view);
-            itemViewSele->SelectedChange();
-
-            if (preItemViewSele != nullptr && preItemViewSele != itemViewSele) {
-                preItemViewSele->Reset();
-            }
-            preItemViewSele = itemViewSele;
-        }
-    }
-    void ApplistPresenter::SetStartIndex(uint16_t index)
-    {
-        model->SetStartIndex(index);
-
-        return;
-    }
-
-    uint16_t ApplistPresenter::GetStartIndex(void)
-    {
-        return model->GetStartIndex();
-    }
-
-    void ApplistPresenter::SetHeadItemY(int y)
-    {
-        model->SetHeadItemY(y);
-    }
-
-    int ApplistPresenter::GetHeadItemY(void)
-    {
-        return model->GetHeadItemY();
-    }
-
-    uint8_t ApplistPresenter::GetListItemNum(void)
-    {
-        return model->GetAppListNum();
-    }
-
-    AppListStyle ApplistPresenter::GetCurrentStyle(void)
-    {
-        return model->GetCurrentStyle();
-    }
+ApplistPresenter::ApplistPresenter()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::ApplistPresenter()");
+    model = &ApplistModel::GetInstance();
+    model->Init();
+    model->SetPresenter(this);
+}
 
-    ApplistView* ApplistPresenter::GetAppListView()
-    {
-        return view_;
-    }
+ApplistPresenter::~ApplistPresenter()
+{
+    model->SetPresenter(nullptr);
+}
 
-    /* ---------------------------------- 弧形列表 ---------------------------------- */
-    //设置弧形列表起始索引
-    void ApplistPresenter::SetArcListStartIndex(uint16_t index)
-    {
-        model->SetArcListStartIndex(index);
+void ApplistPresenter::OnStart()
+{
+    if (view_ == nullptr) {
         return;
     }
-
-    //获取弧形列表起始索引
-    uint16_t ApplistPresenter::GetArcListStartIndex(void)
-    {
-        return model->GetArcListStartIndex();
+    const AppItem *itemInfo = model->GetApplistItems();
+    for (uint8 i = 0; i < model->GetAppListNum(); i++) {
+        view_->AddAppItemToList(itemInfo[i]);
     }
+    view_->RefreshAppList();
+}
 
-    //设置弧形列表头部Item的Y坐标
-    void ApplistPresenter::SetArcListHeadItemY(int y)
-    {
-        model->GetArcListHeadItemY(y);
-    }
+void ApplistPresenter::OnResume()
+{
+    view_->OnResume();
+}
 
-    //获取弧形列表头部Item的Y坐标
-    int ApplistPresenter::GetArcListHeadItemY(void)
-    {
-        return model->GetArcListHeadItemY();
-    }
+ApplistView* ApplistPresenter::GetAppListView()
+{
+    return view_;
+}
 }
index 26c41b7..5d34eca 100644 (file)
  * Create: 2021-09-18
  */
 
-#include "components/ui_view_group.h"
 #include "applist/include/ApplistView.h"
 #include "applist/include/ApplistPresenter.h"
-#include "applist/include/AppItemView.h"
-#include "common/image_cache_manager.h"
-#include "hal_tick.h"
-#include "main/include/ModelListenerSample.h"
-#include "common/screen.h"
+#include "applist/include/DesktopFactory.h"
+#include "themestyle/include/ThemeStyleModel.h"
 
 namespace OHOS {
-static constexpr int16 NUM_2 = 2;
-static constexpr int16 MAX_SCROLL_DIS = 1000;
-
-class  AppCircleListOnDragListener;
-static AppCircleListOnDragListener *AppCircleListOnDragListener_ = nullptr;
-
-ApplistView::ApplistView()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ApplistView ");
-}
-
-ApplistView::~ApplistView()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::~ApplistView ");
-    if (listAdapter_ != nullptr) {
-        delete listAdapter_;
-        listAdapter_ = nullptr;
-    }
-    if (contentList_ != nullptr) {
-        delete contentList_;
-        contentList_ = nullptr;
-    }
-    if (dragListener_ != nullptr) {
-        delete dragListener_;
-        dragListener_ = nullptr;
-    }
-    if (hexagonsList_ != nullptr) {
-        delete hexagonsList_;
-        hexagonsList_ = nullptr;
-    }
-    if (footballList_ != nullptr) {
-        delete footballList_;
-        footballList_ = nullptr;
-    }
-    if (waterfallList_ != nullptr) {
-        delete waterfallList_;
-        waterfallList_ = nullptr;
-    }
-    if (callback_ != nullptr) {
-        delete callback_;
-        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;
-    }
-    /* -------------------------------------------------------------------------- */
-    /* ----------------------------------- 拨号盘 ---------------------------------- */
-    if(CircleListGroup_ != nullptr)
-    {
-        CircleListGroup_->RemoveAll();
-        delete PointImage;
-        PointImage = nullptr;
-        delete CircleListSelectImage;
-        CircleListSelectImage = nullptr;
-        delete CircleListPicker;
-        CircleListPicker = nullptr;
-        delete CircleListScrollView;
-        CircleListScrollView = nullptr;
-        for(int i = 0;i < CircleListAPPNum;i++)
-        {
-            if(nullptr != CircleListAPP[i])
-            {
-                delete CircleListAPP[i];
-                CircleListAPP[i] = nullptr;
-            }
-        }
-        delete AppCircleListOnDragListener_;
-        AppCircleListOnDragListener_ = nullptr;
-
-        delete CircleListGroup_;
-        CircleListGroup_ = 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();
-    }
-}
-
-void ApplistView::FootballStyleOnStart()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::FootballStyleOnStart ");
-    if (footballList_ == nullptr) {
-        footballList_ = new UIIcosahedronView();
-    }
-    footballList_->SetThrowDrag(true);
-    if (footballDefaultImg_ == nullptr) {
-        footballDefaultImg_ = ImageCacheManager::GetInstance().LoadSingleRes(PNG_APPLIST_NOTSETUSE_IMG);
-        if (footballDefaultImg_ == nullptr) {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "load res faild");
-            return;
-        }
-    }
-    if (callback_ == nullptr) {
-        callback_ = new FootballAnimatorCallback(footballList_, 30, 200); // 30: Initial Size 200: Final display size
-    }
-    footballList_->SetDefaultImage(footballDefaultImg_);
-    footballList_->SetPosition(0, 0, GetRootContainer()->GetWidth(), GetRootContainer()->GetHeight());
-    enterAnimator_ = callback_->GetAnimator();
-    AddViewToRootContainer(footballList_);
-    if (callback_ != nullptr) {
-        callback_->SetStartTime(HALTick::GetInstance().GetTime());
-    }
-}
-
-void ApplistView::HexagonsStyleOnStart()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart ");
-    if (hexagonsList_ == nullptr) {
-        hexagonsList_ = new UICustomHexagonsList();
-    }
-    hexagonsList_->SetPosition(0, 0, GetRootContainer()->GetWidth(), GetRootContainer()->GetHeight()); // 2, two
-    imgDistance_ = hexagonsList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient
-    imgSize_ = hexagonsList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient
-    hexagonsList_->SetImageDistance(imgDistance_);
-    hexagonsList_->SetImageSizeInCenter(imgSize_);
-    int16_t blankSize = hexagonsList_->GetRelativeRect().GetWidth() > hexagonsList_->GetRelativeRect().GetHeight() ?
-        hexagonsList_->GetRelativeRect().GetWidth() / 2 : hexagonsList_->GetRelativeRect().GetHeight() / 2; // 2, half
-    hexagonsList_->SetScrollBlankSize(blankSize);
-    hexagonsList_->SetReboundSize(blankSize);
-    hexagonsList_->SetThrowDrag(true);
-    hexagonsList_->SetOnRotateListener(presenter_);
-    hexagonsList_->RequestFocus();
-    AddViewToRootContainer(hexagonsList_);
-}
-
-void ApplistView::WaterfallStyleOnStart()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::WaterfallStyleOnStart ");
-    if (waterfallList_ == nullptr) {
-        waterfallList_ = new UIWaterfallList();
-    }
-    waterfallList_->SetPosition(0, 0, GetRootContainer()->GetWidth(), GetRootContainer()->GetHeight());
-    imgDistance_ = waterfallList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient
-    imgSize_ = waterfallList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient
-    waterfallList_->SetImageDistance(imgDistance_);
-    waterfallList_->SetImageSizeInCenter(imgSize_);
-    int16_t blankSize = waterfallList_->GetRelativeRect().GetWidth() > waterfallList_->GetRelativeRect().GetHeight() ?
-        waterfallList_->GetRelativeRect().GetWidth() / 2 : waterfallList_->GetRelativeRect().GetHeight() / 2; // 2, half
-    waterfallList_->SetThrowDrag(true);
-    uint16_t layoutHeight = static_cast<uint16_t>(imgDistance_ * Sin(60));
-    waterfallList_->SetReboundSize(layoutHeight); // 60: degree, row's layout height
-    waterfallList_->SetScrollBlankSize(layoutHeight, UIAbstractScroll::Direction::TOP);
-    waterfallList_->SetScrollBlankSize(Screen::GetInstance().GetHeight() / 2 - layoutHeight, // 2: half
-        UIAbstractScroll::Direction::BOTTOM);
-    waterfallList_->RequestFocus();
-    waterfallList_->SetRotateFactor(10); // 10, empirical coefficient
-    waterfallList_->SetOnRotateListener(presenter_);
-    waterfallList_->SetTouchable(false);
-    waterfallList_->SetDraggable(false); // ensure that it can't be dragged during animation to avoid error display
-    AddViewToRootContainer(waterfallList_);
-}
-/* -------------------------------------------------------------------------- */
-/* ---------------------------------- 弧形列表 ---------------------------------- */
-#define ARC_SCALE_LIST_SCALE_FACTOR (440)
-#define ARC_SCALE_LIST_X (13)
-#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())
-
-#if 1
-/**
- * @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;
-}
-#else
-static bool TransformItemBaseOnPosition(UITransformList* list, UIView* item)
-{
-    if (list == nullptr || item == nullptr) return false;
-    if (item->GetViewType() != UI_TRANSFORM_GROUP) return false;
-
-    UITransformGroup* group = dynamic_cast<UITransformGroup*>(item);
-    if (group == nullptr) return false;
-
-    const int16_t w = group->GetWidth();
-    const int16_t h = group->GetHeight();
-    if (list->GetDirection() != UIList::VERTICAL) return false;
-
-    const int16_t midY = list->GetY() + (list->GetHeight() >> 1);
-    const int16_t y    = group->GetY();
-    const int offset   = (y + (h >> 1) - midY); // 距中心偏移(+向下)
-
-    // 1) 缩放(中心最大,远离越小)
-    // 基于现有 SineEaseIn,收敛更柔和;scale ∈ [minScale, 1.0]
-    static constexpr float kMinScale = 0.90f;            // 两侧最小缩放
-    static constexpr int   kScaleMax = ARC_SCALE_LIST_SCALE_FACTOR; // 400
-    const int eased = EasingEquation::SineEaseIn(0, kScaleMax, MATH_ABS(offset), kScaleMax);
-    float scale = 1.0f - (static_cast<float>(eased) / kScaleMax);
-    if (scale < kMinScale) scale = kMinScale;
-
-    // 2) 弧形位移(根据距中心的距离决定向右偏移,模拟圆弧)
-    // 简化:xShift 与 (1 - scale) 成正比;可根据视觉微调 kMaxXShift
-    static constexpr int16_t kMaxXShift = 40;            // 两端最大右移像素
-    const int16_t xShift = static_cast<int16_t>(kMaxXShift * (1.0f - scale));
-
-    // 3) 应用变换:先重置再设置,避免累计误差;以靠右的枢轴点缩放(让左侧圆图标更稳)
-    group->Scale(Vector2<float>(scale, scale), Vector2<float>(w * 0.75f, h * 0.5f));
-
-    // 4) UITransformGroup 支持平移变换(不改布局,仅视觉位移)
-    group->Translate(Vector2<int16_t>(xShift, 0));
-
-    // 5) 居中项高亮(胶囊背景 + 文字白色,非中心透明 + 灰字)
-    const bool isCenter = (y <= midY) && ((y + h) >= midY);
-
-    // 访问子控件,改样式
-    ArcScaleListItemView* arcItem = dynamic_cast<ArcScaleListItemView*>(group);
-    if (arcItem != nullptr) {
-        UILabelExt*  label = arcItem->GetLabel();
-        if (label) {
-            label->SetTextColor(isCenter ? Color::White() : Color::Gray());
-        }
-    }
-
-    return isCenter;
-}
-#endif
-
-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(Screen::GetInstance().GetHeight() / 2, UIAbstractScroll::Direction::TOP);
-        ArcScaleList_->SetScrollBlankSize(Screen::GetInstance().GetHeight() / 2, UIAbstractScroll::Direction::BOTTOM);
-        ArcScaleList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
-        ArcScaleList_->SetYScrollBarVisible(true);
-        // ArcScaleList_->SetScrollStateListener(presenter_);
-        ArcScaleList_->SetReboundSize(5);
-        ArcScaleList_->EnableAutoAlign(true);
-        ArcScaleList_->SetItemSpace(20);
-        ArcScaleList_->SetSelectPosition(ARC_SCALE_LIST_HEIGHT / 2);
-        ArcScaleList_->SetRotateFactor(1.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 = 53;
-        } 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
-}
-/* -------------------------------------------------------------------------- */
-/* ----------------------------------- 拨号盘 ---------------------------------- */
-#include <vibrator_service.h>
-
-#include "cmath"
-#include "vector"
-
-// 圆形表的圆心坐标和半径
-static const int CIRCLE_CENTER_X = 233;
-static const int CIRCLE_CENTER_Y = 233;
-static const int CIRCLE_RADIUS = 233;
-static Point curpoint;
-static Point prepoint;
-
-// 将触摸点坐标转换为相对于圆心的坐标
-static Point convertToRelativeCoordinates(const Point& point)
-{
-    Point relativePoint;
-    relativePoint.x = point.x - CIRCLE_CENTER_X;
-    relativePoint.y = point.y - CIRCLE_CENTER_Y;
-    return relativePoint;
-}
-// 使用 atan2 函数计算点与水平正方向的夹角(弧度制)
-static double calculateAngle(const Point& point)
-{
-    double angle = std::atan2(point.y, point.x);
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "x:%d,y:%d",point.x,point.y);
-    return angle;
-}
-//获取是否是正向旋转
-static void isDirectRotate(const DragEvent& event,bool &isDirectRotate)
-{
-    // 计算当前点与水平正方向的夹角(弧度制)
-    double angle_cur = calculateAngle(curpoint);
-    // 计算上一次点与水平正方向的夹角(弧度制)
-    double angle_pre = calculateAngle(prepoint);
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "angle_cur:%lf,angle_pre:%lf",angle_cur,angle_pre);
-
-    // 判断滑动方向,通过比较角度差值
-    bool isDirectRotateTemp = isDirectRotate;
-    double angleDiff = angle_cur - angle_pre;
-    if (angleDiff >= 0)
-    {
-        isDirectRotate = true;
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "顺时针滑动");
-    }
-    else
-    {
-        isDirectRotate = false;
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "逆时针滑动");
-    }
-    if((angle_cur < 0 && angle_pre > 0) || (angle_cur > 0 && angle_pre < 0))
-    {
-        isDirectRotate = isDirectRotateTemp;
-        if(isDirectRotateTemp)
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "逆时针滑动->顺时针滑动");
-        else
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "顺时针滑动->逆时针滑动");
+    if (desktopFragment_ != nullptr) {
+        OnStop();
     }
+    ThemeStyle style = ThemeStyleModel::GetInstance().GetAppListDisplayStyle(); //根据显示样式界面设置的返回当前applit样式
+    desktopFragment_ = DesktopFactory::GetInstance().CreateDesktopStyle(style);
+    desktopFragment_->SetPosition(0, 0, GetRootContainer()->GetWidth(), GetRootContainer()->GetHeight());
+    desktopFragment_->CreateView();
+    AddViewToRootContainer(desktopFragment_->GetFragmentView());
 }
 
-class AppCircleListOnDragListener : public UIView::OnDragListener,
-                                    public UIPicker::SelectedListener,
-                                    public UIView::OnRotateListener,
-                                    public ::OHOS::ModelListenerSample
-                                    
+void ApplistView::OnStop()
 {
-public:
-    AppCircleListOnDragListener(UIImageView ** CircleListAPP_,int CircleListAPPNum_,UIImageView *CircleListSelectImage_)
-    {
-        CircleListAPP = CircleListAPP_;
-        CircleListAPPNum = CircleListAPPNum_;
-        CircleListSelectImage = CircleListSelectImage_;
-        angle = ApplistModel::GetInstance().GetCircleListStartAngle();
-    }
-    ~AppCircleListOnDragListener(){}
-    bool OnDragStart(UIView& view, const DragEvent& event) override
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppCircleListOnDragListener::OnDragStart");
-        if(!isEncoderEvent) //如果此时编码器未旋转
-        {
-            isDragEvent = true;
-            prepoint = convertToRelativeCoordinates(event.GetStartPoint());
-            preX = event.GetStartPoint().x;
-            preY = event.GetStartPoint().y;
-            dragstartTimeStamp = event.GetTimeStamp();
-        }
-        return true;
-    }
-
-    bool OnDrag(UIView& view, const DragEvent& event) override
-    {
-        if(isDragEvent)
-        {
-            int curX = event.GetCurrentPos().x;
-            int curY = event.GetCurrentPos().y;
-            int deltaX = abs(curX - preX);
-            int deltaY = abs(curY - preY);
-            if (deltaX < 8 && deltaY < 8)
-            {
-                return false;
-            }
-            curpoint = convertToRelativeCoordinates(event.GetCurrentPos());
-            /* -------------------------------------------------------------------------- */
-            isDirectRotate(event,isDirectRotateFlag);
-            angle += (isDirectRotateFlag ? CircleListAdapter::angleIncrement : - CircleListAdapter::angleIncrement);
-            CircleListAdapter::CircleListAdapter::native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag);
-            /* -------------------------------------------------------------------------- */
-            prepoint = curpoint;
-            preX = curX;
-            preY = curY;
-            /* -------------------------------------------------------------------------- */
-        }
-        return true;
-    }
-
-    bool OnDragEnd(UIView& view, const DragEvent& event) override
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppCircleListOnDragListener::OnDragEnd");
-        if(isDragEvent)
-        {
-            dragendTimeStamp =  event.GetTimeStamp();
-            dragDuration = dragendTimeStamp - dragstartTimeStamp;
-            // OnDragEndFlag = (dragDuration >= 25 ? 1 : 0);//点击应用的时候容易产生滑动,小于25ms的屏蔽
-            OnDragEndFlag = 1;
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "dragDuration:%d,dragstartTimeStamp:%d,dragendTimeStamp:%d",dragDuration,dragstartTimeStamp,dragendTimeStamp);
-            int deltaX = abs(event.GetLastPoint().x - event.GetStartPoint().x);
-            int deltaY = abs(event.GetLastPoint().y - event.GetStartPoint().y);
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "拖动时间:%d 毫秒,deltaX:%d,deltaY:%d",dragDuration,deltaX,deltaY);
-        }
-        return true;
-    }
-
-
-    void ResetState() 
-    {  
-        OnDragEndFlag = 0;  
-        isInitialized = false;  
-        inertiaDragAngle = 0;
-        isDragEvent = false;  
-        if (isEncoderEvent) 
-        {  
-            CircleListAdapter::angleIncrement = 10;//还原为drag的角度
-            isEncoderEvent = false;  
-            custom_VibratorFunc_int(0);  
-        }
-    }
-
-    void Notify() override
-    {
-        if (!OnDragEndFlag) {  
-            return; // Early return if there's no drag end  
-        }  
-        static int targetAngle = 0;// 目标角度:就是等下惯性要滑多少角度
-        static int timeIndex = 0;
-
-        if(!isInitialized) {
-            isInitialized = true;
-
-            // Define target angles based on drag duration  
-            std::vector<int> targetAngles = {0, 30, 60, 90, 150,180,210,240,270,300};
-            // 根据滑动时间确定对应的目标角度索引
-            uint32_t minDragDuration = 0;  // 假设的最短滑动时间,单位:毫秒,可调整
-            uint32_t maxDragDuration = 1400; // 假设的最长滑动时间,单位:毫秒,可调整
-
-            if (dragDuration < minDragDuration) {
-                // dragDuration = minDragDuration;  // 时间过短,按最短时间处理,避免索引越界等问题
-            } else if (dragDuration > maxDragDuration) {
-                dragDuration = maxDragDuration;  // 时间过长,按最长时间处理
-            }
-            uint32_t durationRange = maxDragDuration - minDragDuration;
-
-
-            // Calculate the target angle index 
-            timeIndex = (dragDuration) / (durationRange / targetAngles.size());
-            timeIndex = std::min(timeIndex, static_cast<int>(targetAngles.size() - 1));  // 防止越界
-            targetAngle = targetAngles[timeIndex];  
-        }
-
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "拖动时间:%d 毫秒,当前角度:%d,目标角度:%d,时间索引:%d", dragDuration, angle, targetAngle, timeIndex);
-        // 根据旋转方向确定角度增量的正负以及计算角度增量大小
-        int angleIncrementSign = isDirectRotateFlag ? 1 : -1;
-
-        if(targetAngle != 0) {
-            if(inertiaDragAngle != targetAngle) {
-                angle += (angleIncrementSign * CircleListAdapter::angleIncrement);
-                inertiaDragAngle += abs(angleIncrementSign * CircleListAdapter::angleIncrement);
-            } else if(inertiaDragAngle == targetAngle && angle % 30 != 0) {
-                angle += (angleIncrementSign * CircleListAdapter::angleIncrement); //还要再次补充角度
-            } else if(inertiaDragAngle == targetAngle && angle % 30 == 0) {
-                // Reset state when target angle is reached  
-                ResetState();
-                return;
-            }
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "inertiaDragAngle:%d,angle:%d",inertiaDragAngle,angle);
-            // 调用视图更新函数,实时更新界面显示
-            CircleListAdapter::native_app_position_update(CircleListAPP, CircleListAPPNum, CircleListSelectImage, angle, isDirectRotateFlag);
-        } else {
-            if(angle % 30 == 0) {
-                ResetState();
-            } else {
-                angle += (isDirectRotateFlag? CircleListAdapter::angleIncrement : -CircleListAdapter::angleIncrement);
-                CircleListAdapter::native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag);
-            }
-        }
+    if (desktopFragment_ == nullptr) {
         return;
     }
-
-    bool OnRotateStart(UIView& view, const RotateEvent& event)
-    {
-        if(!isDragEvent) //如果此时未拖拽
-        {
-            isEncoderEvent = true;
-            CircleListAdapter::angleIncrement = 15;
-            preRotateAngle = angle;
-        }
-        return false;
-    }
-
-    bool OnRotate(UIView& view, const RotateEvent& event)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppCircleListOnDragListener::OnRotate %d",event.GetRotate());
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnRotate回调次数%d",++RotateReportedCount);
-        if(isEncoderEvent)
-        {
-            ++RotateReportedCount;
-            if(RotateReportedCount > 4) 
-            {
-                if(event.GetRotate() > 0)
-                {
-                    isDirectRotateFlag = true;
-                    angle += CircleListAdapter::angleIncrement;
-                    CircleListAdapter::native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag);
-                }
-                else
-                {
-                    isDirectRotateFlag = false;
-                    angle -= CircleListAdapter::angleIncrement;
-                    CircleListAdapter::native_app_position_update(CircleListAPP,CircleListAPPNum,CircleListSelectImage,angle,isDirectRotateFlag);
-                }
-            }
-        }
-        return false;
-    }
-    bool OnRotateEnd(UIView& view, const RotateEvent& event)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AppCircleListOnDragListener::OnRotateEnd %d",event.GetRotate());
-        if(isEncoderEvent)
-        {
-            if(angle % 30 == 0) 
-            { 
-                CircleListAdapter::angleIncrement = 10; //还原为drag的角度
-                OnDragEndFlag = 0;   //不需要补偿角度
-                isEncoderEvent = false;
-                if(preRotateAngle != angle) 
-                {
-                    custom_VibratorFunc_int(0);
-                }
-            } 
-            else 
-            {
-                OnDragEndFlag = 1;
-            }
-            RotateReportedCount = 0;
-            rotateangle = 0;
-            dragDuration = 0;
-        }
-        return false;
-    }
-
-    private:
-        UIImageView **CircleListAPP{nullptr};           //图片组件数组
-        UIImageView *CircleListSelectImage{nullptr};    //中间选中图片的图片组件
-        int CircleListAPPNum{0};                        //图片组件数量
-        int angle = 0;                                  //要旋转角度
-        int rotateangle{0};                             //旋转累计角度
-        uint8_t OnDragEndFlag{0};                       //是否拖拽结束的标志
-        bool isDirectRotateFlag{false};                 //是否是正向旋转的标志
-        int preX{0}; 
-        int preY{0};
-
-        bool isEncoderEvent{false};                     //是否为编码器事件                
-        bool isDragEvent{false};                        //是否为拖拽事件
-        int RotateReportedCount{0};
-
-        uint32_t dragstartTimeStamp{0}; //开始拖拽时的时间戳
-        uint32_t dragendTimeStamp{0};   //拖拽结束时的时间戳
-        uint32_t dragDuration{0};       //拖拽时间
-        int inertiaDragAngle{0};        //惯性拖拽角度
-        bool isInitialized {false};
-        int preRotateAngle{0};
-};
-
-void ApplistView::CircleListStyleOnStart(void)
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListStyleOnStart start!! [%d]", __LINE__);
-    if(nullptr == CircleListGroup_)
-    {
-        CircleListGroup_ = new UIViewGroup();
-        if(nullptr == CircleListGroup_)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListGroup_ failed!! [%d]", __LINE__);
-            return;
-        }
-        CircleListGroup_->SetPosition(0, 0);
-        CircleListGroup_->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-        CircleListGroup_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
-        CircleListGroup_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
-        CircleListGroup_->SetTouchable(true);
-        CircleListGroup_->SetDraggable(true);
-        AddViewToRootContainer(CircleListGroup_);
-        /* -------------------------------------------------------------------------- */
-        if (CircleListPicker == nullptr)
-        {
-            CircleListPicker = new UIPicker();
-            if (CircleListPicker == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CircleListPicker new fail!");
-                return;
-            }
-            CircleListPicker->SetPosition(213, 213, 40, 40);
-            CircleListPicker->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
-            CircleListPicker->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
-            CircleListPicker->SetStyle(STYLE_BORDER_RADIUS, 150);
-            CircleListPicker->SetItemHeight(30);
-            CircleListPicker->SetLoopState(true);
-            CircleListPicker->SetRotateFactor(1.0);
-            CircleListPicker->RequestFocus();
-            CircleListPicker->SetLoopState(true);
-            CircleListPicker->SetTextColor(Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0xff), Color::GetColorFromRGBA(0xff, 0x00, 0x00, 0xff));
-            CircleListPicker->SetSelected(1);
-            int start = 1;
-            int end = 3;
-            CircleListPicker->SetValues(start,end);
-        }
-        /* -------------------------------------------------------------------------- */
-        if(CircleListScrollView == nullptr)
-        {
-            CircleListScrollView = new UIScrollView();
-            if(nullptr == CircleListScrollView)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListScrollView failed!! [%d]", __LINE__);
-                return;
-            }
-            CircleListScrollView->SetPosition(213, 213, 40, 40);
-            CircleListScrollView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
-            CircleListScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
-            CircleListScrollView->SetStyle(STYLE_BORDER_RADIUS, 150);
-            CircleListScrollView->SetRotateFactor(30.0);
-            CircleListScrollView->RequestFocus();
-            CircleListGroup_->Add(CircleListScrollView);
-        }
-        /* -------------------------------------------------------------------------- */
-        CircleListAPPNum = sizeof(CircleListAPP) / sizeof(CircleListAPP[0]);//图片显示数量
-        /* -------------------------------------------------------------------------- */
-        for(int i = 0;i < CircleListAPPNum ;i++)
-        {
-            if(nullptr == CircleListAPP[i])
-            {
-                CircleListAPP[i] = new UIImageView();
-                if(nullptr == CircleListAPP[i]) 
-                {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListStyleOnStart failed!! [%d]", __LINE__);
-                    return;
-                }
-                CircleListAPP[i]->SetAutoEnable(false);
-                CircleListAPP[i]->SetResizeMode(UIImageView::SCALE_DOWN);
-                CircleListAPP[i]->SetSrc(ApplistModel::GetInstance().GetApplistItems()[i].iconSmall);
-                CircleListAPP[i]->SetViewIndex(ApplistModel::GetInstance().GetApplistItems()[i].id);
-                CircleListAPP[i]->SetTouchable(true);
-                CircleListAPP[i]->SetOnClickListener(presenter_);
-            }
-            CircleListGroup_->Add(CircleListAPP[i]); // Add the UIImageView to the UIViewGroup (CircleListGroup_)
-        }
-        /* -------------------------------------------------------------------------- */
-        uint16_t presliceId = NativeAbility::GetInstance().GetPreSliceId();
-        if (presliceId == VIEW_MAIN || presliceId == VIEW_THEME_STYLE) //如果是从主页进入的,那么 startangle = 0
-        {
-            ApplistModel::GetInstance().SetCircleListStartAngle(0);
-            ApplistModel::GetInstance().SetCurselectImageIndex(6);
-            ApplistModel::GetInstance().SetPreselectImageIndex(6);
-        }
-        CircleListAdapter::native_app_position_init(CircleListAPP,CircleListAPPNum,ApplistModel::GetInstance().GetCircleListStartAngle());
-        /* -------------------------------------------------------------------------- */
-        if(nullptr == PointImage)
-        {
-            PointImage = new UIImageView();
-            if(nullptr == PointImage)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistView::PointImage failed!! [%d]", __LINE__);
-                return;
-            }
-            PointImage->SetPosition(330, 233, 10, 10);
-            PointImage->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
-            PointImage->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-            PointImage->SetStyle(STYLE_BORDER_RADIUS, 200);
-            CircleListGroup_->Add(PointImage);
-        }
-        /* -------------------------------------------------------------------------- */
-        if(CircleListSelectImage == nullptr)
-        {
-            CircleListSelectImage = new UIImageView();
-            if(nullptr == CircleListSelectImage)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListSelectImage failed!! [%d]", __LINE__);
-                return;
-            }
-            CircleListSelectImage->SetPosition(153, 153,160,160);
-            CircleListSelectImage->SetAutoEnable(false);
-            CircleListSelectImage->SetResizeMode(UIImageView::SCALE_DOWN);
-            CircleListSelectImage->SetSrc(ApplistModel::GetInstance().GetApplistItems()[ApplistModel::GetInstance().GetCurselectImageIndex()].iconLarge);
-            CircleListSelectImage->SetViewIndex(ApplistModel::GetInstance().GetApplistItems()[ApplistModel::GetInstance().GetCurselectImageIndex()].id);
-            CircleListSelectImage->SetTouchable(true);
-            CircleListSelectImage->SetOnClickListener(presenter_);
-            CircleListGroup_->Add(CircleListSelectImage);
-        }
-        /* -------------------------------------------------------------------------- */
-        if(nullptr == AppCircleListOnDragListener_)
-        {
-            AppCircleListOnDragListener_ = new AppCircleListOnDragListener(CircleListAPP,CircleListAPPNum,CircleListSelectImage);
-            if (nullptr == AppCircleListOnDragListener_)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistView::AppCircleListOnDragListener_ failed!! [%d]", __LINE__);
-                return;
-            }
-        }
-        CircleListGroup_->SetOnDragListener(static_cast<UIView::OnDragListener*>(AppCircleListOnDragListener_));
-        CircleListScrollView->SetOnRotateListener(static_cast<UIView::OnRotateListener *>(AppCircleListOnDragListener_));
-        /* -------------------------------------------------------------------------- */
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListStyleOnStart success!! [%d]", __LINE__);
-    }
-    return;
-}
-void ApplistView::CircleListStyleOnSetUpView(void)
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListStyleOnSetUpView [%d]", __LINE__);
-    return;
-}
-void ApplistView::CircleListStyleOnStop(void)
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::CircleListStyleOnStop [%d]", __LINE__);
-    return;
+    desktopFragment_->DestroyView();
+    delete desktopFragment_;
+    desktopFragment_ = nullptr;
 }
-/* -------------------------------------------------------------------------- */
 
-void ApplistView::ListStyleOnStart()
+void ApplistView::OnResume()
 {
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart");
-    listAdapter_ = new ApplistAdapter();
-    if (listAdapter_ == nullptr) {
-        return;
-    }
-    listAdapter_->SetItemClickListener(presenter_);
-
-    contentList_ = new UIList(UIList::VERTICAL);
-    if (contentList_ == nullptr) {
-        return;
-    }
-    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_->SetDraggable(true);
-    contentList_->SetThrowDrag(true);
-    contentList_->EnableAutoAlign(true);
-    contentList_->SetScrollStateListener(presenter_);
-    contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
-    contentList_->SetYScrollBarVisible(true);
-    contentList_->RequestFocus(); // 确保列表获得焦点
-
-    dragListener_ = new AppListOnDragListener();
-    if (dragListener_ == nullptr) {
+    if (desktopFragment_ == nullptr) {
         return;
     }
-    contentList_->SetOnDragListener(dragListener_);
-    AddViewToRootContainer(contentList_);
-}
-
-void ApplistView::ResumeWaterFallDraggable()
-{
-    if (waterfallList_ != nullptr) {
-        waterfallList_->SetTouchable(true);
-        waterfallList_->SetDraggable(true); // resume touchable after transition animation
-    }
-}
-
-void ApplistView::StartFootBallAnimator()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::StartFootBallAnimator");
-    if (enterAnimator_ != nullptr) {
-        enterAnimator_->Start();
-    }
-}
-
-void ApplistView::OnStop()
-{
-    AppListStyle style = presenter_->GetCurrentStyle();
-    if (style == AppListStyle::FOOTBALL_STYLE) {
-        FootballStyleOnStop();
-    } else if (style == AppListStyle::HEXAGONS_STYLE) {
-        HexagonsStyleOnStop();
-    } else if (style == AppListStyle::WATERFALL_STYLE) {
-        WaterfallStyleOnStop();
-    } else if (style == AppListStyle::ARC_SCALE_LIST_STYLE) {
-        ArcScaleListStyleOnStop();
-    } else if (style == AppListStyle::CIRCLE_LIST_STYLE) {
-        CircleListStyleOnStop();
-    } else {
-        ListStyleOnStop();
-    }
-    return;
-}
-
-void ApplistView::FootballStyleOnStop()
-{
-    if (enterAnimator_ != nullptr) {
-        enterAnimator_->Stop();
-    }
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::FootballStyleOnStop");
-    if (footballDefaultImg_ != nullptr) {
-        ImageCacheManager::GetInstance().UnloadSingleRes(PNG_APPLIST_NOTSETUSE_IMG);
-        footballDefaultImg_ = nullptr;
-    }
-    if (footballList_ != nullptr) {
-        footballList_->RemoveAll();
-    }
-    ListNode<FootballItemView*>* viewNode = footballItemList_.Head();
-    while (viewNode != footballItemList_.End()) {
-        delete(viewNode->data_);
-        viewNode = viewNode->next_;
-    }
-    footballItemList_.Clear();
-}
-
-void ApplistView::HexagonsStyleOnStop()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStop");
-    if (hexagonsList_ != nullptr) {
-        hexagonsList_->RemoveAll();
-    }
-    ListNode<HexagonsItemView*>* viewNode = listHexagonsView_.Head();
-    while (viewNode != listHexagonsView_.End()) {
-        delete(viewNode->data_);
-        viewNode = viewNode->next_;
-    }
-    listHexagonsView_.Clear();
-}
-
-void ApplistView::WaterfallStyleOnStop()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::WaterfallStyleOnStop");
-    if (waterfallList_ != nullptr) {
-        waterfallList_->RemoveAll();
-    }
-    ListNode<WaterfallItemView*>* viewNode = waterfallItemList_.Head();
-    while (viewNode != waterfallItemList_.End()) {
-        delete(viewNode->data_);
-        viewNode = viewNode->next_;
-    }
-    waterfallItemList_.Clear();
-}
-
-void ApplistView::ListStyleOnStop()
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStop");
-    int16_t listHeadY = contentList_->GetChildrenHead()->GetY();
-    int16_t listHeadIndex = contentList_->GetChildrenHead()->GetViewIndex();
-    presenter_->SetHeadItemY(listHeadY);
-    presenter_->SetStartIndex(listHeadIndex);
+    desktopFragment_->ResumeView();
 }
 
 void ApplistView::AddAppItemToList(const AppItem &item)
 {
-    AppListStyle style = presenter_->GetCurrentStyle();
-    if (style == AppListStyle::FOOTBALL_STYLE) {
-        FootballItemView *itemView = new FootballItemView();
-        itemView->SetItemInfo(item);
-        itemView->SetSrc(item.iconHexagon);
-        itemView->SetTouchable(true);
-        itemView->SetOnClickListener(presenter_);
-        footballList_->Add(itemView);
-        footballItemList_.PushBack(itemView);
-    } else if (style == AppListStyle::HEXAGONS_STYLE) {
-        HexagonsItemView *itemView = new HexagonsItemView();
-        itemView->SetItemInfo(item);
-        itemView->SetSrc(item.iconSmall);
-        itemView->SetTouchable(true);
-        itemView->SetOnClickListener(presenter_);
-        hexagonsList_->Add(itemView);
-        listHexagonsView_.PushBack(itemView);
-    } else if (style == AppListStyle::WATERFALL_STYLE) {
-        WaterfallItemView *itemView = new WaterfallItemView();
-        itemView->SetItemInfo(item);
-        itemView->SetSrc(item.iconSmall);
-        itemView->SetTouchable(true);
-        itemView->SetOnClickListener(presenter_);
-        waterfallList_->Add(itemView);
-        waterfallItemList_.PushBack(itemView);
-    } else if(style == AppListStyle::ARC_SCALE_LIST_STYLE) {
-        ArcScaleListAdapter_->AddListItem(item);
-    } else if(style == AppListStyle::CIRCLE_LIST_STYLE) {
-        //拨号盘
-    } else {
-        listAdapter_->AddListItem(item);
+    if (desktopFragment_ == nullptr) {
+        return;
     }
+    desktopFragment_->AddAppItemToList(item);
 }
 
 void ApplistView::ClearAppItemToList()
 {
-    AppListStyle style = presenter_->GetCurrentStyle();
-    if (style == FOOTBALL_STYLE) {
-        FootballStyleOnStop();
-    } else if (style == AppListStyle::HEXAGONS_STYLE) {
-        HexagonsStyleOnStop();
-    } else if (style == AppListStyle::WATERFALL_STYLE) {
-        WaterfallStyleOnStop();
-    } else if(style == AppListStyle::ARC_SCALE_LIST_STYLE) {
-        ArcScaleListStyleOnStop();
-    } else if(style == AppListStyle::CIRCLE_LIST_STYLE) {
-        CircleListStyleOnStop();
-    } else {
-        listAdapter_->ClearItem();
-    }
-}
-
-void ApplistView::RefreshAppList(void)
-{
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::RefreshAppList");
-    AppListStyle style = presenter_->GetCurrentStyle();
-    if (style == AppListStyle::FOOTBALL_STYLE) {
-        footballList_->RefreshIcosahedron();
-    } else if (style == AppListStyle::HEXAGONS_STYLE) {
-        hexagonsList_->LayoutChildren(true);
-    } else if (style == AppListStyle::WATERFALL_STYLE) {
-        waterfallList_->LayoutChildren(true);
-    }  else if (style == AppListStyle::ARC_SCALE_LIST_STYLE) {
-        ArcScaleListStyleOnSetUpView();
-    } else if (style == AppListStyle::CIRCLE_LIST_STYLE) {
-        // 拨号盘
-    } else {
-        uint16_t startIndex = 0;
-        int16_t headY = 0;
-        if (presenter_->GetStartIndex() >= presenter_->GetListItemNum()) {
-            startIndex = presenter_->GetListItemNum() - 1;
-            headY = VERTICAL_RESOLUTION / NUM_2;
-        } else {
-            startIndex = presenter_->GetStartIndex();
-            headY = presenter_->GetHeadItemY();
-            if (headY == 0) {
-                headY = VERTICAL_RESOLUTION / NUM_2;
-            }
-        }
-        contentList_->SetAdapter(listAdapter_);
-        contentList_->ScrollTo(startIndex);
-        contentList_->ScrollBy(headY);
-        contentList_->RefreshList();
+    if (desktopFragment_ == nullptr) {
+        return;
     }
+    desktopFragment_->ClearAppItemToList();
 }
 
-void FootballAnimatorCallback::Callback(UIView *view)
+void ApplistView::RefreshAppList()
 {
-    if (HALTick::GetInstance().GetElapseTime(startTime_) < 300) { // 300, empirical coefficient
+    if (desktopFragment_ == nullptr) {
         return;
     }
-    if (!isStartAnim_) {
-        animator_->Stop();
-        animator_->Start();
-        isStartAnim_ = true;
-    }
-    UIIcosahedronView* footView = dynamic_cast<UIIcosahedronView*>(view);
-    int16_t el = EasingEquation::LinearEaseNone(startPos_, endPos_, animator_->GetRunTime(), animator_->GetTime());
-    footView->SetSideLength(el);
-    footView->RefreshIcosahedron();
-    const Vector3<float> rotateStart(Screen::GetInstance().GetWidth() / 2.0, // 2.0: divisor
-        Screen::GetInstance().GetHeight() / 2.0, 0); // 2.0: divisor
-    const Vector3<float> rotateEnd(0, 0, 0);
-    // 270 : stop angle
-    int16_t angle = EasingEquation::LinearEaseNone(0, 270, animator_->GetRunTime(), animator_->GetTime());
-    footView->RotatePlanes(angle, rotateStart, rotateEnd);
+    desktopFragment_->RefreshAppList();
 }
 }
index fa943b2..c854050 100644 (file)
@@ -1,37 +1,37 @@
-// /*
-//  * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
-//  * Description: DesktopFactory
-//  * Author:
-//  * Create: 2025-07
-//  */
+/*
+ * Copyright (c) CompanyNameMagicTag 2025. All rights reserved.
+ * Description: DesktopFactory
+ * Author:
+ * Create: 2025-07
+ */
 
-// #include "applist/include/DesktopFactory.h"
-// #include "wearable_log.h"
+#include "applist/include/DesktopFactory.h"
+#include "wearable_log.h"
 
-// namespace OHOS {
+namespace OHOS {
 
-// void DesktopFactory::RegisterDesktopStyle(const uint16_t style, DesktopInterface* desktop)
-// {
-//     if (desktop == nullptr) {
-//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Can't register desktop using null proxy");
-//         return;
-//     }
-//     if (desktops_.find(style) != desktops_.end()) {
-//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "desktop style %d has already been registered", style);
-//         return;
-//     } else {
-//         desktops_.insert({style, desktop});
-//     }
-// }
+void DesktopFactory::RegisterDesktopStyle(const uint16_t style, DesktopInterface* desktop)
+{
+    if (desktop == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Can't register desktop using null proxy");
+        return;
+    }
+    if (desktops_.find(style) != desktops_.end()) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "desktop style %d has already been registered", style);
+        return;
+    } else {
+        desktops_.insert({style, desktop});
+    }
+}
 
-// UIDesktopFragment* DesktopFactory::CreateDesktopStyle(uint16_t style)
-// {
-//     auto it = desktops_.find(style);
-//     if (it != desktops_.end()) {
-//         return it->second->CreateDesktop();
-//     } else {
-//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Desktop style:%d was not registered", style);
-//         return nullptr;
-//     }
-// }
-// } // namespace OHOS
+UIDesktopFragment* DesktopFactory::CreateDesktopStyle(uint16_t style)
+{
+    auto it = desktops_.find(style);
+    if (it != desktops_.end()) {
+        return it->second->CreateDesktop();
+    } else {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Desktop style:%d was not registered", style);
+        return nullptr;
+    }
+}
+} // namespace OHOS
index a7e5420..18457b0 100644 (file)
-// /*
-//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
-//  * Description: ListDesktopFragment.cpp
-//  * Author:
-//  * Create: 2025-07-04
-//  */
-
-// #include "applist/include/ListDesktopFragment.h"
-// #include "applist/include/DesktopFactory.h"
-// #include "applist/include/ApplistModel.h"
-
-// namespace OHOS {
-// REGIST_DESKTOP_STYLE(APPLIST_STYLE, ListDesktopFragment);
-
-// static constexpr int16 NUM_2 = 2;
-// static constexpr int16 MAX_SCROLL_DIS = 1000;
-
-// void ListDesktopFragment::OnCreateView(void* data)
-// {
-//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnCreateView");
-//     listAdapter_ = new ApplistAdapter();
-//     if (listAdapter_ == nullptr) {
-//         return;
-//     }
-//     listAdapter_->SetItemClickListener(this);
-
-//     contentList_ = new UIList(UIList::VERTICAL);
-//     if (contentList_ == nullptr) {
-//         return;
-//     }
-//     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_->SetDraggable(true);
-//     contentList_->SetThrowDrag(true);
-//     contentList_->EnableAutoAlign(true);
-//     contentList_->SetScrollStateListener(this);
-//     contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
-//     contentList_->SetYScrollBarVisible(true);
-
-//     dragListener_ = new AppListOnDragListener();
-//     if (dragListener_ == nullptr) {
-//         return;
-//     }
-//     contentList_->SetOnDragListener(dragListener_);
-//     fragmentView_.Add(contentList_);
-// }
-
-
-// void ListDesktopFragment::OnDestroyView()
-// {
-//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnDestroyView");
-//     int16_t listHeadY = contentList_->GetChildrenHead()->GetY();
-//     int16_t listHeadIndex = contentList_->GetChildrenHead()->GetViewIndex();
-//     ApplistModel *model = &ApplistModel::GetInstance();
-//     model->SetHeadItemY(listHeadY);
-//     model->SetStartIndex(listHeadIndex);
-
-//     ClearAppItemToList();
-
-//     if (listAdapter_ != nullptr) {
-//         delete listAdapter_;
-//         listAdapter_ = nullptr;
-//     }
-//     if (contentList_ != nullptr) {
-//         delete contentList_;
-//         contentList_ = nullptr;
-//     }
-//     if (dragListener_ != nullptr) {
-//         delete dragListener_;
-//         dragListener_ = nullptr;
-//     }
-// }
-
-// bool ListDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
-// {
-//     UNUSED(event);
-//     AppItemView *itemView = dynamic_cast<AppItemView *>(&view);
-//     if (itemView == nullptr) {
-//         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr");
-//         return false;
-//     }
-//     AppViewId viewId = itemView->GetViewId();
-//     char *uid = (char *)itemView->GetAppUid();
-
-//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnClick viewid = %d", viewId);
-//     return SwitchView(viewId, uid, TransitionType::TRANSITION_INVALID, APPLIST_STYLE);
-// }
-
-// void ListDesktopFragment::OnItemSelected(int16 index, UIView *view)
-// {
-//     UNUSED(index);
-//     if (view != nullptr) {
-//         itemViewSele = static_cast<AppItemView *>(view);
-//         itemViewSele->SelectedChange();
-
-//         if (preItemViewSele != nullptr && preItemViewSele != itemViewSele) {
-//             preItemViewSele->Reset();
-//         }
-//         preItemViewSele = itemViewSele;
-//     }
-// }
-
-// void ListDesktopFragment::AddAppItemToList(const AppItem &item)
-// {
-//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::AddAppItemToList");
-//     listAdapter_->AddListItem(item);
-// }
-
-// void ListDesktopFragment::ClearAppItemToList()
-// {
-//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::ClearAppItemToList");
-//     listAdapter_->ClearItem();
-// }
-
-// void ListDesktopFragment::RefreshAppList(void)
-// {
-//     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::RefreshAppList");
-//     uint16_t startIndex = 0;
-//     int16_t headY = 0;
-//     ApplistModel *model = &ApplistModel::GetInstance();
-//     if (model->GetStartIndex() >= model->GetAppListNum()) {
-//         startIndex = model->GetAppListNum() - 1;
-//         headY = VERTICAL_RESOLUTION / NUM_2;
-//     } else {
-//         startIndex = model->GetStartIndex();
-//         headY = model->GetHeadItemY();
-//         if (headY == 0) {
-//             headY = VERTICAL_RESOLUTION / NUM_2;
-//         }
-//     }
-//     contentList_->SetAdapter(listAdapter_);
-//     contentList_->ScrollTo(startIndex);
-//     contentList_->ScrollBy(headY);
-//     contentList_->RefreshList();
-// }
-// }
+/*
+ * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+ * Description: ListDesktopFragment.cpp
+ * Author:
+ * Create: 2025-07-04
+ */
+
+#include "applist/include/ListDesktopFragment.h"
+#include "applist/include/DesktopFactory.h"
+#include "applist/include/ApplistModel.h"
+
+namespace OHOS {
+REGIST_DESKTOP_STYLE(APPLIST_STYLE, ListDesktopFragment);
+
+static constexpr int16 NUM_2 = 2;
+static constexpr int16 MAX_SCROLL_DIS = 1000;
+
+void ListDesktopFragment::OnCreateView(void* data)
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnCreateView");
+    listAdapter_ = new ApplistAdapter();
+    if (listAdapter_ == nullptr) {
+        return;
+    }
+    listAdapter_->SetItemClickListener(this);
+
+    contentList_ = new UIList(UIList::VERTICAL);
+    if (contentList_ == nullptr) {
+        return;
+    }
+    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_->SetDraggable(true);
+    contentList_->SetThrowDrag(true);
+    contentList_->EnableAutoAlign(true);
+    contentList_->SetScrollStateListener(this);
+    contentList_->SetMaxScrollDistance(MAX_SCROLL_DIS);
+    contentList_->SetYScrollBarVisible(true);
+
+    dragListener_ = new AppListOnDragListener();
+    if (dragListener_ == nullptr) {
+        return;
+    }
+    contentList_->SetOnDragListener(dragListener_);
+    fragmentView_.Add(contentList_);
+}
+
+
+void ListDesktopFragment::OnDestroyView()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnDestroyView");
+    int16_t listHeadY = contentList_->GetChildrenHead()->GetY();
+    int16_t listHeadIndex = contentList_->GetChildrenHead()->GetViewIndex();
+    ApplistModel *model = &ApplistModel::GetInstance();
+    model->SetHeadItemY(listHeadY);
+    model->SetStartIndex(listHeadIndex);
+
+    ClearAppItemToList();
+
+    if (listAdapter_ != nullptr) {
+        delete listAdapter_;
+        listAdapter_ = nullptr;
+    }
+    if (contentList_ != nullptr) {
+        delete contentList_;
+        contentList_ = nullptr;
+    }
+    if (dragListener_ != nullptr) {
+        delete dragListener_;
+        dragListener_ = nullptr;
+    }
+}
+
+bool ListDesktopFragment::OnClick(UIView &view, const ClickEvent &event)
+{
+    UNUSED(event);
+    AppItemView *itemView = dynamic_cast<AppItemView *>(&view);
+    if (itemView == nullptr) {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr");
+        return false;
+    }
+    AppViewId viewId = itemView->GetViewId();
+    char *uid = (char *)itemView->GetAppUid();
+
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::OnClick viewid = %d", viewId);
+    return SwitchView(viewId, uid, TransitionType::TRANSITION_INVALID, APPLIST_STYLE);
+}
+
+void ListDesktopFragment::OnItemSelected(int16 index, UIView *view)
+{
+    UNUSED(index);
+    if (view != nullptr) {
+        itemViewSele = static_cast<AppItemView *>(view);
+        itemViewSele->SelectedChange();
+
+        if (preItemViewSele != nullptr && preItemViewSele != itemViewSele) {
+            preItemViewSele->Reset();
+        }
+        preItemViewSele = itemViewSele;
+    }
+}
+
+void ListDesktopFragment::AddAppItemToList(const AppItem &item)
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::AddAppItemToList");
+    listAdapter_->AddListItem(item);
+}
+
+void ListDesktopFragment::ClearAppItemToList()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::ClearAppItemToList");
+    listAdapter_->ClearItem();
+}
+
+void ListDesktopFragment::RefreshAppList(void)
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ListDesktopFragment::RefreshAppList");
+    uint16_t startIndex = 0;
+    int16_t headY = 0;
+    ApplistModel *model = &ApplistModel::GetInstance();
+    if (model->GetStartIndex() >= model->GetAppListNum()) {
+        startIndex = model->GetAppListNum() - 1;
+        headY = VERTICAL_RESOLUTION / NUM_2;
+    } else {
+        startIndex = model->GetStartIndex();
+        headY = model->GetHeadItemY();
+        if (headY == 0) {
+            headY = VERTICAL_RESOLUTION / NUM_2;
+        }
+    }
+    contentList_->SetAdapter(listAdapter_);
+    contentList_->ScrollTo(startIndex);
+    contentList_->ScrollBy(headY);
+    contentList_->RefreshList();
+}
+}
index 40a5383..ec7f7af 100644 (file)
@@ -1,50 +1,56 @@
-// /*
-//  * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
-//  * Description: UIDesktopFragment.cpp
-//  * Author:
-//  * Create: 2025-07-07
-//  */
+/*
+ * Copyright (c) CompanyNameMagicTag 2025-2025. All rights reserved.
+ * Description: UIDesktopFragment.cpp
+ * Author:
+ * Create: 2025-07-07
+ */
 
-// #include "applist/include/UIDesktopFragment.h"
-// #include "common/image_cache_manager.h"
-// #include "ability_manager.h"
-// #include "NativeAbility.h"
+#include "applist/include/UIDesktopFragment.h"
+#include "common/image_cache_manager.h"
+#include "ability_manager.h"
+#include "NativeAbility.h"
 
-// namespace OHOS {
-// void UIDesktopFragment::SetPosition(int16_t x, int16_t y, int16_t width, int16_t height)
-// {
-//     fragmentView_.SetPosition(x, y, width, height);
-// }
+namespace OHOS {
+void UIDesktopFragment::SetPosition(int16_t x, int16_t y, int16_t width, int16_t height)
+{
+    fragmentView_.SetPosition(x, y, width, height);
+}
 
-// bool UIDesktopFragment::SwitchView(AppViewId viewId, char *uid, TransitionType type, DesktopStyle style)
-// {
-//     if (viewId < VIEW_MAX_INTER_APP) {
-//         if (viewId == VIEW_SETTING && style == DesktopStyle::APPLIST_STYLE) {
-//             NativeAbility::GetInstance().ChangeSlice(viewId, type, gSliceDefaultPriority, true);
-//         } else {
-//             NativeAbility::GetInstance().ChangeSlice(viewId, type);
-//         }
-//         return true;
-//     } else if (viewId == VIEW_EXTERN_APP) {
-// #ifdef JS_ENABLE
-//         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UIDesktopFragment::OnClick bundleName = %s", uid);
-//         Want *want = new Want();
-//         memset_s(want, sizeof(Want), 0, sizeof(Want));
-//         ElementName startElement = {};
-//         startElement.abilityName = (char *)"default";
-//         startElement.bundleName = uid;
-//         startElement.deviceId = nullptr;
-//         SetWantElement(want, startElement);
-//         if (viewId == VIEW_SETTING && style == DesktopStyle::APPLIST_STYLE) {
-//             StartAbilityWithAnimation(want, static_cast<uint8_t>(type), true);
-//         } else {
-//             StartAbilityWithAnimation(want, static_cast<uint8_t>(type), false);
-//         }
-//         ClearWant(want);
-//         delete want;
-//         return true;
-// #endif
-//     }
-//     return false;
-// }
-// }
+bool UIDesktopFragment::SwitchView(AppViewId viewId, char *uid, TransitionType type, ThemeStyle style)
+{
+    if (viewId < VIEW_MAX_INTER_APP) {
+        #if 0
+        if (viewId == VIEW_SETTING && style == DesktopStyle::APPLIST_STYLE) {
+            NativeAbility::GetInstance().ChangeSlice(viewId, type, gSliceDefaultPriority, true);
+        } else {
+            NativeAbility::GetInstance().ChangeSlice(viewId, type);
+        }
+        #endif
+        NativeAbility::GetInstance().EnterSlice(viewId, type);
+        return true;
+    } else if (viewId == VIEW_EXTERN_APP) {
+#ifdef JS_ENABLE
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UIDesktopFragment::OnClick bundleName = %s", uid);
+        Want *want = new Want();
+        memset_s(want, sizeof(Want), 0, sizeof(Want));
+        ElementName startElement = {};
+        startElement.abilityName = (char *)"default";
+        startElement.bundleName = uid;
+        startElement.deviceId = nullptr;
+        SetWantElement(want, startElement);
+        #if 0
+        if (viewId == VIEW_SETTING && style == DesktopStyle::APPLIST_STYLE) {
+            StartAbilityWithAnimation(want, static_cast<uint8_t>(type), true);
+        } else {
+            StartAbilityWithAnimation(want, static_cast<uint8_t>(type), false);
+        }
+        #endif
+        StartAbilityWithAnimation(want, static_cast<uint8_t>(type), false);
+        ClearWant(want);
+        delete want;
+        return true;
+#endif
+    }
+    return false;
+}
+}
index c7e6ec7..c2e21c6 100644 (file)
@@ -108,11 +108,7 @@ void KeyInputListener::HandlePowerKeyPress(uint16_t currentViewId)
                 }
                 else
                 {
-                    if (ApplistModel::GetInstance().GetCurrentStyle() == AppListStyle::WATERFALL_STYLE) {
-                        NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_INVALID);
-                    } else {
-                        NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_INVALID);
-                    }
+                    NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_INVALID);
                 }
             }
         }
index 519c626..1a4c171 100644 (file)
@@ -112,7 +112,6 @@ namespace OHOS
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::LanguageSwitchScrollViewInit");
         LanguageSwitchScrollView = new UIScrollView();
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::LanguageSwitchScrollViewInit1");
         if (LanguageSwitchScrollView == nullptr)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::LanguageSwitchScrollView new fail!");
@@ -322,9 +321,7 @@ namespace OHOS
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::OnStart");
         LanguageSwitchViewInit();
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::OnStart1");
         // InithintView();
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::OnStart end");
         return;
     }
 }
\ No newline at end of file