From: 罗正 <1732036298@qq.com> Date: Thu, 25 Apr 2024 02:13:33 +0000 (+0000) Subject: Merge #76 into xts_origin from refs/changes/76/head X-Git-Tag: release_V1.2.70_20241020_135402~1131^2~1 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=627328f859929c848a40cb3b91cd88dedb149687;p=mirrors%2FFD230.git Merge #76 into xts_origin from refs/changes/76/head Code review from 罗正 * refs/changes/76/head: (12 commits squashed) - 增加震动提醒功能 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - 1.设置中增加网络与通话Slice,显示方式Slice去除快速访问Slice 2.修改多国语言适配设置界面 3.增加网络与通话界面图片 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - VoLTE,移动数据按钮增加点击监听 - 添加移动数据选项页面 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - 增加运动识别Slice - 修改设置视图以适配多国语言 - 1.利用ConfigModel保存用户设置的VoLTE通话和运动识别开关状态。 2.解决运动识别视图右滑不退出问题。 3.删除系统视图中的4G能力开关并移动到网络与通话中。 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - 修改设置视图中开关机icon,优化显示方式视图的退出方式,修改开关机视图的incon图标 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/76 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h index b3b0628f7..ede6b3404 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h @@ -106,7 +106,7 @@ typedef enum : uint16_t #ifdef SUPPORT_ALIPAY_SEC VIEW_MAIN_ALIPAY, #endif - VIEW_SET_DESKTOP, // 主题样式 + VIEW_SET_DESKTOP, // 主题样式//显示方式 VIEW_SET_CARD, // 卡片管理 VIEW_ADD_CARD, // 添加卡片 VIEW_SET_DIAL, // 切换表盘 diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index 9f88639e0..f2bf91cc1 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -294,7 +294,9 @@ namespace OHOS static constexpr const char *PNG_SETTINGS_DISPLAY_MODE = APP_RES_PATH "/settings/SETTINGS_DISPLAY_MODE.bin"; // 显示方式 static constexpr const char *PNG_SETTINGS_MOTION_RECOGNITION = APP_RES_PATH "/settings/SETTINGS_MOTION_RECOGNITION.bin"; // 运动识别 static constexpr const char *PNG_SETTINGS_SYSTEM = APP_RES_PATH "/settings/SETTINGS_SYSTEM.bin"; // 系统 - static constexpr const char *PNG_SETTINGS_SETTINGS_POWER_CONTROL = APP_RES_PATH "/settings/SETTINGS_POWER_CONTROL.bin"; // 关机和重启 + static constexpr const char *PNG_SETTINGS_SHUTDOWN_AND_RESTART = APP_RES_PATH "/settings/SETTINGS_SHUTDOWN_AND_RESTART.bin"; // 关机和重启 + static constexpr const char *PNG_SETTINGS_SETTTING_SHUTDOWN = APP_RES_PATH "/settings/SETTTING_SHUTDOWN.bin"; // 关机 + static constexpr const char *PNG_SETTINGS_SETTTING_REBOOT = APP_RES_PATH "/settings/SETTTING_REBOOT.bin"; // 重启 /* ---------------------------------- 消息中心 ---------------------------------- */ static constexpr const char *PNG_Message_System = APP_RES_PATH "/message/system-icon.bin"; // 系统消息 static constexpr const char *PNG_Message_Note = APP_RES_PATH "/message/message-icon.bin"; // 短信 diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h b/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h index 2f7777c99..344f3ecbb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h @@ -67,6 +67,8 @@ namespace OHOS CONFIGMODEL_ITEM_TRANING_FREQ,//训练实时数据上传频率 CONFIGMODEL_ITEM_SYSTEM_VOLUME,//系统音量 CONFIGMODEL_ITEM_CALL_VOLUME,//通话音量 + CONFIGMODEL_ITEM_VOLTE_CALL,//VoLTE通话 + CONFIGMODEL_ITEM_MOTIONRECOGNITION,//运动识别 CONFIGMODEL_ITEM_MAX, } ; @@ -128,6 +130,9 @@ namespace OHOS void SetCat1_4Gability(bool state); bool GetCat1_4Gability(); + void SetVoLTE_Call(bool state); + bool GetVoLTE_Call(); + void SetDnotdisturb(bool state); bool GetDnotdisturb(void); @@ -153,6 +158,9 @@ namespace OHOS void SetSilentMode(bool state); bool GetSilentMode(void); + /* ---------------------------------- 运动识别相关set与get ---------------------------------- */ + void SetMotionRecognition(bool state); + bool GetMotionRecognition(void); /* --------------------------------- 用户配置信息 --------------------------------- */ void SetUserAge(int age); int GetUserAge(); @@ -193,6 +201,8 @@ namespace OHOS {ConfigDataType::DATATYPE_INT, "traningfreq", "10" },// CONFIGMODEL_ITEM_TRANING_FREQ //训练实时数据上传频率//单位秒 {ConfigDataType::DATATYPE_INT, "SystemVolume", "100" },// CONFIGMODEL_ITEM_SYSTEM_VOLUME // {ConfigDataType::DATATYPE_INT, "CallVolume", "100" },// CONFIGMODEL_ITEM_CALL_VOLUME // + {ConfigDataType::DATATYPE_BOOL, "VoLTECall", "false" },// CONFIGMODEL_ITEM_VOLTE_CALL + {ConfigDataType::DATATYPE_BOOL, "MotionRecognition", "false" },// CONFIGMODEL_ITEM_MOTIONRECOGNITION }; ConfigModel(); // 私有构造函数,确保无法在外部实例化 ConfigModel(const ConfigModel &) = delete; // 禁止拷贝构造 diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h b/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h index be5d7976c..4041c76d1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-17 09:32:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-22 18:06:14 + * @LastEditTime: 2024-04-24 11:44:39 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h */ #ifndef _CONFIG_MODEL_C_H_ @@ -59,6 +59,20 @@ void initializeVibrationModel(void); * @brief 初始化静音模式 */ void initializeSilentModel(void); + +/* + * @brief 初始化VOLTE通话开关 + */ +void initializeVoLTECall(void); +/* + * @brief 初始化4G能力开关 + */ +void initialize4GCapability(void); + +/* + * @brief 初始化运动识别开关 + */ +void initializeMotionRecognition(void); #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp index ceab7a73f..50e53425b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp @@ -623,6 +623,25 @@ namespace OHOS return get_configData_bool(CONFIGMODEL_ITEM_CAT1_SERVICE_ON); } + /* + * @brief 设置VoLTE通话是否开启 + * @param {bool} state + */ + void ConfigModel::SetVoLTE_Call(bool state) + { + set_condigData_Bool(CONFIGMODEL_ITEM_VOLTE_CALL,state); + } + + /* + * @brief 获取VoLTE通话是否开启 + * @return {bool} true 开启 false 关闭 + */ + bool ConfigModel::GetVoLTE_Call() + { + return get_configData_bool(CONFIGMODEL_ITEM_VOLTE_CALL); + } + + /*设置勿扰模式是否开启*/ void ConfigModel::SetDnotdisturb(bool state) { @@ -670,6 +689,18 @@ namespace OHOS { return get_configData_int(CONFIGMODEL_ITEM_CALL_VOLUME); } + + //设置运动识别是否开启 + void ConfigModel::SetMotionRecognition(bool state) + { + set_condigData_Bool(CONFIGMODEL_ITEM_MOTIONRECOGNITION,state); + } + + //获取运动识别是否开启 + bool ConfigModel::GetMotionRecognition(void) + { + return get_configData_bool(CONFIGMODEL_ITEM_MOTIONRECOGNITION); + } /* -------------------------------------------------------------------------- */ /*设置用户年龄[后续使用结构体统一配置]*/ void ConfigModel::SetUserAge(int age) @@ -828,6 +859,24 @@ void initializeSilentModel(void) uapi_setSilentMode(isopen); } +void initializeVoLTECall(void) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "initializeVoLTECall"); + +} + +void initialize4GCapability(void) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "initialize4GCapability"); + bool isopen = OHOS::ConfigModel::GetInstance()->GetCat1_4Gability(); + uapi_set4GCapability(isopen); +} + +void initializeMotionRecognition(void) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "initializeMotionRecognition"); + bool isopen = OHOS::ConfigModel::GetInstance()->GetMotionRecognition(); +} #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp index a322c4a45..ae0e81756 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-28 14:17:43 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 18:12:26 + * @LastEditTime: 2024-04-24 14:26:22 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/language/src/MotionRecognitionPresenter.cpp */ #include "AppViewIDs.h" @@ -11,6 +11,7 @@ #include "motionrecognition/include/MotionRecognitionView.h" #include "common/key_code.h" #include +#include "config/include/ConfigModel.h" namespace OHOS { @@ -71,10 +72,12 @@ namespace OHOS if (toggleButton->GetState() == true) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is enable!"); + ConfigModel::GetInstance()->SetMotionRecognition(true); } else { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is disable!"); + ConfigModel::GetInstance()->SetMotionRecognition(false); } } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp index 3547c014b..46d56c4d8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp @@ -2,12 +2,13 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 17:28:52 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 19:09:24 + * @LastEditTime: 2024-04-24 14:26:44 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp */ #include "motionrecognition/include/MotionRecognitionPresenter.h" #include "motionrecognition/include/MotionRecognitionView.h" #include "wearable_log.h" +#include "config/include/ConfigModel.h" namespace OHOS { @@ -74,7 +75,15 @@ namespace OHOS scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); scrollView->SetScrollBlankSize(50); + scrollView->SetHorizontalScrollState(false); scrollView->SetReboundSize(35); + UIView::OnDragListener *draglistener = static_cast(MotionRecognitionPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::draglistener can not be nullptr!"); + return; + } + scrollView->SetOnDragListener(draglistener); /* -------------------------------------------------------------------------- */ if (Title == nullptr) { @@ -118,6 +127,7 @@ namespace OHOS return; } MotionRecognitionToggleButton->SetPosition(298, 145, 100, 50); + MotionRecognitionToggleButton->SetState(ConfigModel::GetInstance()->GetMotionRecognition()); MotionRecognitionToggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); const char *selectedImg = "/user/res/TOGGLEBUTTON_ON.bin"; const char *unSelectedImg = "/user/res/TOGGLEBUTTON_OFF.bin"; diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h new file mode 100644 index 000000000..b9778fe60 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h @@ -0,0 +1,28 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-04-24 10:25:39 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-04-24 10:46:13 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h + */ +#ifndef NETWORKANDCALLC_H +#define NETWORKANDCALLC_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" +{ +#endif +#endif +#include +#include + + void power_on_cat1(void); + void power_off_cat1(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp index c152acb1a..8b72fe4c8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 09:59:32 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 17:00:37 + * @LastEditTime: 2024-04-24 14:27:03 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp */ #include "AppViewIDs.h" @@ -14,7 +14,9 @@ #include "map" #include "functional" #include "iostream" - +#include "config/include/ConfigModel.h" +#include "networkandcall/include/NetworkAndCallC.h" +#include "cat1_ctl.h" namespace OHOS { @@ -66,11 +68,10 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NetworkAndCallView::GetInstance fail!!"); return false; } - - + std::map buttonMap = { + {p_NetworkAndCallView->GetMobileDataToggleButton(), "4GCapability"}, {p_NetworkAndCallView->GetVoLTEToggleButton(), "VoLTE"}, - {p_NetworkAndCallView->GetMobileDataToggleButton(), "MobileData"}, {p_NetworkAndCallView->GetMobileDataOptionsView()->GetSystemUpdateToggleButton(), "SystemUpdate"}, {p_NetworkAndCallView->GetMobileDataOptionsView()->GetOnlineMusicToggleButton(), "OnlineMusic"}}; @@ -83,10 +84,29 @@ namespace OHOS if (toggleButton->GetState() == true) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is enable!", it->second.c_str()); + if (it->second == "VoLTE") + { + ConfigModel::GetInstance()->SetVoLTE_Call(true); + + } + else if (it->second == "4GCapability") + { + power_on_cat1(); + ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat()); + } } else { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is disable!", it->second.c_str()); + if (it->second == "VoLTE") + { + ConfigModel::GetInstance()->SetVoLTE_Call(false); + } + else if (it->second == "4GCapability") + { + power_off_cat1(); + ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat()); + } } } return true; @@ -138,4 +158,30 @@ namespace OHOS } return true; } -} \ No newline at end of file +} +#ifdef __cplusplus +#if __cplusplus +extern "C" +{ +#endif /* __cplusplus */ +#endif /* __cplusplus */ + + uint32_t uapi_cat1_power_on(uint32_t pwron); + uint32_t uapi_cat1_reset(uint32_t pwron); + + void power_on_cat1(void) + { + uapi_cat1_power_on(1); + uapi_cat1_reset(0); + } + + void power_off_cat1(void) + { + uapi_cat1_reset(1); + uapi_cat1_power_on(0); + } +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp index a72c484c0..95bef1805 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp @@ -2,6 +2,8 @@ #include "networkandcall/include/NetworkAndCallView.h" #include "wearable_log.h" #include "UiConfig.h" +#include "config/include/ConfigModel.h" +#include "cat1_ctl.h" namespace OHOS { @@ -98,7 +100,7 @@ namespace OHOS Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ int positionY_Img = 120; - const char *text[] = {"VoLTE 通话", "移动数据", "移动数据选项"}; + const char *text[] = {"4G能力", "VoLTE 通话", "移动数据选项"}; for (int i = 0; i < ITEM_NUM; i++) { NetworkAndCallImage[i] = new UIImageView(); // Create a new UIImageView for each iteration @@ -128,27 +130,29 @@ namespace OHOS NetworkAndCallLabel[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); } /* -------------------------------------------------------------------------- */ - VoLTE_toggleButton = new UIToggleButton(); - if (VoLTE_toggleButton == nullptr) + MobileData_toggleButton = new UIToggleButton(); + if (MobileData_toggleButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::MobileData_toggleButton is nullptr!"); return; } - VoLTE_toggleButton->SetPosition(298, 145, 100, 50); - VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + MobileData_toggleButton->SetPosition(298, 145, 100, 50); + MobileData_toggleButton->SetState(uapi_cat1_get_power_stat()); + MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); const char *selectedImg = "/user/res/TOGGLEBUTTON_ON.bin"; const char *unSelectedImg = "/user/res/TOGGLEBUTTON_OFF.bin"; - VoLTE_toggleButton->SetImages(selectedImg, unSelectedImg); + MobileData_toggleButton->SetImages(selectedImg, unSelectedImg); /* -------------------------------------------------------------------------- */ - MobileData_toggleButton = new UIToggleButton(); - if (MobileData_toggleButton == nullptr) + VoLTE_toggleButton = new UIToggleButton(); + if (VoLTE_toggleButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::MobileData_toggleButton is nullptr!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!"); return; } - MobileData_toggleButton->SetPosition(298, 265, 100, 50); - MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - MobileData_toggleButton->SetImages(selectedImg, unSelectedImg); + VoLTE_toggleButton->SetPosition(298, 265, 100, 50); + VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + VoLTE_toggleButton->SetState(ConfigModel::GetInstance()->GetVoLTE_Call()); + VoLTE_toggleButton->SetImages(selectedImg, unSelectedImg); /* ----------------------------- onclickListener ---------------------------- */ UIView::OnClickListener *toggleButtonClick = static_cast(NetworkAndCallPresenter::GetInstance()); VoLTE_toggleButton->SetOnClickListener(toggleButtonClick); diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp index bd714058c..cad3c66a5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootDeviceView.cpp @@ -64,7 +64,9 @@ bool RebootDeviceView::ShowUpRebootDeviceView() } } rebootDeviceButton->SetPosition(172, 147, 110, 110); // 172:x 147:y 110:width 110:height - rebootDeviceButton->SetImageSrc(PNG_REBOOT_BUTTON_IMAGE, PNG_REBOOT_BUTTON_IMAGE); + rebootDeviceButton->SetImageSrc(PNG_SETTINGS_SETTTING_REBOOT, PNG_SETTINGS_SETTTING_REBOOT); + rebootDeviceButton->SetImagePosition(36, 36); + rebootDeviceButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c); rebootDeviceButton->SetViewId(REBOOTDEVICE_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); if (clickListener == nullptr) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp index 4448b5848..b2f20fec8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-21 19:06:02 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-03-21 14:23:19 + * @LastEditTime: 2024-04-25 09:21:08 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp */ #include "rebootdevice/include/RebootPresenter.h" @@ -79,7 +79,7 @@ namespace OHOS RebootView::GetInstance()->ChangeView(SHUTDOWNDEVICEVIEW, SHUTDOWNANIMATORVIEW); start_shutdown_or_reboot(); shutdown_reboot_prejobs(); - + ShutDownAnimatorView::GetInstance()->GeShutDownImageAnimatorView()->Start(); isShutDownOperation = true; } @@ -93,8 +93,9 @@ namespace OHOS { if (strcmp(view.GetViewId(), REBOOT_VIEW) == 0) { - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + // NativeAbility::GetInstance().ChangeSlice(preSlice); + NativeAbility::GetInstance().Back(); } else if (strcmp(view.GetViewId(), REBOOTDEVICE_VIEW) == 0) { @@ -131,8 +132,9 @@ namespace OHOS // 如果是power键,且是亮屏状态,按键释放就返回上一级 if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) { - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + // NativeAbility::GetInstance().ChangeSlice(preSlice); + NativeAbility::GetInstance().Back(); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp index 88f3ed29a..8e5c9c974 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootView.cpp @@ -140,7 +140,9 @@ namespace OHOS } } rebootButton->SetPosition(69, 147, 110, 110); // 69:x 147:y 110:width 110:height - rebootButton->SetImageSrc(PNG_REBOOT_BUTTON_IMAGE, PNG_REBOOT_BUTTON_IMAGE); + rebootButton->SetImageSrc(PNG_SETTINGS_SETTTING_REBOOT, PNG_SETTINGS_SETTTING_REBOOT); + rebootButton->SetImagePosition(36, 36); + rebootButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c); rebootButton->SetViewId(REBOOT_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); if (clickListener == nullptr) @@ -180,7 +182,9 @@ namespace OHOS } } shutdownButton->SetPosition(275, 147, 110, 110); // 275:x 147:y 110:width 110:height - shutdownButton->SetImageSrc(PNG_SHUTDOWN_BUTTON_IMAGE, PNG_SHUTDOWN_BUTTON_IMAGE); + shutdownButton->SetImageSrc(PNG_SETTINGS_SETTTING_SHUTDOWN, PNG_SETTINGS_SETTTING_SHUTDOWN); + shutdownButton->SetImagePosition(36, 36); + shutdownButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36); shutdownButton->SetViewId(SHUTDOWN_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); if (clickListener == nullptr) diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp index 4881c02d5..a56f9fdae 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/ShutdownDeviceView.cpp @@ -64,7 +64,9 @@ bool ShutdownDeviceView::ShowUpShutdownDeviceView() } } shutdownDeviceButton->SetPosition(172, 147, 110, 110); // 172:x 147:y 110:width 110:height - shutdownDeviceButton->SetImageSrc(PNG_SHUTDOWN_BUTTON_IMAGE, PNG_SHUTDOWN_BUTTON_IMAGE); + shutdownDeviceButton->SetImageSrc(PNG_SETTINGS_SETTTING_SHUTDOWN, PNG_SETTINGS_SETTTING_SHUTDOWN); + shutdownDeviceButton->SetImagePosition(36, 36); + shutdownDeviceButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff5a36); shutdownDeviceButton->SetViewId(SHUTDOWNDEVICE_BUTTON); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::RebootPresenter::GetInstance(); if (clickListener == nullptr) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h index 1e8d0c19f..e1fe726a6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h @@ -1,3 +1,10 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-04-08 16:43:48 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-04-24 16:37:10 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h + */ /* * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. * Description: SetDesktopPresenter.h @@ -8,6 +15,7 @@ #ifndef SET_DESKTOP_PRESENTER_H #define SET_DESKTOP_PRESENTER_H +#include "View.h" #include "Presenter.h" #include "components/ui_view.h" @@ -19,17 +27,21 @@ class SetDesktopView; class SetDesktopModel; class SetDesktopPresenter : public Presenter, public UIView::OnClickListener, + public RootView::OnKeyActListener, public UIView::OnDragListener { public: SetDesktopPresenter(); virtual ~SetDesktopPresenter(); + static SetDesktopPresenter *GetInstance(); virtual void OnStart() override; virtual void OnResume() override; virtual void OnStop() override; bool OnClick(UIView &view, const ClickEvent &event) override; - virtual bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 + bool GetHexagonsStyleState(void); private: diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp index 0c361bcb1..cadd1c796 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp @@ -1,3 +1,10 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-04-08 16:43:48 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-04-25 09:24:59 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp + */ /* * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. * Description: SettingPresenter.cpp @@ -8,14 +15,27 @@ #include "SetDesktopView.h" #include "SetDesktopModel.h" #include "SetDesktopPresenter.h" +#include "common/key_code.h" +#include namespace OHOS { + + static SetDesktopPresenter *g_pSetDesktopPresenter = nullptr; + SetDesktopPresenter::SetDesktopPresenter() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::SetDesktopPresenter"); + g_pSetDesktopPresenter=this; } - SetDesktopPresenter::~SetDesktopPresenter() {} + SetDesktopPresenter::~SetDesktopPresenter() { + g_pSetDesktopPresenter = nullptr; + } + + SetDesktopPresenter *SetDesktopPresenter::GetInstance() + { + return g_pSetDesktopPresenter; + } void SetDesktopPresenter::OnStart() { @@ -37,8 +57,9 @@ namespace OHOS { if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnDrag ChangeSlice"); - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + // NativeAbility::GetInstance().ChangeSlice(preSlice); + NativeAbility::GetInstance().Back(); } return false; } @@ -51,12 +72,25 @@ namespace OHOS { } else if (strcmp(view.GetViewId(), SET_DESKTOP_LIST) == 0) { SetDesktopModel::GetInstance().SetDesktopStyle(APPLIST_STYLE); } - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); return true; } bool SetDesktopPresenter::GetHexagonsStyleState(void) { return (SetDesktopModel::GetInstance().GetDesktopStyle() == HEXAGONS_STYLE); } + + bool SetDesktopPresenter::OnKeyAct(UIView &view, const KeyEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::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; + } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp index c5f2b49df..9609c70a5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp @@ -29,6 +29,10 @@ void SetDesktopView::OnStart() container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); container_->SetOnDragListener(presenter_); container_->SetTouchable(true); + + // 增加按键监听 + RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SetDesktopPresenter::GetInstance(); + RootView::GetInstance()->SetOnKeyActListener(keyactListener); } void SetDesktopView::OnSetUpView() diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp index bf2836d41..e37684baa 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-27 19:48:49 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 19:26:32 + * @LastEditTime: 2024-04-24 16:19:53 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp */ @@ -14,16 +14,24 @@ namespace OHOS { static constexpr int16_t SETTING_ICON_X = 19; static constexpr int16_t SETTING_SICON_Y = 19; - static constexpr int16_t SETTING_SLABEL_X = 115; - static constexpr int16_t SETTING_SLABEL_Y = 33; - static constexpr int16_t SETTING_SLABEL_W = 200; - static constexpr int16_t SETTING_SLABEL_H = 40; - static constexpr int16_t SETTING_SNEXTIMAGE_X = 326; - static constexpr int16 SETTING_SLABEL_FONT_SIZE = 30; - static constexpr int16 SETTING_SLABEL_FONT_HEIGHT = 36; - static constexpr int16 SETTING_SBACKGROUND_HEIGHT = 100; - static constexpr int16 NUMS_2 = 2; + static constexpr int16_t SETTING_SICON_W = 62; + static constexpr int16_t SETTING_SICON_H = 62; + static constexpr int16_t SETTINGLABELEXT_X = 115; + static constexpr int16_t SETTINGLABELEXT_Y = 33; + static constexpr int16_t SETTINGLABELEXT_W = 180; + static constexpr int16_t SETTINGLABELEXT_H = 40; + static constexpr int16_t SETTINGLABELEXT_TEXT_FONT = 30; + static constexpr int16_t SETTINGLABELEXT_LINE_HEIGHT = 35; + static constexpr int16_t SETTINGLABELEXT_ROLLSPEED = 40; + + static constexpr int16_t SETTINGLABELBUTTONEXT_X = 0; + static constexpr int16_t SETTINGLABELBUTTONEXT_Y = 0; + static constexpr int16_t SETTINGLABELBUTTONEXT_W = 380; + static constexpr int16_t SETTINGLABELBUTTONEXT_H = 100; + static constexpr int16_t SETTINGLABELBUTTONEXT_TEXT_FONT = 30; + static constexpr int16_t SETTINGLABELBUTTONEXT_LINE_HEIGHT = 35; + SettingItemView::SettingItemView() { SetPosition(0, 120, 380, 120); @@ -47,26 +55,29 @@ namespace OHOS { sItemInfo = itemInfo; Icon.SetSrc(itemInfo.icon); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d", itemInfo.textId); + //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d", itemInfo.textId); settingLabelExt.SetTextId(itemInfo.textId); } void SettingItemView::SetUpChild() { - Icon.SetPosition(SETTING_ICON_X, SETTING_SICON_Y); + Icon.SetPosition(SETTING_ICON_X, SETTING_SICON_Y,SETTING_SICON_W,SETTING_SICON_H); Icon.SetStyle(STYLE_IMAGE_OPA, OPA_OPAQUE); + Icon.SetAutoEnable(false); + Icon.SetResizeMode(UIImageView::FILL); + Icon.SetStyle(STYLE_BORDER_RADIUS,100); - settingLabelExt.SetPosition(115, 33,180,100); - settingLabelExt.SetStyle(STYLE_TEXT_FONT, 30); - settingLabelExt.SetStyle(STYLE_LINE_HEIGHT, 35); + settingLabelExt.SetPosition(SETTINGLABELEXT_X, SETTINGLABELEXT_Y, SETTINGLABELEXT_W, SETTINGLABELEXT_H); + settingLabelExt.SetStyle(STYLE_TEXT_FONT, SETTINGLABELEXT_TEXT_FONT); + settingLabelExt.SetStyle(STYLE_LINE_HEIGHT, SETTINGLABELEXT_LINE_HEIGHT); settingLabelExt.SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); - settingLabelExt.SetRollSpeed(40); - settingLabelExt.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + settingLabelExt.SetRollSpeed(SETTINGLABELEXT_ROLLSPEED); + settingLabelExt.SetFont(DEFAULT_VECTOR_FONT_FILENAME, SETTINGLABELEXT_TEXT_FONT); - settingLabelButtonExt.SetPosition(0, 0, 380, 100); + settingLabelButtonExt.SetPosition(SETTINGLABELBUTTONEXT_X, SETTINGLABELBUTTONEXT_Y, SETTINGLABELBUTTONEXT_W, SETTINGLABELBUTTONEXT_H); settingLabelButtonExt.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - settingLabelButtonExt.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - settingLabelButtonExt.SetStyle(STYLE_LINE_HEIGHT, 35); + settingLabelButtonExt.SetFont(DEFAULT_VECTOR_FONT_FILENAME, SETTINGLABELBUTTONEXT_TEXT_FONT); + settingLabelButtonExt.SetStyle(STYLE_LINE_HEIGHT, SETTINGLABELBUTTONEXT_LINE_HEIGHT); settingLabelButtonExt.SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED); settingLabelButtonExt.SetAlign(TEXT_ALIGNMENT_LEFT); settingLabelButtonExt.SetLabelPosition(115, 0); diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp index 79c3862c6..251c6ed55 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-18 09:09:13 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-23 18:09:47 + * @LastEditTime: 2024-04-25 09:12:06 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp */ #include "SettingModel.h" @@ -22,14 +22,15 @@ namespace OHOS void SettingModel::InitSettingItem() { - settings[0] = {SETTING_ITEM_ZERO, PNG_SETTINGS_DISPLAY_BRIGHTNESS, STR_SCREEN_AND_BRIGHTNESS, true}; - settings[1] = {SETTING_ITEM_ONE, PNG_SETTINGS_NETWORKANDCALL, STR_NETWORKANDCALL, true}; - settings[2] = {SETTING_ITEM_TWO, PNG_SETTINGS_BLUETOOTH, STR_BLUETOOTH, true}; - settings[3] = {SETTING_ITEM_THREE, PNG_SETTINGS_SOUND_VIBRATION, STR_SOUND_AND_VIBRATION, true}; - settings[4] = {SETTING_ITEM_FOUR, PNG_SETTINGS_DISPLAY_MODE, STR_DISPLAY_MODE, true}; - settings[5] = {SETTING_ITEM_FIVE, PNG_SETTINGS_MOTION_RECOGNITION, STR_MOTION_RECOGNITION, true}; - settings[6] = {SETTING_ITEM_SIX, PNG_SETTINGS_SYSTEM, STR_SYSTEM, true}; - settings[7] = {SETTING_ITEM_SEVEN, PNG_SETTINGS_SETTINGS_POWER_CONTROL, STR_SHUTDOWN_AND_RESTART, true}; + int settingLen = 0; + settings[settingLen++] = {SETTING_ITEM_ZERO, PNG_SETTINGS_DISPLAY_BRIGHTNESS, STR_SCREEN_AND_BRIGHTNESS, true}; + settings[settingLen++] = {SETTING_ITEM_ONE, PNG_SETTINGS_NETWORKANDCALL, STR_NETWORKANDCALL, true}; + settings[settingLen++] = {SETTING_ITEM_TWO, PNG_SETTINGS_BLUETOOTH, STR_BLUETOOTH, true}; + settings[settingLen++] = {SETTING_ITEM_THREE, PNG_SETTINGS_SOUND_VIBRATION, STR_SOUND_AND_VIBRATION, true}; + settings[settingLen++] = {SETTING_ITEM_FOUR, PNG_SETTINGS_DISPLAY_MODE, STR_DISPLAY_MODE, true}; + settings[settingLen++] = {SETTING_ITEM_FIVE, PNG_SETTINGS_MOTION_RECOGNITION, STR_MOTION_RECOGNITION, true}; + settings[settingLen++] = {SETTING_ITEM_SIX, PNG_SETTINGS_SYSTEM, STR_SYSTEM, true}; + settings[settingLen++] = {SETTING_ITEM_SEVEN, PNG_SETTINGS_SHUTDOWN_AND_RESTART, STR_SHUTDOWN_AND_RESTART, true}; settingIdToViewId.insert(std::pair(SETTING_ITEM_ZERO, VIEW_DISPLAY_BRIGHTNESS)); settingIdToViewId.insert(std::pair(SETTING_ITEM_ONE, VIEW_NETWORKANDCALL)); settingIdToViewId.insert(std::pair(SETTING_ITEM_TWO, VIEW_CLASSIC_BLUETOOTH)); 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 c129f25a0..7036fff06 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h @@ -91,10 +91,6 @@ namespace OHOS SystemupgradeView *p_SystemupgradeView{nullptr}; UIScrollView *SystemScrollView[10]{nullptr}; UILabelExt *SystemLabel{nullptr}; // 标题 - - UILabelExt *Cat1_4Gability_Label{nullptr}; - UIImageView *Cat1_4Gability_ImageView{nullptr}; - UIToggleButton *Cat1_4Gability_ToggleButton{nullptr}; bool initViewStatus{false}; }; } // namespace OHOS 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 2162ffde4..f32b0afeb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp @@ -85,41 +85,8 @@ namespace OHOS return true; } - extern "C" - { - uint32_t uapi_cat1_power_on(uint32_t pwron); - uint32_t uapi_cat1_reset(uint32_t pwron); - - void power_on_cat1(void) - { - uapi_cat1_power_on(1); - uapi_cat1_reset(0); - } - - void power_off_cat1(void) - { - uapi_cat1_reset(1); - uapi_cat1_power_on(0); - } - } - bool SystemPresenter::OnChange(UICheckBox::UICheckBoxState state) { - switch (state) - { - case UICheckBox::SELECTED: - power_on_cat1(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4g Capability Is Enabled"); - ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat()); - break; - case UICheckBox::UNSELECTED: - power_off_cat1(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4g Capability Is Disabled"); - ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat()); - break; - default: - break; - } return true; } 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 c52e0c9fe..dd4a526ec 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp @@ -85,24 +85,6 @@ namespace OHOS SystemLabel = nullptr; } - if (Cat1_4Gability_Label != nullptr) - { - delete Cat1_4Gability_Label; - Cat1_4Gability_Label = nullptr; - } - - if (Cat1_4Gability_ImageView != nullptr) - { - delete Cat1_4Gability_ImageView; - Cat1_4Gability_ImageView = nullptr; - } - - if (Cat1_4Gability_ToggleButton != nullptr) - { - delete Cat1_4Gability_ToggleButton; - Cat1_4Gability_ToggleButton = nullptr; - } - delete SystemScrollView[SYSTEMVIEW]; SystemScrollView[SYSTEMVIEW] = nullptr; } @@ -159,53 +141,6 @@ namespace OHOS return true; } - /*Cat14G能力开关视图初始化*/ - bool SystemView::Cat1_4GabilityButtonViewInit() - { - Cat1_4Gability_Label = new UILabelExt(); - if (Cat1_4Gability_Label == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " Cat1_4Gability_Label new fail!!"); - return false; - } - Cat1_4Gability_Label->SetPosition(83, 150, 200, 40); - Cat1_4Gability_Label->SetStyle(STYLE_TEXT_FONT, 30); - Cat1_4Gability_Label->SetStyle(STYLE_LINE_HEIGHT, 35); - Cat1_4Gability_Label->SetText("4G能力"); - Cat1_4Gability_Label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - Cat1_4Gability_Label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Cat1_4Gability_Label->SetRollSpeed(0); - Cat1_4Gability_Label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - /* -------------------------------------------------------------------------- */ - Cat1_4Gability_ImageView = new UIImageView(); - if (Cat1_4Gability_ImageView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " Cat1_4Gability_ImageView new fail!!"); - return false; - } - Cat1_4Gability_ImageView->SetPosition(43, 120, 380, 100); - Cat1_4Gability_ImageView->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - Cat1_4Gability_ImageView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - Cat1_4Gability_ImageView->SetStyle(STYLE_BORDER_RADIUS, 100); - /* -------------------------------------------------------------------------- */ - Cat1_4Gability_ToggleButton = new UIToggleButton(); - if (Cat1_4Gability_ToggleButton == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Cat1_4Gability_ToggleButton new fail!!"); - return false; - } - Cat1_4Gability_ToggleButton->SetState(uapi_cat1_get_power_stat()); - Cat1_4Gability_ToggleButton->SetPosition(298, 145, 100, 50); - Cat1_4Gability_ToggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - Cat1_4Gability_ToggleButton->SetStyle(STYLE_BORDER_RADIUS, 50); - const char *toggleButtonselectedImg = "/user/res/TOGGLEBUTTON_ON.bin"; - const char *toggleButtonunSelectedImg = "/user/res/TOGGLEBUTTON_OFF.bin"; - Cat1_4Gability_ToggleButton->SetImages(toggleButtonselectedImg, toggleButtonunSelectedImg); - UICheckBox::OnChangeListener *listener = static_cast(SystemPresenter::GetInstance()); - Cat1_4Gability_ToggleButton->SetOnChangeListener(listener); - return true; - } - UILabelButtonExt *SystemView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener) { UILabelButtonExt *button = new UILabelButtonExt(); @@ -436,8 +371,7 @@ namespace OHOS void SystemView::OnStart() { View::OnStart(); - initView_ext(43, 240, 380, 100, 120, "/user/res/SETTING_NEXT.bin"); - Cat1_4GabilityButtonViewInit(); + initView_ext(43, 120, 380, 100, 120, "/user/res/SETTING_NEXT.bin"); RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SystemPresenter::GetInstance(); RootView::GetInstance()->SetOnKeyActListener(keyactListener); } @@ -452,10 +386,6 @@ namespace OHOS } SystemScrollView[SYSTEMVIEW]->Add(SystemLabel); - SystemScrollView[SYSTEMVIEW]->Add(Cat1_4Gability_ImageView); - SystemScrollView[SYSTEMVIEW]->Add(Cat1_4Gability_Label); - SystemScrollView[SYSTEMVIEW]->Add(Cat1_4Gability_ToggleButton); - int len = sizeof(ViewMapper_t) / sizeof(SystemViewMapper_ext); for (int i = 0; i < len; i++) diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTINGS_POWER_CONTROL.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTINGS_POWER_CONTROL.bin deleted file mode 100644 index daeb8abb1..000000000 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTINGS_POWER_CONTROL.bin and /dev/null differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTINGS_SHUTDOWN_AND_RESTART.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTINGS_SHUTDOWN_AND_RESTART.bin new file mode 100644 index 000000000..cb55abecb Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTINGS_SHUTDOWN_AND_RESTART.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTTING_REBOOT.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTTING_REBOOT.bin new file mode 100644 index 000000000..adae54c1d Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTTING_REBOOT.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTTING_SHUTDOWN.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTTING_SHUTDOWN.bin new file mode 100644 index 000000000..615b3fda2 Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/settings/SETTTING_SHUTDOWN.bin differ diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 4a84c503a..726d60951 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -24,6 +24,7 @@ #include "power_display_service.h" // #include "config/include/ConfigModelC.h" #include "soundandvibration/include/SoundAndVibrationVolumeSettingC.h" +#include "networkandcall/include/NetworkAndCallC.h" #define SUPPORT_NV @@ -226,7 +227,10 @@ void startup_post_init_task(void) initializeVolume(); initializeVibrationModel(); initializeSilentModel(); - + // initializeVoLTECall(); + //initialize4GCapability(); + //initializeMotionRecognition(); + LOS_Msleep(5000); addressbookToRead(NULL); up_report_timer(); @@ -650,6 +654,19 @@ void uapi_setSilentMode(bool isopen) SilentModelSet(isopen); } +//设置4G能力开关是否开启 +void uapi_set4GCapability(bool isopen) +{ + if(isopen) + { + power_on_cat1(); + } + else + { + power_off_cat1(); + } +} + #include "bts_le_gap.h" diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index b11342ba2..633316756 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -63,6 +63,7 @@ void uapi_systemVolumeSet(int16_t sounding); void uapi_callVolumeSet(int16_t sounding); void uapi_vibrationModeSet(int value); void uapi_setSilentMode(bool isopen); +void uapi_set4GCapability(bool isopen); errcode_t uapi_get_btaddr(uint8_t *buf_btaddr, uint32_t *len_btaddr); errcode_t uapi_get_btname(uint8_t *buf_btname, uint32_t *len_btname);