添加applist的足球显示样式
authorluozheng <1732036298@qq.com>
Sat, 6 Jul 2024 10:41:07 +0000 (18:41 +0800)
committerluozheng <1732036298@qq.com>
Sat, 6 Jul 2024 10:41:07 +0000 (18:41 +0800)
15 files changed:
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/include/AppItemView.h
code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistModel.h
code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistPresenter.h
code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistView.h
code/sdk/application/wearable/fd230app/nativeui/applist/src/AppItemView.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistView.cpp
code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h
code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStylePresenter.h
code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleView.h
code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleModel.cpp
code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleView.cpp

index f994949..dfff188 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-05-07 11:25:58
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-05 20:27:09
+ * @LastEditTime: 2024-07-06 10:12:27
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp
  */
 #include "aivoice/include/AiVoicePresenter.h"
@@ -114,6 +114,7 @@ namespace OHOS
         label->SetTextId(labelconfig.textId);
         label->SetLineBreakMode(labelconfig.lineBreakMode);
         label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label->SetRollSpeed(70);
         label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
         return label;
     }
@@ -151,13 +152,13 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceViewLabel");
         LabelConfig labelConfig = {
             .left = 83,
-            .top = 52,
+            .top = 50,
             .width = 300,
             .height = 35,
             .fontSize = 30,
             .lineHeigh = 35,
             .textId = STR_AI_INTELLIGENT_ASSISTANT,
-            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+            .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
         };
         title = AiVoiceViewLabelInit(labelConfig);
         if (title == nullptr)
@@ -174,7 +175,7 @@ namespace OHOS
             .fontSize = 30,
             .lineHeigh = 35,
             .textId = STR_START_CHAT,
-            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+            .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
         };
         startChatLabel = AiVoiceViewLabelInit(labelConfig);
         if (startChatLabel == nullptr)
index 080a52e..1c644c7 100644 (file)
@@ -1,17 +1,11 @@
 /*
  * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-04-08 16:43:48
- * @LastEditors: SnickerSun snickersun@163.com
- * @LastEditTime: 2024-07-02 19:45:18
+ * @Date: 2024-07-06 17:36:42
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-07-06 18:25:00
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/applist/include/AppItemView.h
  */
 
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: AppItemView.h
- * Author:
- * Create: 2021-09-18
- */
 
 #ifndef APP_ITEM_VIEW_H
 #define APP_ITEM_VIEW_H
@@ -58,6 +52,18 @@ private:
     AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr,nullptr,STR_EXERCISE_GENERAL, 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, STR_EXERCISE_GENERAL,nullptr };
+};
 }
 
 #endif
index 8ea9160..40059b7 100644 (file)
@@ -1,10 +1,4 @@
-/*
- * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-04-08 16:43:48
- * @LastEditors: SnickerSun snickersun@163.com
- * @LastEditTime: 2024-07-02 20:03:25
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistModel.h
- */
+
 /*
  * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
  * Description: ApplistModel.h
  * Create: 2021-09-18
  */
 
-#ifndef APPLIST_MODEL_H
-#define APPLIST_MODEL_H
+#ifndef _APPLIST_MODEL_H_
+#define _APPLIST_MODEL_H_
 
 #include "bundle_info.h"
 #include "AppViewIDs.h"
-#include "components/ui_label_ext.h"
-#include"language/font/ui_resource_string.h"
-#include "ohos_types.h"
 
+#include "ohos_types.h"
+#include "components/ui_label_ext.h"
+#include "language/font/ui_resource_string.h"
 #include "ThemeStyleModel.h"
 #define APP_MAX_NUM 50
 
