From 21ddbe06e67adcaf1c8e72b9af4fbb9aae55ffcc Mon Sep 17 00:00:00 2001 From: kangliang <2352009235@qq.com> Date: Fri, 12 Sep 2025 17:03:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/components/ActionBarAdapter.ets | 4 +++- entry/src/main/ets/components/ScrollComponentAdapter.ets | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/entry/src/main/ets/components/ActionBarAdapter.ets b/entry/src/main/ets/components/ActionBarAdapter.ets index 3c468c8..9df74d8 100644 --- a/entry/src/main/ets/components/ActionBarAdapter.ets +++ b/entry/src/main/ets/components/ActionBarAdapter.ets @@ -23,7 +23,9 @@ export struct ActionBarAdapter { build() { Column() { - // Compatibility judgment, 60000 is derived from the since field of the new interface M*10000 F*100 S. + // Regarding the proprietary interfaces of HarmonyOS, specifically the interfaces marked as since M.F.S(N). + // Compatibility judgment, the value corresponding to version 6.0.0(20) is 60000, + // which is derived from the new interface's since field 6*10000 + 0*100 + 0. if (deviceInfo.distributionOSApiVersion >= 60000) { // Component that calls the API of version 6.0.0(20) HdsActionBar({ diff --git a/entry/src/main/ets/components/ScrollComponentAdapter.ets b/entry/src/main/ets/components/ScrollComponentAdapter.ets index 1df808e..4af0b76 100644 --- a/entry/src/main/ets/components/ScrollComponentAdapter.ets +++ b/entry/src/main/ets/components/ScrollComponentAdapter.ets @@ -35,7 +35,7 @@ export struct ScrollComponentAdapter { build() { Scroll() { - // 'app.media.image1' is just an example, please replace the actual image. + // 'app.media.startIcon' is just an example, please replace the actual image. Image($r('app.media.startIcon')) } .scrollable(ScrollDirection.FREE) -- Gitee From b9b3590e9d02ca3f24b8d810b129c9b9ea4f474e Mon Sep 17 00:00:00 2001 From: kangliang <2352009235@qq.com> Date: Mon, 15 Sep 2025 14:42:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/cpp/function/src/IntegratingWithArkts.cpp | 3 +++ entry/src/main/ets/components/ScrollComponentAdapter.ets | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp b/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp index e4d5cec..8ae72eb 100644 --- a/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp +++ b/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp @@ -52,6 +52,9 @@ std::shared_ptr CreateButtonExample() textNode->SetPercentWidth(1); textNode->SetHeight(50); textNode->SetTextAlign(ARKUI_TEXT_ALIGNMENT_CENTER); + // Regarding the proprietary interfaces of HarmonyOS, specifically the interfaces marked as since M.F.S(N). + // Compatibility judgment, the value corresponding to version 5.1.1(19) is 50101, + // which is derived from the new interface's since field 5*10000 + 1*100 + 1. if (OH_GetSdkApiVersion() >= 19) { textNode->SetButtonType(ARKUI_BUTTON_ROUNDED_RECTANGLE); } else { diff --git a/entry/src/main/ets/components/ScrollComponentAdapter.ets b/entry/src/main/ets/components/ScrollComponentAdapter.ets index 4af0b76..a33bad4 100644 --- a/entry/src/main/ets/components/ScrollComponentAdapter.ets +++ b/entry/src/main/ets/components/ScrollComponentAdapter.ets @@ -37,9 +37,10 @@ export struct ScrollComponentAdapter { Scroll() { // 'app.media.startIcon' is just an example, please replace the actual image. Image($r('app.media.startIcon')) + .width('80%') } .scrollable(ScrollDirection.FREE) - .width('100%') + .width('80%') .attributeModifier(this.adaptModifier) } } -- Gitee From f45a4a8e86c0ad161af6fc4f5daa495aa642cc3f Mon Sep 17 00:00:00 2001 From: kangliang <2352009235@qq.com> Date: Mon, 15 Sep 2025 15:09:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8C=E6=BA=90?= =?UTF-8?q?=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/cpp/classdef/src/ArkUIButtonNode.cpp | 3 ++- .../main/cpp/function/src/IntegratingWithArkts.cpp | 6 ++++-- entry/src/main/ets/components/ActionBarAdapter.ets | 12 ++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/entry/src/main/cpp/classdef/src/ArkUIButtonNode.cpp b/entry/src/main/cpp/classdef/src/ArkUIButtonNode.cpp index 2190ae1..758f4bf 100644 --- a/entry/src/main/cpp/classdef/src/ArkUIButtonNode.cpp +++ b/entry/src/main/cpp/classdef/src/ArkUIButtonNode.cpp @@ -48,7 +48,7 @@ void ArkUIButtonNode::SetTextAlign(ArkUI_TextAlignment align) ArkUI_AttributeItem item = {value, 1}; nativeModule_->setAttribute(handle_, NODE_TEXT_ALIGN, &item); } - +// [Start button_api] void ArkUIButtonNode::SetButtonType(int32_t buttonType) { assert(handle_); @@ -56,4 +56,5 @@ void ArkUIButtonNode::SetButtonType(int32_t buttonType) ArkUI_AttributeItem item = {value, 1}; nativeModule_->setAttribute(handle_, NODE_BUTTON_TYPE , &item); } +// [End button_api] } // namespace NativeModule \ No newline at end of file diff --git a/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp b/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp index 8ae72eb..7741232 100644 --- a/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp +++ b/entry/src/main/cpp/function/src/IntegratingWithArkts.cpp @@ -43,15 +43,17 @@ napi_value CreateButtonNativeRoot(napi_env env, napi_callback_info info) return nullptr; } - +// [Start button_api] std::shared_ptr CreateButtonExample() { auto textNode = std::make_shared(); textNode->SetTextContent(std::string("Hello World")); + // [StartExclude button_api] textNode->SetFontSize(TEXT_FONTSIZE); textNode->SetPercentWidth(1); textNode->SetHeight(50); textNode->SetTextAlign(ARKUI_TEXT_ALIGNMENT_CENTER); + // [EndExclude button_api] // Regarding the proprietary interfaces of HarmonyOS, specifically the interfaces marked as since M.F.S(N). // Compatibility judgment, the value corresponding to version 5.1.1(19) is 50101, // which is derived from the new interface's since field 5*10000 + 1*100 + 1. @@ -60,9 +62,9 @@ std::shared_ptr CreateButtonExample() } else { textNode->SetButtonType(ARKUI_BUTTON_TYPE_CAPSULE); } - return textNode; } +// [End button_api] napi_value DestroyButtonNativeRoot(napi_env env, napi_callback_info info) { diff --git a/entry/src/main/ets/components/ActionBarAdapter.ets b/entry/src/main/ets/components/ActionBarAdapter.ets index 9df74d8..35a3103 100644 --- a/entry/src/main/ets/components/ActionBarAdapter.ets +++ b/entry/src/main/ets/components/ActionBarAdapter.ets @@ -20,7 +20,7 @@ import { deviceInfo } from '@kit.BasicServicesKit'; export struct ActionBarAdapter { @State isExpand: boolean = true; @State isPrimaryIconChanged: boolean = false; - + // [Start action_bar_api] build() { Column() { // Regarding the proprietary interfaces of HarmonyOS, specifically the interfaces marked as since M.F.S(N). @@ -35,6 +35,7 @@ export struct ActionBarAdapter { endButtons: [new ActionBarButton({ baseIcon: $r('sys.symbol.mic_fill') })], + // [StartExclude action_bar_api] primaryButton: new ActionBarButton({ baseIcon: $r('sys.symbol.plus'), altIcon: $r('sys.symbol.play_fill'), @@ -47,10 +48,12 @@ export struct ActionBarAdapter { isPrimaryIconChanged: this.isPrimaryIconChanged }), isExpand: this.isExpand!! + // [EndExclude action_bar_api] }) } else { // Downgrading plan Row({ space: 25 }) { + // [StartExclude action_bar_api] if (this.isExpand) { Button({ type: ButtonType.Circle }) { SymbolGlyph($r('sys.symbol.stopwatch_fill')) @@ -71,7 +74,6 @@ export struct ActionBarAdapter { .aspectRatio(1) .height(55) .backgroundColor($r('sys.color.brand')) - .onClick(() => { this.isExpand = !this.isExpand; }) @@ -87,13 +89,19 @@ export struct ActionBarAdapter { .backgroundColor($r('sys.color.background_secondary')) .margin({ right: 10 }) } + // [EndExclude action_bar_api] } + // [StartExclude action_bar_api] .backgroundColor($r('sys.color.background_primary')) .borderRadius(30) + // [EndExclude action_bar_api] } } + // [StartExclude action_bar_api] .width('100%') .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) + // [EndExclude action_bar_api] } + // [End action_bar_api] } \ No newline at end of file -- Gitee