* @Author: luozheng 1732036298@qq.com
* @Date: 2024-08-20 19:16:00
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-22 18:57:46
+ * @LastEditTime: 2024-08-23 15:12:45
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbModel.cpp
*/
#include "dnotdisturb/include/DnotDisturbModel.h"
/*更新主界面下拉界面配置*/
if(DropDownCardPage1::GetInstance() && DropDownCardPage1::GetInstance()->GetDropDownCardPage1_ToggleButton(DropDownCardPage1::toggleButton_DNOTDISTURB))
{
- DropDownCardPage1::GetInstance()->GetDropDownCardPage1_ToggleButton(DropDownCardPage1::toggleButton_DNOTDISTURB)->SetState(GetDoNotDisturbModeEnabled());
+ // DropDownCardPage1::GetInstance()->GetDropDownCardPage1_ToggleButton(DropDownCardPage1::toggleButton_DNOTDISTURB)->SetState(GetDoNotDisturbModeEnabled());
+ DropDownCardPage1::GetInstance()->UpdateDnotdisturbState(GetDoNotDisturbModeEnabled());
}
PullUpDownView::GetInstance()->UpdateDnotDisturbStatus(GetDoNotDisturbModeEnabled());
/*更新主界面配置*/
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-08-21 11:54:00
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-22 18:54:22
+ * @LastEditTime: 2024-08-23 15:26:00
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp
*/
#include "main/include/dropdown/DropDownCardPage1.h"
}
else if (viewId == DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID) // 勿扰开关
{
- state = toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB]->GetState();
- DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(state);
+ if (uapi_dev_runtime_get_sleep_monitoring_status())
+ {
+ return true;
+ }
+
+ if (DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled() == false)
+ {
+ NativeAbility::GetInstance().EnterSlice(VIEW_DNOTDISTURB);
+ }
+ else
+ {
+ state = toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB]->GetState();
+ UpdateDnotdisturbState(state);
+ DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(state);
+ }
}
else if (viewId == DROPDOWN_SETTING_TOGGLEBUTTON_VIEWID) // 设置
{
{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},
- {165, 100, 100, 100, DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID, DROPDOWN_DNOTDISTURB_ON_IMAGE, DROPDOWN_DNOTDISTURB_OFF_IMAGE, true, state_dnotdisturb},
+ {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},
};
{
return toggleButton[index];
}
+
+ void DropDownCardPage1::UpdateDnotdisturbState(bool state)
+ {
+ if (toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB] != nullptr)
+ {
+ const char *ImageSrc = state ? DROPDOWN_DNOTDISTURB_ON_IMAGE : DROPDOWN_DNOTDISTURB_OFF_IMAGE;
+ toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB]->SetImages(ImageSrc, ImageSrc);
+ }
+ }
}
\ No newline at end of file