mcu_hi3321_watch/tjd/ui/app/main/TjdUiAppMainView.h
2025-05-31 10:45:15 +08:00

136 lines
4.3 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description:
*
* Author: huangshuyi
*
* Create: 2024-4
*--------------------------------------------------------------------------*/
#ifndef TJD_MAIN_CLOCK_VIEW_H
#define TJD_MAIN_CLOCK_VIEW_H
#include "TjdUiApp3dEffect.h"
#include "TjdUiAppCenterZoomEffect.h"
#include "TjdUiAppCurtainEffect.h"
#include "TjdUiAppCurtainFadeInEffect.h"
#include "TjdUiAppCurtainFadeInFadeOutEffect.h"
#include "TjdUiAppCurtainGaosiEffect.h"
#include "TjdUiAppMainPresenter.h"
#include "TjdUiWatchFaceCommonView.h"
#include "View.h"
#include "components/root_view.h"
#include "components/tjd_ui_float_window_blend.h"
#include "components/ui_card_page.h"
#include "components/ui_cross_view.h"
#include "components/ui_swipe_view.h"
#include "swipe_effect/card_flip_effect.h"
#include "swipe_effect/turn_page_effect.h"
#include "swipe_effect/zoom_effect.h"
#include <list>
namespace TJD {
class TjdUiAppMainPresenter;
class TjdUiAppMainView : public OHOS::View<TjdUiAppMainPresenter>
{
public:
class CustomCrossView : public OHOS::UICrossView
{
public:
void OnMoveChild(OHOS::UISwipeView &view, int16_t xOffset, int16_t yOffset) override;
void ResetBackgroundOpa(void);
bool OnDragStartEvent(const OHOS::DragEvent &event) override;
bool OnDragEvent(const OHOS::DragEvent &event) override;
bool OnDragEndEvent(const OHOS::DragEvent &event) override;
private:
int16_t curVerId{0};
};
static void SetMessageRead(uint8_t flag)
{
messageReaded = flag; // 1:未读 0:已读
}
static uint8_t GetMessageRead(void) { return messageReaded; }
void ResetView(void);
TjdUiAppMainView();
virtual ~TjdUiAppMainView();
static TjdUiAppMainView *GetInstance(void);
void OnStart() override;
void OnStop() override;
OHOS::UICardPage *InitFavoritePage(void);
OHOS::UICardPage *InitWatchFacePage(void);
OHOS::UICardPage *InitHealthPage(void);
OHOS::UICardPage *InitToolPage(void);
OHOS::UICardPage *InitWeatherPage(void);
OHOS::UICardPage *InitMusicPage(void);
OHOS::UICardPage *InitMakeFriendPage(void);
OHOS::UICardPage *InitMapPage(void);
OHOS::UICardPage *InitFourLeafCloverPage(void);
TjdCardId GetHorCurrentCard() const;
TjdVerCardId GetVerCurrentCard() const;
CustomCrossView *GetMainViewGroup(void) const { return mainSwipeGroup; }
OHOS::UICardPage *GetViewById(int16_t id) const
{
if (id >= TjdCardId::TJD_CARD_MAX_CARD) {
return nullptr;
}
return recordCard[id];
}
void SwitchToClockPage(bool loadAdjacent = true)
{
if (mainClockView != nullptr) {
SetPage(mainClockView->GetViewIndex(), loadAdjacent);
mainSwipeGroup->ResetBackgroundOpa();
}
}
void SwitchToCard(uint8_t cardId, bool loadAdjacent = true);
bool IsMainClockPage(void);
void SetPage(int16_t page, bool loadAdjacent = true);
void ReloadWatchFace();
void ReloadVer();
const std::unique_ptr<TjdUiWatchFaceCommonView> &GetWfCommon(void) { return wfCommon_; }
void ShowFloatWindow(void);
void HideFloatWindow(void);
bool IsShowFloatWindow(void);
private:
std::unique_ptr<TjdUiWatchFaceCommonView> wfCommon_{nullptr};
static uint8_t lastPageId;
static uint8_t isGoLastPage; // 0:go main page 1:go last page
static uint8_t messageReaded;
bool HorizontalViewInit(void);
void HorViewLoad(void);
void VerticalViewInit(void);
void VertViewLoad(void);
OHOS::UICardPage *recordCard[TjdCardId::TJD_CARD_MAX_CARD]{nullptr};
CustomCrossView *mainSwipeGroup{nullptr};
OHOS::UICardPage *mainClockView{nullptr};
OHOS::UICardPage *favoritePage{nullptr};
OHOS::UICardPage *messagePage{nullptr};
OHOS::UICardPage *shortcutPage{nullptr};
OHOS::UICardPage *healthPage{nullptr};
OHOS::UICardPage *toolPage{nullptr};
OHOS::UICardPage *weatherPage{nullptr};
OHOS::UICardPage *musicPage{nullptr};
OHOS::UICardPage *makeFriendPage{nullptr};
OHOS::UICardPage *mapPage{nullptr};
OHOS::UICardPage *fourLeafCloverPage{nullptr};
OHOS::CardSwipe *cardSwipe{nullptr};
TjdUiFloatWindowBlend *floatWindow_{nullptr};
};
} // namespace TJD
#endif // MAIN_VIEW_SAMPLE_H