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
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets
arkts
timeChanged
时间变化回调函数
private timeChanged(newHour: number, newMinute: number, newSecond: number) { const hour = newHour > HOUR_12 ? newHour - HOUR_12 : newHour; const hourOffset = newMinute * HOUR_OFFSET_FACTOR; const minuteOffset = newSecond * MINUTE_OFFSET_FACTOR; this.paintPin(ANGLE_PRE_HOUR * hour + hourOffset, this.hou...
AST#method_declaration#Left private timeChanged AST#parameter_list#Left ( AST#parameter#Left newHour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newMinute : AST#type_annotation#Left AST#primary_type#Left number AST#pri...
private timeChanged(newHour: number, newMinute: number, newSecond: number) { const hour = newHour > HOUR_12 ? newHour - HOUR_12 : newHour; const hourOffset = newMinute * HOUR_OFFSET_FACTOR; const minuteOffset = newSecond * MINUTE_OFFSET_FACTOR; this.paintPin(ANGLE_PRE_HOUR * hour + hourOffset, this.hou...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets#L178-L186
94c22a1f07169402630a2a579bff45b426d59ec7
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/HomeFlashSaleSection.ets
arkts
HomeFlashSaleSection
@file 首页限时精选卡片组件 @author Joker.X
@ComponentV2 export struct HomeFlashSaleSection { /** * 商品列表 */ @Param goodsList: Goods[] = []; /** * 商品点击回调 */ @Param onGoodsClick: (id: number) => void = () => { }; /** * 查看全部回调 */ @Param onMoreClick: () => void = () => { }; /** * 构建限时精选卡片 * @returns {void} 无返回值 */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HomeFlashSaleSection AST#component_body#Left { /** * 商品列表 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right goodsList : AST#type_annotation#Left AST#primary_type#Left AST#array_ty...
@ComponentV2 export struct HomeFlashSaleSection { @Param goodsList: Goods[] = []; @Param onGoodsClick: (id: number) => void = () => { }; @Param onMoreClick: () => void = () => { }; build(): void { if (this.goodsList && this.goodsList.length > 0) { Card() { CardTitleCell(...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeFlashSaleSection.ets#L10-L61
66b34f2a2433396c4b7fe2d6a692f44557a53eb3
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/PrivateChatComponent.ets
arkts
hideSoftInputMethod
收到键盘 @param context
hideSoftInputMethod(context: UIContext) { context.getFocusController().clearFocus(); }
AST#method_declaration#Left hideSoftInputMethod AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left A...
hideSoftInputMethod(context: UIContext) { context.getFocusController().clearFocus(); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L202-L204
80417624546b133ee9c6642b254db5559c50a93a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/social/PostDetailPage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/PostDetailPage.ets#L74-L120
b6cb3de9981bb2d72931405d4c4b7189292bc87e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/text/SelectMenu.ets
arkts
RightClickTextCustomMenu
定义菜单项
@Builder RightClickTextCustomMenu() { Column() { Menu() { MenuItemGroup() { MenuItem({ startIcon: $r('app.media.app_icon'), content: 'CustomMenu One', labelInfo: '' }) .onClick(() => { // 使用closeSelectionMenu接口关闭菜单 this.controller.closeSelectionMenu(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right RightClickTextCustomMenu 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#...
@Builder RightClickTextCustomMenu() { Column() { Menu() { MenuItemGroup() { MenuItem({ startIcon: $r('app.media.app_icon'), content: 'CustomMenu One', labelInfo: '' }) .onClick(() => { this.controller.closeSelectionMenu(); }) M...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/text/SelectMenu.ets#L26-L41
7b36ac2e8fb8859f51d9c2c05b87d98fde488358
gitee
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/models/Code.ets
arkts
目前实现阅读的传感器数据
export const CodeLIST: Item[] = [ { destination: CodeID.temperature, code: "01 03 00 01 00 01 D5 CA", name: "temperature" }, { destination: CodeID.humidity, code : "01 03 00 00 00 01 84 0A", name: "humidity" }, { destination: CodeID.co2, code : "", name: 'co2', }, { ...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CodeLIST : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Item [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#L...
export const CodeLIST: Item[] = [ { destination: CodeID.temperature, code: "01 03 00 01 00 01 D5 CA", name: "temperature" }, { destination: CodeID.humidity, code : "01 03 00 00 00 01 84 0A", name: "humidity" }, { destination: CodeID.co2, code : "", name: 'co2', }, { ...
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/models/Code.ets#L42-L94
c340952542c292f38b0e39f228e4e4962f898a53
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
BptaUseSoftware/entry/src/main/ets/pages/LockBySystem.ets
arkts
onForeground
...
onForeground(): void { //Apply for the resources required by the system, or reapply for the resources released in onBackground () audio.createAudioRenderer(audioRendererOptions,(err: BusinessError) => {}); }
AST#method_declaration#Left onForeground 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 { //Apply for the resources required by the system, or reapply for the resources released in...
onForeground(): void { audio.createAudioRenderer(audioRendererOptions,(err: BusinessError) => {}); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseSoftware/entry/src/main/ets/pages/LockBySystem.ets#L56-L59
e67d5bef441539e19c151a613583b1a39a08f5ba
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets
arkts
getY
returns the y-value of the highlighted value @return
public getY(): number { return this.mY; }
AST#method_declaration#Left public getY 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#member_expression#L...
public getY(): number { return this.mY; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L114-L116
89cd3c90fe27abeee2292272b26dfda69e874b49
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/common/component/TextMatchUtils.ets
arkts
url
export class UrlMatchRegExp extends TextMatchRegExp { getType(): number { return MatchType.URL } getRegExp(): RegExp { return /https?:\/\/[^\s\/$.?#].[^\s]*/g } }
AST#export_declaration#Left export AST#class_declaration#Left class UrlMatchRegExp extends AST#type_annotation#Left AST#primary_type#Left TextMatchRegExp AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left getType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#...
export class UrlMatchRegExp extends TextMatchRegExp { getType(): number { return MatchType.URL } getRegExp(): RegExp { return /https?:\/\/[^\s\/$.?#].[^\s]*/g } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/component/TextMatchUtils.ets#L186-L194
21c01ef2883667e1080ef46361260c26a5626830
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreview.ets
arkts
PicturePreview
使用图片预览组件样例 核心组件: 一. PicturePreview 二. PicturePreviewImage 实现步骤: 一、PicturePreview - 1. 使用 List 来使用多图片的移动和展示 - 2. 当图片处于边缘位置可以通过 ListScroller 来进行图片预览的位移 二、PicturePreviewImage - 1. 使用matrix实现图片的缩放 - 2. 使用offset实现组件的偏移 - 3. 提前计算图片属性以便对组件属性进行设置 - 4. Image.objectFile使用Cover以便图片能够超出其父组件显示(而不撑大父组件) @param { Axis } [listDire...
@Component export struct PicturePreview { // 滑动方向 @Prop listDirection: Axis = Axis.Vertical; // 外部传入的图片数据 @Link @Watch('getListMaxLength') imageList: string[]; // 背景颜色 @State listBGColor: Color = Color.White; // 图片懒加载数据源 @State lazyImageList: CommonLazyDataSourceModel<string> = new CommonLazyDataSourceM...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PicturePreview AST#component_body#Left { // 滑动方向 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right listDirection : AST#type_annotation#Left AST#primary_type#Left Axis AST#primary_type#Right A...
@Component export struct PicturePreview { @Prop listDirection: Axis = Axis.Vertical; @Link @Watch('getListMaxLength') imageList: string[]; @State listBGColor: Color = Color.White; @State lazyImageList: CommonLazyDataSourceModel<string> = new CommonLazyDataSourceModel(); private listIndex: numbe...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreview.ets#L42-L149
5687faff41d378575dc3bb27171cf40541b28279
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets
arkts
title
标题
@Builder title() { Column({ space: SPACE_EIGHTEEN }) { Text($r('app.string.send_message_text1')) .fontSize($r('app.integer.send_message_text_font_size')) .fontWeight(FONT_WEIGHT) .fontColor(Color.Black) Text() { Span($r('app.string.send_message_span1')) .fontC...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right title 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#component_parameters#Left { AST#component_parameter#Lef...
@Builder title() { Column({ space: SPACE_EIGHTEEN }) { Text($r('app.string.send_message_text1')) .fontSize($r('app.integer.send_message_text_font_size')) .fontWeight(FONT_WEIGHT) .fontColor(Color.Black) Text() { Span($r('app.string.send_message_span1')) .fontC...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets#L63-L83
09e521e19ff124785f11cd760c1fe468ba6ca356
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets
arkts
createColors
turn an array of resource-colors (contains resource-id integers) into an array list of actual color integers @param r @param colors an integer array of resource id's of colors @return
public static createColors(colors?: number[]): JArrayList<number> { var result: JArrayList<number> = new JArrayList<number>(); for (var i = 0; i < colors.length; i++) { result.add(colors[i]); } return result; }
AST#method_declaration#Left public static createColors AST#parameter_list#Left ( AST#parameter#Left colors ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann...
public static createColors(colors?: number[]): JArrayList<number> { var result: JArrayList<number> = new JArrayList<number>(); for (var i = 0; i < colors.length; i++) { result.add(colors[i]); } return result; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets#L235-L241
e833e84c30fcb0cf9d38699743c798b950c2ccd7
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/MediaService/src/main/ets/utils/BackgroundTaskManager.ets
arkts
stopContinuousTask
cancel continuous task
public static stopContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { Logger.error(TAG, `stopBackgro...
AST#method_declaration#Left public static stopContinuousTask 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#Right AST#parameter#Right ) AST#param...
public static stopContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { Logger.error(TAG, `stopBackgro...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/utils/BackgroundTaskManager.ets#L56-L65
76a1dbf378362df5313575cf8e4573cea94229d3
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
revokePermission
对所选择的多个文件或目录uri取消持久化授权。(需要权限:ohos.permission.FILE_ACCESS_PERSIST) @returns 无返回结果的Promise对象。
static async revokePermission(policies: Array<fileShare.PolicyInfo>): Promise<void> { return fileShare.revokePermission(policies); }
AST#method_declaration#Left static async revokePermission AST#parameter_list#Left ( AST#parameter#Left policies : 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 AST#qualified_type#Left fileShare . PolicyInfo AST#qualifi...
static async revokePermission(policies: Array<fileShare.PolicyInfo>): Promise<void> { return fileShare.revokePermission(policies); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L937-L939
45718ffc98053fb4057b1eeccecc7af916c4b646
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
listFileSync
列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,以同步方法。 @param path string 文件夹的应用沙箱路径。 @param options 文件过滤选项。默认不进行过滤。 recursion boolean 是否递归子目录下文件名,默认为false。 listNum number 列出文件名数量。当设置0时,列出所有文件,默认为0。 filter Filter 文件过滤选项。当前仅支持后缀名匹配、文件名模糊查询、文件大小过滤、最近修改时间过滤。 @returns
static listFileSync(path: string, options?: ListFileOptions): string[] { return fs.listFileSync(path, options); }
AST#method_declaration#Left static listFileSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left ListFileOptions A...
static listFileSync(path: string, options?: ListFileOptions): string[] { return fs.listFileSync(path, options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L555-L557
d18012a822e9f1a5913bdc330f62919068aa3ef9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 l...
export class RouterModule { // 用于存储自定义builder函数 static builderMap: Map<string, WrappedBuilder<[Object]>> = new Map<string, WrappedBuilder<[Object]>>(); // 用于存储页面栈信息 static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>(); public static registerBuilder(builderName: string, builder: Wrapp...
AST#export_declaration#Left export AST#class_declaration#Left class RouterModule AST#class_body#Left { // 用于存储自定义builder函数 AST#property_declaration#Left static builderMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left s...
export class RouterModule { static builderMap: Map<string, WrappedBuilder<[Object]>> = new Map<string, WrappedBuilder<[Object]>>(); static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>(); public static registerBuilder(builderName: string, builder: WrappedBuilder<[Object]>): void { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/RouterModule/src/main/ets/utils/RouterModule.ets#L16-L42
ad34e7585b00739ee8164b7d803b0a4bdf6ed117
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/CustomTextView.ets
arkts
CustomTextView
showCustomContentDialog - 自定义的文本组件
@ComponentV2 export struct CustomTextView { @Require @Param content: string | Resource; build() { Text(this.content) .fontSize(15) .fontStyle(FontStyle.Normal) .fontFamily('MyFont') .shadow(ShadowStyle.OUTER_DEFAULT_SM) .textShadow({ color: Color.Red, radius: 2, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CustomTextView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right content : AST#type_annotation#Left AST#union_typ...
@ComponentV2 export struct CustomTextView { @Require @Param content: string | Resource; build() { Text(this.content) .fontSize(15) .fontStyle(FontStyle.Normal) .fontFamily('MyFont') .shadow(ShadowStyle.OUTER_DEFAULT_SM) .textShadow({ color: Color.Red, radius: 2, ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/CustomTextView.ets#L10-L32
d5b763efae2605d30ccc1b4d055404ad4ebcecd5
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/OrderPage.ets
arkts
formItem
表单项构建函数
@Builder private formItem(label: string, placeholder: string) { Row() { // 标签文字 Text(label) .fontSize(14) .fontColor('#333') .width(80) .alignSelf(ItemAlign.Center) // 输入框 TextInput({ placeholder: placeholder }) .backgroundColor('#F2F2F2') ....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private formItem 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 placeholder : AST#type_annota...
@Builder private formItem(label: string, placeholder: string) { Row() { Text(label) .fontSize(14) .fontColor('#333') .width(80) .alignSelf(ItemAlign.Center) TextInput({ placeholder: placeholder }) .backgroundColor('#F2F2F2') .borderRadius(...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/OrderPage.ets#L155-L173
7651b52747dabff218ca40738338158b3891f97a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/common/CommonConstants.ets
arkts
内置默认属性值 @since 1.0
export class CommonConstants { // 默认背景条伸缩比例 static readonly DEFAULT_INDICATOR_EXPAND = 1.5; // 默认动画时长 static readonly DEFAULT_ANIMATION_DURATION = 240; // 默认页签项宽度(单位: px) static readonly DEFAULT_LIST_ITEM_WIDTH = 90; // 默认页签条到达边界后继续移动的偏移相对于手滑偏移的比例 static readonly DEFAULT_LIST_RELATIVE_RATIO = 0.25; //...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // 默认背景条伸缩比例 AST#property_declaration#Left static readonly DEFAULT_INDICATOR_EXPAND = AST#expression#Left 1.5 AST#expression#Right ; AST#property_declaration#Right // 默认动画时长 AST#property_declaration#Left static rea...
export class CommonConstants { static readonly DEFAULT_INDICATOR_EXPAND = 1.5; static readonly DEFAULT_ANIMATION_DURATION = 240; static readonly DEFAULT_LIST_ITEM_WIDTH = 90; static readonly DEFAULT_LIST_RELATIVE_RATIO = 0.25; static readonly DEFAULT_TAB_SPRING_DURATION = 180; static reado...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/common/CommonConstants.ets#L21-L76
68f30f30f2098bc5777909c8160611aa4f03a6d0
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets
arkts
computeTask
计算任务
@Concurrent function computeTask(times: number): number { let start: number = new Date().getTime(); let a: number = 1; let b: number = 1; let c: number = 1; for (let i: number = 0; i < times; i++) { a = a * Math.random() + b * Math.random() + c * Math.random(); b = a * Math.random() + b * Math.random...
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function computeTask AST#parameter_list#Left ( AST#parameter#Left times : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AS...
@Concurrent function computeTask(times: number): number { let start: number = new Date().getTime(); let a: number = 1; let b: number = 1; let c: number = 1; for (let i: number = 0; i < times; i++) { a = a * Math.random() + b * Math.random() + c * Math.random(); b = a * Math.random() + b * Math.random...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets#L83-L97
86635c985eb9dce004a7e6230eb35a6ab1c91484
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets
arkts
changePreferType
更改PreferType
changePreferType(status: number): void { if (status === display.FoldStatus.FOLD_STATUS_FOLDED) { this.isCenter = false; } else { this.isCenter = true; } }
AST#method_declaration#Left changePreferType AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#...
changePreferType(status: number): void { if (status === display.FoldStatus.FOLD_STATUS_FOLDED) { this.isCenter = false; } else { this.isCenter = true; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets#L94-L100
4069b59c97ce3c61374db5601b68c9de4a97c7e4
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/PlayerService.ets
arkts
init
初始化播放器
async init(): Promise<void> { if (this.avPlayer) { return; } try { // 从设置中加载默认播放速度 const settingsService = SettingsService.getInstance(); this.playbackSpeed = settingsService.getPlaybackSpeed(); console.info(`[PlayerService] Default playback speed: ${this.playbackSpeed}`); ...
AST#method_declaration#Left async init 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_arguments#R...
async init(): Promise<void> { if (this.avPlayer) { return; } try { const settingsService = SettingsService.getInstance(); this.playbackSpeed = settingsService.getPlaybackSpeed(); console.info(`[PlayerService] Default playback speed: ${this.playbackSpeed}`); this.avPlay...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PlayerService.ets#L59-L76
af416d713ab4a4284eb2d3c475af2522853de901
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/CsConn.ets
arkts
@file 客服连接 @author Joker.X
export class CsConn { /** * ID */ id: number = 0; /** * 用户ID */ userId: number = 0; /** * 连接ID */ connId: string = ""; /** * 类型 0-客户 1-后台 */ type: number = 0; /** * 创建时间 */ createTime?: string | null = null; /** * 更新时间 */ updateTime?: string | null = null; ...
AST#export_declaration#Left export AST#class_declaration#Left class CsConn AST#class_body#Left { /** * ID */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declara...
export class CsConn { id: number = 0; userId: number = 0; connId: string = ""; type: number = 0; createTime?: string | null = null; updateTime?: string | null = null; constructor(init?: Partial<CsConn>) { if (!init) { return; } this.id = init.id ?? this.id; this.us...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/CsConn.ets#L5-L42
9ea36ff8946db8127fc6fee9907d5f3ed379077b
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
getToastIcon
/* ---------------------- 系统弹窗[End] ------------------------ 吐司 + 图标 @description 图标与文字可垂直 或 水平排列 @returns
static getToastIcon(uiContext?: UIContext): ToastIconBuilderProxy { return new ToastIconBuilderProxy(uiContext) }
AST#method_declaration#Left static getToastIcon AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToastIconBu...
static getToastIcon(uiContext?: UIContext): ToastIconBuilderProxy { return new ToastIconBuilderProxy(uiContext) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L106-L108
b439320f7ce4768ad8c02053f4c33c834d21fef5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/HomeCouponSection.ets
arkts
构建优惠券区域 @returns {void} 无返回值
build(): void { Card({ paddingValue: $r("app.float.space_vertical_medium") }) { Row() { Swiper() { ForEach(this.coupons, (coupon: Coupon): void => { this.couponCard(coupon); }, (coupon: Coupon): string => `${coupon.id}-${coupon.title}`); } .indicator(fal...
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 Card ( AST#component_parameters#Left { AST#component_parameter#Left paddingValue...
build(): void { Card({ paddingValue: $r("app.float.space_vertical_medium") }) { Row() { Swiper() { ForEach(this.coupons, (coupon: Coupon): void => { this.couponCard(coupon); }, (coupon: Coupon): string => `${coupon.id}-${coupon.title}`); } .indicator(fal...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCouponSection.ets#L21-L48
683f909e3de4e6930d9841fa13ff12543cf41222
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets
arkts
setScanXComponentSize
计算当前相机预览流显示大小和偏移位置 @param isSupportRotation @param windowSize
public setScanXComponentSize(isSupportRotation: boolean, windowSize: window.Size): void { if (isSupportRotation) { this.getOrientation(); } if (windowSize) { logger.info(`Start to set scan XComponent size. Width: ` + windowSize.width + `, height: ` + windowSize.height); this.updateBreakpoi...
AST#method_declaration#Left public setScanXComponentSize AST#parameter_list#Left ( AST#parameter#Left isSupportRotation : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowSize : AST#type_annotation#Left AST#primary_typ...
public setScanXComponentSize(isSupportRotation: boolean, windowSize: window.Size): void { if (isSupportRotation) { this.getOrientation(); } if (windowSize) { logger.info(`Start to set scan XComponent size. Width: ` + windowSize.width + `, height: ` + windowSize.height); this.updateBreakpoi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets#L142-L178
c4f595bda340a28e5ff202f824b800ef99bce212
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Manager/CDbPath.ets
arkts
MARK: - 路径处理类
export class CDbPath { // 纯名称属性 private baseName: string; // 构造函数 constructor(pureName: string) { this.baseName = pureName; } ///CloudSound的sound的sqlite位置 get sqlite(): string { return `${dAppCloudSoundFolderPath}/${this.baseName}.sqlite`; } }
AST#export_declaration#Left export AST#class_declaration#Left class CDbPath AST#class_body#Left { // 纯名称属性 AST#property_declaration#Left private baseName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 构造函数 AST#constructor_decl...
export class CDbPath { private baseName: string; constructor(pureName: string) { this.baseName = pureName; } get sqlite(): string { return `${dAppCloudSoundFolderPath}/${this.baseName}.sqlite`; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CDbPath.ets#L9-L23
aea08aaeb28463b7ef108c7afb9387381d8db604
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
formatDate
格式化日期
formatDate(date: Date, format?: string): string { try { const languageInfo = this.getCurrentLanguageInfo(); const dateFormat = format || languageInfo?.dateFormat || 'yyyy/MM/dd'; const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const d...
AST#method_declaration#Left formatDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right...
formatDate(date: Date, format?: string): string { try { const languageInfo = this.getCurrentLanguageInfo(); const dateFormat = format || languageInfo?.dateFormat || 'yyyy/MM/dd'; const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const d...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L387-L405
524e118d0863fa17a6992efd2247b6e5fa4324c9
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
buildCurrentLanguageCard
构建当前语言卡片
@Builder buildCurrentLanguageCard() { Column({ space: 12 }) { Row() { Text('当前语言') .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .layoutWeight(1) Text(this.getCurrentLanguageInfo()?.flag || '🌐') .font...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCurrentLanguageCard 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#component_parameters#Left { AST#comp...
@Builder buildCurrentLanguageCard() { Column({ space: 12 }) { Row() { Text('当前语言') .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .layoutWeight(1) Text(this.getCurrentLanguageInfo()?.flag || '🌐') .font...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L143-L212
23134df184adca3af37a66807ad9d8ceb3346b26
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/ZFunction.ets
arkts
findLongestPalindrome
查找字符串的最长回文子串 @param str 输入字符串 @returns 最长回文子串
static findLongestPalindrome(str: string): string { if (!str || str.length === 0) { return ''; } const reversed = str.split('').reverse().join(''); const combined = str + '$' + reversed; const z = ZFunction.computeZArray(combined); let maxLen = 0; let maxPos = 0; for (let i = str...
AST#method_declaration#Left static findLongestPalindrome AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
static findLongestPalindrome(str: string): string { if (!str || str.length === 0) { return ''; } const reversed = str.split('').reverse().join(''); const combined = str + '$' + reversed; const z = ZFunction.computeZArray(combined); let maxLen = 0; let maxPos = 0; for (let i = str...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/ZFunction.ets#L93-L112
e085ce535e53d0c3958743dae824a07ac467602e
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
loadTasks
加载任务数据
async loadTasks() { try { this.tasks = await StorageUtils.getObject<TaskItem[]>(AppConstants.STORAGE_KEY_TASKS, []); this.notifyListeners(); } catch (error) { console.error('Failed to load tasks:', error); } }
AST#method_declaration#Left async loadTasks AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#L...
async loadTasks() { try { this.tasks = await StorageUtils.getObject<TaskItem[]>(AppConstants.STORAGE_KEY_TASKS, []); this.notifyListeners(); } catch (error) { console.error('Failed to load tasks:', error); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L58-L65
86399ae7ff7cedaa2d4a22d196a852fc47c7b0e9
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
equals
Compares two objects for equality. @param { Object } obj - An object @returns { boolean } Returns true if the given object is the same as the current object; Otherwise, false is returned. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
equals(obj: Object): boolean;
AST#method_declaration#Left equals AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left Object 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#Right AST#...
equals(obj: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L943-L943
ff4bcfa28e2cd6134c6dd8488e85ec6c01e5793e
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/DemoRepository.ets
arkts
getById
根据主键查询单条 Demo 记录 @param {number} id - 记录主键 @returns {Promise<DemoEntity | undefined>} 匹配到的记录或 undefined
async getById(id: number): Promise<DemoEntity | undefined> { return this.demoLocalDataSource.getItemById(id); }
AST#method_declaration#Left async getById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise...
async getById(id: number): Promise<DemoEntity | undefined> { return this.demoLocalDataSource.getItemById(id); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/DemoRepository.ets#L70-L72
6f3018291785f99293ca561f74c0b0f59b81db8c
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bridges/Widget/DialogApi.ets
arkts
showSubWindow
显示当前窗口
private showSubWindow() { if (this.subWindow) { this.subWindow.showWindow((err: BusinessError) => { const errCode: number = err.code; if (errCode) { DMPLogger.e('Fail to show window, Cause: ' + JSON.stringify(err)); } }) } }
AST#method_declaration#Left private showSubWindow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Ri...
private showSubWindow() { if (this.subWindow) { this.subWindow.showWindow((err: BusinessError) => { const errCode: number = err.code; if (errCode) { DMPLogger.e('Fail to show window, Cause: ' + JSON.stringify(err)); } }) } }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/Widget/DialogApi.ets#L107-L116
66967a1d1a1759fc8766a3a0d7bc76a518c07510
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
arkts
更新任务 @param id 任务ID @param task 任务对象 @returns 更新后的任务
export function updateTask(id: number, task: Task): Promise<Task> { try { // 创建符合接口的数据结构 const queryParams: QueryParams = {}; const requestData: RequestData = { id: task.id, userId: task.userId, dreamId: task.dreamId, title: task.title, description: task.description, st...
AST#export_declaration#Left export AST#function_declaration#Left function updateTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left task : AST#type_annotation#Left AST#prima...
export function updateTask(id: number, task: Task): Promise<Task> { try { const queryParams: QueryParams = {}; const requestData: RequestData = { id: task.id, userId: task.userId, dreamId: task.dreamId, title: task.title, description: task.description, status: task.sta...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L213-L244
e4b8a63ef7a8911c7fcf99accd3f3b0b45d05d13
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets
arkts
addGroup
添加分组
async addGroup(books: BookGroups){ BookGroupsDao.insert(books) }
AST#method_declaration#Left async addGroup AST#parameter_list#Left ( AST#parameter#Left books : AST#type_annotation#Left AST#primary_type#Left BookGroups AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#exp...
async addGroup(books: BookGroups){ BookGroupsDao.insert(books) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L30-L32
475847ec7d9ff43194927e78439aaeecaa9b2a44
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/I18nManager.ets
arkts
formatNumber
格式化数字
formatNumber(num: number, decimals: number = 0): string { try { const languageInfo = this.getCurrentLanguageInfo(); // 根据语言使用不同的数字格式 if (this.currentLanguage === SupportedLanguage.ZH_CN || this.currentLanguage === SupportedLanguage.ZH_TW) { // 中文数字格式 return num.to...
AST#method_declaration#Left formatNumber AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left decimals : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri...
formatNumber(num: number, decimals: number = 0): string { try { const languageInfo = this.getCurrentLanguageInfo(); if (this.currentLanguage === SupportedLanguage.ZH_CN || this.currentLanguage === SupportedLanguage.ZH_TW) { return num.toFixed(decimals); } ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L441-L462
6790c6105d972654a30e2ea93f433a354ca0ead9
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets
arkts
setFullScreenRoutes
设置折叠屏下全屏路由信息
public static setFullScreenRoutes(routes: string[]) { DynamicsRouter.fullScreenRoutes = routes; }
AST#method_declaration#Left public static setFullScreenRoutes AST#parameter_list#Left ( AST#parameter#Left routes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#build...
public static setFullScreenRoutes(routes: string[]) { DynamicsRouter.fullScreenRoutes = routes; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets#L86-L88
fc3877df00b9266f7a0fb5d6d342344f30bc5aac
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/database/DistributedDB.ets
arkts
updateSurvey
更新问卷
async updateSurvey(survey: Survey, isSync = true): Promise<boolean> { if (!this.rdbStore) { Logger.info('[restoreSurvey]', 'restoreSurvey() has no callback!'); return false; } try { const valueBucket: relationalStore.ValuesBucket = { 'title': survey.title, 'description': s...
AST#method_declaration#Left async updateSurvey AST#parameter_list#Left ( AST#parameter#Left survey : AST#type_annotation#Left AST#primary_type#Left Survey AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isSync = AST#expression#Left AST#boolean_literal#Left true AST#boolean_lite...
async updateSurvey(survey: Survey, isSync = true): Promise<boolean> { if (!this.rdbStore) { Logger.info('[restoreSurvey]', 'restoreSurvey() has no callback!'); return false; } try { const valueBucket: relationalStore.ValuesBucket = { 'title': survey.title, 'description': s...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/database/DistributedDB.ets#L243-L284
e18cff6d3a4b448cffe090d36cd2ce929e656c43
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
arkts
decryptECB
解密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @returns
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> { return SM4.decrypt(data, symKey, null, 'SM4_128|ECB|PKCS7'); }
AST#method_declaration#Left static async decryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym...
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> { return SM4.decrypt(data, symKey, null, 'SM4_128|ECB|PKCS7'); }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L176-L178
29071a9487e9c8b72c807a9dd04b40cb79bfd760
github
Neptune-EX/OS_System_Design.git
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
entry/src/main/ets/view/PublicFilesTab.ets
arkts
getFileIcon
根据文件扩展名返回对应的图标
private getFileIcon(filename: string): string { if (filename.endsWith('.txt')) return '📝'; if (filename.endsWith('.pdf')) return '📕'; if (filename.endsWith('.jpg') || filename.endsWith('.png') || filename.endsWith('.gif')) return '🖼️'; if (filename.endsWith('.mp4') || filename.endsWith('.avi')) retur...
AST#method_declaration#Left private getFileIcon 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#Left AST#primary_type#Left string AST#primar...
private getFileIcon(filename: string): string { if (filename.endsWith('.txt')) return '📝'; if (filename.endsWith('.pdf')) return '📕'; if (filename.endsWith('.jpg') || filename.endsWith('.png') || filename.endsWith('.gif')) return '🖼️'; if (filename.endsWith('.mp4') || filename.endsWith('.avi')) retur...
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/view/PublicFilesTab.ets#L489-L497
e1d11fd06b329260fc36f090e53ff8c1356d12fd
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/http/FileUtil.ets
arkts
getTempDirPath
获取临时目录下的文件夹路径或文件路径。 @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns
static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().tempDir : getContext().getApplicationContext().tempDir; //根目录 if (StringUtils.isNotEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。 filePat...
AST#method_declaration#Left static getTempDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annot...
static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().tempDir : getContext().getApplicationContext().tempDir; if (StringUtils.isNotEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { filePath = dirPath; } e...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/FileUtil.ets#L89-L105
ebb15817ee60d4ea5997e5390f40e3a5aed5dec7
gitee
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
entry/src/main/ets/rdb/MapperMultiple.ets
arkts
getInstance2DB
单例模式 db2
static getInstance2DB() { if (!MapperMultiple.mapper2) { MapperMultiple.mapper2 = BaseMapper.build<Employee>({ class: Employee, config: { name: 'RdbTest2.db', // 数据库文件名 securityLevel: relationalStore.SecurityLevel.S3, // 数据库安全级别 } }) } return MapperMul...
AST#method_declaration#Left static getInstance2DB AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left MapperMultiple...
static getInstance2DB() { if (!MapperMultiple.mapper2) { MapperMultiple.mapper2 = BaseMapper.build<Employee>({ class: Employee, config: { name: 'RdbTest2.db', securityLevel: relationalStore.SecurityLevel.S3, } }) } return MapperMultiple.mapper2 }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/entry/src/main/ets/rdb/MapperMultiple.ets#L27-L38
ae9441c82ee2a46338df03dd04950b6952a12482
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
entry/src/main/ets/pages/SingleImage.ets
arkts
custom
自定义下载方法
@Concurrent async function custom(context: Context, src: string | PixelMap | Resource,headers?: Record<string,Object>): Promise<ArrayBuffer | undefined> { let refer = headers!['refer'] as string console.info('ImageKnife:: custom download:' + src,'refer:'+refer) // 举例写死从本地文件读取,也可以自己请求网络图片 let buffer = context.r...
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function custom AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left src : ...
@Concurrent async function custom(context: Context, src: string | PixelMap | Resource,headers?: Record<string,Object>): Promise<ArrayBuffer | undefined> { let refer = headers!['refer'] as string console.info('ImageKnife:: custom download:' + src,'refer:'+refer) let buffer = context.resourceManager.getMediaCon...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/entry/src/main/ets/pages/SingleImage.ets#L141-L148
bfe0e9f49ac1d62970e078ccc41fd9c409a56798
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
Control style of operation element @enum { TreeListenType } @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Control style of operation element @enum { TreeListenType } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare enum TreeListenType { /** * register listener after a node is clicked. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * register listener after a node is clicked. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum TreeListenType AST#enum_body#Left { /** * register listener after a node is clicked. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * register listener after a node is clicke...
export declare enum TreeListenType { NODE_CLICK = "NodeClick", NODE_ADD = "NodeAdd", NODE_DELETE = "NodeDelete", NODE_MODIFY = "NodeModify", NODE_MOVE = "NodeMove", }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L40-L101
2fac2934061323753c2e358c1403e129e15994b1
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/login_register/login.ets
arkts
loginCompoent
*******************************登录*******************************//
@Builder loginCompoent(){ TextInput({ placeholder: "请输入手机号", text: $$this.phoneNumber }) .type(InputType.Number) .backgroundColor('#FFFFFF') .width('80%') .padding(15) .borderRadius(15) .margin({bottom:10}) TextInput({ placeholder: "请输入密码", text: $$this.password }) ....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right loginCompoent 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 TextInput ( AST#component_parameters#Left { AST#component_pa...
@Builder loginCompoent(){ TextInput({ placeholder: "请输入手机号", text: $$this.phoneNumber }) .type(InputType.Number) .backgroundColor('#FFFFFF') .width('80%') .padding(15) .borderRadius(15) .margin({bottom:10}) TextInput({ placeholder: "请输入密码", text: $$this.password }) ....
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/login_register/login.ets#L34-L85
5bb356a49f5e49ffb32fc3f846285347aee18372
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The entry ability tag. */ static readonly TAG_ABILITY: string = 'EntryAbility'; /** * The entry details ability tag. */ static readonly TAG_DETAILS: string = 'EntryDetailsAbility'; /** * The movie details page tag. */ static readonly TAG_DETAILS...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The entry ability tag. */ AST#property_declaration#Left static readonly TAG_ABILITY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST...
export default class CommonConstants { static readonly TAG_ABILITY: string = 'EntryAbility'; static readonly TAG_DETAILS: string = 'EntryDetailsAbility'; static readonly TAG_DETAILS_PAGE: string = 'MovieDetailsPage'; static readonly TAG_FORM_ABILITY: string = 'EntryFormAbility'; static readonly...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/common/constants/CommonConstants.ets#L21-L101
18115c37a3b048df40e3ad2d1098ba75a88830d4
gitee
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/models/FileData.ets
arkts
文件数据类
export interface FileData { /** * 文件全名称 */ fileFullName: string /** * 文件后缀 */ fileSuffix: string /** * 文件名称 */ fileName: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface FileData AST#object_type#Left { /** * 文件全名称 */ AST#type_member#Left fileFullName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /** * 文件后缀 */ AST#type_m...
export interface FileData { fileFullName: string fileSuffix: string fileName: string }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/models/FileData.ets#L4-L18
504dfb6c1d221b75909c2cb833a216d5926ecbbe
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/utils/KeyBoardManager.d.ets
arkts
@keepTs @ts-nocheck AUTHOR:AbnerMing DATE:2024/10/18 INTRODUCE:键盘管理器
export declare class KeyBoardManager { private static keyBoardManager; private mComponentContentArray; private constructor(); static getInstance(): KeyBoardManager; openLicensePlate(): void; private openDialog; hideDialog(): void; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class KeyBoardManager AST#class_body#Left { AST#property_declaration#Left private static keyBoardManager ; AST#property_declaration#Right AST#property_declaration#Left private mComponentContentArray ; AST#property_decla...
export declare class KeyBoardManager { private static keyBoardManager; private mComponentContentArray; private constructor(); static getInstance(): KeyBoardManager; openLicensePlate(): void; private openDialog; hideDialog(): void; }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/utils/KeyBoardManager.d.ets#L8-L16
8a005a792f4610ec1e7528ae0fc612d88d01e1f4
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/pages/MusicFavoriteListPage.ets
arkts
useMusicListByFavoriteId
@description: 根据收藏夹id查询音乐列表 @date: 2024-07-16 23:39 @author wuwenqiang
useMusicListByFavoriteId(){ getMusicListByFavoriteIdService(this.favoriteDirectory.id,this.pageNum,this.pageSize).then((res) => { this.musicList.push(...res.data); this.total = res.total; }) }
AST#method_declaration#Left useMusicListByFavoriteId 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 getMusicListByFavoriteIdService ( AST#expression#Left AST#member_expression#Left AST#expression#Le...
useMusicListByFavoriteId(){ getMusicListByFavoriteIdService(this.favoriteDirectory.id,this.pageNum,this.pageSize).then((res) => { this.musicList.push(...res.data); this.total = res.total; }) }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/pages/MusicFavoriteListPage.ets#L50-L55
4a942bd77a31a41f52e73d0d99ff2734e32be156
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/BarChartRenderer.ets
arkts
drawData
@Override
public drawData(c: CanvasRenderingContext2D): void { if (!this.mChart) { return } let barData: BarData | null = this.mChart.getBarData(); if (barData) { for (let i = 0; i < barData.getDataSetCount(); i++) { let set: IBarDataSet | null = barData.getDataSetByIndex(i); if (set...
AST#method_declaration#Left public drawData AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D 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#p...
public drawData(c: CanvasRenderingContext2D): void { if (!this.mChart) { return } let barData: BarData | null = this.mChart.getBarData(); if (barData) { for (let i = 0; i < barData.getDataSetCount(); i++) { let set: IBarDataSet | null = barData.getDataSetByIndex(i); if (set...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BarChartRenderer.ets#L92-L107
8a786433d0d1d5bd416ba98ce199c229d4761c40
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width(24) .height(24) .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back(); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets#L65-L137
70c2fdb3ddc0c43b25adecf3b8d5135a3d5c4c05
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.SwipeRefresher.d.ets
arkts
SwipeRefresher
@file @kit ArkUI Declare component SwipeRefresher @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare component SwipeRefresher @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
@Component export declare struct SwipeRefresher { /** * Sets the content when loading. * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the content when loading. * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SwipeRefresher AST#component_body#Left { /** * Sets the content when loading. * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 ...
@Component export declare struct SwipeRefresher { @Prop content?: string; @Prop isLoading: boolean; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SwipeRefresher.d.ets#L30-L62
4e970cff76427f87d7d11517a8b967b0140e5be5
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/GlobalContext.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, softw...
export class GlobalContext { private constructor() { } private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.insta...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat...
export class GlobalContext { private constructor() { } private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.insta...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/GlobalContext.ets#L16-L37
6c8db075f9d3b91cd78ceca150eee84e76ec33b8
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets
arkts
readFile
读取路径path的文件 @param path 文件绝对路径
static readFile(path: string): ArrayBuffer { let fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd; let size = fs.statSync(path).size; let buf = new ArrayBuffer(size); fs.readSync(fd, buf); return buf; }
AST#method_declaration#Left static readFile AST#parameter_list#Left ( AST#parameter#Left path : 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 ArrayBuffer AST#primary_t...
static readFile(path: string): ArrayBuffer { let fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd; let size = fs.statSync(path).size; let buf = new ArrayBuffer(size); fs.readSync(fd, buf); return buf; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets#L92-L98
4e2575d0fa2fbf592111256e32a0bc488a6e95df
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Log.ets
arkts
Basic log class
export default class Log { /** * print info level log * * @param {string} tag - Page or class tag * @param {string} log - Log needs to be printed */ static showInfo(tag, log) { console.info(`${TAG} tag: ${tag} --> ${log}`); } /** * print debug level log * ...
AST#export_declaration#Left export default AST#class_declaration#Left class Log AST#class_body#Left { /** * print info level log * * @param {string} tag - Page or class tag * @param {string} log - Log needs to be printed */ AST#method_declaration#Left static showInfo AST#parameter_list#Left ( A...
export default class Log { static showInfo(tag, log) { console.info(`${TAG} tag: ${tag} --> ${log}`); } static showDebug(tag, log) { console.debug(`${TAG} tag: ${tag} --> ${log}`); } static showError(tag, log) { console.error(`${TAG} tag: ${tag} --> ${log}`)...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Log.ets#L22-L53
d38804d0dc47a3852f22a2e6585e73388e0c14fb
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/ui/animation/AnimationUtils.ets
arkts
页面转场动画配置
export interface PageTransitionConfig { duration: number; curve: any; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PageTransitionConfig AST#object_type#Left { AST#type_member#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left curve : AST#type_ann...
export interface PageTransitionConfig { duration: number; curve: any; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L73-L76
0405aa6c8af634e8a00178c78c521671b2325dd4
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/components/SwipeCardStack.ets
arkts
getVisibleCards
获取可见卡片列表
private getVisibleCards(): InternalCardInfo[] { const visibleCards: InternalCardInfo[] = []; const maxVisible: number = Math.min(this.finalConfig.maxVisibleCards, this.cardDataList.length); for (let i = 0; i < maxVisible; i++) { const dataIndex: number = this.currentIndex + i; if (dataIndex < t...
AST#method_declaration#Left private getVisibleCards AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left InternalCardInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#varia...
private getVisibleCards(): InternalCardInfo[] { const visibleCards: InternalCardInfo[] = []; const maxVisible: number = Math.min(this.finalConfig.maxVisibleCards, this.cardDataList.length); for (let i = 0; i < maxVisible; i++) { const dataIndex: number = this.currentIndex + i; if (dataIndex < t...
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L213-L230
1c3bd599da112edf563f0f26b982eee40b1ca711
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Native/DecodeHEIFImage/decodeheifimage/src/main/ets/model/WaterFlowData.ets
arkts
HEIF图片资源链接
export const heifUrls: string[] = [ getContext(this) .resourceManager .getStringSync($r('app.string.decode_heif_image_url1')), getContext(this) .resourceManager .getStringSync($r('app.string.decode_heif_image_url2')), getContext(this) .resourceManager .getStringSync($r('app.string.decode_h...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left heifUrls : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression...
export const heifUrls: string[] = [ getContext(this) .resourceManager .getStringSync($r('app.string.decode_heif_image_url1')), getContext(this) .resourceManager .getStringSync($r('app.string.decode_heif_image_url2')), getContext(this) .resourceManager .getStringSync($r('app.string.decode_h...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Native/DecodeHEIFImage/decodeheifimage/src/main/ets/model/WaterFlowData.ets#L36-L55
ba3d271a3efaf0e39bd83993e400d51d06a5f900
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
verifySegmentSync
对数据进行分段验签,同步 @param data 待验签数据 @param signDataBlob 签名数据 @param pubKey 公钥 @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。 @param len 自定义的数据拆分长度,此处取128 @returns
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3', len: number = 128): boolean { return CryptoUtil.verifySegmentSync(data, signDataBlob, pubKey, algName, len); }
AST#method_declaration#Left static verifySegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#q...
static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3', len: number = 128): boolean { return CryptoUtil.verifySegmentSync(data, signDataBlob, pubKey, algName, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L305-L308
f3206c61d36d68624d6216b8721f576050cf2779
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets
arkts
MessageView
功能描述: 本示例介绍如何在应用中调起系统短信,通过startAbility接口中的指定号码并调起系统的发送短信页面 推荐场景: 发送短信 核心组件: 1. MessageView.content 实现步骤: 1、本案例通过startAbility接口中的指定号码并调起系统的发送短信页面。 2、点击页面"快捷发送短信"按钮时,通过指定的abilityName和bundleName拉起短信服务,并通过页面传入的want参数中填入短信内容与短信接收人的号码。 3、从而实现在应用内实现跳转到短信编辑的功能,并且携带编辑内容和收件人号码。
@Component export struct MessageView { // 短信内容 @State msg: string = '2618'; // 短信接收人的号码 @State number: string = '103981630163222'; /** * 弹窗函数 */ showToast() { promptAction.showToast({ message: $r('app.string.send_message_toast') }) } build() { Column() { // 标题 this....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MessageView AST#component_body#Left { // 短信内容 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_an...
@Component export struct MessageView { @State msg: string = '2618'; @State number: string = '103981630163222'; showToast() { promptAction.showToast({ message: $r('app.string.send_message_toast') }) } build() { Column() { this.title() this.content() } ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets#L34-L84
45578dd11e045b1a092fe9d7c30239cda8864dc1
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/dataList/buttonList.ets
arkts
@author 2008 @datetime 2024/5/23 22:26 @className: buttonList
export class buttonList { id:number title:string icon:Resource constructor
AST#export_declaration#Left export AST#ERROR#Left class buttonList { id : number title : string icon : Resource AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class buttonList { id:number title:string icon:Resource constructor
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/dataList/buttonList.ets#L6-L10
6d87bc862d3f1bf98d498acc9656d0e62e76de63
github
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/easy_demo/abilityAccessCtrl/abilityAccessCtrl_api10/entry/src/main/ets/entryability/EntryAbility.ets
arkts
getPermission
程序访问控制管理 https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md/
getPermission(): void { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); try { atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA',"ohos.permission.WRITE_MEDIA"]).then((data: PermissionRequestResult) => { console.info("requestPermissionsFro...
AST#method_declaration#Left getPermission 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#variable_declaration#Left let AST#variable_declarator#Left atManager : A...
getPermission(): void { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); try { atManager.requestPermissionsFromUser(this.context, ['ohos.permission.CAMERA',"ohos.permission.WRITE_MEDIA"]).then((data: PermissionRequestResult) => { console.info("requestPermissionsFro...
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/abilityAccessCtrl/abilityAccessCtrl_api10/entry/src/main/ets/entryability/EntryAbility.ets#L56-L69
143da7c86b5aaf9c46dd5cb8895d1bfbf69e7cc3
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/LinkView.ets
arkts
/ 参数类型
export interface Param { title: ResourceStr url: string }
AST#export_declaration#Left export AST#interface_declaration#Left interface Param AST#object_type#Left { AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left url : AST#type_annotation#Left AST#...
export interface Param { title: ResourceStr url: string }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/LinkView.ets#L39-L42
129da2a9301cd5bb87283b4f7790fa5028422b81
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/efLoading.ets
arkts
loadingTxt
@Author csx @DateTime 2024/5/24 21:05 @TODO Loading
@Extend(Text) function loadingTxt(fontSize: string | number) { .fontSize(fontSize) .fontColor("#fff") }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function loadingTxt AST#parameter_list#Left ( AST#parameter#Left fontSize : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#pri...
@Extend(Text) function loadingTxt(fontSize: string | number) { .fontSize(fontSize) .fontColor("#fff") }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/efLoading.ets#L25-L29
b407bf95139b21491b79f898fb578a605ff4c02a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/RSA.ets
arkts
sign
对数据进行签名,异步 @param dataBlob 待签名数据 @param priKey 私钥 @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、等)。 @returns
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256'): Promise<cryptoFramework.DataBlob> { return CryptoUtil.sign(dataBlob,priKey,algName) }
AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKe...
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256'): Promise<cryptoFramework.DataBlob> { return CryptoUtil.sign(dataBlob,priKey,algName) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L238-L240
558f0d8497819aa293a13a887401dbc02c0607f7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets
arkts
updateCriticalAsset
[Start update_critical_asset]
async function updateCriticalAsset(): Promise<string> { let result: string = ''; let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); let attrsToUpdate: asset.AssetMap = new Map(); attrsToUpdate.set(asset.Tag.SECRET, stringToArray('demo_pwd_new')); attrsToUpdate.se...
AST#function_declaration#Left async function updateCriticalAsset 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 string AST#primary_type#Right AST#type_annotation#...
async function updateCriticalAsset(): Promise<string> { let result: string = ''; let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); let attrsToUpdate: asset.AssetMap = new Map(); attrsToUpdate.set(asset.Tag.SECRET, stringToArray('demo_pwd_new')); attrsToUpdate.se...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets#L227-L248
44982af1e74c7a93f541b1c839beab20ac0a5e1c
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/GlobalThemeState.ets
arkts
removeThemeChangeListener
移除主题变化监听器
removeThemeChangeListener(listener: (version: number) => void): void { const index = this.listeners.indexOf(listener); if (index > -1) { this.listeners.splice(index, 1); } }
AST#method_declaration#Left removeThemeChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left version : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#...
removeThemeChangeListener(listener: (version: number) => void): void { const index = this.listeners.indexOf(listener); if (index > -1) { this.listeners.splice(index, 1); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/GlobalThemeState.ets#L32-L37
a0e92489f07d0d35ae56bd32fffcb97cbde4f000
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isUint8Array
检查是否为Uint8Array数组类型。 @param value @returns
static isUint8Array(value: Object): boolean { return new util.types().isUint8Array(value); }
AST#method_declaration#Left static isUint8Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object 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_...
static isUint8Array(value: Object): boolean { return new util.types().isUint8Array(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L173-L175
0bf681f7805352d03752be0e16d458371ff9fd57
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
showBirthdayDialog
显示生日弹窗
private showBirthdayDialog(contacts: Contact[]): void { try { if (!this.settings.dialogEnabled) { return; } const names = contacts.map(c => c.name).join('、'); const message = `今天是${names}的生日!\n\n记得送上温馨的祝福哦 🎂`; promptAction.showDialog({ title: '🎉 生日提醒', messa...
AST#method_declaration#Left private showBirthdayDialog AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an...
private showBirthdayDialog(contacts: Contact[]): void { try { if (!this.settings.dialogEnabled) { return; } const names = contacts.map(c => c.name).join('、'); const message = `今天是${names}的生日!\n\n记得送上温馨的祝福哦 🎂`; promptAction.showDialog({ title: '🎉 生日提醒', messa...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L475-L503
56df1c763e64ae29551974cfd6eef9536db7be7c
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/ImageKnifeDispatcher.ets
arkts
requestJob
通过taskpool 二级缓存,下载/读取本地文件,编解码 @param context @param src @returns
@Concurrent async function requestJob(request: RequestJobRequest, requestList?: List<ImageKnifeRequestWithSource>) { LogUtil.log('requestJob.start:' + request.componentId + ',srcType:' + request.requestSource + ',' + request.componentVersion) let src = typeof request.src == 'number' ? request.resName != undefined ?...
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function requestJob AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left RequestJobRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramet...
@Concurrent async function requestJob(request: RequestJobRequest, requestList?: List<ImageKnifeRequestWithSource>) { LogUtil.log('requestJob.start:' + request.componentId + ',srcType:' + request.requestSource + ',' + request.componentVersion) let src = typeof request.src == 'number' ? request.resName != undefined ?...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnifeDispatcher.ets#L573-L583
71949eead97aca67c28f7a497a7768b81805fc6f
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/PublishReminderInfo.ets
arkts
Publish reminder info
export default class PublishReminderInfo { hour: number = 0; minute: number = 0; daysOfWeek: Array<number> = []; title: string = ''; content: string = ''; notificationId: number = 0; }
AST#export_declaration#Left export default AST#class_declaration#Left class PublishReminderInfo AST#class_body#Left { AST#property_declaration#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_de...
export default class PublishReminderInfo { hour: number = 0; minute: number = 0; daysOfWeek: Array<number> = []; title: string = ''; content: string = ''; notificationId: number = 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/PublishReminderInfo.ets#L19-L27
4e3d6adb6cfcbfe0345fcb4a42aee26dfe594244
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
stopVideo
停止录制
async stopVideo(): Promise<void> { Logger.info(TAG, 'stopVideo is called'); if (!this.isRecording) { Logger.info(TAG, 'not in recording'); return; } try { if (this.avRecorder) { await this.avRecorder.stop(); } if (this.videoOutput) { await this.videoOutput.s...
AST#method_declaration#Left async stopVideo 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_argume...
async stopVideo(): Promise<void> { Logger.info(TAG, 'stopVideo is called'); if (!this.isRecording) { Logger.info(TAG, 'not in recording'); return; } try { if (this.avRecorder) { await this.avRecorder.stop(); } if (this.videoOutput) { await this.videoOutput.s...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L766-L785
6a2ad12861b1d4dc95caafe54510820b8ac936cf
gitee
fourseas1998/hos.ArkTSComponents.git
5f0dbd0038f17067722cb035c88fe826e4846e69
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getFirstGridData
获取第1个表格的数据资源
getFirstGridData(): Array<ItemData>{ let firstGridData: ItemData[] = [ new ItemData($r('app.string.my_love'), $r('app.media.love')), new ItemData($r('app.string.history_record'), $r('app.media.record')), new ItemData($r('app.string.message'), $r('app.media.message')), new ItemData($r('app.st...
AST#method_declaration#Left getFirstGridData 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 ItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_arg...
getFirstGridData(): Array<ItemData>{ let firstGridData: ItemData[] = [ new ItemData($r('app.string.my_love'), $r('app.media.love')), new ItemData($r('app.string.history_record'), $r('app.media.record')), new ItemData($r('app.string.message'), $r('app.media.message')), new ItemData($r('app.st...
https://github.com/fourseas1998/hos.ArkTSComponents.git/blob/5f0dbd0038f17067722cb035c88fe826e4846e69/entry/src/main/ets/viewmodel/MainViewModel.ets#L21-L33
0e4390f69cd958ad5a5e819592143dabd2227551
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bigfilecopy/src/main/ets/view/BigFileCopyView.ets
arkts
BigFileCopyViewComponent
功能描述:文件拷贝是应用开发中的一个常见场景,本例将展示如何使用buffer来将大文件的rawfile复制到应用沙箱。 推荐场景:需要数据备份的软件,如网盘,文件管理器等 核心组件: 1.BigFileCopyViewComponent 实现步骤: 1. 根据rawfile获得其所在hap包的RawFileDescriptor 2. 根据RawFileDescriptor中的fd、偏移、文件长度,使用buffer进行内容读取 3. 调用图库的预览器对复制的文件进行预览,以验证复制过程的正确性
@Component export struct BigFileCopyViewComponent { @State progress: number = BigFileCopyConstants.PROGRESS_MIN; context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; fileName: string = BigFileCopyConstants.TEST_FILE_NAME; targetFilePath: string = ""; @State isCopyFinished: boolean =...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BigFileCopyViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right progress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
@Component export struct BigFileCopyViewComponent { @State progress: number = BigFileCopyConstants.PROGRESS_MIN; context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; fileName: string = BigFileCopyConstants.TEST_FILE_NAME; targetFilePath: string = ""; @State isCopyFinished: boolean =...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bigfilecopy/src/main/ets/view/BigFileCopyView.ets#L43-L134
69937108915f9b0fa3ea03b55af861bc92856e96
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/viewModel/RegionItem.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, softw...
export class RegionItem { /** * width coordinate. */ x: number; /** * height coordinate. */ y: number; constructor(x: number, y: number) { this.x = x; this.y = y; } }
AST#export_declaration#Left export AST#class_declaration#Left class RegionItem AST#class_body#Left { /** * width coordinate. */ AST#property_declaration#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * height ...
export class RegionItem { x: number; y: number; constructor(x: number, y: number) { this.x = x; this.y = y; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/viewModel/RegionItem.ets#L16-L31
89adda8e93d9ad40c8faa25fc3a1cd5eb09ad80d
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
Fits tools with different sizes and lengths.
export default class DimensionUtil { /** * Obtains the screen horizontal adaptation value. * * @return number */ static adaptDimension(value: number): number { let deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display; let widthScale = deviceDisplay....
AST#export_declaration#Left export default AST#class_declaration#Left class DimensionUtil AST#class_body#Left { /** * Obtains the screen horizontal adaptation value. * * @return number */ AST#method_declaration#Left static adaptDimension AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotati...
export default class DimensionUtil { static adaptDimension(value: number): number { let deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let desig...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/utils/DimensionUtil.ets#L35-L79
887a949e94d5f754fdd998cdc05109ac4317d0bf
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
register
订阅指定网络状态变化的通知,支持多事件监听回调。 @param netAvailableCallback 订阅网络可用事件回调。 @param netUnavailableCallback 订阅网络不可用事件回调。 @param netCapabilitiesChangeCallback 订阅网络能力变化事件回调。比如切换Wi-Fi、切换VPN、切换为手机流量。 @param netConnectionPropertiesChangeCallback 订阅网络连接信息变化事件回调。比如更改Wi-Fi、切换Wi-Fi、切换蜂窝网络。 @param netBlockStatusChangeCallback 订阅网络阻塞状态事件...
static register(netAvailableCallback?: Callback<connection.NetHandle>, netUnavailableCallback?: Callback<void>, netCapabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>, netConnectionPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>, netBlockStatusChangeCallback?: C...
AST#method_declaration#Left static register AST#parameter_list#Left ( AST#parameter#Left netAvailableCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qual...
static register(netAvailableCallback?: Callback<connection.NetHandle>, netUnavailableCallback?: Callback<void>, netCapabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>, netConnectionPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>, netBlockStatusChangeCallback?: C...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L246-L287
8ef689c877981f638bbd57d991f8b6ba061cac25
gitee
851432669/Smart-Home-ArkTs-Hi3861.git
0451f85f072ed3281cc23d9cdc2843d79f60f975
entry/src/main/ets/common/utils/GlobalDataManager.ets
arkts
updateDevicesForScene
批量更新设备状态 - 用于场景模式
updateDevicesForScene(scene: string): void { if (scene === 'leaveHome') { // 离家模式:关闭所有设备,只开启扫地机 this.setDeviceStatus('ac', false); // 关闭空调 this.setDeviceStatus('livingRoomLight', false); // 关闭客厅灯 this.setDeviceStatus('tv', false); // 关闭电视 this.setDeviceStatus('curtain',...
AST#method_declaration#Left updateDevicesForScene AST#parameter_list#Left ( AST#parameter#Left scene : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t...
updateDevicesForScene(scene: string): void { if (scene === 'leaveHome') { this.setDeviceStatus('ac', false); this.setDeviceStatus('livingRoomLight', false); this.setDeviceStatus('tv', false); this.setDeviceStatus('curtain', false); this.setDeviceStatus('au...
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L203-L225
07578381ab84380a8c7748b9f260f1d7f7738f32
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/OneWayTlsWorker.ets
arkts
handleMessage
统一处理主线程任务
function handleMessage(message: TlsOneWayMessage) { switch (message.type) { case 'loadCA': if (message.fileUri) { loadCA(message.fileUri); } break; case 'connectServer': if (message.serverIp && message.serverPort && message.ca) { connectToServer(message.serverIp, messa...
AST#function_declaration#Left function handleMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left TlsOneWayMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#ex...
function handleMessage(message: TlsOneWayMessage) { switch (message.type) { case 'loadCA': if (message.fileUri) { loadCA(message.fileUri); } break; case 'connectServer': if (message.serverIp && message.serverPort && message.ca) { connectToServer(message.serverIp, messa...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/OneWayTlsWorker.ets#L58-L77
af1e42684b67c11811abeb96470b7bc348f3fcbe
gitee
makoki13/bikepacking_planner_ArkTS.git
de0c1c96961fa42ed2031d20dca0dfa64b731f74
entry/src/main/ets/components/VisorListaProyectos.ets
arkts
aboutToAppear
Cargar primera página
aboutToAppear(): void { this.cargarDatos(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.cargarDatos(); }
https://github.com/makoki13/bikepacking_planner_ArkTS.git/blob/de0c1c96961fa42ed2031d20dca0dfa64b731f74/entry/src/main/ets/components/VisorListaProyectos.ets#L16-L18
d2002a544bc26f372f5cd6904b299d4b47937af2
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gerenxinxixiugai.ets
arkts
loadUserInfo
从preferences读取用户名(复用“我的”页面逻辑)
async loadUserInfo() { try { const context = getContext(this); // 获取上下文 this.storage = await preferences.getPreferences(context, 'userInfo'); // 打开存储实例 const username = await this.storage.get('currentUser', '未登录'); // 读取键为currentUser的值 this.account = username as string; // 赋值给状态变量 cons...
AST#method_declaration#Left async loadUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#ca...
async loadUserInfo() { try { const context = getContext(this); this.storage = await preferences.getPreferences(context, 'userInfo'); const username = await this.storage.get('currentUser', '未登录'); this.account = username as string; console.info('设置页面读取用户名成功:', this.account); } c...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gerenxinxixiugai.ets#L25-L36
8e1c50f192e26543f9fcaa9b23bbb2dd0d826368
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/StrUtils.ets
arkts
toStr
格式化字符串 @param source @param defaultValue @returns
static toStr(source: string | null | undefined, defaultValue = ""): string { if (source === null || source === undefined) { return defaultValue; } return String(source); }
AST#method_declaration#Left static toStr AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Righ...
static toStr(source: string | null | undefined, defaultValue = ""): string { if (source === null || source === undefined) { return defaultValue; } return String(source); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/StrUtils.ets#L51-L56
1ef7dc987a461f0bd457eb5880793e46d9bd4ac8
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/login/LoginView.ets
arkts
loginBySns
sns登录方法
private loginBySns(type: LoginType): void { if (!this.checkAggree()) return; UserManager.shared.loginBySns(type, undefined, (succeed: boolean, msg:string |null)=>{ this.handleLoginCompletion(succeed, msg); }) }
AST#method_declaration#Left private loginBySns AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left LoginType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
private loginBySns(type: LoginType): void { if (!this.checkAggree()) return; UserManager.shared.loginBySns(type, undefined, (succeed: boolean, msg:string |null)=>{ this.handleLoginCompletion(succeed, msg); }) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/LoginView.ets#L314-L321
1a521d9d1baa34bf9e828c2a35ff6920e9fbeb54
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
shouldShowBottomButton
是否显示底部保存按钮 @returns {boolean} 是否显示
shouldShowBottomButton(): boolean { return this.uiState === BaseNetWorkUiState.SUCCESS; }
AST#method_declaration#Left shouldShowBottomButton AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
shouldShowBottomButton(): boolean { return this.uiState === BaseNetWorkUiState.SUCCESS; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L131-L133
8b062944c29e5c6e250744639efe323c19477aa0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringEncrypt.ets
arkts
decodedString
将Base64字符串解码为原始字符串 @returns 解码后的字符串,如果输入无效则返回null
decodedString(): string | null { if (!this.str) { return null; } try { const base64 = new util.Base64Helper(); const decodedData = base64.decodeSync(this.str); // 将Uint8Array转为字符串 return this.uint8ArrayToString(decodedData); } catch (err) { console.error(`Base64解码失败...
AST#method_declaration#Left decodedString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { ...
decodedString(): string | null { if (!this.str) { return null; } try { const base64 = new util.Base64Helper(); const decodedData = base64.decodeSync(this.str); return this.uint8ArrayToString(decodedData); } catch (err) { console.error(`Base64解码失败: ${err}`); r...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L89-L104
624d3c3e8ee4f3ba1399bdc76079691b71f15882
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/util/ImageProcessingUtil.ets
arkts
filterImage
图片加滤镜
static filterImage(item: FilterModel, pixelMap:PixelMap):Promise<PixelMap> { let filter = effectKit.createEffect(pixelMap); filter.blur(item.filterOptions.blur) if (item.filterOptions.grayscale) { filter.grayscale() } if (item.filterOptions.invert) { filter.invert() } filter.setC...
AST#method_declaration#Left static filterImage AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left FilterModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#p...
static filterImage(item: FilterModel, pixelMap:PixelMap):Promise<PixelMap> { let filter = effectKit.createEffect(pixelMap); filter.blur(item.filterOptions.blur) if (item.filterOptions.grayscale) { filter.grayscale() } if (item.filterOptions.invert) { filter.invert() } filter.setC...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/util/ImageProcessingUtil.ets#L7-L22
3d5d09f1f41891ca5dd8bed1b795d0e0076eb6ff
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets
arkts
当前Bucket名称
export const CurrentBucket: string = `${StringEncoder.removedSalt(CosConfig.zkBucket)}-${StringEncoder.removedSalt(CosConfig.appId)}`;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CurrentBucket : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#L...
export const CurrentBucket: string = `${StringEncoder.removedSalt(CosConfig.zkBucket)}-${StringEncoder.removedSalt(CosConfig.appId)}`;
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L18-L18
af2c12f0ecb866315c2baa42b01a2eb12cb1f7ff
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/passwordInput.ets
arkts
clearViewData
--------------------------- updateView ----------------------- Update view data
clearViewData() { AppStorage.SetOrCreate("checkMessage", ''); this.password = ''; this.passwordCircle = ["", "", "", "", "", ""]; this.mController.bindComponent(this).initData(); this.updateView(); }
AST#method_declaration#Left clearViewData 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 AppStorage AST#expression#Right . SetOrCreate AST#...
clearViewData() { AppStorage.SetOrCreate("checkMessage", ''); this.password = ''; this.passwordCircle = ["", "", "", "", "", ""]; this.mController.bindComponent(this).initData(); this.updateView(); }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/passwordInput.ets#L323-L329
98b8d7b0387869a9894a7d35b9e47354fd2cff3f
gitee
linwu-hi/open_neteasy_cloud.git
b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4
entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
getCategoryData
Get category data. @return {Array<Category>} categoryData
getCategoryData(): Array<Category> { let categoryData: Array<Category> = []; for (let i = 0; i < CommonConstants.CATEGORY_CONTENT_LIST_SIZE; i++) { let categoryItem = new Category(); categoryItem.title = $r('app.string.sub_title'); categoryItem.categoryContent = this.getListData(i + CommonCons...
AST#method_declaration#Left getCategoryData 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 Category AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
getCategoryData(): Array<Category> { let categoryData: Array<Category> = []; for (let i = 0; i < CommonConstants.CATEGORY_CONTENT_LIST_SIZE; i++) { let categoryItem = new Category(); categoryItem.title = $r('app.string.sub_title'); categoryItem.categoryContent = this.getListData(i + CommonCons...
https://github.com/linwu-hi/open_neteasy_cloud.git/blob/b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4/entry/src/main/ets/viewmodel/PageViewModel.ets#L14-L23
ceb660f93e3d3c17258fe8faa2e6296072fd0c13
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/onlinesearch/OnlineWord.ets
arkts
MARK: - OnlineWord 数据模型
export class OnlineWord { titleEn : string | null = null pronEn : string | null = null pronUs : string | null = null titleCn1 : string | null = null titleCn2 : string | null = null titleCn3 : string | null = null wordChange : string | null = null synWords : str...
AST#export_declaration#Left export AST#ERROR#Left class OnlineWord { titleEn AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null...
export class OnlineWord { titleEn : string | null = null pronEn : string | null = null pronUs : string | null = null titleCn1 : string | null = null titleCn2 : string | null = null titleCn3 : string | null = null wordChange : string | null = null synWords : str...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/onlinesearch/OnlineWord.ets#L56-L76
edd566acbf5af0935092ec5e1320a19a83eb77b2
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ActionSheetBuilderProxy.ets
arkts
title
弹窗标题 @param title @returns
title(title: ResourceStr) { this.builderOptions.title = title return this }
AST#method_declaration#Left title AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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#Left AS...
title(title: ResourceStr) { this.builderOptions.title = title return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ActionSheetBuilderProxy.ets#L23-L26
8fbaf72b7396750d8d384ba71b103a7330989eee
github
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/ui/layout/ArticleItemLayout.ets
arkts
articleItemLayout
文章 UI
@Builder private articleItemLayout() { Column() { //作者和TAG、时间 Row() { Text(this.getAuthorName()) .fontSize(12) .fontColor(this.theme.TEXT_COLOR) this.tagComponent() Blank() Text(this.article.niceShareDate) .fontSize(12) .margin(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private articleItemLayout 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#ui_component#Right AST#ERROR#Left...
@Builder private articleItemLayout() { Column() { Row() { Text(this.getAuthorName()) .fontSize(12) .fontColor(this.theme.TEXT_COLOR) this.tagComponent() Blank() Text(this.article.niceShareDate) .fontSize(12) .margin({ ...
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/ui/layout/ArticleItemLayout.ets#L41-L72
bb77fd97f750face15951d8de0608be1b989f132
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
downloadRtsp
============================================================ 网络流媒体 ============================================================ RTSP 流录制
public static downloadRtsp(rtspUrl: string, output: string, duration?: number): string[] { const cmd: string[] = ['ffmpeg', '-rtsp_transport', 'tcp', '-i', rtspUrl, '-c:v', 'copy', '-c:a', 'aac']; if (duration !== undefined) { cmd.push('-t', duration.toString()); } cmd.push('-tag:v', 'hvc1', '-f',...
AST#method_declaration#Left public static downloadRtsp AST#parameter_list#Left ( AST#parameter#Left rtspUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST...
public static downloadRtsp(rtspUrl: string, output: string, duration?: number): string[] { const cmd: string[] = ['ffmpeg', '-rtsp_transport', 'tcp', '-i', rtspUrl, '-c:v', 'copy', '-c:a', 'aac']; if (duration !== undefined) { cmd.push('-t', duration.toString()); } cmd.push('-tag:v', 'hvc1', '-f',...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L202-L209
0af890fad03331cf79ea3d233351a4f33e296f98
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Learn.ets
arkts
hashCode
MARK: - Hashable
hashCode(): number { let str = `planId_${this.planId ?? 0}` + `bookId_${this.bookId ?? 0}` + `num_${this.num ?? 0}` + `distance_${this.distance ?? 0}` + `pieceNo_${this.pieceNo ?? 0}` + `wordId_${this.wordId ?? 0}`; let hash = 0; for (let i =...
AST#method_declaration#Left hashCode 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#variable_declaration#Left let AST#variable_declarator#Left str = AST#expres...
hashCode(): number { let str = `planId_${this.planId ?? 0}` + `bookId_${this.bookId ?? 0}` + `num_${this.num ?? 0}` + `distance_${this.distance ?? 0}` + `pieceNo_${this.pieceNo ?? 0}` + `wordId_${this.wordId ?? 0}`; let hash = 0; for (let i =...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Learn.ets#L62-L76
593baebea0b396ff4efd03ca06a07e0b04dbfaa0
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tls/TlsDemo/entry/src/main/ets/pages/Index.ets
arkts
bind2LocalAddress
绑定本地地址
async bind2LocalAddress() { //本地地址 let localAddress = { address: "0.0.0.0", family: 1 } await tlsSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; }) .catch((e) => { this.msgHistory = 'bind fail ' + e.message + "\r\n"; }) //收到消息时...
AST#method_declaration#Left async bind2LocalAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localAddress = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#prope...
async bind2LocalAddress() { let localAddress = { address: "0.0.0.0", family: 1 } await tlsSocket.bind(localAddress) .then(() => { this.msgHistory = 'bind success' + "\r\n"; }) .catch((e) => { this.msgHistory = 'bind fail ' + e.message + "\r\n"; }) tlsSocke...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/TlsDemo/entry/src/main/ets/pages/Index.ets#L191-L212
28eb92bd484b480b15a0a88813c0a2bc57f2b463
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/sync/CloudStorageProvider.ets
arkts
云存储提供者抽象接口
export abstract class CloudStorageProvider { protected config: CloudStorageConfig; constructor(config: CloudStorageConfig) { this.config = config; } abstract initialize(): Promise<void>; abstract upload(options: UploadOptions): Promise<string>; abstract download(options: DownloadOptions): Promise<Arra...
AST#export_declaration#Left export AST#class_declaration#Left abstract class CloudStorageProvider AST#class_body#Left { AST#property_declaration#Left protected config : AST#type_annotation#Left AST#primary_type#Left CloudStorageConfig AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST...
export abstract class CloudStorageProvider { protected config: CloudStorageConfig; constructor(config: CloudStorageConfig) { this.config = config; } abstract initialize(): Promise<void>; abstract upload(options: UploadOptions): Promise<string>; abstract download(options: DownloadOptions): Promise<Arra...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/CloudStorageProvider.ets#L17-L31
97a0231933550c47f05c2565f63b40c7a5c16688
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/AccessPermission/entry/src/main/ets/common/util/PermissionUtil.ets
arkts
checkPermission
Obtaining the permission status. @returns Scan Results.
async checkPermission() { let atManager = abilityAccessCtrl.createAtManager(); let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED; let tokenId: number = 0; try { let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSe...
AST#method_declaration#Left async checkPermission AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left atManager = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#...
async checkPermission() { let atManager = abilityAccessCtrl.createAtManager(); let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED; let tokenId: number = 0; try { let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSe...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/AccessPermission/entry/src/main/ets/common/util/PermissionUtil.ets#L48-L66
dd43415246a4b963b36030f76fe32b9113354686
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/pages/ForceShowOnTopLeftPage.ets
arkts
[EndExclude quick_start]
build() { Column({ space: 0 }) { Row() { Text($r('app.string.force_left_show')) .width('100%') .fontSize(24) .fontWeight(FontWeight.Bold) .margin({ top: '18vp', left: '16vp', bottom: '16vp' }) } WaterFlow() { // 1、Add the layout content in t...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right...
build() { Column({ space: 0 }) { Row() { Text($r('app.string.force_left_show')) .width('100%') .fontSize(24) .fontWeight(FontWeight.Bold) .margin({ top: '18vp', left: '16vp', bottom: '16vp' }) } WaterFlow() { FlowItem() { ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/ForceShowOnTopLeftPage.ets#L34-L89
abb95fed7c98f927b86c907c0426e4d31c01e674
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/view/CommentView.ets
arkts
底部系统导航栏高度
build() { Column() { List({ scroller: this.listScroll }) { /* *TODO 性能知识点:列表中数据较多且不确定的情况下,使用LazyForEach进行数据循环渲染。 *当组件滑出可视区域外时,框架会进行组件销毁回收以降低内存占用。 *文档参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V2/arkts-rendering-control-lazyforeach-0000001524417213-V2 ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_pa...
build() { Column() { List({ scroller: this.listScroll }) { LazyForEach(this.commentData, (item: Comment, index) => { ListItem() { CommentView({ comment: item }) .onClick(() => { promptAction.showToast({ message: $r('app.stri...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/CommentView.ets#L63-L87
577447843488ec36446b59676d1e8e7bb13738e7
gitee