From: xue <2144439972@qq.com> Date: Wed, 24 Sep 2025 12:22:37 +0000 (+0800) Subject: 增加选择表情切换 X-Git-Tag: V1.0.9_20251128_194606_LN~250^2~56 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=202b46b273c04314d4efe3b6b104d0551341f3e5;p=mirrors%2FFD230.git 增加选择表情切换 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index 0d156a71f..2c6005feb 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -165,6 +165,9 @@ namespace OHOS // 任务提醒处理函数 void HandleTaskReminder(const char* scheduleName); + + // 表情切换函数 + bool SwitchExpression(const char* eyeShape, const char* eyeColor); private: ThunderBirdModel(); diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index 1c0293e6a..e5705a6f4 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -1471,6 +1471,31 @@ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Processing task reminder: %s", scheduleName); } } + bool ThunderBirdModel::SwitchExpression(const char* eyeShape, const char* eyeColor) + { + // 参数验证 + if (eyeShape == nullptr || eyeColor == nullptr) { + return false; + } + + // 构建表情文件路径:/user/res/video/CloseEyes/{eyeShape}/{eyeColor}.mp4 + std::string expressionPath = "/user/res/video/CloseEyes/"; + expressionPath += eyeShape; + expressionPath += "/"; + expressionPath += eyeColor; + expressionPath += ".mp4"; + + // 通过图形服务调用 ThunderBirdMainView 的 SwitchVideo 函数 + bool result = false; + GraphicService::GetInstance()->PostGraphicEvent( + [expressionPath, &result]() { + if (ThunderBirdMainView::GetInstance()) { + result = ThunderBirdMainView::GetInstance()->SwitchVideo(expressionPath.c_str()); + } + }); + + return result; + } } \ No newline at end of file