From: luozheng <1732036298@qq.com> Date: Sat, 25 Apr 2026 03:43:26 +0000 (+0800) Subject: applist1201patch球面显示添加 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=77ebb92e61c9961194b47f2ecaf1165682c51de1;p=mirrors%2FFD230.git applist1201patch球面显示添加 --- diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/SphereDesktopFragment.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/SphereDesktopFragment.h index cf9c51073..28c34e977 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/SphereDesktopFragment.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/include/SphereDesktopFragment.h @@ -1,93 +1,93 @@ -// /* -// * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved. -// * Description: SphereDesktopFragment -// * Author: Hisi Graphic Team -// * Created: 2025-09 -// */ + /* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved. + * Description: SphereDesktopFragment + * Author: Hisi Graphic Team + * Created: 2025-09 + */ -// #ifndef SPHERE_DESKTOP_FRAGMENT_H -// #define SPHERE_DESKTOP_FRAGMENT_H +#ifndef SPHERE_DESKTOP_FRAGMENT_H +#define SPHERE_DESKTOP_FRAGMENT_H -// #include "UIDesktopFragment.h" -// #include "components/ui_sphere_view.h" -// #include "components/ui_transform_group.h" +#include "UIDesktopFragment.h" +#include "components/ui_sphere_view.h" +#include "components/ui_transform_group.h" -// namespace OHOS { -// class SphereAnimatorCallback; -// class SphereItemView; -// class SphereDesktopFragment : public UIDesktopFragment { -// public: -// bool OnClick(UIView &view, const ClickEvent &event) override; -// bool OnRotate(UIView& view, const RotateEvent& event) override; -// void AddAppItemToList(const AppItem &item) override; -// void ClearAppItemToList() override; -// void RefreshAppList() override; +namespace OHOS { +class SphereAnimatorCallback; +class SphereItemView; +class SphereDesktopFragment : public UIDesktopFragment { +public: + bool OnClick(UIView &view, const ClickEvent &event) override; + bool OnRotate(UIView& view, const RotateEvent& event) override; + void AddAppItemToList(const AppItem &item) override; + void ClearAppItemToList() override; + void RefreshAppList() override; -// protected: -// void OnCreateView(void* data) override; -// void OnDestroyView() override; -// void OnResumeView() override; +protected: + void OnCreateView(void* data) override; + void OnDestroyView() override; + void OnResumeView() override; -// private: -// UISphereView* sphereView_{nullptr}; -// List listSphereView_; -// SphereAnimatorCallback* callback_ = nullptr; -// Animator* enterAnimator_ = nullptr; -// }; +private: + UISphereView* sphereView_{nullptr}; + List listSphereView_; + SphereAnimatorCallback* callback_ = nullptr; + Animator* enterAnimator_ = nullptr; +}; -// class SphereAnimatorCallback : public AnimatorCallback { -// public: -// explicit SphereAnimatorCallback(UIView* view, int16_t width, int16_t height) -// : width_(width), -// height_(height), -// startTime_(0), -// passTime_(0), -// angle_(0), -// animator_(new Animator(this, view, 600, false)) {} // 600 ms:duration of animator_ +class SphereAnimatorCallback : public AnimatorCallback { +public: + explicit SphereAnimatorCallback(UIView* view, int16_t width, int16_t height) + : width_(width), + height_(height), + startTime_(0), + passTime_(0), + angle_(0), + animator_(new Animator(this, view, 600, false)) {} // 600 ms:duration of animator_ -// ~SphereAnimatorCallback() override -// { -// if (animator_ != nullptr) { -// delete animator_; -// animator_ = nullptr; -// } -// } + ~SphereAnimatorCallback() override + { + if (animator_ != nullptr) { + delete animator_; + animator_ = nullptr; + } + } -// void Callback(UIView* view) override; + void Callback(UIView* view) override; -// Animator* GetAnimator() const -// { -// return animator_; -// } + Animator* GetAnimator() const + { + return animator_; + } -// void SetStartTime(uint32_t time) -// { -// isStartAnim_ = false; -// startTime_ = time; -// } -// protected: -// int16_t width_; -// int16_t height_; -// uint32_t startTime_; -// uint32_t passTime_; -// bool isStartAnim_ = false; -// int16_t angle_; -// Animator* animator_; -// }; + void SetStartTime(uint32_t time) + { + isStartAnim_ = false; + startTime_ = time; + } +protected: + int16_t width_; + int16_t height_; + uint32_t startTime_; + uint32_t passTime_; + bool isStartAnim_ = false; + int16_t angle_; + Animator* animator_; +}; -// class SphereItemView : public UITransformGroup { -// public: -// explicit SphereItemView() {}; -// ~SphereItemView(); -// bool SetItemInfo(const AppItem &itemInfo); -// AppViewId GetViewId(); -// const char *GetAppUid(); -// private: -// SphereItemView(const SphereItemView &); -// SphereItemView &operator = (const SphereItemView &); -// UIImageView* imageView_{nullptr}; -// AppItem itemInfo_; -// }; -// } +class SphereItemView : public UITransformGroup { +public: + explicit SphereItemView() {}; + ~SphereItemView(); + bool SetItemInfo(const AppItem &itemInfo); + AppViewId GetViewId(); + const char *GetAppUid(); +private: + SphereItemView(const SphereItemView &); + SphereItemView &operator = (const SphereItemView &); + UIImageView* imageView_{nullptr}; + AppItem itemInfo_; +}; +} -// #endif // SPHERE_DESKTOP_FRAGMENT_H +#endif // SPHERE_DESKTOP_FRAGMENT_H diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/SphereDesktopFragment.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/SphereDesktopFragment.cpp index 78426cd30..31d220b2e 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/SphereDesktopFragment.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/applist/src/SphereDesktopFragment.cpp @@ -1,192 +1,192 @@ -// /* -// * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved. -// * Description: SphereDesktopFragment -// * Author: Hisi Graphic Team -// * Created: 2025-09 -// */ - -// #include -// #include "applist/include/SphereDesktopFragment.h" -// #include "applist/include/DesktopFactory.h" -// #include "common/image_cache_manager.h" -// #include "NativeAbility.h" -// #include "hal_tick.h" - -// namespace OHOS { -// REGIST_DESKTOP_STYLE(SPHERE_STYLE, SphereDesktopFragment); - -// void SphereDesktopFragment::OnCreateView(void* data) -// { -// WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnCreateView "); -// if (sphereView_ == nullptr) { -// sphereView_ = new UISphereView(1); -// } -// sphereView_->SetThrowDrag(true); - -// if (callback_ == nullptr) { -// callback_ = new SphereAnimatorCallback(sphereView_, fragmentView_.GetWidth(), fragmentView_.GetHeight()); -// } - -// sphereView_->SetPosition(0, 0, fragmentView_.GetWidth(), fragmentView_.GetHeight()); -// enterAnimator_ = callback_->GetAnimator(); -// sphereView_->SetVisible(false); -// fragmentView_.Add(sphereView_); -// if (callback_ != nullptr) { -// callback_->SetStartTime(HALTick::GetInstance().GetTime()); -// } -// } - -// void SphereDesktopFragment::OnDestroyView() -// { -// WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnDestroyView"); -// ClearAppItemToList(); -// if (sphereView_ != nullptr) { -// delete sphereView_; -// sphereView_ = nullptr; -// } -// if (callback_ != nullptr) { -// delete callback_; -// callback_ = nullptr; -// } -// enterAnimator_ = nullptr; -// } - -// void SphereDesktopFragment::OnResumeView() -// { -// WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnResumeView"); -// if (enterAnimator_ != nullptr) { -// enterAnimator_->Start(); -// } -// } - -// bool SphereDesktopFragment::OnRotate(UIView& view, const RotateEvent& event) -// { -// UISphereView *sphereView = dynamic_cast(&view); -// if (sphereView == nullptr) { -// return false; -// } -// sphereView->UpdateItemAngle(event.GetRotate()); -// return true; -// } - -// bool SphereDesktopFragment::OnClick(UIView &view, const ClickEvent &event) -// { -// UNUSED(event); -// SphereItemView *itemView = dynamic_cast(&view); -// UISphereView *sphereView = dynamic_cast(itemView->GetParent()); -// if (sphereView == nullptr || itemView == nullptr) { -// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sphereView or itemView is nullptr"); -// return false; -// } -// AppViewId viewId = itemView->GetViewId(); -// char *uid = (char *)itemView->GetAppUid(); -// sphereView->SetDraggable(false); - -// WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnClick viewid = %d", viewId); -// return SwitchView(viewId, uid, TransitionType::TRANSITION_FADEINOUT, SPHERE_STYLE); -// } - -// void SphereDesktopFragment::AddAppItemToList(const AppItem &item) -// { -// WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::AddAppItemToList"); -// SphereItemView *itemView = new SphereItemView(); -// if (!itemView->SetItemInfo(item)) { -// delete itemView; -// return; -// } -// itemView->SetTouchable(true); -// itemView->SetOnClickListener(this); -// sphereView_->Add(itemView); -// listSphereView_.PushBack(itemView); -// sphereView_->SetNumberOfRow((listSphereView_.Size() + 2) / 3); // 控制在3排显示 -// } - -// void SphereDesktopFragment::ClearAppItemToList() -// { -// WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::ClearAppItemToList"); -// if (enterAnimator_ != nullptr) { -// enterAnimator_->Stop(); -// } -// if (sphereView_ != nullptr) { -// sphereView_->RemoveAll(); -// } -// ListNode* viewNode = listSphereView_.Head(); -// while (viewNode != listSphereView_.End()) { -// delete(viewNode->data_); -// viewNode = viewNode->next_; -// } -// listSphereView_.Clear(); -// } - -// void SphereDesktopFragment::RefreshAppList(void) -// { -// WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::RefreshAppList"); -// sphereView_->LayoutChildren(true); -// } - -// void SphereAnimatorCallback::Callback(UIView *view) -// { -// if (HALTick::GetInstance().GetElapseTime(startTime_) < 300) { // 300: 动画延迟显示时间,观感效果更好 -// angle_=0; -// return; -// } -// if (!view->IsVisible()) { -// view->SetVisible(true); -// } -// if (!isStartAnim_) { -// animator_->Stop(); -// animator_->Start(); -// isStartAnim_ = true; -// } -// UISphereView* sphereView = dynamic_cast(view); -// const int16_t precision = 1000;// 1000: 精度 -// int16_t el = EasingEquation::QuadEaseOut(0, precision, animator_->GetRunTime(), animator_->GetTime()); -// int roateAngle = el * 360 / precision; // 360 : 一共旋转360度 -// sphereView->UpdateItemAngle(roateAngle - angle_); -// angle_ = roateAngle; -// } - -// SphereItemView::~SphereItemView() -// { -// if (imageView_ != nullptr) { -// delete imageView_; -// imageView_ = nullptr; -// } -// if (itemInfo_.iconSmall == nullptr && itemInfo_.resPath != nullptr) { -// ImageCacheManager::GetInstance().UnloadOneInMultiRes(itemInfo_.resId, itemInfo_.resPath); -// } -// } - -// bool SphereItemView::SetItemInfo(const AppItem &itemInfo) -// { -// if (imageView_ == nullptr) { -// imageView_ = new UIImageView(); -// } -// itemInfo_ = itemInfo; -// if (itemInfo.iconSmall == nullptr && itemInfo.resPath != nullptr) { -// ImageInfo* image = ImageCacheManager::GetInstance().LoadOneInMultiRes(itemInfo.resId, itemInfo.resPath); -// if (image == nullptr) { -// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Load App Icon path %s Image %x fail", -// itemInfo.resId, itemInfo.resPath); -// return false; -// } -// imageView_->SetSrc(image); -// } else { -// imageView_->SetSrc(itemInfo.iconSmall); -// } -// Add(imageView_); -// SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); -// Resize(imageView_->GetWidth(), imageView_->GetHeight()); -// return true; -// } - -// AppViewId SphereItemView::GetViewId() -// { -// return static_cast(itemInfo_.id); -// } - -// const char *SphereItemView::GetAppUid() -// { -// return itemInfo_.uid; -// } -// } + /* + * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025. All rights reserved. + * Description: SphereDesktopFragment + * Author: Hisi Graphic Team + * Created: 2025-09 + */ + +#include +#include "applist/include/SphereDesktopFragment.h" +#include "applist/include/DesktopFactory.h" +#include "common/image_cache_manager.h" +#include "NativeAbility.h" +#include "hal_tick.h" + +namespace OHOS { +REGIST_DESKTOP_STYLE(SPHERE_STYLE, SphereDesktopFragment); + +void SphereDesktopFragment::OnCreateView(void* data) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnCreateView "); + if (sphereView_ == nullptr) { + sphereView_ = new UISphereView(1); + } + sphereView_->SetThrowDrag(true); + + if (callback_ == nullptr) { + callback_ = new SphereAnimatorCallback(sphereView_, fragmentView_.GetWidth(), fragmentView_.GetHeight()); + } + + sphereView_->SetPosition(0, 0, fragmentView_.GetWidth(), fragmentView_.GetHeight()); + enterAnimator_ = callback_->GetAnimator(); + sphereView_->SetVisible(false); + fragmentView_.Add(sphereView_); + if (callback_ != nullptr) { + callback_->SetStartTime(HALTick::GetInstance().GetTime()); + } +} + +void SphereDesktopFragment::OnDestroyView() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnDestroyView"); + ClearAppItemToList(); + if (sphereView_ != nullptr) { + delete sphereView_; + sphereView_ = nullptr; + } + if (callback_ != nullptr) { + delete callback_; + callback_ = nullptr; + } + enterAnimator_ = nullptr; +} + +void SphereDesktopFragment::OnResumeView() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnResumeView"); + if (enterAnimator_ != nullptr) { + enterAnimator_->Start(); + } +} + +bool SphereDesktopFragment::OnRotate(UIView& view, const RotateEvent& event) +{ + UISphereView *sphereView = dynamic_cast(&view); + if (sphereView == nullptr) { + return false; + } + sphereView->UpdateItemAngle(event.GetRotate()); + return true; +} + +bool SphereDesktopFragment::OnClick(UIView &view, const ClickEvent &event) +{ + UNUSED(event); + SphereItemView *itemView = dynamic_cast(&view); + UISphereView *sphereView = dynamic_cast(itemView->GetParent()); + if (sphereView == nullptr || itemView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sphereView or itemView is nullptr"); + return false; + } + AppViewId viewId = itemView->GetViewId(); + char *uid = (char *)itemView->GetAppUid(); + sphereView->SetDraggable(false); + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::OnClick viewid = %d", viewId); + return SwitchView(viewId, uid, TransitionType::TRANSITION_FADEINOUT, SPHERE_STYLE); +} + +void SphereDesktopFragment::AddAppItemToList(const AppItem &item) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::AddAppItemToList"); + SphereItemView *itemView = new SphereItemView(); + if (!itemView->SetItemInfo(item)) { + delete itemView; + return; + } + itemView->SetTouchable(true); + itemView->SetOnClickListener(this); + sphereView_->Add(itemView); + listSphereView_.PushBack(itemView); + sphereView_->SetNumberOfRow((listSphereView_.Size() + 2) / 3); // 控制在3排显示 +} + +void SphereDesktopFragment::ClearAppItemToList() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::ClearAppItemToList"); + if (enterAnimator_ != nullptr) { + enterAnimator_->Stop(); + } + if (sphereView_ != nullptr) { + sphereView_->RemoveAll(); + } + ListNode* viewNode = listSphereView_.Head(); + while (viewNode != listSphereView_.End()) { + delete(viewNode->data_); + viewNode = viewNode->next_; + } + listSphereView_.Clear(); +} + +void SphereDesktopFragment::RefreshAppList(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SphereDesktopFragment::RefreshAppList"); + sphereView_->LayoutChildren(true); +} + +void SphereAnimatorCallback::Callback(UIView *view) +{ + if (HALTick::GetInstance().GetElapseTime(startTime_) < 300) { // 300: 动画延迟显示时间,观感效果更好 + angle_=0; + return; + } + if (!view->IsVisible()) { + view->SetVisible(true); + } + if (!isStartAnim_) { + animator_->Stop(); + animator_->Start(); + isStartAnim_ = true; + } + UISphereView* sphereView = dynamic_cast(view); + const int16_t precision = 1000;// 1000: 精度 + int16_t el = EasingEquation::QuadEaseOut(0, precision, animator_->GetRunTime(), animator_->GetTime()); + int roateAngle = el * 360 / precision; // 360 : 一共旋转360度 + sphereView->UpdateItemAngle(roateAngle - angle_); + angle_ = roateAngle; +} + +SphereItemView::~SphereItemView() +{ + if (imageView_ != nullptr) { + delete imageView_; + imageView_ = nullptr; + } + if (itemInfo_.iconSmall == nullptr && itemInfo_.resPath != nullptr) { + ImageCacheManager::GetInstance().UnloadOneInMultiRes(itemInfo_.resId, itemInfo_.resPath); + } +} + +bool SphereItemView::SetItemInfo(const AppItem &itemInfo) +{ + if (imageView_ == nullptr) { + imageView_ = new UIImageView(); + } + itemInfo_ = itemInfo; + if (itemInfo.iconSmall == nullptr && itemInfo.resPath != nullptr) { + ImageInfo* image = ImageCacheManager::GetInstance().LoadOneInMultiRes(itemInfo.resId, itemInfo.resPath); + if (image == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Load App Icon path %s Image %x fail", + itemInfo.resId, itemInfo.resPath); + return false; + } + imageView_->SetSrc(image); + } else { + imageView_->SetSrc(itemInfo.iconSmall); + } + Add(imageView_); + SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); + Resize(imageView_->GetWidth(), imageView_->GetHeight()); + return true; +} + +AppViewId SphereItemView::GetViewId() +{ + return static_cast(itemInfo_.id); +} + +const char *SphereItemView::GetAppUid() +{ + return itemInfo_.uid; +} +} diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/include/ThemeStyleModel.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/include/ThemeStyleModel.h index c3ace9480..c1929cb9e 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/include/ThemeStyleModel.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/include/ThemeStyleModel.h @@ -23,6 +23,7 @@ namespace OHOS static constexpr const char *THEMESTYLE_VALUE_ARC_SCALE_LIST = "arc_scale_list"; static constexpr const char *THEMESTYLE_VALUE_CIRCLE_LIST = "circle_list"; static constexpr const char *THEMESTYLE_VALUE_PLANET = "planet"; + static constexpr const char *THEMESTYLE_VALUE_SPHERE = "sphere"; typedef enum : uint16_t { @@ -33,6 +34,7 @@ namespace OHOS APPLIST_STYLE, // 列表显示 FOOTBALL_STYLE, //足球 PLANET_STYLE, //行星 + SPHERE_STYLE, // 球面显示 MAX_THEME_STYLE, } ThemeStyle; diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/src/ThemeStyleCatalog.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/src/ThemeStyleCatalog.cpp index 0bef192bd..91e2c993c 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/src/ThemeStyleCatalog.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/themestyle/src/ThemeStyleCatalog.cpp @@ -11,18 +11,21 @@ static constexpr const char *VIEW_ID_LIST = "themestyleList"; static constexpr const char *VIEW_ID_HEXAGONS = "themestyleHexagons"; static constexpr const char *VIEW_ID_ARC_LIST = "themestyleArcList"; static constexpr const char *VIEW_ID_PLANET = "themestylePlanet"; +static constexpr const char *VIEW_ID_SPHERE = "themestyleSphere"; static constexpr const char *IMG_LIST = "/user/res/themestyle/list.bin"; static constexpr const char *IMG_HEXAGONS = "/user/res/themestyle/hexagons.bin"; static constexpr const char *IMG_ARCLIST = "/user/res/themestyle/arclist.bin"; static constexpr const char *IMG_DIALPLATE = "/user/res/themestyle/dialplate.bin"; +static constexpr const char *IMG_SPHERE = "/user/res/themestyle/sphere.bin"; /** Ordered rows on the “显示方式” settings page (label + checkbox + preview). */ static const ThemeStyleSettingsRow kThemeStyleSettingsRows[] = { {ThemeStyle::APPLIST_STYLE, THEMESTYLE_VALUE_LIST, VIEW_ID_LIST, STR_LIST_DISPLAY, IMG_LIST, 0}, {ThemeStyle::ARC_SCALE_LIST_STYLE, THEMESTYLE_VALUE_ARC_SCALE_LIST, VIEW_ID_ARC_LIST, STR_ARC_SCALE_LIST_DISPLAY,IMG_ARCLIST, 1}, {ThemeStyle::HEXAGONS_STYLE, THEMESTYLE_VALUE_HEXAGONS, VIEW_ID_HEXAGONS, STR_CELLULAR_DISPLAY, IMG_HEXAGONS, 2}, - {ThemeStyle::PLANET_STYLE, THEMESTYLE_VALUE_PLANET, VIEW_ID_PLANET, STR_GRID_DISPLAY, IMG_DIALPLATE, 3}, + {ThemeStyle::PLANET_STYLE, THEMESTYLE_VALUE_PLANET, VIEW_ID_PLANET, STR_GRID_DISPLAY, IMG_DIALPLATE, ThemeStyleSettingsRow::kNotInDropdownCycle}, + {ThemeStyle::SPHERE_STYLE, THEMESTYLE_VALUE_SPHERE, VIEW_ID_SPHERE, STR_GRID_DISPLAY, IMG_SPHERE, ThemeStyleSettingsRow::kNotInDropdownCycle}, }; struct ThemeStylePersistPair @@ -40,6 +43,7 @@ static const ThemeStylePersistPair kThemeStylePersistPairs[] = { {ThemeStyle::ARC_SCALE_LIST_STYLE, THEMESTYLE_VALUE_ARC_SCALE_LIST}, {ThemeStyle::CIRCLE_LIST_STYLE, THEMESTYLE_VALUE_CIRCLE_LIST}, {ThemeStyle::PLANET_STYLE, THEMESTYLE_VALUE_PLANET}, + {ThemeStyle::SPHERE_STYLE, THEMESTYLE_VALUE_SPHERE}, }; // 归一化 ThemeStyle 值,确保在下拉列表中显示一致 @@ -48,7 +52,10 @@ static ThemeStyle NormalizeStyleForDropdown(ThemeStyle s) if (s == ThemeStyle::CIRCLE_LIST_STYLE || s == ThemeStyle::WATERFALL_STYLE) { return ThemeStyle::APPLIST_STYLE; } - if (s == ThemeStyle::FOOTBALL_STYLE) { + else if (s == ThemeStyle::FOOTBALL_STYLE || s == ThemeStyle::SPHERE_STYLE) { + return ThemeStyle::APPLIST_STYLE; + } + else if (s == ThemeStyle::PLANET_STYLE) { return ThemeStyle::APPLIST_STYLE; } return s; @@ -151,9 +158,6 @@ ThemeStyle GetThemeStyleDropdownNextStyle(ThemeStyle current) return ThemeStyle::HEXAGONS_STYLE; } if (norm == ThemeStyle::HEXAGONS_STYLE) { - return ThemeStyle::PLANET_STYLE; - } - if (norm == ThemeStyle::PLANET_STYLE) { return ThemeStyle::APPLIST_STYLE; } return ThemeStyle::APPLIST_STYLE;