diff --git a/ArkUI/entry/src/main/ets/pages/Index.d.ts b/ArkUI/entry/src/main/ets/pages/Index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a59673f3582e55a9ddf4de420343f1da8820c4c --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/Index.d.ts @@ -0,0 +1,22 @@ +/* +* 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. +*/ + +/* +* FAQ:如何在C++调用ArkTS传递过来的function +*/ + +// [Start native_call_arkTs] +export const nativeCallArkTS: (a: object) => number; +// [End native_call_arkTs] \ No newline at end of file diff --git a/ArkUI/entry/src/main/ets/pages/MosaicEffect.ets b/ArkUI/entry/src/main/ets/pages/MosaicEffect.ets index a49b81be681a2feacc783c93a98e531c73a77af2..8cdac5ae7a1520a7044ee7ae64c5adfc8377d1cf 100644 --- a/ArkUI/entry/src/main/ets/pages/MosaicEffect.ets +++ b/ArkUI/entry/src/main/ets/pages/MosaicEffect.ets @@ -26,7 +26,7 @@ export struct DrawView { build() { Column({ space: 8 }) { - Text('请选择画笔类型') + Text('Please select the brush type') .fontColor(Color.Red) .textAlign(TextAlign.Center) .fontSize(30) @@ -71,15 +71,15 @@ export struct DrawView { ) Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceAround }) { - Button('普通画笔') + Button('Ordinary paintbrush') .onClick(() => { this.viewModel.drawModel.pathType = DrawPathType.pen; }) - Button('马赛克画笔') + Button('Mosaic brush') .onClick(() => { this.viewModel.drawModel.pathType = DrawPathType.pattern; }) - Button('清除内容') + Button('Clear the content') .onClick(() => { this.viewModel.clearPath(); }) diff --git a/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets b/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets index 9c993e609c56c0ba42a53e76436532f050953ea1..efa53e526e5641ce0e7d95b1db105db9872759d4 100644 --- a/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets +++ b/ArkUI/entry/src/main/ets/viewmodel/DrawViewModel.ets @@ -24,11 +24,11 @@ export class DrawPathPointModel { } export enum DrawPathType { - pen = 0, // 画笔 - pattern // 马赛克 + pen = 0, // Brush + pattern // Mosaic } -// 配置画笔 +// Configure the brush export class DrawPathModel { public pathType: DrawPathType = DrawPathType.pen; public color: string = '#ED1B1B'; @@ -45,7 +45,7 @@ export class DrawViewModel { public canvasWidth: number = 0; private pattern: CanvasPattern | null = null; private points: DrawPathPointModel[] = []; - // 绘制路径 + // Draw a path private drawPath = new Path2D(); constructor() { diff --git a/NetworkKit/entry/src/main/ets/pages/SetNetSpecifier.ets b/NetworkKit/entry/src/main/ets/pages/SetNetSpecifier.ets index de066b1e706a80756b6420fd162325697100c496..29e6019af6ea8561627339dd14bdaac4437ed7c7 100644 --- a/NetworkKit/entry/src/main/ets/pages/SetNetSpecifier.ets +++ b/NetworkKit/entry/src/main/ets/pages/SetNetSpecifier.ets @@ -31,28 +31,28 @@ function listen_network() { let conn = connection.createNetConnection(netSpecifier); conn.register((err: BusinessError, data: void) => { - console.warn('register 网络 ' + JSON.stringify(err)) + console.warn('register Network ' + JSON.stringify(err)) }); // Subscription event, network available conn.on('netAvailable', ((data: connection.NetHandle) => { - console.warn('网络可用, netId is ' + data.netId); + console.warn('Network available, netId is ' + data.netId); })); // Subscription event, network available conn.on('netCapabilitiesChange', ((data: connection.NetCapabilityInfo) => { - console.warn('网络 netCapabilitiesChange bearerTypes ' + data.netCap.bearerTypes); - console.warn('网络 netCapabilitiesChange networkCap ' + data.netCap.networkCap); + console.warn('Network netCapabilitiesChange bearerTypes ' + data.netCap.bearerTypes); + console.warn('Network netCapabilitiesChange networkCap ' + data.netCap.networkCap); })); // Subscription event, network unavailable conn.on('netUnavailable', ((data: void) => { - console.warn('网络不可用, data is ' + JSON.stringify(data)); + console.warn('The network is unavailable, data is ' + JSON.stringify(data)); })); // Subscription event, network disconnection conn.on('netLost', ((data: connection.NetHandle) => { - console.warn('网络lost, netId is ' + data.netId); + console.warn('Network lost, netId is ' + data.netId); })); } @@ -97,10 +97,10 @@ struct NetWork { build() { Row() { Column() { - Button('监听网络').onClick(() => { + Button('Monitor the network').onClick(() => { listen_network() }) - Button('获取网络状态').onClick(() => { + Button('Obtain the network status').onClick(() => { sub_network() }) }