107 lines
3.4 KiB
C++
107 lines
3.4 KiB
C++
#ifndef TJD_UI_APP_SPORT_ADAPTER_H
|
||
#define TJD_UI_APP_SPORT_ADAPTER_H
|
||
|
||
#include "TjdUiAppSportModel.h"
|
||
#include "TjdUiAppSportPresenter.h"
|
||
#include "TjdUiComponentList.h"
|
||
#include "components/abstract_adapter.h"
|
||
#include "components/ui_image_view.h"
|
||
#include "components/ui_label.h"
|
||
#include "components/ui_label_ext.h"
|
||
#include "components/ui_label_button.h"
|
||
#include "components/ui_qrcode.h"
|
||
#include "components/ui_toggle_button.h"
|
||
#include "components/ui_view.h"
|
||
#include "components/ui_view_group.h"
|
||
#include "gfx_utils/list.h"
|
||
#include "image_info.h"
|
||
#include "string"
|
||
#include "components/tjd_ui_transform_list_group.h"
|
||
namespace TJD {
|
||
#define MAX_SPORT_TYPE 58
|
||
enum IndoorRunningItemIndex
|
||
{
|
||
INTDOOR_DISTANCE_INDEX,
|
||
INTDOOR_TIME_INDEX,
|
||
INTDOOR_CALORIES_INDEX,
|
||
INTDOOR_FREE_TRAINING_INDEX,
|
||
INTDOOR_MAX_INDEX,
|
||
};
|
||
struct IndoorRunningSportCaseInfo
|
||
{
|
||
IndoorRunningItemIndex index;
|
||
OHOS::ImageInfo *imgInfo;
|
||
const char *name;
|
||
const char *goal;
|
||
OHOS::ImageInfo *imgMoreInfo;
|
||
};
|
||
|
||
class SportCaseItemView : public ItemConstructor<SportCaseInfo>
|
||
{
|
||
public:
|
||
explicit SportCaseItemView(const SportCaseInfo &info);
|
||
~SportCaseItemView() override;
|
||
// void UpdateView(SportCaseInfo &info, uint8_t index);
|
||
void RefreshItem(const SportCaseInfo &itemInfo, int16_t index);
|
||
SportCaseItemView *GetItemView() { return this; }
|
||
void SetItemOnClickListener(OHOS::UIView::OnClickListener *listener) { SetOnClickListener(listener); }
|
||
bool OnClickEvent(const OHOS::ClickEvent &event) override;
|
||
void SetCurSportIndex(SportTypeIndex index) { curSportIndex_ = index; }
|
||
uint8_t GetCurSportIndex() const { return curSportIndex_; }
|
||
OHOS::Rect imageRect_;
|
||
OHOS::Rect labelRect_;
|
||
friend bool ListItemTransformItemBaseOnPosition(OHOS::UITransformList *list, OHOS::UIView *item);
|
||
private:
|
||
OHOS::UIViewGroup normalView;
|
||
OHOS::UIImageView sportIcon_;
|
||
OHOS::UILabelExt text_;
|
||
OHOS::UIImageView moreIcon_;
|
||
OHOS::UILabelExt goalContent_;
|
||
OHOS::UILabel editLabel_;
|
||
SportTypeIndex curSportIndex_;
|
||
};
|
||
|
||
#pragma region 编辑列表
|
||
class EditItemListListener : public OHOS::UIView::OnClickListener // 编辑列表监听器
|
||
{
|
||
public:
|
||
EditItemListListener() {}
|
||
~EditItemListListener() {}
|
||
bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override;
|
||
|
||
private:
|
||
};
|
||
class EditCaseItemView : public ItemConstructor<EditItemInfo>
|
||
{
|
||
public:
|
||
explicit EditCaseItemView(const EditItemInfo &info);
|
||
~EditCaseItemView();
|
||
// void UpdateView(EditItemInfo &info, uint8_t index);
|
||
void RefreshItem(const EditItemInfo &itemInfo, int16_t index);
|
||
void SetItemOnClickListener(OHOS::UIView::OnClickListener *listener) { SetOnClickListener(listener); }
|
||
bool OnClickEvent(const OHOS::ClickEvent &event);
|
||
void SetSportIndex(uint8_t index) { sportIndex_ = index; }
|
||
uint8_t GetSportIndex() const { return sportIndex_; }
|
||
void SetEditState(bool state) { state_ = state; }
|
||
bool GetEditState() const { return state_; }
|
||
void ChangeEditBoxImage(bool state);
|
||
|
||
private:
|
||
OHOS::ImageInfo* addImg = nullptr;
|
||
OHOS::ImageInfo* educeImg = nullptr;
|
||
OHOS::UIImageView sportIcon_;
|
||
OHOS::UILabelExt text_;
|
||
// OHOS::UICheckBox editBox_;
|
||
OHOS::UIImageView editBox_;
|
||
OHOS::UIViewGroup editBackground_;
|
||
EditItemListListener boxOnClickListener_;
|
||
uint8_t sportIndex_ = 0;
|
||
|
||
bool state_ = false;// 0:未添加,1:已添加
|
||
};
|
||
|
||
#pragma endregion
|
||
|
||
} // namespace TJD
|
||
|
||
#endif |