* @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"
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;
}
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)
.fontSize = 30,
.lineHeigh = 35,
.textId = STR_START_CHAT,
- .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+ .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
};
startChatLabel = AiVoiceViewLabelInit(labelConfig);
if (startChatLabel == nullptr)
/*
* @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
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
-/*
- * @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
#define AppListStyle ThemeStyle
-// typedef enum : uint16_t
-// {
-// APPLIST_STYLE, // 列表显示
-// HEXAGONS_STYLE, // 蜂窝显示
-// FOOTBALL_STYLE, //足球
-// MAX_THEME_STYLE,
-// } AppListStyle;
class ApplistPresenter;
class ApplistModel {
public:
int GetHeadItemY(void);
uint8_t GetListItemNum(void);
ApplistView* GetAppListView();
- bool GetIsUseListStyle(void);
+ AppListStyle GetCurrentStyle(void);
private:
AppItemView *itemViewSele{nullptr};
#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"
#include "ChangeSliceListener.h"
#include "drag_event.h"
#include "UiConfig.h"
-
+#include "components/ui_label_ext.h"
namespace OHOS {
class AppListOnDragListener : public UIView::OnDragListener {
public:
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:
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
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()
{
return itemInfo_.uid;
}
+
+ void FootballItemView::SetItemInfo(const AppItem &itemInfo)
+ {
+ itemInfo_ = itemInfo;
+ }
+
+ AppViewId FootballItemView::GetViewId()
+ {
+ return itemInfo_.id;
+ }
+
+ const char *FootballItemView::GetAppUid()
+ {
+ return itemInfo_.uid;
+ }
}
#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
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();
}
}
#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()
{
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) {
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);
return model->GetAppListNum();
}
- bool ApplistPresenter::GetIsUseListStyle(void)
+ AppListStyle ApplistPresenter::GetCurrentStyle(void)
{
- return model->GetCurrentStyle() == APPLIST_STYLE;
+ return model->GetCurrentStyle();
}
ApplistView* ApplistPresenter::GetAppListView()
#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;
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_);
SetContainerView(hexagonsList_);
}
+//列表OnStart
void ApplistView::ListStyleOnStart()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart");
{
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");
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) {
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");
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);
+}
}
/*
* @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
static ThemeStyleModel &GetInstance(void);
ThemeStyle GetAppListDisplayStyle(void);
void SetAppListDisplayStyle(ThemeStyle style);
- uint16_t GetSelectThemeStyleId(void);
- void SetSelectThemeStyleId(uint16_t Id);
private:
ThemeStyleModel();
* @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
*/
ThemeStylePresenter();
~ThemeStylePresenter() override;
static ThemeStylePresenter *GetInstance();
-
- bool GetListStyleState(void);
- bool GetHexagonsStyleState(void);
+ ThemeStyle GetSelectThemeStyleId(void);
void OnStart() override;
void OnPause() override;
* @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>
* @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
*/
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetAppListDisplayStyle fail!!");
}
}
-
- // 获取选中的样式Id
- uint16_t ThemeStyleModel::GetSelectThemeStyleId(void)
- {
- return GetAppListDisplayStyle();
- }
-
}
* @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
*/
{
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)
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;
}
}
* @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
*/
};
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++)
.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++)
{
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);
}