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/styledtext/src/main/ets/components/StyledStringComponent.ets
arkts
StyledStringComponent
功能描述: 使用属性字符串灵活设置文本样式,实现多行文本中部分文本高亮和超链接的效果,并允许用户点击超链接或视频链接触发相应的交互行为。 实现原理: 1. 使用 `MyCustomSpan[]` 类型的数组 `spans` 作为数据源,每个 `MyCustomSpan` 对象代表一个文本片段,包含类型(普通文本、超链接、视频链接等)和内容。 2. 遍历 `spans` 数组,为每个 `span` 创建属性字符串对象,然后根据不同的Span类型为属性字符串对象添加相应的样式和手势,如果字符长度超过限制需要在末尾添加“...全文”,创建好的属性字符串放入数组styledStrings保存。 3. 对于超链接和视频链接,属性字符串设置点...
@Component export struct StyledStringComponent { // -------------------对外暴露变量----------------------- maxStringLength: number = 140; // 正文内容最大字符长度,默认值140 spans: MyCustomSpan[] = []; // 自定义span列表数据 defaultFontSize: string | number | Resource = $r('app.string.styled_text_font_size_default'); // 正文内容字体大小 defaultF...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct StyledStringComponent AST#component_body#Left { // -------------------对外暴露变量----------------------- AST#property_declaration#Left maxStringLength : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
@Component export struct StyledStringComponent { maxStringLength: number = 140; spans: MyCustomSpan[] = []; defaultFontSize: string | number | Resource = $r('app.string.styled_text_font_size_default'); defaultFontColor: ResourceColor = Color.Black; textAttribute: TextStyle = new TextStyle({ fontColor: ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/StyledStringComponent.ets#L38-L250
534bf354f8f4da2176e6d0109f40abe75cab2009
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/passwordCheck.ets
arkts
stopCountDown
Stop count down view.
stopCountDown() { // for freezing view if (this.timerId > 0) { clearTimeout(this.freezingTimeFlag); clearInterval(this.timerId); } }
AST#method_declaration#Left stopCountDown AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // for freezing view AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left th...
stopCountDown() { if (this.timerId > 0) { clearTimeout(this.freezingTimeFlag); clearInterval(this.timerId); } }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/passwordCheck.ets#L318-L324
a77867d2bffed40ed0dbc522dfb17ff99880ff0d
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/products/watch/src/main/ets/constants/StyleConstants.ets
arkts
Common constants for all styles.
export class StyleConstants { /** * Component width percentage: 100%. */ static readonly FULL_WIDTH: string = '100%'; /** * Component height percentage: 100%. */ static readonly FULL_HEIGHT: string = '100%'; /** * Circle Border Radius. */ static readonly CIRCLE_BORDER_RADIUS: string = '50%...
AST#export_declaration#Left export AST#class_declaration#Left class StyleConstants AST#class_body#Left { /** * Component width percentage: 100%. */ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AS...
export class StyleConstants { static readonly FULL_WIDTH: string = '100%'; static readonly FULL_HEIGHT: string = '100%'; static readonly CIRCLE_BORDER_RADIUS: string = '50%'; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/products/watch/src/main/ets/constants/StyleConstants.ets#L19-L32
d92352b1a5141847c04fdeb55f9f4d5cc50546cb
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexAxisAlignRadioList.ets
arkts
FlexAxisAlignRadioList
Set Axis Alignment in Flex
@Component export struct FlexAxisAlignRadioList { private flexModuleList: ContainerModuleItem[] = getFlexModuleList(); private groupName: string = this.flexModuleList[2].groupName; private moduleName: Resource = this.flexModuleList[2].moduleName; private radioList: Array<string> = this.flexModuleList[2].attribu...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlexAxisAlignRadioList AST#component_body#Left { AST#property_declaration#Left private flexModuleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContainerModuleItem [ ] AST#array_type#Right A...
@Component export struct FlexAxisAlignRadioList { private flexModuleList: ContainerModuleItem[] = getFlexModuleList(); private groupName: string = this.flexModuleList[2].groupName; private moduleName: Resource = this.flexModuleList[2].moduleName; private radioList: Array<string> = this.flexModuleList[2].attribu...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexAxisAlignRadioList.ets#L23-L55
5522b3c7ed0856cbe2579b301cae92e8f7ea7fc7
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/build/default/generated/profile/default/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const BUNDLE_NAME = 'com.example.yxsport';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'com.example.yxsport' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const BUNDLE_NAME = 'com.example.yxsport';
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/build/default/generated/profile/default/BuildProfile.ets#L4-L4
4828fc2ca7659d53279b701c4bb7e266272859ee
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/components/TextAndSpanComponent.ets
arkts
processCustomSpans
处理自定义span列表数据,确保最终拼接后不超过指定字符长度。如果超过,则截取字符串并在末尾添加“...全文”链接。 @param {MyCustomSpan[]} spans - 包含不同类型文本片段的数组(如普通文本、链接等)。
processCustomSpans(spans: MyCustomSpan[]): void { let charCount = 0; // 遍历拼接customMessage.spans,记录已拼接的字符串长度 let data: MyCustomSpan[] = []; // 用于存储处理后的文本 spans.forEach((span: MyCustomSpan, index: number) => { // 如果当前累积字符数已经达到最大允许长度,则停止处理后续文本片段 if (charCount >= this.maxStringLength) { ret...
AST#method_declaration#Left processCustomSpans AST#parameter_list#Left ( AST#parameter#Left spans : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MyCustomSpan [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati...
processCustomSpans(spans: MyCustomSpan[]): void { let charCount = 0; let data: MyCustomSpan[] = []; spans.forEach((span: MyCustomSpan, index: number) => { if (charCount >= this.maxStringLength) { return; } if (charCount + span.content.length >= this.maxStringLength...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/TextAndSpanComponent.ets#L67-L96
e0bd5c0eb437fa69b23ebfe9ada806a9510395a5
gitee
peng-boy/arkTs.git
68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0
entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Style constants that can be used by all modules
export default class CommonConstants { /** * Full width or height. */ public static readonly FULL_LENGTH: string = '100%'; /** * Title height. */ public static readonly TITLE_WIDTH: string = '80%'; /** * List default width. */ public static readonly LIST_DEFAULT_WIDTH: string = '93.3%'; ...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Full width or height. */ AST#property_declaration#Left public static readonly FULL_LENGTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right...
export default class CommonConstants { public static readonly FULL_LENGTH: string = '100%'; public static readonly TITLE_WIDTH: string = '80%'; public static readonly LIST_DEFAULT_WIDTH: string = '93.3%'; public static readonly OPACITY_DEFAULT: number = 1; public static readonly OPACITY_COM...
https://github.com/peng-boy/arkTs.git/blob/68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L70
3a2cf73a3e299f8d358b75cd29a9c395b9803380
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets
arkts
removeTempAudioFiles
删除所有临时音频文件
static async removeTempAudioFiles(): Promise<void> { const tempDir = AudioTool.getTmpSoundDir(); try { const files = await fs.listFile(tempDir); for (const file of files) { await AudioTool.removeFile(`${tempDir}/${file}`); } await fs.rmdir(tempDir); console.info(`已删除临时目录: $...
AST#method_declaration#Left static async removeTempAudioFiles 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...
static async removeTempAudioFiles(): Promise<void> { const tempDir = AudioTool.getTmpSoundDir(); try { const files = await fs.listFile(tempDir); for (const file of files) { await AudioTool.removeFile(`${tempDir}/${file}`); } await fs.rmdir(tempDir); console.info(`已删除临时目录: $...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/AudioTool.ets#L130-L142
32224bf89b50977bf6e300d88a9fe781e975b49d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/utils/Utils.ets
arkts
getMenus
创建菜单假数据 @returns
static getMenus(): Array<MenuBean> { let menus = new Array<MenuBean>(); menus.push({ index: 0, text: '微信', icon: $r('sys.media.ohos_ic_normal_white_grid_doc') }); menus.push({ index: 1, text: 'QQ', icon: $r('sys.media.ohos_ic_normal_white_grid_xls') }); menus.push({ ...
AST#method_declaration#Left static getMenus 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 MenuBean AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
static getMenus(): Array<MenuBean> { let menus = new Array<MenuBean>(); menus.push({ index: 0, text: '微信', icon: $r('sys.media.ohos_ic_normal_white_grid_doc') }); menus.push({ index: 1, text: 'QQ', icon: $r('sys.media.ohos_ic_normal_white_grid_xls') }); menus.push({ ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/utils/Utils.ets#L53-L117
8c1ef18c00ce47e4ff451d868c043a10135c7a02
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWarmPlayerView.ets
arkts
onCastPlayPosition
投屏播放当前位置。 @param position:number 播放当前进度 ,单位ms
onCastPlayPosition(position: number){ this.currentTime = position; }
AST#method_declaration#Left onCastPlayPosition AST#parameter_list#Left ( AST#parameter#Left position : 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#builder_function_body#Left { AST#expression_statement#Left AST#...
onCastPlayPosition(position: number){ this.currentTime = position; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L262-L264
7b5327dce04bfb8d4bdf248dcd64fc22fafc99a4
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
unregisterPageController
取消注册页面主题控制器
unregisterPageController(pageName: string): void { const controller = this.pageControllers.get(pageName); if (controller) { controller.resetTheme(); this.pageControllers.delete(pageName); } }
AST#method_declaration#Left unregisterPageController AST#parameter_list#Left ( AST#parameter#Left pageName : 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#pri...
unregisterPageController(pageName: string): void { const controller = this.pageControllers.get(pageName); if (controller) { controller.resetTheme(); this.pageControllers.delete(pageName); } }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L232-L238
fc0270794fc6f0bef5b066a628c377241e020bf6
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/ExploreRule.ets
arkts
发现结果规则
export class ExploreRule { bookList?: string name?: string author?: string intro?: string kind?: string lastChapter?: string updateTime?: string bookUrl?: string coverUrl?: string wordCount?: string }
AST#export_declaration#Left export AST#class_declaration#Left class ExploreRule AST#class_body#Left { AST#property_declaration#Left bookList AST#ERROR#Left ? : AST#ERROR#Left string name ? : string author ? : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio...
export class ExploreRule { bookList?: string name?: string author?: string intro?: string kind?: string lastChapter?: string updateTime?: string bookUrl?: string coverUrl?: string wordCount?: string }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/ExploreRule.ets#L4-L15
a86dca1f28c768869556c693bc4a1bb5d215445a
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
pushNavForResult
@deprecated @see {ZRouter.getInstance().push} @param name @param param @param callback
public static pushNavForResult<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>) { ZRouter.getRouterMgr().pushNavForResult<T>(name, param, callback) }
AST#method_declaration#Left public static pushNavForResult AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ...
public static pushNavForResult<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>) { ZRouter.getRouterMgr().pushNavForResult<T>(name, param, callback) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L406-L408
95822b6428d1db4e225c81a13e81096525dea8b4
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets
arkts
encode2048PKCS1Segment
2048位加密-分段 @param encodeStr 待加密的字符串 @param pubKey 2048位RSA公钥
static async encode2048PKCS1Segment(str: string, pubKey: string): Promise<OutDTO<string>> { return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048); }
AST#method_declaration#Left static async encode2048PKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left strin...
static async encode2048PKCS1Segment(str: string, pubKey: string): Promise<OutDTO<string>> { return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L78-L80
deef05658c7d87b8350a08894eb34aaad02db20b
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowWebView.ets
arkts
general_harmonyShare_current_tab
Sharing
async general_harmonyShare_current_tab(sharableTarget: harmonyShare.SharableTarget) { let t0 = Date.now(); let img_buffer = sandbox_read_arrayBuffer_sync('homepage_background_arrayBuffer'); let thumbnail_buffer: ArrayBuffer = new ArrayBuffer(8); // Compress image if (img_buffer) { thumbnail_...
AST#method_declaration#Left async general_harmonyShare_current_tab AST#parameter_list#Left ( AST#parameter#Left sharableTarget : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left harmonyShare . SharableTarget AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri...
async general_harmonyShare_current_tab(sharableTarget: harmonyShare.SharableTarget) { let t0 = Date.now(); let img_buffer = sandbox_read_arrayBuffer_sync('homepage_background_arrayBuffer'); let thumbnail_buffer: ArrayBuffer = new ArrayBuffer(8); if (img_buffer) { thumbnail_buffer = await co...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowWebView.ets#L711-L752
7159ea73af15f679917ed9ebcc064d8d7dc7bb65
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
MemoryDetection/entry/src/main/ets/pages/MemoryLeakDetection.ets
arkts
最佳实践:资源泄漏类问题优化建议 [Start resource_leak_advise1_negative]
export default class test { private timer: number | null = null; // 正确声明类属性 onInit() { this.timer = setInterval(() => { this.updateData(); // 通过this调用类方法 }, 1000); } private updateData() { // 定时任务具体逻辑 } }
AST#export_declaration#Left export default AST#class_declaration#Left class test AST#class_body#Left { AST#property_declaration#Left private timer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right A...
export default class test { private timer: number | null = null; onInit() { this.timer = setInterval(() => { this.updateData(); }, 1000); } private updateData() { } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/MemoryDetection/entry/src/main/ets/pages/MemoryLeakDetection.ets#L43-L55
b8c5ada5a45cfc9f69b2800d8375b7ac5ca3f658
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
getSm4GenerateProperties
生成Sm4密钥属性信息
function getSm4GenerateProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_SM4 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128 ...
AST#function_declaration#Left function getSm4GenerateProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#R...
function getSm4GenerateProperties(properties: HuksProperties[]): void { let index = 0; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_SM4 }; properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128 ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L49-L65
c8bb51365c086e041615b6ad3c3cf7a4f950e868
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
DataType represents the type of the data set to picker component @enum { number } DataType @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export declare enum DataType { /** * DataType: set selected uris to picker component, the data should be a array of uri * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ SET_SELECTED_URIS = 1, /** * SET_ALBUM_URI. set selected album uri to pic...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum DataType AST#enum_body#Left { /** * DataType: set selected uris to picker component, the data should be a array of uri * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice ...
export declare enum DataType { SET_SELECTED_URIS = 1, SET_ALBUM_URI = 2, SET_SELECTED_INFO = 3, SET_BADGE_CONFIGS = 4 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L843-L879
e5114f5821cd865eca163a4285d2fed33e905bd5
gitee
Duke_Bit/logan
37ce340f90e508cbf3914162df2254aca76a525a
core/src/main/ets/Logan.ets
arkts
@brief Logan Debug开关
export function setDebug(isDebug: boolean): void { LoganControlCenter.instance().setDebug(isDebug) }
AST#export_declaration#Left export AST#function_declaration#Left function setDebug AST#parameter_list#Left ( AST#parameter#Left isDebug : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#...
export function setDebug(isDebug: boolean): void { LoganControlCenter.instance().setDebug(isDebug) }
https://github.com/Duke_Bit/logan/blob/37ce340f90e508cbf3914162df2254aca76a525a/core/src/main/ets/Logan.ets#L37-L39
6c20d47d6c540741fc4f5c1ba43e0549124af543
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
getCountPerDay
/ 第天多少个新字
getCountPerDay(): number { return this.countPerDay; }
AST#method_declaration#Left getCountPerDay 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_expressio...
getCountPerDay(): number { return this.countPerDay; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L75-L77
49eeeea9c776e5d1d871be159bc8291db9ac51b3
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildAssistantMessage
构建助手消息
@Builder buildAssistantMessage(message: ChatMessage) { Row({ space: 12 }) { // 助手头像 Circle({ width: 32, height: 32 }) .fill($r('app.color.primary')) .overlay( Image($r('app.media.ic_robot')) .width(20) .height(20) .fillColor(Color.White) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAssistantMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder...
@Builder buildAssistantMessage(message: ChatMessage) { Row({ space: 12 }) { Circle({ width: 32, height: 32 }) .fill($r('app.color.primary')) .overlay( Image($r('app.media.ic_robot')) .width(20) .height(20) .fillColor(Color.White) )...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/chat/AIAssistantPage.ets#L219-L266
06a0a5195540d93c408727cd9156afc378ebf7bc
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api15/entry/src/main/ets/MainAbility/pages/data/BasicDataSource.ets
arkts
notifyDataMove
通知LazyForEach组件将from索引和to索引处的子组件进行交换
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); // 写法2:listener.onDatasetChange( // [{type: DataOperationType.EXCHANGE, index: {start: from, end: to}}]); }) }
AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api15/entry/src/main/ets/MainAbility/pages/data/BasicDataSource.ets#L77-L83
8752c4881a82107ca028327c23573c6efe499f3a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/game/GameCenterPage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .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('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/game/GameCenterPage.ets#L67-L103
988ef51abdfca2769bac51fd91ffcc9fd7332793
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHSubtitles.ets
arkts
字幕内容
constructor(index: number, startTimeMs: number, endTimeMs: number, content: string) { this.index = index; this.startTimeMs = startTimeMs; this.endTimeMs = endTimeMs; this.content = content; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left startTimeMs : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
constructor(index: number, startTimeMs: number, endTimeMs: number, content: string) { this.index = index; this.startTimeMs = startTimeMs; this.endTimeMs = endTimeMs; this.content = content; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHSubtitles.ets#L18-L23
2adeafdd4e291b32c458d15a8da0176cc4d95b44
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
stop
停止当前播放
async stop(): Promise<void> { if (!this.ttsEngine) { return; } try { this.ttsEngine.stop(); this.speakQueue = []; // 清空队列 this.isSpeaking = false; this.currentState = TTSState.IDLE; this.logService.tts('播放已停止'); } catch (error) { this.logService.error('TTS', '停...
AST#method_declaration#Left async stop 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 stop(): Promise<void> { if (!this.ttsEngine) { return; } try { this.ttsEngine.stop(); this.speakQueue = []; this.isSpeaking = false; this.currentState = TTSState.IDLE; this.logService.tts('播放已停止'); } catch (error) { this.logService.error('TTS', '停止播放失败')...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L345-L359
ecb21667f9f921107d86566b044cece058ec79db
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomEmitter/entry/src/main/ets/components/Choice.ets
arkts
Choice
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct Choice { build() { Row() { Text($r('app.string.selected')) .fontSize(14) .fontColor($r('app.color.blank')) Flex({ justifyContent: FlexAlign.Start, wrap: FlexWrap.Wrap }) { Text($r('app.string.select_configuration')) .fontSize(14) .pa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Choice AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#a...
@Component export struct Choice { build() { Row() { Text($r('app.string.selected')) .fontSize(14) .fontColor($r('app.color.blank')) Flex({ justifyContent: FlexAlign.Start, wrap: FlexWrap.Wrap }) { Text($r('app.string.select_configuration')) .fontSize(14) .pa...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomEmitter/entry/src/main/ets/components/Choice.ets#L16-L43
c65a16145097ff4dd5c6adda72efaebc7d7712d7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/model/SwiperData.ets
arkts
轮播项视图类 @param data: 轮播项数据 @param contentBuilder: 轮播项视图组件
export class SwiperItemViewType { data: SwiperData; contentBuilder: WrappedBuilder<[SwiperData]>; constructor(data: SwiperData, contentBuilder: WrappedBuilder<[SwiperData]>) { this.data = data; this.contentBuilder = contentBuilder; } }
AST#export_declaration#Left export AST#class_declaration#Left class SwiperItemViewType AST#class_body#Left { AST#property_declaration#Left data : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left cont...
export class SwiperItemViewType { data: SwiperData; contentBuilder: WrappedBuilder<[SwiperData]>; constructor(data: SwiperData, contentBuilder: WrappedBuilder<[SwiperData]>) { this.data = data; this.contentBuilder = contentBuilder; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/model/SwiperData.ets#L42-L50
c038a2985feb3e1dcbf499e3799642d4510f0243
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/LineRadarRenderer.ets
arkts
drawFilledPath
Draws the provided path in filled mode with the provided drawable. @param c @param filledPath @param drawable
protected drawFilledPath(c: CanvasRenderingContext2D, filledPath: Path2D, drawable: ChartPixelMap) { if (this.clipPathSupported()) { c.save(); c.clip(filledPath); // drawable.setBounds( // Math.floor(this.mViewPortHandler.contentLeft()), // Math.floor(this.mViewPortHandler.conte...
AST#method_declaration#Left protected drawFilledPath 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#Left filledPath : AST#type_annotation#Left AST#primary_type#L...
protected drawFilledPath(c: CanvasRenderingContext2D, filledPath: Path2D, drawable: ChartPixelMap) { if (this.clipPathSupported()) { c.save(); c.clip(filledPath); c.restoreToCount(save); if (this.mViewPortHandler) { c.rect(t...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/LineRadarRenderer.ets#L68-L97
0e40ef358b4225703a32c7cad3e0772e67c08d1a
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets
arkts
MARK: - CMetaInfo 管理器
export class CMetaInfoManager { /// 偏好存储的名字 private prefName: string; /// 初始化时传入 PrefName constructor(prefName: string) { this.prefName = prefName; } /// 获取当前 name 的 Book 的 TimeToKey /// 用于记录是否到时间可以 Check 一次了 public getTimeToKeyFor(name: string): string { return `TimeTo_Check__${name}`; } ...
AST#export_declaration#Left export AST#class_declaration#Left class CMetaInfoManager AST#class_body#Left { /// 偏好存储的名字 AST#property_declaration#Left private prefName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /// 初始化时传入 PrefN...
export class CMetaInfoManager { private prefName: string; constructor(prefName: string) { this.prefName = prefName; } public getTimeToKeyFor(name: string): string { return `TimeTo_Check__${name}`; } public async isNeedUpdateForMeta(info: CMetaInfo): Promise<boolean> { const sav...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets#L9-L109
9730d48e0041a783abf4e06174deecb2db654b59
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/market/src/main/ets/view/CouponPage.ets
arkts
CouponPage
@file 优惠券页面视图 @author Joker.X
@ComponentV2 export struct CouponPage { /** * 优惠券页面 ViewModel */ @Local private vm: CouponViewModel = new CouponViewModel(); /** * 构建优惠券页面 * @returns {void} 无返回值 */ build() { AppNavDestination({ title: "优惠券", viewModel: this.vm }) { this.CouponContent(); } } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CouponPage AST#component_body#Left { /** * 优惠券页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left CouponView...
@ComponentV2 export struct CouponPage { @Local private vm: CouponViewModel = new CouponViewModel(); build() { AppNavDestination({ title: "优惠券", viewModel: this.vm }) { this.CouponContent(); } } @Builder private CouponContent() { Text("优惠券页面内容视图") } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/market/src/main/ets/view/CouponPage.ets#L8-L37
c4796e78b128313eb418d79c88724ee3adce6512
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tls/CertVerify/entry/src/main/ets/pages/Index.ets
arkts
getCertFromFile
从文件获取X509证书
async getCertFromFile(filePath: string): Promise<cert.X509Cert | undefined> { let newCert: cert.X509Cert | undefined = undefined //读取文件内容 let certData = readArrayBufferContentFromFile(filePath); if (certData) { let encodingBlob: cert.EncodingBlob = { data: new Uint8Array(certData), ...
AST#method_declaration#Left async getCertFromFile AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
async getCertFromFile(filePath: string): Promise<cert.X509Cert | undefined> { let newCert: cert.X509Cert | undefined = undefined let certData = readArrayBufferContentFromFile(filePath); if (certData) { let encodingBlob: cert.EncodingBlob = { data: new Uint8Array(certData), encodin...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/CertVerify/entry/src/main/ets/pages/Index.ets#L134-L153
32e236ea4eb30402dae7a5ad62e4e4cc0b770362
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressListViewModel.ets
arkts
onDeleteAddress
点击删除地址 @param {number} addressId - 地址 ID @returns {void} 无返回值
onDeleteAddress(addressId: number): void { this.showDeleteDialog(addressId); }
AST#method_declaration#Left onDeleteAddress AST#parameter_list#Left ( AST#parameter#Left addressId : 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_typ...
onDeleteAddress(addressId: number): void { this.showDeleteDialog(addressId); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressListViewModel.ets#L101-L103
5af2cb7342c8632369c06b21cb624d74acc40e7a
github
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/DB/relationDB.ets
arkts
insertDatas
向数据库中插入数据
async insertDatas(tableName: string, valueBucket) { if (store != undefined) { (store as relationalStore.RdbStore).insert(tableName, valueBucket, (err, rowId: number) => { if (err) { console.error(`Failed to insert data. Code:${err.code}, message:${err.message}`); return; } ...
AST#method_declaration#Left async insertDatas AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left valueBucket AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu...
async insertDatas(tableName: string, valueBucket) { if (store != undefined) { (store as relationalStore.RdbStore).insert(tableName, valueBucket, (err, rowId: number) => { if (err) { console.error(`Failed to insert data. Code:${err.code}, message:${err.message}`); return; } ...
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/DB/relationDB.ets#L50-L60
f64bbcf02fe4008790e6b4cf6cb4e0b7414c6720
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
isOddRotation
Confirm whether it is an odd rotation. @param angle @returns true means is odd, false means is not odd.
static isOddRotation(angle: number): boolean { if (angle == -CropAngle.ONE_QUARTER_CIRCLE_ANGLE || angle == -CropAngle.THREE_QUARTER_CIRCLE_ANGLE) { return true; } return false; }
AST#method_declaration#Left static isOddRotation AST#parameter_list#Left ( AST#parameter#Left angle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary...
static isOddRotation(angle: number): boolean { if (angle == -CropAngle.ONE_QUARTER_CIRCLE_ANGLE || angle == -CropAngle.THREE_QUARTER_CIRCLE_ANGLE) { return true; } return false; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L261-L266
cb5209e9f0d117aacfacd78d4cd3e2124ad5c4f9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
getCommemorationsForReminder
获取需要提醒的纪念日
async getCommemorationsForReminder(): Promise<CommemorationWithContact[]> { this.checkInitialization(); return await this.commemorationDAO.getCommemorationsForReminder(); }
AST#method_declaration#Left async getCommemorationsForReminder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CommemorationWithContact [ ] AST...
async getCommemorationsForReminder(): Promise<CommemorationWithContact[]> { this.checkInitialization(); return await this.commemorationDAO.getCommemorationsForReminder(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L184-L187
3a1ab475832820ba216cacb885fa3e56be6a907d
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/NavigationResultPage.ets
arkts
构建结果回传示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_navigation_result_title"), viewModel: this.vm }) { this.NavigationResultContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_nav...
build() { AppNavDestination({ title: $r("app.string.demo_navigation_result_title"), viewModel: this.vm }) { this.NavigationResultContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NavigationResultPage.ets#L22-L29
816464237d2a1196fbdbc83b0d442b3095c4c3a3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/TextSheetView.ets
arkts
TextSheetView
文本内容展示
@Preview @ComponentV2 export struct TextSheetView { private scroller: Scroller = new Scroller(); @Require @Param options: TISheetOptions; @Local content: string = ''; aboutToAppear(): void { this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background'); this.content = t...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TextSheetView AST#component_body#Left { AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Righ...
@Preview @ComponentV2 export struct TextSheetView { private scroller: Scroller = new Scroller(); @Require @Param options: TISheetOptions; @Local content: string = ''; aboutToAppear(): void { this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background'); this.content = t...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/TextSheetView.ets#L13-L47
9fdb694f0febf00a9182a7d5529944e952306a02
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语完整接口
export interface Greeting extends GreetingInfo { usageCount: number; // 使用次数 rating: number; // 评分 authorId?: string; // 作者ID isPublic: boolean; // 是否公开 metadata?: Record<string, string | number | boolean>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Greeting AST#extends_clause#Left extends GreetingInfo AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left usageCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#t...
export interface Greeting extends GreetingInfo { usageCount: number; rating: number; authorId?: string; isPublic: boolean; metadata?: Record<string, string | number | boolean>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L68-L74
37f142e4222578f8d49cf9d23d8cce4fffed2bef
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/CloudDBService.ets
arkts
getInstance
获取单例实例
static getInstance(): CloudDBService { if (!CloudDBService.instance) { CloudDBService.instance = new CloudDBService(); } return CloudDBService.instance; }
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CloudDBService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left...
static getInstance(): CloudDBService { if (!CloudDBService.instance) { CloudDBService.instance = new CloudDBService(); } return CloudDBService.instance; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L27-L32
b662b4e2be272571cd03a5e3e3ae8957916e3d85
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdecoration/src/main/ets/components/AutoAddInspector.ets
arkts
自定义装饰器
export function AutoAddInspector(param: InspectorParam) { return Object; }
AST#export_declaration#Left export AST#function_declaration#Left function AutoAddInspector AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left InspectorParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen...
export function AutoAddInspector(param: InspectorParam) { return Object; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdecoration/src/main/ets/components/AutoAddInspector.ets#L17-L19
cf5a9ad27de12dcf1ff90a553482f9221031c4fb
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/image/ImageUtil.ets
arkts
getPixelMapFromResource
用户获取resource目录下的media中的图片PixelMap @param {Resource} resource Resource资源信息 @param {image.DecodingOptions} options 图像解码参数 @returns {Promise<image.PixelMap>} 返回图像的PixelMap对象
static async getPixelMapFromResource(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> { const resManager: resourceManager.ResourceManager = ContextUtil.getUIAbilityCtx().resourceManager; const uint8Array: Uint8Array = resManager.getMediaContentSync(resource.id); return await Ima...
AST#method_declaration#Left static async getPixelMapFromResource AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type...
static async getPixelMapFromResource(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> { const resManager: resourceManager.ResourceManager = ContextUtil.getUIAbilityCtx().resourceManager; const uint8Array: Uint8Array = resManager.getMediaContentSync(resource.id); return await Ima...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/image/ImageUtil.ets#L39-L43
2a620536a24c8713c346e1b6069bdf6da57a17f8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets
arkts
genTestDlpFile
生成测试DLP文件
async genTestDlpFile(plaintextPath: string, ciphertextFd: number, displayName: string, currentPerssion: number, dlpFileInfos: Array<TestDlpFileInfo>) { Logger.info('GenTestDlpFile start'); let file: fs.File = fs.openSync(plaintextPath, fs.OpenMode.READ_WRITE); this.dlpFd = ciphertextFd; this.dlpFileUri ...
AST#method_declaration#Left async genTestDlpFile AST#parameter_list#Left ( AST#parameter#Left plaintextPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ciphertextFd : AST#type_annotation#Left AST#primary_type#Left numb...
async genTestDlpFile(plaintextPath: string, ciphertextFd: number, displayName: string, currentPerssion: number, dlpFileInfos: Array<TestDlpFileInfo>) { Logger.info('GenTestDlpFile start'); let file: fs.File = fs.openSync(plaintextPath, fs.OpenMode.READ_WRITE); this.dlpFd = ciphertextFd; this.dlpFileUri ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L204-L235
8ef477e3ca590ad4d3d86f77aeb86fce5c49d8e7
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/timeto/TimeToCfg.ets
arkts
MARK: - TimeTo Config
export class TimeTo { // 单位: 小时 public static UpdateServerConfigs: number = DebugFlg.isDebugMode() ? 1.0 / 3600.0 : 24 * 5; // 5天检查一次 ServerConfigs中的配置,Debug:1秒 public static AutoRefreshSubscriptionInfo: number = DebugFlg.isDebugMode() ? 1.0 / 3600.0 : 6; // 5小时检查一次 订阅时间变化,Debug:1秒 }
AST#export_declaration#Left export AST#class_declaration#Left class TimeTo AST#class_body#Left { // 单位: 小时 AST#property_declaration#Left public static UpdateServerConfigs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expres...
export class TimeTo { public static UpdateServerConfigs: number = DebugFlg.isDebugMode() ? 1.0 / 3600.0 : 24 * 5; public static AutoRefreshSubscriptionInfo: number = DebugFlg.isDebugMode() ? 1.0 / 3600.0 : 6; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/timeto/TimeToCfg.ets#L4-L7
2f3f66b9aced76dd0c4635debeb862eebae343be
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
queryForPart
按 partId 进行分段(CategoryName → Words) searchText 可选:模糊查询(仅匹配 wordEn 与 wordJp)
queryForPart(filtedWords: WordUser[]): SectionDatas<string, WordUser> { const sectionWords = new SectionDatas<string, WordUser>(); // 排序:先按 partId,然后按 wordEn filtedWords.sort((a, b) => { const aCat : number = a.partId ?? 0; const bCat : number = b.partId ?? 0; if (aCat !== bCat) { ...
AST#method_declaration#Left queryForPart AST#parameter_list#Left ( AST#parameter#Left filtedWords : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#L...
queryForPart(filtedWords: WordUser[]): SectionDatas<string, WordUser> { const sectionWords = new SectionDatas<string, WordUser>(); filtedWords.sort((a, b) => { const aCat : number = a.partId ?? 0; const bCat : number = b.partId ?? 0; if (aCat !== bCat) { return aCat - bCat; ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L690-L716
c4e314005fec55bad9dfb04e04d2e22bb0dce103
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setStartAtZero
This method is deprecated. Use setAxisMinimum(...) / setAxisMaximum(...) instead. @param startAtZero @Deprecated
public setStartAtZero(startAtZero: boolean): void { if (startAtZero) super.setAxisMinimum(0); else super.resetAxisMinimum(); }
AST#method_declaration#Left public setStartAtZero AST#parameter_list#Left ( AST#parameter#Left startAtZero : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr...
public setStartAtZero(startAtZero: boolean): void { if (startAtZero) super.setAxisMinimum(0); else super.resetAxisMinimum(); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L323-L328
8a4cf2643b9e4503f6162a59ceec5d7b6ccda3b1
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
aboutToAppear
页面出现时初始化列表数据 @returns {void} 无返回值
aboutToAppear(): void { this.initLoad(); }
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.initLoad(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L58-L60
1f829a569e66d49e3fb03de64a398e9ada3d1f83
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/social/PostDetailPage.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Button() { Image($r('app.media.ic_back')) .width('24vp') .height('24vp') .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('24vp') .height('24vp') .fillColor($r('app.color.text_primary')) } .type(ButtonType.Normal) .backgroundColor(Color.Transparent) .onClick(() => { router.back...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/PostDetailPage.ets#L74-L120
2e9dd78739d4fa6da99e040bc7a2cbfed10bae3a
github
Autumnker/ArkTS_FreeKnowledgeChat.git
cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7
entry/src/main/ets/commonViews/chatPage.ets
arkts
chatPage
聊天界面 没有群聊功能
@Entry @Component export struct chatPage{ @State inputText:string='' params = router.getParams() as Params friend = this.params.friend as PersonInterface me = this.params.me as PersonInterface msg = this.params.msg as MsgInterface[] build() { Column() { // 显示好友头像、昵称 Row() { // 返回箭头...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct chatPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right inputText : AST#type_annotation#Left AST#primary_type#Left...
@Entry @Component export struct chatPage{ @State inputText:string='' params = router.getParams() as Params friend = this.params.friend as PersonInterface me = this.params.me as PersonInterface msg = this.params.msg as MsgInterface[] build() { Column() { Row() { Row(){ ...
https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/commonViews/chatPage.ets#L10-L169
6022e98fbd32bc8e236ac6ef65fe711db98717d2
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/DemoRepository.ets
arkts
@file Demo 仓库,衔接业务层与本地数据库。 @author Joker.X
export class DemoRepository { /** * Demo 本地数据源 */ private demoLocalDataSource: DemoLocalDataSource; /** * 构造函数,支持注入自定义数据源(便于测试) * @param {DemoLocalDataSource} [localDataSource] - 可选的本地数据源 */ constructor(localDataSource?: DemoLocalDataSource) { this.demoLocalDataSource = localDataSource ?? ne...
AST#export_declaration#Left export AST#class_declaration#Left class DemoRepository AST#class_body#Left { /** * Demo 本地数据源 */ AST#property_declaration#Left private demoLocalDataSource : AST#type_annotation#Left AST#primary_type#Left DemoLocalDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#propert...
export class DemoRepository { private demoLocalDataSource: DemoLocalDataSource; constructor(localDataSource?: DemoLocalDataSource) { this.demoLocalDataSource = localDataSource ?? new DemoLocalDataSourceImpl(); } async createDemo(title: string, description: string = ""): Promise<number> { retu...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/DemoRepository.ets#L7-L73
177106106de245aec7ed45ea371cdaa2797ed0b7
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets
arkts
fetchData
fetchData
function fetchData(params: PublishReminderInfo): reminderAgent.ReminderRequestAlarm { return { reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM, hour: params.hour || 0, minute: params.minute || 0, daysOfWeek: params.daysOfWeek || [], wantAgent: { pkgName: Const.PACKAGE_NAME, ...
AST#function_declaration#Left function fetchData AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PublishReminderInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#q...
function fetchData(params: PublishReminderInfo): reminderAgent.ReminderRequestAlarm { return { reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM, hour: params.hour || 0, minute: params.minute || 0, daysOfWeek: params.daysOfWeek || [], wantAgent: { pkgName: Const.PACKAGE_NAME, ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets#L112-L127
13d42d7cec667c0bbf387490600bcd2f45d48c8f
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets
arkts
getValue
通过key获取对象值 @param obj @param key @returns
static getValue<T>(obj: object, key: string): T { return obj[key] as T; }
AST#method_declaration#Left static getValue AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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#Ri...
static getValue<T>(obj: object, key: string): T { return obj[key] as T; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/ObjectUtil.ets#L36-L38
8a704d6c5b1973c3cc3f8a7bd7c4b5e39a75bf75
github
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/views/FocusAreaComponent.ets
arkts
FocusAreaComponent
对焦区域
@Component export struct FocusAreaComponent { @Link focusPointBol: boolean; @Link focusPointVal: Array<number>; @Prop xComponentWidth: number; @Prop xComponentHeight: number; // 对焦区域显示框定时器 private areaTimer: number = -1; private focusFrameDisplayDuration: number = 3500; build() { Row() { } ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FocusAreaComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right focusPointBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AS...
@Component export struct FocusAreaComponent { @Link focusPointBol: boolean; @Link focusPointVal: Array<number>; @Prop xComponentWidth: number; @Prop xComponentHeight: number; private areaTimer: number = -1; private focusFrameDisplayDuration: number = 3500; build() { Row() { } .width(this.x...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/views/FocusAreaComponent.ets#L22-L63
ded6b0a98a3a2c75204ce250c5f0c0f337934512
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets
arkts
prompt message
export const SETTING_FINISHED_MESSAGE = '设置完成';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SETTING_FINISHED_MESSAGE = AST#expression#Left '设置完成' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const SETTING_FINISHED_MESSAGE = '设置完成';
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L49-L49
b9f39b6970e94caa985c37cbe26d84b8d5df1f01
gitee
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/CityWeather.ets
arkts
loadWeatherData
加载天气数据
private async loadWeatherData() { try { this.loading = true; let httpRequest = http.createHttp(); let response = await httpRequest.request(Config.API.WEATHER_BY_CITY, { method: http.RequestMethod.POST, extraData: JSON.stringify({ city_name: this.currentCity }), ...
AST#method_declaration#Left private async loadWeatherData 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#membe...
private async loadWeatherData() { try { this.loading = true; let httpRequest = http.createHttp(); let response = await httpRequest.request(Config.API.WEATHER_BY_CITY, { method: http.RequestMethod.POST, extraData: JSON.stringify({ city_name: this.currentCity }), ...
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/CityWeather.ets#L83-L111
724e6c4cf9287ad3aed6462b47f6afd1ac325f87
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/viewmodel/SNViewModel.ets
arkts
getHapticList
获取所有列表数据(返回副本防止外部修改)
getHapticList(): SNListItemModel[] { return [...this.hapticList]; }
AST#method_declaration#Left getHapticList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SNListItemModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement...
getHapticList(): SNListItemModel[] { return [...this.hapticList]; }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/viewmodel/SNViewModel.ets#L39-L41
eee4049305671424b05afaf5c833f204f3dacd83
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
getWindowAvoidArea
获取当前应用窗口内容规避的区域。如系统栏区域、刘海屏区域、手势区域、软键盘区域等与窗口内容重叠时,需要窗口内容避让的区域。 @param type 表示规避区类型。 @returns
static getWindowAvoidArea(type: window.AvoidAreaType, windowClass: window.Window = AppUtil.getMainWindow()): window.AvoidArea { return windowClass.getWindowAvoidArea(type); }
AST#method_declaration#Left static getWindowAvoidArea AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . AvoidAreaType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windo...
static getWindowAvoidArea(type: window.AvoidAreaType, windowClass: window.Window = AppUtil.getMainWindow()): window.AvoidArea { return windowClass.getWindowAvoidArea(type); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L304-L307
61acba71e0a875f1084142d73eb3d2db234cebda
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
getTodayTasks
Get today's tasks @returns Array of Task objects for today
async getTodayTasks(): Promise<Task[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS); const startOfDay = this.getStartOfDay(); const endOfDay = this.getEndOfDay(); predicates.between('due...
AST#method_declaration#Left async getTodayTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Task [ ] AST#array_type#Right AST#primary_type#...
async getTodayTasks(): Promise<Task[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_TASKS); const startOfDay = this.getStartOfDay(); const endOfDay = this.getEndOfDay(); predicates.between('due...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L232-L267
a6d35d446af6dfe1b1feb9b9c1a3a3d244f22424
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPILoadModuleWithInfo/library/Index.ets
arkts
MainPage
[Start napi_load_module_with_info_library_index]
export { MainPage } from './src/main/ets/components/MainPage';
AST#export_declaration#Left export { MainPage } from './src/main/ets/components/MainPage' ; AST#export_declaration#Right
export { MainPage } from './src/main/ets/components/MainPage';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPILoadModuleWithInfo/library/Index.ets#L16-L16
031bdb58b153df0fe01ed9fb332fa1fb83eb6e73
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/plan/CreatePlanView.ets
arkts
/新建plan的快速方法
export function openWithNew(wordIds: number[], name: string, bookId: number){ open({initWordIds: wordIds, initName: name, bookId: bookId}) }
AST#export_declaration#Left export AST#function_declaration#Left function openWithNew AST#parameter_list#Left ( AST#parameter#Left wordIds : 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#param...
export function openWithNew(wordIds: number[], name: string, bookId: number){ open({initWordIds: wordIds, initName: name, bookId: bookId}) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/plan/CreatePlanView.ets#L34-L36
b9192e572dd2a6b5acf6a7d29f04009b9e64b4b2
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets
arkts
onTouchEvent
Draw events. @param event Touch event.
onTouchEvent(event: TouchEvent): void { let positionX: number = event.touches[0].x; let positionY: number = event.touches[0].y; switch (event.type) { case TouchType.Down: { this.canvasContext.beginPath();
AST#method_declaration#Left onTouchEvent AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
onTouchEvent(event: TouchEvent): void { let positionX: number = event.touches[0].x; let positionY: number = event.touches[0].y; switch (event.type) { case TouchType.Down: { this.canvasContext.beginPath();
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets#L182-L187
d88ba3f61509711a0d0fd2388519602ebc0358d9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
offEnvironment
取消对系统环境变化的监听。使用Promise异步回调。仅支持主线程调用。 @param callback 注册监听系统环境变化的ID。 @returns
static async offEnvironment(callbackId: number): Promise<void> { return AppUtil.getApplicationContext().off('environment', callbackId); }
AST#method_declaration#Left static async offEnvironment AST#parameter_list#Left ( AST#parameter#Left callbackId : 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#gen...
static async offEnvironment(callbackId: number): Promise<void> { return AppUtil.getApplicationContext().off('environment', callbackId); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L293-L295
d0a9f95103a91dee956130aaeeb55a0c148b11fa
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
arkts
getInstance
Using singleton mode for global management of component reuse pool
public static getInstance() { if (!NodePool.instance) { NodePool.instance = new NodePool(); } return NodePool.instance; }
AST#method_declaration#Left public static getInstance 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 NodePool A...
public static getInstance() { if (!NodePool.instance) { NodePool.instance = new NodePool(); } return NodePool.instance; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L75-L80
a75c314968ae2c4e1d2fa468994725abec3c71fd
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
Form management of Ability.
export default class EntryFormAbility extends FormExtensionAbility { onAddForm(want: Want) { if (want.parameters === undefined) { return formBindingData.createFormBindingData(); } let formId: string = want.parameters[CommonConstants.IDENTITY_KEY] as string; let formName: string = want.parameters...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryFormAbility extends AST#type_annotation#Left AST#primary_type#Left FormExtensionAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onAddForm AST#parameter_list#Left ( AST#parameter#Le...
export default class EntryFormAbility extends FormExtensionAbility { onAddForm(want: Want) { if (want.parameters === undefined) { return formBindingData.createFormBindingData(); } let formId: string = want.parameters[CommonConstants.IDENTITY_KEY] as string; let formName: string = want.parameters...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/entryformability/EntryFormAbility.ets#L29-L67
dd1577e107e78eda22b21cb88fa01a7d8a814ea0
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/NewFileIoManager.ets
arkts
ReadFile
读取文件内容
async ReadFile(filePath: string):Promise<string> { try{ let content : string=''; let options: Options = { encoding: 'utf-8' }; await fs.readLines(filePath, options).then((readerIterator: fs.ReaderIterator) => { for (let it = readerIterator.next(); !it.done; it = readerIterato...
AST#method_declaration#Left async ReadFile AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
async ReadFile(filePath: string):Promise<string> { try{ let content : string=''; let options: Options = { encoding: 'utf-8' }; await fs.readLines(filePath, options).then((readerIterator: fs.ReaderIterator) => { for (let it = readerIterator.next(); !it.done; it = readerIterato...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/NewFileIoManager.ets#L50-L69
5a67f55a0ea849a1eb0fbe56ac6e4ec70f068671
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets
arkts
fetchSeparateData
单独获取各部分数据的方法
async fetchSeparateData() { console.info('尝试单独获取各部分数据...'); let hasAnyData = false; try { // 获取梦想统计数据 const stats = await ApiService.getDreamStats(this.userId); console.info(`梦想统计获取成功,数据: ${JSON.stringify(stats)}`); if (stats) { this.dreamStats = stats; ...
AST#method_declaration#Left async fetchSeparateData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Righ...
async fetchSeparateData() { console.info('尝试单独获取各部分数据...'); let hasAnyData = false; try { const stats = await ApiService.getDreamStats(this.userId); console.info(`梦想统计获取成功,数据: ${JSON.stringify(stats)}`); if (stats) { this.dreamStats = stats; console.inf...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets#L219-L337
4f1139b9bdf11e856faa53325f0cab46696b4622
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/model/KeyboardKeyData.ets
arkts
Copyright (c) 2022-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,...
export enum MenuType { NORMAL = 0, NUMBER = 1, SPECIAL = 2, EMOJI = 3, CLIPBOARD = 4 }
AST#export_declaration#Left export AST#enum_declaration#Left enum MenuType AST#enum_body#Left { AST#enum_member#Left NORMAL = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NUMBER = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SPECIAL =...
export enum MenuType { NORMAL = 0, NUMBER = 1, SPECIAL = 2, EMOJI = 3, CLIPBOARD = 4 }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/KeyboardKeyData.ets#L16-L22
bf381c15dc35f8efb83048958ac325ccdfe30208
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
goHome
便捷导航方法 跳转到首页
async goHome(): Promise<void> { await this.clearAndPush(RoutePaths.INDEX); }
AST#method_declaration#Left async goHome 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...
async goHome(): Promise<void> { await this.clearAndPush(RoutePaths.INDEX); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L236-L238
6c7ee7853316ef169b59530489ccccb253ffced2
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/auth/AuthService.ets
arkts
setGesturePassword
设置手势密码
async setGesturePassword(pattern: string): Promise<boolean> { try { await StorageManager.setString('gesture_password', pattern); Logger.info('AuthService', 'Gesture password set'); return true; } catch (error) { Logger.error('AuthService', `Failed to set gesture password: ${String(error)...
AST#method_declaration#Left async setGesturePassword AST#parameter_list#Left ( AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t...
async setGesturePassword(pattern: string): Promise<boolean> { try { await StorageManager.setString('gesture_password', pattern); Logger.info('AuthService', 'Gesture password set'); return true; } catch (error) { Logger.error('AuthService', `Failed to set gesture password: ${String(error)...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L376-L385
5b40ff2e0e372b16dd7d66536c8f6f3836abb599
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
getLeapMonth
获取指定年份的闰月月份
static getLeapMonth(year: number): number { const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year); return (yearInfo & 0xf); }
AST#method_declaration#Left static getLeapMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
static getLeapMonth(year: number): number { const yearInfo = ComprehensiveLunarDatabase.getYearInfo(year); return (yearInfo & 0xf); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L134-L137
9edc1bd0baf18f263194505da1cba14127836479
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets
arkts
城市列表数据
export const CITY_DATA = [ new AlphabetListItemType('A', ['阿尔山', '阿勒泰地区', '安庆', '安阳']), new AlphabetListItemType('B', ['北京', '亳州', '包头', '宝鸡']), new AlphabetListItemType('C', ['重庆', '长春', '长沙', '成都']), new AlphabetListItemType('F', ['福州', '阜阳', '佛山', '抚顺']), new AlphabetListItemType('G', ['广州', '桂林', '赣州', '高...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CITY_DATA = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AlphabetListItemType AST#expression#Right AST#new_...
export const CITY_DATA = [ new AlphabetListItemType('A', ['阿尔山', '阿勒泰地区', '安庆', '安阳']), new AlphabetListItemType('B', ['北京', '亳州', '包头', '宝鸡']), new AlphabetListItemType('C', ['重庆', '长春', '长沙', '成都']), new AlphabetListItemType('F', ['福州', '阜阳', '佛山', '抚顺']), new AlphabetListItemType('G', ['广州', '桂林', '赣州', '高...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets#L63-L82
9f857c87b052442e7909b428efc2b54159232247
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ThreadUtils.ets
arkts
dumpThreadInfo
打印完整线程信息 获取当前线程诊断信息
static dumpThreadInfo(): string { const pm = new process.ProcessManager(); const str = ` Process ID: ${process.pid} Thread ID: ${process.tid} Is Main: ${process.tid === process.pid} Is 64Bit: ${process.is64Bit()} Thread Priority: ${pm.getThreadPriority(process.tid)} Uptime: ...
AST#method_declaration#Left static dumpThreadInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left p...
static dumpThreadInfo(): string { const pm = new process.ProcessManager(); const str = ` Process ID: ${process.pid} Thread ID: ${process.tid} Is Main: ${process.tid === process.pid} Is 64Bit: ${process.is64Bit()} Thread Priority: ${pm.getThreadPriority(process.tid)} Uptime: ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ThreadUtils.ets#L19-L32
ff67bc57346edba08cb7b85b56cbb73ddd4ca994
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/wordcard/WordCardOne.ets
arkts
buildReclaimPanel
纠错
@Builder buildReclaimPanel(){ Row(){ Blank().layoutWeight(1) Button(){ ///纠错 Text($r('app.string.learn_detail_btn_reclaim')) .fontSize(15) .fontColor($r('app.color.color_text2')) } .backgroundColor(Color.Transparent) .onClick(()=> { Reclaim...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildReclaimPanel 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_e...
@Builder buildReclaimPanel(){ Row(){ Blank().layoutWeight(1) Button(){ Text($r('app.string.learn_detail_btn_reclaim')) .fontSize(15) .fontColor($r('app.color.color_text2')) } .backgroundColor(Color.Transparent) .onClick(()=> { ReclaimWordV...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L362-L381
8984fe91182031a2ae4139d39e4a03a6198fd265
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets
arkts
initAvSession
Initializing the playback control center. @param context Context.
public static initAvSession(playBarModel: PlayBarModel) { return new Promise<string>(async () => { try { // Sets the current music metadata. let metadata = { assetId: playBarModel!.musicItem!.id.toString(), title: playBarModel!.musicItem!.name, artist: playBarMode...
AST#method_declaration#Left public static initAvSession AST#parameter_list#Left ( AST#parameter#Left playBarModel : AST#type_annotation#Left AST#primary_type#Left PlayBarModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AS...
public static initAvSession(playBarModel: PlayBarModel) { return new Promise<string>(async () => { try { let metadata = { assetId: playBarModel!.musicItem!.id.toString(), title: playBarModel!.musicItem!.name, artist: playBarModel!.musicItem!.singer } as a...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets#L33-L70
b015ea7418012fcc0c25c5e1917540a48f931854
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/MainPage.ets
arkts
TabBuilder
定义 TabBuilder 构建函数,用于创建 Tab 内容
@Builder TabBuilder(index: number, name: string, image: Resource, activeImage: Resource) { Column({ space: 2 }) { // 根据当前索引选择显示普通图标或激活状态图标 Image(this.currentIndex === index ? activeImage : image) .width(25) .height(25) .objectFit(ImageFit.Contain); // 根据当前索引设置字体颜色、字体大小和字体粗细...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left name : AST#type_annotation#Left AST...
@Builder TabBuilder(index: number, name: string, image: Resource, activeImage: Resource) { Column({ space: 2 }) { Image(this.currentIndex === index ? activeImage : image) .width(25) .height(25) .objectFit(ImageFit.Contain); Text(name) .fontColor(this.current...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/MainPage.ets#L23-L86
fa99ad74e317927f6987955e25d12aed858276a9
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationCenterService.ets
arkts
createBirthdayNotification
创建生日提醒通知
public createBirthdayNotification(contact: Contact): NotificationItem { return this.createNotification({ type: NotificationType.BIRTHDAY, title: '🎂 生日提醒', content: `今天是${contact.name}的生日,记得送上祝福哦!`, priority: NotificationPriority.HIGH, relatedContactId: contact.id, metadata: this...
AST#method_declaration#Left public createBirthdayNotification AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Not...
public createBirthdayNotification(contact: Contact): NotificationItem { return this.createNotification({ type: NotificationType.BIRTHDAY, title: '🎂 生日提醒', content: `今天是${contact.name}的生日,记得送上祝福哦!`, priority: NotificationPriority.HIGH, relatedContactId: contact.id, metadata: this...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L80-L105
e6301869b9357b4d90ed00b17a54c95000f18d75
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
getErrorCountByManger
统计试卷错题数量 @param examList @returns
public getErrorCountByManger(examList: ExamDetail[]): number { return examList.filter((item: ExamDetail) => item.isCorrect === false).length; }
AST#method_declaration#Left public getErrorCountByManger AST#parameter_list#Left ( AST#parameter#Left examList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ExamDetail [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty...
public getErrorCountByManger(examList: ExamDetail[]): number { return examList.filter((item: ExamDetail) => item.isCorrect === false).length; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L155-L157
25530f1a957ab012f34bd026ec3cdb62cd6c06a3
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
defaultAnimateBuilder
全局转场动画构造器,构造后还是需要给页面设置NavAnimationModifier,不然不生效 @returns
public defaultAnimateBuilder(): NavAnimParamBuilder { return NavAnimationStore.getInstance().defaultAnimateBuilder() }
AST#method_declaration#Left public defaultAnimateBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NavAnimParamBuilder AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expressio...
public defaultAnimateBuilder(): NavAnimParamBuilder { return NavAnimationStore.getInstance().defaultAnimateBuilder() }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L72-L74
c3635d819224d6df207d8254506f783a1991804e
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineDataSet.ets
arkts
setDrawCircleHole
Set this to true to allow drawing a hole in each data circle. @param enabled
public setDrawCircleHole(enabled: boolean): void { this.mDrawCircleHole = enabled; }
AST#method_declaration#Left public setDrawCircleHole AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pri...
public setDrawCircleHole(enabled: boolean): void { this.mDrawCircleHole = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L345-L347
d33e2381cd5411b93563d08de769b4f64c1b53d1
gitee
yanweiguo198-commits/Harmony-Calendar-App.git
9ebdfbe588dfc230231af619a6eeb89b3c7fc39f
entry/src/main/ets/service/ReminderService.ets
arkts
cancelReminder
【👇👇👇 这里是补回来的代码 👇👇👇】 取消提醒
static async cancelReminder(reminderId: number) { if (reminderId >= 0) { try { await reminderAgentManager.cancelReminder(reminderId); console.info('提醒取消成功 ID:' + reminderId); } catch (error) { console.error('提醒取消失败: ' + JSON.stringify(error)); } } }
AST#method_declaration#Left static async cancelReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_sta...
static async cancelReminder(reminderId: number) { if (reminderId >= 0) { try { await reminderAgentManager.cancelReminder(reminderId); console.info('提醒取消成功 ID:' + reminderId); } catch (error) { console.error('提醒取消失败: ' + JSON.stringify(error)); } } }
https://github.com/yanweiguo198-commits/Harmony-Calendar-App.git/blob/9ebdfbe588dfc230231af619a6eeb89b3c7fc39f/entry/src/main/ets/service/ReminderService.ets#L43-L52
0cdb6b0646f5984f41f8c0ac7cd4e02a4308ef83
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/http/api.ets
arkts
公众号作者下的搜索文章 @param date @returns
export function wxAuthorSearchArticleList(id:number,page:number,key:string) { return axiosClient.get<HomeArticleModel>({ url: `wxarticle/list/${id}/${page}/json?k=${key}`, showLoading:true }) }
AST#export_declaration#Left export AST#function_declaration#Left function wxAuthorSearchArticleList 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 page : AST#type_annotation...
export function wxAuthorSearchArticleList(id:number,page:number,key:string) { return axiosClient.get<HomeArticleModel>({ url: `wxarticle/list/${id}/${page}/json?k=${key}`, showLoading:true }) }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L158-L163
444b0d3c47fe83abb2801821fe3b4a474463c04b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
registerSessionListener
注册AVSession实例事件 播控中心有多种操作,播放、暂停、停止、下一首、上一首、拖进度、标记喜好、播放循环模式切换、快进、快退 @returns {void}
registerSessionListener(eventListener: AVSessionEventListener): void { // 播放 this.session?.on('play', () => { logger.info('avsession on play'); eventListener.onPlay(); }); // 暂停 this.session?.on('pause', () => { logger.info('avsession on pause'); eventListener.onPause(); ...
AST#method_declaration#Left registerSessionListener AST#parameter_list#Left ( AST#parameter#Left eventListener : AST#type_annotation#Left AST#primary_type#Left AVSessionEventListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_ty...
registerSessionListener(eventListener: AVSessionEventListener): void { this.session?.on('play', () => { logger.info('avsession on play'); eventListener.onPlay(); }); this.session?.on('pause', () => { logger.info('avsession on pause'); eventListener.onPause(); }); ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L105-L162
462ac92e82490f5a1131f181f35959551d26a847
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Piece.ets
arkts
appendMem
MARK: - 内存操作(Operation in memo) 从内存中添加wordId @param wordId - 要添加的wordId
appendMem(wordId: number): void { this._wordIds.push(wordId); }
AST#method_declaration#Left appendMem AST#parameter_list#Left ( AST#parameter#Left wordId : 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#Right A...
appendMem(wordId: number): void { this._wordIds.push(wordId); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Piece.ets#L54-L56
fdcbff6036b74445d03d98751efd628e451af4c6
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/components/basicUI/KeyItemGray.ets
arkts
KeyItemGray
无大小写的灰色组件
@Component export struct KeyItemGray { private keyValue: string | undefined = undefined; @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; @State WIDTH: number = 0; @State HEIGHT: number = 0; build() { Stack() { if (this.keyValue)...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyItemGray AST#component_body#Left { AST#property_declaration#Left private keyValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined...
@Component export struct KeyItemGray { private keyValue: string | undefined = undefined; @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; @State WIDTH: number = 0; @State HEIGHT: number = 0; build() { Stack() { if (this.keyValue)...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/components/basicUI/KeyItemGray.ets#L28-L59
d855d2a5a5c94bf1274160024b82e95c8cb2e385
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/DatabasePage.ets
arkts
ListSection
列表区域 @returns {void} 无返回值
@Builder private ListSection(): void { if (this.vm.items.length === 0) { IBestEmpty({ description: $r("app.string.demo_database_empty") }) .margin({ top: $r("app.float.space_vertical_large") }); } else { IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.items, (item...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ListSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if...
@Builder private ListSection(): void { if (this.vm.items.length === 0) { IBestEmpty({ description: $r("app.string.demo_database_empty") }) .margin({ top: $r("app.float.space_vertical_large") }); } else { IBestCellGroup({ inset: true, outerMargin: 0 }) { ForEach(this.vm.items, (item...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/DatabasePage.ets#L116-L128
b3b87e8b5a159f344c42f91b4710e22404e28e9b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/view/ImageDepthCopy.ets
arkts
ImageDepthCopyComponent
功能描述: 本例通过使用PixelMap的readPixelsToBuffer方法来实现深拷贝。 推荐场景: 图库类应用 核心组件: 1. Image 2. PixelMap 实现步骤: 1. 从资源管理器获取图片,创建ImageSource实例并保存,使用createPixelMap创建BGRA_8888格式的PixelMap图片对象。 2. 通过readPixelsToBuffer读取源PixelMap到ArrayBuffer,再通过createPixelMap得到目标PixelMap。 3. 通过PixelMap的crop方法进行图片裁剪。 4. 将当前的图片数据进行保存。
@Component export struct ImageDepthCopyComponent { private imageSource: image.ImageSource | undefined = undefined; private pixelMapSrc: PixelMap | undefined | null = undefined; // 源PixelMap private columnSpace: number = 24; // 内容相隔距离 @State pixelMapDst: PixelMap | undefined | null = undefined; // 目标PixelMap @...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageDepthCopyComponent AST#component_body#Left { AST#property_declaration#Left private imageSource : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#...
@Component export struct ImageDepthCopyComponent { private imageSource: image.ImageSource | undefined = undefined; private pixelMapSrc: PixelMap | undefined | null = undefined; private columnSpace: number = 24; @State pixelMapDst: PixelMap | undefined | null = undefined; @State cropIndex: number = 0; @S...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagedepthcopy/src/main/ets/view/ImageDepthCopy.ets#L43-L264
88ea0211c4e46610e571a1717f04c5bf9337cda3
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ComposeListItem.d.ets
arkts
ComposeListItem
Declare ComposeListItem @struct { ComposeListItem } @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare ComposeListItem @struct { ComposeListItem } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare ComposeListItem @struct { ComposeListItem } @syscap SystemCapability.ArkUI.ArkUI.F...
@Component export declare struct ComposeListItem { /** * The ContentItem. * @type { ?ContentItem } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The ContentItem. * @type { ?ContentItem } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ComposeListItem AST#component_body#Left { /** * The ContentItem. * @type { ?ContentItem } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The C...
@Component export declare struct ComposeListItem { @Prop contentItem?: ContentItem; @Prop operateItem?: OperateItem; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L988-L1035
7ae8dafaeb2c0a25d0ad8e599c0f20aeb78eeb50
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
handleError
处理错误响应 @param {Error} err - 错误对象 @returns {void} 无返回值
protected handleError(err: Error): void { console.error("[BaseNetWorkListViewModel] error:", err.message); if (this.currentPage === 1) { if (this.listData.length === 0) { this.uiState = BaseNetWorkListUiState.ERROR; } return; } this.currentPage -= 1; }
AST#method_declaration#Left protected handleError AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error 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...
protected handleError(err: Error): void { console.error("[BaseNetWorkListViewModel] error:", err.message); if (this.currentPage === 1) { if (this.listData.length === 0) { this.uiState = BaseNetWorkListUiState.ERROR; } return; } this.currentPage -= 1; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L114-L124
de5877305e49eb08e7c05135b940a5ca31dd8573
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets
arkts
AddItem
在指定索引位置增加一个元素
public AddItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray.length); this.notifyDataAdd(index); }
AST#method_declaration#Left public AddItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
public AddItem(index: number): void { this.dataArray.splice(index, 0, this.dataArray.length); this.notifyDataAdd(index); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/pages/WaterFlow/WaterFlow_attribute/WaterFlowDataSource.ets#L98-L101
09115880fbcc185f27e2ae6c93b6f469f05a2364
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/UserProfileComponent.ets
arkts
openEditDialog
打开编辑弹窗
openEditDialog(item: ProfileItem) { this.editingItem = item; this.editingValue = item.value === 'Not set' ? '' : item.value; if (item.key === 'gender') { // 性别特殊处理 if (item.value === 'Male') this.editingGender = 1; else if (item.value === 'Female') this.editingGender = 2; else t...
AST#method_declaration#Left openEditDialog AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ProfileItem 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...
openEditDialog(item: ProfileItem) { this.editingItem = item; this.editingValue = item.value === 'Not set' ? '' : item.value; if (item.key === 'gender') { if (item.value === 'Male') this.editingGender = 1; else if (item.value === 'Female') this.editingGender = 2; else this.editi...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L170-L182
cf0796ec3c82d3ef3534c0f05e0de82ab2a4682a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NumberUtil.ets
arkts
isInteger
检查值是否为整数 @param value @returns
static isInteger(value: Any): boolean { return Number.isInteger(value); }
AST#method_declaration#Left static isInteger AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any 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#R...
static isInteger(value: Any): boolean { return Number.isInteger(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L53-L55
a9652ddec0435a9e516ed5432fe6984415705538
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/formatter/DefaultValueFormatter.ets
arkts
Default formatter used for formatting values inside the chart. Uses a DecimalFormat with pre-calculated number of digits (depending on max and min value).
export default class DefaultValueFormatter implements IValueFormatter { /** * DecimalFormat for formatting */ //protected mFormat:DecimalFormat; protected mDecimalDigits: number = 0; /** * Constructor that specifies to how many digits the value should be * formatted. * * @param digits */...
AST#export_declaration#Left export default AST#class_declaration#Left class DefaultValueFormatter AST#implements_clause#Left implements IValueFormatter AST#implements_clause#Right AST#class_body#Left { /** * DecimalFormat for formatting */ //protected mFormat:DecimalFormat; AST#property_declaration#Left protecte...
export default class DefaultValueFormatter implements IValueFormatter { protected mDecimalDigits: number = 0; constructor(digits: number) { this.setup(digits); } public setup(digits: number): void { this.mDecimalDigits = digits; } public getFormattedValue(value: number, entry: Entry...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/DefaultValueFormatter.ets#L26-L70
65034bb46a3fb464440522f85c08b06c4f59a0cd
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_segmentation/RSASegmentationAsync.ets
arkts
rsaEncryptBySegment
分段加密消息
async function rsaEncryptBySegment(pubKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, pubKey, null); let plainTextSplitLen = 64; let cipherText = new Uint8Array(); for (le...
AST#function_declaration#Left async function rsaEncryptBySegment AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#param...
async function rsaEncryptBySegment(pubKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, pubKey, null); let plainTextSplitLen = 64; let cipherText = new Uint8Array(); for (le...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_segmentation/RSASegmentationAsync.ets#L20-L37
c8de865005d1b395361ae0d86e155980222d5f49
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
getCompressedIcon
获取压缩通知图标(图标像素的总字节数不超过192KB) @param pixelMap:原始待压缩图片的PixelMap对象 @returns
static async getCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 192 * 1024; //通知图标(图标像素的总字节数不超过192K...
AST#method_declaration#Left static async getCompressedIcon AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Righ...
static async getCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> { if (typeof (src as Resource).bundleName == 'string') { src = await ImageUtil.getPixelMapFromMedia((src as Resource)); } let pixelMap = src as image.PixelMap; let pictureMaxSize = 192 * 1024; let pixelBytes = p...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L435-L447
7bedc75f23885f88f0a77eaf4fb078619b3aa67b
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Spacer.ets
arkts
SpaceHorizontalXSmall
创建一个超小水平间距(4vp) @returns {void} 无返回值
@Builder export function SpaceHorizontalXSmall(): void { Blank().width($r("app.float.space_horizontal_small_x")); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceHorizontalXSmall 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#ar...
@Builder export function SpaceHorizontalXSmall(): void { Blank().width($r("app.float.space_horizontal_small_x")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L109-L112
da6665d5687db97e24269252501e5fe44fa83628
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyGenerationImport/KeyImport/DevelopmentGuidelines/ImportKeyPlainText/entry/src/main/ets/pages/X25519.ets
arkts
importX25519
3.明文导入密钥
function importX25519() { try { huks.importKeyItem(keyAlias, options, (error, data) => { if (error) { console.error(`callback: importKeyItem failed` + error); } else { console.info(`callback: importKeyItem success`); } }); } catch (error) { console.error(`callback: impo...
AST#function_declaration#Left function importX25519 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#call_expression#Left AST#expression#Left A...
function importX25519() { try { huks.importKeyItem(keyAlias, options, (error, data) => { if (error) { console.error(`callback: importKeyItem failed` + error); } else { console.info(`callback: importKeyItem success`); } }); } catch (error) { console.error(`callback: impo...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyGenerationImport/KeyImport/DevelopmentGuidelines/ImportKeyPlainText/entry/src/main/ets/pages/X25519.ets#L56-L69
371ebd38d2dc77ed4caef776c7a3336a2b4cf2fc
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
关注用户 @param followerId 关注者ID(当前用户) @param followingId 被关注者ID @returns 操作结果
export async function followUser(followerId: number, followingId: number): Promise<void> { console.info(`API调用: 关注用户, followerId: ${followerId}, followingId: ${followingId}`); try { // 检查参数 if (!followerId || !followingId) { throw new Error('关注用户失败: 用户ID不能为空'); } // 构建URL和请求 const ...
AST#export_declaration#Left export AST#function_declaration#Left async function followUser AST#parameter_list#Left ( AST#parameter#Left followerId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left followingId : AST#type_anno...
export async function followUser(followerId: number, followingId: number): Promise<void> { console.info(`API调用: 关注用户, followerId: ${followerId}, followingId: ${followingId}`); try { if (!followerId || !followingId) { throw new Error('关注用户失败: 用户ID不能为空'); } const url = `${BASE_URL}...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1313-L1359
ef60942538d2d868cb4b06d8a13d91e703bea648
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DeviceUtils.ets
arkts
设备相关工具类
export class DeviceUtils { /** * 获取开发者匿名设备标识符,ODID。 */ static getODID(): string { return deviceInfo.ODID; } /** * 获取开放匿名设备标识符,OAID。 * 需要权限:ohos.permission.APP_TRACKING_CONSENT */ static async getOAID(): Promise<string> { return identifier.getOAID(); } /** * 获取AAID,使用Promise异步...
AST#export_declaration#Left export AST#class_declaration#Left class DeviceUtils AST#class_body#Left { /** * 获取开发者匿名设备标识符,ODID。 */ AST#method_declaration#Left static getODID AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
export class DeviceUtils { static getODID(): string { return deviceInfo.ODID; } static async getOAID(): Promise<string> { return identifier.getOAID(); } static async getAAID(): Promise<string> { return AAID.getAAID(); } static async deleteAAID(): Promise<void> { return AAI...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L11-L278
e95bf6d71875639e52de7e5b5872601333ed63ee
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/Index.ets
arkts
getIconResource
获取图标资源 - 确保所有路径都有返回值
private getIconResource(index: number): Resource { // 如果当前标签被选中,返回深色图标,否则返回浅色图标 if (this.currentIndex === index) { // 返回深色图标 switch (index) { case 0: // 首页 return $r('app.media.homebutton'); case 1: // 导航 return $r('app.media.daohang'); case 3: // 商店 ...
AST#method_declaration#Left private getIconResource AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Resource AST#pri...
private getIconResource(index: number): Resource { if (this.currentIndex === index) { switch (index) { case 0: return $r('app.media.homebutton'); case 1: return $r('app.media.daohang'); case 3: return $r('app.media.blackshop'); case ...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Index.ets#L123-L154
e92f980accd74b00780c6c0f8c2243f44a40512d
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringUtils.ets
arkts
removedDuplicates
去除重复字符(保留顺序) @param str 输入字符串 @returns 处理后的字符串
static removedDuplicates(str: string): string { const set = new Set<string>(); const result: string[] = []; const chars = Array.from(str); for (const c of chars) { if (emptyStr.includes(c)) { result.push(c); } else if (!set.has(c)) { set.add(c); result.push(c); ...
AST#method_declaration#Left static removedDuplicates 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#primar...
static removedDuplicates(str: string): string { const set = new Set<string>(); const result: string[] = []; const chars = Array.from(str); for (const c of chars) { if (emptyStr.includes(c)) { result.push(c); } else if (!set.has(c)) { set.add(c); result.push(c); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringUtils.ets#L117-L132
102d3ddde50dca234a3864c8a0cb6421a675eb46
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/UniversalKeystoreKit/KeyGenerationImport/KeyImport/DevelopmentGuidelines/ImportKeyPlainText/entry/src/main/ets/pages/AES256.ets
arkts
importAES256
3.明文导入密钥
function importAES256() { try { huks.importKeyItem(keyAlias, options, (error, data) => { if (error) { console.error(`callback: importKeyItem failed` + JSON.stringify(error)); } else { console.info(`callback: importKeyItem success`); } }); } catch (error) { console.error...
AST#function_declaration#Left function importAES256 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#call_expression#Left AST#expression#Left A...
function importAES256() { try { huks.importKeyItem(keyAlias, options, (error, data) => { if (error) { console.error(`callback: importKeyItem failed` + JSON.stringify(error)); } else { console.info(`callback: importKeyItem success`); } }); } catch (error) { console.error...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/UniversalKeystoreKit/KeyGenerationImport/KeyImport/DevelopmentGuidelines/ImportKeyPlainText/entry/src/main/ets/pages/AES256.ets#L51-L64
e8015f87b79360c86145489e019259f5a297973c
gitee