@@ -38,13 +32,6 @@ typedef struct {
 
 #define AppListStyle ThemeStyle
 
-// typedef enum : uint16_t
-// {
-//     APPLIST_STYLE,  // 列表显示
-//     HEXAGONS_STYLE, // 蜂窝显示
-//     FOOTBALL_STYLE, //足球
-//     MAX_THEME_STYLE,
-// } AppListStyle;
 class ApplistPresenter;
 class ApplistModel {
 public:
index ec4bcc2..29d65a1 100644 (file)
@@ -37,7 +37,7 @@ namespace OHOS {
         int GetHeadItemY(void);
         uint8_t GetListItemNum(void);
         ApplistView* GetAppListView();
-        bool GetIsUseListStyle(void);
+        AppListStyle GetCurrentStyle(void);
 
     private:
         AppItemView *itemViewSele{nullptr};
index 762ba31..dc2e81e 100644 (file)
@@ -3,13 +3,15 @@
 #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_label_ext.h"
 #include "components/ui_list.h"
 #include "components/ui_custom_hexagons_list.h"
+#include "components/ui_icosahedron_view.h"
+#include "gfx_utils/list.h"
 #include "window/window.h"
 #include "ohos_types.h"
 #include "BaseView.h"
@@ -17,7 +19,7 @@
 #include "ChangeSliceListener.h"
 #include "drag_event.h"
 #include "UiConfig.h"
-
+#include "components/ui_label_ext.h"
 namespace OHOS {
 class AppListOnDragListener : public UIView::OnDragListener {
 public:
@@ -61,6 +63,42 @@ 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:
@@ -75,25 +113,34 @@ public:
     void AddAppItemToList(const AppItem &item);
     void ClearAppItemToList();
     void RefreshAppList(void);
+
 private:
-    void HexagonsStyleOnStart();
+    /* for list style */
     void ListStyleOnStart();
-    void HexagonsStyleOnSetUpView();
     void ListStyleOnSetUpView();
-    void HexagonsStyleOnStop();
     void ListStyleOnStop();
-
-    /* for list style */
     ApplistAdapter *listAdapter_{nullptr};
     UIList *contentList_{nullptr};
     UIView::OnDragListener *dragListener{nullptr};
 
     /* for hexagons style */
+    void HexagonsStyleOnStart();
+    void HexagonsStyleOnSetUpView();
+    void HexagonsStyleOnStop();
     UICustomHexagonsList* hexagonsList_{nullptr};
-    std::list<HexagonsItemView*> listHexagonsView_;
+    List<HexagonsItemView*> listHexagonsView_;
     uint16_t imgSize_ = 0;
     uint16_t imgDistance_ = 0;
 
+    /* for football style */
+    void FootballStyleOnStart();
+    void FootballStyleOnSetUpView();
+    void FootballStyleOnStop();
+    UIIcosahedronView* footballList_ = nullptr;
+    List<FootballItemView*> footballItemList_;
+    ImageInfo* footballDefaultImg_ = nullptr;
+    FootballAnimatorCallback* callback_ = nullptr;
+    Animator* enterAnimator_ = nullptr;
 };
 }
 #endif // APPLIST_VIEW_H
\ No newline at end of file
index ae1aed0..e329bb7 100644 (file)
@@ -16,7 +16,7 @@ namespace OHOS {
     static constexpr int16 APP_ITEM_LABEL_HEIGHT = 110;
 
     static constexpr int16 NUM_20 = 20;
-    static constexpr int16 APP_ITEM_FONT_SIZE = 36;
+    static constexpr int16 APP_ITEM_FONT_SIZE = 40;
     static constexpr int16 APP_ITEM_SELECTED_FONT_SIZE = 44;
 
     AppItemView::AppItemView()
@@ -119,4 +119,19 @@ namespace OHOS {
     {
         return itemInfo_.uid;
     }
+
+    void FootballItemView::SetItemInfo(const AppItem &itemInfo)
+    {
+        itemInfo_ = itemInfo;
+    }
+
+    AppViewId FootballItemView::GetViewId()
+    {
+        return itemInfo_.id;
+    }
+
+    const char *FootballItemView::GetAppUid()
+    {
+        return itemInfo_.uid;
+    }
 }
index 93a8e66..eae7c6e 100644 (file)
 #include "wearable_log.h"
 
 #include "UiConfig.h"
-#include "AppViewIDs.h"
+#include "ApplistModel.h"
+#include "applist/include/ApplistPresenter.h"
+#include "SetDesktopModel.h"
 #include "components/ui_label_ext.h"
 #include "language/font/ui_resource_string.h"
 #include "applist/include/ApplistModel.h"
-#include "applist/include/ApplistPresenter.h"
-#include "SetDesktopModel.h"
 #include "themestyle/include/ThemeStyleModel.h"
 #include "set_desktop/include/SetDesktopView.h"
 namespace OHOS
@@ -249,18 +249,6 @@ namespace OHOS
 
     AppListStyle ApplistModel::GetCurrentStyle(void)
     {
-        uint8_t currenStyle = SetDesktopView::GetInstance()->GetCurrentSelectedStyle();
-        if (currenStyle == 1)
-        { // 1: hexagons desktop style
-            return HEXAGONS_STYLE;
-        }
-        else if (currenStyle == 2)
-        { // 2: football desktop style
-            return FOOTBALL_STYLE;
-        }
-        else
-        {
-            return APPLIST_STYLE;
-        }
+        return ThemeStyleModel::GetInstance().GetAppListDisplayStyle();
     }
 }
index 13e77d4..66c5c12 100644 (file)
@@ -8,12 +8,12 @@
 #include "ApplistPresenter.h"
 #include "ability_manager.h"
 #include "securec.h"
-#include "ConfigModel.h"
-#include "traing/include/TraingModel.h"
 #include "components/ui_hexagons_list.h"
 #include "TransitionType.h"
 #include "AppViewIDs.h"
-
+#include "ConfigModel.h"
+#include "traing/include/TraingModel.h"
+#include <ThemeStyleModel.h>
 namespace OHOS {
     ApplistPresenter::ApplistPresenter()
     {
@@ -103,15 +103,12 @@ namespace OHOS {
         AppViewId viewId = VIEW_INVALID;
         char *uid =  nullptr;
         TransitionType type = TransitionType::TRANSITION_INVALID;
-        if (GetIsUseListStyle()) {
-            AppItemView *itemView = dynamic_cast<AppItemView *>(&view);
-            if (itemView == nullptr) {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr", viewId);
-                return false;
-            }
+        AppListStyle style = GetCurrentStyle();
+        if (style == AppListStyle::FOOTBALL_STYLE) {
+            FootballItemView *itemView = dynamic_cast<FootballItemView *>(&view);
             viewId = itemView->GetViewId();
             uid = (char *)itemView->GetAppUid();
-        } else {
+        } else if (style == AppListStyle::HEXAGONS_STYLE) {
             HexagonsItemView *itemView = dynamic_cast<HexagonsItemView *>(&view);
             UIHexagonsList* hexagonsView = dynamic_cast<UIHexagonsList *>(itemView->GetParent());
             if (hexagonsView == nullptr || itemView == nullptr) {
@@ -123,8 +120,16 @@ namespace OHOS {
             hexagonsView->SetDraggable(false);
             hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view
             type = TransitionType::TRANSITION_HEXAGONS;
+        } 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 type = %d", viewId,type);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d type = %d", viewId,type);
         if (viewId < VIEW_MAX_INTER_APP) {
             //NativeAbility::GetInstance().ChangeSlice(viewId, type);
             NativeAbility::GetInstance().EnterSlice(viewId, type);
@@ -188,9 +193,9 @@ namespace OHOS {
         return model->GetAppListNum();
     }
 
-    bool ApplistPresenter::GetIsUseListStyle(void)
+    AppListStyle ApplistPresenter::GetCurrentStyle(void)
     {
-        return model->GetCurrentStyle() == APPLIST_STYLE;
+        return model->GetCurrentStyle();
     }
 
     ApplistView* ApplistPresenter::GetAppListView()
index 2ffae53..b3a13c9 100644 (file)
@@ -9,6 +9,8 @@
 #include "ApplistView.h"
 #include "ApplistPresenter.h"
 #include "AppItemView.h"
+#include "common/image_cache_manager.h"
+#include "hal_tick.h"
 
 namespace OHOS {
 static constexpr int16 NUM_2 = 2;
@@ -39,27 +41,62 @@ ApplistView::~ApplistView()
         delete hexagonsList_;
         hexagonsList_ = nullptr;
     }
+    if (callback_ != nullptr) {
+        delete callback_;
+        callback_ = nullptr;
+    }
+    enterAnimator_ = nullptr;
 }
 
 void ApplistView::OnStart()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStart ");
     View<ApplistPresenter>::OnStart();
-    if (presenter_->GetIsUseListStyle()) {
-        ListStyleOnStart();
-    } else {
+    AppListStyle style = presenter_->GetCurrentStyle();
+    if (style == AppListStyle::FOOTBALL_STYLE) {
+        FootballStyleOnStart();
+    } else if (style == AppListStyle::HEXAGONS_STYLE) {
         HexagonsStyleOnStart();
+    } else {
+        ListStyleOnStart();
+    }
+}
+
+//足球OnStart
+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, 250); // 30: Initial Size 250: Final display size
+    }
+    footballList_->SetDefaultImage(footballDefaultImg_);
+    footballList_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+    enterAnimator_ = callback_->GetAnimator();
+    SetContainerView(footballList_);
+    if (callback_ != nullptr) {
+        callback_->SetStartTime(HALTick::GetInstance().GetTime());
     }
 }
 
+//蜂窝OnStart
 void ApplistView::HexagonsStyleOnStart()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStart ");
     if (hexagonsList_ == nullptr) {
         hexagonsList_ = new UICustomHexagonsList();
     }
-    hexagonsList_->SetPosition(0, 0,
-        Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); // 2, two
+    hexagonsList_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
     imgDistance_ = hexagonsList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient
     imgSize_ = hexagonsList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient
     hexagonsList_->SetImageDistance(imgDistance_);
@@ -74,6 +111,7 @@ void ApplistView::HexagonsStyleOnStart()
     SetContainerView(hexagonsList_);
 }
 
+//列表OnStart
 void ApplistView::ListStyleOnStart()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart");
@@ -114,18 +152,32 @@ void ApplistView::OnSetUpView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnSetUpView");
     View<ApplistPresenter>::OnSetUpView();
-    if (presenter_->GetIsUseListStyle() == true) {
-        ListStyleOnSetUpView();
-    } else {
+    AppListStyle style = presenter_->GetCurrentStyle();
+    if (style == AppListStyle::FOOTBALL_STYLE) {
+        FootballStyleOnSetUpView();
+    } else if (style == AppListStyle::HEXAGONS_STYLE) {
         HexagonsStyleOnSetUpView();
+    } else {
+        ListStyleOnSetUpView();
+    }
+}
+
+//足球OnSetUpView
+void ApplistView::FootballStyleOnSetUpView()
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnSetUpView");
+    if (enterAnimator_ != nullptr) {
+        enterAnimator_->Start();
     }
 }
 
+//蜂窝OnSetUpView
 void ApplistView::HexagonsStyleOnSetUpView()
 {
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnSetUpView ");
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnSetUpView");
 }
 
+//列表OnSetUpView
 void ApplistView::ListStyleOnSetUpView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnSetUpView");
@@ -162,11 +214,14 @@ void ApplistView::OnTearDownView()
 void ApplistView::OnStop()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop");
-    if (presenter_->GetIsUseListStyle()) {
+    AppListStyle style = presenter_->GetCurrentStyle();
+    if (style == AppListStyle::FOOTBALL_STYLE) {
+        FootballStyleOnStop();
+    } else if (style == AppListStyle::HEXAGONS_STYLE) {
+        HexagonsStyleOnStop();
+    } else {
         ListStyleOnStop();
         RootView::GetInstance()->ClearOnKeyActListener();
-    } else {
-        HexagonsStyleOnStop();
     }
     View<ApplistPresenter>::OnStop();
     if (container_ != nullptr) {
@@ -179,18 +234,44 @@ void ApplistView::OnStop()
     return;
 }
 
+//足球OnStop
+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();
+}
+
+//蜂窝OnStop
 void ApplistView::HexagonsStyleOnStop()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStop");
     if (hexagonsList_ != nullptr) {
         hexagonsList_->RemoveAll();
     }
-    for (auto iter : listHexagonsView_) {
-        delete iter;
+    ListNode<HexagonsItemView*>* viewNode = listHexagonsView_.Head();
+    while (viewNode != listHexagonsView_.End()) {
+        delete(viewNode->data_);
+        viewNode = viewNode->next_;
     }
-    listHexagonsView_.clear();
+    listHexagonsView_.Clear();
 }
 
+//列表OnStop
 void ApplistView::ListStyleOnStop()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStop");
@@ -202,43 +283,72 @@ void ApplistView::ListStyleOnStop()
 
 void ApplistView::AddAppItemToList(const AppItem &item)
 {
-    if (presenter_->GetIsUseListStyle()) {
-        listAdapter_->AddListItem(item);
-    } else {
+    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_.push_back(itemView);
+        listHexagonsView_.PushBack(itemView);
+    } else {
+        listAdapter_->AddListItem(item);
     }
 }
 
 void ApplistView::ClearAppItemToList()
 {
-    if (presenter_->GetIsUseListStyle()) {
-        listAdapter_->ClearItem();
+    AppListStyle style = presenter_->GetCurrentStyle();
+    if (style == FOOTBALL_STYLE) {
+        FootballStyleOnStop();
+    } else if (style == AppListStyle::HEXAGONS_STYLE) {
+        HexagonsStyleOnStop();
     } else {
-        if (hexagonsList_ != nullptr) {
-            hexagonsList_->RemoveAll();
-        }
-        for (auto iter : listHexagonsView_) {
-            delete iter;
-        }
-        listHexagonsView_.clear();
+        listAdapter_->ClearItem();
     }
 }
 
 void ApplistView::RefreshAppList(void)
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::RefreshAppList");
-    if (presenter_->GetIsUseListStyle()) {
-        contentList_->RefreshList();
-    } else {
+    AppListStyle style = presenter_->GetCurrentStyle();
+    if (style == AppListStyle::FOOTBALL_STYLE) {
+        footballList_->RefreshIcosahedron();
+    } else if (style == AppListStyle::HEXAGONS_STYLE) {
         hexagonsList_->LayoutChildren(true);
+    } else {
+        contentList_->RefreshList();
     }
 }
 
+void FootballAnimatorCallback::Callback(UIView *view)
+{
+    if (HALTick::GetInstance().GetElapseTime(startTime_) < 300) {
+        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);
+}
 }
index 00dd7e3..9368b8b 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-14 09:40:13
- * @LastEditors: SnickerSun snickersun@163.com
- * @LastEditTime: 2024-07-02 20:02:35
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-07-06 16:43:47
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h
  */
 #ifndef SET_THEMESTYLE_MODEL_H
@@ -52,8 +52,6 @@ namespace OHOS
         static ThemeStyleModel &GetInstance(void);
         ThemeStyle GetAppListDisplayStyle(void);
         void SetAppListDisplayStyle(ThemeStyle style);
-        uint16_t GetSelectThemeStyleId(void);
-        void SetSelectThemeStyleId(uint16_t Id);
 
     private:
         ThemeStyleModel();
index 199d279..61a16e9 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-14 09:40:13
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-14 18:12:38
+ * @LastEditTime: 2024-07-06 16:41:49
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStylePresenter.h
  */
 
@@ -25,9 +25,7 @@ namespace OHOS
         ThemeStylePresenter();
         ~ThemeStylePresenter() override;
         static ThemeStylePresenter *GetInstance();
-
-        bool GetListStyleState(void);
-        bool GetHexagonsStyleState(void);
+        ThemeStyle GetSelectThemeStyleId(void);
 
         void OnStart() override;
         void OnPause() override;
index 8aa1737..2ff7838 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-14 09:40:13
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-14 18:38:50
+ * @LastEditTime: 2024-07-06 18:33:51
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleView.h
  */
 
 
 namespace OHOS
 {
-    static constexpr const uint16_t MAX_STYLE = MAX_THEME_STYLE;
+    static constexpr const uint16_t MAX_STYLE = MAX_THEME_STYLE-1;
     static constexpr char *THEME_STYLE_LIST = "themestyleList";         // 列表
     static constexpr char *THEME_STYLE_HEXAGONS = "themestyleHexagons"; // 蜂窝
+    static constexpr char *THEME_STYLE_FOOTBALL = "themestyleFootball"; // 足球
     static constexpr char *THEMESTYLEVIEWEXIT = "ThemeStyleViewExit";   // exit
 
-    static constexpr char *THEMESTYLE_LIST_IMAGEPATH = "/user/res/themestyle/list.bin";    
-    static constexpr char *THEMESTYLE_HEXAGONS_IMAGEPATH = "/user/res/themestyle/hexagons.bin"; 
+    static constexpr char *THEMESTYLE_LIST_IMAGEPATH = "/user/res/themestyle/list.bin";
+    static constexpr char *THEMESTYLE_HEXAGONS_IMAGEPATH = "/user/res/themestyle/hexagons.bin";
+    static constexpr char *THEMESTYLE_FOOTBALL_IMAGEPATH = "/user/res/themestyle/grid.bin";
 
     class ThemeStylePresenter;
     class ThemeStyleView : public View<ThemeStylePresenter>
index f4febd1..c3f2406 100644 (file)
@@ -8,7 +8,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-07 09:21:47
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-22 16:33:24
+ * @LastEditTime: 2024-07-06 16:43:52
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThemeStyleModel.cpp
  */
 
@@ -83,11 +83,4 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetAppListDisplayStyle fail!!");
         }
     }
-
-    // 获取选中的样式Id
-    uint16_t ThemeStyleModel::GetSelectThemeStyleId(void)
-    {
-        return GetAppListDisplayStyle();
-    }
-
 }
index cb2b0b7..ed2ae47 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-08 16:43:48
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-15 11:44:48
+ * @LastEditTime: 2024-07-06 18:08:24
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThemeStylePresenter.cpp
  */
 
@@ -81,6 +81,10 @@ namespace OHOS
         {
             ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::HEXAGONS_STYLE);
         }
