/*---------------------------------------------------------------------------- * Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved. * * Description: * * Author: huangshuyi * * Create: 2024-9 *--------------------------------------------------------------------------*/ #ifndef TJDUI_FOOTBALL1_PAGE_H #define TJDUI_FOOTBALL1_PAGE_H #include "components/ui_label.h" #include "wearable_log.h" #include "common/image_cache_manager.h" #include #include #include "gfx_utils/image_info.h" #include "gfx_utils/heap_base.h" #include "TjdUiImageIds.h" #include "ui_label.h" #include "TjdUiMultiLanguageExt.h" #include "sys_config.h" #include "components/ui_view.h" #include "components/ui_view_group.h" #include "components/root_view.h" #include "components/ui_scroll_view.h" #include "components/ui_image_view.h" #include "ui_label_ext.h" #include "components/ui_icosahedron_view.h" #include "components/ui_image_view.h" #include "animator/animator_manager.h" #include "common/screen.h" #include "TjdUiTaskListener.h" #include "common/image.h" #include "components/ui_sweep_clock.h" #include "graphic_timer.h" namespace TJD { class TjdUiFootball1Page : public OHOS::UIView::OnClickListener, public OHOS::UIView::OnDragListener, public TjdUiTaskListener { public: TjdUiFootball1Page(OHOS::UIViewGroup*parent) : parent_(parent) { PageInit(); } virtual ~TjdUiFootball1Page(); virtual void Notify() override; void UpdateClock(void); private: void PageInit(); void InitClock(void); OHOS::UIViewGroup*parent_{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}; OHOS::Image *secondHand{nullptr}; OHOS::Image *minuteHand{nullptr}; OHOS::Image *hourHand{nullptr}; OHOS::Image *dotHand{nullptr}; OHOS::UISweepClock *mainSweepClock{nullptr}; 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 (footballRect_.IsContains(event.GetCurrentPos()) && isOutZoneStart_ == false) { UIIcosahedronView::OnDragEvent(event); return true; } return false; } bool OnDragEndEvent(const OHOS::DragEvent& event) override { if (footballRect_.IsContains(event.GetCurrentPos()) && 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, 0, true)) {} // 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; OHOS::GraphicTimer* timesClock_{nullptr}; }; TjdUiFootball1Page* TjdUiFootball1PageCreate(OHOS::UIViewGroup*& parent); } // namespace TJD #endif // TJDUI_FOOTBALL_PAGE_H