CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES, //运动目标站立次数
CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION, //运动目标时长
CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE, //运动目标距离
+ CONFIGMODEL_ITEM_DNOTDISTURB,//勿扰模式
CONFIGMODEL_ITEM_MAX,
} ;
void SetCat1_4Gability(bool state);
bool GetCat1_4Gability();
+
+ void SetDnotdisturb(bool state);
+ bool GetDnotdisturb(void);
// -------------------------------------------------------------------------- */
private:
{ConfigDataType::DATATYPE_INT, "GoalStandupTimes", "10" },// CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES, //运动目标站立次数 10
{ConfigDataType::DATATYPE_INT, "GoalDuration", "30" },// CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION, //运动目标时长 30(分钟)
{ConfigDataType::DATATYPE_DOUBLE, "GoalDistance", "8.0" },// CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE, //运动目标距离 8.0(km)
+ {ConfigDataType::DATATYPE_BOOL, "Dnotdisturb", "false" },// CONFIGMODEL_ITEM_DNOTDISTURB //勿扰模式默认关闭
};
ConfigModel(); // 私有构造函数,确保无法在外部实例化
ConfigModel(const ConfigModel &) = delete; // 禁止拷贝构造
return get_configData_bool(CONFIGMODEL_ITEM_CAT1_SERVICE_ON);
}
+ /*设置勿扰模式是否开启*/
+ void ConfigModel::SetDnotdisturb(bool state)
+ {
+ set_condigData_Bool(CONFIGMODEL_ITEM_DNOTDISTURB,state);
+ }
+
+ /*获取勿扰模式是否开启*/
+ bool ConfigModel::GetDnotdisturb(void)
+ {
+ return get_configData_bool(CONFIGMODEL_ITEM_DNOTDISTURB);
+ }
+
/* ---------------------------------------------------------------------------- */
int ConfigModel::get_configData_int(ConfigItem item)
{
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 16:38:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-10 16:44:52
+ * @LastEditTime: 2024-04-16 11:40:33
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbModel.h
*/
#ifndef DNOTDISTURB_MODEL_H
DnotDisturbModel &operator=(const DnotDisturbModel &) = delete;
virtual ~DnotDisturbModel();
- bool isDoNotDisturbModeEnabled = false; // 默认勿扰模式未开启
+ //bool isDoNotDisturbModeEnabled = false; // 默认勿扰模式未开启
};
}
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-04-10 16:38:52
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-04-16 11:37:40
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbModel.cpp
+ */
#include "dnotdisturb/include/DnotDisturbModel.h"
-
+#include "config/include/ConfigModel.h"
namespace OHOS
{
void DnotDisturbModel::SetDoNotDisturbModeEnabled(bool enabled)
{
- isDoNotDisturbModeEnabled = enabled;
+ //isDoNotDisturbModeEnabled = enabled;
+ ConfigModel::GetInstance()->SetDnotdisturb(enabled);
}
bool DnotDisturbModel::GetDoNotDisturbModeEnabled() const
{
- return isDoNotDisturbModeEnabled;
+ //return isDoNotDisturbModeEnabled;
+ return ConfigModel::GetInstance()->GetDnotdisturb();
}
}
\ No newline at end of file
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 11:58:37
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-10 16:45:23
+ * @LastEditTime: 2024-04-16 11:09:23
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp
*/
#include "AppViewIDs.h"
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::GetInstance fail!!");
return false;
}
- if (&view == p_DnotDisturbView->GetButtonOn())
+ if (&view == p_DnotDisturbView->GetButtonOn())//开启勿扰模式
{
DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(true);
uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
}
else if (&view == p_DnotDisturbView->GetButtonOff())
{
- DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(false);
+ //DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(false);
uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
NativeAbility::GetInstance().ChangeSlice(preSlice);
}
bool InitView();
void PreLoad(void) override;
void UpdateBlueToothStatus(int status);
-
+ void UpdateDnotDisturbStatus(int status);
private:
UIImageView *dropSetting{nullptr}; // 设置
UIImageView *dropLighting{nullptr}; // 亮屏
#include "DialModelPower.h"
#include "gfx_utils/mem_check.h"
#include "traing/training_card/include/Training_CardView.h"
+#include "dnotdisturb/include/DnotDisturbModel.h"
#if USE_OFFLINE_DIAL
#include "DialViewGroup.h"
#endif
#endif
}
+ //如果勿扰模式是开启状态,在下拉界面点击勿扰快捷入口会关闭勿扰模式不进入勿扰视图
+ if(g_jumpView[curViewId] == VIEW_DNOTDISTURB && DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled() == true)
+ {
+ PullUpDownView::GetInstance()->UpdateDnotDisturbStatus(false);
+ DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(false);
+ return true;
+ }
+
if (g_jumpView.count(curViewId) != 0)
{
NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId]);
return;
}
+ /*更新勿扰模式状态*/
+ void PullUpDownView::UpdateDnotDisturbStatus(int status)
+ {
+ if (dropIconBackground[DNOTDISTURB_INDEX] != nullptr)
+ {
+ if (status)
+ {
+ ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropIconBackground[DNOTDISTURB_INDEX], DROPDOWN_ICONELLIPSEPURPLE);
+ }
+ else
+ {
+ ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropIconBackground[DNOTDISTURB_INDEX], DROPDOWN_ICONELLIPSEBLACK);
+ }
+ dropIconBackground[DNOTDISTURB_INDEX]->Invalidate();
+ }
+ else
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropIconBackground[DNOTDISTURB_INDEX] is nullptr");
+ return;
+ }
+ }
+
}