#ifndef TJD_UI_APP_SETTING_ADAPTER_H #define TJD_UI_APP_SETTING_ADAPTER_H #include "TjdUiAppSettingPresenter.h" #include "TjdUiComponentList.h" #include "components/abstract_adapter.h" #include "components/tjd_ui_transform_list_group.h" #include "components/ui_label.h" #include "components/ui_transform_group.h" #include "gfx_utils/list.h" #include "image_info.h" #include "string" #include "ui_checkbox.h" #include namespace TJD { #define IMAGE_BIN_PATH TJD_IMAGE_PATH "img_setting.bin" class SettingListItemView : public ItemConstructor { public: SettingListItemView(const SettingCaseInfo &info); virtual ~SettingListItemView(); bool OnClickEvent(const OHOS::ClickEvent &event); bool IsSwitchSelected() { if ((switch_.GetImageInfo()->resId) == openRes_->resId) return true; return false; } void ToggleSwitch() { if (switch_.GetImageInfo()->resId == openRes_->resId) switch_.SetSrc(closeRes_); else switch_.SetSrc(openRes_); switch_.Invalidate(); } void SetSwitchSelected(bool selected) { if (selected) switch_.SetSrc(openRes_); else switch_.SetSrc(closeRes_); } void RefreshItem(const SettingCaseInfo &info, int16_t index); private: OHOS::ImageInfo *openRes_{nullptr}; OHOS::ImageInfo *closeRes_{nullptr}; OHOS::UIImageView icon_; OHOS::UILabelExt name_; OHOS::UIImageView switch_; }; } // namespace TJD #endif