From: luozheng <1732036298@qq.com> Date: Thu, 23 Apr 2026 08:24:04 +0000 (+0800) Subject: 解决patch1201合并死机问题 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3365%2Ftarget%2F1;p=mirrors%2FFD230.git 解决patch1201合并死机问题 --- diff --git a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd230/libuikit_fwk.a b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd230/libuikit_fwk.a deleted file mode 100644 index e3ce469ad..000000000 Binary files a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd230/libuikit_fwk.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd230_user/libuikit_fwk.a b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd230_user/libuikit_fwk.a deleted file mode 100644 index e3ce469ad..000000000 Binary files a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd230_user/libuikit_fwk.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd272/libuikit_fwk.a b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd272/libuikit_fwk.a deleted file mode 100644 index e3ce469ad..000000000 Binary files a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-fd272/libuikit_fwk.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-ln/libuikit_fwk.a b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-ln/libuikit_fwk.a deleted file mode 100644 index e3ce469ad..000000000 Binary files a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-ln/libuikit_fwk.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-lnppp/libuikit_fwk.a b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-lnppp/libuikit_fwk.a deleted file mode 100644 index e3ce469ad..000000000 Binary files a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-lnppp/libuikit_fwk.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-n9/libuikit_fwk.a b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-n9/libuikit_fwk.a index e3ce469ad..dd5873d60 100644 Binary files a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-n9/libuikit_fwk.a and b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-n9/libuikit_fwk.a differ diff --git a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-n9ln/libuikit_fwk.a b/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-n9ln/libuikit_fwk.a deleted file mode 100644 index e3ce469ad..000000000 Binary files a/code/sdk/application/wearable/evb/nativeapp/brandy-native-js-n9ln/libuikit_fwk.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportCountdownPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportCountdownPage.h deleted file mode 100644 index 5a94db86b..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportCountdownPage.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportCountdownPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_COUNTDOWN_PAGE_H -#define SPORT_COUNTDOWN_PAGE_H - -#include "animator/animator.h" -#include "components/ui_label.h" -#include "components/ui_circle_progress.h" -#include "components/ui_view_group.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" - -namespace OHOS { -class SportCountdownPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportCountdownPage() {} - ~SportCountdownPage(); - void OnStart(void* data) override; - void OnPause() override; - void OnResume() override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void UpdateCountdownView(uint64_t time); - class SportCountdownAnimatorCallback : public AnimatorCallback { - public: - SportCountdownAnimatorCallback(SportCountdownPage* page):page_(page) {} - virtual ~SportCountdownAnimatorCallback() override {} - void Callback(UIView* view) override; - private: - SportCountdownPage* page_{nullptr}; - }; - Animator* animator_{nullptr}; - SportCountdownAnimatorCallback* callback_{nullptr}; - UIViewGroup *group_{nullptr}; - UILabel *countdownText_{nullptr}; - UICircleProgress *countdownProgress_{nullptr}; - struct timeval startTime_{0}; -}; -} // namespace OHOS -#endif // SPORT_COUNTDOWN_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportDataPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportDataPage.h deleted file mode 100644 index ae650c8fa..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportDataPage.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportDataPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_DATA_PAGE_H -#define SPORT_DATA_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_canvas.h" -#include "components/ui_image_view.h" -#include "components/ui_sweep_clock.h" -#include "animator/animator.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" - -namespace OHOS { -class SportDataPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportDataPage() {} - ~SportDataPage(); - void OnStart(void* data) override; - void OnPause() override; - void OnResume() override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void InitBatteryView(); - void InitTimeLableVIew(); - void ShowUpHeartRate(); - void ShowUpTopView(); - void ShowUpLeftView(); - void ShowUpRightView(); - void ShowUpBottomView(); - void ShowUpSeparateLine(); - void UpdateDataViewByType(); - void CheckTarget(); - void CheckRemind(); - class SportDataAnimatorCallback : public AnimatorCallback { - public: - SportDataAnimatorCallback(SportDataPage* page):page_(page) {} - virtual ~SportDataAnimatorCallback() override {} - void Callback(UIView* view) override; - private: - SportDataPage* page_{nullptr}; - }; - Animator* animator_{nullptr}; - SportDataAnimatorCallback* callback_{nullptr}; - Image *secondHand_{nullptr}; - UISweepClock *sweepClock_{nullptr}; - UIImageView *heartRateScale_{nullptr}; - UIImageView *heartRatePointer_{nullptr}; - UICanvas *separateLine_{nullptr}; - UILabel *topValueLabel_{nullptr}; - UILabel *topUnitLabel_{nullptr}; - UILabel *leftValueLabel_{nullptr}; - UILabel *leftUnitLabel_{nullptr}; - UILabel *rightValueLabel_{nullptr}; - UILabel *rightUnitLabel_{nullptr}; - UILabel *bottomValueLabel_{nullptr}; - UILabel *bottomUnitLabel_{nullptr}; - UILabel *timeLabel_{nullptr}; - UIImageView *batteryIcon_{nullptr}; - UILabel *batteryLabel_{nullptr}; -}; -} // namespace OHOS -#endif // SPORT_DATA_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportHeartRateRangeItemView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportHeartRateRangeItemView.h deleted file mode 100644 index b4e20f700..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportHeartRateRangeItemView.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportHeartRateRangeItemView - * Create: 2025-06-06 - */ - -#ifndef SPORT_HEART_RATE_RANGE_ITEM_VIEW_H -#define SPORT_HEART_RATE_RANGE_ITEM_VIEW_H - -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_radio_button.h" -#include "components/ui_label.h" - -namespace OHOS { -typedef struct { - uint8_t itemId; - const char *title; - const char *viewId; -} SportHeartRateRangeItem; - -class SportHeartRateRangeItemView : public UIViewGroup { -public: - SportHeartRateRangeItemView(); - ~SportHeartRateRangeItemView() override; - - virtual void SetItemInfo(const SportHeartRateRangeItem &itemInfo); - -private: - UIImageView bgImage_; - UILabel title_; - UILabel range_; - UIRadioButton button_; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportHeartRateRangePage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportHeartRateRangePage.h deleted file mode 100644 index a71eac74b..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportHeartRateRangePage.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportHeartRateRangePage - * Create: 2025-06-06 - */ - -#ifndef SPORT_HEART_RATE_RANGE_PAGE_H -#define SPORT_HEART_RATE_RANGE_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_simple_list.h" -#include "components/ui_scroll_view.h" -#include "SlicePage.h" -#include "UiConfig.h" -#include "SportPresenter.h" -#include "SportModel.h" -#include "SportHeartRateRangeItemView.h" - -namespace OHOS { -const char* SPORT_HEARTRATE_RANGE_ITEM_1 = "sportHeartRateRangeItem1"; -const char* SPORT_HEARTRATE_RANGE_ITEM_2 = "sportHeartRateRangeItem2"; -const char* SPORT_HEARTRATE_RANGE_ITEM_3 = "sportHeartRateRangeItem3"; -const char* SPORT_HEARTRATE_RANGE_ITEM_4 = "sportHeartRateRangeItem4"; - -class SportHeartRateRangePage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportHeartRateRangePage(); - ~SportHeartRateRangePage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void CreateUILabel(void); - void CreateUIList(void); - UIScrollView *group_{nullptr}; - UILabel *titleLabel_{nullptr}; - UISimpleList *heartRateRangeList_{nullptr}; - SportHeartRateRangeItem heartRateRanges_[SPORT_HEARTRATE_RANGE_MAX] = { - {SPORT_HEARTRATE_RANGE_ITEM1, "热身燃脂", SPORT_HEARTRATE_RANGE_ITEM_1}, - {SPORT_HEARTRATE_RANGE_ITEM2, "有氧耐力", SPORT_HEARTRATE_RANGE_ITEM_2}, - {SPORT_HEARTRATE_RANGE_ITEM3, "无氧耐力", SPORT_HEARTRATE_RANGE_ITEM_3}, - {SPORT_HEARTRATE_RANGE_ITEM4, "极限训练", SPORT_HEARTRATE_RANGE_ITEM_4}}; -}; -} // namespace OHOS -#endif // SPORT_HEART_RATE_RANGE_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMenuItemView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMenuItemView.h deleted file mode 100644 index 0ed753dca..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMenuItemView.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportMenuItemView - * Create: 2025-06-06 - */ - -#ifndef SPORT_MENU_ITEM_VIEW_H -#define SPORT_MENU_ITEM_VIEW_H - -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_label.h" - -namespace OHOS { -typedef struct { - int bgId; - int iconId; - const char *label; - const char *viewId; -} SportMenuItem; - -class SportMenuItemView : public UIViewGroup { -public: - SportMenuItemView(); - ~SportMenuItemView() override; - - virtual void SetItemInfo(const SportMenuItem &itemInfo); - -private: - UIImageView bgImage_; - UIImageView icon_; - UILabel label_; - UIImageView settingImage_; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMenuPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMenuPage.h deleted file mode 100644 index 95e9f3007..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMenuPage.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportMenuPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_MENU_PAGE_H -#define SPORT_MENU_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_simple_list.h" -#include "components/ui_image_view.h" -#include "components/ui_scroll_view.h" -#include "ui_resource_sport.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" -#include "SportMenuItemView.h" - -namespace OHOS { -const char* SPORT_ITEM_OUTDOOR_RUNNING = "sportItemOutdoorRunning"; -const char* SPORT_ITEM_INDOOR_RUNNING = "sportItemIndoorRunning"; -const char* SPORT_ITEM_CYCLING = "sportItemCycling"; -const char* SPORT_ITEM_CLIMBING = "sportItemClimbing"; -const char* SPORT_ITEM_INDOOR_SWIMMING = "sportItemIndoorSwimming"; -const char* SPORT_ITEM_OUTDOOR_SWIMMING = "sportItemOutdoorSwimming"; - -class SportMenuPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportMenuPage(); - ~SportMenuPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void InitBackgroundView(); - void CreateUILabel(void); - void CreateUIList(void); - UIScrollView *group_{nullptr}; - UIImageView *background_{nullptr}; - UILabel *titleLabel_{nullptr}; - UISimpleList *sportList_{nullptr}; - SportMenuItem sportMenu_[SPORT_TYPE_MAX] = { - {IMAGE_SPORT_ITEMBG1, IMAGE_SPORT_OUTDOOR_RUNNING1, "户外跑步", SPORT_ITEM_OUTDOOR_RUNNING}, - {IMAGE_SPORT_ITEMBG2, IMAGE_SPORT_INDOOR_RUNNING1, "室内跑步", SPORT_ITEM_INDOOR_RUNNING}, - {IMAGE_SPORT_ITEMBG3, IMAGE_SPORT_CYCLING1, "骑行", SPORT_ITEM_CYCLING}, - {IMAGE_SPORT_ITEMBG4, IMAGE_SPORT_CLIMBING1, "登山", SPORT_ITEM_CLIMBING}, - {IMAGE_SPORT_ITEMBG6, IMAGE_SPORT_INDOOR_SWIMMING1, "室内游泳", SPORT_ITEM_INDOOR_SWIMMING}, - {IMAGE_SPORT_ITEMBG5, IMAGE_SPORT_OUTDOOR_SWIMMING1, "户外游泳", SPORT_ITEM_OUTDOOR_SWIMMING}}; -}; -} // namespace OHOS -#endif // SPORT_MENU_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMistouchPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMistouchPage.h deleted file mode 100644 index 6dbea19f1..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportMistouchPage.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportMistouchPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_MISTOUCH_PAGE_H -#define SPORT_MISTOUCH_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_toggle_button.h" -#include "components/ui_image_view.h" -#include "components/ui_scroll_view.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" - -namespace OHOS { -const char* SPORT_MISTOUCH_SCREEN_BUTTON = "sportMistouchScreenButton"; -const char* SPORT_MISTOUCH_CROWN_BUTTON = "sportMistouchCrownButton"; - -class SportMistouchPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportMistouchPage() {} - ~SportMistouchPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - UIScrollView* group_ = nullptr; - UILabel* title_ = nullptr; - UIImageView* bgScreen_ = nullptr; - UIToggleButton* buttonScreen_ = nullptr; - UILabel* titleScreen_ = nullptr; - UIImageView* imageScreen_ = nullptr; - UIImageView* bgCrown_ = nullptr; - UIToggleButton* buttonCrown_ = nullptr; - UILabel* titleCrown_ = nullptr; - UIImageView* imageCrown_ = nullptr; - UILabel* textScreen_ = nullptr; - UILabel* textCrown_ = nullptr; -}; -} // namespace OHOS -#endif // SPORT_MISTOUCH_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportModel.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportModel.h deleted file mode 100644 index 6832bdd3a..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportModel.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportModel - * Create: 2025-06-06 - */ - -#ifndef SPORT_MODEL_H -#define SPORT_MODEL_H - -#include -#if defined(_WIN32) -#include "animator/animator.h" -#define SPORT_CONFIG_PATH -#else -#define SPORT_CONFIG_PATH "/user/data/" -#include "ohos_timer.h" -#include "graphic_timer.h" -#endif - -namespace OHOS { -enum SportType : uint8_t { - SPORT_TYPE_OUTDOOR_RUNNING = 0, - SPORT_TYPE_INDOOR_RUNNING, - SPORT_TYPE_CYCLING, - SPORT_TYPE_CLIMBING, - SPORT_TYPE_INDOOR_SWIMMING, - SPORT_TYPE_OUTDOOR_SWIMMING, - SPORT_TYPE_MAX, -}; - -enum SportSetType : uint8_t { - SPORT_SET_TYPE_TARGET = 0, // 设置项(目标)和提示类型共用 - SPORT_SET_TYPE_REMIND, // 设置项(提醒)和提示类型共用 - SPORT_SET_TYPE_MISTOUCH, // 设置项(防误触) - SPORT_SET_TYPE_MAX = 3, // 设置项最大值 - SPORT_SET_TYPE_HEARTRATE, // 只用于心率提示类型 -}; - -enum SportTarget : uint8_t { - SPORT_TARGET_DISTANCE = 0, - SPORT_TARGET_TIME, - SPORT_TARGET_CALORIE, - SPORT_TARGET_MAX, -}; - -enum SportRemind : uint8_t { - SPORT_REMIND_INTERVAL = 0, - SPORT_REMIND_HEARTRATE, - SPORT_REMIND_MAX, -}; - -enum SportRemindInterval : uint8_t { - SPORT_REMIND_INTERVAL_NONE = 0, - SPORT_REMIND_INTERVAL_DISTANCE, - SPORT_REMIND_INTERVAL_TIME, - SPORT_REMIND_INTERVAL_MAX, -}; - -enum SportRemindHeartRate : uint8_t { - SPORT_REMIND_HEARTRATE_ENABLE = 0, - SPORT_REMIND_HEARTRATE_RANGE, - SPORT_REMIND_HEARTRATE_MAX, -}; - -enum SportHeartRateRange : uint8_t { - SPORT_HEARTRATE_RANGE_ITEM1 = 0, - SPORT_HEARTRATE_RANGE_ITEM2, - SPORT_HEARTRATE_RANGE_ITEM3, - SPORT_HEARTRATE_RANGE_ITEM4, - SPORT_HEARTRATE_RANGE_MAX, -}; - -enum GpsSignal : uint8_t { - SPORT_GPS_SIGNAL0 = 0, - SPORT_GPS_SIGNAL1, - SPORT_GPS_SIGNAL2, - SPORT_GPS_SIGNAL3, -}; - -enum SportAction : uint8_t { - SPORT_ACTION_START = 1, - SPORT_ACTION_PAUSE = 2, - SPORT_ACTION_RESUME = 3, - SPORT_ACTION_STOP = 4, -}; - -enum SportConfig : uint8_t { - SPORT_CONFIG_INFO = 1, - SPORT_CONFIG_RECORD = 2, -}; - -typedef struct sport_control { - uint8_t action; - uint8_t type; -} sport_control_t; - -typedef struct sport_data { - uint8_t type; // 运动类型 - uint16_t heartRate; // 心率 - uint16_t calorie; // 卡路里 - uint16_t altitude; // 高度 - uint16_t ascent; // 海拔上升 - uint16_t descent; // 海拔下降 - uint32_t distance; // 运动距离 - uint32_t lap; // 室内游泳趟数 - uint32_t startTime; // 运动开始时间 - uint32_t endTime; // 运动结束时间 - uint32_t elapsedTime; // 运动总耗时 -} sport_data_t; - -typedef struct sport_info { - SportSetType setType; // 当前设置项类型(目标或提醒) - SportSetType promptType; // 当前提醒项类型 - bool isTargetSetted; // 是否已设置过目标 - SportTarget targetType; // 目标类型 - SportTarget targetTypeTemp; // 临时目标类型,用于恢复没有成功设置目标类型时 - uint16_t targetValue; // 设置的目标值,在Picker中选择的值 - bool targetHalf; // 是否达到一半目标 - bool targetComplete; // 是否达成半目标 - bool isRemindSetted; // 是否已设置过提醒 - SportRemindInterval remindType; // 提醒类型 - SportRemindInterval remindTypeTemp; // 临时提醒类型,用于恢复没有成功设置提醒类型时 - uint16_t remindIndex; // 提醒的索引值,在Picker中的索引值 - uint16_t remindValue; // 设置的提醒值,在Picker中选择的值 - uint16_t remindTimes; // 已经提醒的次数 - bool enableHeartRemind; // 是否开启心率提醒 - bool isHeartReminded; // 同区间的心率值是否已经提醒过 - SportHeartRateRange heartRange; // 设置的心率提醒区间 - bool enableScreenLock; // 是否开启屏幕锁定 - bool enableCrownLock; // 是否开启表冠锁定 - uint32_t startTimeTemp; // 用于暂停时再继续运动时计算运动耗时 - sport_data_t data; // 各项运动数据 -} sport_info_t; - -std::string GetCurrentTimeStr(); -std::string ConvertDistance(uint32_t distance); -std::string FormatSportTime(uint32_t uiSportTime); -std::string CalculateSpeed(uint32_t distance, uint32_t time); -const char *GetHeartRateRangeDescription(uint8_t range); -uint16_t GetHeartRateRangeBounder(uint8_t index); - -class SportModel { -public: - enum class SportState : uint8_t { STOPPED, RUNNING, PAUSED }; - static SportModel &GetInstance(void); - void SetSportType(SportType sportType); - SportType GetSportType(void); - void SetTargetValue(uint16_t index); - void SetRemindValue(uint16_t index); - void SetGpsSignal(GpsSignal gpsSignal); - GpsSignal GetGpsSignal(void); - uint16_t GetHeartRate(void); - sport_info_t *GetSportInfo(SportType type); - sport_info_t *GetCurrSportInfo(); - uint32_t GetElapsedTime(); - void StartSport(bool startedByWatch); - void PauseAndReport(bool isReport); - void ResumeAndReport(bool isReport); - void StopAndReport(bool isReport); - void AddRecord(); - void ClearRecord(); - std::vector &GetRecord(); - bool IsStartByWatch(); - void LoadConfig(); - void SaveConfig(uint8_t config); - void ClearData(); - -private: - SportModel(); - SportModel(const SportModel &); - SportModel &operator=(const SportModel &); - virtual ~SportModel(); - SportType curSport_; - sport_info_t info_[SPORT_TYPE_MAX]; - GpsSignal gpsSignal_; - bool isStartByWatch_{false}; - SportState state_; - std::vector records_; -#if defined(_WIN32) - class SportAnimatorCallback : public AnimatorCallback { - public: - SportAnimatorCallback() {} - virtual ~SportAnimatorCallback() override {} - void Callback(UIView *view) override; - - private: - }; - SportAnimatorCallback *callback_{nullptr}; - Animator *animator_{nullptr}; -#else - GraphicTimer *generateDataHandle_{nullptr}; - void InitGenerateSportData(); - void StartGenerateSportData(); - void StopGenerateSportData(); -#endif -}; -} - -#endif // SPORT_MODEL_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPausePage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPausePage.h deleted file mode 100644 index 232b06ac9..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPausePage.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPausePage - * Create: 2025-06-06 - */ - -#ifndef SPORT_PAUSE_PAGE_H -#define SPORT_PAUSE_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "components/ui_view_group.h" -#include "animator/animator.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" - -namespace OHOS { -const char* SPORT_PAUSE_CONTINUE_BUTTON = "sportPauseContinueButton"; -const char* SPORT_PAUSE_FINISH_BUTTON = "sportPauseFinishButton"; - -class SportPausePage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportPausePage() {} - ~SportPausePage(); - void OnStart(void* data) override; - void OnPause() override; - void OnResume() override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void CreateUILabel(void); - void CreateUIButton(void); - class SportPauseAnimatorCallback : public AnimatorCallback { - public: - SportPauseAnimatorCallback() {} - virtual ~SportPauseAnimatorCallback() override {} - void Callback(UIView* view) override; - }; - SportPauseAnimatorCallback* callback_{nullptr}; - Animator* animator_{nullptr}; - UIViewGroup *group_{nullptr}; - UILabel *timeLabel_{nullptr}; - UILabel *textLabel_{nullptr}; - UILabelButton *continueButton_{nullptr}; - UILabelButton *finishButton_{nullptr}; -}; -} // namespace OHOS -#endif // SPORT_PAUSE_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPreparePage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPreparePage.h deleted file mode 100644 index 20756b503..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPreparePage.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPreparePage - * Create: 2025-06-06 - */ - -#ifndef SPORT_PREPARE_PAGE_H -#define SPORT_PREPARE_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_image_view.h" -#include "components/ui_label_button.h" -#include "components/ui_view_group.h" -#include "animator/animator.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" - -namespace OHOS { -const char* SPORT_PREPARE_GO_BUTTON = "sportPrepareGoButton"; - -class SportPreparePage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportPreparePage() {} - ~SportPreparePage(); - void OnStart(void* data) override; - void OnPause() override; - void OnResume() override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void InitGpsSignalImage(); - void InitBackgroundView(); - void InitBatteryView(); - void InitHeartbeatView(); - void InitTimeLableVIew(); - void InitCenterView(); - void InitGPSView(); - void InitHeartRateView(); - void InitGoButtonView(); - class SportPrepareAnimatorCallback : public AnimatorCallback { - public: - SportPrepareAnimatorCallback(SportPreparePage* page):page_(page) {} - virtual ~SportPrepareAnimatorCallback() override {} - void Callback(UIView* view) override; - private: - SportPreparePage* page_{nullptr}; - }; - SportPrepareAnimatorCallback* callback_{nullptr}; - Animator* animator_{nullptr}; - UIViewGroup *group_{nullptr}; - UIImageView *background_{nullptr}; - UILabel *timeLabel_{nullptr}; - UIImageView *batteryIcon_{nullptr}; - UILabel *batteryLabel_{nullptr}; - UILabel *locatingLabel_{nullptr}; - UIImageView *gpsImageView_{nullptr}; - UIImageView *gpsSignalView_{nullptr}; - UIImageView *heartRateImageView_{nullptr}; - UILabel *heartRateLabel_{nullptr}; - UILabelButton *goButton_{nullptr}; - UIImageView *iconImageView_{nullptr}; - time_t startTime_{0}; - bool isOverTime_{false}; -}; -} // namespace OHOS -#endif // SPORT_PREPARE_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPresenter.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPresenter.h deleted file mode 100644 index bad4570b5..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPresenter.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPresenter - * Create: 2025-06-06 - */ - -#ifndef SPORT_PRESENTER_H -#define SPORT_PRESENTER_H - -#include "Presenter.h" - -namespace OHOS { -class SportView; -class SportPresenter : public Presenter {}; -} - -#endif // SPORT_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPromptPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPromptPage.h deleted file mode 100644 index cbd9fefdf..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportPromptPage.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPromptPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_PROMPT_PAGE_H -#define SPORT_PROMPT_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_button.h" -#include "components/ui_image_view.h" -#include "components/ui_view_group.h" -#include "SlicePage.h" -#include "SportPresenter.h" - -namespace OHOS { -const char* SPORT_PROMPT_CANCEL_BUTTON = "sportPromptCancelButton"; -const char* SPORT_PROMPT_CONFIRM_BUTTON = "sportPromptConfirmButton"; - -class SportPromptPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportPromptPage() {} - ~SportPromptPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void CreateUILabel(void); - void CreateUIButton(void); - UIViewGroup *group_{nullptr}; - UIImageView *promptIcon_{nullptr}; - UILabel *promptLabel_{nullptr}; - UIButton *cancelButton_{nullptr}; - UIButton *confirmButton_{nullptr}; -}; -} // namespace OHOS -#endif // SPORT_PROMPT_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindHeartRateItemView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindHeartRateItemView.h deleted file mode 100644 index 12e7d909d..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindHeartRateItemView.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindHeartRateItemView - * Create: 2025-06-06 - */ - -#ifndef SPORT_REMIND_HEART_RATE_ITEM_VIEW_H -#define SPORT_REMIND_HEART_RATE_ITEM_VIEW_H - -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_toggle_button.h" -#include "components/ui_label.h" - -namespace OHOS { -typedef struct { - uint8_t itemId; - int iconId; - const char *label; - const char *viewId; -} SportRemindHeartRateItem; - -class SportRemindHeartRateItemView : public UIViewGroup { -public: - SportRemindHeartRateItemView(); - ~SportRemindHeartRateItemView() override; - - virtual void SetItemInfo(const SportRemindHeartRateItem &itemInfo); - -private: - UIImageView bgImage_; - UIImageView icon_; - UILabel label_; - UILabel hits_; - UIToggleButton button_; - UIImageView nextImage_; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindHeartRatePage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindHeartRatePage.h deleted file mode 100644 index 34ebec7b5..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindHeartRatePage.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindHeartRatePage - * Create: 2025-06-06 - */ - -#ifndef SPORT_REMIND_HEART_RATE_PAGE_H -#define SPORT_REMIND_HEART_RATE_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_simple_list.h" -#include "components/ui_view_group.h" -#include "UiConfig.h" -#include "ui_resource_sport.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" -#include "SportRemindHeartRateItemView.h" - -namespace OHOS { -const char* SPORT_REMIND_HEARTRATE_ITEM_ENABLE = "sportRemindHeartRateItemEnable"; -const char* SPORT_REMIND_HEARTRATE_ITEM_RANGE = "sportRemindHeartRateItemRange"; - -class SportRemindHeartRatePage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportRemindHeartRatePage(); - ~SportRemindHeartRatePage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void CreateUILabel(void); - void CreateUIList(void); - UIViewGroup *group_{nullptr}; - UILabel *titleLabel_{nullptr}; - UISimpleList *remindHeartRateList_{nullptr}; - SportRemindHeartRateItem remindHeartRates_[SPORT_REMIND_HEARTRATE_MAX] = { - {SPORT_REMIND_HEARTRATE_ENABLE, IMAGE_SPORT_HEARTRATE, "心率提醒", SPORT_REMIND_HEARTRATE_ITEM_ENABLE}, - {SPORT_REMIND_HEARTRATE_RANGE, IMAGE_SPORT_HEARTRATE, "心率范围", SPORT_REMIND_HEARTRATE_ITEM_RANGE}}; -}; -} // namespace OHOS -#endif // SPORT_REMIND_HEART_RATE_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindIntervalItemView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindIntervalItemView.h deleted file mode 100644 index 4ad204c9c..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindIntervalItemView.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindIntervalItemView - * Create: 2025-06-06 - */ - -#ifndef SPORT_REMIND_INTERVAL_ITEM_VIEW_H -#define SPORT_REMIND_INTERVAL_ITEM_VIEW_H - -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_label.h" - -namespace OHOS { -typedef struct { - uint8_t itemId; - int iconId; - const char *label; - const char *viewId; -} SportRemindIntervalItem; - -class SportRemindIntervalItemView : public UIViewGroup { -public: - SportRemindIntervalItemView(); - ~SportRemindIntervalItemView() override; - - virtual void SetItemInfo(const SportRemindIntervalItem &itemInfo); - -private: - UIImageView bgImage_; - UIImageView icon_; - UILabel label_; - UIImageView nextImage_; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindIntervalPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindIntervalPage.h deleted file mode 100644 index 08d7f5006..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindIntervalPage.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindIntervalPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_REMIND_INTERVAL_PAGE_H -#define SPORT_REMIND_INTERVAL_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_simple_list.h" -#include "components/ui_image_view.h" -#include "components/ui_scroll_view.h" -#include "SlicePage.h" -#include "ui_resource_sport.h" -#include "SportPresenter.h" -#include "SportModel.h" -#include "SportRemindIntervalItemView.h" - -namespace OHOS { -const char* SPORT_REMIND_INTERVAL_ITEM_DISTANCE = "sportRemindIntervalItemDistance"; -const char* SPORT_REMIND_INTERVAL_ITEM_TIME = "sportRemindIntervalItemTime"; -const char* SPORT_REMIND_INTERVAL_ITEM_NONE = "sportRemindIntervalItemNone"; - -class SportRemindIntervalPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportRemindIntervalPage(); - ~SportRemindIntervalPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void InitBackgroundView(); - void CreateUILabel(void); - void CreateUIList(void); - UIScrollView *group_{nullptr}; - UIImageView *background_{nullptr}; - UILabel *titleLabel_{nullptr}; - UISimpleList *remindIntervalList_{nullptr}; - SportRemindIntervalItem remindIntervals_[SPORT_REMIND_INTERVAL_MAX] = { - {SPORT_REMIND_INTERVAL_DISTANCE, IMAGE_SPORT_DISTANCE, "距离", SPORT_REMIND_INTERVAL_ITEM_DISTANCE}, - {SPORT_REMIND_INTERVAL_TIME, IMAGE_SPORT_TIME, "时间", SPORT_REMIND_INTERVAL_ITEM_TIME}, - {SPORT_REMIND_INTERVAL_NONE, IMAGE_SPORT_NONE, "无提醒", SPORT_REMIND_INTERVAL_ITEM_NONE}}; -}; -} // namespace OHOS -#endif // SPORT_REMIND_INTERVAL_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindItemView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindItemView.h deleted file mode 100644 index 9c3368eb0..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindItemView.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindItemView - * Create: 2025-06-06 - */ - -#ifndef SPORT_REMIND_ITEM_VIEW_H -#define SPORT_REMIND_ITEM_VIEW_H - -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_label.h" - -namespace OHOS { -typedef struct { - uint8_t itemId; - int iconId; - const char *label; - const char *viewId; -} SportRemindItem; - -class SportRemindItemView : public UIViewGroup { -public: - SportRemindItemView(); - ~SportRemindItemView() override; - - virtual void SetItemInfo(const SportRemindItem &itemInfo); - -private: - UIImageView bgImage_; - UIImageView icon_; - UILabel label_; - UILabel hits_; - UIImageView nextImage_; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindPage.h deleted file mode 100644 index 7b5b4d06b..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportRemindPage.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_REMIND_PAGE_H -#define SPORT_REMIND_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_simple_list.h" -#include "components/ui_image_view.h" -#include "components/ui_view_group.h" -#include "SlicePage.h" -#include "ui_resource_sport.h" -#include "SportPresenter.h" -#include "SportModel.h" -#include "SportRemindItemView.h" - -namespace OHOS { -const char* SPORT_REMIND_ITEM_INTERVAL = "sportRemindItemInterval"; -const char* SPORT_REMIND_ITEM_HEARTRATE = "sportRemindItemHeartRate"; - -class SportRemindPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportRemindPage(); - ~SportRemindPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void InitBackgroundView(); - void CreateUILabel(void); - void CreateUIList(void); - UIViewGroup *group_{nullptr}; - UIImageView *background_{nullptr}; - UILabel *titleLabel_{nullptr}; - UISimpleList *remindList_{nullptr}; - SportRemindItem reminds_[SPORT_REMIND_MAX] = { - {SPORT_REMIND_INTERVAL, IMAGE_SPORT_INTERVAL, "间隔提醒", SPORT_REMIND_ITEM_INTERVAL}, - {SPORT_REMIND_HEARTRATE, IMAGE_SPORT_HEARTRATE, "心率提醒", SPORT_REMIND_ITEM_HEARTRATE}}; -}; -} // namespace OHOS -#endif // SPORT_REMIND_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportSettingsItemView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportSettingsItemView.h deleted file mode 100644 index 124719e04..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportSettingsItemView.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportSettingsItemView - * Create: 2025-06-06 - */ - -#ifndef SPORT_SETTINGS_ITEM_VIEW_H -#define SPORT_SETTINGS_ITEM_VIEW_H - -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_label.h" - -namespace OHOS { -typedef struct { - uint8_t itemId; - int iconId; - const char *label; - const char *viewId; -} SportSettingsItem; - -class SportSettingsItemView : public UIViewGroup { -public: - SportSettingsItemView(); - ~SportSettingsItemView() override; - - virtual void SetItemInfo(const SportSettingsItem &itemInfo); - -private: - UIImageView bgImage_; - UIImageView icon_; - UILabel label_; - UILabel hits_; - UIImageView nextImage_; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportSettingsPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportSettingsPage.h deleted file mode 100644 index 50f41dd52..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportSettingsPage.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportSettingsPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_SETTINGS_PAGE_H -#define SPORT_SETTINGS_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_simple_list.h" -#include "components/ui_image_view.h" -#include "components/ui_scroll_view.h" -#include "SlicePage.h" -#include "ui_resource_sport.h" -#include "SportPresenter.h" -#include "SportModel.h" -#include "SportSettingsItemView.h" - -namespace OHOS { -const char* SETTINGS_ITEM_TARGET = "settingsItemTarget"; -const char* SETTINGS_ITEM_REMIND = "settingsItemTargetRemind"; -const char* SETTINGS_ITEM_MISTOUCH = "settingsItemTargetMistouch"; - -class SportSettingsPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportSettingsPage(); - ~SportSettingsPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void InitBackgroundView(); - void CreateUILabel(void); - void CreateUIList(void); - UIScrollView *group_{nullptr}; - UIImageView *background_{nullptr}; - UILabel *titleLabel_{nullptr}; - UISimpleList *settingList_{nullptr}; - SportSettingsItem settings_[SPORT_SET_TYPE_MAX] = { - {SPORT_SET_TYPE_TARGET, IMAGE_SPORT_TARGET, "目标", SETTINGS_ITEM_TARGET}, - {SPORT_SET_TYPE_REMIND, IMAGE_SPORT_REMIND, "提醒", SETTINGS_ITEM_REMIND}, - {SPORT_SET_TYPE_MISTOUCH, IMAGE_SPORT_MISTOUCH, "防误触", SETTINGS_ITEM_MISTOUCH}, - }; -}; -} // namespace OHOS -#endif // SPORT_SETTINGS_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetItemView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetItemView.h deleted file mode 100644 index e36075a3f..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetItemView.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetItemView - * Create: 2025-06-06 - */ - -#ifndef SPORT_TARGET_ITEM_VIEW_H -#define SPORT_TARGET_ITEM_VIEW_H - -#include "components/ui_view_group.h" -#include "components/ui_image_view.h" -#include "components/ui_label.h" - -namespace OHOS { -typedef struct { - uint8_t itemId; - int iconId; - const char *label; - const char *viewId; -} SportTargetItem; - -class SportTargetItemView : public UIViewGroup { -public: - SportTargetItemView(); - ~SportTargetItemView() override; - - virtual void SetItemInfo(const SportTargetItem &itemInfo); - -private: - UIImageView bgImage_; - UIImageView icon_; - UILabel label_; - UIImageView nextImage_; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetPage.h deleted file mode 100644 index 00e7fd885..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetPage.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_TARGET_PAGE_H -#define SPORT_TARGET_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_simple_list.h" -#include "components/ui_image_view.h" -#include "components/ui_scroll_view.h" -#include "SlicePage.h" -#include "ui_resource_sport.h" -#include "SportPresenter.h" -#include "SportModel.h" -#include "SportTargetItemView.h" - -namespace OHOS { -const char* SPORT_TARGET_ITEM_DISTANCE = "sportTargetItemDistance"; -const char* SPORT_TARGET_ITEM_TIME = "sportTargetItemTime"; -const char* SPORT_TARGET_ITEM_CALORIE = "sportTargetItemCalorie"; - -class SportTargetPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportTargetPage(); - ~SportTargetPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void InitBackgroundView(); - void CreateUILabel(void); - void CreateUIList(void); - UIScrollView *group_{nullptr}; - UIImageView *background_{nullptr}; - UILabel *titleLabel_{nullptr}; - UISimpleList *targetList_{nullptr}; - SportTargetItem targets_[SPORT_TARGET_MAX] = { - {SPORT_TARGET_DISTANCE, IMAGE_SPORT_DISTANCE, "距离", SPORT_TARGET_ITEM_DISTANCE}, - {SPORT_TARGET_TIME, IMAGE_SPORT_TIME, "时间", SPORT_TARGET_ITEM_TIME}, - {SPORT_TARGET_CALORIE, IMAGE_SPORT_CALORIE, "热量", SPORT_TARGET_ITEM_CALORIE}}; -}; -} // namespace OHOS -#endif // SPORT_TARGET_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetPromptPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetPromptPage.h deleted file mode 100644 index 964a59077..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetPromptPage.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetPromptPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_TARGET_PROMPT_PAGE_H -#define SPORT_TARGET_PROMPT_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_image_view.h" -#include "components/ui_view_group.h" -#include "animator/animator.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" - -namespace OHOS { - -class SportTargetPromptPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SportTargetPromptPage() {} - ~SportTargetPromptPage(); - void OnStart(void* data) override; - void OnPause() override; - void OnResume() override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void CreatePromptView(void); - class SportPromptAnimatorCallback : public AnimatorCallback { - public: - SportPromptAnimatorCallback(SportTargetPromptPage* page):page_(page) {} - virtual ~SportPromptAnimatorCallback() override {} - void Callback(UIView* view) override; - private: - SportTargetPromptPage* page_{nullptr}; - }; - SportPromptAnimatorCallback* callback_{nullptr}; - Animator* animator_{nullptr}; - UIViewGroup *group_{nullptr}; - UIImageView *promptIcon_{nullptr}; - UILabel *promptLabel_{nullptr}; - time_t startTime_{0}; -}; -} // namespace OHOS -#endif // SPORT_TARGET_PROMPT_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetSettingPage.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetSettingPage.h deleted file mode 100644 index 3fec391f7..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportTargetSettingPage.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetSettingPage - * Create: 2025-06-06 - */ - -#ifndef SPORT_TARGET_SETTING_PAGE_H -#define SPORT_TARGET_SETTING_PAGE_H - -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "components/ui_view_group.h" -#include "components/ui_picker.h" -#include "SlicePage.h" -#include "SportPresenter.h" -#include "SportModel.h" - -namespace OHOS { -const char* TARGET_SETTING_CONFIRM_BUTTON = "targetSettingConfirmButton"; - -class SportTargetSettingPage : public SlicePage, - public UIView::OnClickListener, - public UIView::OnDragListener, - public UIPicker::SelectedListener { -public: - SportTargetSettingPage() {} - ~SportTargetSettingPage(); - void OnStart(void* data) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnClick(UIView& view, const ClickEvent& event) override; -private: - void UpdateViewByTargetType(); - void UpdateViewByRemindType(); - void CreateUILabel(void); - void CreateUIPicker(void); - void CreateUIButton(void); - UIViewGroup *group_{nullptr}; - UILabel *titleLabel_{nullptr}; - UIPicker *picker_{nullptr}; - UILabelButton *confirmButton_{nullptr}; -}; -} // namespace OHOS -#endif // SPORT_TARGET_SETTING_PAGE_H \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportView.h b/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportView.h deleted file mode 100644 index 96bbf81c0..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/include/sport/SportView.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportView - * Create: 2025-06-06 - */ - -#ifndef SPORT_VIEW_H -#define SPORT_VIEW_H - -#include "View.h" - -namespace OHOS { -enum SportPages : uint8_t { - SPORT_PAGE_MENU = 1, - SPORT_PAGE_PREPARE, - SPORT_PAGE_COUNTDOWN, - SPORT_PAGE_DATA, - SPORT_PAGE_PAUSE, - SPORT_PAGE_PROMPT, - SPORT_PAGE_SETTINGS, - SPORT_PAGE_TARGET, - SPORT_PAGE_TARGET_SETTING, - SPORT_PAGE_TARGET_PROMPT, - SPORT_PAGE_REMIND, - SPORT_PAGE_REMIND_INTERVAL, - SPORT_PAGE_REMIND_HEARTRATE, - SPORT_PAGE_HEARTRATE_RANGE, - SPORT_PAGE_MISTOUCH, - SPORT_PAGE_MAX, -}; - -class SportPresenter; -class SportView : public View {}; -} -#endif // SPORT_VIEW_H diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportCountdownPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportCountdownPage.cpp deleted file mode 100644 index f08e4ad7a..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportCountdownPage.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportCountdownPage - * Create: 2025-06-06 - */ - -#include -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportCountdownPage.h" - -namespace OHOS { -static constexpr uint16_t TEXT_X = 164; -static constexpr uint16_t TEXT_Y = 154; -static constexpr uint16_t TEXT_W = 132; -static constexpr uint16_t TEXT_H = 132; -static constexpr uint16_t TEXT_FONT = 120; -static constexpr uint16_t PROCESS_X = 90; -static constexpr uint16_t PROCESS_Y = 90; -static constexpr uint16_t PROCESS_W = 273; -static constexpr uint16_t PROCESS_H = 273; -static constexpr uint16_t PROCESS_CENTER_X = 135; -static constexpr uint16_t PROCESS_CENTER_Y = 135; -static constexpr uint16_t PROCESS_MAX_RANGE = 100; -static constexpr uint16_t PROCESS_RADIUS = 120; -static constexpr uint16_t PROCESS_START_ANGLE = 360; -static constexpr uint16_t PROCESS_LINE_WIDTH = 20; -static constexpr uint16_t COUNTDOWN_TIME = 3; -static constexpr uint32_t MICRO_SECONDS_PER_SECOND = 1000000; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_COUNTDOWN, SportCountdownPage, false); - -void SportCountdownPage::UpdateCountdownView(uint64_t time) -{ - uint8_t reminTime = COUNTDOWN_TIME - (time / MICRO_SECONDS_PER_SECOND); - if (reminTime != 0) { - countdownText_->SetText(std::to_string(reminTime).c_str()); - } - double precent = static_cast(time) / (COUNTDOWN_TIME * MICRO_SECONDS_PER_SECOND); - countdownProgress_->SetValue(precent * PROCESS_MAX_RANGE); -} - -void SportCountdownPage::SportCountdownAnimatorCallback::Callback(UIView *view) -{ - UNUSED(view); - struct timeval currTime = {0}; - gettimeofday(&currTime, nullptr); - uint64_t time = ((uint64_t)currTime.tv_sec * MICRO_SECONDS_PER_SECOND + currTime.tv_usec) - - ((uint64_t)page_->startTime_.tv_sec * MICRO_SECONDS_PER_SECOND + page_->startTime_.tv_usec); - page_->UpdateCountdownView(time); - if (time / MICRO_SECONDS_PER_SECOND >= COUNTDOWN_TIME) { - page_->animator_->Stop(); - SportModel::GetInstance().StartSport(true); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_DATA, - TransitionType::TRANSITION_INVALID, false); - } -} - -SportCountdownPage::~SportCountdownPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (countdownText_ != nullptr) { - delete countdownText_; - countdownText_ = nullptr; - } - if (countdownProgress_ != nullptr) { - delete countdownProgress_; - countdownProgress_ = nullptr; - } - if (animator_ != nullptr) { - delete animator_; - animator_ = nullptr; - } - if (callback_ != nullptr) { - delete callback_; - callback_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportCountdownPage::~SportCountdownPage"); -} - -void SportCountdownPage::OnStart(void *data) -{ - gettimeofday(&startTime_, nullptr); - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportCountdownPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - - countdownText_ = new UILabel(); - if (countdownText_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportCountdownPage countdownText_ new fail"); - return; - } - countdownText_->SetPosition(TEXT_X, TEXT_Y, TEXT_W, TEXT_H); - countdownText_->SetFont(BOLD_VECTOR_FONT_FILENAME, TEXT_FONT); - countdownText_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - group_->Add(countdownText_); - - countdownProgress_ = new UICircleProgress(); - if (countdownProgress_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportCountdownPage new countdownProgress_ fail"); - return; - } - countdownProgress_->SetPosition(PROCESS_X, PROCESS_Y, PROCESS_W, PROCESS_H); - countdownProgress_->SetCenterPosition(PROCESS_CENTER_X, PROCESS_CENTER_Y); - countdownProgress_->SetRange(PROCESS_MAX_RANGE, 0); - countdownProgress_->SetRadius(PROCESS_RADIUS); - countdownProgress_->SetStartAngle(PROCESS_START_ANGLE); - countdownProgress_->SetEndAngle(0); - countdownProgress_->SetForegroundStyle(STYLE_LINE_COLOR, 0xff14d3dd); - countdownProgress_->SetForegroundStyle(STYLE_LINE_WIDTH, PROCESS_LINE_WIDTH); - countdownProgress_->SetBackgroundStyle(STYLE_LINE_COLOR, 0xff549490); - countdownProgress_->SetBackgroundStyle(STYLE_LINE_WIDTH, PROCESS_LINE_WIDTH); - group_->Add(countdownProgress_); - AddViewToPageContainer(group_); - - callback_ = new SportCountdownAnimatorCallback(this); - if (callback_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportCountdownPage::OnStart callback_ new fail"); - return; - } - - animator_ = new Animator(callback_, nullptr, 0, true); - if (animator_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportCountdownPage::OnStart new Animator animator_ fail"); - return; - } -} - -void SportCountdownPage::OnPause() -{ - if (animator_ != nullptr) { - if (animator_->GetState() != Animator::STOP) { - animator_->Stop(); - } - } -} - -void SportCountdownPage::OnResume() -{ - if (animator_ != nullptr) { - if (animator_->GetState() == Animator::STOP) { - animator_->Start(); - } - } -} - -bool SportCountdownPage::OnDrag(UIView &view, const DragEvent &event) -{ - return false; -} - -bool SportCountdownPage::OnClick(UIView &view, const ClickEvent &event) -{ - return false; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportDataPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportDataPage.cpp deleted file mode 100644 index 1b26a0e89..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportDataPage.cpp +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportDataPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "settings/model/SettingPowerModel.h" -#include "sport/SportView.h" -#include "sport/SportDataPage.h" - -namespace OHOS { -static constexpr uint16_t TARGET_HALF = 2; -static constexpr uint16_t NUM_ONE = 1; -static constexpr uint16_t NUM_THOUSAND = 1000; -static constexpr uint16_t BATTERY_LEVEL1 = 10; -static constexpr uint16_t BATTERY_LEVEL2 = 20; -static constexpr uint16_t BATTERY_LEVEL3 = 40; -static constexpr uint16_t BATTERY_LEVEL4 = 70; -static constexpr uint16_t BATTERY_LEVEL5 = 100; -static constexpr uint16_t UNIT_SECS_PER_MIN = 60; -static constexpr uint16_t HAND_POSITION_XPOS = 224; -static constexpr uint16_t HAND_POSITION_YPOS = 4; -static constexpr uint16_t HAND_CENTER_XPOS = 3; -static constexpr uint16_t HAND_CENTER_YPOS = 223; -static constexpr uint16_t HAND_WIDTH = 2; -static constexpr uint16_t HAND_HEIGHT = 5; -static constexpr uint16_t HEARTBEAT_MIN = 116; -static constexpr uint16_t HEARTBEAT_MID = 156; -static constexpr uint16_t HEARTBEAT_MAX = 195; -static constexpr uint16_t HEARTBEAT_CONVERT_UNIT = 600; -static constexpr uint16_t HEARTBEAT_BASE1 = 24000; -static constexpr uint16_t HEARTBEAT_BASE2 = 36000; -static constexpr uint16_t HEARTBEAT_IMAGE_X = 132; -static constexpr uint16_t HEARTBEAT_IMAGE_Y = 174; -static constexpr uint16_t BATTERY_ICON_X = 160; -static constexpr uint16_t BATTERY_ICON_Y = 405; -static constexpr uint16_t BATTERY_LABEL_FONT = 20; -static constexpr uint16_t BATTERY_LABEL_X = 164; -static constexpr uint16_t BATTERY_LABEL_Y = 405; -static constexpr uint16_t BATTERY_LABEL_W = 35; -static constexpr uint16_t BATTERY_LABEL_H = 20; -static constexpr uint16_t TIME_LABEL_FONT = 32; -static constexpr uint16_t TIME_LABEL_X = 219; -static constexpr uint16_t TIME_LABEL_Y = 395; -static constexpr uint16_t TIME_LABEL_W = 84; -static constexpr uint16_t TIME_LABEL_H = 47; -static constexpr uint16_t TOP_VALUE_LABEL_FONT = 100; -static constexpr uint16_t VALUE_LABEL_FONT = 56; -static constexpr uint16_t UNIT_LABEL_FONT = 24; -static constexpr uint16_t TOP_VALUE_LABEL_X = 142; -static constexpr uint16_t TOP_VALUE_LABEL_Y = 73; -static constexpr uint16_t TOP_VALUE_LABEL_W = 172; -static constexpr uint16_t TOP_VALUE_LABEL_H = 100; -static constexpr uint16_t TOP_UNIT_LABEL_X = 160; -static constexpr uint16_t TOP_UNIT_LABEL_Y = 173; -static constexpr uint16_t TOP_UNIT_LABEL_W = 166; -static constexpr uint16_t TOP_UNIT_LABEL_H = 25; -static constexpr uint16_t LEFT_VALUE_LABEL_X = 44; -static constexpr uint16_t LEFT_VALUE_LABEL_Y = 212; -static constexpr uint16_t LEFT_VALUE_LABEL_W = 175; -static constexpr uint16_t LEFT_VALUE_LABEL_H = 56; -static constexpr uint16_t LEFT_UNIT_LABEL_X = 44; -static constexpr uint16_t LEFT_UNIT_LABEL_Y = 272; -static constexpr uint16_t LEFT_UNIT_LABEL_W = 175; -static constexpr uint16_t LEFT_UNIT_LABEL_H = 25; -static constexpr uint16_t RIGHT_VALUE_LABEL_X = 227; -static constexpr uint16_t RIGHT_VALUE_LABEL_Y = 212; -static constexpr uint16_t RIGHT_VALUE_LABEL_W = 175; -static constexpr uint16_t RIGHT_VALUE_LABEL_H = 56; -static constexpr uint16_t RIGHT_UNIT_LABEL_X = 227; -static constexpr uint16_t RIGHT_UNIT_LABEL_Y = 272; -static constexpr uint16_t RIGHT_UNIT_LABEL_W = 175; -static constexpr uint16_t RIGHT_UNIT_LABEL_H = 25; -static constexpr uint16_t BOTTOM_VALUE_LABEL_X = 120; -static constexpr uint16_t BOTTOM_VALUE_LABEL_Y = 309; -static constexpr uint16_t BOTTOM_VALUE_LABEL_W = 221; -static constexpr uint16_t BOTTOM_VALUE_LABEL_H = 56; -static constexpr uint16_t BOTTOM_UNIT_LABEL_X = 205; -static constexpr uint16_t BOTTOM_UNIT_LABEL_Y = 369; -static constexpr uint16_t BOTTOM_UNIT_LABEL_W = 50; -static constexpr uint16_t BOTTOM_UNIT_LABEL_H = 25; -static constexpr uint16_t SEP_LINE_X = 225; -static constexpr uint16_t SEP_LINE_Y = 220; -static constexpr uint16_t SEP_LINE_W = 2; -static constexpr uint16_t SEP_LINE_H = 80; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_DATA, SportDataPage, false); - -void SportDataPage::SportDataAnimatorCallback::Callback(UIView *view) -{ - UNUSED(view); - - uint16_t heartRate = SportModel::GetInstance().GetHeartRate(); - if (heartRate < HEARTBEAT_MIN) { - heartRate = HEARTBEAT_BASE2; - } else if (heartRate < HEARTBEAT_MID) { - heartRate = (heartRate - HEARTBEAT_MIN) * HEARTBEAT_CONVERT_UNIT + HEARTBEAT_BASE2; - } else if (heartRate < HEARTBEAT_MAX) { - heartRate = (heartRate - HEARTBEAT_MID) * HEARTBEAT_CONVERT_UNIT; - } else { - heartRate = HEARTBEAT_BASE1; - } - page_->sweepClock_->SetSweepTime24Hour(0, 0, heartRate); - page_->sweepClock_->Invalidate(); - - std::string currTime = GetCurrentTimeStr(); - page_->timeLabel_->SetText(currTime.c_str()); - page_->timeLabel_->Invalidate(); - - uint8_t battery = SettingPowerModel::GetInstance().GetBatteryPowerLevel(); - page_->batteryLabel_->SetText(std::to_string(battery).c_str()); - page_->batteryLabel_->Invalidate(); - - if (battery < BATTERY_LEVEL1) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY1); - } else if (battery < BATTERY_LEVEL2) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY2); - } else if (battery < BATTERY_LEVEL3) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY3); - } else if (battery < BATTERY_LEVEL4) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY4); - } else if (battery <= BATTERY_LEVEL5) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY5); - } - - page_->UpdateDataViewByType(); - page_->CheckTarget(); - page_->CheckRemind(); -} - -SportDataPage::~SportDataPage() -{ - if (sweepClock_ != nullptr) { - sweepClock_->RemoveAll(); - delete sweepClock_; - sweepClock_ = nullptr; - } - if (timeLabel_ != nullptr) { - delete timeLabel_; - timeLabel_ = nullptr; - } - if (batteryIcon_ != nullptr) { - delete batteryIcon_; - batteryIcon_ = nullptr; - } - if (batteryLabel_ != nullptr) { - delete batteryLabel_; - batteryLabel_ = nullptr; - } - if (heartRateScale_ != nullptr) { - delete heartRateScale_; - heartRateScale_ = nullptr; - } - if (heartRatePointer_ != nullptr) { - delete heartRatePointer_; - heartRatePointer_ = nullptr; - } - if (separateLine_ != nullptr) { - delete separateLine_; - separateLine_ = nullptr; - } - if (topValueLabel_ != nullptr) { - delete topValueLabel_; - topValueLabel_ = nullptr; - } - if (topUnitLabel_ != nullptr) { - delete topUnitLabel_; - topUnitLabel_ = nullptr; - } - if (leftValueLabel_ != nullptr) { - delete leftValueLabel_; - leftValueLabel_ = nullptr; - } - if (leftUnitLabel_ != nullptr) { - delete leftUnitLabel_; - leftUnitLabel_ = nullptr; - } - if (rightValueLabel_ != nullptr) { - delete rightValueLabel_; - rightValueLabel_ = nullptr; - } - if (rightUnitLabel_ != nullptr) { - delete rightUnitLabel_; - rightUnitLabel_ = nullptr; - } - if (bottomValueLabel_ != nullptr) { - delete bottomValueLabel_; - bottomValueLabel_ = nullptr; - } - if (bottomUnitLabel_ != nullptr) { - delete bottomUnitLabel_; - bottomUnitLabel_ = nullptr; - } - if (secondHand_ != nullptr) { - delete secondHand_; - secondHand_ = nullptr; - } - if (animator_ != nullptr) { - delete animator_; - animator_ = nullptr; - } - if (callback_ != nullptr) { - delete callback_; - callback_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportDataPage::~SportDataPage"); -} - -void SportDataPage::InitTimeLableVIew() -{ - timeLabel_ = new UILabel(); - if (timeLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage timeLabel_ new fail"); - return; - } - timeLabel_->SetPosition(TIME_LABEL_X, TIME_LABEL_Y, TIME_LABEL_W, TIME_LABEL_H); - timeLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TIME_LABEL_FONT); - timeLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - sweepClock_->Add(timeLabel_); -} - -void SportDataPage::InitBatteryView() -{ - batteryIcon_ = new UIImageView(); - if (batteryIcon_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage batteryIcon_ new fail"); - return; - } - batteryIcon_->SetPosition(BATTERY_ICON_X, BATTERY_ICON_Y); - batteryIcon_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - sweepClock_->Add(batteryIcon_); - - batteryLabel_ = new UILabel(); - if (batteryLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage batteryLabel_ new fail"); - return; - } - batteryLabel_->SetPosition(BATTERY_LABEL_X, BATTERY_LABEL_Y, BATTERY_LABEL_W, BATTERY_LABEL_H); - batteryLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, BATTERY_LABEL_FONT); - batteryLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - sweepClock_->Add(batteryLabel_); -} - -void SportDataPage::ShowUpHeartRate() -{ - heartRateScale_ = new UIImageView(); - if (heartRateScale_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage heartRateScale_ new fail"); - return; - } - heartRateScale_->SetPosition(0, 0); - LOADIMG::LoadImageViewImg(heartRateScale_, SPORT_IMAGE, IMAGE_SPORT_SCALE); - sweepClock_->Add(heartRateScale_); - - heartRatePointer_ = new UIImageView(); - if (heartRatePointer_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage heartRatePointer_ new fail"); - return; - } - heartRatePointer_->SetPosition(HEARTBEAT_IMAGE_X, HEARTBEAT_IMAGE_Y); - LOADIMG::LoadImageViewImg(heartRatePointer_, SPORT_IMAGE, IMAGE_SPORT_HEART2); - sweepClock_->Add(heartRatePointer_); - - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_CLIMBING) { - heartRatePointer_->SetVisible(false); - } else { - heartRatePointer_->SetVisible(true); - } -} - -void SportDataPage::ShowUpTopView() -{ - topValueLabel_ = new UILabel(); - if (topValueLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage topValueLabel_ new fail"); - return; - } - topValueLabel_->SetPosition(TOP_VALUE_LABEL_X, TOP_VALUE_LABEL_Y, TOP_VALUE_LABEL_W, TOP_VALUE_LABEL_H); - topValueLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - topValueLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TOP_VALUE_LABEL_FONT); - sweepClock_->Add(topValueLabel_); - - topUnitLabel_ = new UILabel(); - if (topUnitLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage topUnitLabel_ new fail"); - return; - } - topUnitLabel_->SetPosition(TOP_UNIT_LABEL_X, TOP_UNIT_LABEL_Y, TOP_UNIT_LABEL_W, TOP_UNIT_LABEL_H); - topUnitLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - topUnitLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, UNIT_LABEL_FONT); - sweepClock_->Add(topUnitLabel_); -} - -void SportDataPage::ShowUpLeftView() -{ - leftValueLabel_ = new UILabel(); - if (leftValueLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage leftValueLabel_ new fail"); - return; - } - leftValueLabel_->SetPosition(LEFT_VALUE_LABEL_X, LEFT_VALUE_LABEL_Y, LEFT_VALUE_LABEL_W, LEFT_VALUE_LABEL_H); - leftValueLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - leftValueLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, VALUE_LABEL_FONT); - sweepClock_->Add(leftValueLabel_); - - leftUnitLabel_ = new UILabel(); - if (leftUnitLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage leftUnitLabel_ new fail"); - return; - } - leftUnitLabel_->SetPosition(LEFT_UNIT_LABEL_X, LEFT_UNIT_LABEL_Y, LEFT_UNIT_LABEL_W, LEFT_UNIT_LABEL_H); - leftUnitLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - leftUnitLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, UNIT_LABEL_FONT); - sweepClock_->Add(leftUnitLabel_); -} - -void SportDataPage::ShowUpRightView() -{ - rightValueLabel_ = new UILabel(); - if (rightValueLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage rightValueLabel_ new fail"); - return; - } - rightValueLabel_->SetPosition(RIGHT_VALUE_LABEL_X, RIGHT_VALUE_LABEL_Y, RIGHT_VALUE_LABEL_W, RIGHT_VALUE_LABEL_H); - rightValueLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - rightValueLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, VALUE_LABEL_FONT); - sweepClock_->Add(rightValueLabel_); - - rightUnitLabel_ = new UILabel(); - if (rightUnitLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage rightUnitLabel_ new fail"); - return; - } - rightUnitLabel_->SetPosition(RIGHT_UNIT_LABEL_X, RIGHT_UNIT_LABEL_Y, RIGHT_UNIT_LABEL_W, RIGHT_UNIT_LABEL_H); - rightUnitLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - rightUnitLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, UNIT_LABEL_FONT); - sweepClock_->Add(rightUnitLabel_); -} - -void SportDataPage::ShowUpBottomView() -{ - bottomValueLabel_ = new UILabel(); - if (bottomValueLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage bottomValueLabel_ new fail"); - return; - } - bottomValueLabel_->SetPosition(BOTTOM_VALUE_LABEL_X, BOTTOM_VALUE_LABEL_Y, BOTTOM_VALUE_LABEL_W, - BOTTOM_VALUE_LABEL_H); - bottomValueLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - bottomValueLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, VALUE_LABEL_FONT); - sweepClock_->Add(bottomValueLabel_); - - bottomUnitLabel_ = new UILabel(); - if (bottomUnitLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage bottomUnitLabel_ new fail"); - return; - } - bottomUnitLabel_->SetPosition(BOTTOM_UNIT_LABEL_X, BOTTOM_UNIT_LABEL_Y, BOTTOM_UNIT_LABEL_W, BOTTOM_UNIT_LABEL_H); - bottomUnitLabel_->SetText("时间"); - bottomUnitLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - bottomUnitLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, UNIT_LABEL_FONT); - sweepClock_->Add(bottomUnitLabel_); -} - -void SportDataPage::ShowUpSeparateLine() -{ - separateLine_ = new UICanvas(); - if (separateLine_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage ShowUpSeparateLine new fail"); - return; - } - separateLine_->SetPosition(SEP_LINE_X, SEP_LINE_Y, SEP_LINE_W, SEP_LINE_H); - separateLine_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); - sweepClock_->Add(separateLine_); -} - -void SportDataPage::OnStart(void *data) -{ - sweepClock_ = new UISweepClock(); - if (sweepClock_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage sweepClock_ new fail"); - return; - } - sweepClock_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - sweepClock_->SetOnDragListener(this); - sweepClock_->SetDraggable(true); - sweepClock_->SetTouchable(true); - - secondHand_ = new Image(); - if (secondHand_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "secondHand new fail"); - return; - } - LOADIMG::LoadImageImg(secondHand_, SPORT_IMAGE, IMAGE_SPORT_TRIANGLE); - sweepClock_->SetHandImage(UISweepClock::HandType::SECOND_HAND, *secondHand_, - {HAND_POSITION_XPOS, HAND_POSITION_YPOS}, {HAND_CENTER_XPOS, HAND_CENTER_YPOS}); - sweepClock_->SetHandLine(UISweepClock::HandType::HOUR_HAND, {HAND_POSITION_XPOS, HAND_POSITION_YPOS}, - {HAND_CENTER_XPOS, HAND_CENTER_YPOS}, Color::White(), HAND_WIDTH, HAND_HEIGHT, - OPA_TRANSPARENT); - sweepClock_->SetHandLine(UISweepClock::HandType::MINUTE_HAND, {HAND_POSITION_XPOS, HAND_POSITION_YPOS}, - {HAND_CENTER_XPOS, HAND_CENTER_YPOS}, Color::White(), HAND_WIDTH, HAND_HEIGHT, - OPA_TRANSPARENT); - sweepClock_->SetWorkMode(UISweepClock::WorkMode::NORMAL); - - ShowUpHeartRate(); - InitTimeLableVIew(); - InitBatteryView(); - ShowUpTopView(); - ShowUpLeftView(); - ShowUpRightView(); - ShowUpBottomView(); - ShowUpSeparateLine(); - AddViewToPageContainer(sweepClock_); - - callback_ = new SportDataAnimatorCallback(this); - if (callback_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage::OnStart callback_ new fail"); - return; - } - - animator_ = new Animator(callback_, nullptr, 0, true); - if (animator_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportDataPage::OnStart new Animator animator_ fail"); - return; - } -} - -void SportDataPage::OnPause() -{ - if (animator_ != nullptr) { - if (animator_->GetState() != Animator::STOP) { - animator_->Stop(); - } - } -} - -void SportDataPage::OnResume() -{ - if (animator_ != nullptr) { - if (animator_->GetState() == Animator::STOP) { - animator_->Start(); - } - } -} - -bool SportDataPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - SportModel::GetInstance().PauseAndReport(true); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_PAUSE, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportDataPage::OnClick(UIView &view, const ClickEvent &event) -{ - return false; -} - -void SportDataPage::UpdateDataViewByType() -{ - uint32_t elapsedTime = SportModel::GetInstance().GetElapsedTime(); - std::string sportTimeStr = FormatSportTime(elapsedTime); - bottomValueLabel_->SetText(sportTimeStr.c_str()); - - SportType sportType = SportModel::GetInstance().GetSportType(); - sport_info_t *sportInfo = SportModel::GetInstance().GetSportInfo(sportType); - if (sportType == SPORT_TYPE_OUTDOOR_RUNNING) { - topValueLabel_->SetText(std::to_string(sportInfo->data.heartRate).c_str()); - topUnitLabel_->SetText("心率(次/分钟)"); - leftValueLabel_->SetText(CalculateSpeed(sportInfo->data.distance, elapsedTime).c_str()); - leftUnitLabel_->SetText("配速(/km)"); - rightValueLabel_->SetText(ConvertDistance(sportInfo->data.distance).c_str()); - rightUnitLabel_->SetText("距离(km)"); - } else if (sportType == SPORT_TYPE_INDOOR_RUNNING) { - topValueLabel_->SetText(std::to_string(sportInfo->data.heartRate).c_str()); - topUnitLabel_->SetText("心率(次/分钟)"); - leftValueLabel_->SetText(CalculateSpeed(sportInfo->data.distance, elapsedTime).c_str()); - leftUnitLabel_->SetText("配速(/km)"); - rightValueLabel_->SetText(ConvertDistance(sportInfo->data.distance).c_str()); - rightUnitLabel_->SetText("距离(km)"); - } else if (sportType == SPORT_TYPE_CYCLING) { - topValueLabel_->SetText(std::to_string(sportInfo->data.heartRate).c_str()); - topUnitLabel_->SetText("心率(次/分钟)"); - leftValueLabel_->SetText(CalculateSpeed(sportInfo->data.distance, elapsedTime).c_str()); - leftUnitLabel_->SetText("配速(/km)"); - rightValueLabel_->SetText(ConvertDistance(sportInfo->data.distance).c_str()); - rightUnitLabel_->SetText("距离(km)"); - } else if (sportType == SPORT_TYPE_CLIMBING) { - topValueLabel_->SetText(std::to_string(sportInfo->data.altitude).c_str()); - topUnitLabel_->SetText("海拔(m)"); - leftValueLabel_->SetText(std::to_string(sportInfo->data.ascent).c_str()); - leftUnitLabel_->SetText("累计上升(m)"); - rightValueLabel_->SetText(std::to_string(sportInfo->data.descent).c_str()); - rightUnitLabel_->SetText("累计下降(m)"); - } else if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - topValueLabel_->SetText(std::to_string(sportInfo->data.heartRate).c_str()); - topUnitLabel_->SetText("心率(次/分钟)"); - leftValueLabel_->SetText(std::to_string(sportInfo->data.calorie).c_str()); - leftUnitLabel_->SetText("热量(kcal)"); - rightValueLabel_->SetText(ConvertDistance(sportInfo->data.distance).c_str()); - rightUnitLabel_->SetText("距离(km)"); - } else if (sportType == SPORT_TYPE_OUTDOOR_SWIMMING) { - topValueLabel_->SetText(std::to_string(sportInfo->data.heartRate).c_str()); - topUnitLabel_->SetText("心率(次/分钟)"); - leftValueLabel_->SetText(std::to_string(sportInfo->data.calorie).c_str()); - leftUnitLabel_->SetText("热量(kcal)"); - rightValueLabel_->SetText(ConvertDistance(sportInfo->data.distance).c_str()); - rightUnitLabel_->SetText("距离(km)"); - } -} - -void SportDataPage::CheckTarget() -{ - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (!sportInfo->isTargetSetted) { - return; - } - if (sportInfo->targetType == SPORT_TARGET_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - if (!sportInfo->targetComplete && sportInfo->data.lap >= sportInfo->targetValue) { - sportInfo->targetComplete = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } else if (!sportInfo->targetHalf && sportInfo->data.lap >= sportInfo->targetValue / TARGET_HALF) { - sportInfo->targetHalf = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } else { - if (!sportInfo->targetComplete && sportInfo->data.distance >= sportInfo->targetValue * NUM_THOUSAND) { - sportInfo->targetComplete = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } else if (!sportInfo->targetHalf && - sportInfo->data.distance >= sportInfo->targetValue * NUM_THOUSAND / TARGET_HALF) { - sportInfo->targetHalf = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } - } else if (sportInfo->targetType == SPORT_TARGET_TIME) { - uint32_t elapsedTime = SportModel::GetInstance().GetElapsedTime(); - if (!sportInfo->targetComplete && elapsedTime >= sportInfo->targetValue * UNIT_SECS_PER_MIN) { - sportInfo->targetComplete = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } else if (!sportInfo->targetHalf && elapsedTime >= sportInfo->targetValue * UNIT_SECS_PER_MIN / TARGET_HALF) { - sportInfo->targetHalf = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } else if (sportInfo->targetType == SPORT_TARGET_CALORIE) { - if (!sportInfo->targetComplete && sportInfo->data.calorie >= sportInfo->targetValue) { - sportInfo->targetComplete = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } else if (!sportInfo->targetHalf && sportInfo->data.calorie >= sportInfo->targetValue / TARGET_HALF) { - sportInfo->targetHalf = true; - sportInfo->promptType = SPORT_SET_TYPE_TARGET; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } -} - -void SportDataPage::CheckRemind() -{ - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->enableHeartRemind) { - if (sportInfo->data.heartRate >= GetHeartRateRangeBounder(sportInfo->heartRange) && - sportInfo->data.heartRate < GetHeartRateRangeBounder(sportInfo->heartRange + NUM_ONE)) { - if (!sportInfo->isHeartReminded) { - sportInfo->isHeartReminded = true; - sportInfo->promptType = SPORT_SET_TYPE_HEARTRATE; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } else { - sportInfo->isHeartReminded = false; - } - } - - if (sportInfo->remindType == SPORT_REMIND_INTERVAL_NONE || !sportInfo->isRemindSetted) { - return; - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - if (sportInfo->data.lap >= (sportInfo->remindTimes + NUM_ONE) * sportInfo->remindValue) { - sportInfo->remindTimes++; - sportInfo->promptType = SPORT_SET_TYPE_REMIND; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } else { - if (sportInfo->data.distance >= - (sportInfo->remindTimes + NUM_ONE) * sportInfo->remindValue * NUM_THOUSAND) { - sportInfo->remindTimes++; - sportInfo->promptType = SPORT_SET_TYPE_REMIND; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_TIME) { - uint32_t elapsedTime = SportModel::GetInstance().GetElapsedTime(); - if (elapsedTime >= (sportInfo->remindTimes + NUM_ONE) * sportInfo->remindValue * UNIT_SECS_PER_MIN) { - sportInfo->remindTimes++; - sportInfo->promptType = SPORT_SET_TYPE_REMIND; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } - } -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportHeartRateRangeItemView.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportHeartRateRangeItemView.cpp deleted file mode 100644 index a516c158d..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportHeartRateRangeItemView.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportHeartRateRangeItemView - * Create: 2025-06-06 - */ - -#include "wearable_log.h" -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "sport/SportModel.h" -#include "sport/SportHeartRateRangeItemView.h" - -namespace OHOS { -static constexpr uint16_t BG_X = 0; -static constexpr uint16_t BG_Y = 6; -static constexpr uint16_t TITLE_X = 39; -static constexpr uint16_t TITLE_Y = 17; -static constexpr uint16_t TITLE_W = 200; -static constexpr uint16_t TITLE_H = 29; -static constexpr uint16_t TITLE_FONT = 24; -static constexpr uint16_t RANGE_X = 39; -static constexpr uint16_t RANGE_Y = 50; -static constexpr uint16_t RANGE_W = 264; -static constexpr uint16_t RANGE_H = 39; -static constexpr uint16_t RANGE_FONT = 32; -static constexpr uint16_t BUTTON_X = 350; -static constexpr uint16_t BUTTON_Y = 32; -static constexpr uint16_t BUTTON_W = 44; -static constexpr uint16_t BUTTON_H = 44; - -SportHeartRateRangeItemView::SportHeartRateRangeItemView() -{ - bgImage_.SetPosition(BG_X, BG_Y); - LOADIMG::LoadImageViewImg(&bgImage_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - - title_.SetPosition(TITLE_X, TITLE_Y, TITLE_W, TITLE_H); - title_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, TITLE_FONT); - title_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - title_.SetStyle(STYLE_TEXT_COLOR, Color::Gray().full); - title_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - range_.SetPosition(RANGE_X, RANGE_Y, RANGE_W, RANGE_H); - range_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, RANGE_FONT); - range_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - range_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - button_.SetPosition(BUTTON_X, BUTTON_Y, BUTTON_W, BUTTON_H); - button_.SetImages(ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_RADIO1, SPORT_IMAGE), - ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_RADIO0, SPORT_IMAGE)); - - Add(&bgImage_); - Add(&title_); - Add(&range_); - Add(&button_); -} - -SportHeartRateRangeItemView::~SportHeartRateRangeItemView() -{ - Remove(&bgImage_); - Remove(&title_); - Remove(&range_); - Remove(&button_); -} - -void SportHeartRateRangeItemView::SetItemInfo(const SportHeartRateRangeItem &itemInfo) -{ - title_.SetText(itemInfo.title); - range_.SetText(GetHeartRateRangeDescription(itemInfo.itemId)); - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->heartRange == itemInfo.itemId) { - button_.SetState(UICheckBox::UICheckBoxState::SELECTED); - } else { - button_.SetState(UICheckBox::UICheckBoxState::UNSELECTED); - } - SetViewId(itemInfo.viewId); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportHeartRateRangePage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportHeartRateRangePage.cpp deleted file mode 100644 index 1200835c0..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportHeartRateRangePage.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportHeartRateRangePage - * Create: 2025-06-06 - */ - -#include "wearable_log.h" -#include "UiConfig.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportPresenter.h" -#include "sport/SportHeartRateRangePage.h" - -namespace OHOS { -static constexpr uint16_t LABELS_X = 100; -static constexpr uint16_t LABELS_Y = 38; -static constexpr uint16_t LABELS_W = 253; -static constexpr uint16_t LABELS_H = 53; -static constexpr uint16_t LABELS_FONT = 38; -static constexpr uint16_t LIST_X = 20; -static constexpr uint16_t LIST_Y = 100; -static constexpr uint16_t LIST_W = 415; -static constexpr uint16_t LIST_H = 485; -static constexpr uint16_t LIST_ITEM_W = 415; -static constexpr uint16_t LIST_ITEM_H = 108; -static constexpr uint16_t REBOUND_SIZE = 60; -static constexpr uint16_t TOP_BLANK_SIZE = 38; -static constexpr uint16_t BOTTOM_BLANK_SIZE = 60; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_HEARTRATE_RANGE, SportHeartRateRangePage, false); - -static SportHeartRateRangePage *g_SportHeartRateRangePageInstance = nullptr; - -static UIView *CreateViewCb(uint8_t type) -{ - SportHeartRateRangeItemView *item = new SportHeartRateRangeItemView(); - if (item == nullptr) { - return nullptr; - } - item->SetPosition(0, 0, LIST_ITEM_W, LIST_ITEM_H); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetTouchable(true); - item->SetOnClickListener(g_SportHeartRateRangePageInstance); - return item; -} - -static void UpdateViewCb(UIView *view, void *data, uint8_t type) -{ - if (view == nullptr || data == nullptr) { - return; - } - SportHeartRateRangeItemView *item = dynamic_cast(view); - if (item == nullptr) { - return; - } - SportHeartRateRangeItem *itemInfo = static_cast(data); - item->SetItemInfo(*itemInfo); -} - -SportHeartRateRangePage::SportHeartRateRangePage() -{ - g_SportHeartRateRangePageInstance = this; -} - -SportHeartRateRangePage::~SportHeartRateRangePage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (heartRateRangeList_ != nullptr) { - delete heartRateRangeList_; - heartRateRangeList_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportHeartRateRangePage::~SportHeartRateRangePage"); -} - -void SportHeartRateRangePage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportHeartRateRangePage titleLabel_ new fail"); - return; - } - titleLabel_->SetPosition(LABELS_X, LABELS_Y, LABELS_W, LABELS_H); - titleLabel_->SetText("心率范围"); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, LABELS_FONT); - group_->Add(titleLabel_); -} - -void SportHeartRateRangePage::CreateUIList() -{ - heartRateRangeList_ = new UISimpleList(); - if (heartRateRangeList_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportHeartRateRangePage heartRateRangeList_ new fail"); - return; - } - heartRateRangeList_->SetPosition(LIST_X, LIST_Y, LIST_W, LIST_H); - heartRateRangeList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - heartRateRangeList_->SetBoundaryIntercept(DragEvent::DIRECTION_TOP_TO_BOTTOM, false); - heartRateRangeList_->SetBoundaryIntercept(DragEvent::DIRECTION_BOTTOM_TO_TOP, false); - - for (uint8_t i = 0; i < SPORT_HEARTRATE_RANGE_MAX; ++i) { - Contents content; - content.createFunc = CreateViewCb; - content.updateFunc = UpdateViewCb; - content.type = 0; - content.data = reinterpret_cast(&heartRateRanges_[i]); - heartRateRangeList_->AddContent(content); - } - heartRateRangeList_->RefreshList(); - group_->Add(heartRateRangeList_); -} - -void SportHeartRateRangePage::OnStart(void *data) -{ - group_ = new UIScrollView(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportHeartRateRangePage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - group_->SetReboundSize(REBOUND_SIZE, UIAbstractScroll::Direction::BOTTOM); - group_->SetScrollBlankSize(TOP_BLANK_SIZE, UIAbstractScroll::Direction::TOP); - group_->SetScrollBlankSize(BOTTOM_BLANK_SIZE, UIAbstractScroll::Direction::BOTTOM); - - CreateUILabel(); - CreateUIList(); - AddViewToPageContainer(group_); -} - -bool SportHeartRateRangePage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND_HEARTRATE, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportHeartRateRangePage::OnClick(UIView &view, const ClickEvent &event) -{ - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (strcmp(view.GetViewId(), SPORT_HEARTRATE_RANGE_ITEM_1) == 0) { - sportInfo->heartRange = SPORT_HEARTRATE_RANGE_ITEM1; - } else if (strcmp(view.GetViewId(), SPORT_HEARTRATE_RANGE_ITEM_2) == 0) { - sportInfo->heartRange = SPORT_HEARTRATE_RANGE_ITEM2; - } else if (strcmp(view.GetViewId(), SPORT_HEARTRATE_RANGE_ITEM_3) == 0) { - sportInfo->heartRange = SPORT_HEARTRATE_RANGE_ITEM3; - } else if (strcmp(view.GetViewId(), SPORT_HEARTRATE_RANGE_ITEM_4) == 0) { - sportInfo->heartRange = SPORT_HEARTRATE_RANGE_ITEM4; - } - heartRateRangeList_->RefreshList(); - SportModel::GetInstance().SaveConfig(SPORT_CONFIG_INFO); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND_HEARTRATE, - TransitionType::TRANSITION_INVALID, false); - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMenuItemView.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMenuItemView.cpp deleted file mode 100644 index f4eb22478..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMenuItemView.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportMenuItemView - * Create: 2025-06-06 - */ - -#include "wearable_log.h" -#include "UiConfig.h" -#include "ui_resource_sport.h" -#include "main/LoadImg.h" -#include "sport/SportMenuItemView.h" - -namespace OHOS { -static constexpr uint16_t BG_X = 0; -static constexpr uint16_t BG_Y = 10; -static constexpr uint16_t ICON_X = 16; -static constexpr uint16_t ICON_Y = 25; -static constexpr uint16_t LABEL_X = 124; -static constexpr uint16_t LABEL_Y = 47; -static constexpr uint16_t LABEL_W = 166; -static constexpr uint16_t LABEL_H = 40; -static constexpr uint16_t LABEL_FONT = 32; -static constexpr uint16_t IMAGE_X = 344; -static constexpr uint16_t IMAGE_Y = 44; - -SportMenuItemView::SportMenuItemView() -{ - bgImage_.SetPosition(BG_X, BG_Y); - - icon_.SetPosition(ICON_X, ICON_Y); - - label_.SetPosition(LABEL_X, LABEL_Y, LABEL_W, LABEL_H); - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - label_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - - LOADIMG::LoadImageViewImg(&settingImage_, SPORT_IMAGE, IMAGE_SPORT_SETTING); - settingImage_.SetPosition(IMAGE_X, IMAGE_Y); - - Add(&bgImage_); - Add(&icon_); - Add(&label_); - Add(&settingImage_); -} - -SportMenuItemView::~SportMenuItemView() -{ - Remove(&bgImage_); - Remove(&icon_); - Remove(&label_); - Remove(&settingImage_); -} - -void SportMenuItemView::SetItemInfo(const SportMenuItem &itemInfo) -{ - LOADIMG::LoadImageViewImg(&bgImage_, SPORT_IMAGE, itemInfo.bgId); - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, itemInfo.iconId); - label_.SetText(itemInfo.label); - SetViewId(itemInfo.viewId); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMenuPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMenuPage.cpp deleted file mode 100644 index f91d3d6a4..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMenuPage.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportMenuPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportMenuPage.h" - -namespace OHOS { -static constexpr uint16_t TITLI_LABEL_FONT = 38; -static constexpr uint16_t TITLI_LABEL_X = 100; -static constexpr uint16_t TITLI_LABEL_Y = 38; -static constexpr uint16_t TITLI_LABEL_W = 253; -static constexpr uint16_t TITLI_LABEL_H = 53; -static constexpr uint16_t LIST_X = 19; -static constexpr uint16_t LIST_Y = 108; -static constexpr uint16_t LIST_W = 415; -static constexpr uint16_t LIST_H = 780; -static constexpr uint16_t LIST_ITEM_W = 415; -static constexpr uint16_t LIST_ITEM_H = 129; -static constexpr uint16_t REBOUND_SIZE = 60; -static constexpr uint16_t BLANK_SIZE = 100; -static constexpr uint16_t SETTINGS_START_XPOS = 364; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_MENU, SportMenuPage, true); - -static SportMenuPage *g_SportMenuPageInstance = nullptr; - -static UIView *CreateViewCb(uint8_t type) -{ - SportMenuItemView *item = new SportMenuItemView(); - if (item == nullptr) { - return nullptr; - } - item->SetPosition(0, 0, LIST_ITEM_W, LIST_ITEM_H); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetTouchable(true); - item->SetOnClickListener(g_SportMenuPageInstance); - return item; -} - -static void UpdateViewCb(UIView *view, void *data, uint8_t type) -{ - if (view == nullptr || data == nullptr) { - return; - } - SportMenuItemView *item = dynamic_cast(view); - if (item == nullptr) { - return; - } - SportMenuItem *itemInfo = static_cast(data); - item->SetItemInfo(*itemInfo); -} - -SportMenuPage::SportMenuPage() -{ - g_SportMenuPageInstance = this; -} - -SportMenuPage::~SportMenuPage() -{ - bool ret = ImageCacheManager::GetInstance().UnloadAllInMultiRes(SPORT_IMAGE); - if (ret == false) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UnloadSportImage fail"); - } - - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (background_ != nullptr) { - delete background_; - background_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (sportList_ != nullptr) { - delete sportList_; - sportList_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportMenuPage::~SportMenuPage"); -} - -void SportMenuPage::InitBackgroundView() -{ - background_ = new UIImageView(); - if (background_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMenuPage background_ new fail"); - return; - } - background_->SetPosition(0, 0); - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG); - group_->Add(background_); -} - -void SportMenuPage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMenuPage titleLabel_ new fail"); - return; - } - - titleLabel_->SetPosition(TITLI_LABEL_X, TITLI_LABEL_Y, TITLI_LABEL_W, TITLI_LABEL_H); - titleLabel_->SetText("运动"); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, TITLI_LABEL_FONT); - group_->Add(titleLabel_); -} - -void SportMenuPage::CreateUIList() -{ - sportList_ = new UISimpleList(); - if (sportList_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMenuPage sportList_ new fail"); - return; - } - - sportList_->SetPosition(LIST_X, LIST_Y, LIST_W, LIST_H); - sportList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - sportList_->SetBoundaryIntercept(DragEvent::DIRECTION_TOP_TO_BOTTOM, false); - sportList_->SetBoundaryIntercept(DragEvent::DIRECTION_BOTTOM_TO_TOP, false); - - for (uint8_t i = 0; i < SPORT_TYPE_MAX; ++i) { - Contents content; - content.createFunc = CreateViewCb; - content.updateFunc = UpdateViewCb; - content.type = 0; - content.data = reinterpret_cast(&sportMenu_[i]); - sportList_->AddContent(content); - } - sportList_->RefreshList(); - group_->Add(sportList_); -} - -void SportMenuPage::OnStart(void *data) -{ - bool ret = ImageCacheManager::GetInstance().LoadAllInMultiRes(SPORT_IMAGE); - if (ret == false) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LoadSportImage fail"); - return; - } - group_ = new UIScrollView(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMenuPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - group_->SetYScrollBarVisible(true); - group_->SetReboundSize(REBOUND_SIZE, UIAbstractScroll::Direction::BOTTOM); - group_->SetScrollBlankSize(BLANK_SIZE, UIAbstractScroll::Direction::BOTTOM); - - InitBackgroundView(); - CreateUILabel(); - CreateUIList(); - AddViewToPageContainer(group_); -} - -bool SportMenuPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().ChangeSliceToApplist(); - } - return true; -} - -bool SportMenuPage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SPORT_ITEM_OUTDOOR_RUNNING) == 0) { - SportModel::GetInstance().SetSportType(SPORT_TYPE_OUTDOOR_RUNNING); - } else if (strcmp(view.GetViewId(), SPORT_ITEM_INDOOR_RUNNING) == 0) { - SportModel::GetInstance().SetSportType(SPORT_TYPE_INDOOR_RUNNING); - } else if (strcmp(view.GetViewId(), SPORT_ITEM_CYCLING) == 0) { - SportModel::GetInstance().SetSportType(SPORT_TYPE_CYCLING); - } else if (strcmp(view.GetViewId(), SPORT_ITEM_CLIMBING) == 0) { - SportModel::GetInstance().SetSportType(SPORT_TYPE_CLIMBING); - } else if (strcmp(view.GetViewId(), SPORT_ITEM_INDOOR_SWIMMING) == 0) { - SportModel::GetInstance().SetSportType(SPORT_TYPE_INDOOR_SWIMMING); - } else if (strcmp(view.GetViewId(), SPORT_ITEM_OUTDOOR_SWIMMING) == 0) { - SportModel::GetInstance().SetSportType(SPORT_TYPE_OUTDOOR_SWIMMING); - } - - bool isSettingClicked = event.GetCurrentPos().x > SETTINGS_START_XPOS ? true : false; - if (isSettingClicked) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_SETTINGS, - TransitionType::TRANSITION_INVALID, false); - } else { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_PREPARE, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMistouchPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMistouchPage.cpp deleted file mode 100644 index f4f8c227e..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportMistouchPage.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportMistouchPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "wearable_log.h" -#include "ui_resource_sport.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportMistouchPage.h" - -namespace OHOS { -static constexpr uint16_t TITLE_X = 100; -static constexpr uint16_t TITLE_Y = 39; -static constexpr uint16_t TITLE_W = 253; -static constexpr uint16_t TITLE_H = 53; -static constexpr uint16_t TITLE_FONT = 38; -static constexpr uint16_t SCREEN_BG_X = 19; -static constexpr uint16_t SCREEN_BG_Y = 107; -static constexpr uint16_t SCREEN_ICON_X = 27; -static constexpr uint16_t SCREEN_ICON_Y = 115; -static constexpr uint16_t SCREEN_TITLE_X = 100; -static constexpr uint16_t SCREEN_TITLE_Y = 134; -static constexpr uint16_t SCREEN_TITLE_W = 222; -static constexpr uint16_t SCREEN_TITLE_H = 39; -static constexpr uint16_t SCREEN_TITLE_FONT = 32; -static constexpr uint16_t SCREEN_BUTTON_X = 323; -static constexpr uint16_t SCREEN_BUTTON_Y = 131; -static constexpr uint16_t SCREEN_BUTTON_W = 82; -static constexpr uint16_t SCREEN_BUTTON_H = 47; -static constexpr uint16_t SCREEN_TEXT_X = 19; -static constexpr uint16_t SCREEN_TEXT_Y = 224; -static constexpr uint16_t SCREEN_TEXT_W = 415; -static constexpr uint16_t SCREEN_TEXT_H = 146; -static constexpr uint16_t SCREEN_TEXT_FONT = 36; -static constexpr uint16_t CROWN_BG_X = 19; -static constexpr uint16_t CROWN_BG_Y = 394; -static constexpr uint16_t CROWN_ICON_X = 27; -static constexpr uint16_t CROWN_ICON_Y = 402; -static constexpr uint16_t CROWN_TITLE_X = 100; -static constexpr uint16_t CROWN_TITLE_Y = 421; -static constexpr uint16_t CROWN_TITLE_W = 222; -static constexpr uint16_t CROWN_TITLE_H = 39; -static constexpr uint16_t CROWN_TITLE_FONT = 32; -static constexpr uint16_t CROWN_BUTTON_X = 323; -static constexpr uint16_t CROWN_BUTTON_Y = 417; -static constexpr uint16_t CROWN_BUTTON_W = 82; -static constexpr uint16_t CROWN_BUTTON_H = 47; -static constexpr uint16_t CROWN_TEXT_X = 19; -static constexpr uint16_t CROWN_TEXT_Y = 510; -static constexpr uint16_t CROWN_TEXT_W = 415; -static constexpr uint16_t CROWN_TEXT_H = 146; -static constexpr uint16_t CROWN_TEXT_FONT = 36; -static constexpr uint16_t REBOUND_SIZE = 60; -static constexpr uint16_t TOP_BLANK_SIZE = 36; -static constexpr uint16_t BOTTOM_BLANK_SIZE = 100; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_MISTOUCH, SportMistouchPage, false); - -SportMistouchPage::~SportMistouchPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (title_ != nullptr) { - delete title_; - title_ = nullptr; - } - if (bgScreen_ != nullptr) { - delete bgScreen_; - bgScreen_ = nullptr; - } - if (imageScreen_ != nullptr) { - delete imageScreen_; - imageScreen_ = nullptr; - } - if (titleScreen_ != nullptr) { - delete titleScreen_; - titleScreen_ = nullptr; - } - if (buttonScreen_ != nullptr) { - delete buttonScreen_; - buttonScreen_ = nullptr; - } - if (textScreen_ != nullptr) { - delete textScreen_; - textScreen_ = nullptr; - } - if (bgCrown_ != nullptr) { - delete bgCrown_; - bgCrown_ = nullptr; - } - if (imageCrown_ != nullptr) { - delete imageCrown_; - imageCrown_ = nullptr; - } - if (titleCrown_ != nullptr) { - delete titleCrown_; - titleCrown_ = nullptr; - } - if (buttonCrown_ != nullptr) { - delete buttonCrown_; - buttonCrown_ = nullptr; - } - if (textCrown_ != nullptr) { - delete textCrown_; - textCrown_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportMistouchPage::~SportMistouchPage"); -} - -void SportMistouchPage::OnStart(void *data) -{ - group_ = new UIScrollView(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - group_->SetElastic(true); - group_->SetYScrollBarVisible(true); - group_->SetReboundSize(REBOUND_SIZE); - group_->SetScrollBlankSize(TOP_BLANK_SIZE, UIAbstractScroll::Direction::TOP); - group_->SetScrollBlankSize(BOTTOM_BLANK_SIZE, UIAbstractScroll::Direction::BOTTOM); - - title_ = new UILabel(); - if (title_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage title_ new fail"); - return; - } - title_->SetPosition(TITLE_X, TITLE_Y, TITLE_W, TITLE_H); - title_->SetText("运动防误触"); - title_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - title_->SetFont(BOLD_VECTOR_FONT_FILENAME, TITLE_FONT); - group_->Add(title_); - - bgScreen_ = new UIImageView(); - if (bgScreen_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage bgScreen_ new fail"); - return; - } - bgScreen_->SetPosition(SCREEN_BG_X, SCREEN_BG_Y); - LOADIMG::LoadImageViewImg(bgScreen_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - group_->Add(bgScreen_); - - buttonScreen_ = new UIToggleButton(); - if (buttonScreen_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage buttonScreen_ new fail"); - return; - } - buttonScreen_->SetPosition(SCREEN_BUTTON_X, SCREEN_BUTTON_Y, SCREEN_BUTTON_W, SCREEN_BUTTON_H); - buttonScreen_->SetViewId(SPORT_MISTOUCH_SCREEN_BUTTON); - buttonScreen_->SetImages(ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_TOGGLE1, SPORT_IMAGE), - ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_TOGGLE0, SPORT_IMAGE)); - buttonScreen_->SetState(false); - buttonScreen_->SetOnClickListener(this); - group_->Add(buttonScreen_); - - titleScreen_ = new UILabel(); - if (titleScreen_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage titleScreen_ new fail"); - return; - } - titleScreen_->SetPosition(SCREEN_TITLE_X, SCREEN_TITLE_Y, SCREEN_TITLE_W, SCREEN_TITLE_H); - titleScreen_->SetText("自动锁定屏幕"); - titleScreen_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleScreen_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, SCREEN_TITLE_FONT); - group_->Add(titleScreen_); - - imageScreen_ = new UIImageView(); - if (imageScreen_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage imageScreen_ new fail"); - return; - } - imageScreen_->SetPosition(SCREEN_ICON_X, SCREEN_ICON_Y); - LOADIMG::LoadImageViewImg(imageScreen_, SPORT_IMAGE, IMAGE_SPORT_SCREEN); - group_->Add(imageScreen_); - - textScreen_ = new UILabel(); - if (textScreen_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage textScreen_ new fail"); - return; - } - textScreen_->SetPosition(SCREEN_TEXT_X, SCREEN_TEXT_Y, SCREEN_TEXT_W, SCREEN_TEXT_H); - textScreen_->SetText("开启后,运动中熄屏将自动锁定屏幕触摸功能,长按表冠可解锁。"); - textScreen_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - textScreen_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - textScreen_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, SCREEN_TEXT_FONT); - group_->Add(textScreen_); - - bgCrown_ = new UIImageView(); - if (bgCrown_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage bgCrown_ new fail"); - return; - } - bgCrown_->SetPosition(CROWN_BG_X, CROWN_BG_Y); - LOADIMG::LoadImageViewImg(bgCrown_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - group_->Add(bgCrown_); - - buttonCrown_ = new UIToggleButton(); - if (buttonCrown_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage buttonCrown_ new fail"); - return; - } - buttonCrown_->SetPosition(CROWN_BUTTON_X, CROWN_BUTTON_Y, CROWN_BUTTON_W, CROWN_BUTTON_H); - buttonCrown_->SetViewId(SPORT_MISTOUCH_CROWN_BUTTON); - buttonCrown_->SetImages(ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_TOGGLE1, SPORT_IMAGE), - ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_TOGGLE0, SPORT_IMAGE)); - buttonCrown_->SetState(false); - buttonCrown_->SetOnClickListener(this); - group_->Add(buttonCrown_); - - titleCrown_ = new UILabel(); - if (titleCrown_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage titleCrown_ new fail"); - return; - } - titleCrown_->SetPosition(CROWN_TITLE_X, CROWN_TITLE_Y, CROWN_TITLE_W, CROWN_TITLE_H); - titleCrown_->SetText("自动锁定表冠"); - titleCrown_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleCrown_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, CROWN_TITLE_FONT); - group_->Add(titleCrown_); - - imageCrown_ = new UIImageView(); - if (imageCrown_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage imageCrown_ new fail"); - return; - } - imageCrown_->SetPosition(CROWN_ICON_X, CROWN_ICON_Y); - LOADIMG::LoadImageViewImg(imageCrown_, SPORT_IMAGE, IMAGE_SPORT_CROWN); - group_->Add(imageCrown_); - - textCrown_ = new UILabel(); - if (textCrown_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportMistouchPage textCrown_ new fail"); - return; - } - textCrown_->SetPosition(CROWN_TEXT_X, CROWN_TEXT_Y, CROWN_TEXT_W, CROWN_TEXT_H); - textCrown_->SetText("开启后,运动中熄屏将自动锁定表冠点按、旋钮功能,长按表冠可解锁。"); - textCrown_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - textCrown_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - textCrown_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, CROWN_TEXT_FONT); - group_->Add(textCrown_); - - AddViewToPageContainer(group_); -} - -bool SportMistouchPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_SETTINGS, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportMistouchPage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SPORT_MISTOUCH_SCREEN_BUTTON) == 0) { - // 暂不支持 - } else if (strcmp(view.GetViewId(), SPORT_MISTOUCH_CROWN_BUTTON) == 0) { - // 暂不支持 - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportModel.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportModel.cpp deleted file mode 100644 index a9c54bf9b..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportModel.cpp +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportModel - * Create: 2025-06-06 - */ - -#include -#include -#include -#include "wearable_log.h" -#include "msg_center_device.h" -#ifdef BUILD_IN_LINUX -#include "localtime.h" -#endif -#include "sport/SportModel.h" - -namespace OHOS { -static constexpr uint16_t NUM_TEN = 10; -static constexpr uint16_t NUM_HUNDRED = 100; -static constexpr uint16_t NUM_THOUSAND = 1000; -static constexpr uint16_t UNIT_SECS_PER_MIN = 60; -static constexpr uint16_t UNIT_SECS_PER_HOUR = 3600; -static const uint16_t COUNT_TIMES = 100; -static const uint16_t DISTANCE_RANGE = 200; -static const uint16_t HEARTRATE_MIN_VALUE = 116; -static const uint16_t HEARTRATE_MAX_VALUE = 195; -static const uint16_t CALORIE_RANGE = 8; -static const uint16_t ALTITUDE_RANGE = 4; -static const uint16_t ASCENT_RANGE = 7; -static const uint16_t DESCENT_RANGE = 6; -static const uint16_t g_targetDistanceValues[] = {1, 3, 5, 7, 10, 15, 20, 25, 30, 40}; // 距离Picker值集,单位为km -static const uint16_t g_targetTimeValues[] = {10, 20, 30, 60, 120, 180, 200}; // 时间Picker值集,单位为分钟 -static const uint16_t g_targetCalorieValues[] = {100, 200, 300, 500, 600, 800, 1000}; // 热量Picker值集,单位为千卡 -static const uint16_t g_targetLapValues[] = {1, 2, 4, 6, 8, 10, 12, 16, 20, 30}; // 室内游泳趟数Picker值集,单位为趟 -static const char *g_remindHeartRateRange[] = {"116-136次/分", "136-156次/分", "156-176次/分", "176-195次/分"}; -static const uint16_t g_heartRateRangeBounder[] = {116, 136, 156, 176, 195}; -static const char *SPORT_INFO_FILE = SPORT_CONFIG_PATH "sport_info.dat"; -static const char *SPORT_RECORD_FILE = SPORT_CONFIG_PATH "sport_record.dat"; - -std::string GetCurrentTimeStr() -{ - struct tm localTime; - time_t seconds = time(nullptr); - localtime_r(&seconds, &localTime); - std::string currTime; - if (localTime.tm_hour < NUM_TEN) { - currTime += "0"; - } - currTime += std::to_string(localTime.tm_hour) + ":"; - if (localTime.tm_min < NUM_TEN) { - currTime += "0"; - } - currTime += std::to_string(localTime.tm_min); - return currTime; -} - -std::string ConvertDistance(uint32_t distance) -{ - std::string distanceStr; - uint32_t distanceIntPart = distance / NUM_THOUSAND; - uint32_t distanceFractionalPart = (distance % NUM_THOUSAND) / NUM_TEN; - if (distanceIntPart > NUM_HUNDRED) { - distanceStr = std::to_string(distanceIntPart); - } else if (distanceIntPart > NUM_TEN) { - distanceStr = std::to_string(distanceIntPart) + "." + std::to_string(distanceFractionalPart / NUM_TEN); - } else { - if (distanceFractionalPart < NUM_TEN) { - distanceStr = std::to_string(distanceIntPart) + ".0" + std::to_string(distanceFractionalPart); - } else { - distanceStr = std::to_string(distanceIntPart) + "." + std::to_string(distanceFractionalPart); - } - } - return distanceStr; -} - -std::string FormatSportTime(uint32_t uiSportTime) -{ - std::string strSportTime; - std::string hours; - std::string minute; - std::string seconds; - uint32_t hour = uiSportTime / UNIT_SECS_PER_HOUR; - uiSportTime %= UNIT_SECS_PER_HOUR; - uint32_t min = uiSportTime / UNIT_SECS_PER_MIN; - uiSportTime %= UNIT_SECS_PER_MIN; - uint32_t sec = uiSportTime; - if (hour >= 0 && hour < NUM_TEN) { - hours = "0" + std::to_string(hour); - } else { - hours = std::to_string(hour); - } - if (min >= 0 && min < NUM_TEN) { - minute = "0" + std::to_string(min); - } else { - minute = std::to_string(min); - } - if (sec >= 0 && sec < NUM_TEN) { - seconds = "0" + std::to_string(sec); - } else { - seconds = std::to_string(sec); - } - strSportTime = hours + ":" + minute + ":" + seconds; - return strSportTime; -} - -std::string CalculateSpeed(uint32_t distance, uint32_t time) -{ - if (distance == 0) { - return "00'00\""; - } - std::string speedStr; - uint64_t speed = time * NUM_THOUSAND / distance; - uint64_t min = speed / UNIT_SECS_PER_MIN; - uint64_t sec = speed % UNIT_SECS_PER_MIN; - speedStr = std::to_string(min) + "'"; - if (sec >= 0 && sec < NUM_TEN) { - speedStr += "0"; - } - speedStr += std::to_string(sec) + "\""; - return speedStr; -} - -const char *GetHeartRateRangeDescription(uint8_t range) -{ - return g_remindHeartRateRange[range]; -} - -uint16_t GetHeartRateRangeBounder(uint8_t index) -{ - return g_heartRateRangeBounder[index]; -} - -#if defined(_WIN32) -void SportModel::SportAnimatorCallback::Callback(UIView *view) -{ - static uint64_t count = 0; - static bool increase = true; - if (count++ % COUNT_TIMES == 0) { - uint32_t randNum = rand(); - uint32_t distance = randNum % DISTANCE_RANGE; - uint16_t calorie = randNum % CALORIE_RANGE; - uint16_t altitude = randNum % ALTITUDE_RANGE; - uint16_t ascent = randNum % ASCENT_RANGE; - uint16_t descent = randNum % DESCENT_RANGE; - - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - sportInfo->data.distance += distance; - if (sportInfo->data.heartRate < HEARTRATE_MIN_VALUE) { - sportInfo->data.heartRate = HEARTRATE_MIN_VALUE; - increase = true; - } - if (sportInfo->data.heartRate > HEARTRATE_MAX_VALUE) { - sportInfo->data.heartRate = HEARTRATE_MAX_VALUE; - increase = false; - } - if (increase) { - sportInfo->data.heartRate++; - } else { - sportInfo->data.heartRate--; - } - sportInfo->data.calorie += calorie; - sportInfo->data.altitude += altitude; - sportInfo->data.ascent += ascent; - sportInfo->data.descent += descent; - sportInfo->data.lap++; - } -} -#else -static void GenerateDataCallback(void *data) -{ - static bool increase = true; - uint32_t randNum = rand(); - uint32_t distance = randNum % DISTANCE_RANGE; - uint16_t calorie = randNum % CALORIE_RANGE; - uint16_t altitude = randNum % ALTITUDE_RANGE; - uint16_t ascent = randNum % ASCENT_RANGE; - uint16_t descent = randNum % DESCENT_RANGE; - - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - sportInfo->data.distance += distance; - if (sportInfo->data.heartRate < HEARTRATE_MIN_VALUE) { - sportInfo->data.heartRate = HEARTRATE_MIN_VALUE; - increase = true; - } - if (sportInfo->data.heartRate > HEARTRATE_MAX_VALUE) { - sportInfo->data.heartRate = HEARTRATE_MAX_VALUE; - increase = false; - } - if (increase) { - sportInfo->data.heartRate++; - } else { - sportInfo->data.heartRate--; - } - sportInfo->data.calorie += calorie; - sportInfo->data.altitude += altitude; - sportInfo->data.ascent += ascent; - sportInfo->data.descent += descent; - sportInfo->data.lap++; - - if (!SportModel::GetInstance().IsStartByWatch()) { - msg_center_send_data(MSGCENTER_CMD_DEVICE, MSGCENTER_TYPE_ID_SPORT_REPORT_DATA, &sportInfo->data, - sizeof(sport_data_t)); - } -} - -void SportModel::InitGenerateSportData() -{ - uint32_t tick = GetOSTick(2000); - generateDataHandle_ = new GraphicTimer(tick, GenerateDataCallback, nullptr, true); - if (generateDataHandle_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportModel::InitGenerateSportData new GraphicTimer failed!!"); - return; - } -} - -void SportModel::StartGenerateSportData() -{ - if (generateDataHandle_ != nullptr) { - bool retTimer = generateDataHandle_->Start(); - if (!retTimer) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartGenerateSportData failed!!"); - if (generateDataHandle_ != nullptr) { - delete generateDataHandle_; - generateDataHandle_ = nullptr; - } - return; - } - } -} - -void SportModel::StopGenerateSportData() -{ - if (generateDataHandle_ != nullptr) { - generateDataHandle_->Stop(); - } -} -#endif - -SportModel::SportModel() -{ - LoadConfig(); -#if defined(_WIN32) - callback_ = new SportAnimatorCallback(); - if (callback_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportModel::SportModel callback_ new fail"); - return; - } - - animator_ = new Animator(callback_, nullptr, 0, true); - if (animator_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportModel::SportModel new Animator animator_ fail"); - return; - } -#else - InitGenerateSportData(); -#endif -} - -SportModel::~SportModel() {} - -SportModel &SportModel::GetInstance() -{ - static SportModel instance; - return instance; -} - -void SportModel::SetSportType(SportType sportType) -{ - curSport_ = sportType; -} - -SportType SportModel::GetSportType(void) -{ - return curSport_; -} - -void SportModel::SetTargetValue(uint16_t index) -{ - SportTarget target = info_[curSport_].targetType; - if (target == SPORT_TARGET_DISTANCE) { - if (curSport_ == SPORT_TYPE_INDOOR_SWIMMING) { - info_[curSport_].targetValue = g_targetLapValues[index]; - } else { - info_[curSport_].targetValue = g_targetDistanceValues[index]; - } - } else if (target == SPORT_TARGET_TIME) { - info_[curSport_].targetValue = g_targetTimeValues[index]; - } else if (target == SPORT_TARGET_CALORIE) { - info_[curSport_].targetValue = g_targetCalorieValues[index]; - } -} - -void SportModel::SetRemindValue(uint16_t index) -{ - SportRemindInterval remind = info_[curSport_].remindType; - if (remind == SPORT_REMIND_INTERVAL_DISTANCE) { - if (curSport_ == SPORT_TYPE_INDOOR_SWIMMING) { - info_[curSport_].remindValue = g_targetLapValues[index]; - } else { - info_[curSport_].remindValue = g_targetDistanceValues[index]; - } - } else if (remind == SPORT_REMIND_INTERVAL_TIME) { - info_[curSport_].remindValue = g_targetTimeValues[index]; - } - info_[curSport_].remindIndex = index; -} - -uint32_t SportModel::GetElapsedTime() -{ - if (state_ == SportState::RUNNING) { - uint32_t now = time(nullptr); - return info_[curSport_].data.elapsedTime + (now - info_[curSport_].startTimeTemp); - } - return info_[curSport_].data.elapsedTime; -} - -void SportModel::SetGpsSignal(GpsSignal gpsSignal) -{ - gpsSignal_ = gpsSignal; -} - -GpsSignal SportModel::GetGpsSignal(void) -{ - return gpsSignal_; -} - -uint16_t SportModel::GetHeartRate(void) -{ - return info_[curSport_].data.heartRate; -} - -sport_info_t *SportModel::GetSportInfo(SportType type) -{ - return &info_[type]; -} - -sport_info_t *SportModel::GetCurrSportInfo() -{ - return GetSportInfo(curSport_); -} - -void SportModel::StartSport(bool startedByWatch) -{ - if (state_ == SportState::STOPPED) { - state_ = SportState::RUNNING; - isStartByWatch_ = startedByWatch; - info_[curSport_].targetHalf = false; - info_[curSport_].targetComplete = false; - info_[curSport_].isHeartReminded = false; - info_[curSport_].remindTimes = 0; - (void)memset_s(&(info_[curSport_].data), sizeof(info_[curSport_].data), 0, sizeof(sport_data_t)); - info_[curSport_].data.startTime = time(nullptr); - info_[curSport_].startTimeTemp = info_[curSport_].data.startTime; -#if defined(_WIN32) - animator_->Start(); -#else - StartGenerateSportData(); -#endif - } -} - -void SportModel::PauseAndReport(bool isReport) -{ - if (state_ == SportState::RUNNING) { - state_ = SportState::PAUSED; - info_[curSport_].data.elapsedTime += time(nullptr) - info_[curSport_].startTimeTemp; -#if defined(_WIN32) - animator_->Stop(); -#else - StopGenerateSportData(); - if (isReport) { - sport_control_t control = {0}; - control.action = static_cast(SPORT_ACTION_PAUSE); - control.type = static_cast(curSport_); - msg_center_send_data(MSGCENTER_CMD_DEVICE, MSGCENTER_TYPE_ID_SPORT_REPORT_ACTION, &control, - sizeof(sport_control_t)); - } -#endif - } -} - -void SportModel::ResumeAndReport(bool isReport) -{ - if (state_ == SportState::PAUSED) { - state_ = SportState::RUNNING; - info_[curSport_].startTimeTemp = time(nullptr); -#if defined(_WIN32) - animator_->Start(); -#else - StartGenerateSportData(); - if (isReport) { - sport_control_t control = {0}; - control.action = static_cast(SPORT_ACTION_RESUME); - control.type = static_cast(curSport_); - msg_center_send_data(MSGCENTER_CMD_DEVICE, MSGCENTER_TYPE_ID_SPORT_REPORT_ACTION, &control, - sizeof(sport_control_t)); - } -#endif - } -} - -void SportModel::StopAndReport(bool isReport) -{ - if (state_ != SportState::STOPPED) { - state_ = SportState::STOPPED; - info_[curSport_].data.type = static_cast(curSport_); - info_[curSport_].data.endTime = time(nullptr); -#if defined(_WIN32) - animator_->Stop(); -#else - StopGenerateSportData(); - if (isReport) { - sport_control_t control = {0}; - control.action = static_cast(SPORT_ACTION_STOP); - control.type = static_cast(curSport_); - msg_center_send_data(MSGCENTER_CMD_DEVICE, MSGCENTER_TYPE_ID_SPORT_REPORT_ACTION, &control, - sizeof(sport_control_t)); - } -#endif - } -} - -bool SportModel::IsStartByWatch() -{ - return isStartByWatch_; -} - -void SportModel::AddRecord() -{ - if (isStartByWatch_) { - records_.push_back(info_[curSport_].data); - } - SaveConfig(SPORT_CONFIG_RECORD); -} - -std::vector &SportModel::GetRecord() -{ - return records_; -} - -void SportModel::ClearRecord() -{ - records_.clear(); - std::remove(SPORT_RECORD_FILE); -} - -void SportModel::LoadConfig() -{ - std::ifstream infoFile(SPORT_INFO_FILE, std::ios::binary); - if (infoFile) { - for (uint8_t i = 0; i < SPORT_TYPE_MAX; i++) { - infoFile.read(reinterpret_cast(&info_[i]), sizeof(sport_info_t)); - } - infoFile.close(); - } - std::ifstream recordFile(SPORT_RECORD_FILE, std::ios::binary); - if (recordFile) { - uint16_t num = 0; - recordFile.read(reinterpret_cast(&num), sizeof(uint16_t)); - for (uint8_t i = 0; i < num; i++) { - sport_data_t data; - recordFile.read(reinterpret_cast(&data), sizeof(sport_data_t)); - records_.push_back(data); - } - recordFile.close(); - } -} - -void SportModel::SaveConfig(uint8_t config) -{ - if (config == SPORT_CONFIG_INFO) { - std::ofstream infoFile(SPORT_INFO_FILE, std::ios::binary); - if (infoFile) { - infoFile.write(reinterpret_cast(&info_), SPORT_TYPE_MAX * sizeof(sport_info_t)); - infoFile.close(); - } - } else if (config == SPORT_CONFIG_RECORD) { - std::ofstream recordFile(SPORT_RECORD_FILE, std::ios::binary); - if (recordFile) { - uint16_t num = records_.size(); - recordFile.write(reinterpret_cast(&num), sizeof(uint16_t)); - for (uint8_t i = 0; i < num; i++) { - recordFile.write(reinterpret_cast(&records_[i]), sizeof(sport_data_t)); - } - recordFile.close(); - } - } -} - -void SportModel::ClearData() -{ - std::remove(SPORT_INFO_FILE); - std::remove(SPORT_RECORD_FILE); -} -} diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPausePage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPausePage.cpp deleted file mode 100644 index 8a490f702..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPausePage.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPausePage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportPausePage.h" - -namespace OHOS { -static constexpr uint16_t NUM_THOUSAND = 1000; -static constexpr uint16_t TIME_LABEL_FONT = 48; -static constexpr uint16_t TIME_LABEL_X = 166; -static constexpr uint16_t TIME_LABEL_Y = 35; -static constexpr uint16_t TIME_LABEL_W = 122; -static constexpr uint16_t TIME_LABEL_H = 48; -static constexpr uint16_t TEXT_LABEL_FONT = 64; -static constexpr uint16_t TEXT_LABEL_X = 130; -static constexpr uint16_t TEXT_LABEL_Y = 151; -static constexpr uint16_t TEXT_LABEL_W = 194; -static constexpr uint16_t TEXT_LABEL_H = 80; -static constexpr uint16_t BUTTON_X1 = 54; -static constexpr uint16_t BUTTON_X2 = 217; -static constexpr uint16_t BUTTON_Y = 250; -static constexpr uint16_t BUTTON_W = 184; -static constexpr uint16_t BUTTON_H = 184; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_PAUSE, SportPausePage, false); - -void SportPausePage::SportPauseAnimatorCallback::Callback(UIView *view) -{ - UILabel *timeLabel = dynamic_cast(view); - if (timeLabel == nullptr) { - return; - } - std::string currTime = GetCurrentTimeStr(); - timeLabel->SetText(currTime.c_str()); - timeLabel->Invalidate(); -} - -SportPausePage::~SportPausePage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (timeLabel_ != nullptr) { - delete timeLabel_; - timeLabel_ = nullptr; - } - if (textLabel_ != nullptr) { - delete textLabel_; - textLabel_ = nullptr; - } - if (continueButton_ != nullptr) { - delete continueButton_; - continueButton_ = nullptr; - } - if (finishButton_ != nullptr) { - delete finishButton_; - finishButton_ = nullptr; - } - if (animator_ != nullptr) { - delete animator_; - animator_ = nullptr; - } - if (callback_ != nullptr) { - delete callback_; - callback_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportPausePage::~SportPausePage"); -} - -void SportPausePage::CreateUILabel() -{ - timeLabel_ = new UILabel(); - if (timeLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPausePage timeLabel_ new fail"); - return; - } - timeLabel_->SetPosition(TIME_LABEL_X, TIME_LABEL_Y, TIME_LABEL_W, TIME_LABEL_H); - timeLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - timeLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TIME_LABEL_FONT); - group_->Add(timeLabel_); - - textLabel_ = new UILabel(); - if (textLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPausePage textLabel_ new fail"); - return; - } - textLabel_->SetPosition(TEXT_LABEL_X, TEXT_LABEL_Y, TEXT_LABEL_W, TEXT_LABEL_H); - textLabel_->SetText("已暂停"); - textLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - textLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEXT_LABEL_FONT); - group_->Add(textLabel_); - - callback_ = new SportPauseAnimatorCallback(); - if (callback_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPausePage::OnStart callback_ new fail"); - return; - } - - animator_ = new Animator(callback_, timeLabel_, 0, true); - if (animator_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPausePage::OnStart new Animator animator_ fail"); - return; - } -} - -void SportPausePage::OnPause() -{ - if (animator_ != nullptr) { - if (animator_->GetState() != Animator::STOP) { - animator_->Stop(); - } - } -} - -void SportPausePage::OnResume() -{ - if (animator_ != nullptr) { - if (animator_->GetState() == Animator::STOP) { - animator_->Start(); - } - } -} - -void SportPausePage::CreateUIButton() -{ - finishButton_ = new UILabelButton(); - if (finishButton_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPausePage finishButton_ new fail"); - return; - } - finishButton_->SetPosition(BUTTON_X1, BUTTON_Y, BUTTON_W, BUTTON_H); - finishButton_->SetViewId(SPORT_PAUSE_FINISH_BUTTON); - finishButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); - finishButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); - finishButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); - LOADIMG::LoadBtnImage(finishButton_, SPORT_IMAGE, IMAGE_SPORT_STOP, IMAGE_SPORT_STOP); - finishButton_->SetOnClickListener(this); - group_->Add(finishButton_); - - continueButton_ = new UILabelButton(); - if (continueButton_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPausePage continueButton_ new fail"); - return; - } - continueButton_->SetPosition(BUTTON_X2, BUTTON_Y, BUTTON_W, BUTTON_H); - continueButton_->SetViewId(SPORT_PAUSE_CONTINUE_BUTTON); - continueButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); - continueButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); - continueButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); - LOADIMG::LoadBtnImage(continueButton_, SPORT_IMAGE, IMAGE_SPORT_START, IMAGE_SPORT_START); - continueButton_->SetOnClickListener(this); - group_->Add(continueButton_); -} - -void SportPausePage::OnStart(void *data) -{ - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPausePage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - - CreateUILabel(); - CreateUIButton(); - AddViewToPageContainer(group_); -} - -bool SportPausePage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - SportModel::GetInstance().ResumeAndReport(true); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_DATA, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportPausePage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SPORT_PAUSE_CONTINUE_BUTTON) == 0) { - SportModel::GetInstance().ResumeAndReport(true); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_DATA, - TransitionType::TRANSITION_INVALID, false); - } else if (strcmp(view.GetViewId(), SPORT_PAUSE_FINISH_BUTTON) == 0) { - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->data.distance < NUM_THOUSAND) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_PROMPT, - TransitionType::TRANSITION_INVALID, false); - } else { - SportModel::GetInstance().StopAndReport(true); - SportModel::GetInstance().AddRecord(); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_MENU, - TransitionType::TRANSITION_INVALID, false); - } - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPreparePage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPreparePage.cpp deleted file mode 100644 index 041bba018..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPreparePage.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPreparePage - * Create: 2025-06-06 - */ - -#include -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "settings/model/SettingPowerModel.h" -#include "sport/SportView.h" -#include "sport/SportPreparePage.h" - -namespace OHOS { -static constexpr uint16_t LOCATING_OVERTIME_SECOND = 2; -static constexpr uint16_t BATTERY_LEVEL1 = 10; -static constexpr uint16_t BATTERY_LEVEL2 = 20; -static constexpr uint16_t BATTERY_LEVEL3 = 40; -static constexpr uint16_t BATTERY_LEVEL4 = 70; -static constexpr uint16_t BATTERY_LEVEL5 = 100; -static constexpr uint16_t HEARTBEAT_IMAGE_X = 351; -static constexpr uint16_t HEARTBEAT_IMAGE_Y = 223; -static constexpr uint16_t HEARTBEAT_LABEL_X = 329; -static constexpr uint16_t HEARTBEAT_LABEL_Y = 182; -static constexpr uint16_t HEARTBEAT_LABEL_W = 102; -static constexpr uint16_t HEARTBEAT_LABEL_H = 48; -static constexpr uint16_t HEARTBEAT_LABEL_FONT = 32; -static constexpr uint16_t BATTERY_ICON_X = 159; -static constexpr uint16_t BATTERY_ICON_Y = 31; -static constexpr uint16_t BATTERY_LABEL_FONT = 20; -static constexpr uint16_t BATTERY_LABEL_X = 163; -static constexpr uint16_t BATTERY_LABEL_Y = 31; -static constexpr uint16_t BATTERY_LABEL_W = 35; -static constexpr uint16_t BATTERY_LABEL_H = 22; -static constexpr uint16_t GPS_X = 48; -static constexpr uint16_t GPS_Y = 225; -static constexpr uint16_t SIGNAL_X = 44; -static constexpr uint16_t SIGNAL_Y = 175; -static constexpr uint16_t TIME_LABEL_FONT = 32; -static constexpr uint16_t TIME_LABEL_X = 214; -static constexpr uint16_t TIME_LABEL_Y = 23; -static constexpr uint16_t TIME_LABEL_W = 82; -static constexpr uint16_t TIME_LABEL_H = 47; -static constexpr uint16_t LOCATING_LABEL_FONT = 32; -static constexpr uint16_t LOCATING_LABEL_X = 165; -static constexpr uint16_t LOCATING_LABEL_Y = 80; -static constexpr uint16_t LOCATING_LABEL_W = 164; -static constexpr uint16_t LOCATING_LABEL_H = 34; -static constexpr uint16_t CENTER_IMAGE_X = 132; -static constexpr uint16_t CENTER_IMAGE_Y = 132; -static constexpr uint16_t GO_BUTTON_X = 63; -static constexpr uint16_t GO_BUTTON_Y = 361; -static constexpr uint16_t GO_BUTTON_W = 328; -static constexpr uint16_t GO_BUTTON_H = 93; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_PREPARE, SportPreparePage, false); - -void SportPreparePage::SportPrepareAnimatorCallback::Callback(UIView *view) -{ - UNUSED(view); - - std::string currTime = GetCurrentTimeStr(); - page_->timeLabel_->SetText(currTime.c_str()); - page_->timeLabel_->Invalidate(); - - uint8_t battery = SettingPowerModel::GetInstance().GetBatteryPowerLevel(); - page_->batteryLabel_->SetText(std::to_string(battery).c_str()); - page_->batteryLabel_->Invalidate(); - - if (battery < BATTERY_LEVEL1) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY1); - } else if (battery < BATTERY_LEVEL2) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY2); - } else if (battery < BATTERY_LEVEL3) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY3); - } else if (battery < BATTERY_LEVEL4) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY4); - } else if (battery <= BATTERY_LEVEL5) { - LOADIMG::LoadImageViewImg(page_->batteryIcon_, SPORT_IMAGE, IMAGE_SPORT_BATTERY5); - } - - time_t now = time(nullptr); - if (!page_->isOverTime_ && (now - page_->startTime_ > LOCATING_OVERTIME_SECOND)) { - page_->isOverTime_ = true; - page_->InitGpsSignalImage(); - } -} - -SportPreparePage::~SportPreparePage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (background_ != nullptr) { - delete background_; - background_ = nullptr; - } - if (timeLabel_ != nullptr) { - delete timeLabel_; - timeLabel_ = nullptr; - } - if (batteryIcon_ != nullptr) { - delete batteryIcon_; - batteryIcon_ = nullptr; - } - if (batteryLabel_ != nullptr) { - delete batteryLabel_; - batteryLabel_ = nullptr; - } - if (gpsImageView_ != nullptr) { - delete gpsImageView_; - gpsImageView_ = nullptr; - } - if (gpsSignalView_ != nullptr) { - delete gpsSignalView_; - gpsSignalView_ = nullptr; - } - if (heartRateImageView_ != nullptr) { - delete heartRateImageView_; - heartRateImageView_ = nullptr; - } - if (heartRateLabel_ != nullptr) { - delete heartRateLabel_; - heartRateLabel_ = nullptr; - } - if (locatingLabel_ != nullptr) { - delete locatingLabel_; - locatingLabel_ = nullptr; - } - if (goButton_ != nullptr) { - delete goButton_; - goButton_ = nullptr; - } - if (iconImageView_ != nullptr) { - delete iconImageView_; - iconImageView_ = nullptr; - } - if (animator_ != nullptr) { - delete animator_; - animator_ = nullptr; - } - if (callback_ != nullptr) { - delete callback_; - callback_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportPreparePage::~SportPreparePage"); -} - -void SportPreparePage::InitGpsSignalImage() -{ - locatingLabel_->SetVisible(false); - LOADIMG::LoadImageViewImg(gpsSignalView_, SPORT_IMAGE, IMAGE_SPORT_SIGNAL2); -} - -void SportPreparePage::InitTimeLableVIew() -{ - timeLabel_ = new UILabel(); - if (timeLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage timeLabel_ new fail"); - return; - } - timeLabel_->SetPosition(TIME_LABEL_X, TIME_LABEL_Y, TIME_LABEL_W, TIME_LABEL_H); - timeLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TIME_LABEL_FONT); - group_->Add(timeLabel_); -} - -void SportPreparePage::InitBatteryView() -{ - batteryIcon_ = new UIImageView(); - if (batteryIcon_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage batteryIcon_ new fail"); - return; - } - batteryIcon_->SetPosition(BATTERY_ICON_X, BATTERY_ICON_Y); - batteryIcon_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - group_->Add(batteryIcon_); - - batteryLabel_ = new UILabel(); - if (batteryLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage batteryLabel_ new fail"); - return; - } - batteryLabel_->SetPosition(BATTERY_LABEL_X, BATTERY_LABEL_Y, BATTERY_LABEL_W, BATTERY_LABEL_H); - batteryLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, BATTERY_LABEL_FONT); - batteryLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - group_->Add(batteryLabel_); -} - -void SportPreparePage::InitCenterView() -{ - iconImageView_ = new UIImageView(); - if (iconImageView_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage iconImageView_ new fail"); - return; - } - iconImageView_->SetPosition(CENTER_IMAGE_X, CENTER_IMAGE_Y); - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_OUTDOOR_RUNNING) { - LOADIMG::LoadImageViewImg(iconImageView_, SPORT_IMAGE, IMAGE_SPORT_OUTDOOR_RUNNING2); - } else if (sportType == SPORT_TYPE_INDOOR_RUNNING) { - LOADIMG::LoadImageViewImg(iconImageView_, SPORT_IMAGE, IMAGE_SPORT_INDOOR_RUNNING2); - } else if (sportType == SPORT_TYPE_CYCLING) { - LOADIMG::LoadImageViewImg(iconImageView_, SPORT_IMAGE, IMAGE_SPORT_CYCLING2); - } else if (sportType == SPORT_TYPE_CLIMBING) { - LOADIMG::LoadImageViewImg(iconImageView_, SPORT_IMAGE, IMAGE_SPORT_CLIMBING2); - } else if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - LOADIMG::LoadImageViewImg(iconImageView_, SPORT_IMAGE, IMAGE_SPORT_INDOOR_SWIMMING2); - } else if (sportType == SPORT_TYPE_OUTDOOR_SWIMMING) { - LOADIMG::LoadImageViewImg(iconImageView_, SPORT_IMAGE, IMAGE_SPORT_OUTDOOR_SWIMMING2); - } - group_->Add(iconImageView_); -} - -void SportPreparePage::InitGPSView() -{ - locatingLabel_ = new UILabel(); - if (locatingLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage locatingLabel_ new fail"); - return; - } - locatingLabel_->SetPosition(LOCATING_LABEL_X, LOCATING_LABEL_Y, LOCATING_LABEL_W, LOCATING_LABEL_H); - locatingLabel_->SetText("定位中..."); - locatingLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LOCATING_LABEL_FONT); - locatingLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - group_->Add(locatingLabel_); - - gpsSignalView_ = new UIImageView(); - if (gpsSignalView_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage gpsSignalView_ new fail"); - return; - } - gpsSignalView_->SetPosition(SIGNAL_X, SIGNAL_Y); - GpsSignal signal = SportModel::GetInstance().GetGpsSignal(); - if (signal == SPORT_GPS_SIGNAL0) { - LOADIMG::LoadImageViewImg(gpsSignalView_, SPORT_IMAGE, IMAGE_SPORT_SIGNAL0); - } else if (signal == SPORT_GPS_SIGNAL1) { - LOADIMG::LoadImageViewImg(gpsSignalView_, SPORT_IMAGE, IMAGE_SPORT_SIGNAL1); - } else if (signal == SPORT_GPS_SIGNAL2) { - LOADIMG::LoadImageViewImg(gpsSignalView_, SPORT_IMAGE, IMAGE_SPORT_SIGNAL2); - } else if (signal == SPORT_GPS_SIGNAL3) { - LOADIMG::LoadImageViewImg(gpsSignalView_, SPORT_IMAGE, IMAGE_SPORT_SIGNAL3); - } - group_->Add(gpsSignalView_); - - gpsImageView_ = new UIImageView(); - if (gpsImageView_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage gpsImageView_ new fail"); - return; - } - gpsImageView_->SetPosition(GPS_X, GPS_Y); - LOADIMG::LoadImageViewImg(gpsImageView_, SPORT_IMAGE, IMAGE_SPORT_GPS); - group_->Add(gpsImageView_); - - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_RUNNING || sportType == SPORT_TYPE_INDOOR_SWIMMING) { - locatingLabel_->SetVisible(false); - gpsSignalView_->SetVisible(false); - gpsImageView_->SetVisible(false); - } else { - locatingLabel_->SetVisible(true); - gpsSignalView_->SetVisible(true); - gpsImageView_->SetVisible(true); - } -} - -void SportPreparePage::InitHeartRateView() -{ - heartRateLabel_ = new UILabel(); - if (heartRateLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage heartRateLabel_ new fail"); - return; - } - heartRateLabel_->SetPosition(HEARTBEAT_LABEL_X, HEARTBEAT_LABEL_Y, HEARTBEAT_LABEL_W, HEARTBEAT_LABEL_H); - heartRateLabel_->SetText("95"); // 桩数据 - heartRateLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, HEARTBEAT_LABEL_FONT); - heartRateLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - group_->Add(heartRateLabel_); - - heartRateImageView_ = new UIImageView(); - if (heartRateImageView_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage heartRateImageView_ new fail"); - return; - } - heartRateImageView_->SetPosition(HEARTBEAT_IMAGE_X, HEARTBEAT_IMAGE_Y); - LOADIMG::LoadImageViewImg(heartRateImageView_, SPORT_IMAGE, IMAGE_SPORT_HEART1); - group_->Add(heartRateImageView_); -} - -void SportPreparePage::InitGoButtonView() -{ - goButton_ = new UILabelButton(); - if (goButton_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage goButton_ new fail"); - return; - } - goButton_->SetPosition(GO_BUTTON_X, GO_BUTTON_Y, GO_BUTTON_W, GO_BUTTON_H); - goButton_->SetViewId(SPORT_PREPARE_GO_BUTTON); - goButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); - goButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); - goButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_OUTDOOR_RUNNING) { - LOADIMG::LoadBtnImage(goButton_, SPORT_IMAGE, IMAGE_SPORT_GO1, IMAGE_SPORT_GO1); - } else if (sportType == SPORT_TYPE_INDOOR_RUNNING) { - LOADIMG::LoadBtnImage(goButton_, SPORT_IMAGE, IMAGE_SPORT_GO2, IMAGE_SPORT_GO2); - } else if (sportType == SPORT_TYPE_CYCLING) { - LOADIMG::LoadBtnImage(goButton_, SPORT_IMAGE, IMAGE_SPORT_GO3, IMAGE_SPORT_GO3); - } else if (sportType == SPORT_TYPE_CLIMBING) { - LOADIMG::LoadBtnImage(goButton_, SPORT_IMAGE, IMAGE_SPORT_GO4, IMAGE_SPORT_GO4); - } else if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - LOADIMG::LoadBtnImage(goButton_, SPORT_IMAGE, IMAGE_SPORT_GO6, IMAGE_SPORT_GO6); - } else if (sportType == SPORT_TYPE_OUTDOOR_SWIMMING) { - LOADIMG::LoadBtnImage(goButton_, SPORT_IMAGE, IMAGE_SPORT_GO5, IMAGE_SPORT_GO5); - } - goButton_->SetOnClickListener(this); - group_->Add(goButton_); -} - -void SportPreparePage::InitBackgroundView() -{ - background_ = new UIImageView(); - if (background_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage background_ new fail"); - return; - } - background_->SetPosition(0, 0); - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_OUTDOOR_RUNNING) { - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG6); - } else if (sportType == SPORT_TYPE_INDOOR_RUNNING) { - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG1); - } else if (sportType == SPORT_TYPE_CYCLING) { - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG4); - } else if (sportType == SPORT_TYPE_CLIMBING) { - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG3); - } else if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG2); - } else if (sportType == SPORT_TYPE_OUTDOOR_SWIMMING) { - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG5); - } - group_->Add(background_); -} - -void SportPreparePage::OnStart(void *data) -{ - startTime_ = time(nullptr); // 用于在 animator 回调中, 模拟显示 '定位中' - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - - InitBackgroundView(); - InitTimeLableVIew(); - InitBatteryView(); - InitCenterView(); - InitGPSView(); - InitHeartRateView(); - InitGoButtonView(); - AddViewToPageContainer(group_); - - callback_ = new SportPrepareAnimatorCallback(this); - if (callback_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage::OnStart callback_ new fail"); - return; - } - - animator_ = new Animator(callback_, nullptr, 0, true); - if (animator_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPreparePage::OnStart new Animator animator_ fail"); - return; - } -} - -void SportPreparePage::OnPause() -{ - if (animator_ != nullptr) { - if (animator_->GetState() != Animator::STOP) { - animator_->Stop(); - } - } -} - -void SportPreparePage::OnResume() -{ - if (animator_ != nullptr) { - if (animator_->GetState() == Animator::STOP) { - animator_->Start(); - } - } -} - -bool SportPreparePage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_MENU, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportPreparePage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SPORT_PREPARE_GO_BUTTON) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_COUNTDOWN, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPresenter.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPresenter.cpp deleted file mode 100644 index b510e8509..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPresenter.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPresenter - * Create: 2025-06-06 - */ - -#include "NativeRegisterManager.h" -#include "sport/SportView.h" -#include "sport/SportPresenter.h" - -namespace OHOS { -REGIST_MENU(VIEW_SPORT, SportView, SportPresenter, SPORT_ICON, SPORT_ICON, "运动"); -} diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPromptPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPromptPage.cpp deleted file mode 100644 index f5d713259..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportPromptPage.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportPromptPage - * Create: 2025-06-06 - */ - -#include "wearable_log.h" -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportModel.h" -#include "sport/SportPromptPage.h" - -namespace OHOS { -static constexpr uint16_t ICON_X = 173; -static constexpr uint16_t ICON_Y = 48; -static constexpr uint16_t LABEL_X = 24; -static constexpr uint16_t LABEL_Y = 177; -static constexpr uint16_t LABEL_W = 405; -static constexpr uint16_t LABEL_H = 100; -static constexpr uint16_t LABEL_FONT = 36; -static constexpr uint16_t BUTTON_X1 = 104; -static constexpr uint16_t BUTTON_X2 = 240; -static constexpr uint16_t BUTTON_Y = 296; -static constexpr uint16_t BUTTON_W = 109; -static constexpr uint16_t BUTTON_H = 109; -static const char *PROMPT_CONTENT = "本次运动距离过短,不会记录数据。是否结束?"; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_PROMPT, SportPromptPage, false); - -SportPromptPage::~SportPromptPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (promptLabel_ != nullptr) { - delete promptLabel_; - promptLabel_ = nullptr; - } - if (promptIcon_ != nullptr) { - delete promptIcon_; - promptIcon_ = nullptr; - } - if (cancelButton_ != nullptr) { - delete cancelButton_; - cancelButton_ = nullptr; - } - if (confirmButton_ != nullptr) { - delete confirmButton_; - confirmButton_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportPromptPage::~SportPromptPage"); -} - -void SportPromptPage::CreateUILabel() -{ - promptIcon_ = new UIImageView(); - if (promptIcon_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPromptPage promptIcon_ new fail"); - return; - } - promptIcon_->SetPosition(ICON_X, ICON_Y); - LOADIMG::LoadImageViewImg(promptIcon_, SPORT_IMAGE, IMAGE_SPORT_FACE); - group_->Add(promptIcon_); - - promptLabel_ = new UILabel(); - if (promptLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPromptPage promptLabel_ new fail"); - return; - } - promptLabel_->SetPosition(LABEL_X, LABEL_Y, LABEL_W, LABEL_H); - promptLabel_->SetText(PROMPT_CONTENT); - promptLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - promptLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - group_->Add(promptLabel_); -} - -void SportPromptPage::CreateUIButton() -{ - cancelButton_ = new UIButton(); - if (cancelButton_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPromptPage cancelButton_ new fail"); - return; - } - cancelButton_->SetPosition(BUTTON_X1, BUTTON_Y, BUTTON_W, BUTTON_H); - cancelButton_->SetViewId(SPORT_PROMPT_CANCEL_BUTTON); - cancelButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); - cancelButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); - cancelButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); - LOADIMG::LoadBtnImage(cancelButton_, SPORT_IMAGE, IMAGE_SPORT_CANCEL, IMAGE_SPORT_CANCEL); - cancelButton_->SetOnClickListener(this); - group_->Add(cancelButton_); - - confirmButton_ = new UIButton(); - if (confirmButton_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPromptPage confirmButton_ new fail"); - return; - } - confirmButton_->SetPosition(BUTTON_X2, BUTTON_Y, BUTTON_W, BUTTON_H); - confirmButton_->SetViewId(SPORT_PROMPT_CONFIRM_BUTTON); - confirmButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); - confirmButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); - confirmButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); - LOADIMG::LoadBtnImage(confirmButton_, SPORT_IMAGE, IMAGE_SPORT_CONFIRM, IMAGE_SPORT_CONFIRM); - confirmButton_->SetOnClickListener(this); - group_->Add(confirmButton_); -} - -void SportPromptPage::OnStart(void *data) -{ - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportPromptPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - - CreateUILabel(); - CreateUIButton(); - AddViewToPageContainer(group_); -} - -bool SportPromptPage::OnDrag(UIView &view, const DragEvent &event) -{ - return true; -} - -bool SportPromptPage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SPORT_PROMPT_CANCEL_BUTTON) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_PAUSE, - TransitionType::TRANSITION_INVALID, false); - } else if (strcmp(view.GetViewId(), SPORT_PROMPT_CONFIRM_BUTTON) == 0) { - SportModel::GetInstance().StopAndReport(true); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_MENU, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindHeartRateItemView.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindHeartRateItemView.cpp deleted file mode 100644 index 071a4edc4..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindHeartRateItemView.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindHeartRateItemView - * Create: 2025-06-06 - */ - -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "UiConfig.h" -#include "sport/SportModel.h" -#include "sport/SportRemindHeartRateItemView.h" - -namespace OHOS { -static constexpr uint16_t BG_X = 0; -static constexpr uint16_t BG_Y = 6; -static constexpr uint16_t ICON_X = 8; -static constexpr uint16_t ICON_Y = 13; -static constexpr uint16_t LABEL_X = 100; -static constexpr uint16_t LABEL_Y = 17; -static constexpr uint16_t LABEL_W = 207; -static constexpr uint16_t LABEL_H = 39; -static constexpr uint16_t LABEL_FONT = 32; -static constexpr uint16_t HITS_X = 100; -static constexpr uint16_t HITS_Y = 60; -static constexpr uint16_t HITS_W = 176; -static constexpr uint16_t HITS_H = 29; -static constexpr uint16_t HITS_FONT = 24; -static constexpr uint16_t IMAGE_X = 370; -static constexpr uint16_t IMAGE_Y = 38; -static constexpr uint16_t BUTTON_X = 304; -static constexpr uint16_t BUTTON_Y = 33; -static constexpr uint16_t BUTTON_W = 81; -static constexpr uint16_t BUTTON_H = 46; - -SportRemindHeartRateItemView::SportRemindHeartRateItemView() -{ - bgImage_.SetPosition(BG_X, BG_Y); - LOADIMG::LoadImageViewImg(&bgImage_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - - icon_.SetPosition(ICON_X, ICON_Y); - - label_.SetPosition(LABEL_X, LABEL_Y, LABEL_W, LABEL_H); - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - label_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - label_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - hits_.SetPosition(HITS_X, HITS_Y, HITS_W, HITS_H); - hits_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, HITS_FONT); - hits_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - hits_.SetStyle(STYLE_TEXT_COLOR, Color::Gray().full); - hits_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - nextImage_.SetPosition(IMAGE_X, IMAGE_Y); - LOADIMG::LoadImageViewImg(&nextImage_, SPORT_IMAGE, IMAGE_SPORT_NEXT); - - button_.SetPosition(BUTTON_X, BUTTON_Y, BUTTON_W, BUTTON_H); - button_.SetImages(ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_TOGGLE1, SPORT_IMAGE), - ImageCacheManager::GetInstance().LoadOneInMultiRes(IMAGE_SPORT_TOGGLE0, SPORT_IMAGE)); - - Add(&bgImage_); - Add(&icon_); - Add(&label_); - Add(&hits_); - Add(&button_); - Add(&nextImage_); -} - -SportRemindHeartRateItemView::~SportRemindHeartRateItemView() -{ - Remove(&bgImage_); - Remove(&icon_); - Remove(&label_); - Remove(&hits_); - Remove(&button_); - Remove(&nextImage_); -} - -void SportRemindHeartRateItemView::SetItemInfo(const SportRemindHeartRateItem &itemInfo) -{ - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, itemInfo.iconId); - label_.SetText(itemInfo.label); - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (itemInfo.itemId == SPORT_REMIND_HEARTRATE_ENABLE) { - button_.SetVisible(true); - button_.SetState(sportInfo->enableHeartRemind); - if (sportInfo->enableHeartRemind) { - hits_.SetText("开启"); - } else { - hits_.SetText("关闭"); - } - nextImage_.SetVisible(false); - } else if (itemInfo.itemId == SPORT_REMIND_HEARTRATE_RANGE) { - button_.SetVisible(false); - nextImage_.SetVisible(true); - hits_.SetText(GetHeartRateRangeDescription(sportInfo->heartRange)); - } - SetViewId(itemInfo.viewId); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindHeartRatePage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindHeartRatePage.cpp deleted file mode 100644 index f8d781397..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindHeartRatePage.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindHeartRatePage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportRemindHeartRatePage.h" - -namespace OHOS { -static constexpr uint16_t LABELS_X = 100; -static constexpr uint16_t LABELS_Y = 38; -static constexpr uint16_t LABELS_W = 253; -static constexpr uint16_t LABELS_H = 53; -static constexpr uint16_t LABELS_FONT = 38; -static constexpr uint16_t LIST_X = 20; -static constexpr uint16_t LIST_Y = 100; -static constexpr uint16_t LIST_W = 415; -static constexpr uint16_t LIST_H = 324; -static constexpr uint16_t LIST_ITEM_W = 415; -static constexpr uint16_t LIST_ITEM_H = 108; -static constexpr uint16_t LIST_REBOUND_SIZE = 60; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_REMIND_HEARTRATE, SportRemindHeartRatePage, false); - -static SportRemindHeartRatePage *g_SportRemindHeartRatePageInstance = nullptr; - -static UIView *CreateViewCb(uint8_t type) -{ - SportRemindHeartRateItemView *item = new SportRemindHeartRateItemView(); - if (item == nullptr) { - return nullptr; - } - item->SetPosition(0, 0, LIST_ITEM_W, LIST_ITEM_H); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetTouchable(true); - item->SetOnClickListener(g_SportRemindHeartRatePageInstance); - return item; -} - -static void UpdateViewCb(UIView *view, void *data, uint8_t type) -{ - if (view == nullptr || data == nullptr) { - return; - } - SportRemindHeartRateItemView *item = dynamic_cast(view); - if (item == nullptr) { - return; - } - SportRemindHeartRateItem *itemInfo = static_cast(data); - item->SetItemInfo(*itemInfo); -} - -SportRemindHeartRatePage::SportRemindHeartRatePage() -{ - g_SportRemindHeartRatePageInstance = this; -} - -SportRemindHeartRatePage::~SportRemindHeartRatePage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (remindHeartRateList_ != nullptr) { - delete remindHeartRateList_; - remindHeartRateList_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportRemindHeartRatePage::~SportRemindHeartRatePage"); -} - -void SportRemindHeartRatePage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindHeartRatePage titleLabel_ new fail"); - return; - } - titleLabel_->SetPosition(LABELS_X, LABELS_Y, LABELS_W, LABELS_H); - titleLabel_->SetText("心率提醒"); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, LABELS_FONT); - group_->Add(titleLabel_); -} - -void SportRemindHeartRatePage::CreateUIList() -{ - remindHeartRateList_ = new UISimpleList(); - if (remindHeartRateList_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindHeartRatePage remindHeartRateList_ new fail"); - return; - } - remindHeartRateList_->SetPosition(LIST_X, LIST_Y, LIST_W, LIST_H); - remindHeartRateList_->SetThrowDrag(true); - remindHeartRateList_->SetDraggable(true); - remindHeartRateList_->SetReboundSize(LIST_REBOUND_SIZE); - remindHeartRateList_->EnableAutoAlign(true); - remindHeartRateList_->SetElastic(true); - remindHeartRateList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - for (uint8_t i = 0; i < SPORT_REMIND_HEARTRATE_MAX; ++i) { - Contents content; - content.createFunc = CreateViewCb; - content.updateFunc = UpdateViewCb; - content.type = 0; - content.data = reinterpret_cast(&remindHeartRates_[i]); - remindHeartRateList_->AddContent(content); - } - remindHeartRateList_->RefreshList(); - group_->Add(remindHeartRateList_); -} - -void SportRemindHeartRatePage::OnStart(void *data) -{ - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindHeartRatePage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - - CreateUILabel(); - CreateUIList(); - AddViewToPageContainer(group_); -} - -bool SportRemindHeartRatePage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportRemindHeartRatePage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SPORT_REMIND_HEARTRATE_ITEM_ENABLE) == 0) { - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - sportInfo->enableHeartRemind = !sportInfo->enableHeartRemind; - remindHeartRateList_->RefreshList(); - SportModel::GetInstance().SaveConfig(SPORT_CONFIG_INFO); - } else if (strcmp(view.GetViewId(), SPORT_REMIND_HEARTRATE_ITEM_RANGE) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_HEARTRATE_RANGE, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindIntervalItemView.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindIntervalItemView.cpp deleted file mode 100644 index aab3e77cf..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindIntervalItemView.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindIntervalItemView - * Create: 2025-06-06 - */ - -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "UiConfig.h" -#include "sport/SportModel.h" -#include "sport/SportRemindIntervalItemView.h" - -namespace OHOS { -static constexpr uint16_t BG_X = 0; -static constexpr uint16_t BG_Y = 6; -static constexpr uint16_t ICON_X = 8; -static constexpr uint16_t ICON_Y = 13; -static constexpr uint16_t LABEL_X = 100; -static constexpr uint16_t LABEL_Y = 31; -static constexpr uint16_t LABEL_W = 179; -static constexpr uint16_t LABEL_H = 37; -static constexpr uint16_t LABEL_FONT = 32; -static constexpr uint16_t IMAGE_X = 370; -static constexpr uint16_t IMAGE_Y = 38; - -SportRemindIntervalItemView::SportRemindIntervalItemView() -{ - bgImage_.SetPosition(BG_X, BG_Y); - LOADIMG::LoadImageViewImg(&bgImage_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - - icon_.SetPosition(ICON_X, ICON_Y); - - label_.SetPosition(LABEL_X, LABEL_Y, LABEL_W, LABEL_H); - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - label_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - label_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - nextImage_.SetPosition(IMAGE_X, IMAGE_Y); - LOADIMG::LoadImageViewImg(&nextImage_, SPORT_IMAGE, IMAGE_SPORT_NEXT); - - Add(&bgImage_); - Add(&icon_); - Add(&label_); - Add(&nextImage_); -} - -SportRemindIntervalItemView::~SportRemindIntervalItemView() -{ - Remove(&bgImage_); - Remove(&icon_); - Remove(&label_); - Remove(&nextImage_); -} - -void SportRemindIntervalItemView::SetItemInfo(const SportRemindIntervalItem &itemInfo) -{ - SportType sportType = SportModel::GetInstance().GetSportType(); - if (itemInfo.itemId == SPORT_REMIND_INTERVAL_DISTANCE && sportType == SPORT_TYPE_INDOOR_SWIMMING) { - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, IMAGE_SPORT_LAP); - label_.SetText("趟数"); - nextImage_.SetVisible(true); - } else { - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, itemInfo.iconId); - label_.SetText(itemInfo.label); - nextImage_.SetVisible(true); - } - if (itemInfo.itemId == SPORT_REMIND_INTERVAL_NONE) { - nextImage_.SetVisible(false); - } - SetViewId(itemInfo.viewId); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindIntervalPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindIntervalPage.cpp deleted file mode 100644 index fb95d8ae3..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindIntervalPage.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindIntervalPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportRemindIntervalPage.h" - -namespace OHOS { -static constexpr uint16_t LABELS_X = 100; -static constexpr uint16_t LABELS_Y = 38; -static constexpr uint16_t LABELS_W = 253; -static constexpr uint16_t LABELS_H = 53; -static constexpr uint16_t LABELS_FONT = 38; -static constexpr uint16_t LIST_X = 20; -static constexpr uint16_t LIST_Y = 100; -static constexpr uint16_t LIST_W = 415; -static constexpr uint16_t LIST_H = 324; -static constexpr uint16_t LIST_ITEM_W = 415; -static constexpr uint16_t LIST_ITEM_H = 108; -static constexpr uint16_t REBOUND_SIZE = 60; -static constexpr uint16_t BLANK_SIZE = 60; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_REMIND_INTERVAL, SportRemindIntervalPage, false); - -static SportRemindIntervalPage *g_SportRemindIntervalPageInstance = nullptr; - -static UIView *CreateViewCb(uint8_t type) -{ - SportRemindIntervalItemView *item = new SportRemindIntervalItemView(); - if (item == nullptr) { - return nullptr; - } - item->SetPosition(0, 0, LIST_ITEM_W, LIST_ITEM_H); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetTouchable(true); - item->SetOnClickListener(g_SportRemindIntervalPageInstance); - return item; -} - -static void UpdateViewCb(UIView *view, void *data, uint8_t type) -{ - if (view == nullptr || data == nullptr) { - return; - } - SportRemindIntervalItemView *item = dynamic_cast(view); - if (item == nullptr) { - return; - } - SportRemindIntervalItem *itemInfo = static_cast(data); - item->SetItemInfo(*itemInfo); -} - -SportRemindIntervalPage::SportRemindIntervalPage() -{ - g_SportRemindIntervalPageInstance = this; -} - -SportRemindIntervalPage::~SportRemindIntervalPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (background_ != nullptr) { - delete background_; - background_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (remindIntervalList_ != nullptr) { - delete remindIntervalList_; - remindIntervalList_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportRemindIntervalPage::~SportRemindIntervalPage"); -} - -void SportRemindIntervalPage::InitBackgroundView() -{ - background_ = new UIImageView(); - if (background_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindIntervalPage background_ new fail"); - return; - } - background_->SetPosition(0, 0); - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG); - group_->Add(background_); -} - -void SportRemindIntervalPage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindIntervalPage titleLabel_ new fail"); - return; - } - titleLabel_->SetPosition(LABELS_X, LABELS_Y, LABELS_W, LABELS_H); - titleLabel_->SetText("间隔提醒"); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, LABELS_FONT); - group_->Add(titleLabel_); -} - -void SportRemindIntervalPage::CreateUIList() -{ - remindIntervalList_ = new UISimpleList(); - if (remindIntervalList_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindIntervalPage remindIntervalList_ new fail"); - return; - } - remindIntervalList_->SetPosition(LIST_X, LIST_Y, LIST_W, LIST_H); - remindIntervalList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - remindIntervalList_->SetBoundaryIntercept(DragEvent::DIRECTION_TOP_TO_BOTTOM, false); - remindIntervalList_->SetBoundaryIntercept(DragEvent::DIRECTION_BOTTOM_TO_TOP, false); - - for (uint8_t i = 0; i < SPORT_REMIND_INTERVAL_MAX; ++i) { - Contents content; - content.createFunc = CreateViewCb; - content.updateFunc = UpdateViewCb; - content.type = 0; - content.data = reinterpret_cast(&remindIntervals_[i]); - remindIntervalList_->AddContent(content); - } - remindIntervalList_->RefreshList(); - group_->Add(remindIntervalList_); -} - -void SportRemindIntervalPage::OnStart(void *data) -{ - group_ = new UIScrollView(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindIntervalPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - group_->SetReboundSize(REBOUND_SIZE, UIAbstractScroll::Direction::BOTTOM); - group_->SetScrollBlankSize(BLANK_SIZE, UIAbstractScroll::Direction::BOTTOM); - - InitBackgroundView(); - CreateUILabel(); - CreateUIList(); - AddViewToPageContainer(group_); -} - -bool SportRemindIntervalPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportRemindIntervalPage::OnClick(UIView &view, const ClickEvent &event) -{ - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (strcmp(view.GetViewId(), SPORT_REMIND_INTERVAL_ITEM_DISTANCE) == 0) { - sportInfo->setType = SPORT_SET_TYPE_REMIND; - sportInfo->remindTypeTemp = sportInfo->remindType; - sportInfo->remindType = SPORT_REMIND_INTERVAL_DISTANCE; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_SETTING, - TransitionType::TRANSITION_INVALID, false); - } else if (strcmp(view.GetViewId(), SPORT_REMIND_INTERVAL_ITEM_TIME) == 0) { - sportInfo->setType = SPORT_SET_TYPE_REMIND; - sportInfo->remindTypeTemp = sportInfo->remindType; - sportInfo->remindType = SPORT_REMIND_INTERVAL_TIME; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_SETTING, - TransitionType::TRANSITION_INVALID, false); - } else if (strcmp(view.GetViewId(), SPORT_REMIND_INTERVAL_ITEM_NONE) == 0) { - sportInfo->remindTypeTemp = sportInfo->remindType; - sportInfo->remindType = SPORT_REMIND_INTERVAL_NONE; - SportModel::GetInstance().SaveConfig(SPORT_CONFIG_INFO); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindItemView.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindItemView.cpp deleted file mode 100644 index fc2276a2b..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindItemView.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindItemView - * Create: 2025-06-06 - */ - -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "UiConfig.h" -#include "sport/SportModel.h" -#include "sport/SportRemindItemView.h" - -namespace OHOS { -static constexpr uint16_t BG_X = 0; -static constexpr uint16_t BG_Y = 6; -static constexpr uint16_t ICON_X = 8; -static constexpr uint16_t ICON_Y = 13; -static constexpr uint16_t LABEL_X = 100; -static constexpr uint16_t LABEL_Y = 17; -static constexpr uint16_t LABEL_W = 207; -static constexpr uint16_t LABEL_H = 39; -static constexpr uint16_t LABEL_FONT = 32; -static constexpr uint16_t HITS_X = 100; -static constexpr uint16_t HITS_Y = 60; -static constexpr uint16_t HITS_W = 176; -static constexpr uint16_t HITS_H = 29; -static constexpr uint16_t HITS_FONT = 24; -static constexpr uint16_t IMAGE_X = 370; -static constexpr uint16_t IMAGE_Y = 38; - -SportRemindItemView::SportRemindItemView() -{ - bgImage_.SetPosition(BG_X, BG_Y); - LOADIMG::LoadImageViewImg(&bgImage_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - - icon_.SetPosition(ICON_X, ICON_Y); - - label_.SetPosition(LABEL_X, LABEL_Y, LABEL_W, LABEL_H); - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - label_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - label_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - hits_.SetPosition(HITS_X, HITS_Y, HITS_W, HITS_H); - hits_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, HITS_FONT); - hits_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - hits_.SetStyle(STYLE_TEXT_COLOR, Color::Gray().full); - hits_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - nextImage_.SetPosition(IMAGE_X, IMAGE_Y); - LOADIMG::LoadImageViewImg(&nextImage_, SPORT_IMAGE, IMAGE_SPORT_NEXT); - - Add(&bgImage_); - Add(&icon_); - Add(&label_); - Add(&hits_); - Add(&nextImage_); -} - -SportRemindItemView::~SportRemindItemView() -{ - Remove(&bgImage_); - Remove(&icon_); - Remove(&label_); - Remove(&hits_); - Remove(&nextImage_); -} - -void SportRemindItemView::SetItemInfo(const SportRemindItem &itemInfo) -{ - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, itemInfo.iconId); - label_.SetText(itemInfo.label); - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (itemInfo.itemId == SPORT_REMIND_INTERVAL) { - if (sportInfo->remindType == SPORT_REMIND_INTERVAL_NONE || !sportInfo->isRemindSetted) { - hits_.SetText("无提醒"); - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - hits_.SetText((std::to_string(sportInfo->remindValue) + "趟").c_str()); - } else { - hits_.SetText((std::to_string(sportInfo->remindValue) + "km").c_str()); - } - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_TIME) { - hits_.SetText((std::to_string(sportInfo->remindValue) + "分钟").c_str()); - } - } else if (itemInfo.itemId == SPORT_REMIND_HEARTRATE) { - if (!sportInfo->enableHeartRemind) { - hits_.SetText("关闭"); - } else { - hits_.SetText("开启"); - } - } - SetViewId(itemInfo.viewId); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindPage.cpp deleted file mode 100644 index 84fe66d2b..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportRemindPage.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportRemindPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportRemindPage.h" - -namespace OHOS { -static constexpr uint16_t LABELS_X = 100; -static constexpr uint16_t LABELS_Y = 38; -static constexpr uint16_t LABELS_W = 253; -static constexpr uint16_t LABELS_H = 53; -static constexpr uint16_t LABELS_FONT = 38; -static constexpr uint16_t LIST_X = 20; -static constexpr uint16_t LIST_Y = 100; -static constexpr uint16_t LIST_W = 415; -static constexpr uint16_t LIST_H = 324; -static constexpr uint16_t LIST_ITEM_W = 415; -static constexpr uint16_t LIST_ITEM_H = 108; -static constexpr uint16_t LIST_REBOUND_SIZE = 60; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_REMIND, SportRemindPage, false); - -static SportRemindPage *g_SportRemindPageInstance = nullptr; - -static UIView *CreateViewCb(uint8_t type) -{ - SportRemindItemView *item = new SportRemindItemView(); - if (item == nullptr) { - return nullptr; - } - item->SetPosition(0, 0, LIST_ITEM_W, LIST_ITEM_H); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetTouchable(true); - item->SetOnClickListener(g_SportRemindPageInstance); - return item; -} - -static void UpdateViewCb(UIView *view, void *data, uint8_t type) -{ - if (view == nullptr || data == nullptr) { - return; - } - SportRemindItemView *item = dynamic_cast(view); - if (item == nullptr) { - return; - } - SportRemindItem *itemInfo = static_cast(data); - item->SetItemInfo(*itemInfo); -} - -SportRemindPage::SportRemindPage() -{ - g_SportRemindPageInstance = this; -} - -SportRemindPage::~SportRemindPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (background_ != nullptr) { - delete background_; - background_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (remindList_ != nullptr) { - delete remindList_; - remindList_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportRemindPage::~SportRemindPage"); -} - -void SportRemindPage::InitBackgroundView() -{ - background_ = new UIImageView(); - if (background_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindPage background_ new fail"); - return; - } - background_->SetPosition(0, 0); - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG); - group_->Add(background_); -} - -void SportRemindPage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindPage titleLabel_ new fail"); - return; - } - titleLabel_->SetPosition(LABELS_X, LABELS_Y, LABELS_W, LABELS_H); - titleLabel_->SetText("提醒"); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, LABELS_FONT); - group_->Add(titleLabel_); -} - -void SportRemindPage::CreateUIList() -{ - remindList_ = new UISimpleList(); - if (remindList_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindPage remindList_ new fail"); - return; - } - remindList_->SetPosition(LIST_X, LIST_Y, LIST_W, LIST_H); - remindList_->SetThrowDrag(true); - remindList_->SetDraggable(true); - remindList_->SetReboundSize(LIST_REBOUND_SIZE); - remindList_->EnableAutoAlign(true); - remindList_->SetElastic(true); - remindList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - for (uint8_t i = 0; i < SPORT_REMIND_MAX; ++i) { - Contents content; - content.createFunc = CreateViewCb; - content.updateFunc = UpdateViewCb; - content.type = 0; - content.data = reinterpret_cast(&reminds_[i]); - remindList_->AddContent(content); - } - remindList_->RefreshList(); - group_->Add(remindList_); -} - -void SportRemindPage::OnStart(void *data) -{ - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportRemindPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - - InitBackgroundView(); - CreateUILabel(); - CreateUIList(); - AddViewToPageContainer(group_); -} - -bool SportRemindPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_SETTINGS, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportRemindPage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SPORT_REMIND_ITEM_INTERVAL) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND_INTERVAL, - TransitionType::TRANSITION_INVALID, false); - } else if (strcmp(view.GetViewId(), SPORT_REMIND_ITEM_HEARTRATE) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND_HEARTRATE, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportSettingsItemView.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportSettingsItemView.cpp deleted file mode 100644 index 0a8a5724d..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportSettingsItemView.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportSettingsItemView - * Create: 2025-06-06 - */ - -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "UiConfig.h" -#include "sport/SportModel.h" -#include "sport/SportSettingsItemView.h" - -namespace OHOS { -static constexpr uint16_t BG_X = 0; -static constexpr uint16_t BG_Y = 6; -static constexpr uint16_t ICON_X = 8; -static constexpr uint16_t ICON_Y = 13; -static constexpr uint16_t LABEL_X = 100; -static constexpr uint16_t LABEL_Y1 = 17; -static constexpr uint16_t LABEL_Y2 = 31; -static constexpr uint16_t LABEL_W = 207; -static constexpr uint16_t LABEL_H = 39; -static constexpr uint16_t LABEL_FONT = 32; -static constexpr uint16_t HITS_X = 100; -static constexpr uint16_t HITS_Y = 60; -static constexpr uint16_t HITS_W = 176; -static constexpr uint16_t HITS_H = 29; -static constexpr uint16_t HITS_FONT = 24; -static constexpr uint16_t IMAGE_X = 370; -static constexpr uint16_t IMAGE_Y = 38; - -SportSettingsItemView::SportSettingsItemView() -{ - bgImage_.SetPosition(BG_X, BG_Y); - LOADIMG::LoadImageViewImg(&bgImage_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - - icon_.SetPosition(ICON_X, ICON_Y); - - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - label_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - label_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - hits_.SetPosition(HITS_X, HITS_Y, HITS_W, HITS_H); - hits_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, HITS_FONT); - hits_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - hits_.SetStyle(STYLE_TEXT_COLOR, Color::Gray().full); - hits_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - nextImage_.SetPosition(IMAGE_X, IMAGE_Y); - LOADIMG::LoadImageViewImg(&nextImage_, SPORT_IMAGE, IMAGE_SPORT_NEXT); - - Add(&bgImage_); - Add(&icon_); - Add(&label_); - Add(&hits_); - Add(&nextImage_); -} - -SportSettingsItemView::~SportSettingsItemView() -{ - Remove(&bgImage_); - Remove(&icon_); - Remove(&label_); - Remove(&hits_); - Remove(&nextImage_); -} - -void SportSettingsItemView::SetItemInfo(const SportSettingsItem &itemInfo) -{ - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, itemInfo.iconId); - label_.SetText(itemInfo.label); - SetViewId(itemInfo.viewId); - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (itemInfo.itemId == SPORT_SET_TYPE_TARGET) { - label_.SetPosition(LABEL_X, LABEL_Y1, LABEL_W, LABEL_H); - hits_.SetVisible(true); - if (!sportInfo->isTargetSetted) { - hits_.SetText("无目标"); - } else if (sportInfo->targetType == SPORT_TARGET_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - hits_.SetText((std::to_string(sportInfo->targetValue) + "趟").c_str()); - } else { - hits_.SetText((std::to_string(sportInfo->targetValue) + "km").c_str()); - } - } else if (sportInfo->targetType == SPORT_TARGET_TIME) { - hits_.SetText((std::to_string(sportInfo->targetValue) + "分钟").c_str()); - } else if (sportInfo->targetType == SPORT_TARGET_CALORIE) { - hits_.SetText((std::to_string(sportInfo->targetValue) + "千卡").c_str()); - } - } else if (itemInfo.itemId == SPORT_SET_TYPE_REMIND) { - label_.SetPosition(LABEL_X, LABEL_Y1, LABEL_W, LABEL_H); - hits_.SetVisible(true); - if (sportInfo->remindType == SPORT_REMIND_INTERVAL_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - hits_.SetText((std::to_string(sportInfo->remindValue) + "趟").c_str()); - } else { - hits_.SetText((std::to_string(sportInfo->remindValue) + "km").c_str()); - } - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_TIME) { - hits_.SetText((std::to_string(sportInfo->remindValue) + "分钟").c_str()); - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_NONE || !sportInfo->isRemindSetted) { - if (sportInfo->enableHeartRemind) { - hits_.SetText(GetHeartRateRangeDescription(sportInfo->heartRange)); - } else { - hits_.SetText("无提醒"); - } - } - } else if (itemInfo.itemId == SPORT_SET_TYPE_MISTOUCH) { - label_.SetPosition(LABEL_X, LABEL_Y2, LABEL_W, LABEL_H); - hits_.SetVisible(false); - } -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportSettingsPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportSettingsPage.cpp deleted file mode 100644 index 8a5c8521b..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportSettingsPage.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportSettingsPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportSettingsPage.h" - -namespace OHOS { -static constexpr uint16_t LABELS_X = 100; -static constexpr uint16_t LABELS_Y = 38; -static constexpr uint16_t LABELS_W = 253; -static constexpr uint16_t LABELS_H = 53; -static constexpr uint16_t LABELS_FONT = 38; -static constexpr uint16_t LIST_X = 20; -static constexpr uint16_t LIST_Y = 100; -static constexpr uint16_t LIST_W = 415; -static constexpr uint16_t LIST_H = 324; -static constexpr uint16_t LIST_ITEM_W = 415; -static constexpr uint16_t LIST_ITEM_H = 108; -static constexpr uint16_t REBOUND_SIZE = 60; -static constexpr uint16_t BLANK_SIZE = 60; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_SETTINGS, SportSettingsPage, false); - -static SportSettingsPage *g_SportSettingsPageInstance = nullptr; - -static UIView *CreateViewCb(uint8_t type) -{ - SportSettingsItemView *item = new SportSettingsItemView(); - if (item == nullptr) { - return nullptr; - } - item->SetPosition(0, 0, LIST_ITEM_W, LIST_ITEM_H); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetTouchable(true); - item->SetOnClickListener(g_SportSettingsPageInstance); - return item; -} - -static void UpdateViewCb(UIView *view, void *data, uint8_t type) -{ - if (view == nullptr || data == nullptr) { - return; - } - SportSettingsItemView *item = dynamic_cast(view); - if (item == nullptr) { - return; - } - SportSettingsItem *itemInfo = static_cast(data); - item->SetItemInfo(*itemInfo); -} - -SportSettingsPage::SportSettingsPage() -{ - g_SportSettingsPageInstance = this; -} - -SportSettingsPage::~SportSettingsPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (background_ != nullptr) { - delete background_; - background_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (settingList_ != nullptr) { - delete settingList_; - settingList_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportSettingsPage::~SportSettingsPage"); -} - -void SportSettingsPage::InitBackgroundView() -{ - background_ = new UIImageView(); - if (background_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportSettingsPage background_ new fail"); - return; - } - background_->SetPosition(0, 0); - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG); - group_->Add(background_); -} - -void SportSettingsPage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportSettingsPage titleLabel_ new fail"); - return; - } - titleLabel_->SetPosition(LABELS_X, LABELS_Y, LABELS_W, LABELS_H); - titleLabel_->SetText("设置"); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, LABELS_FONT); - group_->Add(titleLabel_); -} - -void SportSettingsPage::CreateUIList() -{ - settingList_ = new UISimpleList(); - if (settingList_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportSettingsPage settingList_ new fail"); - return; - } - settingList_->SetPosition(LIST_X, LIST_Y, LIST_W, LIST_H); - settingList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - settingList_->SetBoundaryIntercept(DragEvent::DIRECTION_TOP_TO_BOTTOM, false); - settingList_->SetBoundaryIntercept(DragEvent::DIRECTION_BOTTOM_TO_TOP, false); - - for (uint8_t i = 0; i < SPORT_SET_TYPE_MAX; ++i) { - Contents content; - content.createFunc = CreateViewCb; - content.updateFunc = UpdateViewCb; - content.type = 0; - content.data = reinterpret_cast(&settings_[i]); - settingList_->AddContent(content); - } - settingList_->RefreshList(); - group_->Add(settingList_); -} - -void SportSettingsPage::OnStart(void *data) -{ - group_ = new UIScrollView(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportSettingsPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - group_->SetReboundSize(REBOUND_SIZE, UIAbstractScroll::Direction::BOTTOM); - group_->SetScrollBlankSize(BLANK_SIZE, UIAbstractScroll::Direction::BOTTOM); - - InitBackgroundView(); - CreateUILabel(); - CreateUIList(); - AddViewToPageContainer(group_); -} - -bool SportSettingsPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_MENU, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportSettingsPage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), SETTINGS_ITEM_TARGET) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET, - TransitionType::TRANSITION_INVALID, false); - } else if (strcmp(view.GetViewId(), SETTINGS_ITEM_REMIND) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND, - TransitionType::TRANSITION_INVALID, false); - } else if (strcmp(view.GetViewId(), SETTINGS_ITEM_MISTOUCH) == 0) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_MISTOUCH, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetItemView.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetItemView.cpp deleted file mode 100644 index 2afb6400d..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetItemView.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetItemView - * Create: 2025-06-06 - */ - -#include "wearable_log.h" -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "sport/SportModel.h" -#include "sport/SportTargetItemView.h" - -namespace OHOS { -static constexpr uint16_t BG_X = 0; -static constexpr uint16_t BG_Y = 6; -static constexpr uint16_t ICON_X = 8; -static constexpr uint16_t ICON_Y = 13; -static constexpr uint16_t LABEL_X = 100; -static constexpr uint16_t LABEL_Y = 31; -static constexpr uint16_t LABEL_W = 179; -static constexpr uint16_t LABEL_H = 37; -static constexpr uint16_t LABEL_FONT = 32; -static constexpr uint16_t IMAGE_X = 370; -static constexpr uint16_t IMAGE_Y = 38; - -SportTargetItemView::SportTargetItemView() -{ - bgImage_.SetPosition(BG_X, BG_Y); - LOADIMG::LoadImageViewImg(&bgImage_, SPORT_IMAGE, IMAGE_SPORT_ITEMBG); - - icon_.SetPosition(ICON_X, ICON_Y); - - label_.SetPosition(LABEL_X, LABEL_Y, LABEL_W, LABEL_H); - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - label_.SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); - label_.SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - nextImage_.SetPosition(IMAGE_X, IMAGE_Y); - LOADIMG::LoadImageViewImg(&nextImage_, SPORT_IMAGE, IMAGE_SPORT_NEXT); - - Add(&bgImage_); - Add(&icon_); - Add(&label_); - Add(&nextImage_); -} - -SportTargetItemView::~SportTargetItemView() -{ - Remove(&bgImage_); - Remove(&icon_); - Remove(&label_); - Remove(&nextImage_); -} - -void SportTargetItemView::SetItemInfo(const SportTargetItem &itemInfo) -{ - SportType sportType = SportModel::GetInstance().GetSportType(); - if (itemInfo.itemId == SPORT_TARGET_DISTANCE && sportType == SPORT_TYPE_INDOOR_SWIMMING) { - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, IMAGE_SPORT_LAP); - label_.SetText("趟数"); - } else { - LOADIMG::LoadImageViewImg(&icon_, SPORT_IMAGE, itemInfo.iconId); - label_.SetText(itemInfo.label); - } - SetViewId(itemInfo.viewId); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetPage.cpp deleted file mode 100644 index 91e7843c5..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetPage.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportTargetPage.h" - -namespace OHOS { -static constexpr uint16_t LABELS_X = 100; -static constexpr uint16_t LABELS_Y = 38; -static constexpr uint16_t LABELS_W = 253; -static constexpr uint16_t LABELS_H = 53; -static constexpr uint16_t LABELS_FONT = 38; -static constexpr uint16_t LIST_X = 20; -static constexpr uint16_t LIST_Y = 100; -static constexpr uint16_t LIST_W = 415; -static constexpr uint16_t LIST_H = 324; -static constexpr uint16_t LIST_ITEM_W = 415; -static constexpr uint16_t LIST_ITEM_H = 108; -static constexpr uint16_t REBOUND_SIZE = 60; -static constexpr uint16_t BLANK_SIZE = 60; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_TARGET, SportTargetPage, false); - -static SportTargetPage *g_SportTargetPageInstance = nullptr; - -static UIView *CreateViewCb(uint8_t type) -{ - SportTargetItemView *item = new SportTargetItemView(); - if (item == nullptr) { - return nullptr; - } - item->SetPosition(0, 0, LIST_ITEM_W, LIST_ITEM_H); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetTouchable(true); - item->SetOnClickListener(g_SportTargetPageInstance); - return item; -} - -static void UpdateViewCb(UIView *view, void *data, uint8_t type) -{ - if (view == nullptr || data == nullptr) { - return; - } - SportTargetItemView *item = dynamic_cast(view); - if (item == nullptr) { - return; - } - SportTargetItem *itemInfo = static_cast(data); - item->SetItemInfo(*itemInfo); -} - -SportTargetPage::SportTargetPage() -{ - g_SportTargetPageInstance = this; -} - -SportTargetPage::~SportTargetPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (background_ != nullptr) { - delete background_; - background_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (targetList_ != nullptr) { - delete targetList_; - targetList_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportTargetPage::~SportTargetPage"); -} - -void SportTargetPage::InitBackgroundView() -{ - background_ = new UIImageView(); - if (background_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPage background_ new fail"); - return; - } - background_->SetPosition(0, 0); - LOADIMG::LoadImageViewImg(background_, SPORT_IMAGE, IMAGE_SPORT_BG); - group_->Add(background_); -} - -void SportTargetPage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPage titleLabel_ new fail"); - return; - } - titleLabel_->SetPosition(LABELS_X, LABELS_Y, LABELS_W, LABELS_H); - titleLabel_->SetText("目标"); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, LABELS_FONT); - group_->Add(titleLabel_); -} - -void SportTargetPage::CreateUIList() -{ - targetList_ = new UISimpleList(); - if (targetList_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPage targetList_ new fail"); - return; - } - targetList_->SetPosition(LIST_X, LIST_Y, LIST_W, LIST_H); - targetList_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - targetList_->SetBoundaryIntercept(DragEvent::DIRECTION_TOP_TO_BOTTOM, false); - targetList_->SetBoundaryIntercept(DragEvent::DIRECTION_BOTTOM_TO_TOP, false); - - for (uint8_t i = 0; i < SPORT_TARGET_MAX; ++i) { - Contents content; - content.createFunc = CreateViewCb; - content.updateFunc = UpdateViewCb; - content.type = 0; - content.data = reinterpret_cast(&targets_[i]); - targetList_->AddContent(content); - } - targetList_->RefreshList(); - group_->Add(targetList_); -} - -void SportTargetPage::OnStart(void *data) -{ - group_ = new UIScrollView(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - group_->SetReboundSize(REBOUND_SIZE, UIAbstractScroll::Direction::BOTTOM); - group_->SetScrollBlankSize(BLANK_SIZE, UIAbstractScroll::Direction::BOTTOM); - - InitBackgroundView(); - CreateUILabel(); - CreateUIList(); - AddViewToPageContainer(group_); -} - -bool SportTargetPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_SETTINGS, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportTargetPage::OnClick(UIView &view, const ClickEvent &event) -{ - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - sportInfo->setType = SPORT_SET_TYPE_TARGET; - if (strcmp(view.GetViewId(), SPORT_TARGET_ITEM_DISTANCE) == 0) { - sportInfo->targetTypeTemp = sportInfo->targetType; - sportInfo->targetType = SPORT_TARGET_DISTANCE; - } else if (strcmp(view.GetViewId(), SPORT_TARGET_ITEM_TIME) == 0) { - sportInfo->targetTypeTemp = sportInfo->targetType; - sportInfo->targetType = SPORT_TARGET_TIME; - } else if (strcmp(view.GetViewId(), SPORT_TARGET_ITEM_CALORIE) == 0) { - sportInfo->targetTypeTemp = sportInfo->targetType; - sportInfo->targetType = SPORT_TARGET_CALORIE; - } - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET_SETTING, - TransitionType::TRANSITION_INVALID, false); - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetPromptPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetPromptPage.cpp deleted file mode 100644 index 2c5c21171..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetPromptPage.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetPromptPage - * Create: 2025-06-06 - */ - -#include -#include "wearable_log.h" -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportTargetPromptPage.h" - -namespace OHOS { -static constexpr uint16_t PAGE_VISIBLE_SECOND = 3; -static constexpr uint16_t PROMPT_DISTANCE_INDEX = 0; -static constexpr uint16_t PROMPT_TIME_INDEX = 1; -static constexpr uint16_t PROMPT_LAP_INDEX = 2; -static constexpr uint16_t IMAGE_X = 46; -static constexpr uint16_t IMAGE_Y = 72; -static constexpr uint16_t IMAGE_COMPLETE_X = 85; -static constexpr uint16_t IMAGE_COMPLETE_Y = 32; -static constexpr uint16_t IMAGE_HEART_X = 167; -static constexpr uint16_t IMAGE_HEART_Y = 118; -static constexpr uint16_t LABEL_X = 25; -static constexpr uint16_t LABEL_Y = 250; -static constexpr uint16_t LABEL_W = 404; -static constexpr uint16_t LABEL_H = 49; -static constexpr uint16_t LABEL_FONT = 36; -static const char *PROMPT_HALF_CONTENT = "本次运动目标已完成50%"; -static const char *PROMPT_FINISH_CONTENT = "本次运动目标已完成"; -static const int PROPMT_IMAGES[][10] = { - {IMAGE_SPORT_1KM, IMAGE_SPORT_3KM, IMAGE_SPORT_5KM, IMAGE_SPORT_7KM, IMAGE_SPORT_10KM, IMAGE_SPORT_15KM, - IMAGE_SPORT_20KM, IMAGE_SPORT_25KM, IMAGE_SPORT_30KM, IMAGE_SPORT_40KM}, - {IMAGE_SPORT_10MIN, IMAGE_SPORT_20MIN, IMAGE_SPORT_30MIN, IMAGE_SPORT_60MIN, IMAGE_SPORT_120MIN, IMAGE_SPORT_180MIN, - IMAGE_SPORT_200MIN}, - {IMAGE_SPORT_LAP1, IMAGE_SPORT_LAP2, IMAGE_SPORT_LAP4, IMAGE_SPORT_LAP6, IMAGE_SPORT_LAP8, IMAGE_SPORT_LAP10, - IMAGE_SPORT_LAP12, IMAGE_SPORT_LAP16, IMAGE_SPORT_LAP20, IMAGE_SPORT_LAP30}, -}; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_TARGET_PROMPT, SportTargetPromptPage, false); - -void SportTargetPromptPage::SportPromptAnimatorCallback::Callback(UIView *view) -{ - UNUSED(view); - - time_t now = time(nullptr); - if (now - page_->startTime_ > PAGE_VISIBLE_SECOND) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_DATA, - TransitionType::TRANSITION_INVALID, false); - } -} - -SportTargetPromptPage::~SportTargetPromptPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (promptIcon_ != nullptr) { - delete promptIcon_; - promptIcon_ = nullptr; - } - if (promptLabel_ != nullptr) { - delete promptLabel_; - promptLabel_ = nullptr; - } - if (animator_ != nullptr) { - delete animator_; - animator_ = nullptr; - } - if (callback_ != nullptr) { - delete callback_; - callback_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportTargetPromptPage::~SportTargetPromptPage"); -} - -void SportTargetPromptPage::CreatePromptView() -{ - promptIcon_ = new UIImageView(); - if (promptIcon_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPromptPage promptIcon_ new fail"); - return; - } - promptIcon_->SetPosition(IMAGE_X, IMAGE_Y); - group_->Add(promptIcon_); - - promptLabel_ = new UILabel(); - if (promptLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPromptPage promptLabel_ new fail"); - return; - } - promptLabel_->SetPosition(LABEL_X, LABEL_Y, LABEL_W, LABEL_H); - promptLabel_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - promptLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - group_->Add(promptLabel_); - - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->promptType == SPORT_SET_TYPE_TARGET) { - if (sportInfo->targetComplete) { - promptLabel_->SetText(PROMPT_FINISH_CONTENT); - promptIcon_->SetPosition(IMAGE_COMPLETE_X, IMAGE_COMPLETE_Y); - LOADIMG::LoadImageViewImg(promptIcon_, SPORT_IMAGE, IMAGE_SPORT_FINISH); - } else if (sportInfo->targetHalf) { - promptLabel_->SetText(PROMPT_HALF_CONTENT); - LOADIMG::LoadImageViewImg(promptIcon_, SPORT_IMAGE, IMAGE_SPORT_HALF); - } - } else if (sportInfo->promptType == SPORT_SET_TYPE_REMIND) { - std::string promptStr; - if (sportInfo->remindType == SPORT_REMIND_INTERVAL_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - promptStr = "第" + std::to_string(sportInfo->remindTimes) + "个" + - std::to_string(sportInfo->remindValue) + "趟已完成!"; - promptLabel_->SetText(promptStr.c_str()); - LOADIMG::LoadImageViewImg(promptIcon_, SPORT_IMAGE, - PROPMT_IMAGES[PROMPT_LAP_INDEX][sportInfo->remindIndex]); - } else { - promptStr = "第" + std::to_string(sportInfo->remindTimes) + "个" + - std::to_string(sportInfo->remindValue) + "公里已完成!"; - promptLabel_->SetText(promptStr.c_str()); - LOADIMG::LoadImageViewImg(promptIcon_, SPORT_IMAGE, - PROPMT_IMAGES[PROMPT_DISTANCE_INDEX][sportInfo->remindIndex]); - } - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_TIME) { - promptStr = "第" + std::to_string(sportInfo->remindTimes) + "个" + std::to_string(sportInfo->remindValue) + - "分钟已完成!"; - promptLabel_->SetText(promptStr.c_str()); - LOADIMG::LoadImageViewImg(promptIcon_, SPORT_IMAGE, - PROPMT_IMAGES[PROMPT_TIME_INDEX][sportInfo->remindIndex]); - } - } else if (sportInfo->promptType == SPORT_SET_TYPE_HEARTRATE) { - std::string promptStr = "当前心率" + std::to_string(sportInfo->data.heartRate) + "次/分!"; - promptLabel_->SetText(promptStr.c_str()); - promptIcon_->SetPosition(IMAGE_HEART_X, IMAGE_HEART_Y); - LOADIMG::LoadImageViewImg(promptIcon_, SPORT_IMAGE, IMAGE_SPORT_HEART3); - } -} - -void SportTargetPromptPage::OnStart(void *data) -{ - startTime_ = time(nullptr); - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPromptPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - - CreatePromptView(); - AddViewToPageContainer(group_); - - callback_ = new SportPromptAnimatorCallback(this); - if (callback_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPromptPage::OnStart callback_ new fail"); - return; - } - - animator_ = new Animator(callback_, nullptr, 0, true); - if (animator_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetPromptPage::OnStart new Animator animator_ fail"); - return; - } -} - -void SportTargetPromptPage::OnPause() -{ - if (animator_ != nullptr) { - if (animator_->GetState() != Animator::STOP) { - animator_->Stop(); - } - } -} - -void SportTargetPromptPage::OnResume() -{ - if (animator_ != nullptr) { - if (animator_->GetState() == Animator::STOP) { - animator_->Start(); - } - } -} - -bool SportTargetPromptPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_DATA, - TransitionType::TRANSITION_INVALID, false); - } - return true; -} - -bool SportTargetPromptPage::OnClick(UIView &view, const ClickEvent &event) -{ - return false; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetSettingPage.cpp b/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetSettingPage.cpp deleted file mode 100644 index c3a10c3d7..000000000 --- a/code/sdk/application/wearable/evb/nativeapp/nativeui/sport/src/SportTargetSettingPage.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2025-2025. All rights reserved. - * Description: SportTargetSettingPage - * Create: 2025-06-06 - */ - -#include "UiConfig.h" -#include "main/LoadImg.h" -#include "ui_resource_sport.h" -#include "wearable_log.h" -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "SlicePageFactory.h" -#include "sport/SportView.h" -#include "sport/SportTargetSettingPage.h" - -namespace OHOS { -static constexpr uint16_t LABELS_X = 100; -static constexpr uint16_t LABELS_Y = 39; -static constexpr uint16_t LABELS_W = 253; -static constexpr uint16_t LABELS_H = 53; -static constexpr uint16_t LABELS_FONT = 38; -static constexpr uint16_t PICKER_X = 103; -static constexpr uint16_t PICKER_Y = 122; -static constexpr uint16_t PICKER_W = 247; -static constexpr uint16_t PICKER_H = 212; -static constexpr uint16_t BACKGROUND_FONT = 38; -static constexpr uint16_t HIGHTLIGHT_FONT = 44; -static constexpr uint16_t PICKER_ITEM_H = 65; -static constexpr uint16_t BUTTON_X = 63; -static constexpr uint16_t BUTTON_Y = 361; -static constexpr uint16_t BUTTON_W = 328; -static constexpr uint16_t BUTTON_H = 93; - -REGIST_SLICE_PAGE(VIEW_SPORT, SportPages::SPORT_PAGE_TARGET_SETTING, SportTargetSettingPage, false); - -SportTargetSettingPage::~SportTargetSettingPage() -{ - if (group_ != nullptr) { - group_->RemoveAll(); - delete group_; - group_ = nullptr; - } - if (titleLabel_ != nullptr) { - delete titleLabel_; - titleLabel_ = nullptr; - } - if (picker_ != nullptr) { - delete picker_; - picker_ = nullptr; - } - if (confirmButton_ != nullptr) { - delete confirmButton_; - confirmButton_ = nullptr; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SportTargetSettingPage::~SportTargetSettingPage"); -} - -void SportTargetSettingPage::CreateUILabel() -{ - titleLabel_ = new UILabel(); - if (titleLabel_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetSettingPage titleLabel_ new fail"); - return; - } - titleLabel_->SetPosition(LABELS_X, LABELS_Y, LABELS_W, LABELS_H); - titleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel_->SetFont(BOLD_VECTOR_FONT_FILENAME, LABELS_FONT); - group_->Add(titleLabel_); -} - -void SportTargetSettingPage::CreateUIPicker() -{ - picker_ = new UIPicker(); - if (picker_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetSettingPage picker_ new fail"); - return; - } - picker_->SetPosition(PICKER_X, PICKER_Y, PICKER_W, PICKER_H); - picker_->SetItemHeight(PICKER_ITEM_H); - picker_->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, BACKGROUND_FONT); - picker_->SetHighlightFont(DEFAULT_VECTOR_FONT_FILENAME, HIGHTLIGHT_FONT); - group_->Add(picker_); -} - -void SportTargetSettingPage::CreateUIButton() -{ - confirmButton_ = new UILabelButton(); - if (confirmButton_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetSettingPage confirmButton_ new fail"); - return; - } - confirmButton_->SetPosition(BUTTON_X, BUTTON_Y, BUTTON_W, BUTTON_H); - confirmButton_->SetViewId(TARGET_SETTING_CONFIRM_BUTTON); - confirmButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); - confirmButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); - confirmButton_->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); - - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->setType == SPORT_SET_TYPE_TARGET) { - if (sportInfo->targetType == SPORT_TARGET_DISTANCE) { - LOADIMG::LoadBtnImage(confirmButton_, SPORT_IMAGE, IMAGE_SPORT_OK1, IMAGE_SPORT_OK1); - } else if (sportInfo->targetType == SPORT_TARGET_TIME) { - LOADIMG::LoadBtnImage(confirmButton_, SPORT_IMAGE, IMAGE_SPORT_OK3, IMAGE_SPORT_OK3); - } else if (sportInfo->targetType == SPORT_TARGET_CALORIE) { - LOADIMG::LoadBtnImage(confirmButton_, SPORT_IMAGE, IMAGE_SPORT_OK2, IMAGE_SPORT_OK2); - } - } else if (sportInfo->setType == SPORT_SET_TYPE_REMIND) { - if (sportInfo->remindType == SPORT_REMIND_INTERVAL_DISTANCE) { - LOADIMG::LoadBtnImage(confirmButton_, SPORT_IMAGE, IMAGE_SPORT_OK1, IMAGE_SPORT_OK1); - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_TIME) { - LOADIMG::LoadBtnImage(confirmButton_, SPORT_IMAGE, IMAGE_SPORT_OK3, IMAGE_SPORT_OK3); - } - } - - confirmButton_->SetOnClickListener(this); - group_->Add(confirmButton_); -} - -void SportTargetSettingPage::OnStart(void *data) -{ - group_ = new UIViewGroup(); - if (group_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SportTargetSettingPage group_ new fail"); - return; - } - group_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - group_->SetOnDragListener(this); - group_->SetDraggable(true); - group_->SetTouchable(true); - - CreateUILabel(); - CreateUIPicker(); - CreateUIButton(); - AddViewToPageContainer(group_); - - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->setType == SPORT_SET_TYPE_TARGET) { - UpdateViewByTargetType(); - } else if (sportInfo->setType == SPORT_SET_TYPE_REMIND) { - UpdateViewByRemindType(); - } -} - -bool SportTargetSettingPage::OnDrag(UIView &view, const DragEvent &event) -{ - if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && - (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->setType == SPORT_SET_TYPE_TARGET) { - sportInfo->targetType = sportInfo->targetTypeTemp; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET, - TransitionType::TRANSITION_INVALID, false); - } else if (sportInfo->setType == SPORT_SET_TYPE_REMIND) { - sportInfo->remindType = sportInfo->remindTypeTemp; - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND, - TransitionType::TRANSITION_INVALID, false); - } - } - return true; -} - -bool SportTargetSettingPage::OnClick(UIView &view, const ClickEvent &event) -{ - if (strcmp(view.GetViewId(), TARGET_SETTING_CONFIRM_BUTTON) == 0) { - uint16_t index = picker_->GetSelected(); - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->setType == SPORT_SET_TYPE_TARGET) { - SportModel::GetInstance().SetTargetValue(index); - sportInfo->isTargetSetted = true; - SportModel::GetInstance().SaveConfig(SPORT_CONFIG_INFO); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_TARGET, - TransitionType::TRANSITION_INVALID, false); - } else if (sportInfo->setType == SPORT_SET_TYPE_REMIND) { - SportModel::GetInstance().SetRemindValue(index); - sportInfo->isRemindSetted = true; - SportModel::GetInstance().SaveConfig(SPORT_CONFIG_INFO); - NativeAbility::GetInstance().SwitchPageInSlice(SportPages::SPORT_PAGE_REMIND, - TransitionType::TRANSITION_INVALID, false); - } - } - return true; -} - -void SportTargetSettingPage::UpdateViewByTargetType() -{ - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->targetType == SPORT_TARGET_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - titleLabel_->SetText("趟数"); - const char *uiLapData[] = {"1趟", "2趟", "4趟", "6趟", "8趟", "10趟", "12趟", "16趟", "20趟", "30趟"}; - picker_->SetTextColor(Color::Gray(), Color::GetColorFromRGB(0x52, 0xe4, 0xeb)); - picker_->SetValues(uiLapData, sizeof(uiLapData) / sizeof(uiLapData[0])); - } else { - titleLabel_->SetText("距离"); - const char *uiDistanceData[] = {"1km", "3km", "5km", "7km", "10km", "15km", "20km", "25km", "30km", "40km"}; - picker_->SetTextColor(Color::Gray(), Color::GetColorFromRGB(0x52, 0xe4, 0xeb)); - picker_->SetValues(uiDistanceData, sizeof(uiDistanceData) / sizeof(uiDistanceData[0])); - } - } else if (sportInfo->targetType == SPORT_TARGET_TIME) { - titleLabel_->SetText("时间"); - const char *uiTimeData[] = {"10分钟", "20分钟", "30分钟", "60分钟", "120分钟", "180分钟", "200分钟"}; - picker_->SetTextColor(Color::Gray(), Color::GetColorFromRGB(0xff, 0x75, 0x00)); - picker_->SetValues(uiTimeData, sizeof(uiTimeData) / sizeof(uiTimeData[0])); - } else if (sportInfo->targetType == SPORT_TARGET_CALORIE) { - titleLabel_->SetText("热量"); - const char *uiCalorieData[] = {"100千卡", "200千卡", "300千卡", "500千卡", "600千卡", "800千卡", "1000千卡"}; - picker_->SetTextColor(Color::Gray(), Color::GetColorFromRGB(0xff, 0x4d, 0x4f)); - picker_->SetValues(uiCalorieData, sizeof(uiCalorieData) / sizeof(uiCalorieData[0])); - } - titleLabel_->Invalidate(); - picker_->Invalidate(); - confirmButton_->Invalidate(); -} - -void SportTargetSettingPage::UpdateViewByRemindType() -{ - sport_info_t *sportInfo = SportModel::GetInstance().GetCurrSportInfo(); - if (sportInfo->remindType == SPORT_REMIND_INTERVAL_DISTANCE) { - SportType sportType = SportModel::GetInstance().GetSportType(); - if (sportType == SPORT_TYPE_INDOOR_SWIMMING) { - titleLabel_->SetText("趟数"); - const char *uiLapData[] = {"1趟", "2趟", "4趟", "6趟", "8趟", "10趟", "12趟", "16趟", "20趟", "30趟"}; - picker_->SetTextColor(Color::Gray(), Color::GetColorFromRGB(0x52, 0xe4, 0xeb)); - picker_->SetValues(uiLapData, sizeof(uiLapData) / sizeof(uiLapData[0])); - } else { - titleLabel_->SetText("距离"); - const char *uiDistanceData[] = {"1km", "3km", "5km", "7km", "10km", "15km", "20km", "25km", "30km", "40km"}; - picker_->SetTextColor(Color::Gray(), Color::GetColorFromRGB(0x52, 0xe4, 0xeb)); - picker_->SetValues(uiDistanceData, sizeof(uiDistanceData) / sizeof(uiDistanceData[0])); - } - } else if (sportInfo->remindType == SPORT_REMIND_INTERVAL_TIME) { - titleLabel_->SetText("时间"); - const char *uiTimeData[] = {"10分钟", "20分钟", "30分钟", "60分钟", "120分钟", "180分钟", "200分钟"}; - picker_->SetTextColor(Color::Gray(), Color::GetColorFromRGB(0xff, 0x75, 0x00)); - picker_->SetValues(uiTimeData, sizeof(uiTimeData) / sizeof(uiTimeData[0])); - } - titleLabel_->Invalidate(); - picker_->Invalidate(); - confirmButton_->Invalidate(); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd230/libmsg_center.a b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd230/libmsg_center.a deleted file mode 100644 index b1e105a9c..000000000 Binary files a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd230/libmsg_center.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd230_user/libmsg_center.a b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd230_user/libmsg_center.a deleted file mode 100644 index b1e105a9c..000000000 Binary files a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd230_user/libmsg_center.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd272/libmsg_center.a b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd272/libmsg_center.a deleted file mode 100644 index b1e105a9c..000000000 Binary files a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-fd272/libmsg_center.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-ln/libmsg_center.a b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-ln/libmsg_center.a deleted file mode 100644 index b1e105a9c..000000000 Binary files a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-ln/libmsg_center.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-lnppp/libmsg_center.a b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-lnppp/libmsg_center.a deleted file mode 100644 index b1e105a9c..000000000 Binary files a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-lnppp/libmsg_center.a and /dev/null differ diff --git a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-n9/libmsg_center.a b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-n9/libmsg_center.a index b1e105a9c..7e69f1c2a 100644 Binary files a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-n9/libmsg_center.a and b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-n9/libmsg_center.a differ diff --git a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-n9ln/libmsg_center.a b/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-n9ln/libmsg_center.a deleted file mode 100644 index b1e105a9c..000000000 Binary files a/code/sdk/application/wearable/evb/service/msg_center/brandy-native-js-n9ln/libmsg_center.a and /dev/null differ diff --git a/code/sdk/application/wearable/n9/nativeabilityfwk/src/AbilitySlice.cpp b/code/sdk/application/wearable/n9/nativeabilityfwk/src/AbilitySlice.cpp index 775fa63d4..68ab45d56 100644 --- a/code/sdk/application/wearable/n9/nativeabilityfwk/src/AbilitySlice.cpp +++ b/code/sdk/application/wearable/n9/nativeabilityfwk/src/AbilitySlice.cpp @@ -22,6 +22,7 @@ const uint32_t PAGE_OFFSET = 16; void AbilitySlice::OnStart(void* data) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnStart"); if ((presenter_ == nullptr) || (view_ == nullptr)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "Presenter or View was nullptr for slice %s", sliceId_); return; @@ -42,11 +43,12 @@ void AbilitySlice::OnStart(void* data) presenter_->OnStart(); presenter_->OnStart(data); state_ = SliceState::START; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnStart state_ = %d", state_); } void AbilitySlice::OnResume() { - + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume state_ = %d", state_); if(NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAIN || NativeAbility::GetInstance().GetCurSliceId() == VIEW_APPLIST) { if (!ImageCacheManager::GetInstance().IsInAod()) { @@ -61,6 +63,7 @@ void AbilitySlice::OnResume() return; } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__); if (view_->GetRootContainer()->GetParent() == nullptr) { RootView::GetInstance()->Add(view_->GetRootContainer()); } @@ -81,10 +84,15 @@ void AbilitySlice::OnResume() view_->GetRootContainer()->SetOnDragListener(backDragListener); } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__); slicePageMgr_.ResumeSlicePage(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__); presenter_->OnResume(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__); view_->Draw(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume:%d",__LINE__); state_ = SliceState::RESUME; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "AbilitySlice::OnResume state_ = %d", state_); } void AbilitySlice::OnPause() diff --git a/code/sdk/application/wearable/n9/nativeapp/brandy-native-js-fd230/libuikit_fwk.a b/code/sdk/application/wearable/n9/nativeapp/brandy-native-js-fd230/libuikit_fwk.a deleted file mode 100644 index e3ce469ad..000000000 Binary files a/code/sdk/application/wearable/n9/nativeapp/brandy-native-js-fd230/libuikit_fwk.a and /dev/null differ diff --git a/code/sdk/application/wearable/n9/nativeapp/brandy-native-js-n9/libuikit_fwk.a b/code/sdk/application/wearable/n9/nativeapp/brandy-native-js-n9/libuikit_fwk.a index e3ce469ad..dd5873d60 100644 Binary files a/code/sdk/application/wearable/n9/nativeapp/brandy-native-js-n9/libuikit_fwk.a and b/code/sdk/application/wearable/n9/nativeapp/brandy-native-js-n9/libuikit_fwk.a differ diff --git a/code/sdk/application/wearable/n9/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/n9/nativeapp/nativelauncher/src/NativeLauncher.cpp index 511668136..6744e7ef8 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -61,7 +61,7 @@ #endif namespace OHOS { - +int16_t BackDragListener::maxDragRegionX_ = MAX_X_IN_DRAG_REGION; NativeLauncher::NativeLauncher() {} NativeLauncher::~NativeLauncher() {} diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp index cb2ff0975..7a6f4bd51 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/languagecode/src/LanguageSwitchPresenter.cpp @@ -48,7 +48,7 @@ namespace OHOS void LanguageSwitchPresenter::OnStart() { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "LanguageSwitchPresenter::OnStart"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchPresenter::OnStart"); if (view_ == nullptr) { return; @@ -58,6 +58,11 @@ namespace OHOS printf("LanguageSwitchPresenter::OnStart: %d\n", i); view_->AddLanguageItemToList(languages[i]); } + if (view_ == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchPresenter::OnStart view_ is nullptr"); + return; + } view_->RefreshLanguageList(); } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootDeviceView.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootDeviceView.h deleted file mode 100644 index 3e50f0b2a..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootDeviceView.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: RebootDevice View - * Create: 2022-04-28 - */ -#ifndef REBOOTDEVICE_VIEW_H -#define REBOOTDEVICE_VIEW_H - -#include "View.h" -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_button.h" - -namespace OHOS { -class RebootDeviceView { -public: - RebootDeviceView(); - ~RebootDeviceView(); - static RebootDeviceView *GetInstance(); - UIViewGroup *InitShowUpView(void); - -private: - bool ShowUpRebootDeviceView(void); - UILabel *rebootDeviceLabel{nullptr}; - UIButton *rebootDeviceButton{nullptr}; - UIViewGroup *group{nullptr}; -}; -} // namespace OHOS -#endif // REBOOTDEVICE_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootModel.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootModel.h deleted file mode 100644 index fba69e64f..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootModel.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: Reboot Model - * Create: 2022-04-28 - */ - -#ifndef REBOOT_MODEL_H -#define REBOOT_MODEL_H -#include - -namespace OHOS { -enum RebootModelView : uint8_t { - REBOOT, - REBOOTDEVICE, - SHUTDOWNDEVICE, -}; - -class RebootModel { -public: - ~RebootModel(); - static RebootModel *GetInstance(void); - int16_t GetSelectView(void); - void SetSelectViewId(int16_t value); - bool GetExitsView(void); - void SetExitsView(bool value); - void SoftRebootDevice(void); - void ShutdownDevice(void); - -private: - RebootModel(); - int16_t selectView{0}; - bool exitsView{false}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootPresenter.h deleted file mode 100644 index 38cf1c952..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootPresenter.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: Reboot Presenter - * Create: 2022-04-28 - */ - -#ifndef REBOOT_PRESENTER_H -#define REBOOT_PRESENTER_H - -#include "key/include/KeyInputListener.h" -#include "Presenter.h" -#include "NativeLauncher.h" -#include "NativeAbility.h" - -namespace OHOS { -enum RebootPresenterNum : uint8_t { - REBOOTVIEW = 0, - REBOOTDEVICEVIEW, - SHUTDOWNDEVICEVIEW, - REBOOT_MAX, -}; - -#define REBOOT_BUTTON "rebootButton" -#define SHUTDOWN_BUTTON "shutdownButton" -#define REBOOTDEVICE_BUTTON "rebootDeviceButton" -#define SHUTDOWNDEVICE_BUTTON "shutdownDeviceButton" - -#define REBOOT_VIEW "rebootView" -#define REBOOTDEVICE_VIEW "rebootDeviceView" -#define SHUTDOWNDEVICE_VIEW "shutdownDeviceView" - -class RebootView; -class RebootPresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - RebootPresenter(); - ~RebootPresenter(); - static RebootPresenter *GetInstance(); - bool OnClick(UIView& view, const ClickEvent& event) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - -private: -}; -} // namespace OHOS -#endif diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootView.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootView.h deleted file mode 100644 index 2019136e9..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/RebootView.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: Reboot View - * Create: 2022-04-28 - */ -#ifndef REBOOT_VIEW_H -#define REBOOT_VIEW_H - -#include "View.h" -#include "rebootdevice/include/ShutdownDeviceView.h" -#include "rebootdevice/include/RebootDeviceView.h" -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_button.h" - -namespace OHOS { -constexpr int16_t NUM_REBOOT_CONTAINER = 3; - -class RebootPresenter; -class RebootView : public View { -public: - RebootView(); - ~RebootView() override; - static RebootView *GetInstance(); - void OnStart() override; - UIViewGroup *InitShowUpView(void); - void ChangeView(int16_t hideView, int16_t showView); - -private: - bool ChangeRebootView(int16_t hideView, int16_t thisView); - bool ChangeRebootDeviceView(int16_t hideView, int16_t thisView); - bool ChangeShutdownDeviceView(int16_t hideView, int16_t thisView); - bool CheckViewParam(int16_t hideView, int16_t showView); - bool ShowUpRebootView(void); - bool ShowUpShutdownView(void); - UILabel *rebootLabel{nullptr}; - UIButton *rebootButton{nullptr}; - UILabel *shutdownLabel{nullptr}; - UIButton *shutdownButton{nullptr}; - UIViewGroup *group{nullptr}; - RebootDeviceView *rebootDeviceView{nullptr}; - ShutdownDeviceView *shutdownDeviceView{nullptr}; - UIViewGroup *container[NUM_REBOOT_CONTAINER]{nullptr}; - typedef bool (RebootView::*PreprosssChangeView)(int16_t hideView, int16_t thisView); - PreprosssChangeView preProcessView[NUM_REBOOT_CONTAINER]; -}; -} // namespace OHOS -#endif // REBOOT_VIEW_H diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/ShutdownDeviceView.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/ShutdownDeviceView.h deleted file mode 100644 index 33140b50d..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/include/ShutdownDeviceView.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: ShutdownDevice View - * Create: 2022-04-28 - */ -#ifndef SHUTDOWNDEVICE_VIEW_H -#define SHUTDOWNDEVICE_VIEW_H - -#include "View.h" -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_button.h" - -namespace OHOS { -class ShutdownDeviceView { -public: - ShutdownDeviceView(); - ~ShutdownDeviceView(); - static ShutdownDeviceView *GetInstance(); - UIViewGroup *InitShowUpView(void); - -private: - bool ShowUpShutdownDeviceView(void); - UILabel *shutdownDeviceLabel{nullptr}; - UIButton *shutdownDeviceButton{nullptr}; - UIViewGroup *group{nullptr}; -}; -} // namespace OHOS -#endif // SHUTDOWNDEVICE_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp deleted file mode 100644 index 9575f2be4..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: RebootDevice View - * Create: 2022-04-28 - */ - -#include "rebootdevice/include/RebootDeviceView.h" -#include "wearable_log.h" -#include "UiConfig.h" -#include "rebootdevice/include/RebootPresenter.h" -#include "PageTransitionMgr.h" - -namespace OHOS { -static RebootDeviceView *g_pRebootDeviceView{nullptr}; -RebootDeviceView::RebootDeviceView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootDeviceView::RebootDeviceView"); - g_pRebootDeviceView = this; -} - -RebootDeviceView::~RebootDeviceView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootDeviceView::~RebootDeviceView"); - if (group != nullptr) { - group->RemoveAll(); - } - delete rebootDeviceLabel; - rebootDeviceLabel = nullptr; - delete rebootDeviceButton; - rebootDeviceButton = nullptr; - delete group; - group = nullptr; - g_pRebootDeviceView = nullptr; -} - -RebootDeviceView *RebootDeviceView::GetInstance() -{ - return g_pRebootDeviceView; -} - -bool RebootDeviceView::ShowUpRebootDeviceView() -{ - if (rebootDeviceLabel == nullptr) { - rebootDeviceLabel = new UILabel(); - if (rebootDeviceLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpRebootDeviceView rebootDeviceLabel new fail"); - return false; - } - } - rebootDeviceLabel->SetPosition(152, 272, 150, 45); // 152:x 272:y 150:width 45:height - rebootDeviceLabel->SetText("重启"); - rebootDeviceLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data - rebootDeviceLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); - rebootDeviceLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - - if (rebootDeviceButton == nullptr) { - rebootDeviceButton = new UIButton(); - if (rebootDeviceButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpRebootDeviceView rebootDeviceButton new fail"); - return false; - } - } - rebootDeviceButton->SetPosition(172, 147, 110, 110); // 172:x 147:y 110:width 110:height - rebootDeviceButton->SetImageSrc(PNG_REBOOT_BUTTON_IMAGE, PNG_REBOOT_BUTTON_IMAGE); - rebootDeviceButton->SetViewId(REBOOTDEVICE_BUTTON); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); - if (clickListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance nullptr"); - return false; - } - rebootDeviceButton->SetOnClickListener(clickListener); - return true; -} - -UIViewGroup *RebootDeviceView::InitShowUpView(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootDeviceView::InitShowUpView"); - bool ret; - if (group == nullptr) { - group = new UIViewGroup(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); - return nullptr; - } - group->SetPosition(0, 0); // 0:x; 0:y - group->SetWidth(HORIZONTAL_RESOLUTION); - group->SetHeight(VERTICAL_RESOLUTION); - } - ret = ShowUpRebootDeviceView(); - if (!ret) { - return nullptr; - } - group->Add(rebootDeviceLabel); - group->Add(rebootDeviceButton); - - UIView::OnDragListener *rebootDeviceDragListener = (UIView::OnDragListener *)OHOS::RebootPresenter::GetInstance(); - if (rebootDeviceDragListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootDeviceDragListener GetInstance fail"); - return nullptr; - } - if (PageTransitionMgr::GetInstance().GetTopSlideBackImage() == nullptr) { // support default slide back firstly - group->SetOnDragListener(rebootDeviceDragListener); - } - group->SetViewId(REBOOTDEVICE_VIEW); - group->SetDraggable(true); - group->SetTouchable(true); - return group; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootModel.cpp deleted file mode 100644 index e5d19bc2a..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootModel.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: Reboot Model - * Create: 2022-04-28 - */ - -#include "rebootdevice/include/RebootModel.h" -#include "dfx_reboot.h" - -namespace OHOS { -RebootModel::RebootModel() {} - -RebootModel::~RebootModel() {} - -RebootModel *RebootModel::GetInstance(void) -{ - static RebootModel instance; - return &instance; -} - -int16_t RebootModel::GetSelectView(void) -{ - return selectView; -} - -void RebootModel::SetSelectViewId(int16_t value) -{ - selectView = value; -} - -bool RebootModel::GetExitsView(void) -{ - return exitsView; -} - -void RebootModel::SetExitsView(bool value) -{ - exitsView = value; -} - -void RebootModel::SoftRebootDevice(void) -{ - uapi_system_reboot(SYSTEM_SOFT_REBOOT); -} - -void RebootModel::ShutdownDevice(void) -{ - uapi_system_shutdown(0); -} - -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp deleted file mode 100644 index db26c7b72..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootPresenter.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: Reboot Presenter - * Create: 2022-04-28 - */ - -#include "rebootdevice/include/RebootPresenter.h" -#include "rebootdevice/include/RebootView.h" -#include "rebootdevice/include/RebootModel.h" -#include "drag_event.h" -#include "wearable_log.h" -#include "NativeRegisterManager.h" - -namespace OHOS { - -REGIST_SLICE(VIEW_REBOOT, RebootView, RebootPresenter); - -static RebootPresenter *g_pRebootPresenter = nullptr; - -RebootPresenter::RebootPresenter() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootPresenter::RebootPresenter"); - g_pRebootPresenter = this; -} - -RebootPresenter::~RebootPresenter() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootPresenter::~RebootPresenter"); - g_pRebootPresenter = nullptr; -} - -RebootPresenter *RebootPresenter::GetInstance() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootPresenter GetInstance"); - return g_pRebootPresenter; -} - -bool RebootPresenter::OnClick(UIView& view, const ClickEvent& event) -{ - UNUSED(event); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnClick OnClick"); - if (strcmp(view.GetViewId(), REBOOT_BUTTON) == 0) { - RebootView::GetInstance()->ChangeView(REBOOTVIEW, REBOOTDEVICEVIEW); - } else if (strcmp(view.GetViewId(), SHUTDOWN_BUTTON) == 0) { - RebootView::GetInstance()->ChangeView(REBOOTVIEW, SHUTDOWNDEVICEVIEW); - } else if (strcmp(view.GetViewId(), REBOOTDEVICE_BUTTON) == 0) { - // 重启 - - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "REBOOTDEVICE_BUTTON OnClick"); - RebootModel::GetInstance()->SoftRebootDevice(); - } else if (strcmp(view.GetViewId(), SHUTDOWNDEVICE_BUTTON) == 0) { - // 关机 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SHUTDOWNDEVICE_BUTTON OnClick"); - RebootModel::GetInstance()->ShutdownDevice(); - } - return true; -} - -bool RebootPresenter::OnDrag(UIView& view, const DragEvent& event) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootPresenter::OnDrag"); - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { - if (strcmp(view.GetViewId(), REBOOT_VIEW) == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); - } else if (strcmp(view.GetViewId(), REBOOTDEVICE_VIEW) == 0) { - if (RebootModel::GetInstance()->GetExitsView() == 0) { - RebootView::GetInstance()->ChangeView(REBOOTDEVICEVIEW, REBOOTVIEW); - } else { - NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING); - RebootModel::GetInstance()->SetExitsView(false); - } - } else if (strcmp(view.GetViewId(), SHUTDOWNDEVICE_VIEW) == 0) { - if (RebootModel::GetInstance()->GetExitsView() == 0) { - RebootView::GetInstance()->ChangeView(SHUTDOWNDEVICEVIEW, REBOOTVIEW); - } else { - NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING); - RebootModel::GetInstance()->SetExitsView(false); - } - } - } - return true; -} -} diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootView.cpp deleted file mode 100644 index 92fc10698..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/RebootView.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: Reboot View - * Create: 2022-04-28 - */ - -#include "rebootdevice/include/RebootView.h" -#include "rebootdevice/include/RebootModel.h" -#include "wearable_log.h" -#include "UiConfig.h" -#include "rebootdevice/include/RebootPresenter.h" -#include "PageTransitionMgr.h" - -namespace OHOS { -static RebootView *g_pRebootView{nullptr}; -RebootView::RebootView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootView::RebootView"); - preProcessView[REBOOTVIEW] = &RebootView::ChangeRebootView; - preProcessView[REBOOTDEVICEVIEW] = &RebootView::ChangeRebootDeviceView; - preProcessView[SHUTDOWNDEVICEVIEW] = &RebootView::ChangeShutdownDeviceView; - g_pRebootView = this; -} - -RebootView::~RebootView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootView::~RebootView"); - if (group != nullptr) { - group->RemoveAll(); - } - delete rebootLabel; - rebootLabel = nullptr; - delete rebootButton; - rebootButton = nullptr; - delete shutdownLabel; - shutdownLabel = nullptr; - delete shutdownButton; - shutdownButton = nullptr; - delete group; - group = nullptr; - g_pRebootView = nullptr; -} - -RebootView *RebootView::GetInstance() -{ - return g_pRebootView; -} - -void RebootView::OnStart() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootView::~OnStart"); - if (RebootModel::GetInstance()->GetSelectView() == REBOOT) { - ChangeView(REBOOT_MAX, REBOOTVIEW); - } else if (RebootModel::GetInstance()->GetSelectView() == REBOOTDEVICE) { - ChangeView(REBOOT_MAX, REBOOTDEVICEVIEW); - RebootModel::GetInstance()->SetSelectViewId(REBOOT); - } else if (RebootModel::GetInstance()->GetSelectView() == SHUTDOWNDEVICE) { - ChangeView(REBOOT_MAX, SHUTDOWNDEVICEVIEW); - RebootModel::GetInstance()->SetSelectViewId(REBOOT); - } - return; -} - -bool RebootView::ShowUpRebootView() -{ - if (rebootLabel == nullptr) { - rebootLabel = new UILabel(); - if (rebootLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpRebootView rebootLabel new fail"); - return false; - } - } - rebootLabel->SetPosition(49, 272, 150, 45); // 49:x 272:y 150:width 45:height - rebootLabel->SetText("重启"); - rebootLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data - rebootLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); - rebootLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - - if (rebootButton == nullptr) { - rebootButton = new UIButton(); - if (rebootButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpRebootView rebootButton new fail"); - return false; - } - } - rebootButton->SetPosition(69, 147, 110, 110); // 69:x 147:y 110:width 110:height - rebootButton->SetImageSrc(PNG_REBOOT_BUTTON_IMAGE, PNG_REBOOT_BUTTON_IMAGE); - rebootButton->SetViewId(REBOOT_BUTTON); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); - if (clickListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance nullptr"); - return false; - } - rebootButton->SetOnClickListener(clickListener); - return true; -} - -bool RebootView::ShowUpShutdownView() -{ - if (shutdownLabel == nullptr) { - shutdownLabel = new UILabel(); - if (shutdownLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpShutdownView shutdownLabel new fail"); - return false; - } - } - shutdownLabel->SetPosition(255, 272, 150, 45); // 255:x 272:y 150:width 45:height - shutdownLabel->SetText("关机"); - shutdownLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data - shutdownLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); - shutdownLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - - if (shutdownButton == nullptr) { - shutdownButton = new UIButton(); - if (shutdownButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpShutdownView shutdownButton new fail"); - return false; - } - } - shutdownButton->SetPosition(275, 147, 110, 110); // 275:x 147:y 110:width 110:height - shutdownButton->SetImageSrc(PNG_SHUTDOWN_BUTTON_IMAGE, PNG_SHUTDOWN_BUTTON_IMAGE); - shutdownButton->SetViewId(SHUTDOWN_BUTTON); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); - if (clickListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance nullptr"); - return false; - } - shutdownButton->SetOnClickListener(clickListener); - return true; -} - -UIViewGroup *RebootView::InitShowUpView(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootView::InitShowUpView"); - bool ret; - if (group == nullptr) { - group = new UIViewGroup(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); - return nullptr; - } - group->SetPosition(0, 0); // 0:x; 0:y - group->SetWidth(HORIZONTAL_RESOLUTION); - group->SetHeight(VERTICAL_RESOLUTION); - } - ret = ShowUpRebootView(); - if (!ret) { - return nullptr; - } - group->Add(rebootLabel); - group->Add(rebootButton); - - ret = ShowUpShutdownView(); - if (!ret) { - return nullptr; - } - group->Add(shutdownLabel); - group->Add(shutdownButton); - UIView::OnDragListener *rebootDragListener = (UIView::OnDragListener *)OHOS::RebootPresenter::GetInstance(); - if (rebootDragListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootDragListener GetInstance fail"); - return nullptr; - } - if (PageTransitionMgr::GetInstance().GetTopSlideBackImage() == nullptr) { // support default slide back firstly - group->SetOnDragListener(rebootDragListener); - } - group->SetViewId(REBOOT_VIEW); - group->SetDraggable(true); - group->SetTouchable(true); - return group; -} - -bool RebootView::ChangeRebootView(int16_t hideView, int16_t thisView) -{ - UNUSED(hideView); - // init view - UIViewGroup *viewGroup = InitShowUpView(); - if (viewGroup == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewGroup nullptr fail"); - return false; - } - container[thisView] = viewGroup; - AddViewToRootContainer(container[thisView]); - return true; -} - -bool RebootView::ChangeRebootDeviceView(int16_t hideView, int16_t thisView) -{ - UNUSED(hideView); - if (container[thisView] == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChangeRebootDeviceView"); - rebootDeviceView = new RebootDeviceView(); - if (rebootDeviceView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootDeviceView new fail"); - return false; - } - // init view - UIViewGroup *viewGroup = rebootDeviceView->InitShowUpView(); - if (viewGroup == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewGroup nullptr fail"); - return false; - } - container[thisView] = viewGroup; - AddViewToRootContainer(container[thisView]); - } - return true; -} - -bool RebootView::ChangeShutdownDeviceView(int16_t hideView, int16_t thisView) -{ - UNUSED(hideView); - if (container[thisView] == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChangeShutdownDeviceView"); - shutdownDeviceView = new ShutdownDeviceView(); - if (shutdownDeviceView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "shutdownDeviceView new fail"); - return false; - } - // init view - UIViewGroup *viewGroup = shutdownDeviceView->InitShowUpView(); - if (viewGroup == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewGroup nullptr fail"); - return false; - } - container[thisView] = viewGroup; - AddViewToRootContainer(container[thisView]); - } - return true; -} - -bool RebootView::CheckViewParam(int16_t hideView, int16_t showView) -{ - if (showView < 0 || showView >= REBOOT_MAX) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootView::CheckViewParam showView err."); - return false; - } - - if (hideView < 0 || hideView > REBOOT_MAX) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootView::CheckViewParam hideView err."); - return false; - } - - return true; -} - -void RebootView::ChangeView(int16_t hideView, int16_t showView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootView::ChangeView %d, %d", hideView, showView); - - if (!CheckViewParam(hideView, showView)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootView::CheckViewParam failed."); - return; - } - - PreprosssChangeView tmpPreProcessView = preProcessView[showView]; - - if (!(this->*tmpPreProcessView)(hideView, showView)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootView::ChangeView %d %dfailed", showView, hideView); - return; - } - if (hideView != REBOOT_MAX) { - if (container[hideView] == nullptr) { - return; - } - container[hideView]->SetVisible(false); - } - container[showView]->SetVisible(true); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootView:: ChangeView end!!!%d", showView); - Draw(); -} -} diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp deleted file mode 100644 index 4f37f2f8b..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: ShutdownDevice View - * Create: 2022-04-28 - */ - -#include "rebootdevice/include/ShutdownDeviceView.h" -#include "wearable_log.h" -#include "UiConfig.h" -#include "rebootdevice/include/RebootPresenter.h" -#include "PageTransitionMgr.h" - -namespace OHOS { -static ShutdownDeviceView *g_pShutdownDeviceView{nullptr}; -ShutdownDeviceView::ShutdownDeviceView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutdownDeviceView::ShutdownDeviceView"); - g_pShutdownDeviceView = this; -} - -ShutdownDeviceView::~ShutdownDeviceView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutdownDeviceView::~ShutdownDeviceView"); - if (group != nullptr) { - group->RemoveAll(); - } - delete shutdownDeviceLabel; - shutdownDeviceLabel = nullptr; - delete shutdownDeviceButton; - shutdownDeviceButton = nullptr; - delete group; - group = nullptr; - g_pShutdownDeviceView = nullptr; -} - -ShutdownDeviceView *ShutdownDeviceView::GetInstance() -{ - return g_pShutdownDeviceView; -} - -bool ShutdownDeviceView::ShowUpShutdownDeviceView() -{ - if (shutdownDeviceLabel == nullptr) { - shutdownDeviceLabel = new UILabel(); - if (shutdownDeviceLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpShutdownDeviceView shutdownDeviceLabel new fail"); - return false; - } - } - shutdownDeviceLabel->SetPosition(152, 272, 150, 45); // 152:x 272:y 150:width 45:height - shutdownDeviceLabel->SetText("关机"); - shutdownDeviceLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); // 35:font data - shutdownDeviceLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); - shutdownDeviceLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - - if (shutdownDeviceButton == nullptr) { - shutdownDeviceButton = new UIButton(); - if (shutdownDeviceButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShowUpShutdownDeviceView shutdownDeviceButton new fail"); - return false; - } - } - shutdownDeviceButton->SetPosition(172, 147, 110, 110); // 172:x 147:y 110:width 110:height - shutdownDeviceButton->SetImageSrc(PNG_SHUTDOWN_BUTTON_IMAGE, PNG_SHUTDOWN_BUTTON_IMAGE); - shutdownDeviceButton->SetViewId(SHUTDOWNDEVICE_BUTTON); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); - if (clickListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance nullptr"); - return false; - } - shutdownDeviceButton->SetOnClickListener(clickListener); - return true; -} - -UIViewGroup *ShutdownDeviceView::InitShowUpView(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutdownDeviceView::InitShowUpView"); - bool ret; - if (group == nullptr) { - group = new UIViewGroup(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); - return nullptr; - } - group->SetPosition(0, 0); // 0:x; 0:y - group->SetWidth(HORIZONTAL_RESOLUTION); - group->SetHeight(VERTICAL_RESOLUTION); - } - - ret = ShowUpShutdownDeviceView(); - if (!ret) { - return nullptr; - } - group->Add(shutdownDeviceLabel); - group->Add(shutdownDeviceButton); - UIView::OnDragListener *rebootDragListener = (UIView::OnDragListener *)OHOS::RebootPresenter::GetInstance(); - if (rebootDragListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootDragListener GetInstance fail"); - return nullptr; - } - if (PageTransitionMgr::GetInstance().GetTopSlideBackImage() == nullptr) { // support default slide back firstly - group->SetOnDragListener(rebootDragListener); - } - group->SetViewId(SHUTDOWNDEVICE_VIEW); - group->SetDraggable(true); - group->SetTouchable(true); - return group; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp index 964c0d24c..80449a744 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp @@ -112,7 +112,5 @@ namespace OHOS styleTable_[i].btn->SetState(false); } } - // 切换到切换表盘Slice - // NativeAbility::GetInstance().ChangeSlice(VIEW_SET_DIAL); } } // OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp index d3a16c0a6..632b6b1dc 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/set_time_format/src/SetTimeFormatView.cpp @@ -95,7 +95,5 @@ void SetTimeFormatView::OnClick(UIView &view) { btnFormat24H_.SetState(false); SetTimeFormatModel::GetInstance().SetStyle(TimeFormat::TIME_FORMAT_12H); } - // 切换到切换表盘Slice - // NativeAbility::GetInstance().ChangeSlice(VIEW_SET_DIAL); } } // namespace OHOS \ No newline at end of file diff --git a/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks.h b/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks.h index a54510e83..acc1f060e 100644 --- a/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks.h +++ b/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks.h @@ -67,6 +67,8 @@ uint32_t clocks_get_core_frequency(void); */ void system_mcu_clocks_config(void); +uint32_t clocks_get_spi_frequency(void); + /** * @} */ diff --git a/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks_config_priv.c b/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks_config_priv.c index 4f14593e9..47d9161e7 100644 --- a/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks_config_priv.c +++ b/code/sdk/drivers/chips/brandy/clocks/drivers/acore/clocks_config_priv.c @@ -369,11 +369,7 @@ static const system_mcu_perip_clk_t g_system_mcu_perp_clk_set_config[] = { {HAL_CLOCKS_APP_SPI2_MS_CLK, TURN_OFF}, // spi2 clock {HAL_CLOCKS_APP_UART_H0_CLK, TURN_ON}, // uart h0 clock {HAL_CLOCKS_APP_UART_H1_CLK, TURN_ON}, // uart h1 clock -#ifdef BOARD_FD272 - {HAL_CLOCKS_APP_I2C0_CLK, TURN_ON}, // i2c0 clock -#else {HAL_CLOCKS_APP_I2C0_CLK, TURN_OFF}, // i2c0 clock -#endif {HAL_CLOCKS_APP_I2C1_CLK, TURN_ON}, // i2c1 clock {HAL_CLOCKS_APP_I2C2_CLK, TURN_ON}, // i2c2 clock {HAL_CLOCKS_APP_I2C3_CLK, TURN_ON}, // i2c3 clock diff --git a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a index 514c229d8..5ccbce8e6 100644 Binary files a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a and b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_recorder.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230/libdisplay_gfx.a deleted file mode 100644 index 8864f8e31..000000000 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230/libdisplay_gfx.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230_user/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230_user/libdisplay_gfx.a deleted file mode 100644 index 8864f8e31..000000000 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd230_user/libdisplay_gfx.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd272/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd272/libdisplay_gfx.a deleted file mode 100644 index 8864f8e31..000000000 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-fd272/libdisplay_gfx.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-ln/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-ln/libdisplay_gfx.a deleted file mode 100644 index 8864f8e31..000000000 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-ln/libdisplay_gfx.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-lnppp/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-lnppp/libdisplay_gfx.a deleted file mode 100644 index 8864f8e31..000000000 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-lnppp/libdisplay_gfx.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-n9/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-n9/libdisplay_gfx.a index 8864f8e31..10dae956b 100644 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-n9/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-n9/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-n9ln/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js-n9ln/libdisplay_gfx.a deleted file mode 100644 index 8864f8e31..000000000 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js-n9ln/libdisplay_gfx.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230/libuikit_ext.a deleted file mode 100644 index 9d278be5b..000000000 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230/libuikit_ext.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230_user/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230_user/libuikit_ext.a deleted file mode 100644 index 9d278be5b..000000000 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd230_user/libuikit_ext.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd272/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd272/libuikit_ext.a deleted file mode 100644 index 9d278be5b..000000000 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-fd272/libuikit_ext.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-ln/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-ln/libuikit_ext.a deleted file mode 100644 index 9d278be5b..000000000 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-ln/libuikit_ext.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-lnppp/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-lnppp/libuikit_ext.a deleted file mode 100644 index 9d278be5b..000000000 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-lnppp/libuikit_ext.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js-n9ln/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js-n9ln/libuikit_ext.a deleted file mode 100644 index 9d278be5b..000000000 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js-n9ln/libuikit_ext.a and /dev/null differ diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h index 32d1006d5..8fe6ed465 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h @@ -73,14 +73,32 @@ public: */ ~UIListExt() override {} + /** + * @brief Obtains the view type. + * + * @return Returns UI_LIST_EXT, as defined in {@link UIViewType}. + */ + UIViewType GetViewType() const override + { + return UI_LIST_EXT; + } + /** * @brief Set scale factor witch is used to calculate scale value. + * scale = N / scale factor ( 1 <= N <= scale factor) + * A larger scaleFactor value indicates higher scale precision. * * @since 1.0 * @version 1.0 */ void SetScaleFactor(int16_t value) { + if (value <= 0) { +#ifndef ENABLE_GRAPHIC_LOG + GRAPHIC_LOGE("Illegal value! Value must bigger than 0"); +#endif + return; + } scaleFactor_ = value; } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service.cpp index 89c87d978..de94603a9 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service.cpp @@ -87,7 +87,7 @@ bool GraphicService::AsyncTriggerNativeGraphicTask() OHOS::GraphicEventHandler::GetInstance()->PostGraphicEvent( [] { if (GraphicService::GetInstance()->IsScreenOn() && - isJsTaskFinished_ && // ±ÜÃâJS->Native TaskderHander¶àÏß³ÌÖØÈë + isJsTaskFinished_ && // ±ÜÃâJS->Native TaskderHander????? GraphicService::GetInstance()->IsNativeRunning()) { // ±ÜÃâNative->JS ¶àÏß³ÌÎÊÌâ OHOS::TaskManager::GetInstance()->TaskHandler(); } else { diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp index e84f7eb04..39a0183c0 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp @@ -314,7 +314,7 @@ void UILiteSurfaceView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidated void UILiteSurfaceView::OnBufferAvailable() { lock_.Lock(); - SurfaceBuffer* back = surface_->GetBackBuf(); + SurfaceBuffer *back = surface_->GetBackBuf(); bool isLastFrame = (back->format == PIXEL_FMT_BUTT); if (isLastFrame) { back->format = PIXEL_FMT_YCBCR_420_SP; diff --git a/code/sdk/middleware/services/gui/uikit/sample/sample_ui.h b/code/sdk/middleware/services/gui/uikit/sample/sample_ui.h index 1a631747e..194f1f0dd 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/sample_ui.h +++ b/code/sdk/middleware/services/gui/uikit/sample/sample_ui.h @@ -15,8 +15,8 @@ extern "C" { int SampleUi(void); /* - ¹¦ÄÜÃèÊö : Æô¶¯Ö¸¶¨ÓÃÀý - ²ÎÊýÄÚÈÝ : ²ÎÊýΪÓÃÀýÃû³Æ + $)A9&D\ChJv : Ft6/V86(SC@} + $)A2NJ}DZH] : 2NJ}N*SC@}C{3F */ int StartCaseUi(const char* testCaseId); diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230-r/libx_vfs_private.a deleted file mode 100644 index ef8c37d47..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230-r/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230/libx_vfs_private.a deleted file mode 100644 index 1c08fcb6b..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230_user-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230_user-r/libx_vfs_private.a deleted file mode 100644 index ef8c37d47..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230_user-r/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230_user/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230_user/libx_vfs_private.a deleted file mode 100644 index 1c08fcb6b..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd230_user/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd272-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd272-r/libx_vfs_private.a deleted file mode 100644 index ef8c37d47..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd272-r/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd272/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd272/libx_vfs_private.a deleted file mode 100644 index 1c08fcb6b..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-fd272/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-ln-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-ln-r/libx_vfs_private.a deleted file mode 100644 index ef8c37d47..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-ln-r/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-ln/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-ln/libx_vfs_private.a deleted file mode 100644 index 1c08fcb6b..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-ln/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lnppp-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lnppp-r/libx_vfs_private.a deleted file mode 100644 index ef8c37d47..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lnppp-r/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lnppp/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lnppp/libx_vfs_private.a deleted file mode 100644 index 1c08fcb6b..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-lnppp/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9-r/libx_vfs_private.a index ef8c37d47..7689d31c6 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9-r/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9-r/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9/libx_vfs_private.a index 1c08fcb6b..ff74eab68 100644 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9/libx_vfs_private.a and b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9/libx_vfs_private.a differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9ln-r/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9ln-r/libx_vfs_private.a deleted file mode 100644 index ef8c37d47..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9ln-r/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9ln/libx_vfs_private.a b/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9ln/libx_vfs_private.a deleted file mode 100644 index 1c08fcb6b..000000000 Binary files a/code/sdk/middleware/utils/fs/vfs/brandy-native-js-n9ln/libx_vfs_private.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230-r/libfs_yaffs2.a deleted file mode 100644 index 00beb36cd..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230-r/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230/libfs_yaffs2.a deleted file mode 100644 index 50e244ad8..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230_user-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230_user-r/libfs_yaffs2.a deleted file mode 100644 index 00beb36cd..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230_user-r/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230_user/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230_user/libfs_yaffs2.a deleted file mode 100644 index 50e244ad8..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd230_user/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd272-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd272-r/libfs_yaffs2.a deleted file mode 100644 index 00beb36cd..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd272-r/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd272/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd272/libfs_yaffs2.a deleted file mode 100644 index 50e244ad8..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-fd272/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-ln-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-ln-r/libfs_yaffs2.a deleted file mode 100644 index 00beb36cd..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-ln-r/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-ln/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-ln/libfs_yaffs2.a deleted file mode 100644 index 50e244ad8..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-ln/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lnppp-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lnppp-r/libfs_yaffs2.a deleted file mode 100644 index 00beb36cd..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lnppp-r/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lnppp/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lnppp/libfs_yaffs2.a deleted file mode 100644 index 50e244ad8..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-lnppp/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9-r/libfs_yaffs2.a index 00beb36cd..6b9dd5460 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9/libfs_yaffs2.a index 50e244ad8..2a44ced8d 100644 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9ln-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9ln-r/libfs_yaffs2.a deleted file mode 100644 index 00beb36cd..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9ln-r/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9ln/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9ln/libfs_yaffs2.a deleted file mode 100644 index 50e244ad8..000000000 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-n9ln/libfs_yaffs2.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230/libams.a deleted file mode 100644 index b294a766d..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230/libams.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230_user/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230_user/libams.a deleted file mode 100644 index b294a766d..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd230_user/libams.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd272/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd272/libams.a deleted file mode 100644 index b294a766d..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-fd272/libams.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-ln/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-ln/libams.a deleted file mode 100644 index b294a766d..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-ln/libams.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-lnppp/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-lnppp/libams.a deleted file mode 100644 index b294a766d..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-lnppp/libams.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-n9ln/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-n9ln/libams.a deleted file mode 100644 index b294a766d..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js-n9ln/libams.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230/libbms.a deleted file mode 100644 index f262ad882..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230/libbms.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230_user/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230_user/libbms.a deleted file mode 100644 index f262ad882..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd230_user/libbms.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd272/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd272/libbms.a deleted file mode 100644 index f262ad882..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-fd272/libbms.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-ln/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-ln/libbms.a deleted file mode 100644 index f262ad882..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-ln/libbms.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-lnppp/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-lnppp/libbms.a deleted file mode 100644 index f262ad882..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-lnppp/libbms.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-n9ln/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-n9ln/libbms.a deleted file mode 100644 index f262ad882..000000000 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js-n9ln/libbms.a and /dev/null differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-n9ln/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-n9ln/libjerryscript.a deleted file mode 100644 index bafd4fc5f..000000000 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js-n9ln/libjerryscript.a and /dev/null differ