77 lines
2.4 KiB
C++
77 lines
2.4 KiB
C++
/*----------------------------------------------------------------------------
|
|
* 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/ui_swipe_view.h"
|
|
#include "components/ui_view.h"
|
|
#include <string>
|
|
|
|
// using namespace std;
|
|
|
|
namespace TJD {
|
|
// namespace OHOS {
|
|
class TjdUiAppMainView;
|
|
class TjdUiAppMainPresenter : public OHOS::Presenter<TjdUiAppMainView>,
|
|
public TjdUiTaskListener,
|
|
public OHOS::UIView::OnClickListener,
|
|
public OHOS::UIView::OnLongPressListener,
|
|
public OHOS::UISwipeView::OnSwipeListener,
|
|
public OHOS::RootView::OnKeyActListener,
|
|
public OHOS::UIView::OnDragListener
|
|
{
|
|
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<TjdCardId> &GetCardSettings(void);
|
|
|
|
bool IsFromSetCardView(void) const;
|
|
void SetFromSetCardView(bool isFrom);
|
|
uint8_t GetFromCardId(void);
|
|
MainPresenterState GetMainPresenterState(void) { return mainPresenterState_; }
|
|
|
|
|
|
private:
|
|
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
|