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

64 lines
2.3 KiB
C++

/*----------------------------------------------------------------------------
* Copyright (c) TJD Technologies Co., Ltd. 2025. All rights reserved.
*
* Description: TjdUiAppListPresenter.h
*
* Author: luziquan@ss-tjd.com
*
* Create: 2025-02-11
*--------------------------------------------------------------------------*/
#ifndef TJD_UI_APP_LIST_PRESENTER_H
#define TJD_UI_APP_LIST_PRESENTER_H
#include "Presenter.h"
#include "TjdUiAppListItemView.h"
#include "TjdUiScreenDrag.h"
#include "components/ui_list.h"
#include "components/ui_sphere_view.h"
namespace TJD {
class TjdUiAppListView;
class TjdUiAppListPresenter : public OHOS::Presenter<TjdUiAppListView>,
public OHOS::UIView::OnClickListener,
public OHOS::ListScrollListener,
public OHOS::UIView::OnRotateListener,
public OHOS::RootView::OnKeyActListener,
public OHOS::UISphereView::ChildStateListener,
public TjdUiScreenDragListener
{
public:
TjdUiAppListPresenter();
~TjdUiAppListPresenter() override;
static TjdUiAppListPresenter *GetInstance();
void OnStart() override;
void OnStop() override;
void OnPause() override;
void OnResume() override;
bool OnRotate(OHOS::UIView &view, const OHOS::RotateEvent &event) override;
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override;
void OnItemSelected(int16_t index, OHOS::UIView *view) override;
bool StateChange(OHOS::UIView& view, float rowAngle, float colAngle) override;
void RefreshAppView(void);
void RefreshAppItemToList(void);
void SetStartIndex(uint16_t index);
uint16_t GetStartIndex(void);
void SetHeadItemY(int y);
int GetHeadItemY(void);
uint8_t GetListItemNum(void);
TjdUiAppListView *GetAppListView();
void SetCurrentStyle(uint8_t style);
uint8_t GetCurrentStyle(void);
void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override;
private:
AppListItemView *itemViewSele{nullptr};
AppListItemView *preItemViewSele{nullptr};
bool exitFlag_{false};
};
} // namespace TJD
#endif