From: luozheng <1732036298@qq.com>
Date: Mon, 6 May 2024 12:44:58 +0000 (+0800)
Subject: 修改系统视图删除不必要的图片和代码,解决内存泄漏问题
X-Git-Tag: release_V1.2.70_20241020_135402~1113^2~20
X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=423550c1264ffdb0e83dd26d26f7dfe3435c788f;p=mirrors%2FFD230.git
修改系统视图删除不必要的图片和代码,解决内存泄漏问题
---
diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt
index dbbe46a20..f914e30b9 100644
--- a/code/sdk/application/wearable/fd230app/CMakeLists.txt
+++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt
@@ -360,7 +360,6 @@ set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemModel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemAboutTheWatchView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemSuperviseView.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemLanguageView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/Systemupgrade.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/system/src/SystemFactoryResetView.cpp
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt
index c4042f1f6..1ed32637b 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_en.txt
@@ -301,4 +301,10 @@ STR_LIST_DISPLAY$List display
STR_GRID_DISPLAY$Grid Display
STR_CELLULAR_DISPLAY$Cellular Display
STR_AUTO_DETECT$Auto Detect
+STR_ABOUT_WATCH$About Watch
+STR_WATCH_QR_CODE$watch QR code
+STR_SYSTEM_LANGUAGE$System Language
+STR_RESTART$ Restart
+STR_SHUTDOWN$Shutdown
+STR_FACTORY_RESET$Factory Reset
STR_LANGUAGE$Language
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
index 6e435c7c5..230c8118a 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
@@ -301,4 +301,10 @@ STR_LIST_DISPLAY$å表æ¾ç¤º
STR_GRID_DISPLAY$ç½æ ¼æ¾ç¤º
STR_CELLULAR_DISPLAY$èçªæ¾ç¤º
STR_AUTO_DETECT$èªå¨è¯å«
+STR_ABOUT_WATCH$å
³äºæè¡¨
+STR_WATCH_QR_CODE$æè¡¨äºç»´ç
+STR_SYSTEM_LANGUAGE$ç³»ç»è¯è¨
+STR_RESTART$éå¯
+STR_SHUTDOWN$å
³æº
+STR_FACTORY_RESET$æ¢å¤åºå
STR_LANGUAGE$è¯è¨
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml
index bdddb5422..a8fbd3303 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_en.xml
@@ -302,5 +302,11 @@
+
+
+
+
+
+
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
index 6597a5a85..9b884e705 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
@@ -302,5 +302,11 @@
+
+
+
+
+
+
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang
index 75b51af23..e564ebbb6 100644
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang differ
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang
index 00b01737d..7c3cc078d 100644
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang differ
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
index e26afe878..5bf80d159 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
@@ -314,8 +314,14 @@ enum UIResourceTextId : uint16_t {
STR_GRID_DISPLAY = 301,
STR_CELLULAR_DISPLAY = 302,
STR_AUTO_DETECT = 303,
- STR_LANGUAGE = 304,
- STR_MAX_ID = 305,
+ STR_ABOUT_WATCH = 304,
+ STR_WATCH_QR_CODE = 305,
+ STR_SYSTEM_LANGUAGE = 306,
+ STR_RESTART = 307,
+ STR_SHUTDOWN = 308,
+ STR_FACTORY_RESET = 309,
+ STR_LANGUAGE = 310,
+ STR_MAX_ID = 311,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang
index 3ba13c590..9e1c67a87 100644
Binary files a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang and b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang differ
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h
index e0fefb4a1..4335a6445 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 09:14:38
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-15 18:20:29
+ * @LastEditTime: 2024-05-06 19:09:44
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h
*/
#ifndef SYSTEM_ABOUT_VIEW_H
@@ -17,6 +17,7 @@
#include
namespace OHOS
{
+ static constexpr const char *SYSTEMABOUTTHEWATCHVIEWID = "SystemAboutTheWatchView"; // å
³äºæè¡¨
class SystemAboutTheWatchView
{
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLanguageView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLanguageView.h
deleted file mode 100644
index 72c5de6a7..000000000
--- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemLanguageView.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef SYSTEM_LANGUAGE_VIEW_H
-#define SYSTEM_LANGUAGE_VIEW_H
-
-#include "BaseView.h"
-#include "View.h"
-#include "components/ui_scroll_view.h"
-#include "components/ui_label.h"
-#include "components/ui_label_ext.h"
-#include "components/ui_radio_button.h"
-#include "components/ui_image_view.h"
-#include "components/ui_label_ext.h"
-#include"language/font/ui_resource_string.h"
-namespace OHOS
-{
- class SystemLanguageView
- {
-
- public:
- struct ImageConfig
- {
- int x;
- int y;
- int w;
- int h;
- const char *ImageSrc;
- };
- struct LabelConfig
- {
- int16_t left;
- int16_t top;
- int16_t width;
- int16_t height;
- int16_t fontSize; // åä½å¤§å°
- int16_t lineHeigh; // è¡é«
- const char *text; // ææ¬
- uint8_t lineBreakMode; // æè¡æ¨¡å¼ã
- };
- struct RadioButtonConfig
- {
- int16_t left;
- int16_t top;
- int16_t width;
- int16_t height;
- const char *name;
- const char *viewId;
- const char *select;
- const char *unselect;
- };
- SystemLanguageView();
- virtual ~SystemLanguageView();
- static SystemLanguageView *GetInstance(void);
- UIScrollView *SystemLanguageViewInit(void); // ç³»ç»è¯è¨è§å¾åå§å
- void ClearAll(void); // æ¸
餿æç»ä»¶
- UIImageView *SetUpImageVIew(ImageConfig &imageconfig); // 设置å¾ç
- UILabel *SetUpLabel(LabelConfig &labelconfig); // 设置æ ç¾
- UIRadioButton *SetUpRadioButton(RadioButtonConfig &radiobutton); // 设置åéæé®
- void SetRadioButtonSelectStatus(UIRadioButton &radiobutton, bool state); // 设置åéæ¡çéæ©ç¶æ
- private:
- UIScrollView *scrollView = nullptr;
- UILabelExt *Title = nullptr; // æ é¢
- UIImageView *Background[2]{nullptr}; // æ¾ç»ä»¶çèæ¯
- UILabel *SimplifiedChineseLabel = nullptr;
- UILabel *EnglishLabel = nullptr;
- UIRadioButton *SimplifiedChineseRadioButton = nullptr;
- UIRadioButton *EnglishRadioButton = nullptr;
- bool initViewStatus{false};
- };
-} // namespace OHOS
-#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemPresenter.h
index 6c05a167c..6216ba778 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemPresenter.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemPresenter.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 18:29:43
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-02 16:00:14
+ * @LastEditTime: 2024-05-06 19:56:05
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemPresenter.h
*/
@@ -22,53 +22,23 @@ namespace OHOS
{
SYSTEMVIEW = 0, // ç³»ç»è§å¾(slice)
ABOUTTHEWATCHVIEW, // å
³äºæè¡¨è§å¾(subView)
- SUPERVISEVIEW, // ç管è§å¾(subView)
+ SYSTEMLUPGRADE, // ç³»ç»å级(subView)
+ WATCHQRCODE, // æè¡¨äºç»´ç è§å¾(subView)
SYSTEMLANGUAGEVIEW, // ç³»ç»è¯è¨è§å¾(subView)
FACTORYRESETVIEW, // æ¢å¤åºå设置è§å¾(subView)upgrade
- SYSTEMLUPGRADE,
TEST,
MAX_SYSTEMVIEWID,
} SYSTEMVIEWID;
- /* ---------------------------- ç³»ç»è¯è¨çé¢åéæé®VIEWID ---------------------------- */
- static const char *SIMPLIFIED_CHINESE_CHECKBOX = "SimplifiedChineseCheckBox"; // ç®ä½ä¸æ
- static const char *ENGLISH_CHECKBOX = "EnglishCheckBox"; // English
/* ---------------------------- æ¢å¤åºå设置ç颿é®çVIEWID --------------------------- */
static const char *FACTORYRESET_CHECKON = "ShoutDownButtonCheckOn"; // 确认
static const char *FACTORYRESET_CHECKOFF = "ShoutDownButtonCheckOff"; // åæ¶
- class RadiobuttonOnChangeListener : public UICheckBox::OnChangeListener
- {
- public:
- RadiobuttonOnChangeListener(UIRadioButton *uiView, UILabelExt *label)
- {
- m_uiView = uiView;
- m_label = label;
- }
- ~RadiobuttonOnChangeListener() {}
- bool isChineseRadioButtonSelected();
- bool isEnglishRadioButtonSelected();
- bool OnChange(UICheckBox::UICheckBoxState state) override;
-
- private:
- UIRadioButton *m_uiView{nullptr};
- UILabelExt *m_label{nullptr};
- };
-
- class SystemViewOnDragListener : public UIView::OnDragListener
- {
- public:
- SystemViewOnDragListener() {}
- ~SystemViewOnDragListener() {}
- bool OnDrag(UIView &view, const DragEvent &event) override;
- bool OnDragEnd(UIView &view, const DragEvent &event) override;
- };
class SystemView;
class SystemPresenter : public Presenter,
public UIView::OnClickListener,
public RootView::OnKeyActListener,
- public UIView::OnDragListener,
- public UICheckBox::OnChangeListener,
+ public UIView::OnDragListener,
public UIView::OnTouchListener
{
public:
@@ -81,7 +51,8 @@ namespace OHOS
void OnStop() override;
static SystemPresenter *GetInstance();
- void set_key_falg(bool);
+ //void set_key_falg(bool);
+
private:
// å 为继æ¿äºOnClickListenerï¼æä»¥æOnClick屿§ï¼è³äºåæ°,å彿°ä¹è¿æ ·ç´æ¥ç»§æ¿;
bool OnClick(UIView &view, const ClickEvent &event) override;
@@ -89,11 +60,11 @@ namespace OHOS
bool OnDragEnd(UIView &view, const DragEvent &event) override;
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // å¢å æé®äºä»¶
bool OnPress(UIView &view, const PressEvent &event) override;
- bool OnChange(UICheckBox::UICheckBoxState state) override;
private:
SystemModel *systemModel;
- bool isSystemUpgradeState{false};//æ¯å¦å¤äºåçº§ç¶æ
+ //bool isSystemUpgradeState{false}; // æ¯å¦å¤äºåçº§ç¶æ
+ bool X_DRAG_FLAG{false};
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h
index 7036fff06..c906f84ca 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h
@@ -1,3 +1,10 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-30 18:29:39
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-05-06 20:35:44
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h
+ */
#ifndef SYSTEM_VIEW_H
#define SYSTEM_VIEW_H
@@ -12,22 +19,17 @@
#include "components/ui_label_button_ext.h"
#include "system/include/SystemAboutTheWatchView.h"
#include "system/include/SystemSuperviseView.h"
-#include "system/include/SystemLanguageView.h"
#include "system/include/SystemFactoryResetView.h"
#include "system/include/Systemupgrade.h"
#include "components/ui_toggle_button.h"
namespace OHOS
{
- static const char *ABOUT_THE_WATCH = "AboutTheWatchButton"; // å
³äºæè¡¨
- static const char *SUPERVISE = "SuperviseButton"; // ç管
- static const char *SYSTEM_LANGUAGE = "SystemLanguageButton"; // ç³»ç»è¯è¨
- static const char *FACTORY_RESET = "FactoryResetButton"; // æ¢å¤åºå设置
- static const char *SYSTEM_UPGRADE = "SystemUpgradeButtonExt"; // ç³»ç»å级
- static const char *ABOUT_THE_WATCH_IMAGESRC = "/user/res/system/SYSTEM_ABOUT_THE_WATCH.bin";
- static const char *SUPERVISE_IMAGESRC = "/user/res/system/SYSTEM_SUPERVISE.bin";
- static const char *SYSTEM_LANGUAGE_IMAGESRC = "/user/res/system/SYSTEM_SYSTEM_LANGUAGE.bin";
- static const char *FACTORY_RESET_LANGUAGE_IMAGESRC = "/user/res/system/SYSTEM_FACTORY_RESET.bin";
+ static constexpr const char *ABOUT_THE_WATCH = "AboutTheWatchButton"; // å
³äºæè¡¨
+ static constexpr const char *SYSTEM_UPGRADE = "SystemUpgradeButtonExt"; // ç³»ç»å级
+ static constexpr const char *WATCH_QR_CODE = "WatchqrcodeButton"; // æè¡¨äºç»´ç
+ static constexpr const char *SYSTEM_LANGUAGE = "SystemLanguageButton"; // ç³»ç»è¯è¨
+ static constexpr const char *FACTORY_RESET = "FactoryResetButton"; // æ¢å¤åºå设置
class SystemPresenter;
class SystemView : public View
{
@@ -41,22 +43,15 @@ namespace OHOS
void OnSetUpView() override;
void OnTearDownView() override;
void OnStop() override;
- struct ButtonConfig
- {
- int x;
- int y;
- int w;
- int h;
- const char *ViewId;
- const char *ImageSrc;
- };
+
struct ButtonConfig_ext_t
{
int x;
int y;
int w;
int h;
- const char *str;
+ // const char *str;
+ uint16_t textId;
const char *ViewId;
const char *ImageSrc;
@@ -69,7 +64,7 @@ namespace OHOS
bool ChangeSystemView(int16_t thisView);
bool ChangeSystemAboutView(int16_t thisView);
- bool ChangeSystemSuperviseView(int16_t thisView);
+ bool ChangeWatchQRCodeView(int16_t thisView);
bool ChangeSystemLanguageView(int16_t thisView);
bool ChangeSystemFactoryResetView(int16_t thisView);
bool ChangeSystemupgradeView(int16_t thisView);
@@ -82,16 +77,14 @@ namespace OHOS
void ClearAll(void);
bool SetTheSystemScrollView(void);
bool SetTheTitle(void);
- bool Cat1_4GabilityButtonViewInit();
UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &ButtonConfig_ext, UIView::OnClickListener *clickListener);
- SystemAboutTheWatchView *p_SystemAboutTheWatchView{nullptr};
- SystemSuperviseView *p_SystemSuperviseView{nullptr};
- SystemLanguageView *p_SystemLanguageView{nullptr};
- SystemFactoryResetView *p_SystemFactoryResetView{nullptr};
- SystemupgradeView *p_SystemupgradeView{nullptr};
+ SystemAboutTheWatchView *p_SystemAboutTheWatchView{nullptr}; // å
³äºæè¡¨
+ SystemupgradeView *p_SystemupgradeView{nullptr}; // ç³»ç»å级
+ SystemSuperviseView *p_WatchQRCodeView{nullptr}; // æè¡¨äºç»´ç
+ SystemFactoryResetView *p_SystemFactoryResetView{nullptr}; // æ¢å¤åºå设置
UIScrollView *SystemScrollView[10]{nullptr};
- UILabelExt *SystemLabel{nullptr}; // æ é¢
- bool initViewStatus{false};
+ UILabelExt *Title{nullptr}; // æ é¢
+ UILabelButtonExt *SystemViewButton[5]{nullptr};
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp
index feab9bcb4..6eed99b36 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp
@@ -177,7 +177,7 @@ namespace OHOS
SystemAboutTheWatchScrollView->SetTouchable(true);
SystemAboutTheWatchScrollView->SetDraggable(true);
- SystemAboutTheWatchScrollView->SetViewId("SystemAboutTheWatchTitle");
+ SystemAboutTheWatchScrollView->SetViewId(SYSTEMABOUTTHEWATCHVIEWID);
UIView::OnClickListener *touch = static_cast(SystemPresenter::GetInstance());
SystemAboutTheWatchScrollView->SetOnClickListener(touch);
return true;
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLanguageView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLanguageView.cpp
deleted file mode 100644
index 08452c61e..000000000
--- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemLanguageView.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-#include "system/include/SystemLanguageView.h"
-#include "system/include/SystemPresenter.h"
-#include "string.h"
-#include "UiConfig.h"
-#include "wearable_log.h"
-
-namespace OHOS
-{
-
- static SystemLanguageView *g_pSystemLanguageView{nullptr};
-
- SystemLanguageView::SystemLanguageView()
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::SystemLanguageView");
- g_pSystemLanguageView = this;
- }
-
- SystemLanguageView::~SystemLanguageView()
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::~SystemLanguageView");
- ClearAll();
- g_pSystemLanguageView = nullptr;
- }
-
- SystemLanguageView *SystemLanguageView::GetInstance()
- {
- return g_pSystemLanguageView;
- }
-
- void SystemLanguageView::ClearAll()
- {
- if (initViewStatus == true)
- {
- scrollView->RemoveAll();
- delete Title;
- Title = nullptr;
- for (int i = 0; i < 2; i++)
- {
- delete Background[i];
- Background[i] = nullptr;
- }
- delete SimplifiedChineseLabel;
- SimplifiedChineseLabel = nullptr;
- delete EnglishLabel;
- EnglishLabel = nullptr;
- delete SimplifiedChineseRadioButton;
- SimplifiedChineseRadioButton = nullptr;
- delete EnglishRadioButton;
- EnglishRadioButton = nullptr;
- delete scrollView;
- scrollView = nullptr;
- }
- }
-
- // 设置å¾ç
- UIImageView *SystemLanguageView::SetUpImageVIew(ImageConfig &imageconfig)
- {
- UIImageView *Image = new UIImageView();
- if (Image == nullptr)
- {
- return nullptr;
- }
- Image->SetPosition(imageconfig.x, imageconfig.y, imageconfig.w, imageconfig.h);
- Image->SetSrc(imageconfig.ImageSrc);
- return Image;
- }
-
- // 设置æ ç¾
- UILabel *SystemLanguageView::SetUpLabel(LabelConfig &labelconfig)
- {
- UILabel *label = new UILabel();
- if (label == nullptr)
- {
- return 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); // åä½è¡é«
- label->SetText(labelconfig.text); // å
容
- label->SetLineBreakMode(labelconfig.lineBreakMode); // æè¡æ¨¡å¼ã
- label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
- return label;
- }
-
- // 设置åéæé®
- UIRadioButton *SystemLanguageView::SetUpRadioButton(RadioButtonConfig &radioButtonconfig)
- {
- UIRadioButton *radiobutton = new UIRadioButton(radioButtonconfig.name);
- if (radiobutton == nullptr)
- {
- return nullptr;
- }
- radiobutton->SetPosition(radioButtonconfig.left, radioButtonconfig.top, radioButtonconfig.width, radioButtonconfig.height);
- radiobutton->SetViewId(radioButtonconfig.viewId);
- radiobutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
- radiobutton->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- radiobutton->SetImages(radioButtonconfig.select, radioButtonconfig.unselect);
- return radiobutton;
- }
-
- // 设置åéæ¡çéæ©ç¶æ
- void SystemLanguageView::SetRadioButtonSelectStatus(UIRadioButton &radiobutton, bool state)
- {
- if (state == true)
- {
- radiobutton.SetState(UICheckBox::SELECTED);
- }
- else
- {
- radiobutton.SetState(UICheckBox::UNSELECTED);
- }
- }
-
- UIScrollView *SystemLanguageView::SystemLanguageViewInit(void)
- {
- /* ------------------------------- scrollView ------------------------------- */
- scrollView = new UIScrollView();
- if (scrollView == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::scrollView new fail!");
- }
- scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
- scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- scrollView->SetStyle(STYLE_BORDER_RADIUS, 1294);
- UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance());
- if (draglistener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "function = %s,Line = %d,draglistener can not be nullptr!", __FUNCTION__, __LINE__);
- return nullptr;
- }
- scrollView->SetOnDragListener(draglistener);
- /* ---------------------------------- Title --------------------------------- */
- Title = new UILabelExt();
- if (Title == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::Title new fail!");
- return nullptr;
- }
- Title->SetPosition(203, 52, 200, 35);
- Title->SetTextId(0);
- // Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- scrollView->Add(Title);
- /* ------------------------------- Background ------------------------------- */
- ImageConfig imageconfig = {
- .x = 43,
- .y = 120,
- .w = 380,
- .h = 100,
- .ImageSrc = "/user/res/SETTING_BACKGROUND.bin",
- };
- Background[0] = SetUpImageVIew(imageconfig);
- if (Background[0] == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::Background[0] new fail!");
- return nullptr;
- }
- imageconfig.y = 240;
- Background[1] = SetUpImageVIew(imageconfig);
- if (Background[1] == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::Background[1] new fail!");
- return nullptr;
- }
- scrollView->Add(Background[0]);
- scrollView->Add(Background[1]);
- /* ------------------------- SimplifiedChineseLabel ------------------------- */
- LabelConfig labelconfig = {
- .left = 90,
- .top = 153,
- .width = 200,
- .height = 60,
- .fontSize = 30,
- .lineHeigh = 35,
- .text = "ç®ä½ä¸æ",
- .lineBreakMode = UILabel::LINE_BREAK_ADAPT,
- };
- SimplifiedChineseLabel = SetUpLabel(labelconfig);
- if (SimplifiedChineseLabel == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::SimplifiedChineseLabel new fail!");
- return nullptr;
- }
- scrollView->Add(SimplifiedChineseLabel);
- /* ------------------------------ EnglishLabel ------------------------------ */
- labelconfig.top = 273;
- labelconfig.text = "ENGLISH";
- EnglishLabel = SetUpLabel(labelconfig);
- if (EnglishLabel == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::EnglishLabel new fail!");
- return nullptr;
- }
- scrollView->Add(EnglishLabel);
- /* ---------------------- SimplifiedChineseRadioButton ---------------------- */
- RadioButtonConfig radioButtonConfig = {
- .left = 300,
- .top = 130,
- .width = 80,
- .height = 80,
- .name = "LanguageCategory",
- .viewId = SIMPLIFIED_CHINESE_CHECKBOX,
- .select = "/user/res/CHECKBOX_ON.bin",
- .unselect = "/user/res/CHECKBOX_OFF.bin",
- };
- SimplifiedChineseRadioButton = SetUpRadioButton(radioButtonConfig);
- if (SimplifiedChineseRadioButton == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::SimplifiedChineseRadioButton new fail!");
- return nullptr;
- }
- SetRadioButtonSelectStatus(*SimplifiedChineseRadioButton, true);
- UICheckBox::OnChangeListener *SimplifiedChineseRadioButtonChange = static_cast(new RadiobuttonOnChangeListener(SimplifiedChineseRadioButton, Title));
- SimplifiedChineseRadioButton->SetOnChangeListener(SimplifiedChineseRadioButtonChange);
- scrollView->Add(SimplifiedChineseRadioButton);
- /* --------------------------- EnglishRadioButton --------------------------- */
- radioButtonConfig.left = 300;
- radioButtonConfig.top = 250;
- radioButtonConfig.viewId = ENGLISH_CHECKBOX;
- EnglishRadioButton = SetUpRadioButton(radioButtonConfig);
- if (EnglishRadioButton == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemLanguageView::EnglishRadioButton new fail!");
- return nullptr;
- }
- UICheckBox::OnChangeListener *EnglishRadioButtonChange = static_cast(new RadiobuttonOnChangeListener(EnglishRadioButton, Title));
- EnglishRadioButton->SetOnChangeListener(EnglishRadioButtonChange);
- scrollView->Add(EnglishRadioButton);
- initViewStatus = true;
- return scrollView;
- }
-}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp
index 6829336ab..96c45f3c3 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp
@@ -17,21 +17,6 @@
namespace OHOS
{
- struct SystemView_ext_p
- {
- const int16_t viewId;
- char *viewid_str;
- bool enable_falg;
- };
-
- static SystemView_ext_p ViewMapper_t[] = {
- {ABOUTTHEWATCHVIEW, "AboutTheWatchButton", true},
- {SUPERVISEVIEW, "SuperviseButton", true},
- {SYSTEMLANGUAGEVIEW, "SystemLanguageButton", false},
- {FACTORYRESETVIEW, "FactoryResetButton", true},
- {SYSTEMLUPGRADE, "systemupgread", true},
- };
-
// å½åPresenter屿§å®ä¾åçå
åæé
static SystemPresenter *g_pSystemPresenter = nullptr;
@@ -85,29 +70,49 @@ namespace OHOS
return true;
}
- bool SystemPresenter::OnChange(UICheckBox::UICheckBoxState state)
- {
- return true;
- }
-
bool SystemPresenter::OnDrag(UIView &view, const DragEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemPresenter::OnDrag");
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // æå¨è¿ç¨ä¸å¤ææ¯å¦æ¯æ°´å¹³æ»å¨
+ {
+ SystemPresenter::X_DRAG_FLAG = true;
+ }
return true;
}
bool SystemPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemPresenter::OnDragEnd");
SystemView *p_SystemView = SystemView::GetInstance();
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+ if (p_SystemView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::GetInstance fail!");
+ return false;
+ }
+
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && SystemPresenter::X_DRAG_FLAG)
{
- for (int i = 1; i < MAX_SYSTEMVIEWID; i++)
+ if (&view == p_SystemView->GetSystemScrollView(SYSTEMVIEW))
{
- if (p_SystemView->GetSystemScrollView(i) != nullptr && p_SystemView->GetSystemScrollView(i)->IsVisible() == true)
- {
- p_SystemView->ChangeView(i, SYSTEMVIEW);
- break;
- }
+ NativeAbility::GetInstance().Back();
}
+ else if (&view == p_SystemView->GetSystemScrollView(ABOUTTHEWATCHVIEW))
+ {
+ p_SystemView->ChangeView(ABOUTTHEWATCHVIEW, SYSTEMVIEW);
+ }
+ else if (&view == p_SystemView->GetSystemScrollView(SYSTEMLUPGRADE))
+ {
+ p_SystemView->ChangeView(SYSTEMLUPGRADE, SYSTEMVIEW);
+ }
+ else if (&view == p_SystemView->GetSystemScrollView(WATCHQRCODE))
+ {
+ p_SystemView->ChangeView(WATCHQRCODE, SYSTEMVIEW);
+ }
+ else if (&view == p_SystemView->GetSystemScrollView(FACTORYRESETVIEW))
+ {
+ p_SystemView->ChangeView(FACTORYRESETVIEW, SYSTEMVIEW);
+ }
+ SystemPresenter::X_DRAG_FLAG = false;
return true;
}
return false;
@@ -116,12 +121,15 @@ namespace OHOS
// 该ç¹å»åè°ä¸»è¦ç¨äºå¨ç³»ç»è§å¾çé¢è¿è¡è·³è½¬è§å¾
bool SystemPresenter::OnClick(UIView &view, const ClickEvent &event)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemPresenter::OnClick");
SystemView *p_SystemView = SystemView::GetInstance();
- int len = sizeof(ViewMapper_t) / sizeof(SystemView_ext_p);
- // int len=5;
- // æ ¹æ®æ§ä»¶idæ¥æ¾æ¯åªä¸ªæ§ä»¶è§¦åäºç¹å»åè°
+ if (p_SystemView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::GetInstance fail!");
+ return false;
+ }
- if (strcmp(view.GetViewId(), "SystemAboutTheWatchTitle") == 0)
+ if (strcmp(view.GetViewId(), SYSTEMABOUTTHEWATCHVIEWID) == 0) // è¿ç»ç¹å»è¿å
¥äº§æµæ¨¡å¼
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchTitle");
if (time == 0)
@@ -149,153 +157,70 @@ namespace OHOS
}
return true;
}
-
- if (strcmp(view.GetViewId(), "SystemLanguageButton") == 0)
+ else if (strcmp(view.GetViewId(), ABOUT_THE_WATCH) == 0) // ç¹å»è¿å
¥å
³äºæè¡¨çé¢
{
- NativeAbility::GetInstance().EnterSlice(VIEW_LANGUAGE_SWITCH);
+ p_SystemView->ChangeView(SYSTEMVIEW, ABOUTTHEWATCHVIEW);
return true;
}
-
- for (int i = 0; i < len; i++)
+ else if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0) // ç¹å»è¿å
¥ç³»ç»å级è§å¾
{
- if (strcmp(view.GetViewId(), ViewMapper_t[i].viewid_str) == 0)
- {
- if (i == 5)
- {
-
- break;
- }
-
- if (ViewMapper_t[i].enable_falg == true)
- SystemView::GetInstance()->ChangeView(SYSTEMVIEW, ViewMapper_t[i].viewId);
- time = 0;
- return true;
- }
+ p_SystemView->ChangeView(SYSTEMVIEW, SYSTEMLUPGRADE);
+ return true;
}
-
- if (strcmp(view.GetViewId(), FACTORYRESET_CHECKON) == 0)
+ else if (strcmp(view.GetViewId(), WATCH_QR_CODE) == 0) // ç¹å»è¿å
¥æè¡¨äºç»´ç è§å¾
{
- do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING,NULL,0);
+ p_SystemView->ChangeView(SYSTEMVIEW, WATCHQRCODE);
return true;
}
- else if (strcmp(view.GetViewId(), FACTORYRESET_CHECKOFF) == 0)
+ else if (strcmp(view.GetViewId(), SYSTEM_LANGUAGE) == 0) // ç¹å»è¿å
¥ç³»ç»è¯è¨çé¢
{
- p_SystemView->ChangeView(FACTORYRESETVIEW, SYSTEMVIEW);
+ NativeAbility::GetInstance().EnterSlice(VIEW_LANGUAGE_SWITCH);
return true;
}
-
- if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0)
+ else if (strcmp(view.GetViewId(), FACTORY_RESET) == 0) // ç¹å»è¿å
¥æ¢å¤åºå设置çé¢
{
- isSystemUpgradeState = true;
- SystemupgradeView::GetInstance()->statr_down_fwpkg();
+ p_SystemView->ChangeView(SYSTEMVIEW, FACTORYRESETVIEW);
+ return true;
}
- if (strcmp(view.GetViewId(), "labelButton1_exit") == 0)
+ else if (strcmp(view.GetViewId(), FACTORYRESET_CHECKON) == 0) // æ¢å¤åºå设置确认
{
- // SystemView::GetInstance()->ChangeSlice(VIEW_SETTING);;
- NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);
- isSystemUpgradeState = false;
+ do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);
+ return true;
}
- return true;
- }
-
- // è¯¥ææ½æ¯ç¨æ¥å¤çç³»ç»è§å¾(slice)çå·¦æ»éåºäºä»¶ååè§å¾çå·¦æ»éåºå°ç³»ç»è§å¾åºåå¼
- bool SystemViewOnDragListener::OnDrag(UIView &view, const DragEvent &event)
- {
- return true;
- }
-
- bool SystemViewOnDragListener::OnDragEnd(UIView &view, const DragEvent &event)
- {
- if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT))
+ else if (strcmp(view.GetViewId(), FACTORYRESET_CHECKOFF) == 0) // æ¢å¤åºåè®¾ç½®åæ¶
{
- SystemPresenter::GetInstance()->set_key_falg(false);
- NativeAbility::GetInstance().Back();
+ p_SystemView->ChangeView(FACTORYRESETVIEW, SYSTEMVIEW);
+ return true;
}
- return true;
- }
- /// @brief ç®ä½ä¸æåéæé®è¢«éä¸
- /// @param void
- /// @return true 表示éä¸ ï¼false 表示æªéä¸
- bool RadiobuttonOnChangeListener::isChineseRadioButtonSelected(void)
- {
- if (m_uiView->GetState() == UICheckBox::SELECTED && m_uiView->GetViewId() == SIMPLIFIED_CHINESE_CHECKBOX)
+
+ if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0) //ç¹å»æ¯å¦ç«å³å级
{
- return true;
+ SystemupgradeView::GetInstance()->statr_down_fwpkg();
}
- RootView::GetInstance()->Invalidate();
- return false;
- }
-
- /// @brief è±è¯åéæé®è¢«éä¸
- /// @param void
- /// @return true 表示éä¸ ï¼false 表示æªéä¸
- bool RadiobuttonOnChangeListener::isEnglishRadioButtonSelected(void)
- {
- if (m_uiView->GetState() == UICheckBox::SELECTED && m_uiView->GetViewId() == ENGLISH_CHECKBOX)
+ if (strcmp(view.GetViewId(), "labelButton1_exit") == 0) //ç¨åå说
{
- return true;
+ NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);
}
- return false;
- }
-
- /* -------------------------------------------------------------------------- */
- // è·åè¯è¨ç±»
- //language *g_planguage = new language();
- /* -------------------------------------------------------------------------- */
- // ç¨æ¥çå¬è¯è¨åæ¢
- bool RadiobuttonOnChangeListener::OnChange(UICheckBox::UICheckBoxState state)
- {
- // language *g_planguage;
- // // static const char *en = "user/res/font/en.lang";
- // // static const char *zh_CN = "user/res/font/zh.lang";
- // switch (state)
- // {
- // case UICheckBox::SELECTED:
- // if (isChineseRadioButtonSelected())
- // {
- // // ä¸æææ¬
- // g_planguage->ChangeLanguage(LanguageId::ZH_CN);
- // }
- // else if (isEnglishRadioButtonSelected())
- // {
- // // è±è¯ææ¬
- // g_planguage->ChangeLanguage(LanguageId::EN);
- // }
- // m_label->SetTextId(0);
- // // 强å¶å·æ°
- // m_label->ForceResetText();
- // RootView::GetInstance()->Invalidate();
- // break;
- // case UICheckBox::UNSELECTED:
- // // Handle unselected state if needed
- // break;
- // default:
- // break;
- // }
return true;
}
bool SystemPresenter::OnKeyAct(UIView &view, const KeyEvent &event) // å¢å æé®äºä»¶
{
- if (!isSystemUpgradeState)
- { // 妿å¤äºç³»ç»åçº§ç¶æpoweré®è¿ååè½æ æ
- UNUSED(view);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemPresenter::OnKeyAct");
- uint16 keyID = event.GetKeyId();
- uint16 keyState = event.GetState();
- // 妿æ¯poweré®,䏿¯äº®å±ç¶æï¼æé®éæ¾å°±è¿åä¸ä¸çº§
- if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
- {
- uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- NativeAbility::GetInstance().Back();
- }
+ UNUSED(view);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemPresenter::OnKeyAct");
+ uint16 keyID = event.GetKeyId();
+ uint16 keyState = event.GetState();
+ // 妿æ¯poweré®,䏿¯äº®å±ç¶æï¼æé®éæ¾å°±è¿åä¸ä¸çº§
+ if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
+ {
+ NativeAbility::GetInstance().Back();
}
return true;
}
- void SystemPresenter::set_key_falg(bool falg) // å¢å æé®äºä»¶
- {
- isSystemUpgradeState = falg;
- }
+ // void SystemPresenter::set_key_falg(bool falg) // å¢å æé®äºä»¶
+ // {
+ // isSystemUpgradeState = falg;
+ // }
}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp
index dd4a526ec..88384fca8 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp
@@ -3,6 +3,7 @@
#include "wearable_log.h"
#include "bleService.h"
#include "battery_hal.h"
+#include "language/font/ui_resource_string.h"
extern uint8_t battery_get_voltage(float *voltage);
namespace OHOS
{
@@ -13,19 +14,53 @@ namespace OHOS
{
const int16_t viewId;
const char *viewid_str;
- const char *Labe_str;
+ // const char *Labe_str;
+ uint16_t textId;
bool (SystemView::*func)(int16_t thisView);
};
- static UILabelButtonExt *button[10] = {NULL};
SystemViewMapper_ext ViewMapper_t[] = {
- {ABOUTTHEWATCHVIEW, "AboutTheWatchButton", "å
³äºæè¡¨", &SystemView::ChangeSystemAboutView},
- {SUPERVISEVIEW, "SuperviseButton", "ç管模å¼", &SystemView::ChangeSystemSuperviseView},
- {SYSTEMLANGUAGEVIEW, "SystemLanguageButton", "忢è¯è¨", &SystemView::ChangeSystemLanguageView},
- {FACTORYRESETVIEW, "FactoryResetButton", "æ¢å¤åºå", &SystemView::ChangeSystemFactoryResetView},
- {SYSTEMLUPGRADE, "systemupgread", "ç³»ç»å级", &SystemView::ChangeSystemupgradeView},
+ {ABOUTTHEWATCHVIEW, ABOUT_THE_WATCH, STR_ABOUT_WATCH, &SystemView::ChangeSystemAboutView},
+ {SYSTEMLUPGRADE, SYSTEM_UPGRADE, STR_SYSTEM_UPDATE, &SystemView::ChangeSystemupgradeView},
+ {WATCHQRCODE, WATCH_QR_CODE, STR_WATCH_QR_CODE, &SystemView::ChangeWatchQRCodeView},
+ {SYSTEMLANGUAGEVIEW, SYSTEM_LANGUAGE, STR_SYSTEM_LANGUAGE, &SystemView::ChangeSystemLanguageView},
+ {FACTORYRESETVIEW, FACTORY_RESET, STR_FACTORY_RESET, &SystemView::ChangeSystemFactoryResetView},
+
};
+ // æ ¹æ®ä¼ å
¥çinterfaceåæ°æ§è¡ç¸åºè§å¾IDå
³èçæå彿°ã
+ bool SystemView::ClickFunc(int16_t interface)
+ {
+ int funcSize = sizeof(ViewMapper_t) / sizeof(ViewMapper_t[SYSTEMVIEW]);
+ for (int i = 0; i < funcSize; i++)
+ {
+ if (interface == ViewMapper_t[i].viewId)
+ {
+ bool jug = (this->*(ViewMapper_t[i].func))(interface);
+ if (jug == false)
+ {
+ return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // 忢è§å¾
+ void SystemView::ChangeView(int16_t hideView, int16_t showView)
+ {
+ if (hideView > MAX_SYSTEMVIEWID)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemViewId Overstep ones bounds");
+ return;
+ }
+ SystemScrollView[hideView]->SetVisible(false);
+ ClickFunc(showView);
+ SystemScrollView[showView]->SetVisible(true);
+ Draw();
+ }
+
SystemView::SystemView()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemView");
@@ -46,14 +81,20 @@ namespace OHOS
void SystemView::ClearAll()
{
- if (initViewStatus == true)
+ if (SystemScrollView[SYSTEMVIEW] != nullptr)
{
SystemScrollView[SYSTEMVIEW]->RemoveAll();
- UIView::OnDragListener *draglistener = SystemScrollView[SYSTEMVIEW]->GetOnDragListener();
- if (draglistener != nullptr)
+
+ if (Title != nullptr)
{
- delete draglistener;
- draglistener = nullptr;
+ delete Title;
+ Title = nullptr;
+ }
+
+ for (int i = 0; i < (sizeof(ViewMapper_t) / sizeof(SystemViewMapper_ext)); i++)
+ {
+ delete SystemViewButton[i];
+ SystemViewButton[i] = nullptr;
}
if (p_SystemAboutTheWatchView != nullptr)
@@ -61,16 +102,17 @@ namespace OHOS
delete p_SystemAboutTheWatchView;
p_SystemAboutTheWatchView = nullptr;
}
- if (p_SystemSuperviseView != nullptr)
+
+ if (p_SystemupgradeView != nullptr)
{
- delete p_SystemSuperviseView;
- p_SystemSuperviseView = nullptr;
+ delete p_SystemupgradeView;
+ p_SystemupgradeView = nullptr;
}
- if (p_SystemLanguageView != nullptr)
+ if (p_WatchQRCodeView != nullptr)
{
- delete p_SystemLanguageView;
- p_SystemLanguageView = nullptr;
+ delete p_WatchQRCodeView;
+ p_WatchQRCodeView = nullptr;
}
if (p_SystemFactoryResetView != nullptr)
@@ -79,12 +121,6 @@ namespace OHOS
p_SystemFactoryResetView = nullptr;
}
- if (SystemLabel != nullptr)
- {
- delete SystemLabel;
- SystemLabel = nullptr;
- }
-
delete SystemScrollView[SYSTEMVIEW];
SystemScrollView[SYSTEMVIEW] = nullptr;
}
@@ -106,7 +142,7 @@ namespace OHOS
SystemScrollView[SYSTEMVIEW]->SetScrollBlankSize(35);
SystemScrollView[SYSTEMVIEW]->SetReboundSize(50);
SystemScrollView[SYSTEMVIEW]->SetDirection(1);
- UIView::OnDragListener *draglistener = static_cast(new SystemViewOnDragListener());
+ UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance());
if (draglistener == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");
@@ -123,21 +159,22 @@ namespace OHOS
/// @return true 设置æåï¼false 失败
bool SystemView::SetTheTitle(void)
{
- SystemLabel = new UILabelExt();
- if (SystemLabel == nullptr)
+ Title = new UILabelExt();
+ if (Title == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLabel new fail!");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::Title new fail!");
return false;
}
- SystemLabel->SetPosition(203, 52);
- SystemLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- SystemLabel->SetStyle(STYLE_TEXT_FONT, 30);
- SystemLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
- SystemLabel->SetText("ç³»ç»");
- SystemLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- SystemLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- SystemLabel->SetRollSpeed(6);
- SystemLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ Title->SetPosition(83, 52, 300, 35);
+ Title->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ Title->SetStyle(STYLE_TEXT_FONT, 30);
+ Title->SetStyle(STYLE_LINE_HEIGHT, 35);
+ // Title->SetText("ç³»ç»");
+ Title->SetTextId(STR_SYSTEM);
+ Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+ Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ // Title->SetRollSpeed(6);
+ Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
return true;
}
@@ -156,7 +193,8 @@ namespace OHOS
button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
button->SetOnClickListener(clickListener);
- button->SetText(buttonconfig.str);
+ // button->SetText(buttonconfig.str);
+ button->SetTextId(buttonconfig.textId);
button->SetAlign(TEXT_ALIGNMENT_LEFT);
button->SetLabelPosition(buttonconfig.label_x, buttonconfig.label_y);
button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize);
@@ -191,18 +229,17 @@ namespace OHOS
for (int i = 0; i < len; i++)
{
- buttonconfig.str = ViewMapper_t[i].Labe_str;
+ // buttonconfig.str = ViewMapper_t[i].Labe_str;
+ buttonconfig.textId = ViewMapper_t[i].textId;
buttonconfig.ViewId = ViewMapper_t[i].viewid_str;
buttonconfig.ImageSrc = imagsrc;
buttonconfig.label_x = 40;
buttonconfig.label_y = 0;
buttonconfig.Fontsize = 30;
buttonconfig.ALIGN = TEXT_ALIGNMENT_LEFT;
- button[i] = SetTheButton_ext(buttonconfig, clickListener);
+ SystemViewButton[i] = SetTheButton_ext(buttonconfig, clickListener);
buttonconfig.y += interval;
}
- /* -------------------------------------------------------------------------- */
- initViewStatus = true;
}
// 0.跳转å°ç³»ç»è§å¾ï¼å
¶ä»è§å¾é½å¸éè¿è¿ä¸ªè§å¾è·³è½¬
@@ -234,19 +271,19 @@ namespace OHOS
return true;
}
- // 2.跳转å°ç³»ç»ç管
- bool SystemView::ChangeSystemSuperviseView(int16_t thisView)
+ // 2.è·³è½¬å°æè¡¨äºç»´ç
+ bool SystemView::ChangeWatchQRCodeView(int16_t thisView)
{
if (SystemScrollView[thisView] == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemSuperviseView");
- p_SystemSuperviseView = new SystemSuperviseView();
- if (p_SystemSuperviseView == nullptr)
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeWatchQRCodeView");
+ p_WatchQRCodeView = new SystemSuperviseView();
+ if (p_WatchQRCodeView == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
return false;
}
- SystemScrollView[thisView] = p_SystemSuperviseView->SystemSuperviseViewInit();
+ SystemScrollView[thisView] = p_WatchQRCodeView->SystemSuperviseViewInit();
RootView::GetInstance()->Add(SystemScrollView[thisView]);
}
return true;
@@ -255,20 +292,6 @@ namespace OHOS
// 3.跳转å°ç³»ç»è¯è¨çé¢
bool SystemView::ChangeSystemLanguageView(int16_t thisView)
{
-#if 1
- if (SystemScrollView[thisView] == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemLanguageView");
- p_SystemLanguageView = new SystemLanguageView();
- if (p_SystemLanguageView == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
- return false;
- }
- SystemScrollView[thisView] = p_SystemLanguageView->SystemLanguageViewInit();
- RootView::GetInstance()->Add(SystemScrollView[thisView]);
- }
-#endif
return true;
}
@@ -295,7 +318,7 @@ namespace OHOS
{
if (SystemScrollView[thisView] == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemFactoryResetView");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemupgradeView");
p_SystemupgradeView = new SystemupgradeView();
if (p_SystemupgradeView == nullptr)
{
@@ -317,57 +340,6 @@ namespace OHOS
return SystemScrollView[ViewId];
}
- /* -------------------------------------------------------------------------- */
- // 1.MainStopWatchViewMapper:ç»æä½å®ä¹äºä¸ä¸ªå°è§å¾IDæ å°å°ç¹å®æå彿°æéçæ å°è¡¨ã
- struct SystemViewMapper
- {
- const int16_t viewId;
- bool (SystemView::*func)(int16_t thisView);
- };
-
- // 2.ViewMapper[] æ¯ä¸ä¸ªéæçè§å¾æ å°æ°ç»ï¼å°è§å¾IDä¸MainStopWatchViewç±»ä¸çç¹å®æå彿°æéè¿è¡äºç»å®ã
- static const SystemViewMapper ViewMapper[] = {
- {SYSTEMVIEW, &SystemView::ChangeSystemView},
- {ABOUTTHEWATCHVIEW, &SystemView::ChangeSystemAboutView},
- {SUPERVISEVIEW, &SystemView::ChangeSystemSuperviseView},
- {SYSTEMLANGUAGEVIEW, &SystemView::ChangeSystemLanguageView},
- {FACTORYRESETVIEW, &SystemView::ChangeSystemFactoryResetView},
- };
-
- // 3.æ ¹æ®ä¼ å
¥çinterfaceåæ°æ§è¡ç¸åºè§å¾IDå
³èçæå彿°ã
- bool SystemView::ClickFunc(int16_t interface)
- {
- int funcSize = sizeof(ViewMapper_t) / sizeof(ViewMapper_t[SYSTEMVIEW]);
- for (int i = 0; i < funcSize; i++)
- {
- if (interface == ViewMapper_t[i].viewId)
- {
- bool jug = (this->*(ViewMapper_t[i].func))(interface);
- if (jug == false)
- {
- return false;
- }
- return true;
- }
- }
- return false;
- }
-
- // 4.忢è§å¾
- void SystemView::ChangeView(int16_t hideView, int16_t showView)
- {
- if (hideView > MAX_SYSTEMVIEWID)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemViewId Overstep ones bounds");
- return;
- }
- SystemScrollView[hideView]->SetVisible(false);
- ClickFunc(showView);
- SystemScrollView[showView]->SetVisible(true);
- Draw();
- }
- /* -------------------------------------------------------------------------- */
-
void SystemView::OnStart()
{
View::OnStart();
@@ -385,12 +357,12 @@ namespace OHOS
return;
}
- SystemScrollView[SYSTEMVIEW]->Add(SystemLabel);
+ SystemScrollView[SYSTEMVIEW]->Add(Title);
int len = sizeof(ViewMapper_t) / sizeof(SystemViewMapper_ext);
for (int i = 0; i < len; i++)
{
- SystemScrollView[SYSTEMVIEW]->Add(button[i]);
+ SystemScrollView[SYSTEMVIEW]->Add(SystemViewButton[i]);
}
RootView::GetInstance()->Add(SystemScrollView[SYSTEMVIEW]);
Draw();
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang
index 75b51af23..e564ebbb6 100644
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang
index 00b01737d..7c3cc078d 100644
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
index e26afe878..5bf80d159 100644
--- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
+++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
@@ -314,8 +314,14 @@ enum UIResourceTextId : uint16_t {
STR_GRID_DISPLAY = 301,
STR_CELLULAR_DISPLAY = 302,
STR_AUTO_DETECT = 303,
- STR_LANGUAGE = 304,
- STR_MAX_ID = 305,
+ STR_ABOUT_WATCH = 304,
+ STR_WATCH_QR_CODE = 305,
+ STR_SYSTEM_LANGUAGE = 306,
+ STR_RESTART = 307,
+ STR_SHUTDOWN = 308,
+ STR_FACTORY_RESET = 309,
+ STR_LANGUAGE = 310,
+ STR_MAX_ID = 311,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang
index 3ba13c590..9e1c67a87 100644
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang differ
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/KUMILOGO.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/KUMILOGO.bin
new file mode 100644
index 000000000..399e9cfbf
--- /dev/null
+++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/KUMILOGO.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:992905e904b5e96cc6e86d1da6060d4f091469cd5360fd55e2606c3d5b64de4b
+size 24984
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_ABOUT_THE_WATCH.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_ABOUT_THE_WATCH.bin
deleted file mode 100644
index 196d9ee23..000000000
--- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_ABOUT_THE_WATCH.bin
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:efdea91c4ef6371d11becb8651e5f1b952bed953af0e1e4610bb71cf1017048a
-size 25624
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_FACTORY_RESET.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_FACTORY_RESET.bin
deleted file mode 100644
index 2753f5242..000000000
--- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_FACTORY_RESET.bin
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7b2eaa958d59789b0398505a7e2ed21c58059c5186ebe8839641ee443ca192ef
-size 25624
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_SUPERVISE.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_SUPERVISE.bin
deleted file mode 100644
index d8e8b6fc8..000000000
--- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_SUPERVISE.bin
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d9e67bc841ccc0ea2ad23a091e80b620412c1ab85a412e6830ee6ee9d439b5cf
-size 25624
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_SYSTEM_LANGUAGE.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_SYSTEM_LANGUAGE.bin
deleted file mode 100644
index 5d36f5be0..000000000
--- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/SYSTEM_SYSTEM_LANGUAGE.bin
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2ff7a6c1c5266019f052011cb76163eb8fed71444f29736d3ced050bafde87d6
-size 25624
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/factoryreset.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/factoryreset.bin
deleted file mode 100644
index 12ea1d168..000000000
--- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/system/factoryreset.bin
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:979a740e2a057ed4d32eb31900c671070c7929d924a6d91d1e27485cd57482e0
-size 146040