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

67 lines
2.2 KiB
C++

#ifndef TJDUIAPP_ALBUM_PRESENTER
#define TJDUIAPP_ALBUM_PRESENTER
#include "Presenter.h"
#include "TjdUiAppAlbumAdapter.h"
#include "TjdUiAppAlbumModel.h"
#include "TjdUiScreenDrag.h"
#include "root_view.h"
#include "ui_list.h"
#include "ui_view.h"
namespace TJD {
class TjdUiAppAlbumView;
class TjdUiAppAlbumPresenter : public OHOS::Presenter<TjdUiAppAlbumView>,
public OHOS::UIView::OnClickListener,
public TjdUiScreenDragListener,
public OHOS::RootView::OnKeyActListener,
public OHOS::ListScrollListener
{
public:
TjdUiAppAlbumPresenter();
~TjdUiAppAlbumPresenter();
static TjdUiAppAlbumPresenter *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 OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override;
void OnItemSelected(int16_t index, OHOS::UIView *view) override;
void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ExitCurrentView(); }
void ExitAlbumView(void);
void ExitCurrentView(void);
uint8_t GetSelectedListId(void) { return selectedListId; }
void SetSelectedListId(uint8_t id) { selectedListId = id; }
OHOS::ImageInfo *GetAlbumIcon(AlbumIconType type) { return AlbumIconArray[type]; }
TjdUiAppAlbumModel *GetAlbumModel(void) { return model; }
void TaskProcess(AlbumItem *item);
AlbumView GetCurrentView(void) { return currentView; }
AlbumView currentView{ALBUM_LIST_VIEW};
bool isSetSucc{false};
bool firstEnter_{false};
private:
void LoadIconRes(void);
TjdUiAppAlbumModel *model{nullptr};
TjdAlbumItemView *itemViewSele{nullptr};
TjdAlbumItemView *preItemViewSele{nullptr};
uint8_t selectedListId = 0;
OHOS::ImageInfo *AlbumIconArray[ALBUM_ICON_MAX]{nullptr};
bool isExit_{false};
int16_t dragStartX_{0};
int16_t dragCurrentX_{0};
int32_t dragDistance_{0};
};
} // namespace TJD
#endif