/*---------------------------------------------------------------------------- * Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved. * * Description: * * Author: huangshuyi * * Create: 2024-4 *--------------------------------------------------------------------------*/ #ifndef TJD_MAIN_CLOCK_PRESENTER_H #define TJD_MAIN_CLOCK_PRESENTER_H #include "Presenter.h" #include "TjdUiAppMainModel.h" #include "TjdUiTaskListener.h" #include "common/screen.h" #include "components/root_view.h" #include "components/tjd_ui_float_window_blend.h" #include "components/ui_swipe_view.h" #include "components/ui_view.h" #include // using namespace std; namespace TJD { // namespace OHOS { class TjdUiAppMainView; class TjdUiAppMainPresenter : public OHOS::Presenter, public TjdUiTaskListener, public OHOS::UIView::OnClickListener, public OHOS::UIView::OnLongPressListener, public OHOS::UISwipeView::OnSwipeListener, public OHOS::RootView::OnKeyActListener, public OHOS::UIView::OnDragListener, public TjdUiFloatWindowBlend::OnFloatWindowStateListener { public: enum class MainPresenterState { START, RESUME, PAUSE, STOP, }; TjdUiAppMainPresenter(); virtual ~TjdUiAppMainPresenter(); static TjdUiAppMainPresenter *GetInstance(void); void OnStart() override; void OnStop() override; void OnResume() override; void OnPause() override; void OnSwipe(OHOS::UISwipeView &view) override; void Notify() override; bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override; bool OnLongPress(OHOS::UIView &view, const OHOS::LongPressEvent &event) override; bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override; void SetTaskPeroid(TjdCardId cardId); const std::vector &GetCardSettings(void); bool IsFromComponentsView(void) const; void SetFromComponentsView(bool isFrom); uint8_t GetFromComponentsCardId(void); MainPresenterState GetMainPresenterState(void) { return mainPresenterState_; } void OnStateChange(OHOS::UIView &view, TjdUiFloatWindowBlend::FloatWindowState state) override; private: void DispatchUpDownViewClickEvent(TjdVerCardId verCardId); void DispatchWatchFaceClickEvent(uint16_t srcKeyId); bool OnKeyClickAct(OHOS::UIView &view, const OHOS::KeyEvent &event); bool OnKeyDoubleClickAct(OHOS::UIView &view, const OHOS::KeyEvent &event); MainPresenterState mainPresenterState_ = MainPresenterState::RESUME; OHOS::UIView *lastBlurView_ = nullptr; bool isHearthRateSensorOpened_{false}; }; } #endif // MAIN_PRESENTER_H