From: luozheng <1732036298@qq.com> Date: Sat, 24 Aug 2024 02:21:35 +0000 (+0800) Subject: 更改下拉蓝牙图标 X-Git-Tag: release_V1.2.70_20241020_135402~563^2~37 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d5ae0657eb76f8a69d6081babeec47558acf08b0;p=mirrors%2FFD230.git 更改下拉蓝牙图标 添加睡眠图标更新函数,还未适配接口等待联调 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/dropdown/DropDownCardPage1.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/dropdown/DropDownCardPage1.h index a424858d6..c72d98d17 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/dropdown/DropDownCardPage1.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/dropdown/DropDownCardPage1.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-21 11:54:00 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-23 15:00:47 + * @LastEditTime: 2024-08-24 10:15:32 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/dropdown/DropDownCardPage1.h */ #ifndef __DROPDOWN_CARD_PAGE1_H__ @@ -50,6 +50,7 @@ namespace OHOS UIToggleButton *GetDropDownCardPage1_ToggleButton(int index); void UpdateDnotdisturbState(bool state); + void UpdateSleepModelState(bool state); private: UIToggleButton *ToggleButtonInit(ToggleButtonConfig &toggleButtonConfig); diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp index acf961624..87e58c309 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-21 11:54:00 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-23 15:26:00 + * @LastEditTime: 2024-08-24 10:19:09 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp */ #include "main/include/dropdown/DropDownCardPage1.h" @@ -31,6 +31,7 @@ namespace OHOS // Image src static constexpr const char *DROPDOWN_BT_CONNECT_IMAGE = "/user/res/dropdown/DROPDOWN_BT_CONNECT.bin"; static constexpr const char *DROPDOWN_BT_DISCONNECT_IMAGE = "/user/res/dropdown/DROPDOWN_BT_DISCONNECT.bin"; + static constexpr const char *DROPDOWN_BT_IMAGE = "/user/res/dropdown/DROPDOWN_BT.bin"; static constexpr const char *DROPDOWN_4G_ON_IMAGE = "/user/res/dropdown/DROPDOWN_4G_ON.bin"; static constexpr const char *DROPDOWN_4G_OFF_IMAGE = "/user/res/dropdown/DROPDOWN_4G_OFF.bin"; @@ -76,16 +77,7 @@ namespace OHOS if (viewId == DROPDOWN_BT_TOGGLEBUTTON_VIEWID) // 蓝牙开关 { state = toggleButton[DropDownCardPage1::toggleButton_BT]->GetState(); - if (state) - { - start_custom_ble_service(); // 主动开启蓝牙 - ConfigModel::GetInstance()->SetClassicBlueToothState(true); - } - else - { - stop_custom_ble_service(); - ConfigModel::GetInstance()->SetClassicBlueToothState(false); - } + NativeAbility::GetInstance().EnterSlice(VIEW_CLASSIC_BLUETOOTH); } else if (viewId == DROPDOWN_4G_TOGGLEBUTTON_VIEWID) // 4G开关 { @@ -189,11 +181,11 @@ namespace OHOS bool state_dnotdisturb = DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled(); ToggleButtonConfig toggleButtonConfig[] = { - {0, 0, 100, 100, DROPDOWN_BT_TOGGLEBUTTON_VIEWID, DROPDOWN_BT_CONNECT_IMAGE, DROPDOWN_BT_DISCONNECT_IMAGE, true, state_bt}, + {0, 0, 100, 100, DROPDOWN_BT_TOGGLEBUTTON_VIEWID, DROPDOWN_BT_IMAGE, DROPDOWN_BT_IMAGE, true, true}, {110, 0, 100, 100, DROPDOWN_4G_TOGGLEBUTTON_VIEWID, DROPDOWN_4G_ON_IMAGE, DROPDOWN_4G_OFF_IMAGE, true, state_4g}, {220, 0, 100, 100, DROPDOWN_ALIPAY_TOGGLEBUTTON_VIEWID, DROPDOWN_ALIPAY_IMAGE, DROPDOWN_ALIPAY_IMAGE, true, true}, {330, 0, 100, 100, DROPDOWN_SAVEPOWER_TOGGLEBUTTON_VIEWID, state_savepower ? DROPDOWN_SAVEPOWER_ON_IMAGE : DROPDOWN_SAVEPOWER_OFF_IMAGE, state_savepower ? DROPDOWN_SAVEPOWER_ON_IMAGE : DROPDOWN_SAVEPOWER_OFF_IMAGE, true, state_savepower}, - {55, 100, 100, 100, DROPDOWN_SLEEP_TOGGLEBUTTON_VIEWID, DROPDOWN_SLEEP_ON_IMAGE, DROPDOWN_SLEEP_OFF_IMAGE, true, state_sleep}, + {55, 100, 100, 100, DROPDOWN_SLEEP_TOGGLEBUTTON_VIEWID, state_sleep ? DROPDOWN_SLEEP_ON_IMAGE : DROPDOWN_SLEEP_OFF_IMAGE, state_sleep ? DROPDOWN_SLEEP_ON_IMAGE : DROPDOWN_SLEEP_OFF_IMAGE, true, state_sleep}, {165, 100, 100, 100, DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID, state_dnotdisturb ? DROPDOWN_DNOTDISTURB_ON_IMAGE : DROPDOWN_DNOTDISTURB_OFF_IMAGE, state_dnotdisturb ? DROPDOWN_DNOTDISTURB_ON_IMAGE : DROPDOWN_DNOTDISTURB_OFF_IMAGE, true, state_dnotdisturb}, {275, 100, 100, 100, DROPDOWN_SETTING_TOGGLEBUTTON_VIEWID, DROPDOWN_SETTING_IMAGE, DROPDOWN_SETTING_IMAGE, true, true}, }; @@ -239,4 +231,14 @@ namespace OHOS toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB]->SetImages(ImageSrc, ImageSrc); } } + + // 更新睡眠模式开关 + void DropDownCardPage1::UpdateSleepModelState(bool state) + { + if (toggleButton[DropDownCardPage1::toggleButton_SLEEP] != nullptr) + { + const char *ImageSrc = state ? DROPDOWN_SLEEP_ON_IMAGE : DROPDOWN_SLEEP_OFF_IMAGE; + toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB]->SetImages(ImageSrc, ImageSrc); + } + } } \ No newline at end of file diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dropdown/DROPDOWN_BT.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dropdown/DROPDOWN_BT.bin new file mode 100644 index 000000000..a068ab0bb --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dropdown/DROPDOWN_BT.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efec424a5d8eb26475b141ebd7c5df51af2a8405cb8cbdf4326b710a9ffb0478 +size 6824