+++ /dev/null
-#ifndef THUNDERBIRD_DIALOGUE_VIEW_H_
-#define THUNDERBIRD_DIALOGUE_VIEW_H_
-
-#include "View.h"
-#include "components/ui_view_group.h"
-#include "components/ui_label_ext.h"
-#include "components/ui_image_view.h"
-
-namespace OHOS
-{
- class ThunderBirdDialogueView
- {
- public:
- ThunderBirdDialogueView();
- virtual ~ThunderBirdDialogueView();
- static ThunderBirdDialogueView *GetInstance(void);
- UIViewGroup *ThunderBirdDialogueViewInit(void);
- void ClearAll(void);
- void Show(int16_t showView);
-
- enum : int16_t {
- THUNDERBIRD_DIALOGUEVIEW_SPEAKING = 0, // 说话中
- THUNDERBIRD_DIALOGUEVIEW_LISTENING, // 聆听中
- THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW, // 状态展示
- };
-
- private:
- UIViewGroup *group{nullptr};
- UILabelExt *titleLabel{nullptr};
- UILabelExt *TextLabel{nullptr};
- UILabelExt *RemindLabel{nullptr};
- UIImageView *RemindIcon{nullptr};
- UIImageView *RemindIcon2{nullptr};
- UIImageView *BackGround{nullptr};
- };
-}
-
-#endif
-
+++ /dev/null
-#ifndef THUNDERBIRD_VIEW_H_
-#define THUNDERBIRD_VIEW_H_
-
-#include "View.h"
-#include "components/ui_scroll_view.h"
-#include "components/ui_view_group.h"
-#include "components/ui_label_ext.h"
-#include "components/ui_image_view.h"
-namespace OHOS
-{
-
- class ThunderBirdView
- {
-
- public:
- ThunderBirdView();
- virtual ~ThunderBirdView();
- static ThunderBirdView *GetInstance(void);
- UIViewGroup *ThunderBirdViewInit(void);
-
- void InitBlackGround();
- void InitText();
- void ClearAll(void);
-
- private:
- UIViewGroup *group{nullptr};
-
-
- UIImageView *ground{nullptr};
-
- UILabelExt *TextLabel{nullptr};
- UILabelExt *RemindLabel{nullptr};
- UIImageView *Remindground{nullptr};
-
-#define SCREEN_WIDTH (Screen::GetInstance().GetWidth())
-#define SCREEN_HEIGHT (Screen::GetInstance().GetHeight())
- };
-}
-#endif
\ No newline at end of file
+++ /dev/null
-#include "thunderbird/include/ThunderBirdAdjustView.h"
-#include "wearable_log.h"
-
-namespace OHOS
-{
- static ThunderBirdAdjustView *g_pThunderBirdAdjustView{nullptr};
-
- ThunderBirdAdjustView::ThunderBirdAdjustView()
- {
- g_pThunderBirdAdjustView = this;
- }
-
- ThunderBirdAdjustView::~ThunderBirdAdjustView()
- {
- g_pThunderBirdAdjustView = nullptr;
- ClearAll();
- }
-
- ThunderBirdAdjustView *ThunderBirdAdjustView::GetInstance(void)
- {
- return g_pThunderBirdAdjustView;
- }
-
- void ThunderBirdAdjustView::ClearAll(void)
- {
- if (group != nullptr)
- {
- group->RemoveAll();
- delete group;
- group = nullptr;
- }
- if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
- if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
- if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
- if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
- if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
- if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
- }
-
- UIViewGroup *ThunderBirdAdjustView::ThunderBirdAdjustViewInit(void)
- {
- group = new UIViewGroup();
- if (group == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdAdjustView::group null!");
- return nullptr;
- }
- group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-
- // 公共控件
- TextLabel = new UILabelExt();
- if (TextLabel)
- {
- TextLabel->SetPosition(0, 104, 466, 48);
- TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
- TextLabel->SetVisible(false);
- group->Add(TextLabel);
- }
- RemindLabel = new UILabelExt();
- if (RemindLabel)
- {
- RemindLabel->SetPosition(0, 180, 466, 40);
- RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
- RemindLabel->SetVisible(false);
- group->Add(RemindLabel);
- }
- RemindIcon = new UIImageView();
- if (RemindIcon)
- {
- RemindIcon->SetAutoEnable(false);
- RemindIcon->SetVisible(false);
- group->Add(RemindIcon);
- }
- RemindIcon2 = new UIImageView();
- if (RemindIcon2)
- {
- RemindIcon2->SetAutoEnable(false);
- RemindIcon2->SetVisible(false);
- group->Add(RemindIcon2);
- }
- BackGround = new UIImageView();
- if (BackGround)
- {
- BackGround->SetPosition(0, 0, 300, 300);
- BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
- BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
- BackGround->SetVisible(false);
- group->Add(BackGround);
- }
-
- return group;
- }
-
- void ThunderBirdAdjustView::Show(int16_t showView)
- {
- if (group == nullptr) { return; }
- if (BackGround) { BackGround->SetVisible(false); }
- if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
- if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
- if (RemindIcon) { RemindIcon->SetVisible(false); }
- if (RemindIcon2) { RemindIcon2->SetVisible(false); }
-
- switch (showView)
- {
- case THUNDERBIRD_ADJUSTVIEW_BIND_SUCCESS:
- {
- if (TextLabel)
- {
- TextLabel->SetText("绑定成功");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("设备已成功连接");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(200, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/check.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_ADJUSTVIEW_WARNING:
- {
- if (TextLabel)
- {
- TextLabel->SetText("异常警告");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请检查设备状态");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(200, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/warning.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_ADJUSTVIEW_NETWORK_CONNECTING:
- {
- if (TextLabel)
- {
- TextLabel->SetText("网络连接中");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请稍候...");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(200, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/connecting.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- default:
- break;
- }
- }
-}
-
-
+++ /dev/null
-#include "thunderbird/include/ThunderBirdDialogueView.h"
-#include "wearable_log.h"
-
-namespace OHOS
-{
- static ThunderBirdDialogueView *g_pThunderBirdDialogueView{nullptr};
-
- ThunderBirdDialogueView::ThunderBirdDialogueView()
- {
- g_pThunderBirdDialogueView = this;
- }
-
- ThunderBirdDialogueView::~ThunderBirdDialogueView()
- {
- g_pThunderBirdDialogueView = nullptr;
- ClearAll();
- }
-
- ThunderBirdDialogueView *ThunderBirdDialogueView::GetInstance(void)
- {
- return g_pThunderBirdDialogueView;
- }
-
- void ThunderBirdDialogueView::ClearAll(void)
- {
- if (group != nullptr)
- {
- group->RemoveAll();
- delete group;
- group = nullptr;
- }
- if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
- if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
- if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
- if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
- if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
- if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
- }
-
- UIViewGroup *ThunderBirdDialogueView::ThunderBirdDialogueViewInit(void)
- {
- group = new UIViewGroup();
- if (group == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdDialogueView::group null!");
- return nullptr;
- }
- group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-
- // 公共控件
- TextLabel = new UILabelExt();
- if (TextLabel)
- {
- TextLabel->SetPosition(0, 104, 466, 48);
- TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
- TextLabel->SetVisible(false);
- group->Add(TextLabel);
- }
- RemindLabel = new UILabelExt();
- if (RemindLabel)
- {
- RemindLabel->SetPosition(0, 180, 466, 40);
- RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
- RemindLabel->SetVisible(false);
- group->Add(RemindLabel);
- }
- RemindIcon = new UIImageView();
- if (RemindIcon)
- {
- RemindIcon->SetAutoEnable(false);
- RemindIcon->SetVisible(false);
- group->Add(RemindIcon);
- }
- RemindIcon2 = new UIImageView();
- if (RemindIcon2)
- {
- RemindIcon2->SetAutoEnable(false);
- RemindIcon2->SetVisible(false);
- group->Add(RemindIcon2);
- }
- BackGround = new UIImageView();
- if (BackGround)
- {
- BackGround->SetPosition(0, 0, 300, 300);
- BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
- BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
- BackGround->SetVisible(false);
- group->Add(BackGround);
- }
-
- return group;
- }
-
- void ThunderBirdDialogueView::Show(int16_t showView)
- {
- if (group == nullptr) { return; }
- if (BackGround) { BackGround->SetVisible(false); }
- if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
- if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
- if (RemindIcon) { RemindIcon->SetVisible(false); }
- if (RemindIcon2) { RemindIcon2->SetVisible(false); }
-
- switch (showView)
- {
- case THUNDERBIRD_DIALOGUEVIEW_SPEAKING:
- {
- if (TextLabel)
- {
- TextLabel->SetText("说话中");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("正在为您播放语音");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(200, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/speaking.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_DIALOGUEVIEW_LISTENING:
- {
- if (TextLabel)
- {
- TextLabel->SetText("聆听中");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请说出您的需求");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(200, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/listening.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW:
- {
- if (TextLabel)
- {
- TextLabel->SetText("状态展示");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 取消 按 确认");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(140, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/volumedown.bin");
- RemindIcon->SetVisible(true);
- }
- if (RemindIcon2)
- {
- RemindIcon2->SetPosition(275, 320, 30, 30);
- RemindIcon2->SetSrc("/user/res/volumeup.bin");
- RemindIcon2->SetVisible(true);
- }
- break;
- }
- default:
- break;
- }
- }
-}
-
-
+++ /dev/null
-#include "thunderbird/include/ThunderBirdLullabyView.h"
-#include "wearable_log.h"
-
-namespace OHOS
-{
- static ThunderBirdLullabyView *g_pThunderBirdLullabyView{nullptr};
-
- ThunderBirdLullabyView::ThunderBirdLullabyView()
- {
- g_pThunderBirdLullabyView = this;
- }
-
- ThunderBirdLullabyView::~ThunderBirdLullabyView()
- {
- g_pThunderBirdLullabyView = nullptr;
- ClearAll();
- }
-
- ThunderBirdLullabyView *ThunderBirdLullabyView::GetInstance(void)
- {
- return g_pThunderBirdLullabyView;
- }
-
- void ThunderBirdLullabyView::ClearAll(void)
- {
- if (group != nullptr)
- {
- group->RemoveAll();
- delete group;
- group = nullptr;
- }
- if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
- if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
- if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
- if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
- if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
- if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
- }
-
- UIViewGroup *ThunderBirdLullabyView::ThunderBirdLullabyViewInit(void)
- {
- group = new UIViewGroup();
- if (group == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdLullabyView::group null!");
- return nullptr;
- }
- group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-
- // 公共控件
- TextLabel = new UILabelExt();
- if (TextLabel)
- {
- TextLabel->SetPosition(0, 104, 466, 48);
- TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
- TextLabel->SetVisible(false);
- group->Add(TextLabel);
- }
- RemindLabel = new UILabelExt();
- if (RemindLabel)
- {
- RemindLabel->SetPosition(0, 180, 466, 40);
- RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
- RemindLabel->SetVisible(false);
- group->Add(RemindLabel);
- }
- RemindIcon = new UIImageView();
- if (RemindIcon)
- {
- RemindIcon->SetAutoEnable(false);
- RemindIcon->SetVisible(false);
- group->Add(RemindIcon);
- }
- RemindIcon2 = new UIImageView();
- if (RemindIcon2)
- {
- RemindIcon2->SetAutoEnable(false);
- RemindIcon2->SetVisible(false);
- group->Add(RemindIcon2);
- }
- BackGround = new UIImageView();//有待解决
- if (BackGround)
- {
- BackGround->SetPosition(0, 0, 300, 300);
- BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
- BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
- BackGround->SetVisible(false);
- group->Add(BackGround);
- }
-
- return group;
- }
-
- void ThunderBirdLullabyView::Show(int16_t showView)
- {
- if (group == nullptr) { return; }
- if (BackGround) { BackGround->SetVisible(false); }
- if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
- if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
- if (RemindIcon) { RemindIcon->SetVisible(false); }
- if (RemindIcon2) { RemindIcon2->SetVisible(false); }
-
- switch (showView)
- {
- case THUNDERBIRD_LULLABYVIEW_1:
- {
- if (TextLabel)
- {
- TextLabel->SetText("按 说“哄我睡觉”");
- TextLabel->SetVisible(true);
- }
- if(RemindIcon)
- {
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_LULLABYVIEW_2:
- {
- if (TextLabel)
- {
- TextLabel->SetText("是否开启哄睡模式");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 取消 按 确认");
- RemindLabel->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_LULLABYVIEW_3:
- {
- if (TextLabel)
- {
- TextLabel->SetText(" 告诉我想听的故事");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 取消 按 确认");
- RemindLabel->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_LULLABYVIEW_4:
- {
- if (TextLabel)
- {
- TextLabel->SetText("从前有座山");
- TextLabel->SetVisible(true);
- }
- if(RemindLabel)
- {
- RemindLabel->SetText("按 下一页");
- RemindLabel->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_LULLABYVIEW_5:
- {
- if (TextLabel)
- {
- TextLabel->SetText("是否退出哄睡模式");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if(RemindLabel)
- {
- RemindLabel->SetY(320);
- RemindLabel->SetText("按 取消 按 确认");
- RemindLabel->SetVisible(true);
- }
- if(RemindIcon)
- {
- RemindIcon->SetPosition(130, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/volumedown.bin");
- RemindIcon->SetVisible(true);
- }
- if(RemindIcon2)
- {
- RemindIcon2->SetPosition(280, 320, 30, 30);
- RemindIcon2->SetSrc("/user/res/volumeup.bin");
- RemindIcon2->SetVisible(true);
- }
- break;
- }
- default:
- break;
- }
- }
-}
-
-
+++ /dev/null
-/***
- * @Date: 2024-06-22 18:08:25
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-06-24 11:30:12
- * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThunderBirdModel.cpp
- */
-/*
- * @Author: luozheng 1732036298@qq.com
- * @Date: 2024-06-07 09:21:47
- * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-11-05 14:49:01
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThunderBirdModel.cpp
- */
-
-#include "thunderbird/include/ThunderBirdModel.h"
-#include "thunderbird/include/ThunderBirdView.h"
-#include "thunderbird/include/ThunderBirdMainView.h"
-#include "wearable_log.h"
-#include <sys/time.h>
-#include <service/graphic_service.h>
-#include "wearable_log.h"
-#include "custom_utils.h"
-#include <string.h>
-namespace OHOS
-{
- ThunderBirdModel::ThunderBirdModel() {}
- ThunderBirdModel::~ThunderBirdModel() {}
-
- ThunderBirdModel *ThunderBirdModel::GetInstance()
- {
- static ThunderBirdModel instance;
- return &instance;
- }
- // 获取当前时间戳字符串
- std::string ThunderBirdModel::GetCurrentTimeStr()
- {
- uint32_t timeStamp = 0;
- if (uapi_get_timestampe_ss(&timeStamp) != ERRCODE_SUCC)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to get timestamp");
- return "----/--/-- \n --/--";
- }
- // 将时间戳转换为 time_t 类型
- time_t rawtime = static_cast<time_t>(timeStamp);
- struct tm *timeinfo = localtime(&rawtime);
-
- if (timeinfo == NULL)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to convert time");
- return "----/--/-- \n --/--";
- }
-
- // 格式化时间为字符串 (HH:MM:SS format)
- char buffer[20]; // 格式: HH:MM:SS
- std::strftime(buffer, sizeof(buffer), "%H:%M", timeinfo);
- return std::string(buffer);
- }
- void ThunderBirdModel::timer_callback_proc()
- {
- ThunderBirdMainView *view = ThunderBirdMainView::GetInstance();
- if (view)
- {
- view->UpdateTimeText(GetCurrentTimeStr().c_str());
- }
- }
-
- static osTimerId_t g_timer = nullptr;
- /*定时器到期时的处理*/
- static void TimerCallbackProc(uint8_t data)
- {
- // 倒计时
- ThunderBirdModel::GetInstance()->timer_callback_proc();
- ThunderBirdMainView::GetInstance()->updateSignalDisplay();
- ThunderBirdMainView::GetInstance()->UpdateBatteryProcess();
- }
- /*
- * @brief 回调函数
- */
- static void TimerCallback(uint8_t data)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TimerCallback %d", data);
- GraphicService::GetInstance()->PostGraphicEvent(
- std::bind(TimerCallbackProc, data));
- }
-
- /*
- * @brief 开启定时器函数
- * @param interval 时间间隔,单位ms
- */
- void ThunderBirdModel::StartTimer(uint32_t interval)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::StartTimer");
- /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回
- * ------------------------- */
- if (g_timer != nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer already exists!!");
- return;
- }
-
- /* --------------------------------- 2.创建定时器
- * -------------------------------- */
- g_timer = osTimerNew((osTimerFunc_t)TimerCallback, osTimerPeriodic,
- nullptr, nullptr);
- // 检查定时器创建是否成功
- if (g_timer == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer create failed!!");
- return;
- }
-
- /* ----------------------------- 3.将毫秒转换为系统时钟节拍数
- * ---------------------------- */
- /* --------------------------------- 4.启动定时器
- * -------------------------------- */
- osStatus_t ret = osTimerStart(g_timer, interval);
- /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为
- * nullptr -------------------- */
- if (ret != osOK)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
- "osTimerDelete failed, ret = %lx!!", ret);
- if (g_timer != nullptr)
- {
- ret = osTimerDelete(g_timer);
- }
- g_timer = nullptr;
- return;
- }
- }
- /*
- * @brief 停止定时器
- */
- void ThunderBirdModel::StopTimer(void)
- {
- // 检查定时器是否存在
- if (g_timer != nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::BP_StopTimer");
- osTimerStop(g_timer);
- // 删除定时器并置为 nullptr
- osStatus_t ret = osTimerDelete(g_timer);
- if (ret != osOK)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
- "osTimerDelete failed, ret = %lx!!", ret);
- }
- g_timer = nullptr;
- }
- }
-
-}
+++ /dev/null
-#include "thunderbird/include/ThunderBirdOtaView.h"
-#include "wearable_log.h"
-
-namespace OHOS
-{
- static ThunderBirdOtaView *g_pThunderBirdOtaView{nullptr};
-
- ThunderBirdOtaView::ThunderBirdOtaView()
- {
- g_pThunderBirdOtaView = this;
- }
-
- ThunderBirdOtaView::~ThunderBirdOtaView()
- {
- g_pThunderBirdOtaView = nullptr;
- ClearAll();
- }
-
- ThunderBirdOtaView *ThunderBirdOtaView::GetInstance(void)
- {
- return g_pThunderBirdOtaView;
- }
-
- void ThunderBirdOtaView::ClearAll(void)
- {
- if (group != nullptr)
- {
- group->RemoveAll();
- delete group;
- group = nullptr;
- }
- if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
- if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
- if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
- if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
- if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
- if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
- }
-
- UIViewGroup *ThunderBirdOtaView::ThunderBirdOtaViewInit(void)
- {
- group = new UIViewGroup();
- if (group == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdOtaView::group null!");
- return nullptr;
- }
- group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-
- // 公共控件
- TextLabel = new UILabelExt();
- if (TextLabel)
- {
- TextLabel->SetPosition(0, 104, 466, 48);
- TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
- TextLabel->SetVisible(false);
- group->Add(TextLabel);
- }
- RemindLabel = new UILabelExt();
- if (RemindLabel)
- {
- RemindLabel->SetPosition(0, 180, 466, 40);
- RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
- RemindLabel->SetVisible(false);
- group->Add(RemindLabel);
- }
- RemindIcon = new UIImageView();
- if (RemindIcon)
- {
- RemindIcon->SetAutoEnable(false);
- RemindIcon->SetVisible(false);
- group->Add(RemindIcon);
- }
- RemindIcon2 = new UIImageView();
- if (RemindIcon2)
- {
- RemindIcon2->SetAutoEnable(false);
- RemindIcon2->SetVisible(false);
- group->Add(RemindIcon2);
- }
- BackGround = new UIImageView();
- if (BackGround)
- {
- BackGround->SetPosition(0, 0, 300, 300);
- BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
- BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
- BackGround->SetVisible(false);
- group->Add(BackGround);
- }
-
- return group;
- }
-
- void ThunderBirdOtaView::Show(int16_t showView)
- {
- if (group == nullptr) { return; }
- if (BackGround) { BackGround->SetVisible(false); }
- if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
- if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
- if (RemindIcon) { RemindIcon->SetVisible(false); }
- if (RemindIcon2) { RemindIcon2->SetVisible(false); }
-
- switch (showView)
- {
- case THUNDERBIRD_OTAVIEW_READY:
- {
- if (TextLabel)
- {
- TextLabel->SetText("OTA 就绪");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 检查更新");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(180, 175, 30, 30);
- RemindIcon->SetSrc("/user/res/volumeup.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_NEW_FEATURE:
- {
- if (TextLabel)
- {
- TextLabel->SetText("有新功能可用");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 取消 按 更新");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(140, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/volumedown.bin");
- RemindIcon->SetVisible(true);
- }
- if (RemindIcon2)
- {
- RemindIcon2->SetPosition(275, 320, 30, 30);
- RemindIcon2->SetSrc("/user/res/volumeup.bin");
- RemindIcon2->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_UPDATE_NOW:
- {
- if (TextLabel)
- {
- TextLabel->SetText("需要立即更新");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 取消 按 立即更新");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(140, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/volumedown.bin");
- RemindIcon->SetVisible(true);
- }
- if (RemindIcon2)
- {
- RemindIcon2->SetPosition(275, 320, 30, 30);
- RemindIcon2->SetSrc("/user/res/volumeup.bin");
- RemindIcon2->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_NIGHT_UPDATE:
- {
- if (TextLabel)
- {
- TextLabel->SetText("设置夜间更新");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 取消 按 确认");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(140, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/volumedown.bin");
- RemindIcon->SetVisible(true);
- }
- if (RemindIcon2)
- {
- RemindIcon2->SetPosition(275, 320, 30, 30);
- RemindIcon2->SetSrc("/user/res/volumeup.bin");
- RemindIcon2->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_NIGHT_UPDATE_SUCCESS:
- {
- if (TextLabel)
- {
- TextLabel->SetText("夜间更新设置成功");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("将在夜间自动更新");
- RemindLabel->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_COUNTDOWN:
- {
- if (TextLabel)
- {
- TextLabel->SetText("更新倒计时");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 取消更新");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(180, 175, 30, 30);
- RemindIcon->SetSrc("/user/res/volumeup.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_LOW_BATTERY:
- {
- if (TextLabel)
- {
- TextLabel->SetText("电量不足");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请充电后重试");
- RemindLabel->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_NETWORK_ERROR:
- {
- if (TextLabel)
- {
- TextLabel->SetText("网络异常");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请检查网络连接");
- RemindLabel->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_MEMORY_ERROR:
- {
- if (TextLabel)
- {
- TextLabel->SetText("内存不足");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请清理存储空间");
- RemindLabel->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS:
- {
- if (TextLabel)
- {
- TextLabel->SetText("更新成功");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 重启设备");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(140, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/check.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_OTAVIEW_UPDATE_FAILED:
- {
- if (TextLabel)
- {
- TextLabel->SetText("更新未完成");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 重试 按 取消");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(140, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/volumedown.bin");
- RemindIcon->SetVisible(true);
- }
- if (RemindIcon2)
- {
- RemindIcon2->SetPosition(275, 320, 30, 30);
- RemindIcon2->SetSrc("/user/res/volumeup.bin");
- RemindIcon2->SetVisible(true);
- }
- break;
- }
- default:
- break;
- }
- }
-}
-
-
+++ /dev/null
-#include "thunderbird/include/ThunderBirdReminderView.h"
-#include "wearable_log.h"
-
-namespace OHOS
-{
- static ThunderBirdReminderView *g_pThunderBirdReminderView{nullptr};
-
- ThunderBirdReminderView::ThunderBirdReminderView()
- {
- g_pThunderBirdReminderView = this;
- }
-
- ThunderBirdReminderView::~ThunderBirdReminderView()
- {
- g_pThunderBirdReminderView = nullptr;
- ClearAll();
- }
-
- ThunderBirdReminderView *ThunderBirdReminderView::GetInstance(void)
- {
- return g_pThunderBirdReminderView;
- }
-
- void ThunderBirdReminderView::ClearAll(void)
- {
- if (group != nullptr)
- {
- group->RemoveAll();
- delete group;
- group = nullptr;
- }
- if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
- if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
- if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
- if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
- if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
- if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
- }
-
- UIViewGroup *ThunderBirdReminderView::ThunderBirdReminderViewInit(void)
- {
- group = new UIViewGroup();
- if (group == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdReminderView::group null!");
- return nullptr;
- }
- group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-
- // 公共控件
- TextLabel = new UILabelExt();
- if (TextLabel)
- {
- TextLabel->SetPosition(0, 104, 466, 48);
- TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
- TextLabel->SetVisible(false);
- group->Add(TextLabel);
- }
- RemindLabel = new UILabelExt();
- if (RemindLabel)
- {
- RemindLabel->SetPosition(0, 180, 466, 40);
- RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
- RemindLabel->SetVisible(false);
- group->Add(RemindLabel);
- }
- RemindIcon = new UIImageView();
- if (RemindIcon)
- {
- RemindIcon->SetAutoEnable(false);
- RemindIcon->SetVisible(false);
- group->Add(RemindIcon);
- }
- RemindIcon2 = new UIImageView();
- if (RemindIcon2)
- {
- RemindIcon2->SetAutoEnable(false);
- RemindIcon2->SetVisible(false);
- group->Add(RemindIcon2);
- }
- BackGround = new UIImageView();
- if (BackGround)
- {
- BackGround->SetPosition(0, 0, 300, 300);
- BackGround->SetStyle(STYLE_BACKGROUND_COLOR, 0x66191919);
- BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
- BackGround->SetVisible(false);
- group->Add(BackGround);
- }
-
- return group;
- }
-
- void ThunderBirdReminderView::Show(int16_t showView)
- {
- if (group == nullptr) { return; }
- if (BackGround) { BackGround->SetVisible(false); }
- if (TextLabel) { TextLabel->SetVisible(false); TextLabel->SetY(104); }
- if (RemindLabel) { RemindLabel->SetVisible(false); RemindLabel->SetY(180); }
- if (RemindIcon) { RemindIcon->SetVisible(false); }
- if (RemindIcon2) { RemindIcon2->SetVisible(false); }
-
- switch (showView)
- {
- case THUNDERBIRD_REMINDERVIEW_VOLUME:
- {
- if (TextLabel)
- {
- TextLabel->SetText("音量调节");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 减小音量 按 增大音量");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(140, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/volumedown.bin");
- RemindIcon->SetVisible(true);
- }
- if (RemindIcon2)
- {
- RemindIcon2->SetPosition(275, 320, 30, 30);
- RemindIcon2->SetSrc("/user/res/volumeup.bin");
- RemindIcon2->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_REMINDERVIEW_TASK_REMINDER:
- {
- if (TextLabel)
- {
- TextLabel->SetText("事项提醒");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("您有新的提醒事项");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(180, 175, 30, 30);
- RemindIcon->SetSrc("/user/res/notification.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT:
- {
- if (TextLabel)
- {
- TextLabel->SetText("网络断开");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请检查网络连接");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(180, 175, 30, 30);
- RemindIcon->SetSrc("/user/res/wifi_off.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_REMINDERVIEW_LOW_BATTERY:
- {
- if (TextLabel)
- {
- TextLabel->SetText("电量不足");
- TextLabel->SetY(160);
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请及时充电");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(180, 175, 30, 30);
- RemindIcon->SetSrc("/user/res/battery_low.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_REMINDERVIEW_CHARGING:
- {
- if (TextLabel)
- {
- TextLabel->SetText("充电中");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("请保持连接");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(200, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/charging.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- case THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE:
- {
- if (TextLabel)
- {
- TextLabel->SetText("充电完成");
- TextLabel->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("可以拔掉充电器");
- RemindLabel->SetVisible(true);
- }
- if (RemindIcon)
- {
- RemindIcon->SetPosition(200, 320, 30, 30);
- RemindIcon->SetSrc("/user/res/check.bin");
- RemindIcon->SetVisible(true);
- }
- break;
- }
- default:
- break;
- }
- }
-}
-
-
+++ /dev/null
-#include "thunderbird/include/ThunderBirdView.h"
-#include "thunderbird/include/ThunderBirdModel.h"
-#include "thunderbird/include/ThunderBirdPresenter.h"
-#include "wearable_log.h"
-#include "NativeAbility.h"
-#include "msg_center.h"
-#include "securec.h"
-#include "common/low_power_manager.h"
-#include "common/image_cache_manager.h"
-#include "uicomponents/UIComponents.h"
-
-
-namespace OHOS
-{
- static ThunderBirdView *g_pThunderBirdView{nullptr};
-
- ThunderBirdView::ThunderBirdView()
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdView::ThunderBirdView");
- g_pThunderBirdView = this;
-
- }
-
- ThunderBirdView::~ThunderBirdView()
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdView::~ThunderBirdView");
- g_pThunderBirdView = nullptr;
- ClearAll();
- RootView::GetInstance()->ClearOnKeyActListener();
- }
-
- ThunderBirdView *ThunderBirdView::GetInstance()
- {
- return g_pThunderBirdView;
- }
-
- void ThunderBirdView::ClearAll(void)
- {
-
- // 清理UI组件
- if (group != nullptr)
- {
- group->RemoveAll();
- delete group;
- group = nullptr;
- }
- }
-
- UIViewGroup *ThunderBirdView::ThunderBirdViewInit(void)
- {
- group = new UIViewGroup();
- if (group == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPopUpView::group null!");
- return nullptr;
- }
- group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-
- // InitBlackGround();
- InitText();
-
- return group;
- }
-
- void ThunderBirdView::InitBlackGround()
- {
- ground = new UIImageView();
- if (ground == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ground new fail");
- return;
- }
- ground->SetStyle(STYLE_BACKGROUND_COLOR, 0x8D000000);
- ground->SetStyle(STYLE_BACKGROUND_OPA, 0x8D);
- // ground->SetStyle(STYLE_BORDER_RADIUS, 200);
- ground->SetPosition(0, 0, 466, 466);
- // ground->SetStyle(STYLE_BORDER_COLOR, Color::Gray().full);
- group->Add(ground);
- }
- void ThunderBirdView::InitText()
- {
- Remindground = new UIImageView();
- if (Remindground == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Remindground new fail");
- return;
- }
- Remindground->SetStyle(STYLE_BACKGROUND_COLOR, 0x8D101010);
- Remindground->SetStyle(STYLE_BACKGROUND_OPA, 0x8D);
- Remindground->SetStyle(STYLE_BORDER_RADIUS, 200);
- Remindground->SetPosition(130, 201, 320, 46);
- Remindground->SetStyle(STYLE_BORDER_COLOR, Color::Gray().full);
- // group->Add(Remindground);
-
- InitLabel(TextLabel, 100, 104, 300, 48, "TextLabel", "08:52", DEFAULT_VECTOR_FONT_FILENAME, 38);
- TextLabel->SetText("Hey, 我是毛毛~");
- TextLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT);
- group->Add(TextLabel);
-
- InitLabel(RemindLabel, 135, 198, 300, 40, "TextLabel", "08:52", DEFAULT_VECTOR_FONT_FILENAME, 30);
- RemindLabel->SetText("按 下一页");
- TextLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT);
- // group->Add(RemindLabel);
- }
-}
\ No newline at end of file
VIEW_SLEEPING,
VIEW_TRAINING,
VIEW_EMPTY,
+ VIEW_THUNDER_BIRD,
#ifdef SUPPORT_ALIPAY_SEC
VIEW_MAIN_ALIPAY,
#endif
static constexpr const char *PNG_A019_094_IMAGE_PATH = APP_RES_PATH"/BLUETOOTH_IMAGE_15.bin";
static constexpr const char *PNG_A019_095_IMAGE_PATH = APP_RES_PATH"/BLUETOOTH_IMAGE_16.bin";
static constexpr const char *PNG_BLUETOOTHEAR = APP_RES_PATH"/BLUETOOTHEAR.bin";
+
+ // Thunderbird animations: speak 1..25
+ static constexpr const char *TB_SPEAK_IMAGE_1 = APP_RES_PATH"/animated_icon/speak/1.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_2 = APP_RES_PATH"/animated_icon/speak/2.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_3 = APP_RES_PATH"/animated_icon/speak/3.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_4 = APP_RES_PATH"/animated_icon/speak/4.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_5 = APP_RES_PATH"/animated_icon/speak/5.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_6 = APP_RES_PATH"/animated_icon/speak/6.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_7 = APP_RES_PATH"/animated_icon/speak/7.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_8 = APP_RES_PATH"/animated_icon/speak/8.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_9 = APP_RES_PATH"/animated_icon/speak/9.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_10 = APP_RES_PATH"/animated_icon/speak/10.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_11 = APP_RES_PATH"/animated_icon/speak/11.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_12 = APP_RES_PATH"/animated_icon/speak/12.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_13 = APP_RES_PATH"/animated_icon/speak/13.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_14 = APP_RES_PATH"/animated_icon/speak/14.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_15 = APP_RES_PATH"/animated_icon/speak/15.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_16 = APP_RES_PATH"/animated_icon/speak/16.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_17 = APP_RES_PATH"/animated_icon/speak/17.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_18 = APP_RES_PATH"/animated_icon/speak/18.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_19 = APP_RES_PATH"/animated_icon/speak/19.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_20 = APP_RES_PATH"/animated_icon/speak/20.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_21 = APP_RES_PATH"/animated_icon/speak/21.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_22 = APP_RES_PATH"/animated_icon/speak/22.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_23 = APP_RES_PATH"/animated_icon/speak/23.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_24 = APP_RES_PATH"/animated_icon/speak/24.bin";
+ static constexpr const char *TB_SPEAK_IMAGE_25 = APP_RES_PATH"/animated_icon/speak/25.bin";
+
+ // Thunderbird animations: listen 1..61
+ static constexpr const char *TB_LISTEN_IMAGE_1 = APP_RES_PATH"/animated_icon/listen/1.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_2 = APP_RES_PATH"/animated_icon/listen/2.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_3 = APP_RES_PATH"/animated_icon/listen/3.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_4 = APP_RES_PATH"/animated_icon/listen/4.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_5 = APP_RES_PATH"/animated_icon/listen/5.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_6 = APP_RES_PATH"/animated_icon/listen/6.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_7 = APP_RES_PATH"/animated_icon/listen/7.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_8 = APP_RES_PATH"/animated_icon/listen/8.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_9 = APP_RES_PATH"/animated_icon/listen/9.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_10 = APP_RES_PATH"/animated_icon/listen/10.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_11 = APP_RES_PATH"/animated_icon/listen/11.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_12 = APP_RES_PATH"/animated_icon/listen/12.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_13 = APP_RES_PATH"/animated_icon/listen/13.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_14 = APP_RES_PATH"/animated_icon/listen/14.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_15 = APP_RES_PATH"/animated_icon/listen/15.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_16 = APP_RES_PATH"/animated_icon/listen/16.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_17 = APP_RES_PATH"/animated_icon/listen/17.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_18 = APP_RES_PATH"/animated_icon/listen/18.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_19 = APP_RES_PATH"/animated_icon/listen/19.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_20 = APP_RES_PATH"/animated_icon/listen/20.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_21 = APP_RES_PATH"/animated_icon/listen/21.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_22 = APP_RES_PATH"/animated_icon/listen/22.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_23 = APP_RES_PATH"/animated_icon/listen/23.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_24 = APP_RES_PATH"/animated_icon/listen/24.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_25 = APP_RES_PATH"/animated_icon/listen/25.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_26 = APP_RES_PATH"/animated_icon/listen/26.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_27 = APP_RES_PATH"/animated_icon/listen/27.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_28 = APP_RES_PATH"/animated_icon/listen/28.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_29 = APP_RES_PATH"/animated_icon/listen/29.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_30 = APP_RES_PATH"/animated_icon/listen/30.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_31 = APP_RES_PATH"/animated_icon/listen/31.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_32 = APP_RES_PATH"/animated_icon/listen/32.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_33 = APP_RES_PATH"/animated_icon/listen/33.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_34 = APP_RES_PATH"/animated_icon/listen/34.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_35 = APP_RES_PATH"/animated_icon/listen/35.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_36 = APP_RES_PATH"/animated_icon/listen/36.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_37 = APP_RES_PATH"/animated_icon/listen/37.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_38 = APP_RES_PATH"/animated_icon/listen/38.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_39 = APP_RES_PATH"/animated_icon/listen/39.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_40 = APP_RES_PATH"/animated_icon/listen/40.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_41 = APP_RES_PATH"/animated_icon/listen/41.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_42 = APP_RES_PATH"/animated_icon/listen/42.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_43 = APP_RES_PATH"/animated_icon/listen/43.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_44 = APP_RES_PATH"/animated_icon/listen/44.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_45 = APP_RES_PATH"/animated_icon/listen/45.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_46 = APP_RES_PATH"/animated_icon/listen/46.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_47 = APP_RES_PATH"/animated_icon/listen/47.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_48 = APP_RES_PATH"/animated_icon/listen/48.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_49 = APP_RES_PATH"/animated_icon/listen/49.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_50 = APP_RES_PATH"/animated_icon/listen/50.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_51 = APP_RES_PATH"/animated_icon/listen/51.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_52 = APP_RES_PATH"/animated_icon/listen/52.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_53 = APP_RES_PATH"/animated_icon/listen/53.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_54 = APP_RES_PATH"/animated_icon/listen/54.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_55 = APP_RES_PATH"/animated_icon/listen/55.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_56 = APP_RES_PATH"/animated_icon/listen/56.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_57 = APP_RES_PATH"/animated_icon/listen/57.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_58 = APP_RES_PATH"/animated_icon/listen/58.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_59 = APP_RES_PATH"/animated_icon/listen/59.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_60 = APP_RES_PATH"/animated_icon/listen/60.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_61 = APP_RES_PATH"/animated_icon/listen/61.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_62 = APP_RES_PATH"/animated_icon/listen/62.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_63 = APP_RES_PATH"/animated_icon/listen/63.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_64 = APP_RES_PATH"/animated_icon/listen/64.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_65 = APP_RES_PATH"/animated_icon/listen/65.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_66 = APP_RES_PATH"/animated_icon/listen/66.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_67 = APP_RES_PATH"/animated_icon/listen/67.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_68 = APP_RES_PATH"/animated_icon/listen/68.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_69 = APP_RES_PATH"/animated_icon/listen/69.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_70 = APP_RES_PATH"/animated_icon/listen/70.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_71 = APP_RES_PATH"/animated_icon/listen/71.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_72 = APP_RES_PATH"/animated_icon/listen/72.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_73 = APP_RES_PATH"/animated_icon/listen/73.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_74 = APP_RES_PATH"/animated_icon/listen/74.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_75 = APP_RES_PATH"/animated_icon/listen/75.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_76 = APP_RES_PATH"/animated_icon/listen/76.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_77 = APP_RES_PATH"/animated_icon/listen/77.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_78 = APP_RES_PATH"/animated_icon/listen/78.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_79 = APP_RES_PATH"/animated_icon/listen/79.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_80 = APP_RES_PATH"/animated_icon/listen/80.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_81 = APP_RES_PATH"/animated_icon/listen/81.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_82 = APP_RES_PATH"/animated_icon/listen/82.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_83 = APP_RES_PATH"/animated_icon/listen/83.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_84 = APP_RES_PATH"/animated_icon/listen/84.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_85 = APP_RES_PATH"/animated_icon/listen/85.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_86 = APP_RES_PATH"/animated_icon/listen/86.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_87 = APP_RES_PATH"/animated_icon/listen/87.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_88 = APP_RES_PATH"/animated_icon/listen/88.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_89 = APP_RES_PATH"/animated_icon/listen/89.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_90 = APP_RES_PATH"/animated_icon/listen/90.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_91 = APP_RES_PATH"/animated_icon/listen/91.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_92 = APP_RES_PATH"/animated_icon/listen/92.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_93 = APP_RES_PATH"/animated_icon/listen/93.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_94 = APP_RES_PATH"/animated_icon/listen/94.bin";
+ static constexpr const char *TB_LISTEN_IMAGE_95 = APP_RES_PATH"/animated_icon/listen/95.bin";
+
+ // Thunderbird shutdown 1..95
+ static constexpr const char *TB_SHUTDOWN_IMAGE_1 = APP_RES_PATH"/RebootAndShutDown/ShutDown/1.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_2 = APP_RES_PATH"/RebootAndShutDown/ShutDown/2.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_3 = APP_RES_PATH"/RebootAndShutDown/ShutDown/3.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_4 = APP_RES_PATH"/RebootAndShutDown/ShutDown/4.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_5 = APP_RES_PATH"/RebootAndShutDown/ShutDown/5.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_6 = APP_RES_PATH"/RebootAndShutDown/ShutDown/6.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_7 = APP_RES_PATH"/RebootAndShutDown/ShutDown/7.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_8 = APP_RES_PATH"/RebootAndShutDown/ShutDown/8.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_9 = APP_RES_PATH"/RebootAndShutDown/ShutDown/9.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_10 = APP_RES_PATH"/RebootAndShutDown/ShutDown/10.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_11 = APP_RES_PATH"/RebootAndShutDown/ShutDown/11.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_12 = APP_RES_PATH"/RebootAndShutDown/ShutDown/12.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_13 = APP_RES_PATH"/RebootAndShutDown/ShutDown/13.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_14 = APP_RES_PATH"/RebootAndShutDown/ShutDown/14.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_15 = APP_RES_PATH"/RebootAndShutDown/ShutDown/15.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_16 = APP_RES_PATH"/RebootAndShutDown/ShutDown/16.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_17 = APP_RES_PATH"/RebootAndShutDown/ShutDown/17.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_18 = APP_RES_PATH"/RebootAndShutDown/ShutDown/18.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_19 = APP_RES_PATH"/RebootAndShutDown/ShutDown/19.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_20 = APP_RES_PATH"/RebootAndShutDown/ShutDown/20.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_21 = APP_RES_PATH"/RebootAndShutDown/ShutDown/21.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_22 = APP_RES_PATH"/RebootAndShutDown/ShutDown/22.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_23 = APP_RES_PATH"/RebootAndShutDown/ShutDown/23.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_24 = APP_RES_PATH"/RebootAndShutDown/ShutDown/24.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_25 = APP_RES_PATH"/RebootAndShutDown/ShutDown/25.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_26 = APP_RES_PATH"/RebootAndShutDown/ShutDown/26.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_27 = APP_RES_PATH"/RebootAndShutDown/ShutDown/27.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_28 = APP_RES_PATH"/RebootAndShutDown/ShutDown/28.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_29 = APP_RES_PATH"/RebootAndShutDown/ShutDown/29.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_30 = APP_RES_PATH"/RebootAndShutDown/ShutDown/30.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_31 = APP_RES_PATH"/RebootAndShutDown/ShutDown/31.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_32 = APP_RES_PATH"/RebootAndShutDown/ShutDown/32.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_33 = APP_RES_PATH"/RebootAndShutDown/ShutDown/33.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_34 = APP_RES_PATH"/RebootAndShutDown/ShutDown/34.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_35 = APP_RES_PATH"/RebootAndShutDown/ShutDown/35.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_36 = APP_RES_PATH"/RebootAndShutDown/ShutDown/36.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_37 = APP_RES_PATH"/RebootAndShutDown/ShutDown/37.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_38 = APP_RES_PATH"/RebootAndShutDown/ShutDown/38.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_39 = APP_RES_PATH"/RebootAndShutDown/ShutDown/39.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_40 = APP_RES_PATH"/RebootAndShutDown/ShutDown/40.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_41 = APP_RES_PATH"/RebootAndShutDown/ShutDown/41.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_42 = APP_RES_PATH"/RebootAndShutDown/ShutDown/42.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_43 = APP_RES_PATH"/RebootAndShutDown/ShutDown/43.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_44 = APP_RES_PATH"/RebootAndShutDown/ShutDown/44.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_45 = APP_RES_PATH"/RebootAndShutDown/ShutDown/45.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_46 = APP_RES_PATH"/RebootAndShutDown/ShutDown/46.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_47 = APP_RES_PATH"/RebootAndShutDown/ShutDown/47.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_48 = APP_RES_PATH"/RebootAndShutDown/ShutDown/48.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_49 = APP_RES_PATH"/RebootAndShutDown/ShutDown/49.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_50 = APP_RES_PATH"/RebootAndShutDown/ShutDown/50.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_51 = APP_RES_PATH"/RebootAndShutDown/ShutDown/51.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_52 = APP_RES_PATH"/RebootAndShutDown/ShutDown/52.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_53 = APP_RES_PATH"/RebootAndShutDown/ShutDown/53.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_54 = APP_RES_PATH"/RebootAndShutDown/ShutDown/54.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_55 = APP_RES_PATH"/RebootAndShutDown/ShutDown/55.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_56 = APP_RES_PATH"/RebootAndShutDown/ShutDown/56.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_57 = APP_RES_PATH"/RebootAndShutDown/ShutDown/57.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_58 = APP_RES_PATH"/RebootAndShutDown/ShutDown/58.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_59 = APP_RES_PATH"/RebootAndShutDown/ShutDown/59.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_60 = APP_RES_PATH"/RebootAndShutDown/ShutDown/60.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_61 = APP_RES_PATH"/RebootAndShutDown/ShutDown/61.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_62 = APP_RES_PATH"/RebootAndShutDown/ShutDown/62.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_63 = APP_RES_PATH"/RebootAndShutDown/ShutDown/63.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_64 = APP_RES_PATH"/RebootAndShutDown/ShutDown/64.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_65 = APP_RES_PATH"/RebootAndShutDown/ShutDown/65.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_66 = APP_RES_PATH"/RebootAndShutDown/ShutDown/66.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_67 = APP_RES_PATH"/RebootAndShutDown/ShutDown/67.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_68 = APP_RES_PATH"/RebootAndShutDown/ShutDown/68.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_69 = APP_RES_PATH"/RebootAndShutDown/ShutDown/69.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_70 = APP_RES_PATH"/RebootAndShutDown/ShutDown/70.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_71 = APP_RES_PATH"/RebootAndShutDown/ShutDown/71.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_72 = APP_RES_PATH"/RebootAndShutDown/ShutDown/72.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_73 = APP_RES_PATH"/RebootAndShutDown/ShutDown/73.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_74 = APP_RES_PATH"/RebootAndShutDown/ShutDown/74.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_75 = APP_RES_PATH"/RebootAndShutDown/ShutDown/75.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_76 = APP_RES_PATH"/RebootAndShutDown/ShutDown/76.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_77 = APP_RES_PATH"/RebootAndShutDown/ShutDown/77.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_78 = APP_RES_PATH"/RebootAndShutDown/ShutDown/78.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_79 = APP_RES_PATH"/RebootAndShutDown/ShutDown/79.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_80 = APP_RES_PATH"/RebootAndShutDown/ShutDown/80.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_81 = APP_RES_PATH"/RebootAndShutDown/ShutDown/81.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_82 = APP_RES_PATH"/RebootAndShutDown/ShutDown/82.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_83 = APP_RES_PATH"/RebootAndShutDown/ShutDown/83.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_84 = APP_RES_PATH"/RebootAndShutDown/ShutDown/84.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_85 = APP_RES_PATH"/RebootAndShutDown/ShutDown/85.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_86 = APP_RES_PATH"/RebootAndShutDown/ShutDown/86.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_87 = APP_RES_PATH"/RebootAndShutDown/ShutDown/87.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_88 = APP_RES_PATH"/RebootAndShutDown/ShutDown/88.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_89 = APP_RES_PATH"/RebootAndShutDown/ShutDown/89.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_90 = APP_RES_PATH"/RebootAndShutDown/ShutDown/90.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_91 = APP_RES_PATH"/RebootAndShutDown/ShutDown/91.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_92 = APP_RES_PATH"/RebootAndShutDown/ShutDown/92.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_93 = APP_RES_PATH"/RebootAndShutDown/ShutDown/93.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_94 = APP_RES_PATH"/RebootAndShutDown/ShutDown/94.bin";
+ static constexpr const char *TB_SHUTDOWN_IMAGE_95 = APP_RES_PATH"/RebootAndShutDown/ShutDown/95.bin";
+
+ // Thunderbird naughty (test) 1..86
+ static constexpr const char *TB_NAUGHTY_IMAGE_1 = APP_RES_PATH"/emoticon/naughty/1.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_2 = APP_RES_PATH"/emoticon/naughty/2.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_3 = APP_RES_PATH"/emoticon/naughty/3.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_4 = APP_RES_PATH"/emoticon/naughty/4.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_5 = APP_RES_PATH"/emoticon/naughty/5.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_6 = APP_RES_PATH"/emoticon/naughty/6.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_7 = APP_RES_PATH"/emoticon/naughty/7.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_8 = APP_RES_PATH"/emoticon/naughty/8.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_9 = APP_RES_PATH"/emoticon/naughty/9.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_10 = APP_RES_PATH"/emoticon/naughty/10.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_11 = APP_RES_PATH"/emoticon/naughty/11.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_12 = APP_RES_PATH"/emoticon/naughty/12.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_13 = APP_RES_PATH"/emoticon/naughty/13.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_14 = APP_RES_PATH"/emoticon/naughty/14.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_15 = APP_RES_PATH"/emoticon/naughty/15.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_16 = APP_RES_PATH"/emoticon/naughty/16.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_17 = APP_RES_PATH"/emoticon/naughty/17.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_18 = APP_RES_PATH"/emoticon/naughty/18.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_19 = APP_RES_PATH"/emoticon/naughty/19.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_20 = APP_RES_PATH"/emoticon/naughty/20.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_21 = APP_RES_PATH"/emoticon/naughty/21.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_22 = APP_RES_PATH"/emoticon/naughty/22.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_23 = APP_RES_PATH"/emoticon/naughty/23.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_24 = APP_RES_PATH"/emoticon/naughty/24.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_25 = APP_RES_PATH"/emoticon/naughty/25.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_26 = APP_RES_PATH"/emoticon/naughty/26.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_27 = APP_RES_PATH"/emoticon/naughty/27.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_28 = APP_RES_PATH"/emoticon/naughty/28.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_29 = APP_RES_PATH"/emoticon/naughty/29.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_30 = APP_RES_PATH"/emoticon/naughty/30.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_31 = APP_RES_PATH"/emoticon/naughty/31.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_32 = APP_RES_PATH"/emoticon/naughty/32.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_33 = APP_RES_PATH"/emoticon/naughty/33.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_34 = APP_RES_PATH"/emoticon/naughty/34.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_35 = APP_RES_PATH"/emoticon/naughty/35.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_36 = APP_RES_PATH"/emoticon/naughty/36.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_37 = APP_RES_PATH"/emoticon/naughty/37.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_38 = APP_RES_PATH"/emoticon/naughty/38.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_39 = APP_RES_PATH"/emoticon/naughty/39.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_40 = APP_RES_PATH"/emoticon/naughty/40.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_41 = APP_RES_PATH"/emoticon/naughty/41.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_42 = APP_RES_PATH"/emoticon/naughty/42.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_43 = APP_RES_PATH"/emoticon/naughty/43.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_44 = APP_RES_PATH"/emoticon/naughty/44.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_45 = APP_RES_PATH"/emoticon/naughty/45.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_46 = APP_RES_PATH"/emoticon/naughty/46.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_47 = APP_RES_PATH"/emoticon/naughty/47.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_48 = APP_RES_PATH"/emoticon/naughty/48.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_49 = APP_RES_PATH"/emoticon/naughty/49.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_50 = APP_RES_PATH"/emoticon/naughty/50.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_51 = APP_RES_PATH"/emoticon/naughty/51.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_52 = APP_RES_PATH"/emoticon/naughty/52.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_53 = APP_RES_PATH"/emoticon/naughty/53.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_54 = APP_RES_PATH"/emoticon/naughty/54.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_55 = APP_RES_PATH"/emoticon/naughty/55.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_56 = APP_RES_PATH"/emoticon/naughty/56.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_57 = APP_RES_PATH"/emoticon/naughty/57.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_58 = APP_RES_PATH"/emoticon/naughty/58.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_59 = APP_RES_PATH"/emoticon/naughty/59.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_60 = APP_RES_PATH"/emoticon/naughty/60.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_61 = APP_RES_PATH"/emoticon/naughty/61.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_62 = APP_RES_PATH"/emoticon/naughty/62.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_63 = APP_RES_PATH"/emoticon/naughty/63.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_64 = APP_RES_PATH"/emoticon/naughty/64.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_65 = APP_RES_PATH"/emoticon/naughty/65.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_66 = APP_RES_PATH"/emoticon/naughty/66.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_67 = APP_RES_PATH"/emoticon/naughty/67.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_68 = APP_RES_PATH"/emoticon/naughty/68.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_69 = APP_RES_PATH"/emoticon/naughty/69.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_70 = APP_RES_PATH"/emoticon/naughty/70.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_71 = APP_RES_PATH"/emoticon/naughty/71.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_72 = APP_RES_PATH"/emoticon/naughty/72.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_73 = APP_RES_PATH"/emoticon/naughty/73.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_74 = APP_RES_PATH"/emoticon/naughty/74.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_75 = APP_RES_PATH"/emoticon/naughty/75.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_76 = APP_RES_PATH"/emoticon/naughty/76.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_77 = APP_RES_PATH"/emoticon/naughty/77.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_78 = APP_RES_PATH"/emoticon/naughty/78.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_79 = APP_RES_PATH"/emoticon/naughty/79.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_80 = APP_RES_PATH"/emoticon/naughty/80.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_81 = APP_RES_PATH"/emoticon/naughty/81.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_82 = APP_RES_PATH"/emoticon/naughty/82.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_83 = APP_RES_PATH"/emoticon/naughty/83.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_84 = APP_RES_PATH"/emoticon/naughty/84.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_85 = APP_RES_PATH"/emoticon/naughty/85.bin";
+ static constexpr const char *TB_NAUGHTY_IMAGE_86 = APP_RES_PATH"/emoticon/naughty/86.bin";
+
+
+
+
// AppList
static constexpr const char *PNG_APPLIST_ALARM_IMAGE = APP_RES_PATH"/APPLIST_ALARM.bin"; // 闹钟
#include "components/ui_view_group.h"
#include "components/ui_label_ext.h"
#include "components/ui_image_view.h"
+#include "components/ui_image_animator.h"
namespace OHOS
{
+ static constexpr int16_t TB_NET_ANIM_X = 38;
+ static constexpr int16_t TB_NET_ANIM_Y = 151;
+ static constexpr int16_t TB_NET_ANIM_W = 36;
+ static constexpr int16_t TB_NET_ANIM_H = 36;
+ static constexpr int16_t TB_NET_ANIM_FRAMES = 60;
+ static constexpr int16_t TB_NET_ANIM_INTERVAL = 41;
+ static constexpr const char *TB_NET_ANIM_PATH = "/user/res/animated_icon/net/";
+
class ThunderBirdAdjustView
{
public:
ThunderBirdAdjustView();
virtual ~ThunderBirdAdjustView();
static ThunderBirdAdjustView *GetInstance(void);
+ bool EnsureNetAnimator();
UIViewGroup *ThunderBirdAdjustViewInit(void);
void ClearAll(void);
void Show(int16_t showView);
private:
UIViewGroup *group{nullptr};
- UILabelExt *titleLabel{nullptr};
UILabelExt *TextLabel{nullptr};
+ UIImageAnimatorView *netAnimator{nullptr};
+ ImageAnimatorInfo netImageInfo[TB_NET_ANIM_FRAMES];
+ const char **netPathsArray{nullptr};
UILabelExt *RemindLabel{nullptr};
+ UIImageView *BackGround{nullptr};
UIImageView *RemindIcon{nullptr};
UIImageView *RemindIcon2{nullptr};
- UIImageView *BackGround{nullptr};
+ UIImageView *RemindIcon3{nullptr};
};
}
--- /dev/null
+#ifndef THUNDERBIRD_DIALOGUE_VIEW_H_
+#define THUNDERBIRD_DIALOGUE_VIEW_H_
+
+#include "View.h"
+#include "components/ui_view_group.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_image_animator.h"
+
+namespace OHOS
+{
+ static constexpr int16_t TB_SPEAK_ANIM_X = 141;
+ static constexpr int16_t TB_SPEAK_ANIM_Y = 114;
+ static constexpr int16_t TB_SPEAK_ANIM_W = 78;
+ static constexpr int16_t TB_SPEAK_ANIM_H = 24;
+ static constexpr int16_t TB_SPEAK_ANIM_FRAMES = 25;
+ static constexpr int16_t TB_SPEAK_ANIM_INTERVAL = 41;
+ static constexpr const char *TB_SPEAK_ANIM_PATH = "/user/res/animated_icon/speak/";
+
+ static constexpr int16_t TB_LISTEN_ANIM_X = 69;
+ static constexpr int16_t TB_LISTEN_ANIM_Y = 67;
+ static constexpr int16_t TB_LISTEN_ANIM_W = 36;
+ static constexpr int16_t TB_LISTEN_ANIM_H = 36;
+ static constexpr int16_t TB_LISTEN_ANIM_FRAMES = 61;
+ static constexpr int16_t TB_LISTEN_ANIM_INTERVAL = 41;
+ static constexpr const char *TB_LISTEN_ANIM_PATH = "/user/res/animated_icon/listen/";
+
+ class ThunderBirdDialogueView
+ {
+ public:
+ ThunderBirdDialogueView();
+ virtual ~ThunderBirdDialogueView();
+ static ThunderBirdDialogueView *GetInstance(void);
+ UIViewGroup *ThunderBirdDialogueViewInit(void);
+ bool EnsureSpeakAnimator();
+ bool EnsureListenAnimator();
+ void ClearAll(void);
+ void Show(int16_t showView);
+
+ enum : int16_t {
+ THUNDERBIRD_DIALOGUEVIEW_SPEAKING = 0, // 说话中
+ THUNDERBIRD_DIALOGUEVIEW_LISTENING, // 聆听中
+ THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW, // 状态展示
+ };
+
+ private:
+ UIViewGroup *group{nullptr};
+ UILabelExt *TextLabel{nullptr};
+ UIImageAnimatorView *speakAnimator{nullptr};
+ UIImageAnimatorView *listenAnimator{nullptr};
+ ImageAnimatorInfo speakImageInfo[TB_SPEAK_ANIM_FRAMES];
+ ImageAnimatorInfo listenImageInfo[TB_LISTEN_ANIM_FRAMES];
+ const char **speakPathsArray{nullptr};
+ const char **listenPathsArray{nullptr};
+ };
+}
+
+#endif
+
#include "components/ui_view_group.h"
#include "components/ui_label_ext.h"
#include "components/ui_image_view.h"
+#include "components/ui_label_button.h"
namespace OHOS
{
private:
UIViewGroup *group{nullptr};
- UILabelExt *titleLabel{nullptr};
UILabelExt *TextLabel{nullptr};
+ UILabelButton *RemindButton{nullptr};
UILabelExt *RemindLabel{nullptr};
UIImageView *RemindGround{nullptr};
UIImageView *RemindIcon{nullptr};
UIImageView *RemindIcon2{nullptr};
- UIImageView *BackGround{nullptr};
};
}
#include "components/ui_view_group.h"
#include "components/ui_label_ext.h"
#include "components/ui_image_view.h"
+#include "components/ui_image_animator.h"
+#include <cstdint>
namespace OHOS
{
+ static constexpr int16_t TB_LISTEN_X = 38;
+ static constexpr int16_t TB_LISTEN_Y = 151;
+ static constexpr int16_t TB_LISTEN_W = 36;
+ static constexpr int16_t TB_LISTEN_H = 36;
+ static constexpr int16_t TB_LISTEN_FRAMES = 95;
+ static constexpr int16_t TB_LISTEN_INTERVAL = 41;
+ static constexpr const char *TB_LISTEN_PATH = "/user/res/animated_icon/listen/";
+
class ThunderBirdLullabyView
{
public:
virtual ~ThunderBirdLullabyView();
static ThunderBirdLullabyView *GetInstance(void);
UIViewGroup *ThunderBirdLullabyViewInit(void);
+ bool EnsureListenAnimator();
void ClearAll(void);
void Show(int16_t showView);
+ void UpdateTimeText(uint32_t currentSeconds, uint32_t totalSeconds);
enum : int16_t {
THUNDERBIRD_LULLABYVIEW_1 = 0,
private:
UIViewGroup *group{nullptr};
- UILabelExt *titleLabel{nullptr};
UILabelExt *TextLabel{nullptr};
UILabelExt *RemindLabel{nullptr};
UIImageView *RemindIcon{nullptr};
UIImageView *RemindIcon2{nullptr};
- UIImageView *BackGround{nullptr};
+ UIImageAnimatorView *listenAnimator{nullptr};
+ ImageAnimatorInfo listenImageInfo[TB_LISTEN_FRAMES];
+ const char **listenPathsArray{nullptr};
};
}
#include "components/ui_label_ext.h"
#include "components/ui_image_view.h"
#include "video_play_wrapper.h"
-#include "main/include/dial/DialVideoView.h"
+#include "main/dial/DialVideoView.h"
#include "animator/animator_manager.h"
#include "components/ui_box_progress.h"
#include "components/ui_image_animator.h"
#include "thunderbird/include/ThunderBirdModel.h"
#include "thunderbird/include/ThunderBirdPresenter.h"
// 各子界面头文件
-#include "thunderbird/include/ThunderBirdView.h"
#include "thunderbird/include/ThunderBirdOtaView.h"
#include "thunderbird/include/ThunderBirdGuideView.h"
#include "thunderbird/include/ThunderBirdLullabyView.h"
#include "thunderbird/include/ThunderBirdDialogueView.h"
#include "thunderbird/include/ThunderBirdReminderView.h"
#include "thunderbird/include/ThunderBirdAdjustView.h"
+#include "thunderbird/include/ThunderBirdShutdownView.h"
+#include "thunderbird/include/ThunderBirdShutdownTestView.h"
namespace OHOS
{
static constexpr const char *DROPDOWN_NOSIGNAL_IMAGE = "/user/res/DROPDOWN_NOSIGNAL.bin";
THUNDERBIRD_REMINDERVIEW,
THUNDERBIRD_ADJUSTVIEW,
THUNDERBIRD_SHUTDOWNVIEW,
+ THUNDERBIRD_SHUTDOWNTESTVIEW,
MAXVIEW
} BPVIEWID;
bool ChangeThunderBirdReminderView(int16_t);
bool ChangeThunderBirdAdjustView(int16_t);
bool ChangeThunderBirdShutdownView(int16_t);
+ bool ChangeThunderBirdShutdownTestView(int16_t);
bool ClickFunc(int16_t interface);
void ChangeView(int16_t hideView, int16_t showView, int16_t subView = -1);
+ int16_t GetPrevViewId() const { return prevView_; }
+ int16_t GetPrevSubViewId() const { return prevSubView_; }
int16_t GetCurrentView() const;
int16_t GetCurrentSubView() const;
+
void UpdateBatteryProcess();
void updateSignalDisplay();
void UpdateSignalBarDisplay(int signalBars, bool state);
int CalculateSignalBars(int signalStrength);
void UpdateTimeText(const char *time);
void Initback();
- void InitBaseData();
+ UIViewGroup * InitBaseData();
void InitCommonPageComponents();
void HideCommonPageComponents();
bool SwitchVideo(const char *uri);
// 关机前关闭视频与相关资源
void CloseVideo();
+ // 打开遮罩(部分视图需要)
+ void OpenBackGround(void);
+
+ MediaVideoPlay *video_ = nullptr;
+ MediaVideoPlay *videoPlay_ = nullptr;
+ UIImageView *batteryimage{nullptr}; // 电池图片
+ UILabel *batteryLabel{nullptr}; // 电池电量
+ UIBoxProgress *progress{nullptr}; // 电池进度条
+ UIImageView *chargeBatteryicon{nullptr}; // 充电图标
+ bool isChargeBatteryIconVisible{false}; // 充电图标是否可见
+
+ int16_t Batteryvalue{0}; // 电池电量
+
+ UIImageView *iconView{nullptr};
+ UIImageView *backGroundView{nullptr};
private:
UIViewGroup *pagesGroup{nullptr};
int16_t currentView_{THUNDERBIRD_GUIDEVIEW};
int16_t currentSubView_{0};
-
+ int16_t prevView_{THUNDERBIRDMENUVIEW};
+ int16_t prevSubView_{0};
+ // 网络状态变化标志(-1 未初始化,0 无网络,1 有网络)
+ int8_t lastNetworkOnline_{-1};
UIImageView *curFace{nullptr};
DialVideoView *videoPlayer_ = nullptr;
UILiteSurfaceView *surfaceView_ = nullptr;
- MediaVideoPlay *video_ = nullptr;
- MediaVideoPlay *videoPlay_ = nullptr;
+
ColorType colorKey_;
UIViewGroup *group1{nullptr};
UILabelExt *timeLabel{nullptr};
UIImageView *showSignalStrength[4]{nullptr}; // 信号强度
UIImageView *NoSignal{nullptr}; // 无信号
- UIImageView *batteryimage{nullptr}; // 电池图片
- UILabel *batteryLabel{nullptr}; // 电池电量
- UIBoxProgress *progress{nullptr}; // 电池进度条
- UIImageView *chargeBatteryicon{nullptr}; // 充电图标
- bool isChargeBatteryIconVisible{false}; // 充电图标是否可见
+
// Ota(进度/文本)
UIBoxProgress *otaProgress{nullptr};
+ // 电量提醒与充电状态一次性提示控制
+ int16_t lastBatteryStage{-1}; // 3:>20, 2:(10,20], 1:(5,10], 0:<=5
+ bool wasCharging{false};
+ bool notifiedChargeFull{false};
+
// 各子界面对象指针
- ThunderBirdView *g_pThunderBirdView{nullptr};
ThunderBirdOtaView *g_pThunderBirdOtaView{nullptr};
ThunderBirdGuideView *g_pThunderBirdGuideView{nullptr};
ThunderBirdLullabyView *g_pThunderBirdLullabyView{nullptr};
ThunderBirdDialogueView *g_pThunderBirdDialogueView{nullptr};
ThunderBirdReminderView *g_pThunderBirdReminderView{nullptr};
ThunderBirdAdjustView *g_pThunderBirdAdjustView{nullptr};
+ ThunderBirdShutdownView *g_pThunderBirdShutdownView{nullptr};
+ ThunderBirdShutdownTestView *g_pThunderBirdShutdownTestView{nullptr};
#define SCREEN_WIDTH (Screen::GetInstance().GetWidth())
#define SCREEN_HEIGHT (Screen::GetInstance().GetHeight())
void timer_callback_proc();
void StopTimer(void);
void StartTimer(uint32_t interval = 2 * 1000);//2秒
+ void StartReminderHideTimer(uint32_t intervalMs = 1000);
+ void StartOtaCountdown(uint32_t startVal);
+ void StartCountUpTimer(uint32_t targetSeconds);
+ void StopCountUpTimer(void);
+ int GetCountUpValue() const;
private:
ThunderBirdModel();
#include "components/ui_view_group.h"
#include "components/ui_label_ext.h"
#include "components/ui_image_view.h"
+#include "components/ui_box_progress.h"
namespace OHOS
{
UIViewGroup *ThunderBirdOtaViewInit(void);
void ClearAll(void);
void Show(int16_t showView);
-
+ void UpdateCountdown(int value);
+ void SetRemindProgress(int16_t value);
enum : int16_t {
- THUNDERBIRD_OTAVIEW_READY = 0, // OTA就绪
- THUNDERBIRD_OTAVIEW_NEW_FEATURE, // 有新功能
+ THUNDERBIRD_OTAVIEW_NORMAL = 0, // OTA就绪
+ THUNDERBIRD_OTAVIEW_OBVIOUS, // 有新功能
THUNDERBIRD_OTAVIEW_UPDATE_NOW, // 需要立即更新
+ THUNDERBIRD_OTAVIEW_UPDATING, // 更新中
THUNDERBIRD_OTAVIEW_NIGHT_UPDATE, // 设置夜间更新
THUNDERBIRD_OTAVIEW_NIGHT_UPDATE_SUCCESS, // 设置夜间更新成功
THUNDERBIRD_OTAVIEW_COUNTDOWN, // 更新倒计时
UIViewGroup *group{nullptr};
UILabelExt *titleLabel{nullptr};
UILabelExt *TextLabel{nullptr};
+ UILabelExt *LittleTextLabel{nullptr};
+ UILabelExt *LittleTextLabel_2{nullptr};
UILabelExt *RemindLabel{nullptr};
UIImageView *RemindIcon{nullptr};
UIImageView *RemindIcon2{nullptr};
+ UIImageView *RemindIcon3{nullptr};
+ UIBoxProgress *VolumeProgress{nullptr};
UIImageView *BackGround{nullptr};
+ int16_t remindProgressValue_{0};
};
}
#define THUNDERBIRD_PRESENTER_H
#include "thunderbird/include/ThunderBirdMainView.h"
-#include "key/include/KeyInputListener.h"
+#include "key/KeyInputListener.h"
#include "Presenter.h"
#include "View.h"
virtual ~ThunderBirdPresenter();
void OnStart() override;
+ void OnResume() override;
static ThunderBirdPresenter *GetInstance();
#include "components/ui_view_group.h"
#include "components/ui_label_ext.h"
#include "components/ui_image_view.h"
+#include "components/ui_box_progress.h"
+#include "components/ui_label_button.h"
namespace OHOS
{
UIViewGroup *ThunderBirdReminderViewInit(void);
void ClearAll(void);
void Show(int16_t showView);
+ void HideAll();
+ // 音量/进度调节接口(用于 THUNDERBIRD_REMINDERVIEW_VOLUME)
+ void AdjustRemindProgress(int16_t delta); // 正数增加,负数减少
+ void SetRemindProgress(int16_t value);
enum : int16_t {
THUNDERBIRD_REMINDERVIEW_VOLUME = 0, // 音量调节
THUNDERBIRD_REMINDERVIEW_LOW_BATTERY, // 电量不足
THUNDERBIRD_REMINDERVIEW_CHARGING, // 充电中
THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE, // 充电完成
+ THUNDERBIRD_REMINDERVIEW_DIALOGUE_NOT_ENOUGH,//对话不足
+ THUNDERBIRD_REMINDERVIEW_DIALOGUE_USE_UP, //对话用尽
+ THUNDERBIRD_REMINDERVIEW_FLOW_NOT_ENOUGH, //流量不足
+ THUNDERBIRD_REMINDERVIEW_FLOW_USE_UP, //流量用尽
};
private:
UIViewGroup *group{nullptr};
- UILabelExt *titleLabel{nullptr};
UILabelExt *TextLabel{nullptr};
UILabelExt *RemindLabel{nullptr};
+ UILabelButton *RemindButton{nullptr};
UIImageView *RemindIcon{nullptr};
UIImageView *RemindIcon2{nullptr};
- UIImageView *BackGround{nullptr};
+
+ UIBoxProgress *VolumeProgress{nullptr};
+
+ // 进度当前值(用于音量界面),0~100
+ int16_t remindProgressValue_{50};
};
}
--- /dev/null
+#ifndef THUNDERBIRD_SHUTDOWN_TEST_VIEW_H
+#define THUNDERBIRD_SHUTDOWN_TEST_VIEW_H
+
+#include "components/ui_view_group.h"
+#include "components/ui_image_animator.h"
+
+namespace OHOS
+{
+ static constexpr int16_t TB_SHUTDOWN_ANIM_X_TEST = 0;
+ static constexpr int16_t TB_SHUTDOWN_ANIM_Y_TEST = 0;
+ static constexpr int16_t TB_SHUTDOWN_ANIM_W_TEST = 466;
+ static constexpr int16_t TB_SHUTDOWN_ANIM_H_TEST = 466;
+ static constexpr int16_t TB_SHUTDOWN_ANIM_FRAMES_TEST = 86;
+ static constexpr int16_t TB_SHUTDOWN_ANIM_INTERVAL_TEST = 41;
+ static constexpr const char *TB_SHUTDOWN_ANIM_PATH_TEST = "/user/res/emoticon/naughty";
+ class ThunderBirdShutdownTestView : public UIImageAnimatorView::AnimatorStopListener
+ {
+ public:
+ ThunderBirdShutdownTestView();
+ virtual ~ThunderBirdShutdownTestView();
+
+ static ThunderBirdShutdownTestView *GetInstance();
+
+ UIViewGroup *Init();
+ UIImageAnimatorView *GetAnimator();
+
+ void StartAnimation();
+
+ private:
+ void OnAnimatorStop(UIView &view) override;
+ void ClearAll();
+ bool EnsureAnimator();
+
+ private:
+ UIViewGroup *group{nullptr};
+ UIImageAnimatorView *animator{nullptr};
+ ImageAnimatorInfo imageInfos[TB_SHUTDOWN_ANIM_FRAMES_TEST];
+ UIImageView *iconView{nullptr};
+ const char **pathsArray{nullptr};
+ };
+}
+
+#endif
+
+
static constexpr int16_t TB_SHUTDOWN_ANIM_W = 466;
static constexpr int16_t TB_SHUTDOWN_ANIM_H = 466;
static constexpr int16_t TB_SHUTDOWN_ANIM_FRAMES = 95;
- static constexpr int16_t TB_SHUTDOWN_ANIM_INTERVAL = 150;
+ static constexpr int16_t TB_SHUTDOWN_ANIM_INTERVAL = 41;
static constexpr const char *TB_SHUTDOWN_ANIM_PATH = "/user/res/RebootAndShutDown/ShutDown/";
class ThunderBirdShutdownView : public UIImageAnimatorView::AnimatorStopListener
--- /dev/null
+#include "thunderbird/include/ThunderBirdAdjustView.h"
+#include "wearable_log.h"
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+
+namespace OHOS
+{
+ const char *searchImagePath[TB_NET_ANIM_FRAMES] = {
+ PNG_A019_080_IMAGE_PATH,
+ PNG_A019_081_IMAGE_PATH,
+ PNG_A019_082_IMAGE_PATH,
+ PNG_A019_083_IMAGE_PATH,
+ PNG_A019_084_IMAGE_PATH,
+ PNG_A019_085_IMAGE_PATH,
+ PNG_A019_086_IMAGE_PATH,
+ PNG_A019_087_IMAGE_PATH,
+ };
+ static ThunderBirdAdjustView *g_pThunderBirdAdjustView{nullptr};
+
+ ThunderBirdAdjustView::ThunderBirdAdjustView()
+ {
+ g_pThunderBirdAdjustView = this;
+ }
+
+ ThunderBirdAdjustView::~ThunderBirdAdjustView()
+ {
+ g_pThunderBirdAdjustView = nullptr;
+ ClearAll();
+ }
+
+ ThunderBirdAdjustView *ThunderBirdAdjustView::GetInstance(void)
+ {
+ return g_pThunderBirdAdjustView;
+ }
+
+ void ThunderBirdAdjustView::ClearAll(void)
+ {
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+ if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+ if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+ if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+ if (RemindIcon3 != nullptr) { delete RemindIcon3; RemindIcon3 = nullptr; }
+ if (netAnimator != nullptr) { delete netAnimator; netAnimator = nullptr; }
+ if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
+ }
+
+ bool ThunderBirdAdjustView::EnsureNetAnimator()
+ {
+ if (netAnimator == nullptr)
+ {
+ netPathsArray = searchImagePath;
+ netAnimator = new UIImageAnimatorView();
+ if (netAnimator == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdDialogueView new UIImageAnimatorView fail");
+ return false;
+ }
+ netAnimator->SetAutoEnable(false);
+ for (uint8_t i = 0; i < TB_NET_ANIM_FRAMES; i++)
+ {
+ netImageInfo[i].imagePath = (netPathsArray[i]);
+ netImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ netImageInfo[i].pos.x = TB_NET_ANIM_X;
+ netImageInfo[i].pos.y = TB_NET_ANIM_Y;
+ netImageInfo[i].width = TB_NET_ANIM_W;
+ netImageInfo[i].height = TB_NET_ANIM_H;
+ }
+ netAnimator->SetPosition(TB_NET_ANIM_X, TB_NET_ANIM_Y, TB_NET_ANIM_W, TB_NET_ANIM_H);
+ netAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ netAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ netAnimator->SetImageAnimatorSrc(netImageInfo, TB_NET_ANIM_FRAMES, TB_NET_ANIM_INTERVAL);
+ netAnimator->SetRepeat(true);
+ netAnimator->SetResizeMode(UIImageView::COVER);
+ //netAnimator->SetAnimatorStopListener(this);
+ }
+ return true;
+ }
+
+ UIViewGroup *ThunderBirdAdjustView::ThunderBirdAdjustViewInit(void)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdAdjustView::group null!");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+
+ // 公共控件
+ BackGround = new UIImageView();
+ if (BackGround)
+ {
+ BackGround->SetAutoEnable(false);
+ BackGround->SetPosition(0, 0, 360, 360);
+ BackGround->SetSrc("/user/res/RebootAndShutDown/ReBoot/4.bin");
+ BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ BackGround->SetResizeMode(UIImageView::CONTAIN);
+ BackGround->SetVisible(true);
+ group->Add(BackGround);
+ }
+ if(!EnsureNetAnimator())
+ {
+ return nullptr;
+ }
+ group->Add(netAnimator);
+ TextLabel = new UILabelExt();
+ if (TextLabel)
+ {
+ TextLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT);
+ TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TextLabel->SetVisible(false);
+ group->Add(TextLabel);
+ }
+ RemindIcon = new UIImageView();
+ if (RemindIcon)
+ {
+ RemindIcon->SetAutoEnable(false);
+ RemindIcon->SetVisible(false);
+ group->Add(RemindIcon);
+ }
+ RemindIcon2 = new UIImageView();
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetAutoEnable(false);
+ RemindIcon2->SetVisible(false);
+ group->Add(RemindIcon2);
+ }
+ RemindIcon3 = new UIImageView();
+ if (RemindIcon3)
+ {
+ RemindIcon3->SetAutoEnable(false);
+ RemindIcon3->SetVisible(false);
+ group->Add(RemindIcon3);
+ }
+ RemindLabel = new UILabelExt();
+ if (RemindLabel)
+ {
+ RemindLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT);
+ RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ RemindLabel->SetVisible(false);
+ group->Add(RemindLabel);
+ }
+ return group;
+ }
+
+ void ThunderBirdAdjustView::Show(int16_t showView)
+ {
+ if (group == nullptr) { return; }
+ if (TextLabel) { TextLabel->SetVisible(false);}
+ if (RemindLabel) { RemindLabel->SetVisible(false);}
+ if (RemindIcon) { RemindIcon->SetVisible(false); }
+ if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+ if (RemindIcon3) { RemindIcon3->SetVisible(false); }
+ if (netAnimator) { netAnimator->SetVisible(false); netAnimator->Stop(); }
+ switch (showView)
+ {
+ case THUNDERBIRD_ADJUSTVIEW_BIND_SUCCESS:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(142, 148, 120, 42);
+ TextLabel->SetText("绑定成功");
+ TextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(132, 284, 96, 28);
+ RemindLabel->SetText("按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(98, 151, 36, 36);
+ RemindIcon->SetSrc("/user/res/completed.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(158, 286, 24, 24);
+ RemindIcon2->SetSrc("/user/res/completed.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_ADJUSTVIEW_WARNING:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(112, 148, 180, 42);
+ TextLabel->SetText("网络连接失败");
+ TextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 重试");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(68, 151, 36, 36);
+ RemindIcon->SetSrc("/user/res/warning.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(104, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_down.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ if (RemindIcon3)
+ {
+ RemindIcon3->SetPosition(216, 277, 22, 22);
+ RemindIcon3->SetSrc("/user/res/volume_up.bin");
+ RemindIcon3->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_ADJUSTVIEW_NETWORK_CONNECTING:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(82, 148, 240, 42);
+ TextLabel->SetText("正在重新连接网络");
+ TextLabel->SetVisible(true);
+ }
+ if (netAnimator) { netAnimator->SetVisible(true); netAnimator->Start(); }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
+
--- /dev/null
+#include "thunderbird/include/ThunderBirdDialogueView.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+
+namespace OHOS
+{
+ static ThunderBirdDialogueView *g_pThunderBirdDialogueView{nullptr};
+ static const char *TB_SPEAK_PATHS[TB_SPEAK_ANIM_FRAMES] = {
+ TB_SPEAK_IMAGE_1,
+ TB_SPEAK_IMAGE_2,
+ TB_SPEAK_IMAGE_3,
+ TB_SPEAK_IMAGE_4,
+ TB_SPEAK_IMAGE_5,
+ TB_SPEAK_IMAGE_6,
+ TB_SPEAK_IMAGE_7,
+ TB_SPEAK_IMAGE_8,
+ TB_SPEAK_IMAGE_9,
+ TB_SPEAK_IMAGE_10,
+ TB_SPEAK_IMAGE_11,
+ TB_SPEAK_IMAGE_12,
+ TB_SPEAK_IMAGE_13,
+ TB_SPEAK_IMAGE_14,
+ TB_SPEAK_IMAGE_15,
+ TB_SPEAK_IMAGE_16,
+ TB_SPEAK_IMAGE_17,
+ TB_SPEAK_IMAGE_18,
+ TB_SPEAK_IMAGE_19,
+ TB_SPEAK_IMAGE_20,
+ TB_SPEAK_IMAGE_21,
+ TB_SPEAK_IMAGE_22,
+ TB_SPEAK_IMAGE_23,
+ TB_SPEAK_IMAGE_24,
+ TB_SPEAK_IMAGE_25,
+ };
+ static const char *TB_LISTEN_PATHS[TB_LISTEN_ANIM_FRAMES] = {
+ TB_LISTEN_IMAGE_1,
+ TB_LISTEN_IMAGE_2,
+ TB_LISTEN_IMAGE_3,
+ TB_LISTEN_IMAGE_4,
+ TB_LISTEN_IMAGE_5,
+ TB_LISTEN_IMAGE_6,
+ TB_LISTEN_IMAGE_7,
+ TB_LISTEN_IMAGE_8,
+ TB_LISTEN_IMAGE_9,
+ TB_LISTEN_IMAGE_10,
+ TB_LISTEN_IMAGE_11,
+ TB_LISTEN_IMAGE_12,
+ TB_LISTEN_IMAGE_13,
+ TB_LISTEN_IMAGE_14,
+ TB_LISTEN_IMAGE_15,
+ TB_LISTEN_IMAGE_16,
+ TB_LISTEN_IMAGE_17,
+ TB_LISTEN_IMAGE_18,
+ TB_LISTEN_IMAGE_19,
+ TB_LISTEN_IMAGE_20,
+ TB_LISTEN_IMAGE_21,
+ TB_LISTEN_IMAGE_22,
+ TB_LISTEN_IMAGE_23,
+ TB_LISTEN_IMAGE_24,
+ TB_LISTEN_IMAGE_25,
+ TB_LISTEN_IMAGE_26,
+ TB_LISTEN_IMAGE_27,
+ TB_LISTEN_IMAGE_28,
+ TB_LISTEN_IMAGE_29,
+ TB_LISTEN_IMAGE_30,
+ TB_LISTEN_IMAGE_31,
+ TB_LISTEN_IMAGE_32,
+ TB_LISTEN_IMAGE_33,
+ TB_LISTEN_IMAGE_34,
+ TB_LISTEN_IMAGE_35,
+ TB_LISTEN_IMAGE_36,
+ TB_LISTEN_IMAGE_37,
+ TB_LISTEN_IMAGE_38,
+ TB_LISTEN_IMAGE_39,
+ TB_LISTEN_IMAGE_40,
+ TB_LISTEN_IMAGE_41,
+ TB_LISTEN_IMAGE_42,
+ TB_LISTEN_IMAGE_43,
+ TB_LISTEN_IMAGE_44,
+ TB_LISTEN_IMAGE_45,
+ TB_LISTEN_IMAGE_46,
+ TB_LISTEN_IMAGE_47,
+ TB_LISTEN_IMAGE_48,
+ TB_LISTEN_IMAGE_49,
+ TB_LISTEN_IMAGE_50,
+ TB_LISTEN_IMAGE_51,
+ TB_LISTEN_IMAGE_52,
+ TB_LISTEN_IMAGE_53,
+ TB_LISTEN_IMAGE_54,
+ TB_LISTEN_IMAGE_55,
+ TB_LISTEN_IMAGE_56,
+ TB_LISTEN_IMAGE_57,
+ TB_LISTEN_IMAGE_58,
+ TB_LISTEN_IMAGE_59,
+ TB_LISTEN_IMAGE_60,
+ TB_LISTEN_IMAGE_61,
+ };
+
+ ThunderBirdDialogueView::ThunderBirdDialogueView()
+ {
+ g_pThunderBirdDialogueView = this;
+ }
+
+ ThunderBirdDialogueView::~ThunderBirdDialogueView()
+ {
+ g_pThunderBirdDialogueView = nullptr;
+ ClearAll();
+ }
+
+ ThunderBirdDialogueView *ThunderBirdDialogueView::GetInstance(void)
+ {
+ return g_pThunderBirdDialogueView;
+ }
+
+ void ThunderBirdDialogueView::ClearAll(void)
+ {
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+ if (speakAnimator != nullptr) { delete speakAnimator; speakAnimator = nullptr; }
+ if (listenAnimator != nullptr) { delete listenAnimator; listenAnimator = nullptr; }
+ }
+ bool ThunderBirdDialogueView::EnsureSpeakAnimator()
+ {
+ if (speakAnimator == nullptr)
+ {
+ speakPathsArray = TB_SPEAK_PATHS;
+ speakAnimator = new UIImageAnimatorView();
+ if (speakAnimator == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdDialogueView new UIImageAnimatorView fail");
+ return false;
+ }
+ speakAnimator->SetAutoEnable(false);
+ for (uint8_t i = 0; i < TB_SPEAK_ANIM_FRAMES; i++)
+ {
+ speakImageInfo[i].imagePath = (speakPathsArray[i]);
+ speakImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ speakImageInfo[i].pos.x = TB_SPEAK_ANIM_X;
+ speakImageInfo[i].pos.y = TB_SPEAK_ANIM_Y;
+ speakImageInfo[i].width = TB_SPEAK_ANIM_W;
+ speakImageInfo[i].height = TB_SPEAK_ANIM_H;
+ }
+ speakAnimator->SetPosition(TB_SPEAK_ANIM_X, TB_SPEAK_ANIM_Y, TB_SPEAK_ANIM_W, TB_SPEAK_ANIM_H);
+ speakAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ speakAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ speakAnimator->SetImageAnimatorSrc(speakImageInfo, TB_SPEAK_ANIM_FRAMES, TB_SPEAK_ANIM_INTERVAL);
+ speakAnimator->SetRepeat(true);
+ speakAnimator->SetResizeMode(UIImageView::COVER);
+ //speakAnimator->SetAnimatorStopListener(this);
+ }
+ return true;
+ }
+ bool ThunderBirdDialogueView::EnsureListenAnimator()
+ {
+ if (listenAnimator == nullptr)
+ {
+ listenPathsArray = TB_LISTEN_PATHS;
+ listenAnimator = new UIImageAnimatorView();
+ if (listenAnimator == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdDialogueView new UIImageAnimatorView fail");
+ return false;
+ }
+ listenAnimator->SetAutoEnable(false);
+ for (uint8_t i = 0; i < TB_LISTEN_ANIM_FRAMES; i++)
+ {
+ listenImageInfo[i].imagePath = (listenPathsArray[i]);
+ listenImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ listenImageInfo[i].pos.x = TB_LISTEN_ANIM_X;
+ listenImageInfo[i].pos.y = TB_LISTEN_ANIM_Y;
+ listenImageInfo[i].width = TB_LISTEN_ANIM_W;
+ listenImageInfo[i].height = TB_LISTEN_ANIM_H;
+ }
+ listenAnimator->SetPosition(TB_LISTEN_ANIM_X, TB_LISTEN_ANIM_Y, TB_LISTEN_ANIM_W, TB_LISTEN_ANIM_H);
+ listenAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ listenAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ listenAnimator->SetImageAnimatorSrc(listenImageInfo, TB_LISTEN_ANIM_FRAMES, TB_LISTEN_ANIM_INTERVAL);
+ listenAnimator->SetRepeat(true);
+ listenAnimator->SetResizeMode(UIImageView::COVER);
+ //listenAnimator->SetAnimatorStopListener(this);
+ }
+ return true;
+ }
+
+ UIViewGroup *ThunderBirdDialogueView::ThunderBirdDialogueViewInit(void)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdDialogueView::group null!");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+
+ // 公共控件
+ TextLabel = new UILabelExt();
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(0, 64, 360, 42);
+ TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ TextLabel->SetRollSpeed(35);
+ TextLabel->SetVisible(false);
+ group->Add(TextLabel);
+ }
+ if(!EnsureSpeakAnimator())
+ {
+ return nullptr;
+ }
+ if(!EnsureListenAnimator())
+ {
+ return nullptr;
+ }
+ group->Add(speakAnimator);
+ group->Add(listenAnimator);
+
+ return group;
+ }
+
+ void ThunderBirdDialogueView::Show(int16_t showView)
+ {
+ if (group == nullptr) { return; }
+ if (TextLabel) { TextLabel->SetVisible(false);}
+ if (speakAnimator) { speakAnimator->SetVisible(false); speakAnimator->Stop(); }
+ if (listenAnimator) { listenAnimator->SetVisible(false); listenAnimator->Stop(); }
+
+ switch (showView)
+ {
+ case THUNDERBIRD_DIALOGUEVIEW_SPEAKING:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetText("保镖小姐 , 你来啦");
+ TextLabel->SetVisible(true);
+ }
+ //动效图标
+ if (speakAnimator) { speakAnimator->SetVisible(true); speakAnimator->Start(); }
+ break;
+ }
+ case THUNDERBIRD_DIALOGUEVIEW_LISTENING:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(111, 64, 180, 42);
+ TextLabel->SetText("超认真聆听中");
+ TextLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT);
+ TextLabel->SetVisible(true);
+ }
+ //动效图标
+ if (listenAnimator) { listenAnimator->SetVisible(true); listenAnimator->Start(); }
+ break;
+ }
+ case THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetText("发呆中...");
+ TextLabel->SetVisible(true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
+
#include "thunderbird/include/ThunderBirdGuideView.h"
+#include "thunderbird/include/ThunderBirdMainView.h"
#include "wearable_log.h"
namespace OHOS
delete group;
group = nullptr;
}
- if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
+ if (RemindButton != nullptr) { delete RemindButton; RemindButton = nullptr; }
if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
- if (RemindGround != nullptr) { delete RemindGround; RemindGround = nullptr; }
if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
}
TextLabel->SetVisible(false);
group->Add(TextLabel);
}
+ RemindButton = new UILabelButton();
+ if (RemindButton)
+ {
+ RemindButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff635d58, UIButton::RELEASED);
+ RemindButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff7c7773, UIButton::RELEASED);
+ RemindButton->SetStyleForState(STYLE_BORDER_WIDTH, 2, UIButton::RELEASED);
+ RemindButton->SetVisible(false);
+ group->Add(RemindButton);
+ }
RemindGround = new UIImageView();
if (RemindGround)
{
- RemindGround->SetPosition(140, 175, 180, 48);
- RemindGround->SetStyle(STYLE_BACKGROUND_COLOR, 0xff95847b);
+ RemindGround->SetAutoEnable(false);
+ RemindGround->SetPosition(128, 164, 94, 94);
RemindGround->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- RemindGround->SetStyle(STYLE_BORDER_RADIUS, 80);
+ RemindGround->SetResizeMode(UIImageView::CONTAIN);
RemindGround->SetVisible(false);
group->Add(RemindGround);
}
void ThunderBirdGuideView::Show(int16_t showView)
{
if (group == nullptr) { return; }
- if (TextLabel) { TextLabel->SetVisible(false); }
- if (RemindGround) { RemindGround->SetVisible(false); }
+ if (TextLabel) { TextLabel->SetVisible(false);TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);}
+ if (RemindButton) { RemindButton->SetVisible(false); }
if (RemindLabel) { RemindLabel->SetVisible(false); }
if (RemindIcon) { RemindIcon->SetVisible(false); }
{
if (TextLabel)
{
- TextLabel->SetPosition(0, 104, 466, 48);
- TextLabel->SetText("Hey, 我是毛毛~");
+ TextLabel->SetPosition(0, 64, 360, 42);
+ TextLabel->SetText("Hey, 我是Amby~");
TextLabel->SetVisible(true);
}
- if(RemindGround)
- {
- RemindGround->SetVisible(true);
- }
- if (RemindLabel)
+ if (RemindButton)
{
- RemindLabel->SetText("按 下一页");
- RemindLabel->SetVisible(true);
+ RemindButton->SetPosition(106, 114, 148, 40);
+ RemindButton->SetText("按 下一页");
+ RemindButton->SetLabelPosition(16, 6);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
}
if(RemindIcon)
{
- RemindIcon->SetPosition(180, 175, 30, 30);
- RemindIcon->SetSrc("/user/res/volumeup.bin");
+ RemindIcon->SetPosition(148, 122, 24, 24);
+ RemindIcon->SetSrc("/user/res/volume_up.bin");
RemindIcon->SetVisible(true);
}
{
if (TextLabel)
{
- TextLabel->SetPosition(0, 104, 466, 48);
+ TextLabel->SetPosition(0, 64, 466, 42);
TextLabel->SetText("我可以和你聊天,哄你睡觉");
+ TextLabel->SetRollSpeed(35);
TextLabel->SetVisible(true);
}
- if(RemindGround)
+ if (RemindButton)
{
- RemindGround->SetVisible(true);
- }
- if (RemindLabel)
- {
- RemindLabel->SetText("按 下一页");
- RemindLabel->SetVisible(true);
+ RemindButton->SetPosition(106, 114, 148, 40);
+ RemindButton->SetText("按 下一页");
+ RemindButton->SetLabelPosition(16, 6);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
}
if(RemindIcon)
{
- RemindIcon->SetPosition(180, 175, 30, 30);
- RemindIcon->SetSrc("/user/res/volumeup.bin");
+ RemindIcon->SetPosition(148, 122, 24, 24);
+ RemindIcon->SetSrc("/user/res/volume_up.bin");
RemindIcon->SetVisible(true);
}
break;
}
case THUNDERBIRD_GUIDEVIEW_3:
{
+ ThunderBirdMainView::GetInstance()->OpenBackGround();
if (TextLabel)
{
- TextLabel->SetPosition(0, 104, 466, 48);
+ TextLabel->SetPosition(60, 64, 240, 84);
TextLabel->SetText("换角色、挑声音、哄睡...扫码尽享受");
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);//自动换行
TextLabel->SetVisible(true);
}
- if(RemindGround)
- {
- RemindGround->SetVisible(true);
- }
+
if (RemindLabel)
{
- RemindLabel->SetText("按 跳过");
+ RemindLabel->SetText("按 跳过");
RemindLabel->SetVisible(true);
}
if(RemindIcon)
{
- RemindIcon->SetPosition(180, 175, 30, 30);
+ RemindIcon->SetPosition(192, 185, 30, 30);
RemindIcon->SetSrc("/user/res/volumeup.bin");
RemindIcon->SetVisible(true);
}
--- /dev/null
+#include "thunderbird/include/ThunderBirdLullabyView.h"
+#include "thunderbird/include/ThunderBirdMainView.h"
+#include "wearable_log.h"
+#include <cstdio>
+#include <string>
+#include "UiConfig.h"
+
+namespace OHOS
+{
+ static ThunderBirdLullabyView *g_pThunderBirdLullabyView{nullptr};
+ static const char *TB_LULLABY_LISTEN_PATHS[TB_LISTEN_FRAMES] = {
+ TB_LISTEN_IMAGE_1,
+ TB_LISTEN_IMAGE_2,
+ TB_LISTEN_IMAGE_3,
+ TB_LISTEN_IMAGE_4,
+ TB_LISTEN_IMAGE_5,
+ TB_LISTEN_IMAGE_6,
+ TB_LISTEN_IMAGE_7,
+ TB_LISTEN_IMAGE_8,
+ TB_LISTEN_IMAGE_9,
+ TB_LISTEN_IMAGE_10,
+ TB_LISTEN_IMAGE_11,
+ TB_LISTEN_IMAGE_12,
+ TB_LISTEN_IMAGE_13,
+ TB_LISTEN_IMAGE_14,
+ TB_LISTEN_IMAGE_15,
+ TB_LISTEN_IMAGE_16,
+ TB_LISTEN_IMAGE_17,
+ TB_LISTEN_IMAGE_18,
+ TB_LISTEN_IMAGE_19,
+ TB_LISTEN_IMAGE_20,
+ TB_LISTEN_IMAGE_21,
+ TB_LISTEN_IMAGE_22,
+ TB_LISTEN_IMAGE_23,
+ TB_LISTEN_IMAGE_24,
+ TB_LISTEN_IMAGE_25,
+ TB_LISTEN_IMAGE_26,
+ TB_LISTEN_IMAGE_27,
+ TB_LISTEN_IMAGE_28,
+ TB_LISTEN_IMAGE_29,
+ TB_LISTEN_IMAGE_30,
+ TB_LISTEN_IMAGE_31,
+ TB_LISTEN_IMAGE_32,
+ TB_LISTEN_IMAGE_33,
+ TB_LISTEN_IMAGE_34,
+ TB_LISTEN_IMAGE_35,
+ TB_LISTEN_IMAGE_36,
+ TB_LISTEN_IMAGE_37,
+ TB_LISTEN_IMAGE_38,
+ TB_LISTEN_IMAGE_39,
+ TB_LISTEN_IMAGE_40,
+ TB_LISTEN_IMAGE_41,
+ TB_LISTEN_IMAGE_42,
+ TB_LISTEN_IMAGE_43,
+ TB_LISTEN_IMAGE_44,
+ TB_LISTEN_IMAGE_45,
+ TB_LISTEN_IMAGE_46,
+ TB_LISTEN_IMAGE_47,
+ TB_LISTEN_IMAGE_48,
+ TB_LISTEN_IMAGE_49,
+ TB_LISTEN_IMAGE_50,
+ TB_LISTEN_IMAGE_51,
+ TB_LISTEN_IMAGE_52,
+ TB_LISTEN_IMAGE_53,
+ TB_LISTEN_IMAGE_54,
+ TB_LISTEN_IMAGE_55,
+ TB_LISTEN_IMAGE_56,
+ TB_LISTEN_IMAGE_57,
+ TB_LISTEN_IMAGE_58,
+ TB_LISTEN_IMAGE_59,
+ TB_LISTEN_IMAGE_60,
+ TB_LISTEN_IMAGE_61,
+ TB_LISTEN_IMAGE_62,
+ TB_LISTEN_IMAGE_63,
+ TB_LISTEN_IMAGE_64,
+ TB_LISTEN_IMAGE_65,
+ TB_LISTEN_IMAGE_66,
+ TB_LISTEN_IMAGE_67,
+ TB_LISTEN_IMAGE_68,
+ TB_LISTEN_IMAGE_69,
+ TB_LISTEN_IMAGE_70,
+ TB_LISTEN_IMAGE_71,
+ TB_LISTEN_IMAGE_72,
+ TB_LISTEN_IMAGE_73,
+ TB_LISTEN_IMAGE_74,
+ TB_LISTEN_IMAGE_75,
+ TB_LISTEN_IMAGE_76,
+ TB_LISTEN_IMAGE_77,
+ TB_LISTEN_IMAGE_78,
+ TB_LISTEN_IMAGE_79,
+ TB_LISTEN_IMAGE_80,
+ TB_LISTEN_IMAGE_81,
+ TB_LISTEN_IMAGE_82,
+ TB_LISTEN_IMAGE_83,
+ TB_LISTEN_IMAGE_84,
+ TB_LISTEN_IMAGE_85,
+ TB_LISTEN_IMAGE_86,
+ TB_LISTEN_IMAGE_87,
+ TB_LISTEN_IMAGE_88,
+ TB_LISTEN_IMAGE_89,
+ TB_LISTEN_IMAGE_90,
+ TB_LISTEN_IMAGE_91,
+ TB_LISTEN_IMAGE_92,
+ TB_LISTEN_IMAGE_93,
+ TB_LISTEN_IMAGE_94,
+ TB_LISTEN_IMAGE_95,
+ };
+
+ ThunderBirdLullabyView::ThunderBirdLullabyView()
+ {
+ g_pThunderBirdLullabyView = this;
+ }
+
+ ThunderBirdLullabyView::~ThunderBirdLullabyView()
+ {
+ g_pThunderBirdLullabyView = nullptr;
+ ClearAll();
+ }
+
+ ThunderBirdLullabyView *ThunderBirdLullabyView::GetInstance(void)
+ {
+ return g_pThunderBirdLullabyView;
+ }
+
+ void ThunderBirdLullabyView::ClearAll(void)
+ {
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+ if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+ if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+ if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+ if (listenAnimator != nullptr) { delete listenAnimator; listenAnimator = nullptr; }
+ }
+ bool ThunderBirdLullabyView::EnsureListenAnimator()
+ {
+ if (listenAnimator == nullptr)
+ {
+ listenPathsArray = TB_LULLABY_LISTEN_PATHS;
+ listenAnimator = new UIImageAnimatorView();
+ if (listenAnimator == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdLullabyView new UIImageAnimatorView fail");
+ return false;
+ }
+ listenAnimator->SetAutoEnable(false);
+ for (uint8_t i = 0; i < TB_LISTEN_FRAMES; i++)
+ {
+ listenImageInfo[i].imagePath = (listenPathsArray[i]);
+ listenImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+ listenImageInfo[i].pos.x = TB_LISTEN_X;
+ listenImageInfo[i].pos.y = TB_LISTEN_Y;
+ listenImageInfo[i].width = TB_LISTEN_W;
+ listenImageInfo[i].height = TB_LISTEN_H;
+ }
+ listenAnimator->SetPosition(TB_LISTEN_X, TB_LISTEN_Y, TB_LISTEN_W, TB_LISTEN_H);
+ listenAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ listenAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ listenAnimator->SetImageAnimatorSrc(listenImageInfo, TB_LISTEN_FRAMES, TB_LISTEN_INTERVAL);
+ listenAnimator->SetRepeat(false);
+ listenAnimator->SetRepeatTimes(1);
+ listenAnimator->SetResizeMode(UIImageView::COVER);
+ //listenAnimator->SetAnimatorStopListener(this);
+ }
+ return true;
+ }
+
+ UIViewGroup *ThunderBirdLullabyView::ThunderBirdLullabyViewInit(void)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdLullabyView::group null!");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+
+ // 公共控件
+ TextLabel = new UILabelExt();
+ if (TextLabel)
+ {
+ TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TextLabel->SetVisible(false);
+ group->Add(TextLabel);
+ }
+ RemindLabel = new UILabelExt();
+ if (RemindLabel)
+ {
+ RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindLabel->SetVisible(false);
+ group->Add(RemindLabel);
+ }
+ RemindIcon = new UIImageView();
+ if (RemindIcon)
+ {
+ RemindIcon->SetAutoEnable(false);
+ RemindIcon->SetVisible(false);
+ group->Add(RemindIcon);
+ }
+ RemindIcon2 = new UIImageView();
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetAutoEnable(false);
+ RemindIcon2->SetVisible(false);
+ group->Add(RemindIcon2);
+ }
+ if(!EnsureListenAnimator())
+ {
+ return nullptr;
+ }
+ group->Add(listenAnimator);
+
+ return group;
+ }
+
+ void ThunderBirdLullabyView::Show(int16_t showView)
+ {
+ if (group == nullptr) { return; }
+ if (TextLabel) { TextLabel->SetVisible(false);
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ TextLabel->SetRollSpeed(35); }
+ if (RemindLabel) { RemindLabel->SetVisible(false);}
+ if (RemindIcon) { RemindIcon->SetVisible(false); }
+ if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+ if (listenAnimator) { listenAnimator->SetVisible(false); listenAnimator->Stop(); }
+
+ switch (showView)
+ {
+ case THUNDERBIRD_LULLABYVIEW_1:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(43, 64, 268, 42);
+ TextLabel->SetText("按 说「哄我睡觉」");
+ TextLabel->SetVisible(true);
+ }
+ if(RemindIcon)
+ {
+ RemindIcon->SetPosition(79, 69, 36, 36);
+ RemindIcon->SetSrc("/user/res/voice.bin");
+ RemindIcon->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_LULLABYVIEW_2:
+ {
+ ThunderBirdMainView::GetInstance()->OpenBackGround();
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(60, 140, 240, 42);
+ TextLabel->SetText("是否开启哄睡模式");
+ TextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_LULLABYVIEW_3:
+ {
+ ThunderBirdMainView::GetInstance()->OpenBackGround();
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(82, 148, 240, 42);
+ TextLabel->SetText("告诉我想听的故事");
+ TextLabel->SetVisible(true);
+ }
+ if (listenAnimator) { listenAnimator->SetVisible(true); listenAnimator->Start(); }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 随机");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_LULLABYVIEW_4:
+ {
+ ThunderBirdModel::GetInstance()->StartCountUpTimer(15 * 60);
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(0, 64, 360, 42);
+ TextLabel->SetText("从前有座山,山里有座庙,庙里有个老和尚,老和尚给小和尚讲故事,讲什么呢?从前有座山,山里有座庙,庙里有个老和尚,老和尚给小和尚讲故事,讲什么呢?从前有座山,山里有座庙,庙里有个老和尚,老和尚给小和尚讲故事,讲什么呢?从前有座山,山里有座庙,庙里有个老和尚,老和尚给小和尚讲故事,讲什么呢?");
+ TextLabel->SetVisible(true);
+ }
+ if(RemindLabel)
+ {
+
+ RemindLabel->SetPosition(155, 114, 131, 28);
+ RemindLabel->SetText("04:00/15:00");
+ RemindLabel->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_LULLABYVIEW_5:
+ {
+ ThunderBirdMainView::GetInstance()->OpenBackGround();
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(60, 148, 240, 42);
+ TextLabel->SetText("是否退出哄睡模式");
+ TextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ void ThunderBirdLullabyView::UpdateTimeText(uint32_t currentSeconds, uint32_t totalSeconds)
+ {
+ if (RemindLabel == nullptr) { return; }
+ // 保护:避免除零或异常
+ uint32_t safeTotal = (totalSeconds == 0) ? 1 : totalSeconds;
+ // 取值范围保护:当前不能超过总时长
+ if (currentSeconds > safeTotal) { currentSeconds = safeTotal; }
+
+ // 格式化为 mm:ss/mm:ss
+ auto formatToMMSS = [](uint32_t seconds) -> std::string {
+ uint32_t minutes = seconds / 60;
+ uint32_t secs = seconds % 60;
+ char buf[8]; // mm:ss + \0
+ std::snprintf(buf, sizeof(buf), "%02u:%02u", minutes, secs);
+ return std::string(buf);
+ };
+
+ std::string left = formatToMMSS(currentSeconds);
+ std::string right = formatToMMSS(safeTotal);
+ std::string merged = left + "/" + right;
+ RemindLabel->SetText(merged.c_str());
+ }
+}
+
+
#include "ui_resource_image.h"
#include <ui_scroll_view.h>
#include "components/ui_button.h"
-#include "MainViewSample.h"
+//#include "MainViewSample.h"
#include "components/ui_view_group.h"
#include "UiConfig.h"
-#include "uicomponents/UIComponents.h"
-#include "MainPresenterSample.h"
+//#include "uicomponents/UIComponents.h"
+//#include "MainPresenterSample.h"
#include "thunderbird/include/ThunderBirdMainView.h"
#include "thunderbird/include/ThunderBirdShutdownView.h"
+#include "thunderbird/include/ThunderBirdShutdownTestView.h"
#include "wearable_log.h"
-#include "screennotify/include/ui_screennotify.h"
+#include "screennotify/ui_screennotify.h"
#include "custom_utils.h"
#include <unistd.h>
#include <sys/stat.h>
#include "battery_hal.h"
#include "battery_service.h"
#include "custom_runtime.h"
+#include <service/graphic_service.h>
namespace OHOS
{
static constexpr int16_t VIDEO_WIDTH = 466;
ScrollView_ = nullptr;
}
g_pThunderBirdMainView = nullptr;
- ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 关闭屏幕常亮
+ ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 关闭屏幕常亮
ThunderBirdModel::GetInstance()->StopTimer();
}
void ThunderBirdMainView::DeInit()
{
// 释放各子界面对象
- if (g_pThunderBirdView) { delete g_pThunderBirdView; g_pThunderBirdView = nullptr; }
- if (g_pThunderBirdOtaView) { delete g_pThunderBirdOtaView; g_pThunderBirdOtaView = nullptr; }
- if (g_pThunderBirdGuideView) { delete g_pThunderBirdGuideView; g_pThunderBirdGuideView = nullptr; }
- if (g_pThunderBirdLullabyView) { delete g_pThunderBirdLullabyView; g_pThunderBirdLullabyView = nullptr; }
- if (g_pThunderBirdDialogueView) { delete g_pThunderBirdDialogueView; g_pThunderBirdDialogueView = nullptr; }
- if (g_pThunderBirdReminderView) { delete g_pThunderBirdReminderView; g_pThunderBirdReminderView = nullptr; }
- if (g_pThunderBirdAdjustView) { delete g_pThunderBirdAdjustView; g_pThunderBirdAdjustView = nullptr; }
- if (g_pThunderBirdShutdownView) { delete g_pThunderBirdShutdownView; g_pThunderBirdShutdownView = nullptr; }
+ if (g_pThunderBirdOtaView)
+ {
+ delete g_pThunderBirdOtaView;
+ g_pThunderBirdOtaView = nullptr;
+ }
+ if (g_pThunderBirdGuideView)
+ {
+ delete g_pThunderBirdGuideView;
+ g_pThunderBirdGuideView = nullptr;
+ }
+ if (g_pThunderBirdLullabyView)
+ {
+ delete g_pThunderBirdLullabyView;
+ g_pThunderBirdLullabyView = nullptr;
+ }
+ if (g_pThunderBirdDialogueView)
+ {
+ delete g_pThunderBirdDialogueView;
+ g_pThunderBirdDialogueView = nullptr;
+ }
+ if (g_pThunderBirdReminderView)
+ {
+ delete g_pThunderBirdReminderView;
+ g_pThunderBirdReminderView = nullptr;
+ }
+ if (g_pThunderBirdAdjustView)
+ {
+ delete g_pThunderBirdAdjustView;
+ g_pThunderBirdAdjustView = nullptr;
+ }
+ if (g_pThunderBirdShutdownView)
+ {
+ delete g_pThunderBirdShutdownView;
+ g_pThunderBirdShutdownView = nullptr;
+ }
+ if (g_pThunderBirdShutdownTestView)
+ {
+ delete g_pThunderBirdShutdownTestView;
+ g_pThunderBirdShutdownTestView = nullptr;
+ }
+ if (g_pThunderBirdShutdownView)
+ {
+ delete g_pThunderBirdShutdownView;
+ g_pThunderBirdShutdownView = nullptr;
+ }
// 置空所有分组索引,避免悬空指针
for (int i = 0; i < MAXVIEW; i++)
{
g_lastPlayed = false;
// 注销屏幕状态通知
- deregisterNotifyScreenStatus(ScreenStatusNotify);
+ //deregisterNotifyScreenStatus(ScreenStatusNotify);
if (curFace != nullptr)
{
ScrollView_->SetTouchable(true);
ScrollView_->SetDraggable(true);
AddViewToRootContainer(ScrollView_);
- RootView::GetInstance()->SetOnKeyActListener(presenter_);
-
- Initback();
- // 顶部状态栏
- InitBaseData();
+ Initback(); // 最底层
+
+ // ScrollView_->Add(group[THUNDERBIRD_GUIDEVIEW]);
+ // //顶部状态栏
+ // if (pagesGroup == nullptr)
+ // {
+ // pagesGroup = new UIViewGroup();
+ // if (pagesGroup == nullptr)
+ // {
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "pagesGroup new fail");
+ // return;
+ // }
+ // }
+ // g_pThunderBirdShutdownTestView = new ThunderBirdShutdownTestView();
+ // pagesGroup = g_pThunderBirdShutdownTestView->Init();
+ // ScrollView_->Add(pagesGroup);
+ // g_pThunderBirdShutdownTestView->StartAnimation();
+ iconView = new UIImageView(); //(表情图片)需要遮罩时启用,预先增加在对应图层
+ iconView->SetAutoEnable(false);
+ iconView->SetPosition(0, 0, 466, 466);
+ iconView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ iconView->SetResizeMode(UIImageView::COVER);
+ iconView->SetSrc("/user/res/emoticon/naughty/1.bin");
+ iconView->SetVisible(false);
+ ScrollView_->Add(iconView);
+
+ backGroundView = new UIImageView(); //(黑色遮罩)需要遮罩时启用,预先增加在对应图层
+ backGroundView->SetAutoEnable(false);
+ backGroundView->SetPosition(0, 0, 466, 466);
+ backGroundView->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ backGroundView->SetStyle(STYLE_BACKGROUND_OPA, 0xD0);
+ backGroundView->SetVisible(false);
+ ScrollView_->Add(backGroundView);
+
// 默认显示主界面
- ChangeView(MAXVIEW, THUNDERBIRD_GUIDEVIEW,0);
+ ChangeView(MAXVIEW, THUNDERBIRD_GUIDEVIEW, 0); // 文字显示图层
+ // iconLabel = new UILabel();
+ // iconLabel->SetPosition(0, 160, 466, 40);
+ // iconLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff);
+ // iconLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ // iconLabel->SetText("你好,我是Amby~");
+ // iconLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
+ // iconLabel->SetVisible(true);
+ // ScrollView_->Add(iconLabel);
+
+ ScrollView_->Add(InitBaseData()); // 最上面状态栏
// 增加按键监听
RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::ThunderBirdPresenter::GetInstance();
RootView::GetInstance()->SetOnKeyActListener(keyactListener);
}
}
- bool ThunderBirdMainView::SwitchVideo(const char *uri)
+ bool ThunderBirdMainView::SwitchVideo(const char *uri) // 切换表情接口
{
- if (uri == nullptr || surfaceView_ == nullptr) {
+ if (uri == nullptr || surfaceView_ == nullptr)
+ {
return false;
}
// 停止并销毁旧播放器
if (videoPlay_ != nullptr)
{
- if (videoPlay_->isPlayed_) {
+ if (videoPlay_->isPlayed_)
+ {
videoPlay_->PauseVideoPlay();
}
- if (videoPlay_->isEntered_) {
+ if (videoPlay_->isEntered_)
+ {
videoPlay_->StopVideoPlay();
}
delete videoPlay_;
}
Surface *surface = surfaceView_->GetSurface();
- if (surface == nullptr) {
- return false;
- }
+ if (surface == nullptr)
+ {
+ return false;
+ }
// 创建新播放器并启动
videoPlay_ = new MediaVideoPlay(surface, nullptr, std::string(uri), false);
- if (videoPlay_ == nullptr) {
+ if (videoPlay_ == nullptr)
+ {
return false;
}
g_videoPlay = videoPlay_;
return (ret == 0);
}
- void ThunderBirdMainView::CloseVideo()
+ void ThunderBirdMainView::CloseVideo() // 关闭表情接口
{
// 停止视频并释放播放器
if (videoPlay_ != nullptr)
g_videoPlay = nullptr;
g_lastPlayed = false;
// 注销屏幕状态通知
- deregisterNotifyScreenStatus(ScreenStatusNotify);
+ //deregisterNotifyScreenStatus(ScreenStatusNotify);
// 释放表面与背景
if (surfaceView_ != nullptr)
{
curFace = nullptr;
}
}
- bool ThunderBirdMainView::ChangeThunderBirdView(int16_t thisView)
- {
- // 检查视图是否已初始化
- if (group[thisView] == nullptr)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeUnderInitialCalibrationView");
- g_pThunderBirdView = new ThunderBirdView();
- if (g_pThunderBirdView == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView);
- return false;
- }
- // 初始化视图并添加到视图组
- group[thisView] = g_pThunderBirdView->ThunderBirdViewInit();
- ScrollView_->Add(group[thisView]);
- }
- return true;
- }
- bool ThunderBirdMainView::ChangeThunderBirdOtaView(int16_t thisView)
+ bool ThunderBirdMainView::ChangeThunderBirdOtaView(int16_t thisView) // 切换Ota界面接口
{
if (group[thisView] == nullptr)
{
return true;
}
- bool ThunderBirdMainView::ChangeThunderBirdGuideView(int16_t thisView)
+ bool ThunderBirdMainView::ChangeThunderBirdGuideView(int16_t thisView) // 切换引导界面接口
{
if (group[thisView] == nullptr)
{
return true;
}
- bool ThunderBirdMainView::ChangeThunderBirdLullabyView(int16_t thisView)
+ bool ThunderBirdMainView::ChangeThunderBirdLullabyView(int16_t thisView) // 切换哄睡界面接口
{
if (group[thisView] == nullptr)
{
return true;
}
- bool ThunderBirdMainView::ChangeThunderBirdDialogueView(int16_t thisView)
+ bool ThunderBirdMainView::ChangeThunderBirdDialogueView(int16_t thisView) // 切换对话界面接口
{
if (group[thisView] == nullptr)
{
return true;
}
- bool ThunderBirdMainView::ChangeThunderBirdReminderView(int16_t thisView)
+ bool ThunderBirdMainView::ChangeThunderBirdReminderView(int16_t thisView) // 切换提醒界面接口
{
if (group[thisView] == nullptr)
{
return true;
}
- bool ThunderBirdMainView::ChangeThunderBirdAdjustView(int16_t thisView)
+ bool ThunderBirdMainView::ChangeThunderBirdAdjustView(int16_t thisView) // 切换调整界面接口
{
if (group[thisView] == nullptr)
{
}
return true;
}
- bool ThunderBirdMainView::ChangeThunderBirdShutdownView(int16_t thisView)
+ bool ThunderBirdMainView::ChangeThunderBirdShutdownView(int16_t thisView) // 切换关机界面接口
{
if (group[thisView] == nullptr)
{
}
return true;
}
-
+ bool ThunderBirdMainView::ChangeThunderBirdShutdownTestView(int16_t thisView) // 切换关机测试界面接口
+ {
+ if (group[thisView] == nullptr)
+ {
+ g_pThunderBirdShutdownTestView = new ThunderBirdShutdownTestView();
+ if (g_pThunderBirdShutdownTestView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownTestView new fail %d", thisView);
+ return false;
+ }
+ group[thisView] = g_pThunderBirdShutdownTestView->Init();
+ ScrollView_->Add(group[thisView]);
+ g_pThunderBirdShutdownTestView->StartAnimation();
+ }
+ return true;
+ }
/**
* 视图映射结构体 - 将视图ID映射到对应的视图切换函数
};
static const TBViewMapper ViewMapper[] = {
- {THUNDERBIRDMENUVIEW, &ThunderBirdMainView::ChangeThunderBirdView},
{THUNDERBIRD_OTAVIEW, &ThunderBirdMainView::ChangeThunderBirdOtaView},
{THUNDERBIRD_GUIDEVIEW, &ThunderBirdMainView::ChangeThunderBirdGuideView},
{THUNDERBIRD_LULLABYVIEW, &ThunderBirdMainView::ChangeThunderBirdLullabyView},
{THUNDERBIRD_REMINDERVIEW, &ThunderBirdMainView::ChangeThunderBirdReminderView},
{THUNDERBIRD_ADJUSTVIEW, &ThunderBirdMainView::ChangeThunderBirdAdjustView},
{THUNDERBIRD_SHUTDOWNVIEW, &ThunderBirdMainView::ChangeThunderBirdShutdownView},
+ {THUNDERBIRD_SHUTDOWNTESTVIEW, &ThunderBirdMainView::ChangeThunderBirdShutdownTestView},
};
bool ThunderBirdMainView::ClickFunc(int16_t interface)
}
group[hideView]->SetVisible(false);
}
+ // 同用遮罩,部分界面在内部自行开启,其余界面关闭
+ iconView->SetVisible(false);
+ backGroundView->SetVisible(false);
+ // 保存上一级视图信息
+ prevView_ = currentView_;
+ prevSubView_ = currentSubView_;
ClickFunc(showView);
group[showView]->SetVisible(true);
- group[showView]->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ group[showView]->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ // 关键:把状态栏重新加到末尾,确保最上层
+ if (group1)
+ {
+ ScrollView_->Remove(group1);
+ ScrollView_->Add(group1);
+ }
// 进入大界面后,根据 subView 跳转到其子界面
if (subView != -1)
{
break;
}
}
- currentView_ = showView;//更新当前视图
- currentSubView_ = subView;//更新当前子视图
+ currentView_ = showView; // 更新当前视图
+ currentSubView_ = subView; // 更新当前子视图
ScrollView_->Invalidate();
+ }
+ void ThunderBirdMainView::OpenBackGround(void)//打开遮罩
+ {
+ iconView->SetVisible(true);
+ backGroundView->SetVisible(true);
}
int16_t ThunderBirdMainView::GetCurrentView() const
return;
}
g_videoPlay = videoPlay_;
- registerNotifyScreenStatus(ScreenStatusNotify);
+ //registerNotifyScreenStatus(ScreenStatusNotify);
}
if (videoPlay_->isExited_ || !videoPlay_->isEntered_)
{
ScrollView_->Add(surfaceView_);
ScrollView_->Add(curFace);
}
- void ThunderBirdMainView::InitBaseData()
+ UIViewGroup *ThunderBirdMainView::InitBaseData()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::InitBaseData");
if (group1 == nullptr)
if (group1 == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group1 new fail");
- return;
+ return nullptr;
}
}
- group1->SetPosition(70, 40, 350, 40);
+ group1->SetPosition(96, 14, 168, 40);
group1->SetStyle(STYLE_BACKGROUND_OPA, 0);
- InitLabel(timeLabel, 0, (group1->GetHeight() - 38), 175, 38, "titleLable", "08:52", DEFAULT_VECTOR_FONT_FILENAME, 32);
+ timeLabel = new UILabelExt();
+ if (timeLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel new fail");
+ return nullptr;
+ }
+ timeLabel->SetPosition(0, 4, 46, 33);
+ timeLabel->SetViewId("timeLabel");
+ timeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 24);
+ timeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ timeLabel->SetVisible(true);
timeLabel->SetText(ThunderBirdModel::GetInstance()->GetCurrentTimeStr().c_str()); // 每秒变化
group1->Add(timeLabel);
/* -------------------------------- NoSignal -------------------------------- */
if (NoSignal == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "NoSignal new fail");
- return;
+ return nullptr;
}
}
NoSignal->SetPosition(140, (group1->GetHeight() - 38) / 2, 36, 38);
};
// 待添加的 ImageView 信息列表
std::vector<ImageViewInfo> imageViewList = {
- {140, 28, 6, 6},
+ {65+8, 28, 6, 6},
{150, 20, 6, 14},
{160, 12, 6, 22},
{170, 4, 6, 30},
if (showSignalStrength[i] == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showSignalStrength[%d] new fail", i);
- return;
+ return nullptr;
}
}
showSignalStrength[i]->SetPosition(imageViewList[i].posX, imageViewList[i].posY, imageViewList[i].width, imageViewList[i].height);
if (batteryimage == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryimage new fail");
- return;
+ return nullptr;
}
batteryimage->SetPosition(170 + 20, (group1->GetHeight() - 30) / 2, 48, 30);
std::string batteryimagesPath = "/user/res/Battery_White.bin";
if (progress == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "progress new fail");
- return;
+ return nullptr;
}
progress->SetPosition(batteryimage->GetX() + 7, batteryimage->GetY() + 6, 30, 18);
progress->SetValidWidth(30);
progress->SetForegroundStyle(STYLE_LINE_COLOR, 0xff45A5FF);
group1->Add(progress);
/* -----------------------------------电量--------------------------------------- */
- InitUILabel(batteryLabel, batteryimage->GetX() + 58, (group1->GetHeight() - 28) / 2, 30, 28, "titleLable", "100", DEFAULT_VECTOR_FONT_FILENAME, 25);
+ batteryLabel = new UILabel();
+ if (batteryLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryLabel new fail");
+ return nullptr;
+ }
+ batteryLabel->SetPosition(batteryimage->GetX() + 58, (group1->GetHeight() - 28) / 2, 30, 28);
+ batteryLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 25);
+ batteryLabel->SetText("100");
batteryLabel->SetStyle(STYLE_TEXT_COLOR, Color::White().full);
batteryLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT);
group1->Add(batteryLabel);
if (!chargeBatteryicon)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "chargeBatteryicon creation failed");
- return;
+ return nullptr;
}
chargeBatteryicon->SetPosition(progress->GetX() + 6, batteryimage->GetY() + 2, 17, 26);
chargeBatteryicon->SetSrc("/user/res/Icon.bin");
chargeBatteryicon->SetVisible(false);
group1->Add(chargeBatteryicon);
/* -------------------------------------------------------------------------- */
- ScrollView_->Add(group1);
+ // ScrollView_->Add(group1);
/* -------------------------------------------------------------------------- */
updateSignalDisplay();
/* -------------------------------------------------------------------------- */
UpdateBatteryProcess();
+ return group1;
}
void ThunderBirdMainView::UpdateTimeText(const char *time)
{
timeLabel->SetText(time); // 每秒变化
}
- void ThunderBirdMainView::updateSignalDisplay()
+ void ThunderBirdMainView::updateSignalDisplay() // 信号接收
{
int sim = uapi_dev_runtime_get_cat1_simstat();
int cat1_powerOn = uapi_dev_runtime_get_cat1_powerstat();
int signal = uapi_dev_runtime_get_cat1_signal();
int network_on = uapi_dev_runtime_get_cat1_networkstat();
int cat1_network_type = uapi_dev_runtime_get_cat1_networtype();
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sim = %d", sim);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_powerOn = %d", cat1_powerOn);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "signal = %d", signal);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "network_on = %d", network_on);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_network_type = %d", cat1_network_type);
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sim = %d", sim);
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_powerOn = %d", cat1_powerOn);
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "signal = %d", signal);
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "network_on = %d", network_on);
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_network_type = %d", cat1_network_type);
const int SIGNAL_NO_SIGNAL = 99;
NoSignal->SetVisible(true);
}
UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+ // 处理网络标志位(无网络)
+ int8_t currentNet = 0;
+ if (lastNetworkOnline_ == -1)
+ {
+ lastNetworkOnline_ = currentNet;
+ }
+ if (lastNetworkOnline_ == 1 && currentNet == 0)
+ {
+ if (currentView_ == THUNDERBIRD_DIALOGUEVIEW ||
+ (currentView_ == THUNDERBIRD_LULLABYVIEW &&
+ (currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1 ||
+ currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4))) // 只有在对话界面还有哄睡界面才触发
+ {
+ // 从有网络到无网络:提示一次
+ ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW);
+ if (g_pThunderBirdReminderView)
+ {
+ g_pThunderBirdReminderView->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT);
+ }
+
+ }
+ }
+ lastNetworkOnline_ = currentNet;
}
else if (cat1_powerOn == 1 && sim == 1)
{
NoSignal->SetVisible(true);
}
UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+ // 从有网络到无网络:提示一次
+ int8_t currentNet = 0;
+ if (lastNetworkOnline_ == -1)
+ {
+ lastNetworkOnline_ = currentNet;
+ }
+ if (lastNetworkOnline_ == 1 && currentNet == 0)
+ {
+ if (currentView_ == THUNDERBIRD_DIALOGUEVIEW ||
+ (currentView_ == THUNDERBIRD_LULLABYVIEW &&
+ (currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1 ||
+ currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4))) // 只有在对话界面还有哄睡界面才触发
+ {
+ ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW);
+ if (g_pThunderBirdReminderView)
+ {
+ g_pThunderBirdReminderView->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT);
+ }
+
+ }
+ }
+ lastNetworkOnline_ = currentNet;
}
else
{
NoSignal->SetVisible(false);
}
UpdateSignalBarDisplay(CalculateSignalBars(signal), true);
+ lastNetworkOnline_ = 1;
}
}
}
return 99; // Invalid signal strength
}
}
- void ThunderBirdMainView::UpdateBatteryProcess()
+ void ThunderBirdMainView::UpdateBatteryProcess() // 电量接收及其提醒函数
{
float voltage = 0.0F;
- uint8_t value = 0;
+ Batteryvalue = 0;
#ifdef SUPPORT_BATTERY_SERVICE
- value = battery_get_voltage(&voltage);
+ Batteryvalue = battery_get_voltage(&voltage);
#endif
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "battery_get_voltage = %d", value);
- batteryLabel->SetText((std::to_string(static_cast<int>(value))+"%").c_str()); // 电量
- progress->SetValue(value);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "battery_get_voltage = %d", Batteryvalue);
+ if (batteryLabel)
+ {
+ batteryLabel->SetText((std::to_string(static_cast<int>(Batteryvalue))).c_str()); // 电量
+ }
+ if (progress)
+ {
+ progress->SetValue(Batteryvalue);
+ }
if (!chargeBatteryicon || !progress)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "isCharging = %d", isCharging);
#endif
+ // 充电流程:进入充电显示“充电中”(一次),满电显示“充电完成”(一次)
if (isCharging)
{
if (!isChargeBatteryIconVisible)
- {
- chargeBatteryicon->SetVisible(true); // 充电图标
+ {
+ chargeBatteryicon->SetVisible(true); // 充电图标
isChargeBatteryIconVisible = true;
}
- progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); // 充电状态为绿色
- return;
- }
- else
- {
- if (value <= 20) // 低电量
+ progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Green().full);
+
+ if (!wasCharging)
{
- if (isChargeBatteryIconVisible)
+ // int16_t currentView = GetCurrentView();
+ // int16_t currentSubView = GetCurrentSubView();
+ if (currentView_ == THUNDERBIRD_DIALOGUEVIEW ||
+ (currentView_ == THUNDERBIRD_LULLABYVIEW &&
+ (currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1 ||
+ currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4))) // 只有在对话界面还有哄睡界面才触发
{
- chargeBatteryicon->SetVisible(false); // 充电图标
- isChargeBatteryIconVisible = false;
+ // 首次进入充电状态,提醒一次,不走ChangeView
+ ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW); // 不走ChangeView
+ if (g_pThunderBirdReminderView)
+ {
+ g_pThunderBirdReminderView->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_CHARGING);
+ }
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "currentView = %d, currentSubView = %d", currentView_, currentSubView_);
+
}
- progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); // 低电状态为红色
+ wasCharging = true;
+ notifiedChargeFull = false;
}
- else // 非低电量
+
+ if (Batteryvalue >= 100 && !notifiedChargeFull)
{
- if (isChargeBatteryIconVisible)
+ if (currentView_ == THUNDERBIRD_DIALOGUEVIEW ||
+ (currentView_ == THUNDERBIRD_LULLABYVIEW &&
+ (currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1 ||
+ currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4))) // 只有在对话界面还有哄睡界面才触发
{
- chargeBatteryicon->SetVisible(false); // 充电图标
- isChargeBatteryIconVisible = false;
+ ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW); // 不走ChangeView
+ if (g_pThunderBirdReminderView)
+ {
+ g_pThunderBirdReminderView->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE);
+ }
+ notifiedChargeFull = true;
+
}
-
- progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::White().full); // 非充电状态为白色
}
return;
}
+
+ // 非充电:重置充电相关一次性标记
+ if (isChargeBatteryIconVisible)
+ {
+ chargeBatteryicon->SetVisible(false);
+ isChargeBatteryIconVisible = false;
+ }
+ wasCharging = false;
+ notifiedChargeFull = false;
+
+ // 颜色显示
+ if (Batteryvalue <= 20)
+ {
+ progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Red().full);
+ }
+ else
+ {
+ progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::White().full);
+ }
+
+ // 电量阶段:3:>20, 2:(10,20], 1:(5,10], 0:<=5
+ int16_t stage = 3;
+ if (Batteryvalue == 5)
+ stage = 0;
+ else if (Batteryvalue == 10)
+ stage = 1;
+ else if (Batteryvalue == 20)
+ stage = 2;
+
+ // 阶段变更时提醒一次(从高到低跨阈值时触发)
+ if (stage != lastBatteryStage)
+ {
+ if (stage < lastBatteryStage || lastBatteryStage == -1)
+ {
+ if (stage <= 2) // 仅在<=20%三个档位弹低电量提醒
+ {
+ if (currentView_ == THUNDERBIRD_DIALOGUEVIEW ||
+ (currentView_ == THUNDERBIRD_LULLABYVIEW &&
+ (currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1 ||
+ currentSubView_ == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4))) // 只有在对话界面还有哄睡界面才触发
+ {
+ ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW); // 不走ChangeView
+ if (g_pThunderBirdReminderView)
+ {
+ g_pThunderBirdReminderView->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_LOW_BATTERY);
+ }
+
+ }
+ }
+ }
+ lastBatteryStage = stage;
+ }
+ return;
}
}
--- /dev/null
+/***
+ * @Date: 2024-06-22 18:08:25
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-24 11:30:12
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThunderBirdModel.cpp
+ */
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-07 09:21:47
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-11-05 14:49:01
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThunderBirdModel.cpp
+ */
+
+#include "thunderbird/include/ThunderBirdModel.h"
+#include "thunderbird/include/ThunderBirdReminderView.h"
+#include "thunderbird/include/ThunderBirdOtaView.h"
+#include "thunderbird/include/ThunderBirdLullabyView.h"
+#include "thunderbird/include/ThunderBirdMainView.h"
+#include "wearable_log.h"
+#include <sys/time.h>
+#include <service/graphic_service.h>
+#include "wearable_log.h"
+#include "custom_utils.h"
+#include <string.h>
+namespace OHOS
+{
+ ThunderBirdModel::ThunderBirdModel() {}
+ ThunderBirdModel::~ThunderBirdModel() {}
+
+ ThunderBirdModel *ThunderBirdModel::GetInstance()
+ {
+ static ThunderBirdModel instance;
+ return &instance;
+ }
+ // 获取当前时间戳字符串
+ std::string ThunderBirdModel::GetCurrentTimeStr()
+ {
+ uint32_t timeStamp = 0;
+ if (uapi_get_timestampe_ss(&timeStamp) != ERRCODE_SUCC)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to get timestamp");
+ return "----/--/-- \n --/--";
+ }
+ // 将时间戳转换为 time_t 类型
+ time_t rawtime = static_cast<time_t>(timeStamp);
+ struct tm *timeinfo = localtime(&rawtime);
+
+ if (timeinfo == NULL)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to convert time");
+ return "----/--/-- \n --/--";
+ }
+
+ // 格式化时间为字符串 (HH:MM:SS format)
+ char buffer[20]; // 格式: HH:MM:SS
+ std::strftime(buffer, sizeof(buffer), "%H:%M", timeinfo);
+ return std::string(buffer);
+ }
+ void ThunderBirdModel::timer_callback_proc()
+ {
+ ThunderBirdMainView *view = ThunderBirdMainView::GetInstance();
+ if (view)
+ {
+ view->UpdateTimeText(GetCurrentTimeStr().c_str());
+ }
+ }
+
+ /* ---------------------- 状态栏时间刷新定时器 ---------------------- */
+ static osTimerId_t g_timer = nullptr;
+ /*定时器到期时的处理*/
+ static void TimerCallbackProc(uint8_t data)
+ {
+ // 倒计时
+ ThunderBirdModel::GetInstance()->timer_callback_proc();
+ ThunderBirdMainView::GetInstance()->updateSignalDisplay();
+ ThunderBirdMainView::GetInstance()->UpdateBatteryProcess();
+ }
+ /*
+ * @brief 回调函数
+ */
+ static void TimerCallback(uint8_t data)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TimerCallback %d", data);
+ GraphicService::GetInstance()->PostGraphicEvent(
+ std::bind(TimerCallbackProc, data));
+ }
+
+ /*
+ * @brief 开启定时器函数
+ * @param interval 时间间隔,单位ms
+ */
+ void ThunderBirdModel::StartTimer(uint32_t interval)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::StartTimer");
+ /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回
+ * ------------------------- */
+ if (g_timer != nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer already exists!!");
+ return;
+ }
+
+ /* --------------------------------- 2.创建定时器
+ * -------------------------------- */
+ g_timer = osTimerNew((osTimerFunc_t)TimerCallback, osTimerPeriodic,
+ nullptr, nullptr);
+ // 检查定时器创建是否成功
+ if (g_timer == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Timer create failed!!");
+ return;
+ }
+
+ /* ----------------------------- 3.将毫秒转换为系统时钟节拍数
+ * ---------------------------- */
+ /* --------------------------------- 4.启动定时器
+ * -------------------------------- */
+ osStatus_t ret = osTimerStart(g_timer, interval);
+ /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为
+ * nullptr -------------------- */
+ if (ret != osOK)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+ "osTimerDelete failed, ret = %lx!!", ret);
+ if (g_timer != nullptr)
+ {
+ ret = osTimerDelete(g_timer);
+ }
+ g_timer = nullptr;
+ return;
+ }
+ }
+ /*
+ * @brief 停止定时器
+ */
+ void ThunderBirdModel::StopTimer(void)
+ {
+ // 检查定时器是否存在
+ if (g_timer != nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::BP_StopTimer");
+ osTimerStop(g_timer);
+ // 删除定时器并置为 nullptr
+ osStatus_t ret = osTimerDelete(g_timer);
+ if (ret != osOK)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+ "osTimerDelete failed, ret = %lx!!", ret);
+ }
+ g_timer = nullptr;
+ }
+ }
+
+ /*----------------------提醒界面定时器----------------------------------*/
+ static osTimerId_t g_reminderHideTimer = nullptr;
+ static void ReminderHideTimerCallbackProc(uint8_t data)
+ {
+ (void)data;
+ auto *reminder = ThunderBirdReminderView::GetInstance();
+ if (reminder != nullptr)
+ {
+ reminder->HideAll();
+ }
+ int16_t currentView = ThunderBirdMainView::GetInstance()->GetCurrentView();
+ int16_t currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView();
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "currentView = %d, currentSubView = %d", currentView, currentSubView);
+ // 隐藏后切回之前的界面
+ // auto *mainv = ThunderBirdReminderView::GetInstance();
+ // if (mainv != nullptr)//判断条件需要修改
+ // {
+ // mainv->Show(-1);
+ // }
+ }
+ static void ReminderHideTimerCallback(uint8_t data)
+ {
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(ReminderHideTimerCallbackProc, data));
+ }
+ void ThunderBirdModel::StartReminderHideTimer(uint32_t intervalMs)
+ {
+ if (g_reminderHideTimer != nullptr)
+ {
+ osTimerStop(g_reminderHideTimer);
+ osStatus_t ret = osTimerDelete(g_reminderHideTimer);
+ (void)ret;
+ g_reminderHideTimer = nullptr;
+ }
+ g_reminderHideTimer = osTimerNew((osTimerFunc_t)ReminderHideTimerCallback, osTimerOnce, nullptr, nullptr);
+ if (g_reminderHideTimer == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartReminderHideTimer new timer failed!!");
+ return;
+ }
+ osStatus_t ret = osTimerStart(g_reminderHideTimer, intervalMs);
+ if (ret != osOK)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartReminderHideTimer start failed, ret = %lx!!", ret);
+ osTimerDelete(g_reminderHideTimer);
+ g_reminderHideTimer = nullptr;
+ }
+ auto *reminder = ThunderBirdReminderView::GetInstance();//先隐藏全部提醒界面
+ if (reminder != nullptr)
+ {
+ reminder->HideAll();
+ }
+ }
+
+ // ---------------------- OTA 倒计时定时器(5 -> 1,每步1秒) ----------------------
+ static osTimerId_t g_otaCountdownTimer = nullptr;
+ static int g_otaCountdownValue = 0;
+ static void OtaCountdownTimerProc(uint8_t data)
+ {
+ (void)data;
+ if (g_otaCountdownValue < 1)
+ {
+ // 停止并删除
+ if (g_otaCountdownTimer != nullptr)
+ {
+ osTimerStop(g_otaCountdownTimer);
+ osTimerDelete(g_otaCountdownTimer);
+ g_otaCountdownTimer = nullptr;
+ }
+ g_otaCountdownValue = 0;
+ //自动跳转到开始OTA界面
+ ThunderBirdMainView::GetInstance()->ChangeView(THUNDERBIRD_OTAVIEW, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATING);
+ return;
+
+
+ }
+ g_otaCountdownValue -= 1;
+ GraphicService::GetInstance()->PostGraphicEvent([](){
+ if (ThunderBirdOtaView::GetInstance())
+ {
+ ThunderBirdOtaView::GetInstance()->UpdateCountdown(g_otaCountdownValue);
+ }
+ });
+ }
+ static void OtaCountdownTimerCb(uint8_t data)
+ {
+ OtaCountdownTimerProc(data);
+ }
+ void ThunderBirdModel::StartOtaCountdown(uint32_t startVal)
+ {
+ // 范围保护
+ if (startVal < 1) { startVal = 1; }
+ if (startVal > 5) { startVal = 5; }
+ // 先停旧定时器
+ if (g_otaCountdownTimer != nullptr)
+ {
+ osTimerStop(g_otaCountdownTimer);
+ osTimerDelete(g_otaCountdownTimer);
+ g_otaCountdownTimer = nullptr;
+ }
+ g_otaCountdownValue = (int)startVal;
+ // 立即刷新一次当前值
+ if (ThunderBirdOtaView::GetInstance())
+ {
+ ThunderBirdOtaView::GetInstance()->UpdateCountdown(g_otaCountdownValue);
+ }
+ // 创建1s周期定时器
+ uint32_t oneSecond = 1000;
+ g_otaCountdownTimer = osTimerNew((osTimerFunc_t)OtaCountdownTimerCb, osTimerPeriodic, nullptr, nullptr);
+ if (g_otaCountdownTimer == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartOtaCountdown new timer failed!!");
+ return;
+ }
+ osStatus_t ret = osTimerStart(g_otaCountdownTimer, oneSecond);
+ if (ret != osOK)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartOtaCountdown start failed, ret = %lx!!", ret);
+ osTimerDelete(g_otaCountdownTimer);
+ g_otaCountdownTimer = nullptr;
+ }
+ }
+
+ // ---------------------- 通用计时加一定时器(0 -> targetSeconds,每步1秒) ----------------------
+ static osTimerId_t g_countUpTimer = nullptr;
+ static int g_countUpTargetSeconds = 0;
+ static int g_countUpValue = 0;
+ static void CountUpTimerProc(uint8_t data)
+ {
+ (void)data;
+ if (g_countUpValue >= g_countUpTargetSeconds)
+ {
+ if (g_countUpTimer != nullptr)
+ {
+ osTimerStop(g_countUpTimer);
+ osTimerDelete(g_countUpTimer);
+ g_countUpTimer = nullptr;
+ }
+ return;
+ }
+ g_countUpValue += 1;
+ ThunderBirdLullabyView::GetInstance()->UpdateTimeText(g_countUpValue, g_countUpTargetSeconds);
+ }
+ static void CountUpTimerCb(uint8_t data)
+ {
+ CountUpTimerProc(data);
+ }
+ void ThunderBirdModel::StartCountUpTimer(uint32_t targetSeconds)
+ {
+ // 参数保护:至少为1秒
+ if (targetSeconds < 1) { targetSeconds = 1; }
+ // 停止旧定时器
+ if (g_countUpTimer != nullptr)
+ {
+ osTimerStop(g_countUpTimer);
+ osStatus_t ret = osTimerDelete(g_countUpTimer);
+ (void)ret;
+ g_countUpTimer = nullptr;
+ }
+ // 初始化
+ g_countUpTargetSeconds = (int)targetSeconds;
+ g_countUpValue = 0;
+ // 创建1s周期定时器
+ uint32_t oneSecond = 1000;
+ g_countUpTimer = osTimerNew((osTimerFunc_t)CountUpTimerCb, osTimerPeriodic, nullptr, nullptr);
+ if (g_countUpTimer == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartCountUpTimer new timer failed!!");
+ return;
+ }
+ osStatus_t ret = osTimerStart(g_countUpTimer, oneSecond);
+ if (ret != osOK)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartCountUpTimer start failed, ret = %lx!!", ret);
+ osTimerDelete(g_countUpTimer);
+ g_countUpTimer = nullptr;
+ }
+ }
+ void ThunderBirdModel::StopCountUpTimer(void)
+ {
+ if (g_countUpTimer != nullptr)
+ {
+ osTimerStop(g_countUpTimer);
+ osStatus_t ret = osTimerDelete(g_countUpTimer);
+ if (ret != osOK)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StopCountUpTimer delete failed, ret = %lx!!", ret);
+ }
+ g_countUpTimer = nullptr;
+ }
+ }
+ int ThunderBirdModel::GetCountUpValue() const
+ {
+ return g_countUpValue;
+ }
+
+}
--- /dev/null
+#include "thunderbird/include/ThunderBirdOtaView.h"
+#include "thunderbird/include/ThunderBirdModel.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+ static ThunderBirdOtaView *g_pThunderBirdOtaView{nullptr};
+
+ ThunderBirdOtaView::ThunderBirdOtaView()
+ {
+ g_pThunderBirdOtaView = this;
+ }
+
+ ThunderBirdOtaView::~ThunderBirdOtaView()
+ {
+ g_pThunderBirdOtaView = nullptr;
+ ClearAll();
+ }
+
+ ThunderBirdOtaView *ThunderBirdOtaView::GetInstance(void)
+ {
+ return g_pThunderBirdOtaView;
+ }
+
+ void ThunderBirdOtaView::ClearAll(void)
+ {
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ if (titleLabel != nullptr) { delete titleLabel; titleLabel = nullptr; }
+ if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+ if (LittleTextLabel != nullptr) { delete LittleTextLabel; LittleTextLabel = nullptr; }
+ if (LittleTextLabel_2 != nullptr) { delete LittleTextLabel_2; LittleTextLabel_2 = nullptr; }
+ if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+ if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+ if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+ if (BackGround != nullptr) { delete BackGround; BackGround = nullptr; }
+ }
+
+ UIViewGroup *ThunderBirdOtaView::ThunderBirdOtaViewInit(void)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdOtaView::group null!");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+
+ BackGround = new UIImageView();
+ if (BackGround)
+ {
+ BackGround->SetAutoEnable(false);
+ BackGround->SetPosition(0, 0, 466, 466);
+ BackGround->SetSrc("/user/res/RebootAndShutDown/ReBoot/4.bin");
+ BackGround->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ BackGround->SetResizeMode(UIImageView::CONTAIN);
+ BackGround->SetVisible(false);
+ group->Add(BackGround);
+ }
+
+ // 公共控件
+ TextLabel = new UILabelExt();
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(0, 104, 466, 48);
+ TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
+ TextLabel->SetVisible(false);
+ group->Add(TextLabel);
+ }
+ LittleTextLabel = new UILabelExt();
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetPosition(0, 180, 466, 40);
+ LittleTextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ LittleTextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 34);
+ LittleTextLabel->SetVisible(false);
+ group->Add(LittleTextLabel);
+ }
+ LittleTextLabel_2 = new UILabelExt();
+ if (LittleTextLabel_2)
+ {
+ LittleTextLabel_2->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ LittleTextLabel_2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ LittleTextLabel_2->SetVisible(false);
+ group->Add(LittleTextLabel_2);
+ }
+ RemindLabel = new UILabelExt();
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(0, 180, 466, 40);
+ RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
+ RemindLabel->SetVisible(false);
+ group->Add(RemindLabel);
+ }
+ RemindIcon = new UIImageView();
+ if (RemindIcon)
+ {
+ RemindIcon->SetAutoEnable(false);
+ RemindIcon->SetVisible(false);
+ group->Add(RemindIcon);
+ }
+ RemindIcon2 = new UIImageView();
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetAutoEnable(false);
+ RemindIcon2->SetVisible(false);
+ group->Add(RemindIcon2);
+ }
+ RemindIcon3 = new UIImageView();
+ if (RemindIcon3)
+ {
+ RemindIcon3->SetAutoEnable(false);
+ RemindIcon3->SetVisible(false);
+ group->Add(RemindIcon3);
+ }
+ VolumeProgress = new UIBoxProgress();
+ if (VolumeProgress)
+ {
+ VolumeProgress->SetPosition(56, 279, 248, 4);
+ VolumeProgress->SetRange(100, 0);
+ VolumeProgress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0xff);
+ VolumeProgress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xffb4a9a0);
+ VolumeProgress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ VolumeProgress->SetForegroundStyle(STYLE_TEXT_COLOR, 0xff000000);
+ VolumeProgress->SetForegroundStyle(STYLE_LINE_COLOR, 0xff45A5FF);
+ group->Add(VolumeProgress);
+ }
+ return group;
+ }
+
+ void ThunderBirdOtaView::Show(int16_t showView)
+ {
+ if (group == nullptr) { return; }
+ if (BackGround) { BackGround->SetVisible(true);}
+ if (TextLabel) { TextLabel->SetVisible(false); }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetVisible(false);
+ LittleTextLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ LittleTextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ LittleTextLabel->SetRollSpeed(35);
+ LittleTextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
+ }
+ if (LittleTextLabel_2) { LittleTextLabel_2->SetVisible(false);}
+ if (RemindLabel) { RemindLabel->SetVisible(false);}
+ if (RemindIcon) { RemindIcon->SetVisible(false); }
+ if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+ if (RemindIcon3) { RemindIcon3->SetVisible(false); }
+ if (VolumeProgress) { VolumeProgress->SetVisible(false); }
+ switch (showView)
+ {
+ case THUNDERBIRD_OTAVIEW_NORMAL:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(45, 102, 270, 42);
+ TextLabel->SetText("新的体验优化已就绪");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("全新功能已推出,现在Amby可以哄你睡觉");
+ LittleTextLabel->SetPosition(0, 162, 360, 28);
+ LittleTextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel_2)
+ {
+ LittleTextLabel_2->SetPosition(94, 194, 172, 28);
+ LittleTextLabel_2->SetText("更新预计需要5分钟");
+ LittleTextLabel_2->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 更新");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_OBVIOUS:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(66, 102, 240, 42);
+ TextLabel->SetText("有新功能更新可用");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("全新功能已推出,现在Amby可以哄你睡觉");
+ LittleTextLabel->SetPosition(0, 162, 360, 28);
+ LittleTextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ LittleTextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel_2)
+ {
+ LittleTextLabel_2->SetText("更新预计需要5分钟");
+ LittleTextLabel_2->SetPosition(94, 194, 172, 28);
+ LittleTextLabel_2->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 更新");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_UPDATE_NOW:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(90, 102, 180, 42);
+ TextLabel->SetText("需要立即更新");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("为保障您的产品安全,部分功能将在更新后恢复使用");
+ LittleTextLabel->SetPosition(60, 162, 240, 56);
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 更新");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_NIGHT_UPDATE:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(45, 102, 270, 42);
+ TextLabel->SetText("设置夜间更新");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("电量>50%,网络正常");
+ LittleTextLabel->SetPosition(75, 162, 210, 28);
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_NIGHT_UPDATE_SUCCESS:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(90, 102, 180, 84);
+ TextLabel->SetText(" 设定成功! 记得充好电哦");
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ TextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(136, 275, 88, 25);
+ RemindLabel->SetText("按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(160, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_COUNTDOWN:
+ {
+ ThunderBirdModel::GetInstance()->StartOtaCountdown(5);
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(60, 102, 240, 42);
+ TextLabel->SetText("设备更新即将开始");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("5");
+ LittleTextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 48);
+ LittleTextLabel->SetPosition(166, 172, 29, 67);
+ LittleTextLabel->SetVisible(true);
+ }
+
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_LOW_BATTERY:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(82, 124, 240, 42);
+ TextLabel->SetText("电量不足无法更新");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("请至少充至50%电量哦");
+ LittleTextLabel->SetPosition(72, 186, 192, 25);
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(136, 275, 88, 25);
+ RemindLabel->SetText("按 退出");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(160, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(38, 127, 36, 36);
+ RemindIcon2->SetSrc("/user/res/warning.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_NETWORK_ERROR:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetText("网络连接异常");
+ TextLabel->SetPosition(112, 124, 180, 42);
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("请检查网络后重试");
+ LittleTextLabel->SetPosition(100, 184, 160, 28);
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 重试");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ if (RemindIcon3)
+ {
+ RemindIcon3->SetPosition(68, 127, 36, 36);
+ RemindIcon3->SetSrc("/user/res/warning.bin");
+ RemindIcon3->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_MEMORY_ERROR:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(82, 124, 240, 42);
+ TextLabel->SetText("内存不足无法更新");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetText("请及时清理内存空间");
+ LittleTextLabel->SetPosition(90, 184, 180, 28);
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 清理");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ if (RemindIcon3)
+ {
+ RemindIcon3->SetPosition(38, 127, 36, 36);
+ RemindIcon3->SetSrc("/user/res/warning.bin");
+ RemindIcon3->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_UPDATING:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(90, 108, 120, 42);
+ TextLabel->SetText("更新中");
+ TextLabel->SetVisible(true);
+ }
+ if (VolumeProgress)
+ {
+ VolumeProgress->SetVisible(true);
+ }
+ if(LittleTextLabel)
+ {
+ LittleTextLabel->SetPosition(56, 243, 44, 28);
+ LittleTextLabel->SetText((std::to_string(remindProgressValue_) + "%").c_str());
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(198, 246, 106, 22);
+ RemindLabel->SetText("更新预计需要5分钟");
+ RemindLabel->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(142, 122, 164, 42);
+ TextLabel->SetText("更新成功");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetPosition(80, 184, 220, 28);
+ LittleTextLabel->SetText("你的设备已是最新版本");
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(136, 275, 88, 25);
+ RemindLabel->SetText("按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(160, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_up.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(98, 125, 36, 36);
+ RemindIcon2->SetSrc("/user/res/completed.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_OTAVIEW_UPDATE_FAILED:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(127, 122, 150, 42);
+ TextLabel->SetText("更新未完成");
+ TextLabel->SetVisible(true);
+ }
+ if (LittleTextLabel)
+ {
+ LittleTextLabel->SetPosition(70, 184, 220, 28);
+ LittleTextLabel->SetText("请检查网络和电量后重试");
+ LittleTextLabel->SetVisible(true);
+ }
+ if (RemindLabel)
+ {
+ RemindLabel->SetPosition(80, 275, 200, 25);
+ RemindLabel->SetText("按 退出 按 重试");
+ RemindLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(104, 277, 22, 22);
+ RemindIcon->SetSrc("/user/res/volume_down.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(216, 277, 22, 22);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ if (RemindIcon3)
+ {
+ RemindIcon3->SetPosition(83, 125, 36, 36);
+ RemindIcon3->SetSrc("/user/res/completed.bin");
+ RemindIcon3->SetVisible(true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ void ThunderBirdOtaView::UpdateCountdown(int value)//更新倒计时
+ {
+ if (LittleTextLabel == nullptr)
+ {
+ return;
+ }
+ if (value < 1) { value = 1; }
+ if (value > 5) { value = 5; }
+ LittleTextLabel->SetText(std::to_string(value).c_str());
+ LittleTextLabel->Invalidate();
+ }
+
+ void ThunderBirdOtaView::SetRemindProgress(int16_t value)//更新进度
+ {
+ if (VolumeProgress == nullptr)
+ {
+ return;
+ }
+ int newVal = remindProgressValue_ + value;
+ if (newVal < 0) { newVal = 0; }
+ if (newVal > 100) { newVal = 100; }
+ remindProgressValue_ = newVal;
+ VolumeProgress->SetValue(remindProgressValue_);
+ VolumeProgress->Invalidate();
+ }
+}
+
+
#include "common/key_code.h"
#include <custom_utils.h>
#include "NativeRegisterManager.h"
-#include "uicomponents/UIComponents.h"
+//#include "uicomponents/UIComponents.h"
#include "broadcast_feature.h"
#include "broadcast_service.h"
#include "samgr_lite.h"
Presenter<ThunderBirdMainView>::OnStart();
}
+ void ThunderBirdPresenter::OnResume()
+ {
+ Presenter<ThunderBirdMainView>::OnResume();
+ //统一抢回
+ RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)ThunderBirdPresenter::GetInstance();
+ RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::OnResume reset key listener");
+ }
+
bool ThunderBirdPresenter::OnDrag(UIView &view, const DragEvent &event)
{
UNUSED(event);
if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && ThunderBirdPresenter::X_DRAG_FLAG)
{
- NativeAbility::GetInstance().Back();
+ //NativeAbility::GetInstance().Back();
ThunderBirdPresenter::X_DRAG_FLAG = false;
}
return true;
UNUSED(event);
- NativeAbility::GetInstance().Back();
+ //NativeAbility::GetInstance().Back();
return true;
}
// 增加按键事件
bool ThunderBirdPresenter::OnKeyAct(UIView &view, const KeyEvent &event)
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::OnKeyAct");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::OnKeyAct");
uint16_t keyID = event.GetKeyId();
uint16_t keyState = event.GetState();
// 如果是power键就返回上一级
{
int16_t currentView = ThunderBirdMainView::GetInstance()->GetCurrentView();
int16_t currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView();
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "currentView = %d, currentSubView = %d", currentView, currentSubView);
+ // 音量界面:电源键 +10
+ if (currentView == THUNDERBIRD_DIALOGUEVIEW)
+ {
+ ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ ThunderBirdMainView::GetInstance()->ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW);//不走ChangeView
+ // if (ThunderBirdReminderView::GetInstance())
+ // {
+ // ThunderBirdReminderView::GetInstance()->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_VOLUME);
+ // ThunderBirdReminderView::GetInstance()->AdjustRemindProgress(10);
+ // ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ // }
+ if (ThunderBirdReminderView::GetInstance())
+ {
+ ThunderBirdReminderView::GetInstance()->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT);
+ }
+
+ return true;
+ }
// 引导界面导航
if(currentView == THUNDERBIRD_GUIDEVIEW)
{
}
else if(currentSubView == ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_3)
{
- ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_READY);
+ ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NORMAL);
}
}
// OTA界面导航
else if(currentView == THUNDERBIRD_OTAVIEW)
{
- if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_READY) // 有新功能
+ if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NORMAL) // 有新功能
{
- ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NEW_FEATURE);
+ ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_OBVIOUS);
}
- else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_NEW_FEATURE) // 需要立即更新
+ else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_OBVIOUS) // 需要立即更新
{
ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_NOW);
}
{
ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_MEMORY_ERROR);
}
- else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_MEMORY_ERROR) // 更新成功
+ else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_MEMORY_ERROR) // 内存不足
{
ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS);
}
- else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS) // æ\9b´æ\96°æ\9cªå®\8cæ\88\90
+ else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS) // æ\9b´æ\96°æ\88\90å\8a\9f
{
ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_FAILED);
}
- else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_FAILED) // 更新未完成
+ else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_FAILED) // 更新失败
{
ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1);
}
+ else if(currentSubView == ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATING) // 更新中
+ {
+ ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_SUCCESS);
+ }
}
// 哄睡界面导航
}
else if(currentSubView == ThunderBirdAdjustView::THUNDERBIRD_ADJUSTVIEW_NETWORK_CONNECTING) // 网络连接中
{
- ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_SHUTDOWNVIEW, 0);
+ // ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_SHUTDOWNVIEW, 0);
+ ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_SHUTDOWNTESTVIEW, -1);
}
}
}
if(keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC) && keyState == 1 && uapi_get_screen_state() == 0)
{
+ int16_t currentView = ThunderBirdMainView::GetInstance()->GetCurrentView();
+ int16_t currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView();
+ // 音量界面:FUNC 键 -10
+ if (currentView == THUNDERBIRD_DIALOGUEVIEW ||
+ (currentView == THUNDERBIRD_LULLABYVIEW &&
+ (currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_1 ||
+ currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4))) //只有在对话界面还有哄睡界面才触发
+ {
+ ThunderBirdMainView::GetInstance()->ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW);//不走ChangeView
+ if (ThunderBirdReminderView::GetInstance())
+ {
+ ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000);
+ ThunderBirdReminderView::GetInstance()->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_VOLUME);
+ ThunderBirdReminderView::GetInstance()->AdjustRemindProgress(-10);
+
+ }
+ return true;
+ }
// // 发布OTA升级事件,显示OTA升级弹窗
// PublishEvent(TOPIC_EVENT_OTA_UPDATE, nullptr, 0);
// WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter: Published OTA update event");
--- /dev/null
+#include "thunderbird/include/ThunderBirdReminderView.h"
+#include "wearable_log.h"
+#include "thunderbird/include/ThunderBirdMainView.h"
+#include "battery_hal.h"
+#include "battery_service.h"
+namespace OHOS
+{
+ static ThunderBirdReminderView *g_pThunderBirdReminderView{nullptr};
+
+ ThunderBirdReminderView::ThunderBirdReminderView()
+ {
+ g_pThunderBirdReminderView = this;
+ }
+
+ ThunderBirdReminderView::~ThunderBirdReminderView()
+ {
+ g_pThunderBirdReminderView = nullptr;
+ ClearAll();
+ }
+
+ ThunderBirdReminderView *ThunderBirdReminderView::GetInstance(void)
+ {
+ return g_pThunderBirdReminderView;
+ }
+
+ void ThunderBirdReminderView::ClearAll(void)
+ {
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
+ if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
+ if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
+ if (RemindIcon2 != nullptr) { delete RemindIcon2; RemindIcon2 = nullptr; }
+ }
+
+ UIViewGroup *ThunderBirdReminderView::ThunderBirdReminderViewInit(void)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdReminderView::group null!");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+
+ // 公共控件
+ TextLabel = new UILabelExt();
+ if (TextLabel)
+ {
+ TextLabel->SetVisible(false);
+ group->Add(TextLabel);
+ }
+ if(RemindLabel)
+ {
+ RemindLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ RemindLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindLabel->SetVisible(false);
+ group->Add(RemindLabel);
+ }
+ RemindButton = new UILabelButton();
+ if (RemindButton)
+ {
+ RemindButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff635d58, UIButton::RELEASED);
+ RemindButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff7c7773, UIButton::RELEASED);
+ RemindButton->SetStyleForState(STYLE_BORDER_WIDTH, 2, UIButton::RELEASED);
+ RemindButton->SetVisible(false);
+ group->Add(RemindButton);
+ }
+ RemindIcon = new UIImageView();
+ if (RemindIcon)
+ {
+ RemindIcon->SetAutoEnable(false);
+ RemindIcon->SetVisible(false);
+ group->Add(RemindIcon);
+ }
+ RemindIcon2 = new UIImageView();
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetAutoEnable(false);
+ RemindIcon2->SetVisible(false);
+ group->Add(RemindIcon2);
+ }
+ VolumeProgress = new UIBoxProgress();
+ if (VolumeProgress)
+ {
+ VolumeProgress->SetPosition(118, 132, 124, 4);
+ VolumeProgress->SetRange(100, 0);
+ VolumeProgress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0xff);
+ VolumeProgress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xffb4a9a0);
+ VolumeProgress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ VolumeProgress->SetForegroundStyle(STYLE_TEXT_COLOR, 0xff000000);
+ VolumeProgress->SetForegroundStyle(STYLE_LINE_COLOR, 0xff45A5FF);
+ group->Add(VolumeProgress);
+ }
+ return group;
+ }
+
+ void ThunderBirdReminderView::Show(int16_t showView)
+ {
+ if (group == nullptr) { return; }
+ if (TextLabel) { TextLabel->SetVisible(false); }
+ if (RemindLabel) { RemindLabel->SetVisible(false); }
+ if (RemindButton) { RemindButton->SetVisible(false); }
+ if (RemindIcon) { RemindIcon->SetVisible(false); RemindIcon->SetStyle(STYLE_BACKGROUND_OPA, 0x00);}
+ if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+ if (VolumeProgress) { VolumeProgress->SetVisible(false); }
+
+
+ switch (showView)
+ {
+ case THUNDERBIRD_REMINDERVIEW_VOLUME:
+ {
+ if (RemindButton)
+ {
+ RemindButton->SetPosition(102, 114, 156, 40);
+ RemindButton->SetText("");
+ RemindButton->SetVisible(true);
+ }
+ if (VolumeProgress)
+ {
+ VolumeProgress->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_TASK_REMINDER:
+ {
+ if (TextLabel)
+ {
+ TextLabel->SetPosition(99, 64, 261, 42);
+ TextLabel->SetText("11点了该睡觉了");
+ TextLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_LEFT);
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ TextLabel->SetRollSpeed(35);
+ TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TextLabel->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(57, 67, 36, 36);
+ RemindIcon->SetSrc("/user/res/notification.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if (RemindButton)
+ {
+ RemindButton->SetPosition(102, 114, 168, 40);
+ RemindButton->SetText("按 关闭通知");
+ RemindButton->SetLabelPosition(16, 6);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
+ }
+ if (RemindIcon2)
+ {
+ RemindIcon2->SetPosition(144, 122, 24, 24);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_NETWORK_DISCONNECT:
+ {
+ if (RemindButton)
+ {
+ RemindButton->SetPosition(99, 114, 185, 59);
+ RemindButton->SetText("网络已断开");
+ RemindButton->SetLabelPosition(69, 16);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(115, 120, 47, 47);
+ RemindIcon->SetSrc("/user/res/no_network.bin");
+ RemindIcon->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_LOW_BATTERY:
+ {
+ if (RemindButton)
+ {
+ RemindButton->SetPosition(103, 114, 185, 40);
+ RemindButton->SetLabelPosition(46, 6);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(103, 122, 23, 23);
+ RemindIcon->SetSrc("/user/res/no_network.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if(RemindLabel)
+ {
+ if (ThunderBirdMainView::GetInstance()->Batteryvalue <= 20 && ThunderBirdMainView::GetInstance()->Batteryvalue > 10)
+ {
+ RemindButton->SetText(" 电量不足20%");
+ }
+ else if (ThunderBirdMainView::GetInstance()->Batteryvalue <= 10 && ThunderBirdMainView::GetInstance()->Batteryvalue > 5)
+ {
+ RemindButton->SetText(" 电量不足10%");
+ }
+ else if (ThunderBirdMainView::GetInstance()->Batteryvalue <= 5)
+ {
+ RemindButton->SetText(" 电量不足5%");
+ }
+ }
+
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_CHARGING:
+ {
+ if (RemindButton)
+ {
+ RemindButton->SetPosition(119, 116, 121, 40);
+ RemindButton->SetText("充电中");
+ RemindButton->SetLabelPosition(46, 6);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(135, 124, 23, 23);
+ RemindIcon->SetSrc("/user/res/no_network.bin");
+ RemindIcon->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_CHARGE_COMPLETE:
+ {
+ if (RemindButton)
+ {
+ RemindButton->SetPosition(109, 116, 141, 40);
+ RemindButton->SetText("充电完成");
+ RemindButton->SetLabelPosition(46, 6);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
+ }
+ if (RemindIcon)
+ {
+ RemindIcon->SetPosition(125, 124, 23, 23);
+ RemindIcon->SetSrc("/user/res/no_network.bin");
+ RemindIcon->SetVisible(true);
+ }
+
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_DIALOGUE_NOT_ENOUGH:
+ {
+ ThunderBirdMainView::GetInstance()->OpenBackGround();
+ if(TextLabel)
+ {
+ TextLabel->SetPosition(57, 69, 246, 84);
+ TextLabel->SetText("对话额度不足20轮可扫码续充");
+ TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ TextLabel->SetVisible(true);
+ }
+ if(RemindIcon)
+ {
+ RemindIcon->SetPosition(133, 169, 94, 94);
+ RemindIcon->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ RemindIcon->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ //RemindIcon->SetSrc("/user/res/volume_up.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if(RemindLabel)
+ {
+ RemindLabel->SetPosition(132, 296, 96, 28);
+ RemindLabel->SetText("按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if(RemindIcon2)
+ {
+ RemindIcon2->SetPosition(158, 298, 24, 24);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_DIALOGUE_USE_UP:
+ {
+ ThunderBirdMainView::GetInstance()->OpenBackGround();
+ if(TextLabel)
+ {
+ TextLabel->SetPosition(47, 64, 266, 84);
+ TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ TextLabel->SetText("啊哦,对话轮数已用完,扫码续上吧");
+ TextLabel->SetVisible(true);
+ }
+ if(RemindIcon)
+ {
+ RemindIcon->SetPosition(133, 169, 94, 94);
+ RemindIcon->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ RemindIcon->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ //RemindIcon->SetSrc("/user/res/volume_up.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if(RemindLabel)
+ {
+ RemindLabel->SetPosition(132, 296, 96, 28);
+ RemindLabel->SetText("按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if(RemindIcon2)
+ {
+ RemindIcon2->SetPosition(158, 298, 24, 24);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_FLOW_NOT_ENOUGH:
+ {
+ ThunderBirdMainView::GetInstance()->OpenBackGround();
+ if(TextLabel)
+ {
+ TextLabel->SetPosition(47, 64, 266, 84);
+ TextLabel->SetText("流量不足100M了哦扫码可重置流量");
+ TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+ TextLabel->SetVisible(true);
+ }
+ if(RemindIcon)
+ {
+ RemindIcon->SetPosition(133, 169, 94, 94);
+ RemindIcon->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ RemindIcon->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ //RemindIcon->SetSrc("/user/res/volume_up.bin");
+ RemindIcon->SetVisible(true);
+ }
+ if(RemindLabel)
+ {
+ RemindLabel->SetPosition(132, 296, 96, 28);
+ RemindLabel->SetText("按 确认");
+ RemindLabel->SetVisible(true);
+ }
+ if(RemindIcon2)
+ {
+ RemindIcon2->SetPosition(158, 298, 24, 24);
+ RemindIcon2->SetSrc("/user/res/volume_up.bin");
+ RemindIcon2->SetVisible(true);
+ }
+ break;
+ }
+ case THUNDERBIRD_REMINDERVIEW_FLOW_USE_UP:
+ {
+ if(TextLabel)
+ {
+ TextLabel->SetPosition(91, 64, 180, 42);
+ TextLabel->SetText("流量用完了哦");
+ TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ TextLabel->SetVisible(true);
+ }
+ if (RemindButton)
+ {
+ RemindButton->SetPosition(64, 114, 232, 40);
+ RemindButton->SetText("可在小程序上续费使用");
+ RemindButton->SetLabelPosition(46, 6);
+ RemindButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
+ RemindButton->SetVisible(true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ void ThunderBirdReminderView::HideAll()
+ {
+ if (group == nullptr) { return; }
+ if (RemindButton) { RemindButton->SetVisible(false); }
+ if (TextLabel) { TextLabel->SetVisible(false); }
+ if (RemindLabel) { RemindLabel->SetVisible(false); }
+ if (RemindIcon) { RemindIcon->SetVisible(false); }
+ if (RemindIcon2) { RemindIcon2->SetVisible(false); }
+ if (VolumeProgress) { VolumeProgress->SetVisible(false); }
+ group->Invalidate();
+ }
+
+ void ThunderBirdReminderView::SetRemindProgress(int16_t value)
+ {
+ if (VolumeProgress == nullptr)
+ {
+ return;
+ }
+ if (value < 0) { value = 0; }
+ if (value > 100) { value = 100; }
+ remindProgressValue_ = value;
+ VolumeProgress->SetValue(remindProgressValue_);
+ VolumeProgress->Invalidate();
+ }
+
+ void ThunderBirdReminderView::AdjustRemindProgress(int16_t delta)
+ {
+ if (VolumeProgress == nullptr)
+ {
+ return;
+ }
+ int16_t newVal = remindProgressValue_ + delta;
+ SetRemindProgress(newVal);
+ // 若当前处于音量界面,确保控件可见
+ if (RemindButton) { RemindButton->SetVisible(true); }
+ }
+
+}
+
+
--- /dev/null
+#include "thunderbird/include/ThunderBirdShutdownTestView.h"
+//#include "uicomponents/UIComponents.h"
+#include "wearable_log.h"
+#include "custom_utils.h"
+#include "thunderbird/include/ThunderBirdMainView.h"
+#include "UiConfig.h"
+
+namespace OHOS
+{
+ static ThunderBirdShutdownTestView *g_tbShutdownTestView{nullptr};
+ static const char *TB_NAUGHTY_PATHS[TB_SHUTDOWN_ANIM_FRAMES_TEST] = {
+ TB_NAUGHTY_IMAGE_1, TB_NAUGHTY_IMAGE_2, TB_NAUGHTY_IMAGE_3, TB_NAUGHTY_IMAGE_4, TB_NAUGHTY_IMAGE_5,
+ TB_NAUGHTY_IMAGE_6, TB_NAUGHTY_IMAGE_7, TB_NAUGHTY_IMAGE_8, TB_NAUGHTY_IMAGE_9, TB_NAUGHTY_IMAGE_10,
+ TB_NAUGHTY_IMAGE_11, TB_NAUGHTY_IMAGE_12, TB_NAUGHTY_IMAGE_13, TB_NAUGHTY_IMAGE_14, TB_NAUGHTY_IMAGE_15,
+ TB_NAUGHTY_IMAGE_16, TB_NAUGHTY_IMAGE_17, TB_NAUGHTY_IMAGE_18, TB_NAUGHTY_IMAGE_19, TB_NAUGHTY_IMAGE_20,
+ TB_NAUGHTY_IMAGE_21, TB_NAUGHTY_IMAGE_22, TB_NAUGHTY_IMAGE_23, TB_NAUGHTY_IMAGE_24, TB_NAUGHTY_IMAGE_25,
+ TB_NAUGHTY_IMAGE_26, TB_NAUGHTY_IMAGE_27, TB_NAUGHTY_IMAGE_28, TB_NAUGHTY_IMAGE_29, TB_NAUGHTY_IMAGE_30,
+ TB_NAUGHTY_IMAGE_31, TB_NAUGHTY_IMAGE_32, TB_NAUGHTY_IMAGE_33, TB_NAUGHTY_IMAGE_34, TB_NAUGHTY_IMAGE_35,
+ TB_NAUGHTY_IMAGE_36, TB_NAUGHTY_IMAGE_37, TB_NAUGHTY_IMAGE_38, TB_NAUGHTY_IMAGE_39, TB_NAUGHTY_IMAGE_40,
+ TB_NAUGHTY_IMAGE_41, TB_NAUGHTY_IMAGE_42, TB_NAUGHTY_IMAGE_43, TB_NAUGHTY_IMAGE_44, TB_NAUGHTY_IMAGE_45,
+ TB_NAUGHTY_IMAGE_46, TB_NAUGHTY_IMAGE_47, TB_NAUGHTY_IMAGE_48, TB_NAUGHTY_IMAGE_49, TB_NAUGHTY_IMAGE_50,
+ TB_NAUGHTY_IMAGE_51, TB_NAUGHTY_IMAGE_52, TB_NAUGHTY_IMAGE_53, TB_NAUGHTY_IMAGE_54, TB_NAUGHTY_IMAGE_55,
+ TB_NAUGHTY_IMAGE_56, TB_NAUGHTY_IMAGE_57, TB_NAUGHTY_IMAGE_58, TB_NAUGHTY_IMAGE_59, TB_NAUGHTY_IMAGE_60,
+ TB_NAUGHTY_IMAGE_61, TB_NAUGHTY_IMAGE_62, TB_NAUGHTY_IMAGE_63, TB_NAUGHTY_IMAGE_64, TB_NAUGHTY_IMAGE_65,
+ TB_NAUGHTY_IMAGE_66, TB_NAUGHTY_IMAGE_67, TB_NAUGHTY_IMAGE_68, TB_NAUGHTY_IMAGE_69, TB_NAUGHTY_IMAGE_70,
+ TB_NAUGHTY_IMAGE_71, TB_NAUGHTY_IMAGE_72, TB_NAUGHTY_IMAGE_73, TB_NAUGHTY_IMAGE_74, TB_NAUGHTY_IMAGE_75,
+ TB_NAUGHTY_IMAGE_76, TB_NAUGHTY_IMAGE_77, TB_NAUGHTY_IMAGE_78, TB_NAUGHTY_IMAGE_79, TB_NAUGHTY_IMAGE_80,
+ TB_NAUGHTY_IMAGE_81, TB_NAUGHTY_IMAGE_82, TB_NAUGHTY_IMAGE_83, TB_NAUGHTY_IMAGE_84, TB_NAUGHTY_IMAGE_85,
+ TB_NAUGHTY_IMAGE_86,
+ };
+ ThunderBirdShutdownTestView::ThunderBirdShutdownTestView()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownTestView::ThunderBirdShutdownTestView");
+ if (ThunderBirdMainView::GetInstance())
+ {
+ // ThunderBirdMainView::GetInstance()->CloseVideo();
+ ThunderBirdMainView::GetInstance()->videoPlay_->StopVideoPlay();
+ }
+ g_tbShutdownTestView = this;
+ }
+
+ ThunderBirdShutdownTestView::~ThunderBirdShutdownTestView()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownTestView::~ThunderBirdShutdownTestView");
+ ClearAll();
+ g_tbShutdownTestView = nullptr;
+ }
+ ThunderBirdShutdownTestView *ThunderBirdShutdownTestView::GetInstance()
+ {
+ return g_tbShutdownTestView;
+ }
+
+ void ThunderBirdShutdownTestView::ClearAll()
+ {
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ if (animator != nullptr)
+ {
+ delete animator;
+ animator = nullptr;
+ }
+ //FreeImagePathsArray(pathsArray, TB_SHUTDOWN_ANIM_FRAMES_TEST);
+ delete group;
+ group = nullptr;
+ }
+ }
+
+ bool ThunderBirdShutdownTestView::EnsureAnimator()
+ {
+ if (animator == nullptr)
+ {
+ pathsArray = TB_NAUGHTY_PATHS;
+ animator = new UIImageAnimatorView();
+ if (animator == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownTestView new UIImageAnimatorView fail");
+ return false;
+ }
+ animator->SetAutoEnable(false);
+ for (uint8_t i = 0; i < TB_SHUTDOWN_ANIM_FRAMES_TEST; i++)
+ {
+ imageInfos[i].imagePath = (pathsArray[i]);
+ imageInfos[i].imageType = IMG_SRC_FILE_PATH;
+ imageInfos[i].pos.x = TB_SHUTDOWN_ANIM_X_TEST;
+ imageInfos[i].pos.y = TB_SHUTDOWN_ANIM_Y_TEST;
+ imageInfos[i].width = TB_SHUTDOWN_ANIM_W_TEST;
+ imageInfos[i].height = TB_SHUTDOWN_ANIM_H_TEST;
+ }
+ animator->SetPosition(TB_SHUTDOWN_ANIM_X_TEST, TB_SHUTDOWN_ANIM_Y_TEST, TB_SHUTDOWN_ANIM_W_TEST, TB_SHUTDOWN_ANIM_H_TEST);
+ animator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ animator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ animator->SetImageAnimatorSrc(imageInfos, TB_SHUTDOWN_ANIM_FRAMES_TEST, TB_SHUTDOWN_ANIM_INTERVAL_TEST);
+ animator->SetRepeat(true);
+ animator->SetRepeatTimes(1);
+ animator->SetResizeMode(UIImageView::COVER);
+ //animator->SetAnimatorStopListener(this);
+ }
+ return true;
+ }
+
+ UIViewGroup *ThunderBirdShutdownTestView::Init()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownTestView::Init");
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownTestView group new fail");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+ if (!EnsureAnimator())
+ {
+ return nullptr;
+ }
+ group->Add(animator);
+ iconView = new UIImageView();
+ iconView->SetPosition(0, 0, 466, 466);
+ iconView->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ iconView->SetStyle(STYLE_BACKGROUND_OPA, 0x66);
+ iconView->SetVisible(false);
+ group->Add(iconView);
+ return group;
+ }
+
+ UIImageAnimatorView *ThunderBirdShutdownTestView::GetAnimator()
+ {
+ return animator;
+ }
+
+ void ThunderBirdShutdownTestView::StartAnimation()
+ {
+ if (!EnsureAnimator())
+ {
+ return;
+ }
+ animator->Start();
+ }
+
+ void ThunderBirdShutdownTestView::OnAnimatorStop(UIView &view)
+ {
+ UNUSED(view);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownTestView::OnAnimatorStop");
+ // No shutdown side effects in test view
+ }
+}
+
+
#include "thunderbird/include/ThunderBirdShutdownView.h"
-#include "uicomponents/UIComponents.h"
+//#include "uicomponents/UIComponents.h"
#include "wearable_log.h"
#include "custom_runtime.h"
#include "custom_utils.h"
-#include "uiservice/include/ui_service.h"
+//#include "uiservice/include/ui_service.h"
#include "vibrator_service.h"
#include "thunderbird/include/ThunderBirdMainView.h"
+#include "UiConfig.h"
namespace OHOS
{
static ThunderBirdShutdownView *g_tbShutdownView{nullptr};
+ static const char *TB_SHUTDOWN_PATHS[TB_SHUTDOWN_ANIM_FRAMES] = {
+ TB_SHUTDOWN_IMAGE_1, TB_SHUTDOWN_IMAGE_2, TB_SHUTDOWN_IMAGE_3, TB_SHUTDOWN_IMAGE_4, TB_SHUTDOWN_IMAGE_5,
+ TB_SHUTDOWN_IMAGE_6, TB_SHUTDOWN_IMAGE_7, TB_SHUTDOWN_IMAGE_8, TB_SHUTDOWN_IMAGE_9, TB_SHUTDOWN_IMAGE_10,
+ TB_SHUTDOWN_IMAGE_11, TB_SHUTDOWN_IMAGE_12, TB_SHUTDOWN_IMAGE_13, TB_SHUTDOWN_IMAGE_14, TB_SHUTDOWN_IMAGE_15,
+ TB_SHUTDOWN_IMAGE_16, TB_SHUTDOWN_IMAGE_17, TB_SHUTDOWN_IMAGE_18, TB_SHUTDOWN_IMAGE_19, TB_SHUTDOWN_IMAGE_20,
+ TB_SHUTDOWN_IMAGE_21, TB_SHUTDOWN_IMAGE_22, TB_SHUTDOWN_IMAGE_23, TB_SHUTDOWN_IMAGE_24, TB_SHUTDOWN_IMAGE_25,
+ TB_SHUTDOWN_IMAGE_26, TB_SHUTDOWN_IMAGE_27, TB_SHUTDOWN_IMAGE_28, TB_SHUTDOWN_IMAGE_29, TB_SHUTDOWN_IMAGE_30,
+ TB_SHUTDOWN_IMAGE_31, TB_SHUTDOWN_IMAGE_32, TB_SHUTDOWN_IMAGE_33, TB_SHUTDOWN_IMAGE_34, TB_SHUTDOWN_IMAGE_35,
+ TB_SHUTDOWN_IMAGE_36, TB_SHUTDOWN_IMAGE_37, TB_SHUTDOWN_IMAGE_38, TB_SHUTDOWN_IMAGE_39, TB_SHUTDOWN_IMAGE_40,
+ TB_SHUTDOWN_IMAGE_41, TB_SHUTDOWN_IMAGE_42, TB_SHUTDOWN_IMAGE_43, TB_SHUTDOWN_IMAGE_44, TB_SHUTDOWN_IMAGE_45,
+ TB_SHUTDOWN_IMAGE_46, TB_SHUTDOWN_IMAGE_47, TB_SHUTDOWN_IMAGE_48, TB_SHUTDOWN_IMAGE_49, TB_SHUTDOWN_IMAGE_50,
+ TB_SHUTDOWN_IMAGE_51, TB_SHUTDOWN_IMAGE_52, TB_SHUTDOWN_IMAGE_53, TB_SHUTDOWN_IMAGE_54, TB_SHUTDOWN_IMAGE_55,
+ TB_SHUTDOWN_IMAGE_56, TB_SHUTDOWN_IMAGE_57, TB_SHUTDOWN_IMAGE_58, TB_SHUTDOWN_IMAGE_59, TB_SHUTDOWN_IMAGE_60,
+ TB_SHUTDOWN_IMAGE_61, TB_SHUTDOWN_IMAGE_62, TB_SHUTDOWN_IMAGE_63, TB_SHUTDOWN_IMAGE_64, TB_SHUTDOWN_IMAGE_65,
+ TB_SHUTDOWN_IMAGE_66, TB_SHUTDOWN_IMAGE_67, TB_SHUTDOWN_IMAGE_68, TB_SHUTDOWN_IMAGE_69, TB_SHUTDOWN_IMAGE_70,
+ TB_SHUTDOWN_IMAGE_71, TB_SHUTDOWN_IMAGE_72, TB_SHUTDOWN_IMAGE_73, TB_SHUTDOWN_IMAGE_74, TB_SHUTDOWN_IMAGE_75,
+ TB_SHUTDOWN_IMAGE_76, TB_SHUTDOWN_IMAGE_77, TB_SHUTDOWN_IMAGE_78, TB_SHUTDOWN_IMAGE_79, TB_SHUTDOWN_IMAGE_80,
+ TB_SHUTDOWN_IMAGE_81, TB_SHUTDOWN_IMAGE_82, TB_SHUTDOWN_IMAGE_83, TB_SHUTDOWN_IMAGE_84, TB_SHUTDOWN_IMAGE_85,
+ TB_SHUTDOWN_IMAGE_86, TB_SHUTDOWN_IMAGE_87, TB_SHUTDOWN_IMAGE_88, TB_SHUTDOWN_IMAGE_89, TB_SHUTDOWN_IMAGE_90,
+ TB_SHUTDOWN_IMAGE_91, TB_SHUTDOWN_IMAGE_92, TB_SHUTDOWN_IMAGE_93, TB_SHUTDOWN_IMAGE_94, TB_SHUTDOWN_IMAGE_95,
+ };
ThunderBirdShutdownView::ThunderBirdShutdownView()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownView::ThunderBirdShutdownView");
g_tbShutdownView = this;
+ // 关机前释放 thunderbird 视频与相关资源
+ if (ThunderBirdMainView::GetInstance())
+ {
+ // ThunderBirdMainView::GetInstance()->CloseVideo();
+ ThunderBirdMainView::GetInstance()->videoPlay_->StopVideoPlay();
+ }
}
ThunderBirdShutdownView::~ThunderBirdShutdownView()
delete shutdownAnimator;
shutdownAnimator = nullptr;
}
- FreeImagePathsArray(shutdownPathsArray, TB_SHUTDOWN_ANIM_FRAMES);
+ //FreeImagePathsArray(shutdownPathsArray, TB_SHUTDOWN_ANIM_FRAMES);
delete group;
group = nullptr;
}
{
UNUSED(view);
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdShutdownView::OnAnimatorStop");
- // 关机前释放 thunderbird 视频与相关资源
- if (ThunderBirdMainView::GetInstance())
- {
- ThunderBirdMainView::GetInstance()->CloseVideo();
- }
shutdown_reboot_prejobs(SHUTDOWN_TYPE);
}
{
if (shutdownAnimator == nullptr)
{
- shutdownPathsArray = CreateImagePathsArray(TB_SHUTDOWN_ANIM_PATH, TB_SHUTDOWN_ANIM_FRAMES);
+ shutdownPathsArray = TB_SHUTDOWN_PATHS;
shutdownAnimator = new UIImageAnimatorView();
if (shutdownAnimator == nullptr)
{
shutdownAnimator->SetRepeat(false);
shutdownAnimator->SetRepeatTimes(1);
shutdownAnimator->SetResizeMode(UIImageView::COVER);
- shutdownAnimator->SetAnimatorStopListener(this);
+ //shutdownAnimator->SetAnimatorStopListener(this);
}
return true;
}
}
shutdownAnimator->Start();
uapi_dev_runtime_set_shutting_down_status(1);
- ScreenOffEnable(false);
+ //ScreenOffEnable(false);
uapi_set_screen_on_api();
custom_VibratorFunc_int(0);
}
#endif
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-static const uint32_t SECOND_TO_MILLISECOND = 1000;
-static const int32_t FULL_FREQUENCE = 60;
+ static const uint32_t SECOND_TO_MILLISECOND = 1000;
+ static const int32_t FULL_FREQUENCE = 60;
#if !defined(_WIN32)
-static rtc_handle_t g_rtcHandle = nullptr;
+ static rtc_handle_t g_rtcHandle = nullptr;
#endif
-static int32_t g_timeInterval = -1;
-static int32_t g_freq = 0;
-static bool g_initialized = false;
-bool g_isScreenOn = false;
-static bool g_showLogo = false;
-static OHOS::UIImageView* g_logo = nullptr;
-static OHOS::ImageInfo* g_imgInfo = nullptr;
-
-static bool g_showOtaLogo = false;
-static OHOS::UIImageView* g_ota_logo = nullptr;
-static OHOS::ImageInfo* g_ota_imgInfo = nullptr;
-
-static uint32_t *g_boot_animation_task_handle = NULL;
-
-static OHOS::UIViewGroup* group=nullptr;
-static OHOS::UIViewGroup* boot_group=nullptr;
-static OHOS::UIImageAnimatorView* ReBootImageAnimatorView=nullptr;
+ static int32_t g_timeInterval = -1;
+ static int32_t g_freq = 0;
+ static bool g_initialized = false;
+ bool g_isScreenOn = false;
+ static bool g_showLogo = false;
+ static OHOS::UIImageView *g_logo = nullptr;
+ static OHOS::ImageInfo *g_imgInfo = nullptr;
+
+ static bool g_showOtaLogo = false;
+ static OHOS::UIImageView *g_ota_logo = nullptr;
+ static OHOS::ImageInfo *g_ota_imgInfo = nullptr;
+
+ static uint32_t *g_boot_animation_task_handle = NULL;
+
+ static OHOS::UIViewGroup *group = nullptr;
+ static OHOS::UIViewGroup *boot_group = nullptr;
+ static OHOS::UIImageAnimatorView *ReBootImageAnimatorView = nullptr;
#ifdef CUSTOM_Z1
-static constexpr const char *ReBootPaths = "/user/res/RebootAndShutDown/ReBoot/"; //开机图片路径
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数
+ static constexpr const char *ReBootPaths = "/user/res/RebootAndShutDown/ReBoot/"; // 开机图片路径
+ static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数
#elif defined(BOARD_W9) || defined(BOARD_N9)
-static constexpr const char *ReBootPaths = "/user/res/RebootAndShutDown/ReBoot/"; //开机图片路径
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数
+static constexpr const char *ReBootPaths = "/user/res/RebootAndShutDown/ReBoot/"; // 开机图片路径
+static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30; // 图片帧数
+#elif defined(BOARD_LEINIAO)
+static constexpr const char *ReBootPaths = "/user/res/RebootAndShutDown/ReBoot/"; // 开机图片路径
+static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 57; // 图片帧数
#else
-static constexpr const char *ReBootPaths = "/user/res/RebootAndShutDown/ReBoot/"; //开机图片路径
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 36; // 图片帧数
+static constexpr const char *ReBootPaths = "/user/res/RebootAndShutDown/ReBoot/"; // 开机图片路径
+static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 36; // 图片帧数
#endif
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔
-static OHOS::ImageAnimatorInfo ReBootImageInfo[REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 开机图像的信息
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_X = 0;
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_Y = 0;
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_W = 466;
-static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_H = 466;
-const OHOS::ImageInfo **ReBootPathsArray{nullptr}; // 开机图片路径数组
-static OHOS::UIImageAnimatorView::AnimatorStopListener *bootStoplistener{nullptr};
-static bool boot_animation_flag = false;
-static app_task_definition_t taskcfg={0};
+ static constexpr int16_t REBOOT_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔
+ static OHOS::ImageAnimatorInfo ReBootImageInfo[REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 开机图像的信息
+ static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_X = 0;
+ static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_Y = 0;
+ static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_W = 466;
+ static constexpr int16_t REBOOT_IMAGE_ANIMATOR_VIEW_H = 466;
+ const OHOS::ImageInfo **ReBootPathsArray{nullptr}; // 开机图片路径数组
+ static OHOS::UIImageAnimatorView::AnimatorStopListener *bootStoplistener{nullptr};
+ static bool boot_animation_flag = false;
+ static app_task_definition_t taskcfg = {0};
#ifdef QSPI_DISPLAY
#define IMAGE_OPEN_LOGO_PATH "/user/res/OPEN_LOGO_QSPI.bin"
#else
-#ifdef SINGLE_USER_PARTITION
+#ifdef SINGLE_USER_PARTITION
#define IMAGE_OPEN_LOGO_PATH "/user/system/KUMI_LOGO.bin"
#define IMAGE_OTA_LOGO_PATH "/user/system/OTAUpdata.bin"
#else
#ifdef IMAGE_OPEN_LOGO_PATH
#undef IMAGE_OPEN_LOGO_PATH
#endif
-#ifdef SINGLE_USER_PARTITION
+#ifdef SINGLE_USER_PARTITION
#define IMAGE_OPEN_LOGO_PATH "/user/system/z1bootlogo.bin"
#else
#define IMAGE_OPEN_LOGO_PATH "/system/z1bootlogo.bin"
#ifdef IMAGE_OPEN_LOGO_PATH
#undef IMAGE_OPEN_LOGO_PATH
#endif
-#ifdef SINGLE_USER_PARTITION
+#ifdef SINGLE_USER_PARTITION
#define IMAGE_OPEN_LOGO_PATH "/user/system/N9_TEST_LOGO.bin"
#else
#define IMAGE_OPEN_LOGO_PATH "/system/N9_TEST_LOGO.bin"
#endif
#endif
-
-static void FreeImagePathsArray(const char **imagePaths, const int numImages)
-{
- for (int i = 0; i < numImages; i++)
+ static void FreeImagePathsArray(const char **imagePaths, const int numImages)
{
- delete imagePaths[i];
- imagePaths[i] = nullptr;
+ for (int i = 0; i < numImages; i++)
+ {
+ delete imagePaths[i];
+ imagePaths[i] = nullptr;
+ }
}
-}
-static void ClearAll(void)
-{
- if(group!=nullptr)
+ static void ClearAll(void)
{
- OHOS::RootView::GetInstance()->Remove(group);
- group->RemoveAll();
-
- if (ReBootImageAnimatorView != nullptr)
+ if (group != nullptr)
{
- delete ReBootImageAnimatorView;
- ReBootImageAnimatorView = nullptr;
- }
+ OHOS::RootView::GetInstance()->Remove(group);
+ group->RemoveAll();
- if(bootStoplistener!=nullptr)
- {
- delete bootStoplistener;
- bootStoplistener = nullptr;
- }
+ if (ReBootImageAnimatorView != nullptr)
+ {
+ delete ReBootImageAnimatorView;
+ ReBootImageAnimatorView = nullptr;
+ }
- // FreeImagePathsArray(ReBootPathsArray, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
- #ifdef SUPPORT_CUSTOM_UI_COMPONENT
- OHOS::FreeImageInfoArray(ReBootPathsArray, ReBootPaths, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
- #endif
+ if (bootStoplistener != nullptr)
+ {
+ delete bootStoplistener;
+ bootStoplistener = nullptr;
+ }
- delete group;
- group = nullptr;
- }
-}
+// FreeImagePathsArray(ReBootPathsArray, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+#ifdef SUPPORT_CUSTOM_UI_COMPONENT
+ OHOS::FreeImageInfoArray(ReBootPathsArray, ReBootPaths, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+#endif
-class BootAnimatorListener:public OHOS::UIImageAnimatorView::AnimatorStopListener
-{
-public:
-BootAnimatorListener(){}
-~BootAnimatorListener(){}
+ delete group;
+ group = nullptr;
+ }
+ }
-private:
- void OnAnimatorStop(OHOS::UIView &view)
+ class BootAnimatorListener : public OHOS::UIImageAnimatorView::AnimatorStopListener
{
- boot_animation_flag = true;
-
- ClearAll();
-
- //boot_group->SetVisible(false);
- OHOS::RootView::GetInstance()->Remove(boot_group);
- delete boot_group;
- boot_group = nullptr;
- }
+ public:
+ BootAnimatorListener() {}
+ ~BootAnimatorListener() {}
+
+ private:
+ void OnAnimatorStop(OHOS::UIView &view)
+ {
+ boot_animation_flag = true;
-};
+ ClearAll();
+ // boot_group->SetVisible(false);
+ OHOS::RootView::GetInstance()->Remove(boot_group);
+ delete boot_group;
+ boot_group = nullptr;
+ }
+ };
-static const char ** CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
-{
- const char **imagePaths = new const char *[numImages];
- char buffer[256];
- for (int i = 0; i < numImages; i++)
+ static const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
{
+ const char **imagePaths = new const char *[numImages];
+ char buffer[256];
+ for (int i = 0; i < numImages; i++)
+ {
#ifdef CUSTOM_Z1
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, numImages - i , fileExtension);
+ snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, numImages - i, fileExtension);
#else
- snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1 , fileExtension);
+ snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension);
#endif
- imagePaths[i] = strdup(buffer);
+ imagePaths[i] = strdup(buffer);
+ }
+ return imagePaths;
}
- return imagePaths;
-}
-bool ShowReBootAnimatorView()
-{
- #ifdef SUPPORT_CUSTOM_UI_COMPONENT
- ReBootPathsArray = OHOS::CreateImageInfoArray(ReBootPaths, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
- #endif
-
- if (ReBootImageAnimatorView == nullptr)
+ bool ShowReBootAnimatorView()
{
- ReBootImageAnimatorView = new OHOS::UIImageAnimatorView();
+#ifdef SUPPORT_CUSTOM_UI_COMPONENT
+ ReBootPathsArray = OHOS::CreateImageInfoArray(ReBootPaths, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+#endif
+
if (ReBootImageAnimatorView == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new ReBootImageAnimatorView fail");
- return false;
- }
+ ReBootImageAnimatorView = new OHOS::UIImageAnimatorView();
+ if (ReBootImageAnimatorView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new ReBootImageAnimatorView fail");
+ return false;
+ }
#if defined(BOARD_W9) || defined(BOARD_N9)
- for (int j = 0, i = REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES - 1;
- i > 0 && j < REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES;
- i--, j++)
- {
- ReBootImageInfo[j].imageInfo = ReBootPathsArray[i];
- ReBootImageInfo[j].imageType = OHOS::IMG_SRC_IMAGE_INFO;
- ReBootImageInfo[j].pos.x = REBOOT_IMAGE_ANIMATOR_VIEW_X;
- ReBootImageInfo[j].pos.y = REBOOT_IMAGE_ANIMATOR_VIEW_Y;
- ReBootImageInfo[j].width = REBOOT_IMAGE_ANIMATOR_VIEW_W;
- ReBootImageInfo[j].height = REBOOT_IMAGE_ANIMATOR_VIEW_H;
- }
+ for (int j = 0, i = REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES - 1;
+ i > 0 && j < REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES;
+ i--, j++)
+ {
+ ReBootImageInfo[j].imageInfo = ReBootPathsArray[i];
+ ReBootImageInfo[j].imageType = OHOS::IMG_SRC_IMAGE_INFO;
+ ReBootImageInfo[j].pos.x = REBOOT_IMAGE_ANIMATOR_VIEW_X;
+ ReBootImageInfo[j].pos.y = REBOOT_IMAGE_ANIMATOR_VIEW_Y;
+ ReBootImageInfo[j].width = REBOOT_IMAGE_ANIMATOR_VIEW_W;
+ ReBootImageInfo[j].height = REBOOT_IMAGE_ANIMATOR_VIEW_H;
+ }
#else
for (uint8_t i = 0; i < REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
{
ReBootImageInfo[i].height = REBOOT_IMAGE_ANIMATOR_VIEW_H;
}
#endif
- ReBootImageAnimatorView->SetPosition(REBOOT_IMAGE_ANIMATOR_VIEW_X, REBOOT_IMAGE_ANIMATOR_VIEW_Y, REBOOT_IMAGE_ANIMATOR_VIEW_W, REBOOT_IMAGE_ANIMATOR_VIEW_H);
- ReBootImageAnimatorView->SetStyle(OHOS::STYLE_BACKGROUND_COLOR, 0xffffffff);
- ReBootImageAnimatorView->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0xff);
- ReBootImageAnimatorView->SetImageAnimatorSrc(ReBootImageInfo, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, 100);
- ReBootImageAnimatorView->SetRepeat(false);
- ReBootImageAnimatorView->SetRepeatTimes(1);
-
- bootStoplistener = static_cast<OHOS::UIImageAnimatorView::AnimatorStopListener *>(new BootAnimatorListener());
- if (bootStoplistener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to Create bootStoplistener!!");
- return false;
+#if defined(BOARD_LEINIAO)
+ ReBootImageAnimatorView->SetAutoEnable(false);
+#endif
+ ReBootImageAnimatorView->SetPosition(REBOOT_IMAGE_ANIMATOR_VIEW_X, REBOOT_IMAGE_ANIMATOR_VIEW_Y, REBOOT_IMAGE_ANIMATOR_VIEW_W, REBOOT_IMAGE_ANIMATOR_VIEW_H);
+ ReBootImageAnimatorView->SetStyle(OHOS::STYLE_BACKGROUND_COLOR, 0xffffffff);
+ ReBootImageAnimatorView->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0xff);
+ ReBootImageAnimatorView->SetImageAnimatorSrc(ReBootImageInfo, REBOOT_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, 100);
+#if defined(BOARD_LEINIAO)
+ ReBootImageAnimatorView->SetResizeMode(OHOS::UIImageView::COVER);
+#endif
+ ReBootImageAnimatorView->SetRepeat(false);
+ ReBootImageAnimatorView->SetRepeatTimes(1);
+
+ bootStoplistener = static_cast<OHOS::UIImageAnimatorView::AnimatorStopListener *>(new BootAnimatorListener());
+ if (bootStoplistener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to Create bootStoplistener!!");
+ return false;
+ }
+ ReBootImageAnimatorView->SetAnimatorStopListener(bootStoplistener);
}
- ReBootImageAnimatorView->SetAnimatorStopListener(bootStoplistener);
- }
-
- return true;
-}
-
-OHOS::UIViewGroup* ReBootAnimatorViewInit(void)
-{
- bool ret;
- group = new OHOS::UIViewGroup();
- if (group == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP," group new fail");
- return nullptr;
+ return true;
}
- group->SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
- group->SetStyle(OHOS::STYLE_BACKGROUND_OPA, OHOS::OPA_OPAQUE);
- ret = ShowReBootAnimatorView();
- if (ret == false)
+ OHOS::UIViewGroup *ReBootAnimatorViewInit(void)
{
- return nullptr;
- }
+ bool ret;
+ group = new OHOS::UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " group new fail");
+ return nullptr;
+ }
+ group->SetPosition(0, 0, OHOS::HORIZONTAL_RESOLUTION, OHOS::VERTICAL_RESOLUTION);
+ group->SetStyle(OHOS::STYLE_BACKGROUND_OPA, OHOS::OPA_OPAQUE);
+ ret = ShowReBootAnimatorView();
- group->Add(ReBootImageAnimatorView);
- return group;
-}
+ if (ret == false)
+ {
+ return nullptr;
+ }
-static void UikitRTCCallBack(uintptr_t data)
-{
- (void)(data);
- if (!g_initialized || !g_isScreenOn) {
- GRAPHIC_LOGE("RTC should not be started when g_isScreenOn:%d g_initialized:%d", g_isScreenOn, g_initialized);
- return;
+ group->Add(ReBootImageAnimatorView);
+ return group;
}
+
+ static void UikitRTCCallBack(uintptr_t data)
+ {
+ (void)(data);
+ if (!g_initialized || !g_isScreenOn)
+ {
+ GRAPHIC_LOGE("RTC should not be started when g_isScreenOn:%d g_initialized:%d", g_isScreenOn, g_initialized);
+ return;
+ }
#if !defined(_WIN32)
- uapi_rtc_start(g_rtcHandle, g_timeInterval, UikitRTCCallBack, 0);
+ uapi_rtc_start(g_rtcHandle, g_timeInterval, UikitRTCCallBack, 0);
#endif
- GraphicService::GetInstance()->UpdateGraphicEvent();
-}
-
-void SetFrequenceInner(int freq)
-{
- if (!g_isScreenOn) {
- return;
+ GraphicService::GetInstance()->UpdateGraphicEvent();
}
- if (freq > FULL_FREQUENCE) {
- freq = FULL_FREQUENCE;
- }
+ void SetFrequenceInner(int freq)
+ {
+ if (!g_isScreenOn)
+ {
+ return;
+ }
- if ((g_freq != freq) && (freq != 0)) {
- g_freq = freq;
- g_timeInterval = SECOND_TO_MILLISECOND / freq;
- GRAPHIC_LOGI("set freq: %d, time: %dms\n", freq, g_timeInterval);
- if (freq == FULL_FREQUENCE) {
- if (!OHOS::LowPowerManager::GetInstance()->IsLiteSurfaceInRootView()) {
- GraphicService::GetInstance()->EnableAsyncMode(true);
- }
- } else {
- GraphicService::GetInstance()->EnableAsyncMode(false);
+ if (freq > FULL_FREQUENCE)
+ {
+ freq = FULL_FREQUENCE;
}
+
+ if ((g_freq != freq) && (freq != 0))
+ {
+ g_freq = freq;
+ g_timeInterval = SECOND_TO_MILLISECOND / freq;
+ GRAPHIC_LOGI("set freq: %d, time: %dms\n", freq, g_timeInterval);
+ if (freq == FULL_FREQUENCE)
+ {
+ if (!OHOS::LowPowerManager::GetInstance()->IsLiteSurfaceInRootView())
+ {
+ GraphicService::GetInstance()->EnableAsyncMode(true);
+ }
+ }
+ else
+ {
+ GraphicService::GetInstance()->EnableAsyncMode(false);
+ }
#if !defined(_WIN32)
- uapi_rtc_start(g_rtcHandle, g_timeInterval, UikitRTCCallBack, 0);
+ uapi_rtc_start(g_rtcHandle, g_timeInterval, UikitRTCCallBack, 0);
#endif
+ }
}
-}
-int GetFrequence(void)
-{
- return g_freq;
-}
+ int GetFrequence(void)
+ {
+ return g_freq;
+ }
-int IsNativeRunning(void)
-{
- return GraphicService::GetInstance()->IsNativeRunning();
-}
+ int IsNativeRunning(void)
+ {
+ return GraphicService::GetInstance()->IsNativeRunning();
+ }
-void SetFrequence(int freq)
-{
- GraphicService::GetInstance()->PostGraphicEvent([=] {
- SetFrequenceInner(freq);
- });
-}
+ void SetFrequence(int freq)
+ {
+ GraphicService::GetInstance()->PostGraphicEvent([=]
+ { SetFrequenceInner(freq); });
+ }
-void NotifyScreenOn(void)
-{
- GraphicService::GetInstance()->NotifyScreenOn();
+ void NotifyScreenOn(void)
+ {
+ GraphicService::GetInstance()->NotifyScreenOn();
#if !defined(_WIN32)
- if (g_rtcHandle == nullptr) {
- return;
- }
+ if (g_rtcHandle == nullptr)
+ {
+ return;
+ }
#endif
- if (!g_isScreenOn) {
- g_isScreenOn = true;
- OHOS::LowPowerManager::GetInstance()->ExitLowPower();
+ if (!g_isScreenOn)
+ {
+ g_isScreenOn = true;
+ OHOS::LowPowerManager::GetInstance()->ExitLowPower();
+ }
}
-}
-void NotifyScreenOff(void)
-{
+ void NotifyScreenOff(void)
+ {
#if !defined(_WIN32)
- if (g_rtcHandle != nullptr) {
- uapi_rtc_stop(g_rtcHandle);
- g_freq = 0;
- g_timeInterval = -1;
- }
+ if (g_rtcHandle != nullptr)
+ {
+ uapi_rtc_stop(g_rtcHandle);
+ g_freq = 0;
+ g_timeInterval = -1;
+ }
#endif
- g_isScreenOn = false;
- GraphicService::GetInstance()->NotifyScreenOff();
-}
-
-void InitGraphicService(void)
-{
- if (g_initialized) {
- return;
+ g_isScreenOn = false;
+ GraphicService::GetInstance()->NotifyScreenOff();
}
+ void InitGraphicService(void)
+ {
+ if (g_initialized)
+ {
+ return;
+ }
+
#if !defined(_WIN32)
- /* create RTC timer */
- uapi_rtc_create(RTC_0, &g_rtcHandle);
- if (g_rtcHandle == nullptr) {
- GRAPHIC_LOGE("create RTC timer fail!!");
- return;
- }
+ /* create RTC timer */
+ uapi_rtc_create(RTC_0, &g_rtcHandle);
+ if (g_rtcHandle == nullptr)
+ {
+ GRAPHIC_LOGE("create RTC timer fail!!");
+ return;
+ }
#endif
- if (!GraphicService::GetInstance()->InitGraphicService()) {
- GRAPHIC_LOGE("InitGraphicService fail!!");
+ if (!GraphicService::GetInstance()->InitGraphicService())
+ {
+ GRAPHIC_LOGE("InitGraphicService fail!!");
#if !defined(_WIN32)
- uapi_rtc_stop(g_rtcHandle);
- uapi_rtc_delete(g_rtcHandle);
+ uapi_rtc_stop(g_rtcHandle);
+ uapi_rtc_delete(g_rtcHandle);
#endif
- return;
+ return;
+ }
+ g_initialized = true;
}
- g_initialized = true;
-}
-void HideGraphicLogo()
-{
- if (!g_showLogo) {
+ void HideGraphicLogo()
+ {
+ if (!g_showLogo)
+ {
return;
}
- g_showLogo = false;
- GraphicService::GetInstance()->PostGraphicEvent(
- [] {
- if (g_logo != nullptr) {
+ g_showLogo = false;
+ GraphicService::GetInstance()->PostGraphicEvent(
+ []
+ {
+ if (g_logo != nullptr)
+ {
OHOS::RootView::GetInstance()->Remove(g_logo);
delete g_logo;
g_logo = nullptr;
OHOS::ImageCacheManager::GetInstance().UnloadSingleRes(IMAGE_OPEN_LOGO_PATH);
g_imgInfo = nullptr;
}
- });
-}
-
-void HideGraphicOtaLogo()
-{
- if (!g_showOtaLogo) {
- return;
+ });
}
- g_showOtaLogo = false;
- GraphicService::GetInstance()->PostGraphicEvent(
- [] {
- if (g_ota_logo != nullptr) {
- OHOS::RootView::GetInstance()->Remove(g_ota_logo);
- delete g_ota_logo;
- g_ota_logo = nullptr;
- OHOS::ImageCacheManager::GetInstance().UnloadSingleRes(IMAGE_OTA_LOGO_PATH);
- g_ota_imgInfo = nullptr;
- }
- });
-}
-
-static void boot_animation_task(void *arg)
-{
- unused(arg);
- boot_group = ReBootAnimatorViewInit();
- if (boot_group == nullptr)
+ void HideGraphicOtaLogo()
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP," boot_group nullptr fail");
- return;
+ if (!g_showOtaLogo)
+ {
+ return;
+ }
+ g_showOtaLogo = false;
+ GraphicService::GetInstance()->PostGraphicEvent(
+ []
+ {
+ if (g_ota_logo != nullptr)
+ {
+ OHOS::RootView::GetInstance()->Remove(g_ota_logo);
+ delete g_ota_logo;
+ g_ota_logo = nullptr;
+ OHOS::ImageCacheManager::GetInstance().UnloadSingleRes(IMAGE_OTA_LOGO_PATH);
+ g_ota_imgInfo = nullptr;
+ }
+ });
}
- HideGraphicLogo();
- HideGraphicOtaLogo();
- OHOS::GraphicEventHandler::GetInstance()->PostGraphicEvent(
- [] {
- OHOS::RootView::GetInstance()->Add(boot_group);
- ReBootImageAnimatorView->Start();
- },
- false);
-
-}
-
-void wait_animation_stop(void)
-{
- while(boot_animation_flag == false)
+
+ static void boot_animation_task(void *arg)
{
- LOS_Msleep(1000);
+ unused(arg);
+
+ boot_group = ReBootAnimatorViewInit();
+ if (boot_group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " boot_group nullptr fail");
+ return;
+ }
+ HideGraphicLogo();
+ HideGraphicOtaLogo();
+ OHOS::GraphicEventHandler::GetInstance()->PostGraphicEvent(
+ []
+ {
+ OHOS::RootView::GetInstance()->Add(boot_group);
+ ReBootImageAnimatorView->Start();
+ },
+ false);
}
-}
-void ShowGraphicLogo(void)
-{
- if (g_showLogo) {
- return;
+ void wait_animation_stop(void)
+ {
+ while (boot_animation_flag == false)
+ {
+ LOS_Msleep(1000);
+ }
}
- g_showLogo = true;
- g_logo = new OHOS::UIImageView();
- g_logo->SetPosition(0, 0, OHOS::Screen::GetInstance().GetWidth(), OHOS::Screen::GetInstance().GetHeight());
- g_logo->SetAutoEnable(false);
- g_logo->SetResizeMode(OHOS::UIImageView::CENTER);
- g_imgInfo = OHOS::ImageCacheManager::GetInstance().LoadSingleRes(IMAGE_OPEN_LOGO_PATH);
- g_logo->SetSrc(g_imgInfo);
- GraphicService::GetInstance()->PostGraphicEvent(
- [] {
- OHOS::RootView::GetInstance()->Add(g_logo);
- OHOS::RootView::GetInstance()->Invalidate();
- });
- LOS_Msleep(500);
-}
-
-void ShowGraphicOTALogo(void)
-{
- if (g_showOtaLogo) {
- return;
+ void ShowGraphicLogo(void)
+ {
+ if (g_showLogo)
+ {
+ return;
+ }
+ g_showLogo = true;
+ g_logo = new OHOS::UIImageView();
+ g_logo->SetPosition(0, 0, OHOS::Screen::GetInstance().GetWidth(), OHOS::Screen::GetInstance().GetHeight());
+ g_logo->SetAutoEnable(false);
+ g_logo->SetResizeMode(OHOS::UIImageView::CENTER);
+ g_imgInfo = OHOS::ImageCacheManager::GetInstance().LoadSingleRes(IMAGE_OPEN_LOGO_PATH);
+ g_logo->SetSrc(g_imgInfo);
+ GraphicService::GetInstance()->PostGraphicEvent(
+ []
+ {
+ OHOS::RootView::GetInstance()->Add(g_logo);
+ OHOS::RootView::GetInstance()->Invalidate();
+ });
+ LOS_Msleep(500);
}
- g_showOtaLogo = true;
- g_ota_logo = new OHOS::UIImageView();
- g_ota_logo->SetPosition(0, 0, OHOS::Screen::GetInstance().GetWidth(), OHOS::Screen::GetInstance().GetHeight());
- g_ota_logo->SetAutoEnable(false);
- g_ota_logo->SetResizeMode(OHOS::UIImageView::CENTER);
- g_ota_imgInfo = OHOS::ImageCacheManager::GetInstance().LoadSingleRes(IMAGE_OTA_LOGO_PATH);
- g_ota_logo->SetSrc(g_ota_imgInfo);
- GraphicService::GetInstance()->PostGraphicEvent(
- [] {
- OHOS::RootView::GetInstance()->Add(g_ota_logo);
- OHOS::RootView::GetInstance()->Invalidate();
- });
- LOS_Msleep(500);
-
-}
-
-void boot_animation_init_deinit(void)
-{
- errcode_t ret = uapi_terminate_thread(taskcfg.task_handle);
- if(ret != ERRCODE_SUCC)
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"kill boot_animation_task failed %d!",ret);
- else
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"kill boot_animation_task succed !");
+ void ShowGraphicOTALogo(void)
+ {
+
+ if (g_showOtaLogo)
+ {
+ return;
+ }
+ g_showOtaLogo = true;
+ g_ota_logo = new OHOS::UIImageView();
+ g_ota_logo->SetPosition(0, 0, OHOS::Screen::GetInstance().GetWidth(), OHOS::Screen::GetInstance().GetHeight());
+ g_ota_logo->SetAutoEnable(false);
+ g_ota_logo->SetResizeMode(OHOS::UIImageView::CENTER);
+ g_ota_imgInfo = OHOS::ImageCacheManager::GetInstance().LoadSingleRes(IMAGE_OTA_LOGO_PATH);
+ g_ota_logo->SetSrc(g_ota_imgInfo);
+ GraphicService::GetInstance()->PostGraphicEvent(
+ []
+ {
+ OHOS::RootView::GetInstance()->Add(g_ota_logo);
+ OHOS::RootView::GetInstance()->Invalidate();
+ });
+ LOS_Msleep(500);
+ }
- if(taskcfg.attr.stack_mem != NULL)
+ void boot_animation_init_deinit(void)
{
- free(taskcfg.attr.stack_mem);
- taskcfg.attr.stack_mem = NULL;
+ errcode_t ret = uapi_terminate_thread(taskcfg.task_handle);
+
+ if (ret != ERRCODE_SUCC)
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "kill boot_animation_task failed %d!", ret);
+ else
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "kill boot_animation_task succed !");
+
+ if (taskcfg.attr.stack_mem != NULL)
+ {
+ free(taskcfg.attr.stack_mem);
+ taskcfg.attr.stack_mem = NULL;
+ }
+ if (taskcfg.task_handle != NULL)
+ taskcfg.task_handle = NULL;
}
- if(taskcfg.task_handle != NULL)
- taskcfg.task_handle = NULL;
-}
-void boot_animation_init(void)
-{
- taskcfg.task_handle = g_boot_animation_task_handle;
- taskcfg.attr.name="boot_animation_service";
- taskcfg.attr.priority = TASK_PRIORITY_APP;
- taskcfg.attr.stack_size = 0x1000;
- taskcfg.func = boot_animation_task;
- taskcfg.use_mem = USE_EXTEND_MEM;
-
- errcode_t ret=uapi_create_osThread_custom(&taskcfg);
- if(ret != ERRCODE_SUCC)
+ void boot_animation_init(void)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"create boot_animation_task failed %d!",ret);
- return ;
+ taskcfg.task_handle = g_boot_animation_task_handle;
+ taskcfg.attr.name = "boot_animation_service";
+ taskcfg.attr.priority = TASK_PRIORITY_APP;
+ taskcfg.attr.stack_size = 0x1000;
+ taskcfg.func = boot_animation_task;
+ taskcfg.use_mem = USE_EXTEND_MEM;
+
+ errcode_t ret = uapi_create_osThread_custom(&taskcfg);
+ if (ret != ERRCODE_SUCC)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "create boot_animation_task failed %d!", ret);
+ return;
+ }
}
-}
-void PostGraphicEvent(GraphicEventCb eventCb, void* userData)
-{
- GraphicService::GetInstance()->PostGraphicEvent(
- [=] {
- eventCb(userData);
+ void PostGraphicEvent(GraphicEventCb eventCb, void *userData)
+ {
+ GraphicService::GetInstance()->PostGraphicEvent(
+ [=]
+ {
+ eventCb(userData);
});
-}
+ }
#ifdef __cplusplus
};
#endif