VIEW_TRAINING,
VIEW_EMPTY,
VIEW_THUNDER_BIRD,
+ VIEW_LCD_TEST,
#ifdef SUPPORT_ALIPAY_SEC
VIEW_MAIN_ALIPAY,
#endif
--- /dev/null
+#ifndef LCD_TEST_PRESENTER_H
+#define LCD_TEST_PRESENTER_H
+
+#include "Presenter.h"
+#include "View.h"
+#include "drag_event.h"
+
+namespace OHOS {
+class LcdTestView;
+class LcdTestPresenter : public Presenter<LcdTestView> {
+public:
+ LcdTestPresenter();
+ ~LcdTestPresenter() override;
+ static LcdTestPresenter* GetInstance();
+
+private:
+ static LcdTestPresenter* self_;
+};
+} // namespace OHOS
+#endif
+
+
--- /dev/null
+#ifndef LCD_TEST_VIEW_H
+#define LCD_TEST_VIEW_H
+
+#include "lcdtest/LcdTestPresenter.h"
+#include "View.h"
+#include "components/ui_view_group.h"
+#include "components/ui_image_view.h"
+#include "cmsis_os2.h"
+
+namespace OHOS {
+class LcdTestView : public View<LcdTestPresenter> {
+public:
+ LcdTestView();
+ ~LcdTestView() override;
+ static LcdTestView* GetInstance();
+
+ void OnStart() override;
+ UIViewGroup* InitShowUpView();
+ void StartAnimation();
+ void SetLCDColor(int color);
+
+private:
+ void ClearAll();
+
+private:
+ UIViewGroup* group{nullptr};
+ UIImageView* overlay{nullptr};
+ osTimerId_t timer_{NULL};
+ uint8_t colorIndex_{0};
+ static LcdTestView* self_;
+};
+} // namespace OHOS
+#endif
+
+
+
--- /dev/null
+#include "lcdtest/LcdTestPresenter.h"
+#include "lcdtest/LcdTestView.h"
+#include "NativeAbility.h"
+#include "AppViewIDs.h"
+#include "NativeRegisterManager.h"
+#include "wearable_log.h"
+#include "drag_event.h"
+
+namespace OHOS {
+REGIST_SLICE(VIEW_LCD_TEST, LcdTestView, LcdTestPresenter);
+
+LcdTestPresenter* LcdTestPresenter::self_{nullptr};
+
+LcdTestPresenter::LcdTestPresenter()
+{
+ self_ = this;
+}
+
+LcdTestPresenter::~LcdTestPresenter()
+{
+ self_ = nullptr;
+}
+
+LcdTestPresenter* LcdTestPresenter::GetInstance()
+{
+ return self_;
+}
+
+} // namespace OHOS
+
+
--- /dev/null
+#include "lcdtest/LcdTestView.h"
+#include "UiConfig.h"
+#include "components/root_view.h"
+#include "common/screen.h"
+#include "wearable_log.h"
+
+namespace OHOS {
+static void LcdTestTick(void* arg)
+{
+ LcdTestView* v = reinterpret_cast<LcdTestView*>(arg);
+ if (v != nullptr) {
+ v->SetLCDColor(-1);
+ }
+}
+
+LcdTestView* LcdTestView::self_{nullptr};
+
+LcdTestView::LcdTestView()
+{
+ self_ = this;
+}
+
+LcdTestView::~LcdTestView()
+{
+ ClearAll();
+ self_ = nullptr;
+}
+
+LcdTestView* LcdTestView::GetInstance()
+{
+ return self_;
+}
+
+void LcdTestView::ClearAll()
+{
+ if (timer_ != NULL) {
+ osTimerStop(timer_);
+ osTimerDelete(timer_);
+ timer_ = NULL;
+ }
+ if (overlay != nullptr) {
+ if (group != nullptr) {
+ group->Remove(overlay);
+ }
+ delete overlay;
+ overlay = nullptr;
+ }
+ if (group != nullptr) {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+}
+
+UIViewGroup* LcdTestView::InitShowUpView()
+{
+ if (group != nullptr) {
+ return group;
+ }
+ group = new UIViewGroup();
+ if (group == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LcdTestView group new fail");
+ return nullptr;
+ }
+ group->SetPosition(0, 0);
+ group->SetWidth(HORIZONTAL_RESOLUTION);
+ group->SetHeight(VERTICAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+
+ overlay = new UIImageView();
+ if (overlay != nullptr) {
+ overlay->SetPosition(0, 0, group->GetWidth(), group->GetHeight());
+ overlay->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ overlay->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ overlay->SetVisible(true);
+ group->Add(overlay);
+ }
+ return group;
+}
+
+void LcdTestView::StartAnimation()
+{
+ if (timer_ == NULL) {
+ timer_ = osTimerNew((osTimerFunc_t)LcdTestTick, osTimerPeriodic, this, NULL);
+ }
+ colorIndex_ = 0;
+ if (timer_ != NULL) {
+ osTimerStart(timer_, 1000);
+ }
+}
+
+void LcdTestView::SetLCDColor(int color)
+{
+ if (group == nullptr) {
+ return;
+ }
+ if (color < 0) {
+ color = colorIndex_++;
+ }
+ switch (color % 6) {
+ case 0: group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); break;
+ case 1: group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); break;
+ case 2: group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Yellow().full); break;
+ case 3: group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); break;
+ case 4: group->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); break;
+ case 5: group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); break;
+ default: break;
+ }
+ RootView::GetInstance()->Invalidate();
+}
+
+void LcdTestView::OnStart()
+{
+ UIViewGroup* v = InitShowUpView();
+ if (v != nullptr) {
+ AddViewToRootContainer(v);
+ StartAnimation();
+ }
+}
+} // namespace OHOS
+
+
namespace OHOS {
-//REGIST_SLICE(VIEW_REBOOT, RebootView, RebootPresenter);
+REGIST_SLICE(VIEW_REBOOT, RebootView, RebootPresenter);
static RebootPresenter *g_pRebootPresenter = nullptr;
#include "components/ui_label_ext.h"
#include "components/ui_image_view.h"
#include "components/ui_label_button.h"
+#include "components/ui_qrcode.h"
namespace OHOS
{
UIViewGroup *group{nullptr};
UILabelExt *TextLabel{nullptr};
UILabelExt *TextLabel_Y{nullptr};
+ UIQrcode *qrcode_{nullptr};
UILabelButton *RemindButton{nullptr};
UILabelExt *RemindLabel{nullptr};
UIImageView *RemindGround{nullptr};
#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_; }
ThunderBirdReminderView *g_pThunderBirdReminderView{nullptr};
ThunderBirdAdjustView *g_pThunderBirdAdjustView{nullptr};
ThunderBirdShutdownView *g_pThunderBirdShutdownView{nullptr};
- ThunderBirdShutdownTestView *g_pThunderBirdShutdownTestView{nullptr};
#define SCREEN_WIDTH 360
#define SCREEN_HEIGHT 360
+++ /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 = 360;
- static constexpr int16_t TB_SHUTDOWN_ANIM_H_TEST = 360;
- 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
-
-
if (RemindButton != nullptr) { delete RemindButton; RemindButton = nullptr; }
if (TextLabel != nullptr) { delete TextLabel; TextLabel = nullptr; }
if (TextLabel_Y != nullptr) { delete TextLabel_Y; TextLabel_Y = nullptr; }
+ if (qrcode_ != nullptr) { delete qrcode_; qrcode_ = nullptr; }
if (RemindLabel != nullptr) { delete RemindLabel; RemindLabel = nullptr; }
if (RemindGround != nullptr) { delete RemindGround; RemindGround = nullptr; }
if (RemindIcon != nullptr) { delete RemindIcon; RemindIcon = nullptr; }
TextLabel->SetVisible(false);
group->Add(TextLabel);
}
+ qrcode_ = new UIQrcode();
+ if (qrcode_)
+ {
+ qrcode_->SetPosition(133, 169, 104, 104);
+ qrcode_->SetQrcodeInfo("https://example.com/device/bind?deviceId=DEVICE_001");
+ qrcode_->SetStyle(STYLE_PADDING_LEFT, 4);
+ qrcode_->SetStyle(STYLE_PADDING_RIGHT, 4);
+ qrcode_->SetStyle(STYLE_PADDING_TOP, 4);
+ qrcode_->SetStyle(STYLE_PADDING_BOTTOM, 4);
+ qrcode_->SetVisible(false);
+ group->Add(qrcode_);
+ }
RemindButton = new UILabelButton();
if (RemindButton)
if (group == nullptr) { return; }
if (TextLabel) { TextLabel->SetVisible(false);TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);}
if (TextLabel_Y) { TextLabel_Y->SetVisible(false); }
+ if (qrcode_) { qrcode_->SetVisible(false); }
if (RemindButton) { RemindButton->SetVisible(false); }
if (RemindLabel) { RemindLabel->SetVisible(false); }
if (RemindIcon) { RemindIcon->SetVisible(false); }
TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);//自动换行
TextLabel->SetVisible(true);
}
- if(RemindIcon2)
+ if (qrcode_)
{
- RemindIcon2->SetPosition(133, 169, 104, 104);
- RemindIcon->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
- RemindIcon2->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- //RemindIcon->SetSrc("/user/res/volume_up.bin");
- RemindIcon2->SetVisible(true);
+ qrcode_->SetVisible(true);
}
if(RemindIcon)
{
RemindIcon->SetPosition(158, 296, 30, 30);
- RemindIcon->SetSrc("/user/res/volumeup.bin");
+ RemindIcon->SetSrc("/user/res/volume_up.bin");
RemindIcon->SetVisible(true);
}
if (RemindButton)
RemindButton->SetVisible(true);
}
- // 黑色背景与二维码需要补充
break;
}
default:
{
TextLabel_Y->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
TextLabel_Y->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ TextLabel_Y->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
TextLabel_Y->SetVisible(false);
group->Add(TextLabel_Y);
}
//#include "MainPresenterSample.h"
#include "thunderbird/include/ThunderBirdMainView.h"
#include "thunderbird/include/ThunderBirdShutdownView.h"
-#include "thunderbird/include/ThunderBirdShutdownTestView.h"
#include "wearable_log.h"
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdMainView::ThunderBirdMainView");
g_pThunderBirdMainView = this;
- //ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 打开屏幕常亮
+ ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 打开屏幕常亮
ThunderBirdModel::GetInstance()->StartTimer();
}
ScrollView_ = nullptr;
}
g_pThunderBirdMainView = nullptr;
- //ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 关闭屏幕常亮
+ ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 关闭屏幕常亮
ThunderBirdModel::GetInstance()->StopTimer();
}
delete g_pThunderBirdShutdownView;
g_pThunderBirdShutdownView = nullptr;
}
- if (g_pThunderBirdShutdownTestView)
- {
- delete g_pThunderBirdShutdownTestView;
- g_pThunderBirdShutdownTestView = nullptr;
- }
if (g_pThunderBirdShutdownView)
{
delete g_pThunderBirdShutdownView;
ChangeView(MAXVIEW, THUNDERBIRD_GUIDEVIEW, 0); // 文字显示图层
//绑定设备提示 > 配置更新成功>OTA升级>其他(按触发时间先后提示)
/*************************用户是否绑定*************************/
- // ln_http_server_send_task(LN_HTTP_SERVICE_CMD_GET_USER_ID, nullptr, 0);//获取用户是否绑定
+ // do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_USER_ID, nullptr, 0);//获取用户是否绑定
// if(uapi_ln_get_user_bind_status() == 0)//未绑定
// {
// ChangeView(MAXVIEW, THUNDERBIRD_GUIDEVIEW, ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_1);
// }
// if(uapi_ln_get_user_bind_status() == 1)//已绑定
// {
- // ChangeView(MAXVIEW, THUNDERBIRD_GUIDEVIEW, ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_2);
+ // //ChangeView(MAXVIEW, THUNDERBIRD_GUIDEVIEW, ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_2);进入对话界面
// }
// /*************************更新角色配置*************************/
- // ln_http_server_send_task(LN_HTTP_SERVICE_CMD_GET_CHARACTER, nullptr, 0);//获取角色配置
+ // do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_CHARACTER, nullptr, 0);//获取角色配置
// /*************************OTA升级*************************/
- // ln_http_server_send_task(LN_HTTP_SERVICE_CMD_OTA_GET_TASK, nullptr, 0);//获取是否需要OTA升级
+ // do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_OTA_GET_TASK, nullptr, 0);//获取是否需要OTA升级
// if(uapi_ln_ota_get_update_type() == 1)//强制OTA升级
// {
// ChangeView(MAXVIEW, THUNDERBIRD_OTAVIEW, ThunderBirdOtaView::THUNDERBIRD_OTAVIEW_UPDATE_NOW);
// RootView::GetInstance()->SetOnKeyActListener(keyactListener);
}
}
+
bool ThunderBirdMainView::SwitchVideo(const char *uri) // 切换表情接口
{
}
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映射到对应的视图切换函数
{THUNDERBIRD_REMINDERVIEW, &ThunderBirdMainView::ChangeThunderBirdReminderView},
{THUNDERBIRD_ADJUSTVIEW, &ThunderBirdMainView::ChangeThunderBirdAdjustView},
{THUNDERBIRD_SHUTDOWNVIEW, &ThunderBirdMainView::ChangeThunderBirdShutdownView},
- {THUNDERBIRD_SHUTDOWNTESTVIEW, &ThunderBirdMainView::ChangeThunderBirdShutdownTestView},
};
bool ThunderBirdMainView::ClickFunc(int16_t interface)
#include <string.h>
namespace OHOS
{
+ enum OTA_STATUS
+ {
+ OTA_STATUS_LOW_BATTERY = 0,
+ OTA_STATUS_DOW,
+ OTA_STATUS_UPDATING,
+ OTA_STATUS_SUCCESS,
+ };
ThunderBirdModel::ThunderBirdModel() {}
ThunderBirdModel::~ThunderBirdModel() {}
}
}
+
+
/* ---------------------- 状态栏时间刷新定时器 ---------------------- */
static osTimerId_t g_timer = nullptr;
/*定时器到期时的处理*/
#include "samgr_lite.h"
#include "service_id_define.h"
#include "dock/input_device.h"
+#include "custom_runtime.h"
namespace OHOS
{
static int i=0;//版本临时变量
uint16_t keyID = event.GetKeyId();
uint16_t keyState = event.GetState();
+ // 刷新息屏计时:任意按键按下时重置屏幕熄灭倒计时
+ if (keyState == InputDevice::STATE_PRESS) {
+ uapi_set_screen_on_api();
+ }
+
// 长按关机键
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) &&
keyState == InputDevice::STATE_LONG_PRESS)
NativeAbility::GetInstance().SwitchSlice(VIEW_REBOOT);
return true;
}
+
+ // 长按 FUNC:进入 LCD 产测 slice
+ if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_FUNC) &&
+ keyState == InputDevice::STATE_LONG_PRESS &&
+ uapi_get_screen_state() == 0)
+ {
+ NativeAbility::GetInstance().SwitchSlice(VIEW_LCD_TEST);
+ return true;
+ }
/*************************power键*************************/
if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0)
{
int16_t currentView = ThunderBirdMainView::GetInstance()->GetCurrentView();
int16_t currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView();
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "currentView = %d, currentSubView = %d", currentView, currentSubView);
- i++;
- if(i == 1)
- {
- ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/Classic/blue.bin");
- }
- else if(i == 2)
- {
- ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/Classic/curly_hair.bin");
- }
- else if(i == 3)
- {
- ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/SidePartingShort/purple.bin");
- }
- else if(i == 4)
- {
- ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/Bangs/gold.bin");
- }
- else if(i == 5)
- {
- ThunderBirdMainView::GetInstance()->SwitchVideo("/user/video/Angry.mp4");
- }
+ // i++;
+ // if(i == 1)
+ // {
+ // ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/Classic/blue.bin");
+ // }
+ // else if(i == 2)
+ // {
+ // ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/Classic/curly_hair.bin");
+ // }
+ // else if(i == 3)
+ // {
+ // ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/SidePartingShort/purple.bin");
+ // }
+ // else if(i == 4)
+ // {
+ // ThunderBirdMainView::GetInstance()->SwitchHair("/user/res/hair/Bangs/gold.bin");
+ // }
return 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] = {
-
- };
- 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, 360, 360);
- if (!EnsureAnimator())
- {
- return nullptr;
- }
- group->Add(animator);
- iconView = new UIImageView();
- iconView->SetPosition(0, 0, 360, 360);
- 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
- }
-}
-
-