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
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/book/CategoryManager.ets
arkts
equals
实现 Equatable 接口(以名称判断)
static equals(lhs: Category, rhs: Category): boolean { return lhs.categoryName === rhs.categoryName; }
AST#method_declaration#Left static equals AST#parameter_list#Left ( AST#parameter#Left lhs : AST#type_annotation#Left AST#primary_type#Left Category AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rhs : AST#type_annotation#Left AST#primary_type#Left Category AST#primary_type#Ri...
static equals(lhs: Category, rhs: Category): boolean { return lhs.categoryName === rhs.categoryName; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/CategoryManager.ets#L12-L14
8fdf6591169190a8bb3c2245e71636c4942f7f34
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/loading/PageLoading.ets
arkts
构建页面级 Loading 视图 @returns {void} 无返回值
build(): void { Column() { Loading(); SpaceVerticalMedium(); Text(this.text); } .width(P100) .height(P100) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right 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#ui_custom_component_statement#L...
build(): void { Column() { Loading(); SpaceVerticalMedium(); Text(this.text); } .width(P100) .height(P100) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/loading/PageLoading.ets#L21-L31
2ea9b0b66830bb75b35ee1ca46e0a74d70805597
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
startBLEScan
扫描设备
startBLEScan(): boolean { Log.showInfo(TAG, `startBleScan`); if (!this.isBluetoothEnabled()) { Log.showInfo(TAG, `startBLEScan: bluetooth is disable.`); // 启动蓝牙服务 this.enableBluetooth(); promptAction.showToast({ message: $r('app.string.ble_toast_enable_bluetooth'), durat...
AST#method_declaration#Left startBLEScan 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressi...
startBLEScan(): boolean { Log.showInfo(TAG, `startBleScan`); if (!this.isBluetoothEnabled()) { Log.showInfo(TAG, `startBLEScan: bluetooth is disable.`); this.enableBluetooth(); promptAction.showToast({ message: $r('app.string.ble_toast_enable_bluetooth'), duration: Dura...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L82-L100
4c200aa692da4a5dadc12fb3b183435e8d13346f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets
arkts
this
弹出常用设置底部弹窗
this.commonSettingDialogController.open();
AST#method_declaration#Left this AST#ERROR#Left . commonSett in gDialogController . open AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
this.commonSettingDialogController.open();
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets#L121-L121
1a3232fae68fe7c33cd08789a1d82c61a9c555e9
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/FlawService.ets
arkts
listFlaw
获取故障列表 @param params 分页和筛选参数 @returns 故障列表数据
static async listFlaw(params: FlawPageParam): Promise<TableDataInfo<AgvFlaw>> { try { console.info('[FlawService] 🔍 获取故障列表,参数:', JSON.stringify(params)); let queryString = `pageNum=${params.pageNum}&pageSize=${params.pageSize}`; if (params.taskId) queryString += `&taskId=${params.ta...
AST#method_declaration#Left static async listFlaw AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left FlawPageParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
static async listFlaw(params: FlawPageParam): Promise<TableDataInfo<AgvFlaw>> { try { console.info('[FlawService] 🔍 获取故障列表,参数:', JSON.stringify(params)); let queryString = `pageNum=${params.pageNum}&pageSize=${params.pageSize}`; if (params.taskId) queryString += `&taskId=${params.ta...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L64-L89
42ca13b1ba4cbb44a2b9db7b2e23f6a75bb3c364
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/navigation/ResetPasswordNav.ets
arkts
ResetPasswordNav
@file 重置密码页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function ResetPasswordNav(): void { ResetPasswordPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ResetPasswordNav 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_cust...
@Builder export function ResetPasswordNav(): void { ResetPasswordPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/navigation/ResetPasswordNav.ets#L8-L11
c72de5ae76d65a13087328c8c78836b1a8adc918
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/digitalscrollanimation/Index.ets
arkts
DigitalScrollExampleComponent
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 { DigitalScrollExampleComponent } from './src/main/ets/pages/DigitalScrollExample';
AST#export_declaration#Left export { DigitalScrollExampleComponent } from './src/main/ets/pages/DigitalScrollExample' ; AST#export_declaration#Right
export { DigitalScrollExampleComponent } from './src/main/ets/pages/DigitalScrollExample';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/digitalscrollanimation/Index.ets#L15-L15
d14339924d05f363315d146e07f2502b7b487163
gitee
conrad_sheeran/TickAuth
8ef852e12999d15cf70394cdab82d08ac5843143
features/steam/src/main/ets/view/SteamTOTPView.ets
arkts
aboutToAppear
生命周期
async aboutToAppear(): Promise<void> { try { this.oldDeleteItem = await this.preferences.get("WaitDeleteAlias", []) as Array<WaitDeleteItemParam>; this.oldDeleteItem.forEach((value, index) => { if (value.time <= Date.now()) { this.writeToJson.remove(value.alias).then(async (isNull: boo...
AST#method_declaration#Left async aboutToAppear 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#type_ar...
async aboutToAppear(): Promise<void> { try { this.oldDeleteItem = await this.preferences.get("WaitDeleteAlias", []) as Array<WaitDeleteItemParam>; this.oldDeleteItem.forEach((value, index) => { if (value.time <= Date.now()) { this.writeToJson.remove(value.alias).then(async (isNull: boo...
https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/steam/src/main/ets/view/SteamTOTPView.ets#L134-L167
59ca9aaf3e24967170ee41c100ba20bc08884203
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/bean/TaskInfo.ets
arkts
TaskInfo @param id @param date @param taskID @param targetValue @param isAlarm @param startTime @param endTime @param frequency @param isDone @param doneValue @param isOpen
export default class TaskInfo { id: number; date: string; taskID: number; targetValue: string; isAlarm: boolean; startTime: string; endTime: string; frequency: string; isDone: boolean; finValue: string; isOpen: boolean; fishId: number; fishType: string; constructor(id: number, date: string...
AST#export_declaration#Left export default AST#class_declaration#Left class TaskInfo AST#class_body#Left { AST#property_declaration#Left id : 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 date : AST#t...
export default class TaskInfo { id: number; date: string; taskID: number; targetValue: string; isAlarm: boolean; startTime: string; endTime: string; frequency: string; isDone: boolean; finValue: string; isOpen: boolean; fishId: number; fishType: string; constructor(id: number, date: string...
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/bean/TaskInfo.ets#L16-L46
3a4e386973677b3c5326247a8d3b21388b0a9c3d
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/web_actions.ets
arkts
Should be called when a tab begins loading. @param pk The tab_info_packed.
export function on_page_begin(pk: tab_info_packed) { console.log("[ArkWeb] on page begin!"); let tabs = pk.storage.get('bunch_of_tabs') as bunch_of_tabs; if (pk.index >= tabs.get_tabs_count()) { // If not synced, idk why but o(=•ェ•=)m return; } // Ask tab to update its info try { let url = pk....
AST#export_declaration#Left export AST#function_declaration#Left function on_page_begin AST#parameter_list#Left ( AST#parameter#Left pk : AST#type_annotation#Left AST#primary_type#Left tab_info_packed AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Lef...
export function on_page_begin(pk: tab_info_packed) { console.log("[ArkWeb] on page begin!"); let tabs = pk.storage.get('bunch_of_tabs') as bunch_of_tabs; if (pk.index >= tabs.get_tabs_count()) { return; } try { let url = pk.update_url(); let is_loading = false; if (url.substring(0, 7...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L114-L153
74e7c96b7efdadf8da38ea99ac7dc978d05ad125
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
entry/src/main/ets/entryability/EntryAbility.ets
arkts
registerRouter
注册路由
registerRouter(): void { new MainGraph().register(); new AuthGraph().register(); new CommonGraph().register(); new CsGraph().register(); new FeedbackGraph().register(); new GoodsGraph().register(); new LaunchGraph().register(); new UserGraph().register(); new OrderGraph().register();...
AST#method_declaration#Left registerRouter 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#expressio...
registerRouter(): void { new MainGraph().register(); new AuthGraph().register(); new CommonGraph().register(); new CsGraph().register(); new FeedbackGraph().register(); new GoodsGraph().register(); new LaunchGraph().register(); new UserGraph().register(); new OrderGraph().register();...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/entry/src/main/ets/entryability/EntryAbility.ets#L100-L111
53df9521ba3046f4d3dbe19a4d2c280ac14d7218
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_user_agents.ets
arkts
A user_agent object, which consists of a label and the user agent text content. @param label The name of the user agent. @param user_agent_content The content of the user agent.
constructor(label: string, content: string) { this.label = label; this.user_agent_content = content; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty...
constructor(label: string, content: string) { this.label = label; this.user_agent_content = content; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_user_agents.ets#L99-L102
71432be0af0726f47b443a9b1a0c61ae242bec57
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ResponsiveLayout/entry/src/main/ets/utils/Logger.ets
arkts
constructor. @param Prefix Identifies the log tag. @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
constructor(prefix: string) { this.prefix = prefix; this.domain = 0xFF00; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefix : 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_statement#...
constructor(prefix: string) { this.prefix = prefix; this.domain = 0xFF00; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ResponsiveLayout/entry/src/main/ets/utils/Logger.ets#L29-L32
a9e862d75cee956f87adda5c090330aeb53193c3
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets
arkts
decodeECB
解密-ECB模式 @param str 加密的字符串 @param aesKey AES密钥 @returns
static async decodeECB(str: string, aesKey: string): Promise<OutDTO<string>> { return CryptoUtil.decodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256); }
AST#method_declaration#Left static async decodeECB 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static async decodeECB(str: string, aesKey: string): Promise<OutDTO<string>> { return CryptoUtil.decodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L203-L205
d247ad9bbb550167bae24050f22133aa8e2461bb
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets
arkts
Constructor.
constructor() { this.left = 0; this.top = 0; this.right = 0; this.bottom = 0; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . left AST#member_expr...
constructor() { this.left = 0; this.top = 0; this.right = 0; this.bottom = 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets#L41-L46
0ec01829de77e7e5ea1915e3020eebb356823490
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
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...
export default class CommonConstants { static readonly HOME_TITLE: Resource = $r('app.string.HOME_TITLE'); static readonly IMG_WALL_TITLE: Resource = $r('app.string.IMG_WALL_TITLE'); static readonly HELLO: Resource = $r('app.string.HELLO'); static readonly WELCOME_USE_JOT: Resource = $r('app.string.WELCOME_USE_...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { AST#property_declaration#Left static readonly HOME_TITLE : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_express...
export default class CommonConstants { static readonly HOME_TITLE: Resource = $r('app.string.HOME_TITLE'); static readonly IMG_WALL_TITLE: Resource = $r('app.string.IMG_WALL_TITLE'); static readonly HELLO: Resource = $r('app.string.HELLO'); static readonly WELCOME_USE_JOT: Resource = $r('app.string.WELCOME_USE_...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/common/constants/CommonConstants.ets#L16-L49
ec197214757e1c1ae4d27539c3a4d57bfb25c407
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets
arkts
drawClipImage
绘制裁剪框
drawClipImage() { let lineWidth = vp2px(2) let clipRectW = this.clipRect.width! + 4 let clipRectH = this.clipRect.height! + 4 this.cropContext.clearRect(2, 2, this.clipRect.width, this.clipRect.height); this.cropContext.lineWidth = lineWidth this.cropContext.strokeStyle = '#ffff00' this.crop...
AST#method_declaration#Left drawClipImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left lineWidth = AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument...
drawClipImage() { let lineWidth = vp2px(2) let clipRectW = this.clipRect.width! + 4 let clipRectH = this.clipRect.height! + 4 this.cropContext.clearRect(2, 2, this.clipRect.width, this.clipRect.height); this.cropContext.lineWidth = lineWidth this.cropContext.strokeStyle = '#ffff00' this.crop...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets#L297-L351
dade6041d39c02a9a84d319deb5bd8db472c1899
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets
arkts
connectNetwork
[Start notification_of_network_status_change] 连接并接收指定网络的状态变化通知
connectNetwork() { if (this.conn) { Logger.info('Network connection already established.'); return; // 如果已有连接,直接返回 }; let netSpecifier: connection.NetSpecifier = { netCapabilities: { // 假设当前默认网络是蜂窝网络连接,需要创建WIFI网络连接,可指定网络类型为WIFI bearerTypes: [connection.NetBearType.BEARER_W...
AST#method_declaration#Left connectNetwork AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . conn AST#member_expression#Right AST#expression#Right ) ...
connectNetwork() { if (this.conn) { Logger.info('Network connection already established.'); return; }; let netSpecifier: connection.NetSpecifier = { netCapabilities: { bearerTypes: [connection.NetBearType.BEARER_WIFI], networkCap: [connection.NetCap.NET_...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/NetConnection_Manage_case/entry/src/main/ets/pages/Index.ets#L270-L313
bb40a4d7171f489f4268f24520980d09a79ef0e9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
buildFilterMenu
构建筛选菜单
@Builder buildFilterMenu() { Column() { // 背景遮罩 Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showFilterMenu = false; }) // 菜单内容 Column({ space: 16 }) { // 样式筛选 Column...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterMenu 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#a...
@Builder buildFilterMenu() { Column() { Row() .width('100%') .layoutWeight(1) .backgroundColor('rgba(0,0,0,0.3)') .onClick(() => { this.showFilterMenu = false; }) Column({ space: 16 }) { Column({ space: 8 }) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L491-L560
1bcb7b10d3c86ce0a19dd97e8219fffc96d722aa
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
stringToByteArray
字符串转换为Uint8Array数组 @param str 字符串C1C3C2格式的,true为是 @param keyName 密钥长度 @param isC1C3C2 传入的字符串是否为 @returns Uint8Array数组
static stringToByteArray(str: string, keyName: number, isC1C3C2?: boolean): Uint8Array { // if (isC1C3C2) { // str = new SM2Convert().i2dSM2(str); // } //判断是否为HarmonyOS自己生成的字符串,只包含小写a-z和数字 if (str.length != keyName / 8) { const hexString = str.match(/.{1,2}/g); // 将字符串按每两个字符分割为数组 let a...
AST#method_declaration#Left static stringToByteArray 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 keyName : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
static stringToByteArray(str: string, keyName: number, isC1C3C2?: boolean): Uint8Array { if (str.length != keyName / 8) { const hexString = str.match(/.{1,2}/g); let arr = new Array<string>(); hexString?.forEach((val) => { arr.push(val); }) let byteArray: n...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L188-L211
102573fabf116f96d7edfa88eb2d297b0db1b75e
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets
arkts
setDomain
设置日志对应的领域标识,范围是0x0~0xFFFF。(该方法建议在Ability里调用) @param domain
static setDomain(domain: number = LOGGER_DOMAIN) { LogUtil.domain = domain }
AST#method_declaration#Left static setDomain AST#parameter_list#Left ( AST#parameter#Left domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left LOGGER_DOMAIN AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu...
static setDomain(domain: number = LOGGER_DOMAIN) { LogUtil.domain = domain }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L30-L32
59e769586447d4e9472245a9235977f385b66b39
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dynamicattributes/src/main/ets/view/Details.ets
arkts
Details
自定义组件中text大小
@Component export struct Details { // TODO:知识点:实例化自定义的样式类 @State rowModifier: BarModifier = new BarModifier(); @State imageModifier: ImageModifier = new ImageModifier($r('app.string.dynamicattributes_max_size'), $r('app.string.dynamicattributes_image_proportion')); @Consume('navPathStack') navPathStack:NavPathS...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Details AST#component_body#Left { // TODO:知识点:实例化自定义的样式类 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right rowModifier : AST#type_annotation#Left AST#primary_type#Left BarModifier AST#primar...
@Component export struct Details { @State rowModifier: BarModifier = new BarModifier(); @State imageModifier: ImageModifier = new ImageModifier($r('app.string.dynamicattributes_max_size'), $r('app.string.dynamicattributes_image_proportion')); @Consume('navPathStack') navPathStack:NavPathStack build() { ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/view/Details.ets#L22-L53
eb99507bd8855ce77230b405cbb29bb9e6606c07
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setTransparentCircleColor
Sets the color the transparent-circle should have. @param color
public setTransparentCircleColor(color: number): void { if (!this.mRenderer) { return; } let p: Paint = ( /*(PieChartRenderer) */ this.mRenderer as PieChartRenderer).getPaintTransparentCircle(); let alpha: number | undefined = p.getGlobalAlpha(); p.setColor(color); if (alpha) { ...
AST#method_declaration#Left public setTransparentCircleColor 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 void AS...
public setTransparentCircleColor(color: number): void { if (!this.mRenderer) { return; } let p: Paint = ( this.mRenderer as PieChartRenderer).getPaintTransparentCircle(); let alpha: number | undefined = p.getGlobalAlpha(); p.setColor(color); if (alpha) { p.setGlobalAlpha(alpha...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L641-L652
8ea5be7451045ee5bf7ed6294550468d87ea73ec
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/event/WanEvents.ets
arkts
登出 event
export class LoginOutEvent { }
AST#export_declaration#Left export AST#class_declaration#Left class LoginOutEvent AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class LoginOutEvent { }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/event/WanEvents.ets#L111-L112
2229d3add688e64c6b89fc904de060457983444f
github
openharmony/communication_wifi
387ba7fa8f98578629a6148635a4d630b2b99aa1
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/component/dialog/customPromptDialog.ets
arkts
CustomPromptDialog
自定义提示弹窗
@CustomDialog export default struct CustomPromptDialog { title: string = '提示'; cancelVal: string= '取消'; confirmVal: string= '确定'; @State contentVal: string = ''; controller: CustomDialogController; eventAction: () => void; build() { Column() { Text(this.title) .width('95%') .fon...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct CustomPromptDialog AST#component_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Lef...
@CustomDialog export default struct CustomPromptDialog { title: string = '提示'; cancelVal: string= '取消'; confirmVal: string= '确定'; @State contentVal: string = ''; controller: CustomDialogController; eventAction: () => void; build() { Column() { Text(this.title) .width('95%') .fon...
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/component/dialog/customPromptDialog.ets#L19-L97
b7b2efeb8c7cd22cda765995d9085c4dfbb40010
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/WatchGiftBuilder.ets
arkts
自定义参数类型
export class WatchGiftParams { gift: VHWatchGiftInfo; webinar: VHWebinarData; constructor(id: VHWatchGiftInfo, webinar: VHWebinarData) { this.gift = id; this.webinar = webinar; } }
AST#export_declaration#Left export AST#class_declaration#Left class WatchGiftParams AST#class_body#Left { AST#property_declaration#Left gift : AST#type_annotation#Left AST#primary_type#Left VHWatchGiftInfo AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left we...
export class WatchGiftParams { gift: VHWatchGiftInfo; webinar: VHWebinarData; constructor(id: VHWatchGiftInfo, webinar: VHWebinarData) { this.gift = id; this.webinar = webinar; } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/WatchGiftBuilder.ets#L25-L33
ea602ded6cc3d6d95415bad91ba99a3cf38bb51a
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_key_shortcuts.ets
arkts
save_to_disk
Saves current key combination settings to disk
save_to_disk() { let list: string[] = []; for (let index = 0; index < this.key_shortcut_combinations.length; index++) { list.push(this.key_shortcut_combinations[index].toString()); } bunch_of_settings.set('key_shortcuts', list.join('\n')); this.last_edit = Date.now(); }
AST#method_declaration#Left save_to_disk AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary...
save_to_disk() { let list: string[] = []; for (let index = 0; index < this.key_shortcut_combinations.length; index++) { list.push(this.key_shortcut_combinations[index].toString()); } bunch_of_settings.set('key_shortcuts', list.join('\n')); this.last_edit = Date.now(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L124-L131
58ecef033e684ad0c2f3f8bd45f9076e4939b17c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AddressRepository.ets
arkts
deleteAddress
删除地址 @param params 待删除地址ID集合 @returns 删除结果
async deleteAddress(params: Ids): Promise<NetworkResponse<void>> { return this.networkDataSource.deleteAddress(params); }
AST#method_declaration#Left async deleteAddress AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Ids 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 ...
async deleteAddress(params: Ids): Promise<NetworkResponse<void>> { return this.networkDataSource.deleteAddress(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AddressRepository.ets#L53-L55
85eb53370461ead70e59fd32104ef2079f4cadfc
github
sea5241/PictureSelector
09bac407ebd61100d1ccbf6e6d3b6349cb0013d7
selector/src/main/ets/model/PictureItemStyleData.ets
arkts
图片显示样式 @Author sea @Date 2024/7/8
export class PictureItemStyleData { unselectResource: Resource = $r('app.media.ic_choice_unselect') selectResource: Resource = $r('app.media.ic_choice_selected') selectSize: number = 20 marginTop: number = 10 marginRight: number = 10 maxSelectToast: Resource = $r('app.string.max_count_toast') }
AST#export_declaration#Left export AST#class_declaration#Left class PictureItemStyleData AST#class_body#Left { AST#property_declaration#Left unselectResource AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expre...
export class PictureItemStyleData { unselectResource: Resource = $r('app.media.ic_choice_unselect') selectResource: Resource = $r('app.media.ic_choice_selected') selectSize: number = 20 marginTop: number = 10 marginRight: number = 10 maxSelectToast: Resource = $r('app.string.max_count_toast') }
https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/model/PictureItemStyleData.ets#L6-L13
c799d386527f9186dafefb8ce695070a7aac3409
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildFavoriteItem
收藏项目
@Builder buildFavoriteItem(text: string) { Row({ space: 12 }) { Text(text) .fontSize(14) .fontColor(this.COLORS.textPrimary) .lineHeight(20) .layoutWeight(1) Row({ space: 8 }) { // 复制按钮 Text('📋') .fontSize(14) .padding(6) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFavoriteItem AST#parameter_list#Left ( AST#parameter#Left text : 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#builder_function_bo...
@Builder buildFavoriteItem(text: string) { Row({ space: 12 }) { Text(text) .fontSize(14) .fontColor(this.COLORS.textPrimary) .lineHeight(20) .layoutWeight(1) Row({ space: 8 }) { Text('📋') .fontSize(14) .padding(6) .backgr...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3376-L3428
38dfcfc8fcddbe0df42e1ba8fbf20dc296745ff5
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/wordcard/WordCardOne.ets
arkts
buildMemoPanel
构建备忘录标题区域
@Builder buildMemoPanel() { Column(){ if (this.word.memo){ //笔记 标题 Text($r('app.string.wordcard_memo_txt_title')) //笔记 .fontSize(14) .fontColor($r('app.color.color_detail')) .textAlign(TextAlign.Start) .margin({ top: 25, left:10 }) } //笔记...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMemoPanel 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#ui_control...
@Builder buildMemoPanel() { Column(){ if (this.word.memo){ Text($r('app.string.wordcard_memo_txt_title')) .fontSize(14) .fontColor($r('app.color.color_detail')) .textAlign(TextAlign.Start) .margin({ top: 25, left:10 }) } 内容 Column...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L383-L452
58ec9cd33cec248616a5829695c707817ac41256
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
DialogPage
TODO 弹窗工具 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
@Preview @Component export struct DialogPage { private scroller: Scroller = new Scroller(); @State menuArray: Array<ResourceStr> = [$r('app.string.str_camera'), $r('app.string.str_album'), "文件管理器"]; @State inputText: string = ""; //输入框内容 @State progress: number = 1; private likes: string[] = ['乒乓球', '鸿蒙手机', '...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct DialogPage AST#component_body#Left { AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST...
@Preview @Component export struct DialogPage { private scroller: Scroller = new Scroller(); @State menuArray: Array<ResourceStr> = [$r('app.string.str_camera'), $r('app.string.str_album'), "文件管理器"]; @State inputText: string = ""; @State progress: number = 1; private likes: string[] = ['乒乓球', '鸿蒙手机', 'ArkTS',...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L28-L1313
3e924b15262c0ddef76a9f4cadf73f5ff45ac5c9
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
persistProp
Called when a persistence property is stored. @since 10
static persistProp<T>(key: string, defaultValue: T): void { throw new Error("PersistentStorage.persistProp is not implemented") }
AST#method_declaration#Left static persistProp AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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...
static persistProp<T>(key: string, defaultValue: T): void { throw new Error("PersistentStorage.persistProp is not implemented") }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L380-L382
229145c980959cf4c86a2aa847dfa50b2a1dfb78
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Progresses.ets
arkts
bodyBuilder
内容展示(自定义builder渲染)
@Builder bodyBuilder() { Column(){ // 默认进度条 Text('Progress linear 线形') .fontSize(14) .margin({ top:20, bottom: 12}) Progress({ value: 20, total: 100, type: ProgressType.Linear }) .width(200) .margin({ top: 10 }) .style({ strokeWidth: 4, // 进度条宽度 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder 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 bodyBuilder() { Column(){ Text('Progress linear 线形') .fontSize(14) .margin({ top:20, bottom: 12}) Progress({ value: 20, total: 100, type: ProgressType.Linear }) .width(200) .margin({ top: 10 }) .style({ strokeWidth: 4, }) P...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Progresses.ets#L47-L263
c2ac6229b35fd29747679d00393a4175cbd493d0
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/permission/PermissionUtils.ets
arkts
权限工具类 提供常用权限的快捷申请方法 需要调用 ContextUtil.init() 之后初始化
export class PermissionUtils { private atManager: abilityAccessCtrl.AtManager; private context: common.UIAbilityContext; constructor() { this.atManager = abilityAccessCtrl.createAtManager(); this.context = ContextUtil.getUIAbilityCtx(); } /** * 检查单个权限是否已授权 * @param {Permissions} permission 目标权...
AST#export_declaration#Left export AST#class_declaration#Left class PermissionUtils AST#class_body#Left { AST#property_declaration#Left private atManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . AtManager AST#qualified_type#Right AST#primary_type#Right AST#type_annota...
export class PermissionUtils { private atManager: abilityAccessCtrl.AtManager; private context: common.UIAbilityContext; constructor() { this.atManager = abilityAccessCtrl.createAtManager(); this.context = ContextUtil.getUIAbilityCtx(); } private async checkPermissionGrant(permission: Permissions...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L12-L199
8ac1f005cce8c4d20d306f425d7ddca9e3c29fb1
github
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/ContactModel.ets
arkts
用于初始化ContactData的数组
export function getContactDatas(): Array<ContactData> { let contactDataArray: Array<ContactData> = [] ContactsComposition.forEach(item => { contactDataArray.push(new ContactData(item.wid , item.headImg , item.name , item.mark , item.gender , item.area)) }) return contactDataArray; }
AST#export_declaration#Left export AST#function_declaration#Left function getContactDatas AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ContactData AST#primary_typ...
export function getContactDatas(): Array<ContactData> { let contactDataArray: Array<ContactData> = [] ContactsComposition.forEach(item => { contactDataArray.push(new ContactData(item.wid , item.headImg , item.name , item.mark , item.gender , item.area)) }) return contactDataArray; }
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/ContactModel.ets#L6-L12
d3678428e983bfc9054a2cee3aacd4610b2af0b8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/ActionBar.ets
arkts
ActionBar
ActionBar,It consists of action on the left, title in the middle and menu panel on the right
@Component export struct ActionBar { @Link actionBarProp: ActionBarProp; onMenuClicked: Function | undefined = undefined; isVideoPage: boolean = false; @State hasTabBar: boolean = false; private onBuildDone(): void { Log.info(TAG, 'onBuildDone,actionBarProp:' + this.actionBarProp.getHasTabBar()); } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ActionBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right actionBarProp : AST#type_annotation#Left AST#primary_type#Left ActionBarProp AST#primary_type#Right AST#t...
@Component export struct ActionBar { @Link actionBarProp: ActionBarProp; onMenuClicked: Function | undefined = undefined; isVideoPage: boolean = false; @State hasTabBar: boolean = false; private onBuildDone(): void { Log.info(TAG, 'onBuildDone,actionBarProp:' + this.actionBarProp.getHasTabBar()); } ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/ActionBar.ets#L30-L95
17bd7cc3a587862dff9edae838d21e879ba1476e
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/VerifyPage.ets
arkts
onVerifyFailed
验证失败处理
onVerifyFailed() { this.isInputWrong = true; this.inputText = ''; this.imageId = (this.imageId + 1) % 2; this.updateVerifyItem(); promptAction.showToast({ message: '验证码错误,请重试', duration: 1500 }); }
AST#method_declaration#Left onVerifyFailed 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 . isInputWrong AST#member_expression#...
onVerifyFailed() { this.isInputWrong = true; this.inputText = ''; this.imageId = (this.imageId + 1) % 2; this.updateVerifyItem(); promptAction.showToast({ message: '验证码错误,请重试', duration: 1500 }); }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/VerifyPage.ets#L86-L96
41974a9764daec2dc099f74159ac7c030822704d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/XComponentView.ets
arkts
PublishView
页面共享组件
@Component export struct PublishView { @Prop imageWidth: number; @Prop imageHeight: number; @Prop isShow: boolean; private gridArray: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8']; build() { Column() { if (!this.isShow) { Grid() { ForEach(this.gridArray, (day: string) =...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PublishView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right imageWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_anno...
@Component export struct PublishView { @Prop imageWidth: number; @Prop imageHeight: number; @Prop isShow: boolean; private gridArray: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8']; build() { Column() { if (!this.isShow) { Grid() { ForEach(this.gridArray, (day: string) =...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/components/XComponentView.ets#L80-L107
f458bdbf9222564dcf96c6e4e150e0a6cdb2076a
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
generateAESKey192
生成AES的对称密钥-192位-默认base64 @param resultCoding 生成AES秘钥的字符串格式(hex/base64)-默认不传为base64格式 @returns AES密钥-192位
static generateAESKey192(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('AES192', resultCoding); }
AST#method_declaration#Left static generateAESKey192 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#exp...
static generateAESKey192(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('AES192', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L79-L81
4fe6b4abb284add15fcf9eb2ce5d819d0fb1fa6a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets
arkts
requestPermission
向用户申请授权 @param {Permissions} permissionName 申请授权的权限名 @returns {boolean} 申请授权结果
async requestPermission(permissionName: Permissions) { // 向用户申请授权 let context = getContext() as common.UIAbilityContext; let atManager = abilityAccessCtrl.createAtManager(); let grantStatusArr = await atManager.requestPermissionsFromUser(context, [ permissionName ]); const grantStatus = grantStatusA...
AST#method_declaration#Left async requestPermission AST#parameter_list#Left ( AST#parameter#Left permissionName : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 向用户申请授权 AST#statement...
async requestPermission(permissionName: Permissions) { let context = getContext() as common.UIAbilityContext; let atManager = abilityAccessCtrl.createAtManager(); let grantStatusArr = await atManager.requestPermissionsFromUser(context, [ permissionName ]); const grantStatus = grantStatusArr.authRes...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets#L98-L110
75ab8e980dc4a8a79a0653683db3f1c45bd433cd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets
arkts
footBuilder
底部按钮
@Builder footBuilder() { Text(this.options.cancelValue) .fontSize(this.fontSize) .fontColor(this.options.cancelFontColor ?? $r('sys.color.ohos_id_picker_button_text_color')) .fontWeight(this.options.cancelFontWeight ?? FontWeight.Bold) .align(Alignment.Center) .textAlign(TextAlign.Ce...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right footBuilder 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 Text ( AST#expression#Left AST#member_expression#Left AST#expr...
@Builder footBuilder() { Text(this.options.cancelValue) .fontSize(this.fontSize) .fontColor(this.options.cancelFontColor ?? $r('sys.color.ohos_id_picker_button_text_color')) .fontWeight(this.options.cancelFontWeight ?? FontWeight.Bold) .align(Alignment.Center) .textAlign(TextAlign.Ce...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets#L147-L165
e26d8e7f961c70d1ff56d171f1760ef463a0246c
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/TaskModel.ets
arkts
saveTasks
保存待办任务
static async saveTasks(tasks: TaskItem[]): Promise<void> { if (!DataStorage.prefsInstance) { console.error('Preferences not initialized'); return; } try { await DataStorage.prefsInstance.put(DataStorage.KEY_TASKS, JSON.stringify(tasks)); await DataStorage.prefsInstance.flush(); ...
AST#method_declaration#Left static async saveTasks AST#parameter_list#Left ( AST#parameter#Left tasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati...
static async saveTasks(tasks: TaskItem[]): Promise<void> { if (!DataStorage.prefsInstance) { console.error('Preferences not initialized'); return; } try { await DataStorage.prefsInstance.put(DataStorage.KEY_TASKS, JSON.stringify(tasks)); await DataStorage.prefsInstance.flush(); ...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L38-L50
c0dab57652162a4a50ba3c7ee60144aea4346da7
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/class.ets
arkts
trainItemUI
**********训练动作**********//
@Builder trainItemUI(name: string, index: number) { Row() { Image('/image/home/class1.png') .width(100) .height(100) .margin({ right: 20, bottom: 10 }) Column() { Text(name) .margin({ bottom: 20 }) .width('100%') Text(this.trainArryCount[inde...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right trainItemUI AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AS...
@Builder trainItemUI(name: string, index: number) { Row() { Image('/image/home/class1.png') .width(100) .height(100) .margin({ right: 20, bottom: 10 }) Column() { Text(name) .margin({ bottom: 20 }) .width('100%') Text(this.trainArryCount[inde...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/class.ets#L357-L373
4d45aba249e52f36f64bd9187d6bc86a6db4c046
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
add1stItem
Increase the data
public add1stItem(): void { this.dataArray.splice(0, 0, this.dataArray.length); this.notifyDataAdd(0); }
AST#method_declaration#Left public add1stItem 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#expres...
public add1stItem(): void { this.dataArray.splice(0, 0, this.dataArray.length); this.notifyDataAdd(0); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L94-L97
a34d0b0f42e3aa4cbe2cf293fca3952dd5986148
gitee
null128/OHSchedule.git
fc2401a6198d911d115ab77b2e265b3a2ac3d616
entry/src/main/ets/utils/file.ets
arkts
let filesDir = 'D:\\mywork\\LSJproject\\OpenHarmony\\OHSchedule\\entry\\src\\main\\ets\\storage'
export function formatFilePath(fileName: string): string { return `${filesDir}/${fileName}.json` }
AST#export_declaration#Left export AST#function_declaration#Left function formatFilePath AST#parameter_list#Left ( AST#parameter#Left fileName : 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#Lef...
export function formatFilePath(fileName: string): string { return `${filesDir}/${fileName}.json` }
https://github.com/null128/OHSchedule.git/blob/fc2401a6198d911d115ab77b2e265b3a2ac3d616/entry/src/main/ets/utils/file.ets#L12-L14
aa5d9762c2a235768c402573e6cd61878eb85d92
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/NavigationParam.ets
arkts
@file 公共导航参数定义 @author Joker.X ID 参数
export interface IdParam { /** * ID */ id: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IdParam AST#object_type#Left { /** * ID */ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_decl...
export interface IdParam { id: number; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationParam.ets#L9-L14
e7a89ead0f958e96c3f2b000bfe934c4f61ff981
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
plainToClassArray
将普通纯对象数组转换为指定类的实例数组(嵌套类需要添加装饰器NestedClassV6) @param clazz 目标类的构造函数 @param obj 普通JSON纯对象数组 @returns
static plainToClassArray<T>(clazz: Constructor<T>, plainArray: Object[]): T[] { return ClassTransformer.plainToClassArray(clazz, plainArray); }
AST#method_declaration#Left static plainToClassArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left clazz : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Constructor AST#type_arguments#Left < A...
static plainToClassArray<T>(clazz: Constructor<T>, plainArray: Object[]): T[] { return ClassTransformer.plainToClassArray(clazz, plainArray); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L194-L196
a0a7098b7259e2eb6b8b8bf21ef9c273e834277f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ArrayUtil.ets
arkts
isEmpty
判断集合是否为空集合。 @param array @returns
static isEmpty<T>(array: T[]): boolean { return array === undefined || array === null || array.length === 0; }
AST#method_declaration#Left static isEmpty AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right A...
static isEmpty<T>(array: T[]): boolean { return array === undefined || array === null || array.length === 0; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L42-L44
7f163b4ad8a56ebd3a5e338d838d2b7b6495ed66
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/CandleDataSet.ets
arkts
setIncreasingColor
Sets the one and ONLY color that should be used for this DataSet when open <= close. @param color
public setIncreasingColor(color: number): void { this.mIncreasingColor = color; }
AST#method_declaration#Left public setIncreasingColor 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 void AST#prima...
public setIncreasingColor(color: number): void { this.mIncreasingColor = color; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L212-L214
f44be1cc89097103828e89e6751ccac69508c09d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets
arkts
restart
重新开始
restart(): void { this.stop(); this.remainMs = this.totalMs; if (this.callback) { this.start(this.callback); } }
AST#method_declaration#Left restart 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#Left ...
restart(): void { this.stop(); this.remainMs = this.totalMs; if (this.callback) { this.start(this.callback); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L109-L115
db13d52dc6561032a1c157dfbae202ae020696b0
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/permission_tools.ets
arkts
Requests permission from user. @param p Permissions[]
export function request_user_permission(context:common.UIAbilityContext ,p: Permissions[]) { if (p.length == 0) { return; } atManager.requestPermissionsFromUser(context, p); }
AST#export_declaration#Left export AST#function_declaration#Left function request_user_permission AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Ri...
export function request_user_permission(context:common.UIAbilityContext ,p: Permissions[]) { if (p.length == 0) { return; } atManager.requestPermissionsFromUser(context, p); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/permission_tools.ets#L13-L18
38f7c530fa82507f214c5db901b261d3253f8248
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_synchronous.ets
arkts
decryptMessage
分段解密消息
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams); let updateLength = 20; // 假设以20字节为单位进行分段update,实际并无要求 let decryptText = n...
AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c...
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams); let updateLength = 20; let decryptText = new Uint8Array(); for (let i ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_synchronous.ets#L71-...
3d36afb232d9b639f07f3c95eb45e75a2ae687fe
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
getHttpAuthCredentials
检索给定主机和域的HTTP身份验证凭据,该方法为同步方法。 @param host HTTP身份验证凭据应用的主机。 @param realm HTTP身份验证凭据应用的域。 @returns
static getHttpAuthCredentials(host: string, realm: string): Array<string> { return webview.WebDataBase.getHttpAuthCredentials(host, realm); }
AST#method_declaration#Left static getHttpAuthCredentials AST#parameter_list#Left ( AST#parameter#Left host : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left realm : AST#type_annotation#Left AST#primary_type#Left string AST#...
static getHttpAuthCredentials(host: string, realm: string): Array<string> { return webview.WebDataBase.getHttpAuthCredentials(host, realm); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L277-L279
448b0e3b9a43c6379703f7acd6e456bc32860eef
gitee
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/NotificationManager.ets
arkts
createWantAgent
创建WantAgent用于点击通知时打开应用
private async createWantAgent(): Promise<WantAgent> { const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: 'com.example.calendar', abilityName: 'EntryAbility' } ], requestCode: 0, operationType: wantAgent.OperationType.START_ABILITY, ...
AST#method_declaration#Left private async createWantAgent 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 WantAgent AST#primary_type#Right AST#type_annotation#Righ...
private async createWantAgent(): Promise<WantAgent> { const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: 'com.example.calendar', abilityName: 'EntryAbility' } ], requestCode: 0, operationType: wantAgent.OperationType.START_ABILITY, ...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L192-L213
082d016cdd520d62eae5f781e6538c656aeddd1d
github
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git
3b5fa45c650dcae2773a19f122161935e0c0e2bc
entry/src/main/ets/pages/customScan/pages/ScanPage.ets
arkts
this
Pixel density listener.
this.onDensityDPI();
AST#method_declaration#Left this AST#ERROR#Left . onDensityDPI AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
this.onDensityDPI();
https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/pages/ScanPage.ets#L146-L146
5286d889615c9ef3089c0212815bec1704ac1828
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets
arkts
@file 注册页面 ViewModel @author Joker.X
@ObservedV2 export default class RegisterViewModel extends BaseViewModel { /** * 更新手机号 * @param {string} value - 手机号 * @returns {void} 无返回值 */ updatePhone(value: string): void { } /** * 更新验证码 * @param {string} value - 验证码 * @returns {void} 无返回值 */ updateVerificationCode(value: string)...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class RegisterViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 更新手机号 * @par...
@ObservedV2 export default class RegisterViewModel extends BaseViewModel { updatePhone(value: string): void { } updateVerificationCode(value: string): void { } updatePassword(value: string): void { } updateConfirmPassword(value: string): void { } onSendVerificationCode(): void { }...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets#L8-L55
78964e79e68351fcd2396297e574dfee26e18270
github
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/components/BottomBarControlComponent.ets
arkts
BottomBarControlComponent
import { AudioService, EventId, IsPlayingStorageKey, SongItemStorageKey } from '../common/utils/AudioService'; import emitter from '@ohos.events.emitter';
@Component export struct BottomBarControlComponent { @StorageProp('IS_PLAYING') isPlaying: boolean = false; @StorageProp('AUDIO_ID') @Watch('onAudioChange') currAudioId: number = 0; @State _songItem: Song | null = null; aboutToAppear() { this._songItem = AudioService.getInstance().getCurrSong(); } onA...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BottomBarControlComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'IS_PLAYING' AST#expression#Right ) AST#decorator#Right isPlaying : AST#type_ann...
@Component export struct BottomBarControlComponent { @StorageProp('IS_PLAYING') isPlaying: boolean = false; @StorageProp('AUDIO_ID') @Watch('onAudioChange') currAudioId: number = 0; @State _songItem: Song | null = null; aboutToAppear() { this._songItem = AudioService.getInstance().getCurrSong(); } onA...
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/components/BottomBarControlComponent.ets#L8-L64
bb2bea3e63ea9abc16d8d6bfd7c9ddead09ff37a
github
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets
arkts
queryAll
查询表格中的所有数据
queryAll(tableName: string): Promise<dataRdb.ResultSet> { return this.rdbStore.querySql(`select * from ${tableName}`); }
AST#method_declaration#Left queryAll AST#parameter_list#Left ( AST#parameter#Left tableName : 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 Promi...
queryAll(tableName: string): Promise<dataRdb.ResultSet> { return this.rdbStore.querySql(`select * from ${tableName}`); }
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets#L161-L163
4479336726da96be5a069146857a0521e4d9684f
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets
arkts
AddLastItem
在数据尾部增加一个元素
public AddLastItem(): void { this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); this.notifyDataAdd(this.dataArray.length - 1); }
AST#method_declaration#Left public AddLastItem 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#expre...
public AddLastItem(): void { this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); this.notifyDataAdd(this.dataArray.length - 1); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets#L92-L95
92100ff8a6cb9ca372d4581cbf9f8a5dfa04f14d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/LoginViewModel.ets
arkts
@file 登录页面 ViewModel @author Joker.X
@ObservedV2 export default class LoginViewModel extends BaseViewModel { /** * 微信登录点击 * @returns {void} 无返回值 */ onWechatLoginClick(): void { // 第三方登录暂未接入,等待后续实现 } /** * QQ 登录点击 * @returns {void} 无返回值 */ onQQLoginClick(): void { // 第三方登录暂未接入,等待后续实现 } /** * 支付宝登录点击 * @return...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class LoginViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 微信登录点击 * @retur...
@ObservedV2 export default class LoginViewModel extends BaseViewModel { onWechatLoginClick(): void { } onQQLoginClick(): void { } onAlipayLoginClick(): void { } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/LoginViewModel.ets#L6-L32
1e44af25af8583bcfc5c0b730fba4da0dac648a1
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/CharUtil.ets
arkts
isEmoji
判断是否为emoji表情符 @param c 字符 @returns 是否为emoji
static isEmoji(c: number): boolean { // 判断码点是否在 Emoji 的主要 Unicode 范围内 return ( // 表情符号 (c >= 0x1F600 && c <= 0x1F64F) || // 交通和地图符号 (c >= 0x1F680 && c <= 0x1F6FF) || // 补充符号和图形 (c >= 0x1F700 && c <= 0x1F77F) || // 几何形状扩展 (c >= 0x1F780 && c <= 0x1F7FF) ...
AST#method_declaration#Left static isEmoji AST#parameter_list#Left ( AST#parameter#Left c : 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 boolean AST#primary_type#Righ...
static isEmoji(c: number): boolean { return ( (c >= 0x1F600 && c <= 0x1F64F) || (c >= 0x1F680 && c <= 0x1F6FF) || (c >= 0x1F700 && c <= 0x1F77F) || (c >= 0x1F780 && c <= 0x1F7FF) || (c >= 0x1F800 && c <= 0x1F8FF) || ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/CharUtil.ets#L55-L79
fc481d13289d90566a60cdb7f8910144328b2f5e
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/pages/SettingsPage.ets
arkts
saveApiKey
保存API密钥
private async saveApiKey(): Promise<void> { if (!this.apiKeyInput.trim()) { return; } this.isSaving = true; try { await this.configService.saveApiKey(this.apiKeyInput.trim()); this.apiKeyMasked = await this.configService.getMaskedApiKey(); this.apiKeyInput = ''; this.isEd...
AST#method_declaration#Left private async saveApiKey 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#ty...
private async saveApiKey(): Promise<void> { if (!this.apiKeyInput.trim()) { return; } this.isSaving = true; try { await this.configService.saveApiKey(this.apiKeyInput.trim()); this.apiKeyMasked = await this.configService.getMaskedApiKey(); this.apiKeyInput = ''; this.isEd...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/SettingsPage.ets#L64-L87
48ffe5868df9282a789938d3a19bede8c2108219
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets
arkts
atomicsProcess
原子操作,进行10000次++
@Concurrent function atomicsProcess(int32Array: Int32Array) { for (let i = 0; i < 10000; i++) { Atomics.add(int32Array, 0, 1); } }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function atomicsProcess AST#parameter_list#Left ( AST#parameter#Left int32Array : AST#type_annotation#Left AST#primary_type#Left Int32Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_lis...
@Concurrent function atomicsProcess(int32Array: Int32Array) { for (let i = 0; i < 10000; i++) { Atomics.add(int32Array, 0, 1); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets#L104-L109
584bb5e68000c30696ee06465ca8b45b5cfbbb36
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
clearCanvas
Clear canvas content.
clearCanvas(): void { if (this.ctx !== undefined) { this.ctx.clearRect(0, 0, this.displayWidth, this.displayHeight); } }
AST#method_declaration#Left clearCanvas 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#binary_expre...
clearCanvas(): void { if (this.ctx !== undefined) { this.ctx.clearRect(0, 0, this.displayWidth, this.displayHeight); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L136-L140
95f4a7765bb50c71a3df95e5354d5e16a61768db
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/StepperItemView.ets
arkts
itemStyle
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...
@Styles function itemStyle() { .width(336) .height(621) .margin({ top: 48, left: 12 }) .borderRadius(24) .backgroundColor('#FFFFFF') }
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function itemStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 336 AST#expression#Right ) AST#modifier_chain_expression#Left ....
@Styles function itemStyle() { .width(336) .height(621) .margin({ top: 48, left: 12 }) .borderRadius(24) .backgroundColor('#FFFFFF') }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/StepperItemView.ets#L16-L22
289c530bd1b9387c2b342b10a474475a4c75c575
gitee
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/NotificationManager.ets
arkts
parseEventDateTime
解析日期时间
private parseEventDateTime(date: string, time: string): Date { const dateParts: number[] = date.split('-').map(Number) const timeParts: number[] = time.split(':').map(Number) const year: number = dateParts[0] const month: number = dateParts[1] const day: number = dateParts[2] const hour: number ...
AST#method_declaration#Left private parseEventDateTime AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
private parseEventDateTime(date: string, time: string): Date { const dateParts: number[] = date.split('-').map(Number) const timeParts: number[] = time.split(':').map(Number) const year: number = dateParts[0] const month: number = dateParts[1] const day: number = dateParts[2] const hour: number ...
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L180-L189
93e32c5dbf1e44df68f3c8e63f6bbbb6f55f53ce
github
RicardoWesleyli/HarmonyNEXT_Examples.git
6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670
Chapter8/entry/src/main/ets/model/BookModel.ets
arkts
BookModel.ets
export class BookDataModel{ id: number name: string author: string imageLink:string recommendation: string constructor
AST#export_declaration#Left export AST#ERROR#Left class BookDataModel { id : AST#ERROR#Left number name : string author : string image Link : string recommendation : AST#ERROR#Right string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable...
export class BookDataModel{ id: number name: string author: string imageLink:string recommendation: string constructor
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter8/entry/src/main/ets/model/BookModel.ets#L2-L9
882e02768efb8303b67f39efadaaba7989b2b3c1
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM3.ets
arkts
hmacSegmentSync
消息认证码计算,分段,同步 @param data 传入的消息 @param symKey 共享对称密钥(SymKey)。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度
static hmacSegmentSync(data: string, symKey: cryptoFramework.SymKey = SM3.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.hmacSegmentSync(data, 'SM3', symKey, resultCoding, len); }
AST#method_declaration#Left static hmacSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_typ...
static hmacSegmentSync(data: string, symKey: cryptoFramework.SymKey = SM3.symKey, resultCoding: crypto.BhCoding = 'hex', len: number = 128): string { return CryptoUtil.hmacSegmentSync(data, 'SM3', symKey, resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM3.ets#L116-L119
7f09f347e48eaba60cb91635e634a7df9498bdec
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/interface_class/complex_class/complex_class_001_T.ets
arkts
Introduction 嵌套类
export function complex_class_001_T(taint_src : string) { let b = new B(); b.setData(taint_src); taint.Sink(b.data.getData()); }
AST#export_declaration#Left export AST#function_declaration#Left function complex_class_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : 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...
export function complex_class_001_T(taint_src : string) { let b = new B(); b.setData(taint_src); taint.Sink(b.data.getData()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/interface_class/complex_class/complex_class_001_T.ets#L6-L10
7a5687be7f4d12c9597d519c341082aedc2c70ab
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinX.ets
arkts
SpinX
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinX { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local scale2: number = 0.3; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.sp...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinX AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinX { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local scale2: number = 0.3; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.sp...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinX.ets#L23-L95
d9aa21fb4fa5a35facedc30f2ed150b2e1b1dbaf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets
arkts
IDataSource处理数据监听的基本实现
export class SiteListDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private dataList: SiteItem[] = []; private initialSiteList: SiteItem[] | undefined = []; // 原数组 /** * 返回原数组 */ public getInitalList() { let siteListString: string | undefined = AppStorage.get('sit...
AST#export_declaration#Left export AST#class_declaration#Left class SiteListDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListen...
export class SiteListDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private dataList: SiteItem[] = []; private initialSiteList: SiteItem[] | undefined = []; public getInitalList() { let siteListString: string | undefined = AppStorage.get('siteList'); if (siteListS...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets#L21-L220
78676297c987df513cb610aec5f535ea215606e3
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/components/SwipeCardStack.ets
arkts
getRemainingCount
获取剩余卡片数量
public getRemainingCount(): number { return Math.max(0, this.cardDataList.length - this.currentIndex); }
AST#method_declaration#Left public getRemainingCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number 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_e...
public getRemainingCount(): number { return Math.max(0, this.cardDataList.length - this.currentIndex); }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L521-L523
2a2bd9a874ccd89c5f7b96f832a4002e8b8f9d60
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/components/basicUI/ReturnItem.ets
arkts
ReturnItem
返回组件
@Component export struct ReturnItem { @StorageLink('enterKeyType') enterKeyType: EnterKeyType = EnterKeyType.Done @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); private returnWidth: Resource | undefined = undefined; build() { if (this.returnWidth) { Stack()...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ReturnItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'enterKeyType' AST#expression#Right ) AST#decorator#Right enterKeyType : AST#type_annotation#Le...
@Component export struct ReturnItem { @StorageLink('enterKeyType') enterKeyType: EnterKeyType = EnterKeyType.Done @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); private returnWidth: Resource | undefined = undefined; build() { if (this.returnWidth) { Stack()...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/components/basicUI/ReturnItem.ets#L34-L74
dd3fb60834e85eb20441dc7875de1f3a10a64816
github
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/component/TextCommonComponent.ets
arkts
点击事件回调函数
build() { Row() { // 创建一个水平布局 // 显示左侧图标 Image(this.textImage !== undefined ? this.textImage : '') .width(26) // 设置图标宽度为26 .height(26) // 设置图标高度为26 .margin({ left: 12 }) // 设置左边距为12 // 显示标题文本 Text(this.title ?? '') .fontSize(17) // 设置字体大小为17 .margin({ ...
AST#build_method#Left build ( ) AST#build_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#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#cond...
build() { Row() { Image(this.textImage !== undefined ? this.textImage : '') .width(26) .height(26) .margin({ left: 12 }) Text(this.title ?? '') .fontSize(17) .margin({ left: 16 }) .height('100%') .opacity(0.9) T...
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/TextCommonComponent.ets#L8-L54
d03cc6bc4cc7cd0a2785c41405adb0f85dbc5f78
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
帖子状态枚举
export enum PostStatus { DRAFT = 'draft', PUBLISHED = 'published', HIDDEN = 'hidden', REPORTED = 'reported', DELETED = 'deleted' }
AST#export_declaration#Left export AST#enum_declaration#Left enum PostStatus AST#enum_body#Left { AST#enum_member#Left DRAFT = AST#expression#Left 'draft' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left PUBLISHED = AST#expression#Left 'published' AST#expression#Right AST#enum_member#Right , AST#enum_m...
export enum PostStatus { DRAFT = 'draft', PUBLISHED = 'published', HIDDEN = 'hidden', REPORTED = 'reported', DELETED = 'deleted' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L76-L82
aa44222605e2ea4cc099dcd79419e3ff58fda34f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/constants/LayoutPercent.ets
arkts
90% 百分比
export const P90: string = "90%";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P90 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "90%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right...
export const P90: string = "90%";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L99-L99
3c9892e6b49cf0e1483bb7ea2d0b50c03f533d8c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkJsObject.ets
arkts
setWebviewController
该方法内部功能实现用到,使用时,无需调用该方法。
setWebviewController(controller: webview.WebviewController) { this.controller = controller; }
AST#method_declaration#Left setWebviewController AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list...
setWebviewController(controller: webview.WebviewController) { this.controller = controller; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L32-L34
1a6f32aff686c720dbdbda1bfb64eee413505d6d
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_seven/ace_ets_component_seven_special/entry/src/main/ets/MainAbility/utils/Common.ets
arkts
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 default class CommonFunc { static rect_left; static rect_top; static rect_right; static rect_bottom; static rect_value; static sleep(time){ return new Promise((resolve,reject)=>{ setTimeout(()=>{ resolve("ok") },time) }).then(()=>{ ...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonFunc AST#class_body#Left { AST#property_declaration#Left static rect_left ; AST#property_declaration#Right AST#property_declaration#Left static rect_top ; AST#property_declaration#Right AST#property_declaration#Left static rect_right ; AS...
export default class CommonFunc { static rect_left; static rect_top; static rect_right; static rect_bottom; static rect_value; static sleep(time){ return new Promise((resolve,reject)=>{ setTimeout(()=>{ resolve("ok") },time) }).then(()=>{ ...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_seven_special/entry/src/main/ets/MainAbility/utils/Common.ets#L16-L47
e890f221e8f64b466963d85a5393720e7ee7c93b
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/ImageUtil.ets
arkts
pickerSave
水印 https://gitee.com/harmonyos_samples/watermark 将buffer图片保存到选择路径 @param buffer 图片buffer @returns 保存结果
static async pickerSave(buffer: ArrayBuffer): Promise<OutDTO<string>> { // 创建文件管理器保存选项实例 const photoSaveOptions = new picker.PhotoSaveOptions(); //设置默认文件名 photoSaveOptions.newFileNames = ['efPickerSave' + new Date().getTime() + '.jpg'] // 保存文件名(可选) //创建照片选择器 const photoViewPicker = new picker.Ph...
AST#method_declaration#Left static async pickerSave AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
static async pickerSave(buffer: ArrayBuffer): Promise<OutDTO<string>> { const photoSaveOptions = new picker.PhotoSaveOptions(); photoSaveOptions.newFileNames = ['efPickerSave' + new Date().getTime() + '.jpg'] const photoViewPicker = new picker.PhotoViewPicker; let photoSaveResult = ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L50-L69
f9a2ed9817b526c84ab826cddc76da8e84a543cf
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/review/ReviewToolbar.ets
arkts
FilterChip
筛选按钮
@Builder export function FilterChip( label: string, mode: 'all' | 'week' | 'month', currentMode: 'all' | 'week' | 'month', onModeChange: (mode: 'all' | 'week' | 'month') => void ) { Button(label) .fontSize(14) .height(36) .padding({ left: 20, right: 20 }) .backgroundColor(currentMode === mode ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function FilterChip AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode AST#...
@Builder export function FilterChip( label: string, mode: 'all' | 'week' | 'month', currentMode: 'all' | 'week' | 'month', onModeChange: (mode: 'all' | 'week' | 'month') => void ) { Button(label) .fontSize(14) .height(36) .padding({ left: 20, right: 20 }) .backgroundColor(currentMode === mode ...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/review/ReviewToolbar.ets#L60-L77
5e6e5be6c14f47c6fa31e5976acc1dc9f2e02aba
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/MessageUtil.ets
arkts
error
显示异常框 @param cfg
error(cfg: MessageCfg) { //设置成功弹框页面内容 let componentContent = new ComponentContent(cfg.context, wrapBuilder(errorView), cfg); this.buildView(componentContent, cfg); }
AST#method_declaration#Left error AST#parameter_list#Left ( AST#parameter#Left cfg : AST#type_annotation#Left AST#primary_type#Left MessageCfg AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { //设置成功弹框页面内容 AST#statement#Left AST#variable_declarati...
error(cfg: MessageCfg) { let componentContent = new ComponentContent(cfg.context, wrapBuilder(errorView), cfg); this.buildView(componentContent, cfg); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L103-L107
fdf8a845170dd1b4f6745f0b717b8f6152181672
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets
arkts
onWindowStageDestroy
[StartExclude request_permission_in_UIAbility]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{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(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets#L84-L87
77db42c43aee89e34333bec96de6ac9b80a41e67
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/ValidationUtils.ets
arkts
isValidUrl
验证URL
static isValidUrl(url: string): boolean { try { new URL(url); return true; } catch { return false; } }
AST#method_declaration#Left static isValidUrl AST#parameter_list#Left ( AST#parameter#Left url : 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 boolean AST#primary_type...
static isValidUrl(url: string): boolean { try { new URL(url); return true; } catch { return false; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ValidationUtils.ets#L33-L40
5748907fe380ee1da175cba7b95632292810ffc6
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinC.ets
arkts
SpinC
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinC { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0.4; @Local scale2: number = 0.4; @Local scale3: number = 0.4; @Local scale4: number = 0.4; @Local scale5: number = 0.4; build() { Row() { Canvas() .c...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinC AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinC { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0.4; @Local scale2: number = 0.4; @Local scale3: number = 0.4; @Local scale4: number = 0.4; @Local scale5: number = 0.4; build() { Row() { Canvas() .c...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinC.ets#L26-L187
ab131455beca1c6b97a335e0823845ae884e76b1
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets
arkts
sendStreamHttpRequest
[Start request_in_stream_interface_development] 封装流式 HTTP 请求逻辑
private sendStreamHttpRequest(): void { this.streamReqResult = $r('app.string.testing'); let httpRequest = http.createHttp(); let res = new ArrayBuffer(0); // 订阅HTTP响应头事件 httpRequest.on('headersReceive', (header: Object) => { Logger.info(`${LOG_TAG} header: ${JSON.stringify(header)}`); })...
AST#method_declaration#Left private sendStreamHttpRequest 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assign...
private sendStreamHttpRequest(): void { this.streamReqResult = $r('app.string.testing'); let httpRequest = http.createHttp(); let res = new ArrayBuffer(0); httpRequest.on('headersReceive', (header: Object) => { Logger.info(`${LOG_TAG} header: ${JSON.stringify(header)}`); }); ht...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets#L159-L187
0f1aac71aaa2c503592cc30e4f6082464d015420
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/pages/Income.ets
arkts
startSecondAbility
启动SecondAbility,跳转到支出页
startSecondAbility() { let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; // UIAbilityContext let wantInfo: Want = { deviceId: '', // deviceId为空表示本设备 bundleName: 'com.example.datasynchronization', moduleName: 'entry', // moduleName非必选 abilityName: 'Second...
AST#method_declaration#Left startSecondAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#...
startSecondAbility() { let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; let wantInfo: Want = { deviceId: '', bundleName: 'com.example.datasynchronization', moduleName: 'entry', abilityName: 'SecondAbility', parameters: { info: ...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/pages/Income.ets#L143-L161
d231d690e113a933a774eba8c9a6400f207a8d23
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines ChipGroupPaddingOptions. @interface ChipGroupPaddingOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ChipGroupPaddingOptions { /** * Top of chip group padding. * * @type { Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ top: Length; /** * Bottom of chip group padding. * * @type { L...
AST#export_declaration#Left export AST#interface_declaration#Left interface ChipGroupPaddingOptions AST#object_type#Left { /** * Top of chip group padding. * * @type { Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_m...
export interface ChipGroupPaddingOptions { top: Length; bottom: Length; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L528-L550
90c0244fb01b4153fd3149a1e0bb9f1198f37945
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets
arkts
clearRecords
清空记录(是否收藏除外)
clearRecords() { this.correctNumber = 0; this.errorNumber = 0; for (let item of this.examDetails) { item.selected = []; item.isCorrect = undefined; } }
AST#method_declaration#Left clearRecords AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . correctNumber AST#member...
clearRecords() { this.correctNumber = 0; this.errorNumber = 0; for (let item of this.examDetails) { item.selected = []; item.isCorrect = undefined; } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/model/QuestionAnswerRecord.ets#L108-L115
4fbb57536cc4c344f1534da26c43105c52617182
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/dialog/ToastIconDialog.ets
arkts
initToastIconDefault
------------------------- 保护、私有方法 protected | private methods ------------------------- 初始化ToastIconOptions参数 @param options
private initToastIconDefault(options: IToastIconOptions) { // dialogCoreHandler.initRouter(DialogHub.config.navigationId) options.isHideMask = options.isHideMask ?? true options.maskColor = Color.Transparent; //弹框自定义蒙层颜色。 options.autoCancel = false; //点击遮障层时,是否关闭弹窗。 options.isModal = false; //弹窗是否为模...
AST#method_declaration#Left private initToastIconDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IToastIconOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // dialogCoreH...
private initToastIconDefault(options: IToastIconOptions) { options.isHideMask = options.isHideMask ?? true options.maskColor = Color.Transparent; options.autoCancel = false; options.isModal = false; options._dialogType = 'toast' if (options.alignment || DialogHub.config.alignme...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/ToastIconDialog.ets#L51-L112
a02aec43859c9d6493b3ca17dff0d3c1c725f7e5
github
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/utils/LocalDataManager.ets
arkts
updateShopCart
Update shopCart data. @param props: update prop.
updateShopCart(props: UpdateShopProps) { const result: Product = this.shopCartData.filter((item: Product) => item.id === props.id)[0]; const newShop: Product = { id: props.id, name: result.name, img: result.img, commodityId: result.commodityId, description: result.description, ...
AST#method_declaration#Left updateShopCart AST#parameter_list#Left ( AST#parameter#Left props : AST#type_annotation#Left AST#primary_type#Left UpdateShopProps AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declar...
updateShopCart(props: UpdateShopProps) { const result: Product = this.shopCartData.filter((item: Product) => item.id === props.id)[0]; const newShop: Product = { id: props.id, name: result.name, img: result.img, commodityId: result.commodityId, description: result.description, ...
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L108-L125
5bfe045eb6944b841810a8861efefebaa4cc7def
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/CacheHelper.ets
arkts
clear
清除缓存数据,并重置lruCache的大小
public static clear() { CacheHelper.lruCache.clear(); CacheHelper.lruCache.updateCapacity(64); }
AST#method_declaration#Left public static clear 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#Le...
public static clear() { CacheHelper.lruCache.clear(); CacheHelper.lruCache.updateCapacity(64); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/CacheHelper.ets#L91-L94
dfeaa68f26a2c61cafeaeec0e3c70f7c7b3032ec
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets
arkts
ClickAnimationComponent
功能描述: 提供点击动画组件,能够在用户进行点击交互时展示生动的动画效果,如图标放大淡出或向上移动淡出等。此组件支持自定义背景内容和上方叠加的其他UI元素,并且支持通过参数自定义动画行为,例如调整动画速度、改变图标尺寸等。 实现原理: 1. 定义Stack布局来承载背景视频和点击出现的动画元素以及可能存在其他功能模块。 2. 点击效果区域使用Stack组件,结合LazyForEach实现图像元素的动态上下树和叠加显示。 3. 为点击效果区域添加TapGesture手势,当用户双击或连续快速点击区域时,添加新的图标项到LazyForEach数据源末尾。 4. 为显示图标的Image组件设置transition属性,根据设定的动画类型...
@Component export struct ClickAnimationComponent { // -------------------对外暴露变量----------------------- iconWidth: number = 60; // 图标的宽度,默认60像素。 iconHeight: number = 60; // 图标的高度,默认60像素。 animationType: IconAnimationType = IconAnimationType.ScaleUpAndFadeOut; // 动画类型,默认为放大淡出动画。 iconArray: Resource[] = ICON_LIST...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ClickAnimationComponent AST#component_body#Left { // -------------------对外暴露变量----------------------- AST#property_declaration#Left iconWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri...
@Component export struct ClickAnimationComponent { iconWidth: number = 60; iconHeight: number = 60; animationType: IconAnimationType = IconAnimationType.ScaleUpAndFadeOut; iconArray: Resource[] = ICON_LIST; scaleUpAndFadeOutOptions: ScaleUpAndFadeOutOptions = new ScaleUpAndFadeOutOptions(); moveUpAn...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets#L56-L253
2ee3d73233464e18bec972414091c97401bda21f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
prepare
加载播放资源 @param finishTask prepare完成时的任务 @returns {Promise<void}
async prepare(finishTask?: Function): Promise<void> { if (!this.curMusicModelRaw) { return; } await this.avplayerModel.prepare(this.curMusicModelRaw.res, finishTask); }
AST#method_declaration#Left async prepare AST#parameter_list#Left ( AST#parameter#Left finishTask ? : AST#type_annotation#Left AST#primary_type#Left Function 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#...
async prepare(finishTask?: Function): Promise<void> { if (!this.curMusicModelRaw) { return; } await this.avplayerModel.prepare(this.curMusicModelRaw.res, finishTask); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L201-L207
59ec7871517d8d309f1437bc3751d82d3cedced2
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
getRecentMemos
Get recent memos (last 10) @returns Array of recent Memo objects
async getRecentMemos(limit: number = 10): Promise<Memo[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_MEMOS); predicates.orderByDesc('created_at'); predicates.limitAs(limit); try { const...
AST#method_declaration#Left async getRecentMemos AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#...
async getRecentMemos(limit: number = 10): Promise<Memo[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_MEMOS); predicates.orderByDesc('created_at'); predicates.limitAs(limit); try { const...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L384-L414
e277fc9fcc8a16cf05af89bd57a6a64c29c9e39b
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
isAxisLineDashedLineEnabled
Returns true if the axis dashed-line effect is enabled, false if not. @return
public isAxisLineDashedLineEnabled(): boolean { return this.mAxisLineDashPathEffect == null ? false : true; }
AST#method_declaration#Left public isAxisLineDashedLineEnabled 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...
public isAxisLineDashedLineEnabled(): boolean { return this.mAxisLineDashPathEffect == null ? false : true; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L663-L665
9ea57d1d2b8b80cc285f4b775e29d5bb1905d0e5
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/common/utils/Geography.ets
arkts
toPixelCoordinates
The Mercator projection calculates the pixel coordinate system, which may have stretching errors. @param Latitude @param Longitude @returns pixelCoordinates.
public static toPixelCoordinates(latitude: number, longitude: number): PixelCoordinates { // Calculations that associate the selected area with coordinates. const yMin = Geography.MercatorY(Const.SOUTH_LATITUDE); const yMax = Geography.MercatorY(Const.NORTH_LATITUDE); // Ratio of the image width range t...
AST#method_declaration#Left public static toPixelCoordinates AST#parameter_list#Left ( AST#parameter#Left latitude : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left longitude : AST#type_annotation#Left AST#primary_type#Left ...
public static toPixelCoordinates(latitude: number, longitude: number): PixelCoordinates { const yMin = Geography.MercatorY(Const.SOUTH_LATITUDE); const yMax = Geography.MercatorY(Const.NORTH_LATITUDE); const xFactor = Const.MAP_WIDTH / (Const.EAST_LONGITUDE - Const.WEST_LONGITUDE); const...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/Geography.ets#L30-L43
2ab1380bbd0e86084a9b777b74a4ffab6f5447df
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets
arkts
onDestroy
[EndExclude save_uiContext_to_localstorage_in_entry_ability] [StartExclude save_uiContext_to_localstorage_in_entry_ability]
onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
AST#method_declaration#Left onDestroy 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#Lef...
onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets#L34-L36
efd6823b8e59a3ae2d5c953445cebcab7db89cf2
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
BinaryEncodingVisitor
Binary 编码 Visitor 将消息编码为 Protobuf wire format
export { BinaryEncodingVisitor } from './BinaryEncodingVisitor'
AST#export_declaration#Left export { BinaryEncodingVisitor } from './BinaryEncodingVisitor' AST#export_declaration#Right
export { BinaryEncodingVisitor } from './BinaryEncodingVisitor'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L51-L51
16684e144774b0cfc5da2ce0f13042d52306d25c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppDefines.ets
arkts
获取文件路径
export const dAppFilefolder = getAppContext().filesDir + '/';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left dAppFilefolder = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getAppContext AST#expression#Right AST#argum...
export const dAppFilefolder = getAppContext().filesDir + '/';
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppDefines.ets#L40-L40
232166328c286b876c7a4101522205a4a10a186d
github