+        else if (viewId == THEME_STYLE_FOOTBALL)
+        {
+            ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::FOOTBALL_STYLE);
+        }
 
         uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
         if (preSlice == VIEW_APPLIST)
@@ -132,16 +136,11 @@ namespace OHOS
         return true;
     }
 
-    // 获取当前主题是否是蜂窝
-    bool ThemeStylePresenter::GetHexagonsStyleState(void)
-    {
-        return (ThemeStyleModel::GetInstance().GetAppListDisplayStyle() == ThemeStyle::HEXAGONS_STYLE);
-    }
-
-    // 获取当前主题是否是列表
-    bool ThemeStylePresenter::GetListStyleState(void)
+    // 获取选中的样式Id
+    ThemeStyle ThemeStylePresenter::GetSelectThemeStyleId(void)
     {
-        return (ThemeStyleModel::GetInstance().GetAppListDisplayStyle() == ThemeStyle::APPLIST_STYLE);
+        ThemeStyle style = ThemeStyleModel::GetInstance().GetAppListDisplayStyle();
+        return style;
     }
 
 }
index caf87d2..062a071 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-14 09:40:20
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-14 18:41:37
+ * @LastEditTime: 2024-07-06 18:34:04
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStyleView.cpp
  */
 
@@ -160,6 +160,8 @@ namespace OHOS
         };
 
         int top = 120;
