nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnMainAlignRadioList.ets
arkts
ColumnMainAlignRadioList
Set Main Alignment in Column
@Component export struct ColumnMainAlignRadioList { private columnModuleList: ContainerModuleItem[] = getColumnModuleList(); private groupName: string = this.columnModuleList[0].groupName; private moduleName: Resource = this.columnModuleList[0].moduleName; private radioList: Array<string> = this.columnModuleLis...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ColumnMainAlignRadioList AST#component_body#Left { AST#property_declaration#Left private columnModuleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContainerModuleItem [ ] AST#array_type#Rig...
@Component export struct ColumnMainAlignRadioList { private columnModuleList: ContainerModuleItem[] = getColumnModuleList(); private groupName: string = this.columnModuleList[0].groupName; private moduleName: Resource = this.columnModuleList[0].moduleName; private radioList: Array<string> = this.columnModuleLis...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/ColumnMainAlignRadioList.ets#L23-L55
a75dd16024ce1ea70262c5504de3dd0171cff1c7
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets
arkts
setChartDimens
Sets the width and height of the chart. @param width @param height
public setChartDimens(width: number, height: number) { var offsetLeft = this.offsetLeft(); var offsetTop = this.offsetTop(); var offsetRight = this.offsetRight(); var offsetBottom = this.offsetBottom(); this.mChartHeight = height; this.mChartWidth = width; this.restrainViewPort(offsetLeft,...
AST#method_declaration#Left public setChartDimens AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
public setChartDimens(width: number, height: number) { var offsetLeft = this.offsetLeft(); var offsetTop = this.offsetTop(); var offsetRight = this.offsetRight(); var offsetBottom = this.offsetBottom(); this.mChartHeight = height; this.mChartWidth = width; this.restrainViewPort(offsetLeft,...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets#L97-L107
4f43cdb64f3fd3a766065706c751ecdabedc1f4b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Player component status.
export enum AvplayerStatus { IDLE = 'idle', INITIALIZED = 'initialized', PREPARED = 'prepared', PLAYING = 'playing', PAUSED = 'paused', COMPLETED = 'completed', STOPPED = 'stopped', RELEASED = 'released', ERROR = 'error' }
AST#export_declaration#Left export AST#enum_declaration#Left enum AvplayerStatus AST#enum_body#Left { AST#enum_member#Left IDLE = AST#expression#Left 'idle' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left INITIALIZED = AST#expression#Left 'initialized' AST#expression#Right AST#enum_member#Right , AST#...
export enum AvplayerStatus { IDLE = 'idle', INITIALIZED = 'initialized', PREPARED = 'prepared', PLAYING = 'playing', PAUSED = 'paused', COMPLETED = 'completed', STOPPED = 'stopped', RELEASED = 'released', ERROR = 'error' }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L111-L121
4c512e3bdd8c0fc0a59bfe3a1eb1751eaadba9d7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Connectivity/Bluetooth/entry/src/main/ets/Commom/TitleBar.ets
arkts
TitleBar
Copyright (c) 2022-2025 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,...
@Component export struct TitleBar { private handlerClickButton: () => void = () => { } build() { Row() { Image($r('app.media.ic_back')) .width(40) .height(30) .onClick(() => { this.handlerClickButton() }) Text($r('app.string.bluetooth')) .fontSize...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private handlerClickButton : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation...
@Component export struct TitleBar { private handlerClickButton: () => void = () => { } build() { Row() { Image($r('app.media.ic_back')) .width(40) .height(30) .onClick(() => { this.handlerClickButton() }) Text($r('app.string.bluetooth')) .fontSize...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Connectivity/Bluetooth/entry/src/main/ets/Commom/TitleBar.ets#L16-L42
7a2b58744f4cab05da92826225594c90eee1d522
gitee
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/NotificationManager.ets
arkts
sendImmediateNotification
立即发送通知(给定时检查用)
async sendImmediateNotification(event: EventModel): Promise<void> { try { const notificationId = parseInt(event.id.substring(0, 8), 16) console.info('⏰ 立即发送提醒通知...') console.info(`Event: ${event.title}, Time: ${event.startTime} - ${event.endTime}`) const notificationRequest: notificationMa...
AST#method_declaration#Left async sendImmediateNotification AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left EventModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#...
async sendImmediateNotification(event: EventModel): Promise<void> { try { const notificationId = parseInt(event.id.substring(0, 8), 16) console.info('⏰ 立即发送提醒通知...') console.info(`Event: ${event.title}, Time: ${event.startTime} - ${event.endTime}`) const notificationRequest: notificationMa...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L119-L145
f81c1b723ab3eab9c67aaaf75efa0bfa70086470
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets
arkts
reCreateCamera
重新打开相机
async reCreateCamera() { await this.cameraService.createCamera(this.surFaceId); }
AST#method_declaration#Left async reCreateCamera AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#L...
async reCreateCamera() { await this.cameraService.createCamera(this.surFaceId); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets#L52-L54
3e9a0d695390328b7c509761e084c2bae2e672b5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/common/CommonNavigator.ets
arkts
@file 公共模块导航封装 @author Joker.X
export class CommonNavigator { /** * 跳转到关于我们 * @returns {void} 无返回值 */ static toAbout(): void { navigateTo(CommonRoutes.About); } /** * 跳转到设置页 * @returns {void} 无返回值 */ static toSettings(): void { navigateTo(CommonRoutes.Settings); } /** * 跳转到用户协议 * @returns {void} 无返回值 ...
AST#export_declaration#Left export AST#class_declaration#Left class CommonNavigator AST#class_body#Left { /** * 跳转到关于我们 * @returns {void} 无返回值 */ AST#method_declaration#Left static toAbout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
export class CommonNavigator { static toAbout(): void { navigateTo(CommonRoutes.About); } static toSettings(): void { navigateTo(CommonRoutes.Settings); } static toUserAgreement(): void { navigateTo(CommonRoutes.UserAgreement); } static toPrivacyPolicy(): void { navigateTo(C...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L9-L63
ea39a1f0cbf2536b07fa52c45e451a0f424ea5f7
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets
arkts
setSelectsByRepeatType
根据重复类型设置选择的重复天数
setSelectsByRepeatType(repeatType: RepeatType) { if (repeatType === RepeatType.NoRepeat) { this.selects = []; } else if (repeatType === RepeatType.Everyday) { this.selects = DetailConstants.WEEKDAY_DATA; } else if (repeatType === RepeatType.DoubleRest) { this.selects = [1, 2, 3, 4, 5]; ...
AST#method_declaration#Left setSelectsByRepeatType AST#parameter_list#Left ( AST#parameter#Left repeatType : AST#type_annotation#Left AST#primary_type#Left RepeatType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left...
setSelectsByRepeatType(repeatType: RepeatType) { if (repeatType === RepeatType.NoRepeat) { this.selects = []; } else if (repeatType === RepeatType.Everyday) { this.selects = DetailConstants.WEEKDAY_DATA; } else if (repeatType === RepeatType.DoubleRest) { this.selects = [1, 2, 3, 4, 5]; ...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets#L37-L49
24c75907ac202a2f3efa02b6f24ef3e445eeeb4d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
draw
Draw the raffle round turntable. @param canvasContext canvasContext. @param screenWidth screenWidth. @param screenHeight screenHeight.
draw(canvasContext: CanvasRenderingContext2D, screenWidth: number, screenHeight: number) { if (CheckEmptyUtils.isEmptyObj(canvasContext)) { Logger.error('[DrawModel][draw] canvasContext is empty.'); return; } this.canvasContext = canvasContext; this.screenWidth = screenWidth; this.canvas...
AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left canvasContext : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left screenWidth : AST#type_annotation#Left AST#primary_type#Left num...
draw(canvasContext: CanvasRenderingContext2D, screenWidth: number, screenHeight: number) { if (CheckEmptyUtils.isEmptyObj(canvasContext)) { Logger.error('[DrawModel][draw] canvasContext is empty.'); return; } this.canvasContext = canvasContext; this.screenWidth = screenWidth; this.canvas...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets#L40-L65
677e1a6a0d8a3f8f8e7b35d50e6dcb49d320e6f3
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/detail/DetailCardsView.ets
arkts
preLoadOneSound
预下载 (或合成) 词语的声音 (词语模式时)
async preLoadOneSound(text?: string | null) { if (!text) { return } if (!(await CSoundHelper.isSoundCacheExists(text))) { // 启动(下载或合成)声音 await CSoundHelper.startDownloadOrGenerateSound(text) } }
AST#method_declaration#Left async preLoadOneSound AST#parameter_list#Left ( AST#parameter#Left text ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ...
async preLoadOneSound(text?: string | null) { if (!text) { return } if (!(await CSoundHelper.isSoundCacheExists(text))) { await CSoundHelper.startDownloadOrGenerateSound(text) } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detail/DetailCardsView.ets#L612-L622
9dd1221a7a2ef2a2e215d00d49bad445d08feace
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态工厂 @since 2022-06-10
export namespace StateManager { /** * 是否允许执行该升级行为 * * @param status 状态 * @param action 行为 * @return 是否允许 */ export function isAllowExecute(status: number, action: UpdateAction): boolean { let stateObj: BaseState = OtaUpdateManager.getInstance().getStateObj(status); return stateObj.actionSe...
AST#export_declaration#Left export AST#ERROR#Left namespace State Manager { /** * 是否允许执行该升级行为 * * @param status 状态 * @param action 行为 * @return 是否允许 */ export AST#ERROR#Right AST#function_declaration#Left function isAllowExecute AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation...
export namespace StateManager { export function isAllowExecute(status: number, action: UpdateAction): boolean { let stateObj: BaseState = OtaUpdateManager.getInstance().getStateObj(status); return stateObj.actionSet.indexOf(action) != -1; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L32-L43
3a5e54ce97b85ede823b8a13b301e5c726c07a8a
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/ui/rcpLoading.ets
arkts
弹框形状布局
export enum RcpLoadingShape { /** * 正方形 */ SQUARE, /** * 矩形 */ RECTANGLE }
AST#export_declaration#Left export AST#enum_declaration#Left enum RcpLoadingShape AST#enum_body#Left { /** * 正方形 */ AST#enum_member#Left SQUARE AST#enum_member#Right , /** * 矩形 */ AST#enum_member#Left RECTANGLE AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Rig...
export enum RcpLoadingShape { SQUARE, RECTANGLE }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/ui/rcpLoading.ets#L216-L225
0f3478b84c9652871efcf28433149440396d4d5a
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PCProject/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
[End available_area]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onWindowStageDestroy'); }
AST#method_declaration#Left onWindowStageDestroy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Main window is destroyed, release UI related resources AST#expression_statement...
onWindowStageDestroy(): void { hilog.info(DOMAIN, TAG, '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PCProject/entry/src/main/ets/entryability/EntryAbility.ets#L75-L78
464609482c31dd40f229076e3979fa88185d24c3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets
arkts
use named export
export * from './Utils'
AST#export_declaration#Left export * from './Utils' AST#export_declaration#Right
export * from './Utils'
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets#L66-L66
70fe4bd9a61f59252cb3fc85b719d829c6b717c9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets
arkts
savePopBuilder
保存图片弹窗
@Builder savePopBuilder() { Column() { Text($r('app.string.photo_pick_and_save_is_save_picture')) .fontSize($r('app.string.photo_pick_and_save_is_save_picture_message_font_size')) .height($r('app.string.photo_pick_and_save_is_save_picture_message_height')) .textAlign(TextAlign.Center...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right savePopBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_e...
@Builder savePopBuilder() { Column() { Text($r('app.string.photo_pick_and_save_is_save_picture')) .fontSize($r('app.string.photo_pick_and_save_is_save_picture_message_font_size')) .height($r('app.string.photo_pick_and_save_is_save_picture_message_height')) .textAlign(TextAlign.Center...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SavePictureFromWeb.ets#L129-L158
8d681bbfe7f56a4042fcd65d9e639ca4eb72e532
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/model/TaskTimeRange.ets
arkts
updateTaskName
更新任务名称
updateTaskName(newName: string): void { this.taskName = newName; }
AST#method_declaration#Left updateTaskName AST#parameter_list#Left ( AST#parameter#Left newName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
updateTaskName(newName: string): void { this.taskName = newName; }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/model/TaskTimeRange.ets#L25-L27
a69056c48045747c7c42a8956ec18bc590c3458c
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets
arkts
notifyDataChange
通知控制器数据变化
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); }
AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets#L45-L49
aba16ea06184cc73614d55266ae10ec77feb0bfe
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/Index.ets
arkts
AddressRecognize
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, soft...
export { AddressRecognize } from './src/main/ets/view/AddressRecognize';
AST#export_declaration#Left export { AddressRecognize } from './src/main/ets/view/AddressRecognize' ; AST#export_declaration#Right
export { AddressRecognize } from './src/main/ets/view/AddressRecognize';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/Index.ets#L15-L15
fbf39610624ab1b8c2bc8bc5c5a38e14883ada41
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
incrementLearnTimesForWord
增加单词的学习次数
async incrementLearnTimesForWord(word: WordUser): Promise<void> { word.incrementLearnTimes(); await WordUserDbAccess.shared.saveWordUser(word); }
AST#method_declaration#Left async incrementLearnTimesForWord AST#parameter_list#Left ( AST#parameter#Left word : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge...
async incrementLearnTimesForWord(word: WordUser): Promise<void> { word.incrementLearnTimes(); await WordUserDbAccess.shared.saveWordUser(word); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L845-L848
0367375cc5d9a524945657896e703c087a37132a
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SHA.ets
arkts
hmac
消息认证码计算 @param str 计算字符串 @returns
static async hmac(str: string): Promise<OutDTO<string>> { return DynamicUtil.hmac(str, 'SHA256'); }
AST#method_declaration#Left static async hmac AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr...
static async hmac(str: string): Promise<OutDTO<string>> { return DynamicUtil.hmac(str, 'SHA256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHA.ets#L78-L80
9785f8f819937c517cb50d50498cc539202726b3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
initUIRange
初始化视频剪辑范围
initUIRange() { this.componentRect = [0, 0, this.componentMaxWidth, this.componentMaxHeight]; this.leftThumbRect = [0, 0, this.leftThumbWidth, this.componentMaxHeight]; this.leftThumbPosition = { x: this.leftThumbRect[0], y: this.leftThumbRect[1] }; this.leftTextPosition = { x: this.leftThumbRect[0], y...
AST#method_declaration#Left initUIRange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentRect AST#member_expression#Ri...
initUIRange() { this.componentRect = [0, 0, this.componentMaxWidth, this.componentMaxHeight]; this.leftThumbRect = [0, 0, this.leftThumbWidth, this.componentMaxHeight]; this.leftThumbPosition = { x: this.leftThumbRect[0], y: this.leftThumbRect[1] }; this.leftTextPosition = { x: this.leftThumbRect[0], y...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L277-L321
3c6c7ba716808e175f50969b4fba7a104aa9c4c8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/datasource/BasicDataSource.ets
arkts
registerDataChangeListener
该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听
public registerDataChangeListener(listener: DataChangeListener): void { this.listeners.add(listener); }
AST#method_declaration#Left public registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t...
public registerDataChangeListener(listener: DataChangeListener): void { this.listeners.add(listener); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/datasource/BasicDataSource.ets#L44-L46
8bd8fcf8848498217af2d489bf3f6a9d2e949d2a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets
arkts
getData
获取索引对应的数据 @param index 数组索引 @returns
public getData(index: number): SiteItem { return this.dataList[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SiteItem AST#primary_type...
public getData(index: number): SiteItem { return this.dataList[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets#L152-L154
3b8367f0a8b224f79ec56dfbbacf300cedc9f52e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
媒体文件类型枚举
export enum MediaType { IMAGE = 'image', AUDIO = 'audio', VIDEO = 'video' }
AST#export_declaration#Left export AST#enum_declaration#Left enum MediaType AST#enum_body#Left { AST#enum_member#Left IMAGE = AST#expression#Left 'image' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left AUDIO = AST#expression#Left 'audio' AST#expression#Right AST#enum_member#Right , AST#enum_member#Lef...
export enum MediaType { IMAGE = 'image', AUDIO = 'audio', VIDEO = 'video' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L18-L22
c11ea7c9ca3fd874aaea7e44df71638b2a36559f
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/main/sub/list/SubListView.ets
arkts
SearchPanel
MARK: - Search Panel
@Builder SearchPanel() { Row() { Search({placeholder: '', value: $$this.searchText, controller: this.searchController}) .backgroundColor($r('app.color.color_obscure')) .layoutWeight(1) .enterKeyType(EnterKeyType.Search) .enableHapticFeedback(true) //.enableKeyboardOnFoc...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SearchPanel AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder SearchPanel() { Row() { Search({placeholder: '', value: $$this.searchText, controller: this.searchController}) .backgroundColor($r('app.color.color_obscure')) .layoutWeight(1) .enterKeyType(EnterKeyType.Search) .enableHapticFeedback(true) .onB...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/list/SubListView.ets#L109-L156
30bfa6b2cb7eb2b9ac5e265c7265e2fb90b25413
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/pages/SettingsPage.ets
arkts
loadLogFiles
加载日志文件列表
private async loadLogFiles(): Promise<void> { this.logService.info('SettingsPage', '开始加载日志文件...'); try { // 检查并确保日志服务已初始化 if (!this.logService.isServiceInitialized()) { console.warn('[SettingsPage] 日志服务未初始化,尝试初始化...'); const context = this.getUIContext().getHostContext() as common.UI...
AST#method_declaration#Left private async loadLogFiles AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#...
private async loadLogFiles(): Promise<void> { this.logService.info('SettingsPage', '开始加载日志文件...'); try { if (!this.logService.isServiceInitialized()) { console.warn('[SettingsPage] 日志服务未初始化,尝试初始化...'); const context = this.getUIContext().getHostContext() as common.UIAbilityContext; ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/SettingsPage.ets#L105-L134
ad6189ce14206834a4aa334733517ec5bababcdc
github
knight6236/Pomodoro-Timer.git
7810017895bdfaad31cb5b664edd08a712272080
entry/src/main/ets/pages/Index.ets
arkts
DialogBuilder
定义对话框内容构建器
@Builder DialogBuilder() { Column() { Text('添加任务') .fontSize(20) .fontWeight(FontWeight.Bold) .margin({ top: 16, bottom: 16 }) TextInput({ placeholder: '输入任务名称' }) .width('90%') .height(50) .margin({ top: 8 }) .onChange((value: string) => { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DialogBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_el...
@Builder DialogBuilder() { Column() { Text('添加任务') .fontSize(20) .fontWeight(FontWeight.Bold) .margin({ top: 16, bottom: 16 }) TextInput({ placeholder: '输入任务名称' }) .width('90%') .height(50) .margin({ top: 8 }) .onChange((value: string) => { ...
https://github.com/knight6236/Pomodoro-Timer.git/blob/7810017895bdfaad31cb5b664edd08a712272080/entry/src/main/ets/pages/Index.ets#L62-L118
9c2001a29fe42943ae5c2ac41be1a0471cca9ec7
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCameraComp.ets
arkts
updateCameraSurfaceSize
动态更新XComponent的Suerface尺寸 @param {number} width 新宽度 @param {number} height 新高度 @returns {void}
updateCameraSurfaceSize(width: number, height: number, offsetX: number, offsetY: number): void { this.cameraSurfaceController.setXComponentSurfaceRect({ offsetX: vp2px(offsetX), offsetY: vp2px(offsetY), surfaceWidth: vp2px(width), surfaceHeight: vp2px(height), }) logger.info(`setXCo...
AST#method_declaration#Left updateCameraSurfaceSize AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
updateCameraSurfaceSize(width: number, height: number, offsetX: number, offsetY: number): void { this.cameraSurfaceController.setXComponentSurfaceRect({ offsetX: vp2px(offsetX), offsetY: vp2px(offsetY), surfaceWidth: vp2px(width), surfaceHeight: vp2px(height), }) logger.info(`setXCo...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCameraComp.ets#L82-L91
712fc7240e27d0dc54fc7a4062b7622f378fba61
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/order/OrderNavigator.ets
arkts
toDetail
跳转到订单详情 @param {number} orderId - 订单 ID @returns {void} 无返回值
static toDetail(orderId: number): void { const params: OrderIdParam = { orderId }; navigateTo(OrderRoutes.Detail, params); }
AST#method_declaration#Left static toDetail AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#...
static toDetail(orderId: number): void { const params: OrderIdParam = { orderId }; navigateTo(OrderRoutes.Detail, params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderNavigator.ets#L38-L41
4d571bb768d1130e629e3f582ee8d24ac49d7f28
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets
arkts
PreviewWindowComponent
预览小窗口组件。
@Component export struct PreviewWindowComponent { private context: Context = getContext(this); // 截图后生成的图片,与父组件双向同步 @Link mergedImage: PixelMap | undefined; // 截图后小窗大小,与父组件双向同步 @Link snapPopupWidth: number; @Link snapPopupHeight: number; @Link snapPopupPosition: Position; // 是否显示预览窗口,与父组件双向同步 @Link @W...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PreviewWindowComponent AST#component_body#Left { AST#property_declaration#Left private context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right = AST#expression...
@Component export struct PreviewWindowComponent { private context: Context = getContext(this); @Link mergedImage: PixelMap | undefined; @Link snapPopupWidth: number; @Link snapPopupHeight: number; @Link snapPopupPosition: Position; @Link @Watch('onShowChanged') isShowSnapPopup: boolean; @Link sho...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L30-L311
d7308b4911b277496de57f5f0fa06f6a7a289438
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
setCanvasSize
Set Canvas display state. @param width @param height
setCanvasSize(width: number, height: number): void { Logger.info(TAG, `setCanvasSize: width[${width}], height[${height}]`); this.displayWidth = width; this.displayHeight = height; let limit = this.calcNewLimit(); if (this.isCropShowInitialized) { this.cropShow.syncLimitRect(limit); this....
AST#method_declaration#Left setCanvasSize AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
setCanvasSize(width: number, height: number): void { Logger.info(TAG, `setCanvasSize: width[${width}], height[${height}]`); this.displayWidth = width; this.displayHeight = height; let limit = this.calcNewLimit(); if (this.isCropShowInitialized) { this.cropShow.syncLimitRect(limit); this....
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L118-L131
5cd27c6a318eab53bd13c605c17e052b810b2661
gitee
AlbertZyc/tab-layout
4ba256eead3792c84128f8679b26ac159a2d7f06
tablayout/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.0.15';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.0.15' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.0.15';
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/tablayout/BuildProfile.ets#L4-L4
d35fe3c15990f377ffec0709d463562a04d059be
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Linear.ets
arkts
columnStyle
自定义样式:column
@Styles columnStyle() { .width(180) .height(120) .border({ width: 1 }) .margin({ bottom: 10 }) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right columnStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 180 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expre...
@Styles columnStyle() { .width(180) .height(120) .border({ width: 1 }) .margin({ bottom: 10 }) }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Linear.ets#L51-L56
596ce0ce9b4713e73b20a76e49bb3982e05fa589
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customtabbar/src/main/ets/util/CustomTabBar.ets
arkts
checkParam
检查输入参数
checkParam() { if (!this.tabsInfo || this.tabsInfo.length === 0) { this.tabsInfo = [ new TabBarInfo(0, CommonConstants.DEFAULT_TITLE1_TAB, CommonConstants.DEFAULT_ICON, CommonConstants.DEFAULT_ICON, CommonConstants.SELECTED_TITLE_FONT_COLOR, CommonConstants.DEFAULT_ICON), new TabBarI...
AST#method_declaration#Left checkParam AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left...
checkParam() { if (!this.tabsInfo || this.tabsInfo.length === 0) { this.tabsInfo = [ new TabBarInfo(0, CommonConstants.DEFAULT_TITLE1_TAB, CommonConstants.DEFAULT_ICON, CommonConstants.DEFAULT_ICON, CommonConstants.SELECTED_TITLE_FONT_COLOR, CommonConstants.DEFAULT_ICON), new TabBarI...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customtabbar/src/main/ets/util/CustomTabBar.ets#L75-L88
75bef83515ef4231b125d8dce4d1383bb383bb94
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
通用分页接口
export interface PaginationParams { page: number; pageSize: number; total?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PaginationParams AST#object_type#Left { AST#type_member#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left pageSize : AST#type_annotati...
export interface PaginationParams { page: number; pageSize: number; total?: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L16-L20
e25c5d018116cd4866a38f259b136adb36fa812d
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Loading.ets
arkts
aboutToAppear
页面滚动条 生命周期函数,创建组件实例后,执行build渲染函数之前
aboutToAppear() { }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear() { }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Loading.ets#L13-L15
bdec9948f10eed00adcdcf553d6e222a135b4508
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
mergeThemeSettings
私有辅助方法 合并主题设置
private mergeThemeSettings(current: ThemeSettings, updates: Partial<ThemeSettings>): ThemeSettings { const result: ThemeSettings = { mode: updates.mode !== undefined ? updates.mode : current.mode, primaryColor: updates.primaryColor !== undefined ? updates.primaryColor : current.primaryColor, accen...
AST#method_declaration#Left private mergeThemeSettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left ThemeSettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AS...
private mergeThemeSettings(current: ThemeSettings, updates: Partial<ThemeSettings>): ThemeSettings { const result: ThemeSettings = { mode: updates.mode !== undefined ? updates.mode : current.mode, primaryColor: updates.primaryColor !== undefined ? updates.primaryColor : current.primaryColor, accen...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L469-L483
1d978ff6ed9225e3349ab56ca9c8e9a99cdd2858
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ColorTemplate.ets
arkts
blue
from Color blue() @param color
public static blue(color: number): number { return color & 0xFF; }
AST#method_declaration#Left public static blue AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
public static blue(color: number): number { return color & 0xFF; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L266-L268
ba11046e32fbf46c0b598e65aaf7c69f48bc28af
gitee
Huarrrr/MiShop_HarmonyOS.git
a94d941f50550522c8324416afe4551ed4a2df93
entry/src/main/ets/widgets/TitleLayout.ets
arkts
TitleLayout
公共标题栏
@Component export struct TitleLayout { @Link title: string; isJustShowStatusBar: boolean = false; showBack: boolean = true; onBack: () => void = () => { router.back(); } menuIcon?: Resource; onMenuClick?: () => void; build() { Column() { Row() .width('100%') .height(Window...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio...
@Component export struct TitleLayout { @Link title: string; isJustShowStatusBar: boolean = false; showBack: boolean = true; onBack: () => void = () => { router.back(); } menuIcon?: Resource; onMenuClick?: () => void; build() { Column() { Row() .width('100%') .height(Window...
https://github.com/Huarrrr/MiShop_HarmonyOS.git/blob/a94d941f50550522c8324416afe4551ed4a2df93/entry/src/main/ets/widgets/TitleLayout.ets#L5-L65
9c7d7bf960ff09dcc7a95760e1a00c13685e0b99
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets
arkts
handleNumberInput
体重处理-------------------------------------------------- 处理数字输入
handleNumberInput(num: string) { // 限制输入长度 if (this.inputValue.length >= 10) return; // 处理小数点逻辑 if (num === '.' && this.inputValue.includes('.')) return; // 处理前导零 if (this.inputValue === '0' && num !== '.') { this.inputValue = num; } else { this.inputValue += num; } }
AST#method_declaration#Left handleNumberInput AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 限制输入长度 AST#statement#Left AST#if_statement#...
handleNumberInput(num: string) { if (this.inputValue.length >= 10) return; if (num === '.' && this.inputValue.includes('.')) return; if (this.inputValue === '0' && num !== '.') { this.inputValue = num; } else { this.inputValue += num; } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets#L21-L34
ec16811b902320d59dc460d353908b5aa62f1f43
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/util.ets
arkts
ZigZag decode 64-bit bigint
export function unZigZag64(n: bigint): bigint { return (n >> 1n) ^ (-(n & 1n)) }
AST#export_declaration#Left export AST#function_declaration#Left function unZigZag64 AST#parameter_list#Left ( AST#parameter#Left n : AST#type_annotation#Left AST#primary_type#Left bigint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prima...
export function unZigZag64(n: bigint): bigint { return (n >> 1n) ^ (-(n & 1n)) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/util.ets#L127-L129
c32342e067e00c7b2d633de449b42f16883626b8
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkNightModeUsable
/ 检查 是否可以使用夜晚模式
public checkNightModeUsable(showMessage: boolean = true): boolean { if (!this.nonMember.isLockedNightMode) { return true } // 非会员 锁定夜晚模式 功能是否启用 if (this.isActive) { return true } // 非会员才做检查 if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_night_mode')) } retur...
AST#method_declaration#Left public checkNightModeUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AS...
public checkNightModeUsable(showMessage: boolean = true): boolean { if (!this.nonMember.isLockedNightMode) { return true } if (this.isActive) { return true } if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_night_mode')) } return false }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L302-L311
5b406d05fdbff049c33d951d309f548e204ccbdc
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Description.ets
arkts
setPosition
Sets a custom position for the description text in pixels on the screen. @param x - xcoordinate @param y - ycoordinate
public setPosition(x: number, y: number): void { if (this.mPosition == null) { this.mPosition = MPPointF.getInstance(x, y); } else { this.mPosition.x = x; this.mPosition.y = y; } }
AST#method_declaration#Left public setPosition AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
public setPosition(x: number, y: number): void { if (this.mPosition == null) { this.mPosition = MPPointF.getInstance(x, y); } else { this.mPosition.x = x; this.mPosition.y = y; } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Description.ets#L66-L73
82d1228f3559816515bf6c04082743737545e710
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
getSignalLevel
获取当前连接Wi-Fi的信号强度 通过获取信号强度,用户可以初步判断当前网络是否能够满足其对速度的需求。 取值范围为[0, 4],取值越大表示信号越强 @returns 信号强度,取值范围[0, 4],-1表示报错
async getSignalLevel(): Promise<number> { try { let wifiLinkedInfo: wifiManager.WifiLinkedInfo = await wifiManager.getLinkedInfo(); let rssi = wifiLinkedInfo.rssi; let band = wifiLinkedInfo.band; let level = wifiManager.getSignalLevel(rssi, band); logger.info("level:" + JSON.stringify(...
AST#method_declaration#Left async getSignalLevel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type...
async getSignalLevel(): Promise<number> { try { let wifiLinkedInfo: wifiManager.WifiLinkedInfo = await wifiManager.getLinkedInfo(); let rssi = wifiLinkedInfo.rssi; let band = wifiLinkedInfo.band; let level = wifiManager.getSignalLevel(rssi, band); logger.info("level:" + JSON.stringify(...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L253-L265
a63bc251559adac9e3674f0e0323775ad176d362
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/AlbumSetPage.ets
arkts
onActive
Callback when the page is in the foreground
onActive(): void { if (!this.isActive) { Log.info(TAG, 'onActive'); this.isActive = true; this.albumsDataSource.dataRemove(); } this.loadItem(); }
AST#method_declaration#Left onActive AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expressi...
onActive(): void { if (!this.isActive) { Log.info(TAG, 'onActive'); this.isActive = true; this.albumsDataSource.dataRemove(); } this.loadItem(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/AlbumSetPage.ets#L307-L314
d8baca1ee21c97b84c1483dc3c5176a35c22c9f9
gitee
sRect/Harmony-Arkts-todolist.git
d854c95e96ec2ab8aef0f829a8b7e0a57dd3ab34
entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
其build()函数之前执行 允许在aboutToAppear函数中改变状态变量,更改将在后续执行build()函数中生效
aboutToAppear(): void { console.log('aboutToAppear'); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { console.log('aboutToAppear'); }
https://github.com/sRect/Harmony-Arkts-todolist.git/blob/d854c95e96ec2ab8aef0f829a8b7e0a57dd3ab34/entry/src/main/ets/pages/Index.ets#L11-L13
189901075c17668abd6e07b302ad2c0f4866bbba
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
TODO:知识点:步骤三: 注册UIAbility的ID及其对应的UIContext,此方法应确保在loadContent成功之后执行, 即EntryAbility中的onWindowStageCreate中的windowStage.loadContent回调中执行 @param abilityID:UIAbility的ID @param windowStage:UIAbility对应的windowStage对象
export function addUIContext(abilityID: string, windowClass: window.Window): void { const uiContext: UIContext = windowClass.getUIContext(); // TODO:知识点:添加UIAbility的id及其对应UIContext,后续将uiContext传回ets侧,以确保多实例情况下事件在正确的窗口/UIAbility内发生 if (etswrapper !== undefined && etswrapper.addUIContext !== undefined) { etswra...
AST#export_declaration#Left export AST#function_declaration#Left function addUIContext AST#parameter_list#Left ( AST#parameter#Left abilityID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotatio...
export function addUIContext(abilityID: string, windowClass: window.Window): void { const uiContext: UIContext = windowClass.getUIContext(); if (etswrapper !== undefined && etswrapper.addUIContext !== undefined) { etswrapper.addUIContext(abilityID, uiContext); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets#L125-L131
a594d131d1dd3782b9e2b0883f273d2a935d6cfa
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets
arkts
构造函数私有
private constructor() { // downloader = CosDownloader.shared /// do nothing.. }
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // downloader = CosDownloader.shared /// do nothing.. } AST#block_statement#Right AST#constructor_declaration#Right
private constructor() { }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookManager.ets#L32-L35
a115fbf576c682876431023024e906858b767538
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets
arkts
compareTo
MARK: - 比较(Comparable) 比较两个DayOf对象的大小 @param other - 另一个DayOf对象
compareTo(other: DayOf): number { return this.num - other.num; }
AST#method_declaration#Left compareTo AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
compareTo(other: DayOf): number { return this.num - other.num; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets#L106-L108
33e939d717fcb7d7f2c3c8f94655d2586865d1c4
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/PreviewUtil.ets
arkts
previewVideo
预览视频 @param uri 预览uri
static async previewVideo(uri: string): Promise<void> { await PreviewUtil.openPreview('video', uri); }
AST#method_declaration#Left static async previewVideo AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
static async previewVideo(uri: string): Promise<void> { await PreviewUtil.openPreview('video', uri); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L59-L61
18cab3ef317a20dd7ec57b9f6a6f7c671ebe5d9e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
moveFile
移动文件,使用Promise异步回调。 @param src string 源文件的应用沙箱路径。 @param dest string 目的文件的应用沙箱路径。 @param mode number 移动模式。若mode为0,移动位置存在同名文件时,强制移动覆盖。若mode为1,移动位置存在同名文件时,抛出异常。默认为0。 @returns
static moveFile(src: string, dest: string, mode: number = 0): Promise<void> { return fs.moveFile(src, dest, mode) }
AST#method_declaration#Left static moveFile AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dest : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static moveFile(src: string, dest: string, mode: number = 0): Promise<void> { return fs.moveFile(src, dest, mode) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L645-L647
67d72cb5925a02d696c68fb5ac13bc5228c6dab7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
startVideoRecording
开始录像
async startVideoRecording(config?: Partial<VideoRecordConfig>): Promise<void> { try { const recordConfig = { ...this.defaultVideoConfig, ...config }; // 创建录像器 this.videoRecorder = await media.createAVRecorder(); // 配置录像参数 const videoRecorderConfig: media.AVRecorderConfig = { ...
AST#method_declaration#Left async startVideoRecording AST#parameter_list#Left ( AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left VideoRecordConfig AST#primary_type#Right AST#type_annotation...
async startVideoRecording(config?: Partial<VideoRecordConfig>): Promise<void> { try { const recordConfig = { ...this.defaultVideoConfig, ...config }; this.videoRecorder = await media.createAVRecorder(); const videoRecorderConfig: media.AVRecorderConfig = { audioSourceType: ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L458-L503
df9e6c40537ebf1565171c20ea59df6cff36ff86
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets
arkts
handleStyledString
将文本处理成最终展示的属性字符串
handleStyledString() { this.paragraphStyledString = new MutableStyledString('', []); // 处理自定义span列表数据,生成属性字符串数组 this.styledStrings = this.processCustomSpans(this.spans); // 将每个文本片段生成的属性字符串追加到属性字符串paragraphStyledString中 this.styledStrings.forEach((mutableStyledString: MutableStyledString, index: numb...
AST#method_declaration#Left handleStyledString AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paragraphStyledString AST#membe...
handleStyledString() { this.paragraphStyledString = new MutableStyledString('', []); this.styledStrings = this.processCustomSpans(this.spans); this.styledStrings.forEach((mutableStyledString: MutableStyledString, index: number) => { this.paragraphStyledString.appendStyledString(mutableStyled...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets#L68-L76
b23692e64651677992c1e6ba4cf9a5b7db1f63ea
gitee
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/FileManager.ets
arkts
importFile
导入文件 @returns 文件内容
async importFile(): Promise<string | null> { try { console.info('📥 开始导入文件') // 创建文档选择器 const documentSelectOptions = new picker.DocumentSelectOptions() documentSelectOptions.maxSelectNumber = 1 console.info('🔍 打开文件选择器...') const documentPicker = new picker.Documen...
AST#method_declaration#Left async importFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#L...
async importFile(): Promise<string | null> { try { console.info('📥 开始导入文件') const documentSelectOptions = new picker.DocumentSelectOptions() documentSelectOptions.maxSelectNumber = 1 console.info('🔍 打开文件选择器...') const documentPicker = new picker.DocumentViewPicke...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/FileManager.ets#L74-L184
9998d2498aea3abbeabc07e50c2c29c5989923fc
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getGoodsPage
分页查询商品 @param params 商品搜索请求参数 @returns 商品分页数据
async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> { return this.networkDataSource.getGoodsPage(params); }
AST#method_declaration#Left async getGoodsPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsSearchRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> { return this.networkDataSource.getGoodsPage(params); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/GoodsRepository.ets#L29-L31
0d9a688062f332c21d7e4c2b6c6f8b906170db1f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/launch/LaunchParam.ets
arkts
@file 启动流程模块导航参数定义 @author Joker.X 引导页参数
export interface LaunchGuideParam { /** * 是否从设置页进入 */ fromSettings?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LaunchGuideParam AST#object_type#Left { /** * 是否从设置页进入 */ AST#type_member#Left fromSettings ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_t...
export interface LaunchGuideParam { fromSettings?: boolean; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/launch/LaunchParam.ets#L9-L14
06a65ab5b077026da2a86b5d8055b1f55d6a2890
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/ImageUtil.ets
arkts
getPixelMapFromMedia
获取resource目录下media中的图片转换成PixelMap @param resource 资源 @returns
static async getPixelMapFromMedia(resource: Resource): Promise<OutDTO<image.PixelMap>> { //获取资源管理器 let resourceManager = getContext().resourceManager; //获取图片uint8数组 let uint8Array = resourceManager.getMediaContentSync(resource); //转换 let pm = await ImageUtil.arrayBuffer2PixelMap(buffer.from(uint...
AST#method_declaration#Left static async getPixelMapFromMedia AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left A...
static async getPixelMapFromMedia(resource: Resource): Promise<OutDTO<image.PixelMap>> { let resourceManager = getContext().resourceManager; let uint8Array = resourceManager.getMediaContentSync(resource); let pm = await ImageUtil.arrayBuffer2PixelMap(buffer.from(uint8Array).buffer); if (p...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L318-L329
5478a6f19aaa8a9b5d3dfb3cb1d9bf568f83c75b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets
arkts
buildHeader
构建页面头部
@Builder buildHeader() { AppHeader({ title: '联系人详情', showBack: true, showAction: true, actionIcon: $r('app.media.ic_more'), onAction: () => { this.showActionSheet = true; } }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppHeader ( AST#component_parameters#Left { AST#component_para...
@Builder buildHeader() { AppHeader({ title: '联系人详情', showBack: true, showAction: true, actionIcon: $r('app.media.ic_more'), onAction: () => { this.showActionSheet = true; } }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L138-L149
622bf9cf6def492b123fe9310194724d9201bc73
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
learnedWordsFor
/获取已经学习或复习的Words
learnedWordsFor(dayOf: DayOf, distances: number[] | null = null): WordUser[] { let ids = this.learnedWordIdsFor(dayOf, distances); return this.getWordsByIds(ids); }
AST#method_declaration#Left learnedWordsFor AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left distances : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left A...
learnedWordsFor(dayOf: DayOf, distances: number[] | null = null): WordUser[] { let ids = this.learnedWordIdsFor(dayOf, distances); return this.getWordsByIds(ids); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L374-L377
baebf74a0fb7b39b432b7016ddb87ebe93bf049c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/mapthumbtack/src/main/ets/components/LocationAndPopupComponent.ets
arkts
LocationAndPopUpComponent
定位地址弹窗组件 @param thumbTackState 用于设置大头针状态,ThumbTackState.EMPTY、ThumbTackState.LOADING、ThumbTackState.SHOWING。 @param address 组件处于ThumbTackState.SHOWING状态时,需要显示的地址文本;组件处于其他状态时,需设置为null。 @param tip 组件处于ThumbTackState.SHOWING状态时,需要显示的当前地址的一些提示,组件处于其他状态或无提示文本时,需设置为null。 @param tipBackgroundColor 组件处于ThumbTackState.SHOWING状态...
@Component export struct LocationAndPopUpComponent { @Link @Watch('onAddrStateChanged') thumbTackState: ThumbTackState; @Link address: string | null; @Link tip: string | null; @Link tipBackgroundColor: Color; @Link addrImage: PixelMap | ResourceStr | DrawableDescriptor | ImageContent | null; public onImageC...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LocationAndPopUpComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onAddrStateChanged' AST#expression#Righ...
@Component export struct LocationAndPopUpComponent { @Link @Watch('onAddrStateChanged') thumbTackState: ThumbTackState; @Link address: string | null; @Link tip: string | null; @Link tipBackgroundColor: Color; @Link addrImage: PixelMap | ResourceStr | DrawableDescriptor | ImageContent | null; public onImageC...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mapthumbtack/src/main/ets/components/LocationAndPopupComponent.ets#L32-L111
b8dd135c8cf8069f46d3e21620a0533cd22ed956
gitee
devaige/HarmonyOSOfficialDemo.git
8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c
RankingDemo/entry/src/main/ets/viewmodel/RankData.ets
arkts
Copyright (c) 2022 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, soft...
export class RankData { name: Resource; vote: string; // Number of votes id: string; constructor(id: string, name: Resource, vote: string) { this.id = id; this.name = name; this.vote = vote; } }
AST#export_declaration#Left export AST#class_declaration#Left class RankData AST#class_body#Left { AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left vote : AST#type_...
export class RankData { name: Resource; vote: string; id: string; constructor(id: string, name: Resource, vote: string) { this.id = id; this.name = name; this.vote = vote; } }
https://github.com/devaige/HarmonyOSOfficialDemo.git/blob/8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c/RankingDemo/entry/src/main/ets/viewmodel/RankData.ets#L16-L26
2366d9f5142ae7ec6e3c62f8ba40b5ad87f7aad3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets
arkts
getData
获取指定数据项
public getData(index: number): CommentModel { return this.originDataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommentModel AST#primary_...
public getData(index: number): CommentModel { return this.originDataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets#L62-L64
797df3300e69be80393d4a93211b91885380d53c
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets
arkts
generateRSAKey
生成RSA的非对称密钥 @param resultCoding 生成RSA秘钥的字符串格式(hex/base64)-默认不传为base64格式 @returns RSA密钥{publicKey:公钥,privateKey:私钥}
static generateRSAKey(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<CryptoKey> { return CryptoSyncUtil.generateCryptoKey('RSA1024', resultCoding); }
AST#method_declaration#Left static generateRSAKey AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expres...
static generateRSAKey(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<CryptoKey> { return CryptoSyncUtil.generateCryptoKey('RSA1024', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L35-L37
7845301eb3f0990b2ab3075cbbd558bd5887c518
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets
arkts
判断日期是否为今天 @param date 日期对象 @returns 是否为今天
export function isToday(date: Date): boolean { const today = new Date(); return date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear(); }
AST#export_declaration#Left export AST#function_declaration#Left function isToday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary...
export function isToday(date: Date): boolean { const today = new Date(); return date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear(); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L101-L106
6511ffa64434de666ba162d963b35d6e409e46c4
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Chip.d.ets
arkts
Defines label option. @interface LabelOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Defines label option. @interface LabelOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface LabelOptions { /** * Text content. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Text content. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @s...
AST#export_declaration#Left export AST#interface_declaration#Left interface LabelOptions AST#object_type#Left { /** * Text content. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Text content. * * @type { string } * @syscap SystemC...
export interface LabelOptions { text: string; fontSize?: Dimension; fontColor?: ResourceColor; activatedFontColor?: ResourceColor; fontFamily?: string; labelMargin?: LabelMarginOptions; localizedLabelMargin?: LocalizedLabelMarginOptions; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L546-L664
954d7a82762a1ea978283cef77ef74241629fdb6
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
updateById
更新指定 ID 的记录 @param {number} id - 记录主键 @returns {Promise<void>} Promise<void>
private async updateById(id: number): Promise<void> { const entity: DemoEntity = new DemoEntity(); entity.id = id; entity.title = this.titleInput.trim(); entity.description = this.descInput.trim(); await this.demoRepository.updateDemo(entity); }
AST#method_declaration#Left private async updateById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L...
private async updateById(id: number): Promise<void> { const entity: DemoEntity = new DemoEntity(); entity.id = id; entity.title = this.titleInput.trim(); entity.description = this.descInput.trim(); await this.demoRepository.updateDemo(entity); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets#L138-L144
55274c11e58a9f5c8c02a3bf32c29b44b945cff4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'LLMConfigPage aboutToAppear'); this.loadProviders(); this.loadCurrentConfig(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expre...
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'LLMConfigPage aboutToAppear'); this.loadProviders(); this.loadCurrentConfig(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L34-L38
119b38d8f07416b4c8ca043022e1c6cb82904e27
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/UseTaskPool.ets
arkts
[Start use_task_pool]
build() { Column({ space: 2 }) { Row({ space: 5 }) { Column() { Image($r('app.media.chevron_left')) .width(16) .height(16) } .width(40) .height(40) .justifyContent(FlexAlign.Center) .backgroundColor('#E8E8E8') .borderRad...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 2 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right...
build() { Column({ space: 2 }) { Row({ space: 5 }) { Column() { Image($r('app.media.chevron_left')) .width(16) .height(16) } .width(40) .height(40) .justifyContent(FlexAlign.Center) .backgroundColor('#E8E8E8') .borderRad...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/UseTaskPool.ets#L50-L119
4c52cbf09bdb01769db7616a9bae03dae40cb552
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/StorageUtils.ets
arkts
remove
删除数据 @param key 存储键
static async remove(key: string): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.delete(key); await dataPreferences.flush(); } catch (error) { ...
AST#method_declaration#Left static async remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
static async remove(key: string): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.delete(key); await dataPreferences.flush(); } catch (error) { ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L182-L195
9c8cb18aafdbbb48d75487a69a9f463094a7d528
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/constraint.ets
arkts
选择日期类型
export enum DateType { YmdHms, //年月日时分秒 YmdHm, //年月日时分 YmdH, //年月日时 Ymd, //年月日 Ym, //年月 Y, //年 Hms, //时分秒 Hm, //时分 Ms //分秒 }
AST#export_declaration#Left export AST#enum_declaration#Left enum DateType AST#enum_body#Left { AST#enum_member#Left YmdHms AST#enum_member#Right , //年月日时分秒 AST#enum_member#Left YmdHm AST#enum_member#Right , //年月日时分 AST#enum_member#Left YmdH AST#enum_member#Right , //年月日时 AST#enum_member#Left Ymd AST#enum_member#Right ...
export enum DateType { YmdHms, YmdHm, YmdH, Ymd, Ym, Y, Hms, Hm, Ms }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/constraint.ets#L51-L61
29733f0fb071634497c00f05fc41664052fed932
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listslidetohistory/src/main/ets/model/BasicDataSource.ets
arkts
文字配图
constructor(id: string, userName: string, avatar: string, text: string, image?: string) { this.id = id; this.userName = userName; this.avatar = avatar; this.text = text; if (image !== undefined) { this.image = image; } }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
constructor(id: string, userName: string, avatar: string, text: string, image?: string) { this.id = id; this.userName = userName; this.avatar = avatar; this.text = text; if (image !== undefined) { this.image = image; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/model/BasicDataSource.ets#L81-L89
c4c45dacb1aee53b2dc18f6f13bc484e21891be9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/product/entry/src/main/ets/widget/utils/CaseCardUtils.ets
arkts
卡片展示最大案例数
export class CaseCardUtils { // 案例字符串格式化 public static formatData(data: string) { let result: CASES[] = []; if (data.indexOf('**下面是详细的案例列表:**') > -1) { let casesArray: string[] = data.split('**下面是详细的案例列表:**')[1].split('####'); for (let i = 1; i < CASES_MAX_LENGTH; i++) { const cases: CAS...
AST#export_declaration#Left export AST#class_declaration#Left class CaseCardUtils AST#class_body#Left { // 案例字符串格式化 AST#method_declaration#Left public static formatData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Ri...
export class CaseCardUtils { public static formatData(data: string) { let result: CASES[] = []; if (data.indexOf('**下面是详细的案例列表:**') > -1) { let casesArray: string[] = data.split('**下面是详细的案例列表:**')[1].split('####'); for (let i = 1; i < CASES_MAX_LENGTH; i++) { const cases: CASES = { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/widget/utils/CaseCardUtils.ets#L11-L39
a747acaeb9e74941cf727c48a5662c84bb3179b6
gitee
Nuist666/Alzheimer.git
c171b8e739357bfc5a3fc71c90aaea6ce5d463d1
entry/src/main/ets/model/VideoControll.ets
arkts
Get video string of current time. @param the number of current time @return the string of current time
export function changeSliderTime(value: number): string { let second: number = value % COMMON_NUM_MINUTE; let min: number = Number.parseInt((value / COMMON_NUM_MINUTE).toString()); let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min; let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : sec...
AST#export_declaration#Left export AST#function_declaration#Left function changeSliderTime AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left...
export function changeSliderTime(value: number): string { let second: number = value % COMMON_NUM_MINUTE; let min: number = Number.parseInt((value / COMMON_NUM_MINUTE).toString()); let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min; let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : sec...
https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/model/VideoControll.ets#L15-L22
71b5c848aacf9bd00dfcb20b3138c1adfd9ce422
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/CreateRoomDialog.ets
arkts
当前选择项的内容
build() { Column() { Row() { Text(this.title) .fontSize(20) .fontColor($r('app.color.COLOR_E6000000')) .fontFamily($r('app.string.font_family')) .textAlign(TextAlign.Center) .margin({ top: 14, bottom: 24 }) } .width('85%') .justifyCon...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Column() { Row() { Text(this.title) .fontSize(20) .fontColor($r('app.color.COLOR_E6000000')) .fontFamily($r('app.string.font_family')) .textAlign(TextAlign.Center) .margin({ top: 14, bottom: 24 }) } .width('85%') .justifyCon...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/CreateRoomDialog.ets#L25-L111
c6f00c937aacab935adcdbaf777a5205b6af187f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/ECDSASync.ets
arkts
verify
验签 @param signStr 已签名的字符串 @param verifyStr 需要验签的字符串 @param pubKey 公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns 验签结果OutDTO对象,其中Msg为验签结果
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, dataCoding,false); }
AST#method_declaration#Left static verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static verify(signStr: string, verifyStr: string, pubKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.verify(signStr, verifyStr, pubKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, dataCoding,false); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/ECDSASync.ets#L59-L62
1e24315daa19ccca11b971e78eb5fd51ea81b278
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets
arkts
convertSM2PubKey
将服务器端生成的16进制的长度为130位的04开头的C1C3C2格式的SM2公钥转换为前端所需的ASN.1格式公钥字符串 @param pubKey 04开头的16进制的130位的公钥字符串 @returns 转换后的公钥字符串
static convertSM2PubKey(pubKey: string): OutDTO<string> { if (pubKey.length != 130) { return OutDTO.Error('服务器端SM2公钥长度不正确~'); } //截取x参数 let px = pubKey.substring(2, 66); //截取y参数 let py = pubKey.substring(66); //转16进制放入对应的位置 04+x+y let pk: cryptoFramework.Point = { x: BigInt("...
AST#method_declaration#Left static convertSM2PubKey AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
static convertSM2PubKey(pubKey: string): OutDTO<string> { if (pubKey.length != 130) { return OutDTO.Error('服务器端SM2公钥长度不正确~'); } let px = pubKey.substring(2, 66); let py = pubKey.substring(66); let pk: cryptoFramework.Point = { x: BigInt("0x" + px), y: BigInt("0x" + p...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L96-L123
ec2b0884e1682bb9c95a1f2b84b126c0a620f4c9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupAnimation.ets
arkts
AnimationPopupExample
[Start animation_popup]
@Entry @Component export struct AnimationPopupExample { @State handlePopup: boolean = false; @State customPopup: boolean = false; @Builder popupBuilder() { Row() { Text('Custom Popup with transitionEffect').fontSize(10) }.height(50).padding(5) } build() { NavDestination() { Column({ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct AnimationPopupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right handlePopup : AST#type_annotation#Left AST#pr...
@Entry @Component export struct AnimationPopupExample { @State handlePopup: boolean = false; @State customPopup: boolean = false; @Builder popupBuilder() { Row() { Text('Custom Popup with transitionEffect').fontSize(10) }.height(50).padding(5) } build() { NavDestination() { Column({ ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupAnimation.ets#L17-L85
590b9fb78b341dec3a86601c9af34c96b7c1506c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
isSameWeek
判断两个日期是否是同一周
static isSameWeek(date1: number | string | Date, date2: number | string | Date) { const oneDayTime = 1000 * 60 * 60 * 24; let dayCount1 = DateUtil.getFormatDate(date1).getTime() / oneDayTime; let dayCount2 = DateUtil.getFormatDate(date2).getTime() / oneDayTime; let i1 = NumberUtil.toInt(((dayCount1 + 4)...
AST#method_declaration#Left static isSameWeek AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Rig...
static isSameWeek(date1: number | string | Date, date2: number | string | Date) { const oneDayTime = 1000 * 60 * 60 * 24; let dayCount1 = DateUtil.getFormatDate(date1).getTime() / oneDayTime; let dayCount2 = DateUtil.getFormatDate(date2).getTime() / oneDayTime; let i1 = NumberUtil.toInt(((dayCount1 + 4)...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L202-L209
af2ba8b298c588e4ecba9ecbedcf02e1eb795816
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbility/entry/src/main/ets/pages/PayCode.ets
arkts
stopSecondAbility
TODO 停止SecondAbility
stopSecondAbility() { }
AST#method_declaration#Left stopSecondAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
stopSecondAbility() { }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/StartAbility/entry/src/main/ets/pages/PayCode.ets#L102-L104
715be3fad60ce92c316044407757e31dcd32f429
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/CustomContentOptions.ets
arkts
TODO 自定义内容区弹出框,参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface CustomContentOptions extends BaseContentOptions { buttons?: Array<ResourceStr | ButtonOptions>; //弹出框操作区按钮,最多支持4个按钮。 onAction?: ActionStrCallBack; //按钮的CallBack事件。 contentBuilder: () => void; //弹出框内容,自定义 }
AST#export_declaration#Left export AST#interface_declaration#Left interface CustomContentOptions AST#extends_clause#Left extends BaseContentOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left buttons ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_argumen...
export interface CustomContentOptions extends BaseContentOptions { buttons?: Array<ResourceStr | ButtonOptions>; onAction?: ActionStrCallBack; contentBuilder: () => void; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/CustomContentOptions.ets#L25-L32
eeaee258d2257d551dac42bd124a9fb8108876c7
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets
arkts
setCircleHoleRadius
Sets the hole radius of the drawn circles. Default radius = 2f, Min = 0.5f @param holeRadius
public setCircleHoleRadius(holeRadius: number): void { if (holeRadius >= 0.5) { this.mCircleHoleRadius = holeRadius; } else { console.log('LineDataSet', 'Circle radius cannot be < 0.5'); } }
AST#method_declaration#Left public setCircleHoleRadius AST#parameter_list#Left ( AST#parameter#Left holeRadius : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST...
public setCircleHoleRadius(holeRadius: number): void { if (holeRadius >= 0.5) { this.mCircleHoleRadius = holeRadius; } else { console.log('LineDataSet', 'Circle radius cannot be < 0.5'); } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets#L173-L179
8a13ebed0d79ad7fdbe43c34778ebf11a76b34bb
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets
arkts
createRouter
通过名称注册路由栈
public static createRouter(routerName: string, router: NavPathStack): void { RouterModule.routerMap.set(routerName, router); }
AST#method_declaration#Left public static createRouter AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left router : AST#type_annotation#Left AST#primary_type#Left NavPath...
public static createRouter(routerName: string, router: NavPathStack): void { RouterModule.routerMap.set(routerName, router); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets#L29-L31
ba30d9eb4e12dc1678a4b887a198d3a0f660c184
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/TextDrag.ets
arkts
TextDrag
Copyright (c) 2023 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, soft...
@Component export struct TextDrag { @State visible: boolean = true // 自定义拖拽过程中显示的内容 @Builder pixelMapBuilder() { Text('OpenHarmony') .fontSize(24) } build() { Column() { Text('OpenHarmony') .id('text') .fontSize(24) .visibility(this.visible ? Visibility.Visible : ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextDrag AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right visible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotati...
@Component export struct TextDrag { @State visible: boolean = true @Builder pixelMapBuilder() { Text('OpenHarmony') .fontSize(24) } build() { Column() { Text('OpenHarmony') .id('text') .fontSize(24) .visibility(this.visible ? Visibility.Visible : Visibility.Hidde...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/TextDrag.ets#L16-L46
1841afbece598f270b42afcb2ab4f4a50e798b67
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/model/DataType.ets
arkts
列表视图阶段高度 @param {number} minHeight - 最小高度 @param {number} middleHeight - 第二阶段高度 @param {number} maxHeight - 最大高度
export class BottomDrawerHeight { minHeight: number; middleHeight: number; maxHeight: number; constructor(minHeight: number = CommonConstants.BOTTOM_DRAWER_MIN_HEIGHT, middleHeight: number = CommonConstants.BOTTOM_DRAWER_MIDDLE_HEIGHT, maxHeight: number = 0) { this.minHeight = minHeight; this.middl...
AST#export_declaration#Left export AST#class_declaration#Left class BottomDrawerHeight AST#class_body#Left { AST#property_declaration#Left minHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left mid...
export class BottomDrawerHeight { minHeight: number; middleHeight: number; maxHeight: number; constructor(minHeight: number = CommonConstants.BOTTOM_DRAWER_MIN_HEIGHT, middleHeight: number = CommonConstants.BOTTOM_DRAWER_MIDDLE_HEIGHT, maxHeight: number = 0) { this.minHeight = minHeight; this.middl...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/model/DataType.ets#L24-L35
39cb83ef3a2457aca58dbe36137717fdc8a835b2
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseEntry.ets
arkts
setIcon
Sets the icon drawable @param icon
public setIcon(icon: ChartPixelMap): void { this.mIcon = icon; }
AST#method_declaration#Left public setIcon AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ChartPixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
public setIcon(icon: ChartPixelMap): void { this.mIcon = icon; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseEntry.ets#L52-L54
4460a9f4be65559ffc1c56537fb3daf74a7c1132
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
setLoading
Set loading state @param loading - Loading state
private setLoading(loading: boolean): void { this.isLoading = loading; }
AST#method_declaration#Left private setLoading AST#parameter_list#Left ( AST#parameter#Left loading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
private setLoading(loading: boolean): void { this.isLoading = loading; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L547-L549
edf6150ef114d7a8b2762ead62d5caa607e68812
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/CustomComponent.ets
arkts
CustomTabBar
非选中状态的外边距初始值
@Component export struct CustomTabBar { @Link currentIndex: TabBarType; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; build() { Row() { ForEach(TabsInfo, (item: TabBarData) => { this.TabItem(item.id); }, (item: TabBarData) => item.id.toString()) } .p...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#ty...
@Component export struct CustomTabBar { @Link currentIndex: TabBarType; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; build() { Row() { ForEach(TabsInfo, (item: TabBarData) => { this.TabItem(item.id); }, (item: TabBarData) => item.id.toString()) } .p...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/CustomComponent.ets#L22-L75
a3cbb62177cd55a7750b6785e4dcf9b27e2ac19e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
saveCustomTheme
保存自定义主题
private async saveCustomTheme(theme: ThemeConfig): Promise<void> { // TODO: 实现保存自定义主题到本地存储 hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Saving custom theme: ${theme.colorTheme.name}`); }
AST#method_declaration#Left private async saveCustomTheme AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left ThemeConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g...
private async saveCustomTheme(theme: ThemeConfig): Promise<void> { hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Saving custom theme: ${theme.colorTheme.name}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L858-L861
d63592f33b3c56306132b56e65bff790d1feeac6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/navigationHome/index.ets
arkts
NavigationHomePage
Copyright (c) 2022 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, soft...
export { NavigationHomePage } from './src/main/ets/main/NavigationHomePage'
AST#export_declaration#Left export { NavigationHomePage } from './src/main/ets/main/NavigationHomePage' AST#export_declaration#Right
export { NavigationHomePage } from './src/main/ets/main/NavigationHomePage'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/index.ets#L16-L16
98396141c36f500812b32d5cf6537071093796d3
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets
arkts
showProblemListSheet
答题卡视图
@Builder showProblemListSheet() { Column() { Grid() { ForEach(this.examManager.examDetails, (item: ExamDetail, index: number) => { GridItem() { Stack() { Row() { } .width('100%') .width(40) .height(40) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right showProblemListSheet AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkt...
@Builder showProblemListSheet() { Column() { Grid() { ForEach(this.examManager.examDetails, (item: ExamDetail, index: number) => { GridItem() { Stack() { Row() { } .width('100%') .width(40) .height(40) ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets#L335-L387
28cd3b1555cc82ebca6cbd9aecb648766415cf88
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tcp/SmtpClient/entry/src/main/ets/pages/Index.ets
arkts
exeCmdAndWait4Response
给服务器发送命令并等待响应
async exeCmdAndWait4Response(cmd:string){ this.isServerResponse = false let result = await this.sendCmd2ServerWithCRLF(cmd) if (result != true) { return } //等待服务器响应 await this.wait4ServerResponse() }
AST#method_declaration#Left async exeCmdAndWait4Response AST#parameter_list#Left ( AST#parameter#Left cmd : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_s...
async exeCmdAndWait4Response(cmd:string){ this.isServerResponse = false let result = await this.sendCmd2ServerWithCRLF(cmd) if (result != true) { return } await this.wait4ServerResponse() }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/SmtpClient/entry/src/main/ets/pages/Index.ets#L318-L328
68aae7a24c071b5caa97b389802d5bb90341fddc
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/util/SvgUtil.ets
arkts
画svg到离线画板 @param context @param offContext @param resource svg资源,例如$r('app.media.svg_test') @param width 绘制大小 @param height @param dx 绘制左上角偏移x @param dy
export async function drawSvg(context: Context, offContext: OffscreenCanvasRenderingContext2D , resource: Resource, width: number, height: number, dx: number = 0, dy: number = 0) { const unit8Array: Uint8Array = await context.resourceManager.getMediaContent(resource); let textDecoder: util.TextDecoder = util.Text...
AST#export_declaration#Left export AST#function_declaration#Left async function drawSvg AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offContext : AST#type_annotation...
export async function drawSvg(context: Context, offContext: OffscreenCanvasRenderingContext2D , resource: Resource, width: number, height: number, dx: number = 0, dy: number = 0) { const unit8Array: Uint8Array = await context.resourceManager.getMediaContent(resource); let textDecoder: util.TextDecoder = util.Text...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/util/SvgUtil.ets#L28-L49
d165529accf8269b20d660588bd7bcbdef76c8c1
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/view/Detail/dialog/CommonDialog.ets
arkts
构建组件
build() { Column() { // 弹窗标题 Text(this.title) .fontSize(DimensionUtil.getFp($r('app.float.common_dialog_title_font_size'))) .width(CommonConstants.FULL_LENGTH) .fontColor($r('app.color.grey_divider')) .margin({ bottom: DimensionUtil.getVp($r('app.float.common_di...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 弹窗标题 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expressio...
build() { Column() { Text(this.title) .fontSize(DimensionUtil.getFp($r('app.float.common_dialog_title_font_size'))) .width(CommonConstants.FULL_LENGTH) .fontColor($r('app.color.grey_divider')) .margin({ bottom: DimensionUtil.getVp($r('app.float.common_dialog_ti...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/CommonDialog.ets#L18-L57
ba27b38a301832fdeec52befdad592a38b83ada8
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/result/src/main/ets/RequestHelper.ets
arkts
response
返回完整响应(code / data / message),需手动调用 then 处理 @returns {Promise<NetworkResponse<T>>} 完整响应 Promise
async response(): Promise<NetworkResponse<T>> { return this.runInternal(true); }
AST#method_declaration#Left async response AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type...
async response(): Promise<NetworkResponse<T>> { return this.runInternal(true); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L59-L61
450d4cc4f60f05b5f9a4cf4e78caf6ea6d8a7279
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
arkts
getData
获取数据函数 @param index @returns
public getData(index: number) { return this.originDataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left re...
public getData(index: number) { return this.originDataArray[index]; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L85-L87
fb1f7ae398874e485f8946b6d0831238a7892a55
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/NotePadOpenHarmony/entry/src/main/ets/model/NotesDataModel.ets
arkts
getSelectNotes
Get the notes by folder type. @param flag the folder type. @param allNotes all of notes. @returns subNotes.
getSelectNotes(flag: FolderType, allNotes: Array<NotesInfoBean>): Array<NotesInfoBean> { return allNotes.filter((item: NotesInfoBean) => item.folder === flag); }
AST#method_declaration#Left getSelectNotes AST#parameter_list#Left ( AST#parameter#Left flag : AST#type_annotation#Left AST#primary_type#Left FolderType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left allNotes : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
getSelectNotes(flag: FolderType, allNotes: Array<NotesInfoBean>): Array<NotesInfoBean> { return allNotes.filter((item: NotesInfoBean) => item.folder === flag); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/model/NotesDataModel.ets#L58-L60
783f296fca98e17442f54619dd7c3a7964fab225
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Solutions/PatternLock/entry/src/main/ets/common/TitleBar.ets
arkts
TitleBar
Copyright (c) 2022 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, soft...
@Component export default struct TitleBar { private title: Resource = $r('app.string.MainAbility_label') build() { Row() { Text(this.title) .fontColor(Color.White) .fontSize(28) .id('title') } .width('100%') .height('8%') .constraintSize({ minHeight: 70 }) .pad...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left A...
@Component export default struct TitleBar { private title: Resource = $r('app.string.MainAbility_label') build() { Row() { Text(this.title) .fontColor(Color.White) .fontSize(28) .id('title') } .width('100%') .height('8%') .constraintSize({ minHeight: 70 }) .pad...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Solutions/PatternLock/entry/src/main/ets/common/TitleBar.ets#L16-L33
51b95e0d8c7dd9ddaa63702c48ba6709ce1682ea
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/model/MessagesProvider.ets
arkts
updateMessageSendStatus
更新指定指纹码的消息的发送状态(更新单条消息)。 @param fingerPrint 消息指纹码(消息id) @param sendStatus 发送状态,see {@link MsgSendStatus}
updateMessageSendStatus(fingerPrint: string, sendStatus: MsgSendStatus): void { // 遍历消息列表 for(let i = 0; i < this.messages.length; i++) { let m = this.messages[i]; // 对符合条件的消息对象进行消息发送状态的设置 if(m && m.isOutgoing() && m.fingerPrintOfProtocal === fingerPrint) { // 更新状态 m.sendStatus...
AST#method_declaration#Left updateMessageSendStatus AST#parameter_list#Left ( AST#parameter#Left fingerPrint : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sendStatus : AST#type_annotation#Left AST#primary_type#Left MsgSe...
updateMessageSendStatus(fingerPrint: string, sendStatus: MsgSendStatus): void { for(let i = 0; i < this.messages.length; i++) { let m = this.messages[i]; if(m && m.isOutgoing() && m.fingerPrintOfProtocal === fingerPrint) { m.sendStatus = sendStatus; IMClient...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/MessagesProvider.ets#L80-L92
03b1b76bbe6a7de691a7b8be1182f58f92c27514
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
hasNetWiFi
判断当前网络是否是Wi-Fi网络。
static hasNetWiFi(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_WIFI); }
AST#method_declaration#Left static hasNetWiFi AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_express...
static hasNetWiFi(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_WIFI); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L139-L141
5971299330cc1c191f263894bd4b00f48c356da6
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets
arkts
digest
SM3摘要 @param str 带摘要的字符串 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns 摘要后的字符串
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.digest(str, 'SM3', resultCoding); }
AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Le...
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.digest(str, 'SM3', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets#L34-L36
f6bfc15f769b3fe16cd460603147993da9e72815
gitee