* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-28 11:50:42
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-11 14:41:49
+ * @LastEditTime: 2024-07-11 19:35:30
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootModel.cpp
*/
#include <AppViewIDs.h>
#include "power_display_service.h"
#include "aimodels/include/AiModelsModel.h"
+#include "themestyle/include/ThemeStyleModel.h"
+
namespace OHOS
{
RebootModel::RebootModel() {}
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandlePowerKeyDoubleClick");
// Handle PowerKey DoubleClick logic here
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();
+ if (!display_api)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "power_display_svr_get_api returned nullptr");
+ return;
+ }
+
+ if (display_api->get_screen_state() == SCREEN_ON)
+ {
+ // ThemeStyleModel &themeStyleModel = ThemeStyleModel::GetInstance();
+ // ThemeStyle style = themeStyleModel.GetAppListDisplayStyle();
+ // themeStyleModel.SwitchApplistStyleOnPowerClick(); // 切换样式
+ // uint16_t sliceId = NativeAbility::GetInstance().GetCurSliceId();
+ // if (sliceId == VIEW_APPLIST)
+ // {
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ZOOM);
+ // }
+ NativeAbility::GetInstance().EnterSlice(VIEW_THEME_STYLE);
+ }
+ else
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Screen is not on, skipping applist style change");
+ }
}
/*注册电源键的双击事件*/
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootModel::RegisterPowerKeyDoubleClickEvent");
// Register PowerKey DoubleClick event here
+ int32_t ret = uapi_button_register_event_cb(HandlePowerKeyDoubleClick, BUTTON_PWR_CLICKUP_2);
+ if (ret != ERRCODE_SUCC)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Register FuncKey Click Event error, ret = %d", ret);
+ return false;
+ }
return true;
}
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-14 09:40:13
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-06 16:43:47
+ * @LastEditTime: 2024-07-11 17:17:52
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h
*/
#ifndef SET_THEMESTYLE_MODEL_H
static ThemeStyleModel &GetInstance(void);
ThemeStyle GetAppListDisplayStyle(void);
void SetAppListDisplayStyle(ThemeStyle style);
+ void SwitchApplistStyleOnPowerClick(void);
private:
ThemeStyleModel();
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-07 09:21:47
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-06 16:43:52
+ * @LastEditTime: 2024-07-11 17:52:54
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/ThemeStyleModel.cpp
*/
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetAppListDisplayStyle fail!!");
}
}
+
+ /*通过power建切换applist的样式*/
+ void ThemeStyleModel::SwitchApplistStyleOnPowerClick(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleModel::SwitchApplistStyleOnPowerClick");
+ uint16_t style = GetAppListDisplayStyle();
+ style += 1;
+ if (style == FOOTBALL_STYLE)
+ {
+ style += 1;
+ }
+ if (style >= MAX_THEME_STYLE)
+ {
+ style = APPLIST_STYLE;
+ }
+ SetAppListDisplayStyle(static_cast<ThemeStyle>(style));
+ return;
+ }
}