121 lines
3.6 KiB
C++
121 lines
3.6 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description:
|
|
*
|
|
* Author: huangshuyi
|
|
*
|
|
* Create: 2024-9
|
|
*--------------------------------------------------------------------------*/
|
|
#ifndef TJDUI_FOOTBALL_PAGE_H
|
|
#define TJDUI_FOOTBALL_PAGE_H
|
|
#include "components/ui_label.h"
|
|
#include "wearable_log.h"
|
|
#include "common/image_cache_manager.h"
|
|
#include <time.h>
|
|
#include <unordered_map>
|
|
#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"
|
|
|
|
namespace TJD {
|
|
class TjdUiFootballPage : public OHOS::UIView::OnClickListener, public OHOS::UIView::OnDragListener, public TjdUiTaskListener
|
|
{
|
|
public:
|
|
TjdUiFootballPage(OHOS::UIViewGroup*parent) : parent_(parent) { PageInit(); }
|
|
virtual ~TjdUiFootballPage();
|
|
virtual void Notify() override;
|
|
private:
|
|
void PageInit();
|
|
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};
|
|
|
|
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, 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;
|
|
|
|
};
|
|
|
|
TjdUiFootballPage* TjdUiFootballPageCreate(OHOS::UIViewGroup*& parent);
|
|
} // namespace TJD
|
|
#endif // TJDUI_FOOTBALL_PAGE_H
|