111 lines
3.3 KiB
C++
111 lines
3.3 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description:
|
|
*
|
|
* Author: huangshuyi
|
|
*
|
|
* Create: 2024-9
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
#ifndef TJDUI_WF_PAGE_FOOTBALL_H
|
|
#define TJDUI_WF_PAGE_FOOTBALL_H
|
|
#include "TjdUiWatchFaceBase.h"
|
|
#include "common/image.h"
|
|
#include "components/ui_icosahedron_view.h"
|
|
#include "components/ui_label.h"
|
|
#include "components/ui_sweep_clock.h"
|
|
#include "components/ui_view_group.h"
|
|
#include "graphic_timer.h"
|
|
|
|
namespace TJD {
|
|
class TjdUiWFPageFootball : public TjdUiWfBase, public OHOS::UIView::OnClickListener, public OHOS::UIView::OnDragListener
|
|
//class TjdUiWFPageFootball : public TjdUiWfBase, public OHOS::UIView::OnClickListener, public OHOS::UIView::OnDragListener, public OHOS::UICardPage
|
|
{
|
|
public:
|
|
TjdUiWFPageFootball();
|
|
virtual ~TjdUiWFPageFootball();
|
|
TjdUiWFPageFootball *GetInstance();
|
|
void InitView();
|
|
void Update(void) override;
|
|
void PreLoad(void) override;
|
|
void UnLoad(void) override;
|
|
|
|
class FootballUIIcosahedronView : public OHOS::UIIcosahedronView {
|
|
public:
|
|
bool OnDragStartEvent(const OHOS::DragEvent& event) override
|
|
{
|
|
if (footballRect_.IsContains(event.GetCurrentPos())) {
|
|
UIIcosahedronView::OnDragStartEvent(event);
|
|
isOutZoneStart_ = false;
|
|
return true;
|
|
}
|
|
isOutZoneStart_ = true;
|
|
return false;
|
|
}
|
|
bool OnDragEvent(const OHOS::DragEvent& event) override
|
|
{
|
|
if (isOutZoneStart_ == false) {
|
|
UIIcosahedronView::OnDragEvent(event);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
bool OnDragEndEvent(const OHOS::DragEvent& event) override
|
|
{
|
|
if (isOutZoneStart_ == false) {
|
|
UIIcosahedronView::OnDragEndEvent(event);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
OHOS::Rect footballRect_;
|
|
private:
|
|
bool isOutZoneStart_ = false;
|
|
};
|
|
FootballUIIcosahedronView* container_ = nullptr;
|
|
class EntryAnimatorCallback : public OHOS::AnimatorCallback {
|
|
public:
|
|
explicit EntryAnimatorCallback(OHOS::UIView* view, int16_t startPos, int16_t endPos)
|
|
: startPos_(startPos),
|
|
endPos_(endPos),
|
|
animator_(new OHOS::Animator(this, view, 1000, false)) {} // 1000:duration of animator_, in milliseconds.
|
|
|
|
~EntryAnimatorCallback() override
|
|
{
|
|
if (animator_ != nullptr) {
|
|
delete animator_;
|
|
animator_ = nullptr;
|
|
}
|
|
}
|
|
|
|
void Callback(OHOS::UIView* view) override;
|
|
|
|
OHOS::Animator* GetAnimator() const
|
|
{
|
|
return animator_;
|
|
}
|
|
|
|
protected:
|
|
int16_t startPos_;
|
|
int16_t endPos_;
|
|
OHOS::Animator* animator_;
|
|
};
|
|
EntryAnimatorCallback* callback_ = nullptr;
|
|
OHOS::Animator* enterAnimator_ = nullptr;
|
|
|
|
private:
|
|
bool viewiInitStatus{false};
|
|
OHOS::UIViewGroup *mainView_{nullptr};
|
|
OHOS::ImageInfo* imgInfo_ = nullptr;
|
|
OHOS::ImageInfo* imgInverseInfo_ = nullptr;
|
|
OHOS::UILabel *labelTimeH_{nullptr };
|
|
OHOS::UILabel *labelTimeM_{nullptr };
|
|
OHOS::UILabel *labelDiv_{nullptr };
|
|
OHOS::UILabel *labelDate_{nullptr};
|
|
OHOS::UILabel *labelWeek_{nullptr};
|
|
};
|
|
|
|
} // namespace TJD
|
|
#endif // TJDUI_FOOTBALL_PAGE_H
|