90 lines
2.7 KiB
C++
90 lines
2.7 KiB
C++
#ifndef TJDUI_APP_SPORT_PRESENTER_H
|
|
#define TJDUI_APP_SPORT_PRESENTER_H
|
|
|
|
#include "Presenter.h"
|
|
#include "TjdUiAppSportDataInit.h"
|
|
#include "TjdUiScreenDrag.h"
|
|
#include "cmsis_os2.h"
|
|
#include "components/root_view.h"
|
|
#include "components/ui_view.h"
|
|
#include "dock/input_device.h"
|
|
#include "ui_swipe_view.h"
|
|
|
|
enum SportViewManager
|
|
{
|
|
SPORT_LIST_VIEW,
|
|
COUNT_DOWN_VIEW,
|
|
GPS_VIEW,
|
|
SPORTING_VIEW,
|
|
SPORT_END_NODATA_VIEW,
|
|
SPORT_END_DATA_VIEW,
|
|
SPORT_GOAL_SELECT_VIEW,
|
|
SPORT_GOAL_DISTANCES_VIEW,
|
|
SPORT_GOAL_TIME_VIEW,
|
|
SPORT_GOAL_CALORIES_VIEW,
|
|
SPORT_GOAL_FREE_TRAINING_VIEW,
|
|
DISTANCE_GOAL_SELECT_VIEW,
|
|
TIME_GOAL_SELECT_VIEW,
|
|
CALORIES_GOAL_SELECT_VIEW,
|
|
SPORT_REMIND_SELECT_VIEW,
|
|
HEART_RATE_PICK_VIEW,
|
|
TIME_PICK_VIEW,
|
|
DISTANCE_PICK_VIEW,
|
|
SPORT_EDIT_VIEW,
|
|
// SPORT_FINISH_REMIND_VIEW,
|
|
VIEW_MANAGER_MAX
|
|
};
|
|
namespace TJD {
|
|
|
|
class TjdUiAppSportView;
|
|
|
|
class SportItemListListener : public OHOS::UIView::OnClickListener
|
|
{
|
|
public:
|
|
SportItemListListener() {}
|
|
~SportItemListListener() {}
|
|
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
|
|
|
|
private:
|
|
int16_t index_{0};
|
|
};
|
|
|
|
class TjdUiAppSportPresenter : public OHOS::Presenter<TjdUiAppSportView>,
|
|
public OHOS::UISwipeView::OnSwipeListener,
|
|
public TjdUiScreenDragListener,
|
|
public OHOS::UIView::OnClickListener,
|
|
public OHOS::RootView::OnKeyActListener,
|
|
public OHOS::UIView::OnLongPressListener,
|
|
public OHOS::UIView::OnTouchListener
|
|
{
|
|
public:
|
|
TjdUiAppSportPresenter();
|
|
virtual ~TjdUiAppSportPresenter();
|
|
static TjdUiAppSportPresenter *GetInstance(void);
|
|
void OnStart() override;
|
|
void OnStop() override;
|
|
void OnResume() override;
|
|
|
|
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event);
|
|
void OnSwipe(OHOS::UISwipeView &view);
|
|
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event);
|
|
virtual bool OnLongPress(OHOS::UIView &view, const OHOS::LongPressEvent &event);
|
|
virtual bool OnPress(OHOS::UIView &view, const OHOS::PressEvent &event);
|
|
virtual bool OnRelease(OHOS::UIView &view, const OHOS::ReleaseEvent &event);
|
|
void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ExitSportView(); }
|
|
// void SetCurrentSportingData() ;
|
|
|
|
void StartJumpTimer(SportViewManager jumpView);
|
|
osTimerId_t jumpTimerId_{nullptr};
|
|
|
|
private:
|
|
bool isExit_{false};
|
|
int16_t dragStartX_{0};
|
|
int16_t dragCurrentX_{0};
|
|
int32_t dragDistance_{0};
|
|
void ExitSportView(void);
|
|
};
|
|
|
|
} // namespace TJD
|
|
|
|
#endif |