${CMAKE_CURRENT_SOURCE_DIR}/nativeui/temperature/include
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/offlinevoice/include
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/settings/include
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_desktop/include
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_card/include
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/add_card/include
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/include
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/settings/src/SettingView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/settings/src/SettingModel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/settings/src/SettingItemView.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_desktop/src/SetDesktopModel.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_desktop/src/SetDesktopPresenter.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_desktop/src/SetDesktopView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_card/src/SetCardAdapter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_card/src/SetCardItem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_card/src/SetCardModel.cpp
VIEW_THEME_STYLE, // 主题样式
VIEW_AI_VOICE, // AI Voice(人工智能语音)
VIEW_AI_MODELS, // AI模型选择界面
- VIEW_SET_DESKTOP, // 显示方式
VIEW_RECORD,
/* ----------------------------------------------------------------------------- */
VIEW_DIAL, // 切换表盘
static NativeLauncher &GetInstance(void);
void InitNativeLauncher(void);
void InitMainSlice(void);
- void InitSetDesktopSlice(void);
void InitSetCardSlice(void);
void InitAddCardSlice(void);
void InitSetDialSlice(void);
#include "AlipayMainView.h"
#include "AlipayPresenter.h"
#endif
-#include "SetDesktopView.h"
-#include "SetDesktopPresenter.h"
#include "SetCardView.h"
#include "SetCardPresenter.h"
#include "AddCardView.h"
{VIEW_BLOODOXY, &NativeLauncher::InitMainBloodSlice},
/*心率检测*/
{VIEW_HEART, &NativeLauncher::InitHeartSlice},
- /*设置主题样式*/
- {VIEW_SET_DESKTOP, &NativeLauncher::InitSetDesktopSlice},
/*设置卡片*/
{VIEW_SET_CARD, &NativeLauncher::InitSetCardSlice},
/*添加卡片*/
NativeAbility::GetInstance().AddSliceProxy(VIEW_AI_MODELS, AiModels);
}
/* -------------------------------------------------------------------------- */
- void NativeLauncher::InitSetDesktopSlice(void)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitSetDesktopSlice");
- SliceProxy *setDesktopView = new AbilitySliceProxy<SetDesktopView, SetDesktopPresenter>;
- if (setDesktopView == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "setDesktopView");
- return;
- }
- NativeAbility::GetInstance().AddSliceProxy(VIEW_SET_DESKTOP, setDesktopView);
- }
void NativeLauncher::InitSetCardSlice(void)
{
#include "UiConfig.h"
#include "ApplistModel.h"
#include "applist/include/ApplistPresenter.h"
-#include "SetDesktopModel.h"
#include "components/ui_label_ext.h"
#include "ui_resource_string.h"
#include "applist/include/ApplistModel.h"
#include "themestyle/include/ThemeStyleModel.h"
-#include "set_desktop/include/SetDesktopView.h"
namespace OHOS
{
/**- APPLSIT
+++ /dev/null
-/*
- * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-06-07 09:21:47
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 15:03:40
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h
- */
-
-#ifndef SET_DESKTOP_MODEL_H
-#define SET_DESKTOP_MODEL_H
-
-#include <cstdint>
-#include <map>
-#include "AppViewIDs.h"
-#include "UiConfig.h"
-#include "SetDesktopPresenter.h"
-
-typedef enum {
- APPLIST_STYLE, //列表显示
- HEXAGONS_STYLE, //蜂窝显示
- FOOTBALL_STYLE
-} DesktopStyle;
-
-namespace OHOS {
- class SetDesktopModel {
- public:
- static SetDesktopModel &GetInstance(void);
- DesktopStyle GetDesktopStyle(void);
- void SetDesktopStyle(DesktopStyle style);
- private:
- SetDesktopModel();
- SetDesktopModel(const SetDesktopModel &);
- SetDesktopModel &operator=(const SetDesktopModel &);
- virtual ~SetDesktopModel();
- };
-}
-
-#endif // SET_DESKTOP_MODEL_H
\ No newline at end of file
+++ /dev/null
-/*
- * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-04-08 16:43:48
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-24 16:37:10
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h
- */
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopPresenter.h
- * Author:
- * Create: 2021-11-23
- */
-
-#ifndef SET_DESKTOP_PRESENTER_H
-#define SET_DESKTOP_PRESENTER_H
-
-#include "View.h"
-#include "Presenter.h"
-#include "components/ui_view.h"
-
-namespace OHOS {
-static const char *SET_DESKTOP_LIST = "setdesktopList";
-static const char *SET_DESKTOP_HEXAGONS = "setdesktopHexagons";
-static const char *SET_DESKTOP_FOOTBALL = "setdesktopFootball";
-
-class SetDesktopView;
-class SetDesktopModel;
-class SetDesktopPresenter : public Presenter<SetDesktopView>,
- public UIView::OnClickListener,
- public RootView::OnKeyActListener,
- public UIView::OnDragListener {
-public:
- SetDesktopPresenter();
- ~SetDesktopPresenter() override;
- static SetDesktopPresenter *GetInstance();
-
- void OnStart() override;
- void OnResume() override;
- void OnStop() override;
-
- bool OnClick(UIView &view, const ClickEvent &event) override;
- bool OnDrag(UIView& view, const DragEvent& event) override;
- bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
-
- uint8_t GetCurrentStyle(void);
-private:
-
-};
-}
-
-#endif // SET_DESKTOP_PRESENTER_H
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopView.h
- * Author:
- * Create: 2021-11-23
- */
-
-#ifndef SET_DESKTOP_VIEW_H
-#define SET_DESKTOP_VIEW_H
-
-#include "View.h"
-#include "components/ui_view_group.h"
-#include "components/ui_label.h"
-#include "components/ui_image_view.h"
-#include "components/ui_toggle_button.h"
-#include "window/window.h"
-#include "BaseView.h"
-#include "ChangeSliceListener.h"
-#include "UiConfig.h"
-
-namespace OHOS {
-class SetDesktopPresenter;
-
-class SetDesktopView : public View<SetDesktopPresenter> {
-public:
- SetDesktopView();
- ~SetDesktopView() override;
-
- static SetDesktopView *GetInstance()
- {
- static SetDesktopView instance;
- return &instance;
- }
-
- void OnStart() override;
- void OnSetUpView() override;
- void OnTearDownView() override;
- void OnStop() override;
- void UpdateSelectedStyle(uint8_t selectedStyle);
- uint8_t GetCurrentSelectedStyle(void);
-
-private:
- void InitFootballItem();
- UILabel titleText;
- UIToggleButton hexagonsBtn;
- UIToggleButton listBtn;
- UIToggleButton footballBtn_;
- UIImageView hexagonsImage;
- UIImageView listImage;
- UIImageView footballImage_;
- UILabel listText;
- UILabel hexagonsText;
- UILabel footballText_;
-};
-}
-#endif // SET_DESKTOP_VIEW_H
+++ /dev/null
-/*
- * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-06-07 09:21:47
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 11:17:14
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp
- */
-
-#include "SetDesktopModel.h"
-#include "kv_store.h"
-#include "securec.h"
-
-namespace OHOS {
- static const int STYLE_VALUE_LEN = 32;
- SetDesktopModel::SetDesktopModel() {}
-
- SetDesktopModel::~SetDesktopModel() {}
-
- SetDesktopModel &SetDesktopModel::GetInstance()
- {
- static SetDesktopModel instance;
- return instance;
- }
-
- //获取applist的显示样式
- DesktopStyle SetDesktopModel::GetDesktopStyle(void)
- {
- DesktopStyle style;
- char temp[STYLE_VALUE_LEN] = { 0 };
- (void)UtilsGetValue("applist_style", temp, STYLE_VALUE_LEN);
- if (strcmp(temp, "hexagons") == 0) {
- style = HEXAGONS_STYLE;
- } else if (strcmp(temp, "football") == 0) {
- style = FOOTBALL_STYLE;
- } else {
- style = APPLIST_STYLE;
- }
- return style;
- }
-
- void SetDesktopModel::SetDesktopStyle(DesktopStyle style)
- {
- if (style == APPLIST_STYLE) {
- (void)UtilsSetValue("applist_style", "list");
- } else if (style == HEXAGONS_STYLE) {
- (void)UtilsSetValue("applist_style", "hexagons");
- } else if (style == FOOTBALL_STYLE) {
- (void)UtilsSetValue("applist_style", "football");
- }
- }
-
-}
+++ /dev/null
-/*
- * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-04-08 16:43:48
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 11:05:24
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp
- */
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SettingPresenter.cpp
- * Author:
- * Create: 2021-11-23
- */
-
-#include "SetDesktopView.h"
-#include "SetDesktopModel.h"
-#include "SetDesktopPresenter.h"
-#include "common/key_code.h"
-#include <custom_utils.h>
-
-namespace OHOS {
-
- static SetDesktopPresenter *g_pSetDesktopPresenter = nullptr;
-
- SetDesktopPresenter::SetDesktopPresenter()
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::SetDesktopPresenter");
- g_pSetDesktopPresenter=this;
- }
-
- SetDesktopPresenter::~SetDesktopPresenter() {
- g_pSetDesktopPresenter = nullptr;
- }
-
- SetDesktopPresenter *SetDesktopPresenter::GetInstance()
- {
- return g_pSetDesktopPresenter;
- }
-
- void SetDesktopPresenter::OnStart()
- {
- Presenter<SetDesktopView>::OnStart();
- }
-
- void SetDesktopPresenter::OnResume(void)
- {
- }
-
- void SetDesktopPresenter::OnStop(void)
- {
- }
-
- bool SetDesktopPresenter::OnDrag(UIView& view, const DragEvent& event)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::OnDrag");
- UNUSED(view);
- 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, "SettingPresenter::OnDrag ChangeSlice");
- // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- // NativeAbility::GetInstance().ChangeSlice(preSlice);
- NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
- }
- return false;
- }
-
- bool SetDesktopPresenter::OnClick(UIView &view, const ClickEvent &event)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::OnClick");
- if (strcmp(view.GetViewId(), SET_DESKTOP_HEXAGONS) == 0) {
- SetDesktopModel::GetInstance().SetDesktopStyle(HEXAGONS_STYLE);
- } else if (strcmp(view.GetViewId(), SET_DESKTOP_LIST) == 0) {
- SetDesktopModel::GetInstance().SetDesktopStyle(APPLIST_STYLE);
- } else if (strcmp(view.GetViewId(), SET_DESKTOP_FOOTBALL) == 0) {
- SetDesktopModel::GetInstance().SetDesktopStyle(FOOTBALL_STYLE);
- }
- //uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- //NativeAbility::GetInstance().ChangeSlice(preSlice);
- NativeAbility::GetInstance().Back();
- return true;
- }
- uint8_t SetDesktopPresenter::GetCurrentStyle(void)
- {
- DesktopStyle style = SetDesktopModel::GetInstance().GetDesktopStyle();
- if (style == HEXAGONS_STYLE) {
- return 1; // 1: hexagons style enum index
- } else if (style == FOOTBALL_STYLE) {
- return 2; // 2: football style enum index
- }
- return 0;
- }
-
-
- bool SetDesktopPresenter::OnKeyAct(UIView &view, const KeyEvent &event)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::OnKeyAct");
- uint16 keyID = event.GetKeyId();
- uint16 keyState = event.GetState();
- // 如果是power键就返回上一级
- if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
- {
- NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
- }
- return true;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopView.cpp
- * Author:
- * Create: 2021-11-23
- */
-
-#include <string>
-#include "SetDesktopView.h"
-#include "SetDesktopPresenter.h"
-
-namespace OHOS {
-SetDesktopView::SetDesktopView()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::SetDesktopView");
-}
-
-SetDesktopView::~SetDesktopView()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::~SetDesktopView");
-}
-
-void SetDesktopView::OnStart()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::OnStart");
- View<SetDesktopPresenter>::OnStart();
- SetContainerView(new UIViewGroup());
- container_->SetDraggable(true);
- container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
- container_->SetOnDragListener(presenter_);
- container_->SetTouchable(true);
-
- // 增加按键监听
- RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SetDesktopPresenter::GetInstance();
- RootView::GetInstance()->SetOnKeyActListener(keyactListener);
-}
-
-void SetDesktopView::OnSetUpView()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::OnSetUpView");
- View<SetDesktopPresenter>::OnSetUpView();
-
- titleText.SetPosition(180, 45, 260, 110);
- titleText.SetText("桌面");
- titleText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- titleText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
- titleText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- container_->Add(&titleText);
-
- listImage.SetPosition(0, 135, 190, 190);
- listImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE);
- container_->Add(&listImage);
-
- listBtn.SetPosition(22, 157, 148, 148);
- listBtn.SetImages(PNG_SET_DESKTOP_LIST_IMAGE, PNG_SET_DESKTOP_LIST_IMAGE);
- listBtn.SetViewId(SET_DESKTOP_LIST);
- container_->Add(&listBtn);
-
- listText.SetPosition(61, 328, 200, 60);
- listText.SetText("列表");
- listText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- listText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- listText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- container_->Add(&listText);
-
- hexagonsImage.SetPosition(150, 135, 190, 190);
- hexagonsImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE);
- container_->Add(&hexagonsImage);
-
- hexagonsBtn.SetPosition(172, 157, 148, 148);
- hexagonsBtn.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE);
- hexagonsBtn.SetViewId(SET_DESKTOP_HEXAGONS);
- container_->Add(&hexagonsBtn);
-
- hexagonsText.SetPosition(218, 328, 200, 60);
- hexagonsText.SetText("蜂窝");
- hexagonsText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- hexagonsText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- hexagonsText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- container_->Add(&hexagonsText);
-
- InitFootballItem();
- listBtn.SetOnClickListener(presenter_);
- hexagonsBtn.SetOnClickListener(presenter_);
- footballBtn_.SetOnClickListener(presenter_);
- UpdateSelectedStyle(presenter_->GetCurrentStyle());
-}
-
-void SetDesktopView::OnTearDownView()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::OnTearDownView");
- View<SetDesktopPresenter>::OnTearDownView();
-}
-
-void SetDesktopView::OnStop()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::OnStop");
- View<SetDesktopPresenter>::OnStop();
- if (container_ != nullptr) {
- container_->RemoveAll();
- delete container_;
- container_ = nullptr;
- }
-}
-
-void SetDesktopView::UpdateSelectedStyle(uint8_t selectedStyle)
-{
- hexagonsImage.SetVisible(false);
- hexagonsBtn.SetState(false);
- listImage.SetVisible(false);
- listBtn.SetState(false);
- footballImage_.SetVisible(false);
- footballBtn_.SetState(false);
-
- if (selectedStyle == 1) { // 1: select hexagons style
- hexagonsImage.SetVisible(true);
- hexagonsBtn.SetState(true);
- } else if (selectedStyle == 2) { // 2: select football style
- footballImage_.SetVisible(true);
- footballBtn_.SetState(true);
- } else {
- listImage.SetVisible(true);
- listBtn.SetState(true);
- }
-}
-
-void SetDesktopView::InitFootballItem()
-{
- footballImage_.SetPosition(300, 135, 190, 190);
- footballImage_.SetSrc(PNG_SET_DESKTOP_BG_IMAGE);
- container_->Add(&footballImage_);
-
- footballBtn_.SetPosition(322, 157, 148, 148);
- footballBtn_.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE);
- footballBtn_.SetViewId(SET_DESKTOP_FOOTBALL);
- container_->Add(&footballBtn_);
-
- footballText_.SetPosition(368, 328, 200, 60);
- footballText_.SetText("足球");
- footballText_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- footballText_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- footballText_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- container_->Add(&footballText_);
-}
-
-uint8_t SetDesktopView::GetCurrentSelectedStyle()
-{
- return presenter_->GetCurrentStyle();
-}
-}