From 168cbdf46937ef08e76828852da9d2522d94d698 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Thu, 11 Apr 2024 15:35:03 +0800 Subject: [PATCH 1/7] [NDK] animate api Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- arkui/ace_engine/native/BUILD.gn | 1 + arkui/ace_engine/native/libace.ndk.json | 64 ++++++ arkui/ace_engine/native/native_animate.h | 228 +++++++++++++++++++++ arkui/ace_engine/native/native_interface.h | 2 + arkui/ace_engine/native/native_type.h | 24 +++ 5 files changed, 319 insertions(+) create mode 100644 arkui/ace_engine/native/native_animate.h diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn index 2539ea4d5..122bd3689 100644 --- a/arkui/ace_engine/native/BUILD.gn +++ b/arkui/ace_engine/native/BUILD.gn @@ -26,6 +26,7 @@ if (!is_arkui_x) { ohos_ndk_headers("arkui_header") { dest_dir = "$ndk_headers_out_dir/arkui/" sources = [ + "native_animate.h", "native_dialog.h", "native_event.h", "native_gesture.h", diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index f8e09b745..f0b74c921 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -462,5 +462,69 @@ { "first_introduced": "12", "name": "OH_ArkUI_GetModuleInterface" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_Create" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_Dispose" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_GetDuration" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_GetTempo" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_GetCurve" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_GetDelay" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_GetIterations" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_GetPlayMode" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_GetExpectedFrameRateRange" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_SetDuration" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_SetTempo" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_SetCurve" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_SetDelay" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_SetIterations" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_SetPlayMode" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_AnimateOption_SetExpectedFrameRateRange" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_animate.h b/arkui/ace_engine/native/native_animate.h new file mode 100644 index 000000000..cb0bb67b9 --- /dev/null +++ b/arkui/ace_engine/native/native_animate.h @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ARKUI_NATIVE_ANIMATE_H +#define ARKUI_NATIVE_ANIMATE_H + +#include + +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** +* @brief 设置动画的期望帧率。 +* +* @since 12 +*/ +typedef struct { + /** 期望的最小帧率。*/ + uint32_t min; + /** 期望的最大帧率。*/ + uint32_t max; + /** 期望的最优帧率。*/ + uint32_t expected; +} ArkUI_ExpectedFrameRateRange; + +/** +* @brief 动画播放完成回调类型。 +* +* @since 12 +*/ +typedef struct { + /** 在动画中定义onFinish回调的类型。*/ + ArkUI_FinishCallbackType type; + /** 动画播放完成回调。*/ + void (*callback)(void* userData); + /** 自定义类型。*/ + void* userData; +} ArkUI_AnimateCompleteCallback; + +/** +* @brief 设置动画效果相关参数。 +* +* @since 12 +*/ +typedef struct ArkUI_AnimateOption ArkUI_AnimateOption; + +/** + * @brief ArkUI提供的Native侧动画接口集合。 + * + * @version 1 + * @since 12 + */ +typedef struct { + /** + * @brief 显式动画接口 + * + * @note event闭包中要设置的组件属性,必须在其之前设置过。 + * + * @param option 设置动画效果相关参数。 + * @param update 指定动效的闭包函数,在闭包函数中导致的状态变化系统会自动插入过渡动画。 + * @param complete 设置动画播放完成回调参数。 + * @return 返回错误码,0 - 成功, 401 - 参数错误。 + */ + int32_t (*animateTo)( + ArkUI_AnimateOption* option, ArkUI_ContextCallback* update, ArkUI_AnimateCompleteCallback* complete); +} ArkUI_NativeAnimateAPI_1; + +/** +* @brief 创建动画效果参数。 +* +* @return 新的动画效果参数指针。 +* @since 12 +*/ +ArkUI_AnimateOption* OH_ArkUI_AnimateOption_Create(); + +/** +* @brief 销毁动画效果参数指针。 +* +* @since 12 +*/ +void OH_ArkUI_AnimateOption_Dispose(ArkUI_AnimateOption* option); + +/** +* @brief 获取动画持续时间,单位为ms(毫秒)。 +* +* @param option 动画效果参数。 +* @return 持续时间。 +* @since 12 +*/ +uint32_t OH_ArkUI_AnimateOption_GetDuration(ArkUI_AnimateOption* option); + +/** +* @brief 获取动画播放速度。 +* +* @param option 动画效果参数。 +* @return 动画播放速度。 +* @since 12 +*/ +float OH_ArkUI_AnimateOption_GetTempo(ArkUI_AnimateOption* option); + +/** +* @brief 获取动画曲线。 +* +* @param option 动画效果参数。 +* @return 动画曲线。 +* @since 12 +*/ +ArkUI_AnimationCurve OH_ArkUI_AnimateOption_GetCurve(ArkUI_AnimateOption* option); + +/** +* @brief 获取动画延迟播放时间,单位为ms(毫秒)。 +* +* @param option 动画效果参数。 +* @return 动画延迟播放时间。 +* @since 12 +*/ +int32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option); + +/** +* @brief 获取动画播放次数。 +* +* @param option 动画效果参数。 +* @return 动画播放次数。 +* @since 12 +*/ +int32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option); + +/** +* @brief 获取动画播放模式。 +* +* @param option 动画效果参数。 +* @return 动画播放模式。 +* @since 12 +*/ +ArkUI_AnimationPlayMode OH_ArkUI_AnimateOption_GetPlayMode(ArkUI_AnimateOption* option); + +/** +* @brief 获取动画的期望帧率。 +* +* @param option 动画效果参数。 +* @return 动画的期望帧率。 +* @since 12 +*/ +ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimateOption_GetExpectedFrameRateRange(ArkUI_AnimateOption* option); + +/** +* @brief 设置动画持续时间。 +* +* @param option 动画效果参数。 +* @param value 持续时间,单位为ms(毫秒)。 +* @since 12 +*/ +void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, int32_t value); + +/** +* @brief 设置动画播放速度。 +* +* @param option 动画效果参数。 +* @param value 动画播放速度。 +* @since 12 +*/ +void OH_ArkUI_AnimateOption_SetTempo(ArkUI_AnimateOption* option, float value); + +/** +* @brief 设置动画曲线。 +* +* @param option 动画效果参数。 +* @param value 动画曲线。 +* @since 12 +*/ +void OH_ArkUI_AnimateOption_SetCurve(ArkUI_AnimateOption* option, ArkUI_AnimationCurve value); + +/** +* @brief 设置动画延迟播放时间。 +* +* @param option 动画效果参数。 +* @param value 动画延迟播放时间。 +* @since 12 +*/ +void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, int32_t value); + +/** +* @brief 设置动画播放次数。 +* +* @param option 动画效果参数。 +* @param value 动画播放次数。 +* @since 12 +*/ +void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, int32_t value); + +/** +* @brief 设置动画播放模式。 +* +* @param option 动画效果参数。 +* @param value 动画播放模式。 +* @since 12 +*/ +void OH_ArkUI_AnimateOption_SetPlayMode(ArkUI_AnimateOption* option, ArkUI_AnimationPlayMode value); + +/** +* @brief 设置动画的期望帧率。 +* +* @param option 动画效果参数。 +* @param value 动画的期望帧率。 +* @since 12 +*/ +void OH_ArkUI_AnimateOption_SetExpectedFrameRateRange(ArkUI_AnimateOption* option, ArkUI_ExpectedFrameRateRange* value); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_ANIMATE_H \ No newline at end of file diff --git a/arkui/ace_engine/native/native_interface.h b/arkui/ace_engine/native/native_interface.h index ba288efaf..2d859edbe 100644 --- a/arkui/ace_engine/native/native_interface.h +++ b/arkui/ace_engine/native/native_interface.h @@ -54,6 +54,8 @@ typedef enum { ARKUI_NATIVE_DIALOG, /** API related to gestures. For details, see the struct definition in . */ ARKUI_NATIVE_GESTURE, + /** 动画相关接口类型。*/ + ARKUI_NATIVE_ANIMATE, } ArkUI_NativeAPIVariantKind; /** diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index a2fd4874e..94cb22096 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -91,6 +91,18 @@ typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandle; */ typedef struct ArkUI_WaterFlowSectionOption ArkUI_WaterFlowSectionOption; +/** + * @brief 事件回调类型。 + * + * @since 12 + */ +typedef struct { + /** 自定义类型。*/ + void* userData; + /** 事件回调。*/ + void(*callback)(void* userData); +} ArkUI_ContextCallback; + /** * @brief Provides the number types of ArkUI in the native code. * @@ -1369,6 +1381,18 @@ typedef struct { int32_t y; } ArkUI_IntOffset; +/** + * @brief 在动画中定义onFinish回调的类型。 + * + * @since 12 + */ +typedef enum { + /** 当整个动画结束并立即删除时,将触发回调。 */ + ARKUI_FINISH_CALLBACK_REMOVED = 0, + /** 当动画在逻辑上处于下降状态,但可能仍处于其长尾状态时,将触发回调。*/ + ARKUI_FINISH_CALLBACK_LOGICALLY, +} ArkUI_FinishCallbackType; + /** * @brief Creates a size constraint. * -- Gitee From 8c04efd5726f538509074094664fcf1d5ca4c2e0 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Thu, 11 Apr 2024 22:52:57 +0800 Subject: [PATCH 2/7] [NDK] animate api Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- arkui/ace_engine/native/libace.ndk.json | 4 + arkui/ace_engine/native/native_animate.h | 145 +++++++++++---------- arkui/ace_engine/native/native_interface.h | 2 +- arkui/ace_engine/native/native_node_napi.h | 13 ++ arkui/ace_engine/native/native_type.h | 29 ++++- 5 files changed, 117 insertions(+), 76 deletions(-) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index f0b74c921..4c7ccdad1 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -526,5 +526,9 @@ { "first_introduced": "12", "name": "OH_ArkUI_AnimateOption_SetExpectedFrameRateRange" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_GetContextFromNapiValue" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_animate.h b/arkui/ace_engine/native/native_animate.h index cb0bb67b9..d79eb8d56 100644 --- a/arkui/ace_engine/native/native_animate.h +++ b/arkui/ace_engine/native/native_animate.h @@ -25,198 +25,207 @@ extern "C" { #endif /** -* @brief 设置动画的期望帧率。 +* @brief Defines the expected frame rate range of the animation. * * @since 12 */ typedef struct { - /** 期望的最小帧率。*/ + /** Expected minimum frame rate. */ uint32_t min; - /** 期望的最大帧率。*/ + /** Expected maximum frame rate. */ uint32_t max; - /** 期望的最优帧率。*/ + /** Expected optimal frame rate. */ uint32_t expected; } ArkUI_ExpectedFrameRateRange; /** -* @brief 动画播放完成回调类型。 +* @brief Defines the callback type for when the animation playback is complete. * * @since 12 */ typedef struct { - /** 在动画中定义onFinish回调的类型。*/ + /** Type of the onFinish callback. */ ArkUI_FinishCallbackType type; - /** 动画播放完成回调。*/ + /** Callback invoked when the animation playback is complete. */ void (*callback)(void* userData); - /** 自定义类型。*/ + /** Custom type. */ void* userData; } ArkUI_AnimateCompleteCallback; /** -* @brief 设置动画效果相关参数。 +* @brief Defines the animation configuration. * * @since 12 */ typedef struct ArkUI_AnimateOption ArkUI_AnimateOption; /** - * @brief ArkUI提供的Native侧动画接口集合。 + * @brief Implements the native animation APIs provided by ArkUI. * * @version 1 * @since 12 */ typedef struct { /** - * @brief 显式动画接口 + * @brief Defines an explicit animation. * - * @note event闭包中要设置的组件属性,必须在其之前设置过。 + * @note Make sure the component attributes to be set in the event closure have been set before. * - * @param option 设置动画效果相关参数。 - * @param update 指定动效的闭包函数,在闭包函数中导致的状态变化系统会自动插入过渡动画。 - * @param complete 设置动画播放完成回调参数。 - * @return 返回错误码,0 - 成功, 401 - 参数错误。 + * @param context UIContext。 + * @param option Indicates the pointer to an animation configuration. + * @param update Indicates the animation closure. The system automatically inserts a transition animation + * for the state change caused by the closure. + * @param complete Indicates the callback to be invoked when the animation playback is complete. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. */ - int32_t (*animateTo)( - ArkUI_AnimateOption* option, ArkUI_ContextCallback* update, ArkUI_AnimateCompleteCallback* complete); + int32_t (*animateTo)(ArkUI_ContextHandle context, ArkUI_AnimateOption* option, ArkUI_ContextCallback* update, + ArkUI_AnimateCompleteCallback* complete); } ArkUI_NativeAnimateAPI_1; /** -* @brief 创建动画效果参数。 +* @brief Defines the animation configuration. * -* @return 新的动画效果参数指针。 +* @since 12 +*/ +typedef struct ArkUI_AnimateOption ArkUI_AnimateOption; + +/** +* @brief Creates an animation configuration. +* +* @return Returns the pointer to the created animation configuration. * @since 12 */ ArkUI_AnimateOption* OH_ArkUI_AnimateOption_Create(); /** -* @brief 销毁动画效果参数指针。 +* @brief Destroys an animation configuration. * * @since 12 */ void OH_ArkUI_AnimateOption_Dispose(ArkUI_AnimateOption* option); /** -* @brief 获取动画持续时间,单位为ms(毫秒)。 +* @brief Obtains the animation duration, in milliseconds. * -* @param option 动画效果参数。 -* @return 持续时间。 +* @param option Indicates the pointer to an animation configuration. +* @return Returns the duration. * @since 12 */ uint32_t OH_ArkUI_AnimateOption_GetDuration(ArkUI_AnimateOption* option); /** -* @brief 获取动画播放速度。 +* @brief Obtains the animation playback speed. * -* @param option 动画效果参数。 -* @return 动画播放速度。 +* @param option Indicates the pointer to an animation configuration. +* @return Returns the animation playback speed. * @since 12 */ float OH_ArkUI_AnimateOption_GetTempo(ArkUI_AnimateOption* option); /** -* @brief 获取动画曲线。 +* @brief Obtains the animation curve. * -* @param option 动画效果参数。 -* @return 动画曲线。 +* @param option Indicates the pointer to an animation configuration. +* @return Returns the animated curve. * @since 12 */ ArkUI_AnimationCurve OH_ArkUI_AnimateOption_GetCurve(ArkUI_AnimateOption* option); /** -* @brief 获取动画延迟播放时间,单位为ms(毫秒)。 +* @brief Obtains the animation delay, in milliseconds. * -* @param option 动画效果参数。 -* @return 动画延迟播放时间。 +* @param option Indicates the pointer to an animation configuration. +* @return Returns the animation delay. * @since 12 */ -int32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option); +uint32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option); /** -* @brief 获取动画播放次数。 +* @brief Obtains the number of times that an animation is played. * -* @param option 动画效果参数。 -* @return 动画播放次数。 +* @param option Indicates the pointer to an animation configuration. +* @return Returns the number of times that the animation is played. * @since 12 */ -int32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option); +uint32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option); /** -* @brief 获取动画播放模式。 +* @brief Obtains the animation playback mode. * -* @param option 动画效果参数。 -* @return 动画播放模式。 +* @param option Indicates the pointer to an animation configuration. +* @return Returns the animation playback mode. * @since 12 */ ArkUI_AnimationPlayMode OH_ArkUI_AnimateOption_GetPlayMode(ArkUI_AnimateOption* option); /** -* @brief 获取动画的期望帧率。 +* @brief Obtains the expected frame rate range of an animation. * -* @param option 动画效果参数。 -* @return 动画的期望帧率。 +* @param option Indicates the pointer to an animation configuration. +* @return Returns the expected frame rate range. * @since 12 */ ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimateOption_GetExpectedFrameRateRange(ArkUI_AnimateOption* option); /** -* @brief 设置动画持续时间。 +* @brief Sets the animation duration. * -* @param option 动画效果参数。 -* @param value 持续时间,单位为ms(毫秒)。 +* @param option Indicates the pointer to an animation configuration. +* @param value Indicates the duration, in milliseconds. * @since 12 */ -void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, int32_t value); +void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, uint32_t value); /** -* @brief 设置动画播放速度。 +* @brief Sets the animation playback speed. * -* @param option 动画效果参数。 -* @param value 动画播放速度。 +* @param option Indicates the pointer to an animation configuration. +* @param value Indicates the animation playback speed. * @since 12 */ void OH_ArkUI_AnimateOption_SetTempo(ArkUI_AnimateOption* option, float value); /** -* @brief 设置动画曲线。 +* @brief Sets the animation curve. * -* @param option 动画效果参数。 -* @param value 动画曲线。 +* @param option Indicates the pointer to an animation configuration. +* @param value Indicates the animated curve. * @since 12 */ void OH_ArkUI_AnimateOption_SetCurve(ArkUI_AnimateOption* option, ArkUI_AnimationCurve value); /** -* @brief 设置动画延迟播放时间。 +* @brief Sets the animation delay. * -* @param option 动画效果参数。 -* @param value 动画延迟播放时间。 +* @param option Indicates the pointer to an animation configuration. +* @param value Indicates the animation delay. * @since 12 */ -void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, int32_t value); +void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, uint32_t value); /** -* @brief 设置动画播放次数。 +* @brief Sets the number of times that an animation is played. * -* @param option 动画效果参数。 -* @param value 动画播放次数。 +* @param option Indicates the pointer to an animation configuration. +* @param value Indicates the number of times that the animation is played. * @since 12 */ -void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, int32_t value); +void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, uint32_t value); /** -* @brief 设置动画播放模式。 +* @brief Sets the animation playback mode. * -* @param option 动画效果参数。 -* @param value 动画播放模式。 +* @param option Indicates the pointer to an animation configuration. +* @param value Indicates the animation playback mode. * @since 12 */ void OH_ArkUI_AnimateOption_SetPlayMode(ArkUI_AnimateOption* option, ArkUI_AnimationPlayMode value); /** -* @brief 设置动画的期望帧率。 +* @brief Sets the expected frame rate range of an animation. * -* @param option 动画效果参数。 -* @param value 动画的期望帧率。 +* @param option Indicates the pointer to an animation configuration. +* @param value Indicates the expected frame rate range. * @since 12 */ void OH_ArkUI_AnimateOption_SetExpectedFrameRateRange(ArkUI_AnimateOption* option, ArkUI_ExpectedFrameRateRange* value); diff --git a/arkui/ace_engine/native/native_interface.h b/arkui/ace_engine/native/native_interface.h index 2d859edbe..04b555af3 100644 --- a/arkui/ace_engine/native/native_interface.h +++ b/arkui/ace_engine/native/native_interface.h @@ -54,7 +54,7 @@ typedef enum { ARKUI_NATIVE_DIALOG, /** API related to gestures. For details, see the struct definition in . */ ARKUI_NATIVE_GESTURE, - /** 动画相关接口类型。*/ + /** API related to animations. For details, see the struct definition in .*/ ARKUI_NATIVE_ANIMATE, } ArkUI_NativeAPIVariantKind; diff --git a/arkui/ace_engine/native/native_node_napi.h b/arkui/ace_engine/native/native_node_napi.h index cc219bd5a..bba0121e8 100644 --- a/arkui/ace_engine/native/native_node_napi.h +++ b/arkui/ace_engine/native/native_node_napi.h @@ -56,6 +56,19 @@ extern "C" { */ int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value frameNode, ArkUI_NodeHandle* handle); +/** + * @brief Obtains a UIContext object on the ArkTS side and maps it to an ArkUI_ContextHandle object on the + * native side. + * + * @param env ndicates the NAPI environment pointer. + * @param value Indicates the UIContext object created on the ArkTS side. + * @param context Indicates the pointer to the ArkUI_ContextHandle object. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_GetContextFromNapiValue(napi_env env, napi_value value, ArkUI_ContextHandle* context); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 94cb22096..1de0c6500 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -92,17 +92,31 @@ typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandle; typedef struct ArkUI_WaterFlowSectionOption ArkUI_WaterFlowSectionOption; /** - * @brief 事件回调类型。 + * @brief Defines the ArkUI native context object. + * + * @since 12 + */ + +struct ArkUI_Context; + +/** + * @brief Defines the pointer to the context instance object pointer definition of ArkUI on the native side. + * + * @since 12 + */ +typedef struct ArkUI_Context* ArkUI_ContextHandle; + +/** + * @brief Defines the event callback type. * * @since 12 */ typedef struct { - /** 自定义类型。*/ + /** Custom type. */ void* userData; - /** 事件回调。*/ + /** Event callback. */ void(*callback)(void* userData); } ArkUI_ContextCallback; - /** * @brief Provides the number types of ArkUI in the native code. * @@ -1382,14 +1396,15 @@ typedef struct { } ArkUI_IntOffset; /** - * @brief 在动画中定义onFinish回调的类型。 + * @brief Enumerates the animation onFinish callback types. * * @since 12 */ typedef enum { - /** 当整个动画结束并立即删除时,将触发回调。 */ + /** The callback is invoked when the entire animation is removed once it has finished. */ ARKUI_FINISH_CALLBACK_REMOVED = 0, - /** 当动画在逻辑上处于下降状态,但可能仍处于其长尾状态时,将触发回调。*/ + /** The callback is invoked when the animation logically enters the falling state, though it may still be in its + * long tail state. */ ARKUI_FINISH_CALLBACK_LOGICALLY, } ArkUI_FinishCallbackType; -- Gitee From c96e9f36329454101b64fd7f6e08d1605e0464bd Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Thu, 11 Apr 2024 23:20:09 +0800 Subject: [PATCH 3/7] [NDK] animate api Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- arkui/ace_engine/native/native_animate.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arkui/ace_engine/native/native_animate.h b/arkui/ace_engine/native/native_animate.h index d79eb8d56..e16738575 100644 --- a/arkui/ace_engine/native/native_animate.h +++ b/arkui/ace_engine/native/native_animate.h @@ -138,7 +138,7 @@ ArkUI_AnimationCurve OH_ArkUI_AnimateOption_GetCurve(ArkUI_AnimateOption* option * @return Returns the animation delay. * @since 12 */ -uint32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option); +int32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option); /** * @brief Obtains the number of times that an animation is played. @@ -147,7 +147,7 @@ uint32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option); * @return Returns the number of times that the animation is played. * @since 12 */ -uint32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option); +int32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option); /** * @brief Obtains the animation playback mode. @@ -174,7 +174,7 @@ ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimateOption_GetExpectedFrameRateRange(A * @param value Indicates the duration, in milliseconds. * @since 12 */ -void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, uint32_t value); +void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, int32_t value); /** * @brief Sets the animation playback speed. @@ -201,7 +201,7 @@ void OH_ArkUI_AnimateOption_SetCurve(ArkUI_AnimateOption* option, ArkUI_Animatio * @param value Indicates the animation delay. * @since 12 */ -void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, uint32_t value); +void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, int32_t value); /** * @brief Sets the number of times that an animation is played. @@ -210,7 +210,7 @@ void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, uint32_t value * @param value Indicates the number of times that the animation is played. * @since 12 */ -void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, uint32_t value); +void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, int32_t value); /** * @brief Sets the animation playback mode. -- Gitee From 9426acf38af9f78635227bc2ae98c7d3c6fd6d77 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Sat, 13 Apr 2024 15:59:46 +0800 Subject: [PATCH 4/7] [NDK] animate api Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- arkui/ace_engine/native/native_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index b9a0515e3..f3d8bf075 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -114,8 +114,8 @@ typedef struct ArkUI_Context* ArkUI_ContextHandle; typedef struct { /** Custom type. */ void* userData; - /** Event callback. */ - void(*callback)(void* userData); + /** Event callback. */ + void (*callback)(void* userData); } ArkUI_ContextCallback; /** * @brief Provides the number types of ArkUI in the native code. -- Gitee From 75c1f5a39d95e9045340102200de22264c7f5605 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Sat, 13 Apr 2024 17:19:46 +0800 Subject: [PATCH 5/7] [NDK] animate api Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- arkui/ace_engine/native/native_type.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index f3d8bf075..0eac39ef9 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -92,11 +92,10 @@ typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandle; typedef struct ArkUI_WaterFlowSectionOption ArkUI_WaterFlowSectionOption; /** - * @brief Defines the ArkUI native context object. + * @brief Defines the ArkUI native context object. * * @since 12 */ - struct ArkUI_Context; /** -- Gitee From 5cbfc5b06d622602e8f4f0e52bf183d340dbd6c8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Sat, 13 Apr 2024 17:32:16 +0800 Subject: [PATCH 6/7] [NDK] animate api Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- arkui/ace_engine/native/native_type.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 0eac39ef9..043526c17 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -92,10 +92,10 @@ typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandle; typedef struct ArkUI_WaterFlowSectionOption ArkUI_WaterFlowSectionOption; /** - * @brief Defines the ArkUI native context object. - * - * @since 12 - */ + * @brief Defines the ArkUI native context object. + * + * @since 12 + */ struct ArkUI_Context; /** -- Gitee From 221b316d4dcc22721eb4d53223191eb46096c4eb Mon Sep 17 00:00:00 2001 From: "DESKTOP-H8KLN8I\\lisitao" Date: Mon, 15 Apr 2024 20:19:50 +0800 Subject: [PATCH 7/7] [NDK] animateTo Signed-off-by:lisitaolisitao3@huawei.com Signed-off-by: DESKTOP-H8KLN8I\lisitao --- arkui/ace_engine/native/native_animate.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arkui/ace_engine/native/native_animate.h b/arkui/ace_engine/native/native_animate.h index e16738575..fbafc396f 100644 --- a/arkui/ace_engine/native/native_animate.h +++ b/arkui/ace_engine/native/native_animate.h @@ -82,13 +82,6 @@ typedef struct { ArkUI_AnimateCompleteCallback* complete); } ArkUI_NativeAnimateAPI_1; -/** -* @brief Defines the animation configuration. -* -* @since 12 -*/ -typedef struct ArkUI_AnimateOption ArkUI_AnimateOption; - /** * @brief Creates an animation configuration. * -- Gitee