131 lines
4.2 KiB
C++
131 lines
4.2 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/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 OnSwipe(OHOS::UISwipeView &view) override;
|
|
};
|
|
|
|
static void ChangeMainViewToMainPage(OHOS::TransitionType type = OHOS::TransitionType::TRANSITION_INVALID)
|
|
{
|
|
OHOS::NativeAbility::GetInstance().ChangeSlice(TJD_APP_VIEW_MAIN, type);
|
|
}
|
|
|
|
static void SetLastPageIndex(uint8_t id)
|
|
{
|
|
lastPageId = id; //表示的是一个页面的索引 非MainCardId
|
|
}
|
|
static void SetMessageRead(uint8_t flag)
|
|
{
|
|
messageReaded = flag; // 1:未读 0:已读
|
|
}
|
|
static uint8_t GetMessageRead(void) { return messageReaded; }
|
|
void VertViewRemove(void);
|
|
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);
|
|
}
|
|
}
|
|
void SwitchToCard(uint8_t cardId, bool loadAdjacent = true);
|
|
bool IsMainClockPage(void);
|
|
void SetPage(int16_t page, bool loadAdjacent = true);
|
|
void ReloadWatchFace();
|
|
const std::unique_ptr<TjdUiWatchFaceCommonView> &GetWfCommon(void) { return wfCommon_; }
|
|
|
|
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};
|
|
};
|
|
} // namespace TJD
|
|
#endif // MAIN_VIEW_SAMPLE_H
|