+        // const char *viewId[MAX_STYLE] = {THEME_STYLE_LIST, THEME_STYLE_HEXAGONS, THEME_STYLE_FOOTBALL};
+        // uint16_t textId[MAX_STYLE] = {STR_LIST_DISPLAY, STR_CELLULAR_DISPLAY, STR_GRID_DISPLAY};
         const char *viewId[MAX_STYLE] = {THEME_STYLE_LIST, THEME_STYLE_HEXAGONS};
         uint16_t textId[MAX_STYLE] = {STR_LIST_DISPLAY, STR_CELLULAR_DISPLAY};
         for (int i = 0; i < MAX_STYLE; i++)
@@ -208,6 +210,7 @@ namespace OHOS
             .src = THEMESTYLE_LIST_IMAGEPATH,
         };
         int y = 150;
+        //const char *src[MAX_STYLE] = {THEMESTYLE_LIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH, THEMESTYLE_FOOTBALL_IMAGEPATH};
         const char *src[MAX_STYLE] = {THEMESTYLE_LIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH};
         for (int i = 0; i < MAX_STYLE; i++)
         {
@@ -278,12 +281,12 @@ namespace OHOS
         ClearAll();
     }
 
-    //更新按钮的选中状态
+    // 更新按钮的选中状态
     void ThemeStyleView::UpdateSelectedStyle(void)
     {
         for (int i = 0; i < MAX_STYLE; i++)
         {
-            if (i == ThemeStyleModel::GetInstance().GetSelectThemeStyleId())
+            if (i == presenter_->GetSelectThemeStyleId())
             {
                 ThemeStyleLabelButton[i]->SetImageSrc(PNG_CHECKBOX_ON_IMAGE, PNG_CHECKBOX_ON_IMAGE);
             }