mcu_hi3321_watch/tjd/ui/app/play_dial/TjdUiAppPlayDialPresenter.h
2025-05-26 20:15:20 +08:00

73 lines
2.2 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
*
* Description: TjdUiAppPlayDialPresenter.h
*
* Author: liuguanwu
*
* Create: 2024-10
*--------------------------------------------------------------------------*/
#ifndef TJDUI_APP_PLAY_DIAL_PRESENTER_H
#define TJDUI_APP_PLAY_DIAL_PRESENTER_H
#include "Presenter.h"
#include "components/root_view.h"
#include "components/ui_slider.h"
#include "components/ui_view.h"
#include "graphic_timer.h"
#include <audio_manager.h>
#include <string>
namespace TJD {
class PlayDialInterruptListener : public Audio::InterruptListener
{
public:
void OnInterrupt(int32_t type, int32_t hint);
};
/*@class presenter---<s> */
class TjdUiAppPlayDialView;
class TjdUiAppPlayDialPresenter : public OHOS::Presenter<TjdUiAppPlayDialView>,
public OHOS::UIView::OnClickListener,
public OHOS::UIView::OnDragListener,
#if ENABLE_ROTATE_INPUT
public OHOS::UIView::OnRotateListener,
#endif
public OHOS::RootView::OnKeyActListener
{
public:
TjdUiAppPlayDialPresenter();
~TjdUiAppPlayDialPresenter();
static TjdUiAppPlayDialPresenter &GetInstance(void);
void OnStart() override;
void OnResume() override;
void OnPause() override;
void OnStop() override;
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
bool OnDragStart(OHOS::UIView &view, const OHOS::DragEvent &event) override;
bool OnDrag(OHOS::UIView &view, const OHOS::DragEvent &event) override;
bool OnDragEnd(OHOS::UIView &view, const OHOS::DragEvent &event) override;
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override;
#if ENABLE_ROTATE_INPUT
bool OnRotateStart(OHOS::UIView &view, const OHOS::RotateEvent &event) override;
#endif
void OnClickTrans(OHOS::UIView &view);
private:
bool initFlag_{false};
uint8_t tjdScrollDir_{0};
bool tjdIntercept_{false}; // SetIntercept()
bool isExit_{true};
int16_t dragStartX_{0};
int16_t dragCurrentX_{0};
int32_t dragDistance_{0};
};
/*@class presenter---<e> */
} // namespace TJD
#endif