Commit 68e471e9 authored by dsq's avatar dsq

适配0.2.0

parent 0954dbef
......@@ -53,10 +53,10 @@ kotlin {
main.compilerOptions.configure {
freeCompilerArgs.add("-Xbinary=sanitizer=address")
}
//val resource by main.cinterops.creating {
// defFile(file("src/ohosArm64Main/cinterop/resource.def"))
// includeDirs(file("src/ohosArm64Main/cinterop/include"))
// }
val resource by main.cinterops.creating {
defFile(file("src/ohosArm64Main/cinterop/resource.def"))
includeDirs(file("src/ohosArm64Main/cinterop/include"))
}
}
ohosX64 {
......@@ -71,10 +71,10 @@ kotlin {
main.compilerOptions.configure {
freeCompilerArgs.add("-Xbinary=sanitizer=address")
}
// val resource by main.cinterops.creating {
// defFile(file("src/ohosX64Main/cinterop/resource.def"))
// includeDirs(file("src/ohosX64Main/cinterop/include"))
// }
val resource by main.cinterops.creating {
defFile(file("src/ohosX64Main/cinterop/resource.def"))
includeDirs(file("src/ohosX64Main/cinterop/include"))
}
}
sourceSets {
......@@ -83,7 +83,7 @@ kotlin {
implementation(libs.androidx.lifecycle.viewmodelCompose)
implementation(libs.androidx.lifecycle.runtimeCompose)
implementation(libs.androidx.collection)
implementation(libs.compose.ui.backhandler) //需要单独依赖
// implementation(libs.compose.ui.backhandler) //需要单独依赖
}
commonMain.dependencies {
implementation(compose.runtime)
......@@ -96,7 +96,7 @@ kotlin {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.atomicFu)
// Navigation 库测试 Demo:使用 Maven 依赖(版本见 libs.versions.toml 的 androidx-navigation)
implementation(libs.compose.navigation)
// implementation(libs.compose.navigation)
}
val iosMain by creating {
dependencies {
......@@ -110,14 +110,14 @@ kotlin {
dependencies {
api(libs.compose.multiplatform.export)
//导出skiko api 用于demo中测试
implementation("org.jetbrains.skiko:skiko-ohosarm64")
// implementation("org.jetbrains.skiko:skiko-ohosarm64")
}
}
val ohosX64Main by getting {
dependencies {
api(libs.compose.multiplatform.export)
implementation("org.jetbrains.skiko:skiko-ohosx64")
// implementation("org.jetbrains.skiko:skiko-ohosx64")
}
}
}
......@@ -154,10 +154,11 @@ dependencies {
debugImplementation(libs.compose.ui.tooling)
}
compose{
ohos{
skia("0.9.22.2-OH.0.1.2-06") // 启用自渲染
// ohrender(" 0.9.22.2-ohrende") //启用统一渲染
// OHOS 渲染模式二选一:自渲染(Skia)或统一渲染(ohrender)。切换时只保留其一,另一行注释掉。
compose {
ohos {
skia("0.9.22.2-0.1.1") // 自渲染:Compose 用 Skia 自绘
// ohrender("0.9.22.2-0.1.0") // 统一渲染:与 ArkUI 统一渲染管线;启用时注释上一行
}
}
......
......@@ -5,10 +5,10 @@ import com.dong.demo013.debug.DebugAllTypesData
import com.dong.demo013.debug.allBreakpoints
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.coroutines.initMainHandler
import platform.ohos.napi_env
import platform.ohos.napi_value
import platform.ArkTS.ArkTS_Napi_NativeModule.*
import kotlin.experimental.ExperimentalNativeApi
@OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class)
@CName("MainArkUIViewController")
fun MainArkUIViewController(env: napi_env): napi_value {
......
package com.dong.demo013
import kotlinx.cinterop.ExperimentalForeignApi
import platform.ohos.OH_LOG_Print
import platform.PerformanceAnalysisKit.HiLog.OH_LOG_Print
import kotlin.experimental.ExperimentalNativeApi
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlin.experimental.ExperimentalNativeApi::class)
......
#ifndef GLOBAL_RAW_FILE_H
#define GLOBAL_RAW_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
struct RawFile;
typedef struct RawFile RawFile;
int OH_ResourceManager_ReadRawFile(const RawFile *rawFile, void *buf, size_t length);
long OH_ResourceManager_GetRawFileSize(RawFile *rawFile);
void OH_ResourceManager_CloseRawFile(RawFile *rawFile);
#ifdef __cplusplus
};
#endif
/** @} */
#endif // GLOBAL_RAW_FILE_H
#ifndef GLOBAL_NATIVE_RESOURCE_MANAGER_H
#define GLOBAL_NATIVE_RESOURCE_MANAGER_H
#include "napi/native_api.h"
#include "raw_file.h"
#ifdef __cplusplus
extern "C" {
#endif
struct NativeResourceManager;
typedef struct NativeResourceManager NativeResourceManager;
NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr);
void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr);
RawFile *OH_ResourceManager_OpenRawFile(const NativeResourceManager *mgr, const char *fileName);
#ifdef __cplusplus
};
#endif
/** @} */
#endif // GLOBAL_NATIVE_RESOURCE_MANAGER_H
package = platform.resource
headers = raw_file_manager.h raw_file.h
\ No newline at end of file
......@@ -4,8 +4,7 @@ import androidx.compose.ui.window.ComposeArkUIViewController
import com.dong.demo013.debug.allBreakpoints
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.coroutines.initMainHandler
import platform.ohos.napi_env
import platform.ohos.napi_value
import platform.ArkTS.ArkTS_Napi_NativeModule.*
import kotlin.experimental.ExperimentalNativeApi
@OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class)
......
package com.dong.demo013
import kotlinx.cinterop.ExperimentalForeignApi
import platform.ohos.OH_LOG_Print
import platform.posix.usleep
import platform.PerformanceAnalysisKit.HiLog.OH_LOG_Print
import kotlin.experimental.ExperimentalNativeApi
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlin.experimental.ExperimentalNativeApi::class)
......
[versions]
# Build & Android
agp = "8.2.2"
agp = "8.6.0"
android-compileSdk = "36"
android-minSdk = "24"
android-targetSdk = "36"
......@@ -19,15 +19,13 @@ androidx-testExt = "1.3.0"
# Compose
compose = "1.9.4"
compose-material3 = "1.4.0"
composeMultiplatform = "1.9.2-OH.0.1.2-14"
compose-navigation = "2.9.4-OH.0.1.2-14"
compose-ui-backhandler = "1.9.2-OH.0.1.2-14"
composeMultiplatform = "1.9.2-0.2.0-03"
# Kotlin & testing
junit = "4.13.2"
kotlin = "2.2.21-OH.0.1.0-02"
kotlinx-coroutines = "1.10.2-OH-103"
atomicFu = "0.31.0-OH-001"
kotlin = "2.2.21-0.2.0-09"
kotlinx-coroutines = "1.10.2-0.2.0-01"
atomicFu = "0.31.0-0.2.0-02"
[libraries]
# ----- Testing -----
......@@ -65,9 +63,6 @@ compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material = { module = "androidx.compose.material:material", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material:material3", version.ref = "compose-material3" }
# Navigation(Maven 依赖,用于「Navigation 库测试」Demo;版本请与已发布的 navigation-compose 一致)
compose-navigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "compose-navigation" }
compose-ui-backhandler = { module = "org.jetbrains.compose.ui:ui-backhandler", version.ref = "compose-ui-backhandler" }
[plugins]
# Android
......
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://mirrors.tencent.com/gradle/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
......
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
......@@ -7,9 +7,9 @@
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"compose@libs/compose.har": "compose@libs/compose.har",
"libcompose_arkui_utils.so@../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils": "libcompose_arkui_utils.so@../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils",
"libcompose_arkui_utils.so@../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils": "libcompose_arkui_utils.so@../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils",
"libentry.so@src/main/cpp/types/libentry": "libentry.so@src/main/cpp/types/libentry",
"libskikobridge.so@../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libskikobridge": "libskikobridge.so@../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libskikobridge"
"libskikobridge.so@../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libskikobridge": "libskikobridge.so@../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libskikobridge"
},
"packages": {
"compose@libs/compose.har": {
......@@ -22,10 +22,10 @@
"libskikobridge.so": "file:./src/main/cpp/types/libskikobridge"
}
},
"libcompose_arkui_utils.so@../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils": {
"libcompose_arkui_utils.so@../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils": {
"name": "libcompose_arkui_utils.so",
"version": "1.0.0",
"resolved": "../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils",
"resolved": "../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libcompose_arkui_utils",
"registryType": "local"
},
"libentry.so@src/main/cpp/types/libentry": {
......@@ -34,10 +34,10 @@
"resolved": "src/main/cpp/types/libentry",
"registryType": "local"
},
"libskikobridge.so@../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libskikobridge": {
"libskikobridge.so@../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libskikobridge": {
"name": "libskikobridge.so",
"version": "0.0.0",
"resolved": "../oh_modules/.ohpm/compose@ma2je3shc8wd1ay4sclgu8prv+0pyungmargnuaabae=/oh_modules/compose/src/main/cpp/types/libskikobridge",
"resolved": "../oh_modules/.ohpm/compose@zyix+yj1mhkoan3lc4sdfsulqfawiqohijc9ejvuxzw=/oh_modules/compose/src/main/cpp/types/libskikobridge",
"registryType": "local"
}
}
......
......@@ -194,20 +194,25 @@ extern void* MainArkUIViewController(void* env);
extern libkn_KInt hiLogPrintMsg(libkn_KUInt type, libkn_KUInt level, libkn_KUInt domain, const char* tag, const char* message);
extern void testArkTsToKotin();
extern libkn_KInt kn_get_render_backend_id();
extern void InitJsRenderNodeContext(void* env, void* nodeConstructor, void* statusModifyConstructor, libkn_KDouble ratio, libkn_KBoolean fixed);
extern void androidx_compose_ui_arkui_ArkUIViewController_aboutToAppear(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_aboutToDisappear(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_cancelSyncRefresh(void* controllerRef, libkn_KInt refreshId);
extern void androidx_compose_ui_arkui_ArkUIViewController_dispatchHoverEvent(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_dispatchMouseEvent(void* controllerRef);
extern libkn_KBoolean androidx_compose_ui_arkui_ArkUIViewController_dispatchTouchEvent(void* controllerRef, void* nativeTouchEvent, libkn_KBoolean ignoreInteropView);
extern void AndroidxComposeUiArkuiArkUiViewControllerDraw(void* controllerRef, void* canvas);
extern const char* androidx_compose_ui_arkui_ArkUIViewController_getId(void* controllerRef);
extern void* AndroidxComposeUiArkuiArkUiViewControllerGetJsNode(void* controllerRef);
extern void* androidx_compose_ui_arkui_ArkUIViewController_getXComponentRender(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_initFusionRendererNode(void* controllerRef, libkn_KBoolean enableCApi, void* rootContent, void* frameMgr);
extern void androidx_compose_ui_arkui_ArkUIViewController_keyboardWillHide(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_keyboardWillShow(void* controllerRef, libkn_KFloat keyboardHeight);
extern libkn_KBoolean androidx_compose_ui_arkui_ArkUIViewController_onBackPress(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_onFinalize(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_onFocusEvent(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_onFrame(void* controllerRef, libkn_KLong timestamp, libkn_KLong targetTimestamp);
extern void AndroidXComposeUIArkUIArkUIViewControllerOnIdle(void* controllerRef, libkn_KLong timeLeft);
extern void androidx_compose_ui_arkui_ArkUIViewController_onKeyEvent(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_onPageHide(void* controllerRef);
extern void androidx_compose_ui_arkui_ArkUIViewController_onPageShow(void* controllerRef);
......@@ -223,16 +228,10 @@ extern void androidx_compose_ui_arkui_ArkUIViewController_setEnv(void* controlle
extern void androidx_compose_ui_arkui_ArkUIViewController_setId(void* controllerRef, const char* id);
extern void androidx_compose_ui_arkui_ArkUIViewController_setLocaleAndStringProvider(void* controllerRef, void* provider);
extern void androidx_compose_ui_arkui_ArkUIViewController_setMessenger(void* controllerRef, void* messenger);
extern void androidx_compose_ui_arkui_ArkUIViewController_setRenderBackendId(void* controllerRef, libkn_KInt backendId);
extern void androidx_compose_ui_arkui_ArkUIViewController_setRendererBackendId(void* controllerRef, libkn_KInt backendId);
extern void androidx_compose_ui_arkui_ArkUIViewController_setRootView(void* controllerRef, void* backRootView, void* foreRootView, void* touchableRootView);
extern void androidx_compose_ui_arkui_ArkUIViewController_setUIContext(void* controllerRef, void* uiContext);
extern void androidx_compose_ui_arkui_ArkUIViewController_setXComponentRender(void* controllerRef, void* render);
extern void buildInstance(void* env, void* func);
extern void* createRootRenderNode();
extern void renderNodeDraw(void* env, void* jsCanvas, void* jsNode);
extern void renderNodeNotifyRedraw(void* env, void* jsNode);
extern void setNodeConstructor(void* env, void* func);
extern void setPixelRatio(libkn_KDouble ratio);
extern void androidx_compose_ui_arkui_init(void* env, void* exports);
typedef struct {
......@@ -1104,21 +1103,25 @@ typedef struct {
struct {
struct {
struct {
void* (*get_NodeDrawCallback)();
void (*InitJsRenderNodeContext_)(void* env, void* nodeConstructor, void* statusModifyConstructor, libkn_KDouble ratio, libkn_KBoolean fixed);
void (*_Export_ArkUIViewController_aboutToAppear)(void* controllerRef);
void (*_Export_ArkUIViewController_aboutToDisappear)(void* controllerRef);
void (*_Export_ArkUIViewController_cancelSyncRefresh)(void* controllerRef, libkn_KInt refreshId);
void (*_Export_ArkUIViewController_dispatchHoverEvent)(void* controllerRef);
void (*_Export_ArkUIViewController_dispatchMouseEvent)(void* controllerRef);
libkn_KBoolean (*_Export_ArkUIViewController_dispatchTouchEvent)(void* controllerRef, void* nativeTouchEvent, libkn_KBoolean ignoreInteropView);
void (*_Export_ArkUIViewController_draw)(void* controllerRef, void* canvas);
const char* (*_Export_ArkUIViewController_getId)(void* controllerRef);
void* (*_Export_ArkUIViewController_getJsNode)(void* controllerRef);
void* (*_Export_ArkUIViewController_getXComponentRender)(void* controllerRef);
void (*_Export_ArkUIViewController_initFusionRendererNode)(void* controllerRef, libkn_KBoolean enableCApi, void* rootContent, void* frameMgr);
void (*_Export_ArkUIViewController_keyboardWillHide)(void* controllerRef);
void (*_Export_ArkUIViewController_keyboardWillShow)(void* controllerRef, libkn_KFloat keyboardHeight);
libkn_KBoolean (*_Export_ArkUIViewController_onBackPress)(void* controllerRef);
void (*_Export_ArkUIViewController_onFinalize)(void* controllerRef);
void (*_Export_ArkUIViewController_onFocusEvent)(void* controllerRef);
void (*_Export_ArkUIViewController_onFrame)(void* controllerRef, libkn_KLong timestamp, libkn_KLong targetTimestamp);
void (*_Export_ArkUIViewController_onIdle)(void* controllerRef, libkn_KLong timeLeft);
void (*_Export_ArkUIViewController_onKeyEvent)(void* controllerRef);
void (*_Export_ArkUIViewController_onPageHide)(void* controllerRef);
void (*_Export_ArkUIViewController_onPageShow)(void* controllerRef);
......@@ -1134,17 +1137,11 @@ typedef struct {
void (*_Export_ArkUIViewController_setId)(void* controllerRef, const char* id);
void (*_Export_ArkUIViewController_setLocaleAndStringProvider)(void* controllerRef, void* provider);
void (*_Export_ArkUIViewController_setMessenger)(void* controllerRef, void* messenger);
void (*_Export_ArkUIViewController_setRenderBackendId)(void* controllerRef, libkn_KInt backendId);
void (*_Export_ArkUIViewController_setRendererBackendId)(void* controllerRef, libkn_KInt backendId);
void (*_Export_ArkUIViewController_setRootView)(void* controllerRef, void* backRootView, void* foreRootView, void* touchableRootView);
void (*_Export_ArkUIViewController_setUIContext)(void* controllerRef, void* uiContext);
void (*_Export_ArkUIViewController_setXComponentRender)(void* controllerRef, void* render);
void (*buildInstance_)(void* env, void* func);
void* (*createRootRenderNode_)();
libkn_KLong (*getCurrentTimeNanos)();
void (*renderNodeDraw_)(void* env, void* jsCanvas, void* jsNode);
void (*renderNodeNotifyRedraw_)(void* env, void* jsNode);
void (*setNodeConstructor_)(void* env, void* func);
void (*setPixelRatio_)(libkn_KDouble ratio);
void (*_Export_ArkUIViewInitializer_init)(void* env, void* exports);
} arkui;
} ui;
......
......@@ -15,75 +15,6 @@ static napi_value MainArkUIViewController(napi_env env, napi_callback_info info)
static napi_value nativeCreateRootNode(napi_env env, napi_callback_info info) {
size_t argc = 2;
napi_value argv[2];
napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
return reinterpret_cast<napi_value>(createRootRenderNode());
}
static napi_value nativeOHRenderNodeDraw(napi_env env, napi_callback_info info) {
size_t argc = 2;
napi_value argv[2];
napi_status status;
status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
if (status != napi_ok || argc < 2) {
napi_throw_type_error(env, nullptr, "Expected canvas argument");
return nullptr;
}
renderNodeDraw(env, argv[0], argv[1]);
return nullptr;
}
static napi_value nativeOHRenderNotifyRedraw(napi_env env, napi_callback_info info) {
size_t argc = 1;
napi_value argv[1];
napi_status status;
status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
if (status != napi_ok || argc < 1) {
napi_throw_type_error(env, nullptr, "Expected renderNode argument");
return nullptr;
}
renderNodeNotifyRedraw(env, argv[0]);
return nullptr;
}
static napi_value nativeRegisterNodeConstructor(napi_env env, napi_callback_info info) {
size_t argc = 1;
napi_value argv[1];
napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
if (argc < 1) {
return nullptr;
}
setNodeConstructor(env, argv[0]);
return nullptr;
}
static napi_value nativeSetPixelRatio(napi_env env, napi_callback_info info) {
size_t argc = 1;
napi_value argv[1];
napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
double ratio = 1.0;
napi_get_value_double(env, argv[0], &ratio);
setPixelRatio(ratio);
return nullptr;
}
static napi_value nativeRegisterNodeStatusModifyConstructor(napi_env env, napi_callback_info info) {
size_t argc = 1;
napi_value argv[1];
napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
if (argc < 1) {
return nullptr;
}
buildInstance(env, argv[0]);
return nullptr;
}
static napi_value nativeTestArkTsToKotin(napi_env env, napi_callback_info info) {
testArkTsToKotin();
......@@ -97,12 +28,6 @@ static napi_value Init(napi_env env, napi_value exports) {
androidx_compose_ui_arkui_init(env, exports);
napi_property_descriptor desc[] = {
{"MainArkUIViewController", nullptr, MainArkUIViewController, nullptr, nullptr, nullptr, napi_default, nullptr},
{"nativeCreateRootNode", nullptr, nativeCreateRootNode, nullptr, nullptr, nullptr, napi_default, nullptr},
{"nativeOHRenderNodeDraw", nullptr, nativeOHRenderNodeDraw, nullptr, nullptr, nullptr, napi_default, nullptr},
{"nativeOHRenderNotifyRedraw", nullptr, nativeOHRenderNotifyRedraw, nullptr, nullptr, nullptr, napi_default, nullptr},
{"nativeRegisterNodeConstructor", nullptr, nativeRegisterNodeConstructor, nullptr, nullptr, nullptr, napi_default, nullptr},
{"nativeRegisterNodeStatusModifyConstructor", nullptr, nativeRegisterNodeStatusModifyConstructor, nullptr, nullptr, nullptr, napi_default, nullptr },
{"nativeSetPixelRatio", nullptr, nativeSetPixelRatio, nullptr, nullptr, nullptr, napi_default, nullptr},
{"testArkTsToKotin", nullptr, nativeTestArkTsToKotin, nullptr, nullptr, nullptr, napi_default, nullptr},
};
napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
......
rootProject.name = "TestToolChainDemo"
// 启用类型安全项目访问器特性(Type-safe project accessors)
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
/**
专门管理 Gradle 插件的解析和应用:
影响 plugins {} 块中的插件解析
影响 buildscript {} 块中的插件解析
影响插件版本管理
影响插件仓库配置
只在构建脚本配置阶段生效
*/
pluginManagement {
repositories {
// mavenLocal()
maven("https://maven.eazytec-cloud.com/nexus/repository/maven-public/")
// 引入 Gradle 插件门户(主要用于查找 Gradle 插件)
gradlePluginPortal()
}
}
/**
专门管理项目依赖的解析:
影响 dependencies {} 块中的依赖解析
影响 implementation、api、compileOnly 等依赖声明
影响依赖版本管理
影响依赖仓库配置
在整个项目构建过程中生效
*/
dependencyResolutionManagement {
repositories {
// mavenLocal()
maven("https://maven.eazytec-cloud.com/nexus/repository/maven-public/")
}
}
// 包含 composeApp 模块
include(":composeApp")
include(":composeApp")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment