* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-18 14:25:53
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-31 09:48:48
+ * @LastEditTime: 2024-08-29 17:11:51
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h
*/
#ifndef REBOOT_AND_SHUTDOWN_VIEW_H
#include "components/ui_view_group.h"
#include "rebootandshutdown/include/ShutDownImageAnimatorView.h"
#include "rebootandshutdown/include/FactoryResetView.h"
+#define IS_SLIDER_TO_SHUTDOWN 0
namespace OHOS
{
typedef enum : uint8_t
{
- REBOOTANDSHUTDOWN = 0,
- SHUTDOWNANIMATOR, /*关机动画view*/
- FACTORYRESET, /*恢复出厂设置view*/
+ REBOOTANDSHUTDOWN = 0, // 关机和SOS(Slice)
+ SHUTDOWNANIMATOR, // 关机动画视图(subview)
+ SHUTDOWNTIPVIEW, // 关机提示视图(subview)
+ FACTORYRESET, // 恢复出厂设置视图(subview)
REBOOTANDSHUTDOWN_MAX,
} REBOOTANDSHUTDOWNVIEWID;
- static constexpr const char *SHUTDOWN_SLIDER_VIEWID = "shutdown_slider_viewid";
- static constexpr const char *REBOOT_SLIDER_VIEWID = "reboot_slider_viewid";
+ static constexpr const char *SHUTDOWN_BUTTON_VIEWID = "shutdown_button_viewid";
+ static constexpr const char *SOS_BUTTON_VIEWID = "sos_button_viewid";
static constexpr const char *FACTORYRESET_LABEL_VIEWID = "factoryreset_label_viewid";
static constexpr const char *REBOOT_AND_SHUTDOWN_GROUPVIEW = "reboot_and_shutdown_groupview";
RebootAndShutdownView();
~RebootAndShutdownView();
static RebootAndShutdownView *GetInstance(void);
- UISlider *GetShutdownSlider(void);
- UISlider *GetRebootSlider(void);
+ UIButton *GetButtonEnsure();
+ UIButton *GetButtonCancel();
+ UIScrollView *GetSystemShutdownScrollView(void);
bool ChangeToRebootAndShutdownView(int16_t thisView);
+ bool ChangeToShutdownTipView(int16_t thisView);
bool ChangeToShutDownAnimatorView(int16_t thisView);
bool ChangeToFactoryResetView(int16_t thisView);
void ChangeView(int16_t hideView, int16_t showView);
bool CreateRebootAndShutdownSlider(void);
bool CreateRebootAndShutdownScrollView(void);
bool CreateRebootAndShutdownGroupView(void);
+ bool CreateRebootAndShutdownButton(void);
void CreateRebootAndShutdownView(void);
void ClearAll(void);
UILabelExt *title{nullptr};
UILabelExt *factoryResetLabel{nullptr}; /*恢复出厂设置*/
+#if IS_SLIDER_TO_SHUTDOWN
/*关机*/
UILabelExt *shutdownLabel{nullptr};
UISlider *shutdownSlider{nullptr};
UILabelExt *rebootLabel{nullptr};
UISlider *rebootSlider{nullptr};
UIScrollView *rebootScrollView{nullptr};
-
+#else
+ // 关机
+ UILabelExt *shutdownLabel{nullptr};
+ UIButton *shutdownButton{nullptr};
+ /* -------------------------------------------------------------------------- */
+ UIScrollView *SystemShutdownScrollView = nullptr;
+ UILabelExt *shutdowntitle{nullptr};
+ UILabelExt *note{nullptr};
+ UIImageView *image = nullptr;
+ UIButton *button_ensure = nullptr;
+ UIButton *button_cancel = nullptr;
+ UIViewGroup *ShutdownViewInit(void);
+ void ClearAllShutdownView(void);
+ /* -------------------------------------------------------------------------- */
+
+ // SOS
+ UILabelExt *sosLabel{nullptr};
+ UIButton *sosButton{nullptr};
+#endif
bool viewInitStatus{false};
};
}
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-20 15:11:17
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-31 10:43:30
+ * @LastEditTime: 2024-08-29 17:39:15
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/RebootAndShutdownPresenter.cpp
*/
#include "AppViewIDs.h"
#include "rebootandshutdown/include/RebootAndShutdownPresenter.h"
#include "rebootandshutdown/include/RebootAndShutdownView.h"
#include "rebootandshutdown/include/RebootAndShutdownModel.h"
-
+#include "dial_sos_c.h"
namespace OHOS
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnClick");
if (strcmp(view.GetViewId(), FACTORYRESET_LABEL_VIEWID) == 0) // 进入出厂设置界面
{
- RebootAndShutdownView::GetInstance()->ChangeView(REBOOTANDSHUTDOWN, FACTORYRESET);
+ view_->ChangeView(REBOOTANDSHUTDOWN, FACTORYRESET);
return true;
}
else if (strcmp(view.GetViewId(), FACTORY_RESET_BUTTON_CHECK_ON) == 0) // 恢复出厂设置确认
}
else if (strcmp(view.GetViewId(), FACTORY_RESET_BUTTON_CHECK_OFF) == 0) // 恢复出厂设置取消
{
- RebootAndShutdownView::GetInstance()->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN);
+ view_->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN);
}
- else if (strcmp(view.GetViewId(), SHUTDOWN_SLIDER_VIEWID) == 0)
+ else if (strcmp(view.GetViewId(), SHUTDOWN_BUTTON_VIEWID) == 0) // 进入关机提示视图
{
- auto shutdownSlider = view_->GetShutdownSlider();
- if (shutdownSlider != nullptr)
- {
- shutdownSlider->SetValue(SLIDER_VALUE_MIN);
- }
+ view_->ChangeView(REBOOTANDSHUTDOWN, SHUTDOWNTIPVIEW);
}
- else if (strcmp(view.GetViewId(), REBOOT_SLIDER_VIEWID) == 0)
+ else if (&view == view_->GetButtonEnsure()) // 关机确认
{
- auto rebootSlider = view_->GetRebootSlider();
- if (rebootSlider != nullptr)
- {
- rebootSlider->SetValue(SLIDER_VALUE_MIN);
- }
+ view_->ChangeView(SHUTDOWNTIPVIEW, SHUTDOWNANIMATOR);
+ start_shutdown_or_reboot();
+ shutdown_reboot_prejobs();
+
+ ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(true);
+ isShutDownImageAnimatorStart = true;
+ }
+ else if (&view == view_->GetButtonCancel()) // 关机取消
+ {
+ view_->ChangeView(SHUTDOWNTIPVIEW, REBOOTANDSHUTDOWN);
}
+ else if (strcmp(view.GetViewId(), SOS_BUTTON_VIEWID) == 0)
+ {
+ start_SOS_phone_dail();
+ }
+
return true;
}
bool RebootAndShutdownPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnDragEnd");
- UISlider *slider = dynamic_cast<UISlider *>(&view);
- if (slider != nullptr)
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && RebootAndShutdownPresenter::X_DRAG_FLAG)
{
- if (slider == view_->GetRebootSlider() || slider == view_->GetShutdownSlider())
+ if (strcmp(view.GetViewId(), REBOOT_AND_SHUTDOWN_GROUPVIEW) == 0)
{
- return true;
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
- }
- else
- {
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && RebootAndShutdownPresenter::X_DRAG_FLAG)
+ else if (strcmp(view.GetViewId(), FACTORY_RESET_GROUPVIEW) == 0)
+ {
+ view_->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN);
+ }
+ else if (&view == view_->GetSystemShutdownScrollView())
{
- if (strcmp(view.GetViewId(), REBOOT_AND_SHUTDOWN_GROUPVIEW) == 0)
- {
- NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
- }
- else if (strcmp(view.GetViewId(), FACTORY_RESET_GROUPVIEW) == 0)
- {
- RebootAndShutdownView::GetInstance()->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN);
- }
- RebootAndShutdownPresenter::X_DRAG_FLAG = false;
- return true;
+ view_->ChangeView(SHUTDOWNTIPVIEW, REBOOTANDSHUTDOWN);
}
+ RebootAndShutdownPresenter::X_DRAG_FLAG = false;
+ return true;
}
return false;
}
void RebootAndShutdownPresenter::OnRelease(int32_t value)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnRelease,value = %d", value);
- auto shutdownSlider = view_->GetShutdownSlider();
- auto rebootSlider = view_->GetRebootSlider();
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnRelease,value = %d", value);
+ // auto shutdownSlider = view_->GetShutdownSlider();
+ // auto rebootSlider = view_->GetRebootSlider();
- handleSlider(shutdownSlider, true);
- handleSlider(rebootSlider, false);
+ // handleSlider(shutdownSlider, true);
+ // handleSlider(rebootSlider, false);
}
void RebootAndShutdownPresenter::handleSlider(UISlider *slider, bool isShutdown)
{
- if (!slider)
- {
- return;
- }
-
- if (slider->GetValue() < SLIDER_VALUE_MAX)
- {
- slider->SetValue(SLIDER_VALUE_MIN);
- }
- else
- {
- slider->SetValue(SLIDER_VALUE_MAX);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s!!", isShutdown ? "关机" : "重启");
- view_->ChangeView(REBOOTANDSHUTDOWN, SHUTDOWNANIMATOR);
- start_shutdown_or_reboot();
- shutdown_reboot_prejobs();
-
- if (ShutDownImageAnimatorView::GetInstance() != nullptr && ShutDownImageAnimatorView::GetInstance()->GeShutDownImageAnimatorView() != nullptr)
- {
- ShutDownImageAnimatorView::GetInstance()->GeShutDownImageAnimatorView()->Start();
- isShutDownImageAnimatorStart = true;
- }
- isShutDownOperation = isShutdown;
- }
+ // if (!slider)
+ // {
+ // return;
+ // }
+
+ // if (slider->GetValue() < SLIDER_VALUE_MAX)
+ // {
+ // slider->SetValue(SLIDER_VALUE_MIN);
+ // }
+ // else
+ // {
+ // slider->SetValue(SLIDER_VALUE_MAX);
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s!!", isShutdown ? "关机" : "重启");
+ // view_->ChangeView(REBOOTANDSHUTDOWN, SHUTDOWNANIMATOR);
+ // start_shutdown_or_reboot();
+ // shutdown_reboot_prejobs();
+
+ // if (ShutDownImageAnimatorView::GetInstance() != nullptr && ShutDownImageAnimatorView::GetInstance()->GeShutDownImageAnimatorView() != nullptr)
+ // {
+ // ShutDownImageAnimatorView::GetInstance()->GeShutDownImageAnimatorView()->Start();
+ // isShutDownImageAnimatorStart = true;
+ // }
+ // isShutDownOperation = isShutdown;
+ // }
}
bool RebootAndShutdownPresenter::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件
}
return true;
}
-
- bool RebootAndShutdownPresenter::GetIsShutDownImageAnimator(void)
- {
- return isShutDownImageAnimatorStart;
- }
}
\ No newline at end of file
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-07-18 14:26:08
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-31 10:08:26
+ * @LastEditTime: 2024-08-29 17:14:57
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp
*/
return g_pRebootAndShutdownView;
}
- /*获取关机滑动条*/
- UISlider *RebootAndShutdownView::GetShutdownSlider(void)
- {
- return shutdownSlider;
- }
-
- /*获取重启滑动条*/
- UISlider *RebootAndShutdownView::GetRebootSlider(void)
- {
- return rebootSlider;
- }
-
void RebootAndShutdownView::ClearAll(void)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::ClearAll");
delete container_;
container_ = nullptr;
}
-
if (rebootAndShutdownGroupView[REBOOTANDSHUTDOWN] != nullptr)
{
rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->RemoveAll();
delete factoryResetLabel;
factoryResetLabel = nullptr;
}
- if (shutdownScrollView != nullptr)
+ if (shutdownLabel)
{
- shutdownScrollView->RemoveAll();
-
- if (shutdownLabel != nullptr)
- {
- delete shutdownLabel;
- shutdownLabel = nullptr;
- }
-
- if (shutdownSlider != nullptr)
- {
- delete shutdownSlider;
- shutdownSlider = nullptr;
- }
-
- delete shutdownScrollView;
- shutdownScrollView = nullptr;
+ delete shutdownLabel;
+ shutdownLabel = nullptr;
}
- if (rebootScrollView != nullptr)
+ if (shutdownButton)
{
- rebootScrollView->RemoveAll();
-
- if (rebootSlider != nullptr)
- {
- delete rebootSlider;
- rebootSlider = nullptr;
- }
-
- if (rebootLabel != nullptr)
- {
- delete rebootLabel;
- rebootLabel = nullptr;
- }
-
- delete rebootScrollView;
- rebootScrollView = nullptr;
+ delete shutdownButton;
+ shutdownButton = nullptr;
+ }
+ if (sosLabel)
+ {
+ delete sosLabel;
+ sosLabel = nullptr;
+ }
+ if (sosButton)
+ {
+ delete sosButton;
+ sosButton = nullptr;
}
delete rebootAndShutdownGroupView[REBOOTANDSHUTDOWN];
rebootAndShutdownGroupView[REBOOTANDSHUTDOWN] = nullptr;
}
-
+ ClearAllShutdownView();
if (shutDownImageAnimatorView != nullptr)
{
delete shutDownImageAnimatorView;
shutDownImageAnimatorView = nullptr;
}
-
if (factoryResetView != nullptr)
{
delete factoryResetView;
factoryResetView = nullptr;
}
+ for (int i = REBOOTANDSHUTDOWN; i < REBOOTANDSHUTDOWN_MAX; i++)
+ {
+ rebootAndShutdownGroupView[i] = nullptr;
+ }
}
}
label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height);
label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);
label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);
- if (true == ConfigModel::GetInstance()->GetisFirstTimeStart() && ConfigModel::GetInstance()->GetLanguage() == -1)
- {
- label->SetText(labelconfig.text);
- }
- else
- {
- label->SetTextId(labelconfig.textId);
- }
+ label->SetTextId(labelconfig.textId);
label->SetLineBreakMode(labelconfig.lineBreakMode);
label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
label->SetRollSpeed(70);
.height = 35,
.fontSize = 30,
.lineHeigh = 35,
- .textId = STR_SHUTDOWN_AND_RESTART, /*关机和重启*/
+ .textId = STR_SYSTEM, /*系统*/
.lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
};
title = RebootAndShutdownLabelInit(labelConfig);
}
/* -------------------------------------------------------------------------- */
labelConfig = {
- .left = 110,
- .top = 33,
- .width = 240,
+ .left = 113,
+ .top = 271,
+ .width = 60,
.height = 35,
.fontSize = 30,
.lineHeigh = 35,
- .textId = STR_SLIDE_TO_SHUTDOWN, /*滑动关机 >>*/
- .text = "Slide to shutdown",
+ .textId = STR_SHUTDOWN, /*关机*/
+ .text = "shutdown",
.lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
};
shutdownLabel = RebootAndShutdownLabelInit(labelConfig);
shutdownLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
shutdownLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
/* -------------------------------------------------------------------------- */
- labelConfig.textId = STR_SLIDE_TO_REBOOT; /*滑动重启 >>*/
- labelConfig.text = "Slide to reboot";
- rebootLabel = RebootAndShutdownLabelInit(labelConfig);
- if (rebootLabel == nullptr)
+ sosLabel = new UILabelExt();
+ if (sosLabel == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootLabel new fail!");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sosLabel new fail!");
return false;
}
- rebootLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER);
- rebootLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
+ sosLabel->SetPosition(294, 271, 58, 35);
+ sosLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ sosLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ sosLabel->SetText("SOS");
+ sosLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ sosLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ sosLabel->SetRollSpeed(70);
+ sosLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ sosLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));
/* -------------------------------------------------------------------------- */
labelConfig = {
.left = 83,
bool RebootAndShutdownView::CreateRebootAndShutdownSlider(void)
{
+#if IS_SLIDER_TO_SHUTDOWN
if (shutdownSlider == nullptr)
{
shutdownSlider = new UISlider();
rebootSlider->SetOnClickListener(presenter_);
rebootSlider->SetOnDragListener(presenter_);
rebootSlider->SetSliderEventListener(presenter_);
-
+#endif
return true;
}
bool RebootAndShutdownView::CreateRebootAndShutdownScrollView(void)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::CreateRebootAndShutdownScrollView");
+#if IS_SLIDER_TO_SHUTDOWN
if (shutdownScrollView == nullptr)
{
shutdownScrollView = new UIScrollView();
rebootScrollView->SetDraggable(true);
rebootScrollView->SetIntercept(true);
}
+#endif
+ return true;
+ }
+ bool RebootAndShutdownView::CreateRebootAndShutdownButton(void)
+ {
+ if (shutdownButton == nullptr)
+ {
+ shutdownButton = new UIButton();
+ if (shutdownButton == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootAndShutdownGroupView[REBOOTANDSHUTDOWN] is new fail!!");
+ return false;
+ }
+ shutdownButton->SetPosition(93, 160);
+ shutdownButton->Resize(100, 100);
+ shutdownButton->SetViewId(SHUTDOWN_BUTTON_VIEWID);
+ shutdownButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ shutdownButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ shutdownButton->SetImageSrc(PNG_SETTINGS_SETTTING_SHUTDOWN_1, PNG_SETTINGS_SETTTING_SHUTDOWN_1);
+ shutdownButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ shutdownButton->SetOnClickListener(presenter_);
+ }
+ if (sosButton == nullptr)
+ {
+ sosButton = new UIButton();
+ if (sosButton == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "rebootAndShutdownGroupView[REBOOTANDSHUTDOWN] is new fail!!");
+ return false;
+ }
+ sosButton->SetPosition(273, 160);
+ sosButton->Resize(100, 100);
+ sosButton->SetViewId(SOS_BUTTON_VIEWID);
+ sosButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ sosButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ sosButton->SetImageSrc(PNG_SETTINGS_SETTTING_SOS, PNG_SETTINGS_SETTTING_SOS);
+ sosButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ sosButton->SetOnClickListener(presenter_);
+ }
return true;
}
void RebootAndShutdownView::CreateRebootAndShutdownView(void)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::CreateRebootAndShutdownView");
- if (!CreateRebootAndShutdownGroupView() || !CreateRebootAndShutdownScrollView() ||
- !CreateRebootAndShutdownLabel() || !CreateRebootAndShutdownSlider())
+ if (!CreateRebootAndShutdownGroupView() || !CreateRebootAndShutdownButton() || !CreateRebootAndShutdownLabel())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::CreateRebootAndShutdownView fail!");
return;
}
rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(title);
- shutdownScrollView->Add(shutdownLabel);
- shutdownScrollView->Add(shutdownSlider);
- rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(shutdownScrollView);
-
- rebootScrollView->Add(rebootLabel);
- rebootScrollView->Add(rebootSlider);
- rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(rebootScrollView);
+ rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(shutdownButton);
+ rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(shutdownLabel);
+ rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(sosButton);
+ rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(sosLabel);
rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->Add(factoryResetLabel);
-
container_->Add(rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]);
}
return true;
}
+ // 切换到关机提示视图
+ bool RebootAndShutdownView::ChangeToShutdownTipView(int16_t thisView)
+ {
+ if (rebootAndShutdownGroupView[thisView] == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::ChangeToShutdownTipView");
+ UIViewGroup *group = ShutdownViewInit();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail");
+ return false;
+ }
+ rebootAndShutdownGroupView[thisView] = group;
+ container_->Add(rebootAndShutdownGroupView[thisView]);
+ }
+ return true;
+ }
+
+ // 切换到关机动画视图
bool RebootAndShutdownView::ChangeToShutDownAnimatorView(int16_t thisView)
{
if (rebootAndShutdownGroupView[thisView] == nullptr)
return true;
}
+ // 切换到恢复出厂设置视图
bool RebootAndShutdownView::ChangeToFactoryResetView(int16_t thisView)
{
if (rebootAndShutdownGroupView[thisView] == nullptr)
static const RebootAndShutdownViewMapper ViewMapper[] = {
{REBOOTANDSHUTDOWN, &RebootAndShutdownView::ChangeToRebootAndShutdownView},
- {FACTORYRESET, &RebootAndShutdownView::ChangeToFactoryResetView},
+ {SHUTDOWNTIPVIEW, &RebootAndShutdownView::ChangeToShutdownTipView},
{SHUTDOWNANIMATOR, &RebootAndShutdownView::ChangeToShutDownAnimatorView},
+ {FACTORYRESET, &RebootAndShutdownView::ChangeToFactoryResetView},
};
bool RebootAndShutdownView::ClickFunc(int16_t interface)
rebootAndShutdownGroupView[showView]->SetVisible(true);
Draw();
}
+
+ UIButton *RebootAndShutdownView::GetButtonEnsure()
+ {
+ return button_ensure;
+ }
+ UIButton *RebootAndShutdownView::GetButtonCancel()
+ {
+ return button_cancel;
+ }
+ UIScrollView *RebootAndShutdownView::GetSystemShutdownScrollView(void)
+ {
+ return SystemShutdownScrollView;
+ }
+
+ UIViewGroup *RebootAndShutdownView::ShutdownViewInit(void)
+ {
+ if (SystemShutdownScrollView == nullptr)
+ {
+ SystemShutdownScrollView = new UIScrollView();
+ if (SystemShutdownScrollView == nullptr)
+ {
+ return nullptr;
+ }
+ SystemShutdownScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ SystemShutdownScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ SystemShutdownScrollView->SetOnDragListener(presenter_);
+ SystemShutdownScrollView->SetTouchable(true);
+ SystemShutdownScrollView->SetDraggable(true);
+ /* -------------------------------------------------------------------------- */
+ if (shutdowntitle == nullptr)
+ {
+ shutdowntitle = new UILabelExt();
+ if (shutdowntitle == nullptr)
+ {
+ return nullptr;
+ }
+ shutdowntitle->SetPosition(83, 50, 300, 35); // 位置
+ shutdowntitle->SetStyle(STYLE_TEXT_FONT, 30); // 字体大小
+ shutdowntitle->SetStyle(STYLE_LINE_HEIGHT, 35); // 字体行高
+ shutdowntitle->SetTextId(STR_SHUTDOWN); // 内容
+ shutdowntitle->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ shutdowntitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ shutdowntitle->SetRollSpeed(70);
+ shutdowntitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ SystemShutdownScrollView->Add(shutdowntitle);
+ }
+ /* -------------------------------------------------------------------------- */
+ if (image == nullptr)
+ {
+ image = new UIImageView();
+ if (image == nullptr)
+ {
+ return nullptr;
+ }
+ image->SetPosition(196, 120, 74, 80);
+ image->SetSrc("/user/res/settings/SETTTING_SHUTDOWN.bin");
+ }
+ SystemShutdownScrollView->Add(image);
+ /* -------------------------------------------------------------------------- */
+ if (note == nullptr)
+ {
+ note = new UILabelExt();
+ if (note == nullptr)
+ {
+ return nullptr;
+ }
+ note->SetPosition(53, 232, 360, 35); // 位置
+ note->SetStyle(STYLE_TEXT_FONT, 30); // 字体大小
+ note->SetStyle(STYLE_LINE_HEIGHT, 35); // 字体行高
+ note->SetTextId(STR_SHUTDOWN_CONFIRM);
+ note->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ note->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ note->SetRollSpeed(70);
+ note->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ SystemShutdownScrollView->Add(note);
+ }
+ /* -------------------------------------------------------------------------- */
+ button_cancel = new UIButton();
+ if (button_cancel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemShutdown::new button_cancel fail!");
+ return nullptr;
+ }
+ button_cancel->SetPosition(97, 299, 130, 130);
+ button_cancel->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ button_cancel->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ button_cancel->SetImagePosition(15, 15);
+ button_cancel->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+ button_cancel->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ button_cancel->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE);
+ SystemShutdownScrollView->Add(button_cancel);
+ /* ------------------------ button_ensure ----------------------- */
+ button_ensure = new UIButton();
+ if (button_ensure == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemShutdown::new button_ensure fail!");
+ return nullptr;
+ }
+ button_ensure->SetPosition(240, 299, 130, 130);
+ button_ensure->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+ button_ensure->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+ button_ensure->SetImagePosition(15, 15);
+ button_ensure->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+ button_ensure->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ button_ensure->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE);
+ SystemShutdownScrollView->Add(button_ensure);
+ button_cancel->SetOnClickListener(presenter_);
+ button_ensure->SetOnClickListener(presenter_);
+ }
+ return SystemShutdownScrollView;
+ }
+
+ void RebootAndShutdownView::ClearAllShutdownView(void)
+ {
+ if (SystemShutdownScrollView)
+ {
+ SystemShutdownScrollView->RemoveAll();
+
+ if (title)
+ {
+ delete title;
+ title = nullptr;
+ }
+ if (note)
+ {
+ delete note;
+ note = nullptr;
+ }
+ if (image)
+ {
+ delete image;
+ image = nullptr;
+ }
+ if (button_ensure)
+ {
+ delete button_ensure;
+ button_ensure = nullptr;
+ }
+ if (button_cancel)
+ {
+ delete button_cancel;
+ button_cancel = nullptr;
+ }
+ delete SystemShutdownScrollView;
+ SystemShutdownScrollView = nullptr;
+ }
+ }
+
}
\ No newline at end of file