#ifndef TJDUI_APP_SETTING_PRESENTER_H #define TJDUI_APP_SETTING_PRESENTER_H #include "Presenter.h" #include "TjdUiScreenDrag.h" #include "components/root_view.h" #include "components/ui_view.h" #include "sys_typedef.h" #include namespace TJD { enum SettingItemIndex { SETTING_USER_INDEX, // 用户 SETTING_BLUETOOTH_INDEX, // 蓝牙 SETTING_NOTIFICATION_INDEX, // 通知 SETTING_COMMON_INDEX, // 通用 SETTING_LANGUAGE_INDEX, // 语言 SETTING_MOTION_INTENT, // 运动识别 SETTING_PASSWORD_INDEX, // 密码 SETTING_DO_NOT_DISTURB_INDEX, // 勿扰模式 SETTING_POWER_SAVING_INDEX, // 省电模式 SETTING_WATCHFACE_MENU_INDEX, // 表盘与菜单 SETTING_PINCH_TO_ANSWER_INDEX, // 捏手接听 SETTING_COVER_TO_TURN_OFF_SCREEN_INDEX, // 盖手熄屏 SETTING_LEFT_KEY_SETTING_INDEX, // 左键设置 SETTING_FLOATING_WINDOW_INDEX, // 浮窗 SETTING_ANIMATION_SETTING_INDEX, // 动效设置 SETTING_DISPLAY_AND_BRIGHTNESS_INDEX, // 显示与亮度 SETTING_SOUND_AND_TOUCH_INDEX, // 声音与触感 SETTING_ABOUT_INDEX, // 关于 SETTING_MAX_INDEX }; struct SettingCaseInfo { SettingItemIndex index; bool isCanSwitch; OHOS::ImageInfo *imgInfo; uint16_t name; uint32_t sliceId; }; // 息屏表盘类型 enum ShowOffScreenViewType { POINTER_CLOCK, DIGITAL_CLOCK, }; struct ScreenInfo { ScreenInfo() : isShowOffScreenView(false), showOffScreenViewType(POINTER_CLOCK), isShowBedsideClock(false), keepScreenTime(0), screenBrightness(0), isScreenAutoBrightness(false), isPowerSavingMode(false) {} bool isShowOffScreenView; // 是否显示息屏表盘 ShowOffScreenViewType showOffScreenViewType; // 息屏表盘类型 bool isShowBedsideClock; // 是否显示床头时钟 uint16_t keepScreenTime; // 保持屏幕亮的时间 uint8_t screenBrightness; // 屏幕亮度 bool isScreenAutoBrightness; // 自动调节亮度 bool isPowerSavingMode; // 省电模式 }; struct DoNotDisturbInfo { DoNotDisturbInfo() : isNotification(false), isScreenWakesUp(false), isAllDay(false), isPeriod(false), startHour(0), startMinute(0), endHour(0), endMinute(0) {} bool isNotification; // 通知 bool isScreenWakesUp; // 点亮屏幕 bool isAllDay; // 勿扰模式 bool isPeriod; // 勿扰时间段使能 uint8_t startHour; uint8_t startMinute; uint8_t endHour; uint8_t endMinute; }; struct MotionInfo { MotionInfo() : isMotionEnable(false), isMotionEndEnable(false), motionOutTime(8 * 3600) {} bool isMotionEnable; // 运动识别 bool isMotionEndEnable; // 运动结束提醒 uint32_t motionOutTime; // 运动超时提醒 }; struct GuiInfo { GuiInfo() : isPinchToAnswer(false), isCoverToTurnOffScreen(false), leftKeySetting(0), animation(0), watchFaceMenuStyle(0), floatingWindowCount(0) {} bool isPinchToAnswer; // 捏手接听 bool isCoverToTurnOffScreen; // 盖手熄屏 uint32_t leftKeySetting; // 左键设置 uint8_t animation; // 动效设置 uint8_t watchFaceMenuStyle; // 表盘与菜单 std::vector floatingWindowHasMap; // 浮窗 uint32_t floatingWindowCount; }; class TjdUiAppSettingView; class TjdUiAppSettingModel; class TjdUiAppSettingPresenter : public OHOS::Presenter, public TjdUiScreenDragListener, public OHOS::RootView::OnKeyActListener, public OHOS::UIView::OnClickListener { public: TjdUiAppSettingPresenter(); virtual ~TjdUiAppSettingPresenter(); static TjdUiAppSettingPresenter *GetInstance(void); void OnStart() override; void OnStop() override; bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override; bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override; void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ViewExitEvent(true); } bool OnClickSettingItem(SettingCaseInfo caseInfo, bool open); void ViewExitEvent(bool isSwipe); bool IsOpenBle(); bool SetOpenBle(bool open); std::string GetUserName(); bool IsPinchToAnswer(); bool IsCoverToTurnOffScreen(); void SetPinchToAnswer(bool enable); void SetCoverToTurnOffScreen(bool enable); void SetHeadItemY(int y); int GetHeadItemY(void); void SetStartIndex(uint16_t index); uint16_t GetStartIndex(void); bool IsEnterSettingItem(void) { return isEnterSettingItem_; } private: bool isEnterSettingItem_ = false; }; } // namespace TJD #endif