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
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
generateSymKey
生成对称密钥-指定密钥生成格式(默认base64) @param symAlgName 秘钥规格 @param resultCoding 生成对称秘钥的编码方式(hex/base64) @returns 指定秘钥规格的对称密钥
static generateSymKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<string> { // 创建对称密钥生成器 let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName); // 通过非对称密钥生成器,随机生成非对称密钥 let promiseSymKey = symKeyGenerator.generateSymKeySync(); //转换成可以读懂的字符串 let key = StrAndUintUtil.unitArray2StrCoding(promiseSymKey.getEncoded().data, resultCoding); // 获取对称密钥的二进制数据 return OutDTO.OKByDataRow<string>('生成' + symAlgName + '密钥成功~', key); }
AST#method_declaration#Left static generateSymKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right 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 OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 创建对称密钥生成器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createSymKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symAlgName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过非对称密钥生成器,随机生成非对称密钥 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left promiseSymKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left symKeyGenerator AST#expression#Right . generateSymKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成可以读懂的字符串 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left key = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2StrCoding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promiseSymKey AST#expression#Right . getEncoded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取对称密钥的二进制数据 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '生成' AST#expression#Right + AST#expression#Left symAlgName AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '密钥成功~' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static generateSymKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<string> { let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName); let promiseSymKey = symKeyGenerator.generateSymKeySync(); let key = StrAndUintUtil.unitArray2StrCoding(promiseSymKey.getEncoded().data, resultCoding); return OutDTO.OKByDataRow<string>('生成' + symAlgName + '密钥成功~', key); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L120-L129
b5b86c3f4c5590d08fcd64f600fe0e1f6e52c155
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
arkts
confirmPayment
确认支付
confirmPayment(): void { const selectedItems = this.datas.filter((item: Type1): boolean => item.selected); const totalPrice = this.calculateTotalPrice(); // 这里可以添加实际的支付逻辑 console.log('确认支付,总价:', totalPrice); console.log('选中商品:', selectedItems); promptAction.showToast({ message: `支付成功!总价:${totalPrice}`, duration: 3000 }); // 关闭支付弹窗 this.showPaymentDialog = false; // 支付成功后,可以清空选中的商品或跳转到支付成功页面 // 这里简单地将选中商品从购物车中移除 this.removeSelectedItems(); }
AST#method_declaration#Left confirmPayment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left selectedItems = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . datas AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Type1 AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . selected AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left totalPrice = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateTotalPrice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 这里可以添加实际的支付逻辑 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#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '确认支付,总价:' AST#expression#Right , AST#expression#Left totalPrice AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '选中商品:' AST#expression#Right , AST#expression#Left selectedItems AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 支付成功!总价: AST#template_substitution#Left $ { AST#expression#Left totalPrice AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 3000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 关闭支付弹窗 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showPaymentDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 支付成功后,可以清空选中的商品或跳转到支付成功页面 // 这里简单地将选中商品从购物车中移除 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . removeSelectedItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
confirmPayment(): void { const selectedItems = this.datas.filter((item: Type1): boolean => item.selected); const totalPrice = this.calculateTotalPrice(); console.log('确认支付,总价:', totalPrice); console.log('选中商品:', selectedItems); promptAction.showToast({ message: `支付成功!总价:${totalPrice}`, duration: 3000 }); this.showPaymentDialog = false; this.removeSelectedItems(); }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L265-L279
32bd64b82135a307dfdb6f564afaaa3a41d0ebe6
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/mine/ServiceList.ets
arkts
handleMenuClick
处理菜单项点击
private handleMenuClick(title: string): void { hilog.info(DOMAIN, TAG, 'Menu item clicked: %{public}s', title); switch (title) { case '深色模式': this.toggleDarkMode(); break; case '足迹': this.navigateToFootprint();
AST#method_declaration#Left private handleMenuClick AST#parameter_list#Left ( AST#parameter#Left title : 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#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Menu item clicked: %{public}s' AST#expression#Right , AST#expression#Left title AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#ERROR#Left ( AST#expression#Left title AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left '深色模式' AST#expression#Right AST#expression_statement#Right : AST#ERROR#Left AST#qualified_type#Left this . toggleDarkMode AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left '足迹' AST#expression#Right AST#expression_statement#Right : AST#ERROR#Left AST#qualified_type#Left this . navigateToFootprint AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#method_declaration#Right
private handleMenuClick(title: string): void { hilog.info(DOMAIN, TAG, 'Menu item clicked: %{public}s', title); switch (title) { case '深色模式': this.toggleDarkMode(); break; case '足迹': this.navigateToFootprint();
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/mine/ServiceList.ets#L71-L79
7a2697ff82f2f54c8282efcaef012db7483439da
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
the divide of single and double
export const COMMON_NUM_DOUBLE: number = 10;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMON_NUM_DOUBLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const COMMON_NUM_DOUBLE: number = 10;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L69-L69
cde707d3eb261b46ebe9a702b70017f48a28df30
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ApiUsingStandards/entry/src/main/ets/pages/AVImageGenerator.ets
arkts
fetchFrame
[Start av_image_generator_class]
async fetchFrame(): Promise<void> { await this.fetchMeta(); if (canIUse("SystemCapability.Multimedia.Media.AVImageGenerator")) { this.pixelMap = new Array; let avImageGenerator: media.AVImageGenerator = await media.createAVImageGenerator(); // raw fd avImageGenerator.fdSrc = fs.openSync(this.rootPath + this.testFilename); for (let i = 0; i < 6; i++) { let pixelMap: image.PixelMap = await avImageGenerator.fetchFrameByTime(this.diffTime[i], this.seekOption, { width: this.pixelMapWidth, height: this.pixelMapHeight }); this.pixelMap.push(pixelMap); if (i == 0) { this.pixelLcd = pixelMap; let rate: number = pixelMap.getImageInfoSync().size.height / pixelMap.getImageInfoSync().size.width; this.lcdHeight = display.getDefaultDisplaySync().width / 2 / display.getDefaultDisplaySync().densityPixels * rate; } let imageInfo: image.ImageInfo = pixelMap.getImageInfoSync(); hilog.info(0x0000, 'testTag', `colorFormat ${imageInfo.pixelFormat} width ${imageInfo.size.width} height ${imageInfo.size.height} isHdr ${imageInfo.isHdr}`); } } }
AST#method_declaration#Left async fetchFrame 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#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchMeta AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#expression#Left "SystemCapability.Multimedia.Media.AVImageGenerator" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMap AST#member_expression#Right = AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left avImageGenerator : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVImageGenerator AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left media AST#expression#Right AST#await_expression#Right AST#expression#Right . createAVImageGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // raw fd AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left avImageGenerator AST#expression#Right . fdSrc AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootPath AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . testFilename AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left avImageGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchFrameByTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . diffTime AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . seekOption AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMapWidth AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMapHeight AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelLcd AST#member_expression#Right = AST#expression#Left pixelMap AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getImageInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left pixelMap AST#expression#Right AST#binary_expression#Right AST#expression#Right . getImageInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lcdHeight AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . densityPixels AST#member_expression#Right AST#expression#Right * AST#expression#Left rate AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getImageInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` colorFormat AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . pixelFormat AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right width AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right height AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right isHdr AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left imageInfo AST#expression#Right . isHdr AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async fetchFrame(): Promise<void> { await this.fetchMeta(); if (canIUse("SystemCapability.Multimedia.Media.AVImageGenerator")) { this.pixelMap = new Array; let avImageGenerator: media.AVImageGenerator = await media.createAVImageGenerator(); avImageGenerator.fdSrc = fs.openSync(this.rootPath + this.testFilename); for (let i = 0; i < 6; i++) { let pixelMap: image.PixelMap = await avImageGenerator.fetchFrameByTime(this.diffTime[i], this.seekOption, { width: this.pixelMapWidth, height: this.pixelMapHeight }); this.pixelMap.push(pixelMap); if (i == 0) { this.pixelLcd = pixelMap; let rate: number = pixelMap.getImageInfoSync().size.height / pixelMap.getImageInfoSync().size.width; this.lcdHeight = display.getDefaultDisplaySync().width / 2 / display.getDefaultDisplaySync().densityPixels * rate; } let imageInfo: image.ImageInfo = pixelMap.getImageInfoSync(); hilog.info(0x0000, 'testTag', `colorFormat ${imageInfo.pixelFormat} width ${imageInfo.size.width} height ${imageInfo.size.height} isHdr ${imageInfo.isHdr}`); } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ApiUsingStandards/entry/src/main/ets/pages/AVImageGenerator.ets#L35-L57
3cdf2b9e221236223f1b7ae372fc22c8ff656c4b
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets
arkts
Declare type OperationOption @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare type OperationOption @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export declare class OperationOption { /** * The content of text or the address of icon. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The content of text or the address of icon. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ value: ResourceStr; /** * callback function when operate the text or icon. * @type { () => void }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * callback function when operate the text or icon. * @type { () => void }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ action?: () => void; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class OperationOption AST#class_body#Left { /** * The content of text or the address of icon. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The content of text or the address of icon. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * callback function when operate the text or icon. * @type { () => void }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * callback function when operate the text or icon. * @type { () => void }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ AST#property_declaration#Left action ? : AST#type_annotation#Left AST#function_type#Left 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#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export declare class OperationOption { value: ResourceStr; action?: () => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets#L94-L123
8b31f3eb9e52b2783e59602bec076140d3b0e841
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
qualityPriorityCompress
优先压缩图片质量 @param sourcePixelMap 原始待压缩图片的PixelMap @param maxCompressedImageSize 指定图片的压缩目标大小
async qualityPriorityCompress(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number) { // TODO 知识点:自动模式(指定压缩目标大小)优先压缩图片质量。先判断设置图片质量参数为0时,packing能压缩到的图片最小字节大小compressedImageData.byteLength是否满足指定的图片压缩大小。如果满足,则使用packing方式二分查找最接近指定图片压缩目标大小的quality来压缩图片。如果不满足,则图片质量按最低0进行设置,并调用scalePriorityCompress进行scale尺寸压缩。 let compressedImageData: ArrayBuffer = await this.packing(sourcePixelMap, IMAGE_QUALITY_ZERO, this.afterCompressFmt); // 先判断图片质量参数设置最低0能否满足目标大小。如果能满足目标大小,则直接使用packing二分图片质量。如果不满足,则质量参数固定为0,进行scale尺寸压缩 if (compressedImageData.byteLength <= maxCompressedImageSize * BYTE_CONVERSION) { // 满足目标大小,直接使用packing二分 await this.packingImage(sourcePixelMap, compressedImageData, maxCompressedImageSize * BYTE_CONVERSION); } else { // 不满足目标大小,质量参数设置为0,再进行scale尺寸压缩 await this.scalePriorityCompress(sourcePixelMap, maxCompressedImageSize, IMAGE_QUALITY_ZERO); } // 更新显示压缩后的图片格式 this.showCompressFormat = this.afterCompressFmt; }
AST#method_declaration#Left async qualityPriorityCompress AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxCompressedImageSize : 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 { // TODO 知识点:自动模式(指定压缩目标大小)优先压缩图片质量。先判断设置图片质量参数为0时,packing能压缩到的图片最小字节大小compressedImageData.byteLength是否满足指定的图片压缩大小。如果满足,则使用packing方式二分查找最接近指定图片压缩目标大小的quality来压缩图片。如果不满足,则图片质量按最低0进行设置,并调用scalePriorityCompress进行scale尺寸压缩。 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left compressedImageData : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . packing AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourcePixelMap AST#expression#Right , AST#expression#Left IMAGE_QUALITY_ZERO AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . afterCompressFmt AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 先判断图片质量参数设置最低0能否满足目标大小。如果能满足目标大小,则直接使用packing二分图片质量。如果不满足,则质量参数固定为0,进行scale尺寸压缩 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left compressedImageData AST#expression#Right . byteLength AST#member_expression#Right AST#expression#Right <= AST#expression#Left AST#binary_expression#Left AST#expression#Left maxCompressedImageSize AST#expression#Right * AST#expression#Left BYTE_CONVERSION AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 满足目标大小,直接使用packing二分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . packingImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourcePixelMap AST#expression#Right , AST#expression#Left compressedImageData AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left maxCompressedImageSize AST#expression#Right * AST#expression#Left BYTE_CONVERSION AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 不满足目标大小,质量参数设置为0,再进行scale尺寸压缩 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . scalePriorityCompress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourcePixelMap AST#expression#Right , AST#expression#Left maxCompressedImageSize AST#expression#Right , AST#expression#Left IMAGE_QUALITY_ZERO AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 更新显示压缩后的图片格式 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showCompressFormat AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . afterCompressFmt AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async qualityPriorityCompress(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number) { let compressedImageData: ArrayBuffer = await this.packing(sourcePixelMap, IMAGE_QUALITY_ZERO, this.afterCompressFmt); if (compressedImageData.byteLength <= maxCompressedImageSize * BYTE_CONVERSION) { await this.packingImage(sourcePixelMap, compressedImageData, maxCompressedImageSize * BYTE_CONVERSION); } else { await this.scalePriorityCompress(sourcePixelMap, maxCompressedImageSize, IMAGE_QUALITY_ZERO); } this.showCompressFormat = this.afterCompressFmt; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L251-L265
e34019d7f85da8feb7e4b9e4c1d031e701a6c69a
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/log/Logger.ets
arkts
debug
Debug 日志
debug(tag: string, message: string, ...args: string[]): void { this.log(LogLevel.DEBUG, tag, message, args); }
AST#method_declaration#Left debug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogLevel AST#expression#Right . DEBUG AST#member_expression#Right AST#expression#Right , AST#expression#Left tag AST#expression#Right , AST#expression#Left message AST#expression#Right , AST#expression#Left args AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
debug(tag: string, message: string, ...args: string[]): void { this.log(LogLevel.DEBUG, tag, message, args); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/log/Logger.ets#L59-L61
7dcab899e434f6bb036ffda01c302b78b3021429
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/AnnouncementBuilder.ets
arkts
VHAnnouncementPopup
公告栏
@Component export struct VHAnnouncementPopup { @State Animator: boolean = true; @Prop Announcement: string = '' @Consume announcementValue: string aboutToAppear(): void { this.AnnouncementText() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VHAnnouncementPopup AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right Animator : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right Announcement : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#property_declaration#Right AST#decorator#Left @ Consume AST#decorator#Right announcementValue : AST#ERROR#Left string aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#component_body#Left { AST#method_declaration#Left this AST#ERROR#Left . Announcement Text AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct VHAnnouncementPopup { @State Animator: boolean = true; @Prop Announcement: string = '' @Consume announcementValue: string aboutToAppear(): void { this.AnnouncementText() }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/AnnouncementBuilder.ets#L122-L130
a09f37d30fe4fcf283c71dd2d188704ddb9edefa
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
getTypeface
returns the Typeface used for the labels, returns null if none is set @return
public getTypeface(): FontWeight /*Typeface*/ { return this.mTypeface; }
AST#method_declaration#Left public getTypeface AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FontWeight AST#primary_type#Right AST#type_annotation#Right /*Typeface*/ AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTypeface AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getTypeface(): FontWeight { return this.mTypeface; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L100-L102
cd217ea643ab99a99726ee84f1a598081dad49f4
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets
arkts
aboutToAppear
页面加载时获取签到数据
aboutToAppear() { this.fetchCheckInData(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fetchCheckInData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear() { this.fetchCheckInData(); }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets#L32-L34
a2abd1bf664f313d1abd7095dea2ec43aeedbd3f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderCommentPage.ets
arkts
构建订单评论页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.order_comment"), viewModel: this.vm, pageBackgroundColor: $r("app.color.bg_white"), titleOptions: { backgroundColor: $r("app.color.bg_white") }, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(); } }
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.order_comment" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left pageBackgroundColor : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left titleOptions : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . topInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . leftInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . rightInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . PageContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { AppNavDestination({ title: $r("app.string.order_comment"), viewModel: this.vm, pageBackgroundColor: $r("app.color.bg_white"), titleOptions: { backgroundColor: $r("app.color.bg_white") }, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderCommentPage.ets#L42-L58
9d2ac863256c3a961b08d1286851efc675077b24
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppSettings.ets
arkts
AppSettings.ets
export namespace AppSettings { export class App { static readonly projectName = "WordTree" // 用于标识 project static readonly appName = "WordTree" // 用于标识 app static readonly appDisplayName = getString($r('app.string.app_name')) static readonly deviceType = "Harmony" static readonly minDisk = 100 //mb }
AST#export_declaration#Left export AST#ERROR#Left namespace AppSett in gs { export AST#ERROR#Right AST#class_declaration#Left class App AST#class_body#Left { AST#property_declaration#Left static readonly projectName = AST#expression#Left "WordTree" AST#expression#Right // 用于标识 project AST#property_declaration#Right AST#property_declaration#Left static readonly appName = AST#expression#Left "WordTree" AST#expression#Right // 用于标识 app AST#property_declaration#Right AST#property_declaration#Left static readonly appDisplayName = AST#expression#Left AST#call_expression#Left AST#expression#Left getString AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.app_name' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly deviceType = AST#expression#Left "Harmony" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly minDisk = AST#expression#Left 100 AST#expression#Right //mb AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export namespace AppSettings { export class App { static readonly projectName = "WordTree" static readonly appName = "WordTree" static readonly appDisplayName = getString($r('app.string.app_name')) static readonly deviceType = "Harmony" static readonly minDisk = 100 }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppSettings.ets#L5-L14
542dc69710b961f20b820981564f305ad8b3472f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/UserFile/SelectingUserFiles/entry/src/main/ets/pages/Index.ets
arkts
selectAudioFile
[Start audio_view_picker]
async selectAudioFile() { // [Start audio_select_option] const audioSelectOptions = new picker.AudioSelectOptions(); // [End audio_select_option] const audioViewPicker = new picker.AudioViewPicker(context); try { const audioSelectResult: string[] = await audioViewPicker.select(audioSelectOptions); this.audioUris = audioSelectResult[0]; Logger.info('audioViewPicker.select to file succeed and uri is:' + this.audioUris); // [StartExclude audio_view_picker] this.fileContent = 'Select Success'; this.readAudioFile(this.audioUris); // [EndExclude audio_view_picker] } catch (err) { const error: BusinessError = err as BusinessError; Logger.error(`Invoke audioViewPicker.select failed, code is ${error.code}, message is ${error.message}`); } }
AST#method_declaration#Left async selectAudioFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // [Start audio_select_option] AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioSelectOptions = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioSelectOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // [End audio_select_option] AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioViewPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . AudioViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioSelectResult : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left audioViewPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left audioSelectOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . audioUris AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left audioSelectResult AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'audioViewPicker.select to file succeed and uri is:' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . audioUris AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [StartExclude audio_view_picker] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileContent AST#member_expression#Right = AST#expression#Left 'Select Success' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readAudioFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . audioUris AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [EndExclude audio_view_picker] } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Invoke audioViewPicker.select failed, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async selectAudioFile() { const audioSelectOptions = new picker.AudioSelectOptions(); const audioViewPicker = new picker.AudioViewPicker(context); try { const audioSelectResult: string[] = await audioViewPicker.select(audioSelectOptions); this.audioUris = audioSelectResult[0]; Logger.info('audioViewPicker.select to file succeed and uri is:' + this.audioUris); this.fileContent = 'Select Success'; this.readAudioFile(this.audioUris); } catch (err) { const error: BusinessError = err as BusinessError; Logger.error(`Invoke audioViewPicker.select failed, code is ${error.code}, message is ${error.message}`); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/SelectingUserFiles/entry/src/main/ets/pages/Index.ets#L167-L184
0510e0038c138bda8772a92f9c1822302a9156c5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/HomeCouponSection.ets
arkts
HomeCouponSection
@file 首页优惠券区域组件 @author Joker.X
@ComponentV2 export struct HomeCouponSection { /** * 优惠券列表 */ @Param coupons: Coupon[] = []; /** * 构建优惠券区域 * @returns {void} 无返回值 */ build(): void { Card({ paddingValue: $r("app.float.space_vertical_medium") }) { Row() { Swiper() { ForEach(this.coupons, (coupon: Coupon): void => { this.couponCard(coupon); }, (coupon: Coupon): string => `${coupon.id}-${coupon.title}`); } .indicator(false) .autoPlay(false) .loop(false) .layoutWeight(1); Column() .width($r("app.float.space_divider")) .height(20) .backgroundColor($r("app.color.border")) .margin({ left: $r("app.float.space_padding_medium"), right: $r("app.float.space_padding_medium") }); Text($r("app.string.receive")) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.primary")); } } } /** * 构建优惠券卡片内容 * @param {Coupon} coupon - 优惠券信息 * @returns {void} 无返回值 */ @Builder private couponCard(coupon: Coupon): void { RowStartCenter({ widthValue: P100 }) { Row() { Image($r("app.media.ic_coupon")) .fillColor($r("app.color.text_primary")) .attributeModifier(size(18)); } .padding($r("app.float.space_padding_small_x")) .backgroundColor($r("app.color.bg_grey")) .borderRadius($r("app.float.radius_small_x")); SpaceHorizontalSmall(); Text(coupon.title) .fontSize($r("app.float.body_large")) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) .layoutWeight(1); } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HomeCouponSection AST#component_body#Left { /** * 优惠券列表 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right coupons : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Coupon [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 构建优惠券区域 * @returns {void} 无返回值 */ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( AST#component_parameters#Left { AST#component_parameter#Left paddingValue : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_vertical_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Swiper ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . coupons AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left coupon : AST#type_annotation#Left AST#primary_type#Left Coupon 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 AST#type_annotation#Right => AST#ui_arrow_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . couponCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left coupon AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left coupon : AST#type_annotation#Left AST#primary_type#Left Coupon 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#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left coupon AST#expression#Right . id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left coupon AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . indicator ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . autoPlay ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . loop ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_divider" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.border" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.receive" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.body_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /** * 构建优惠券卡片内容 * @param {Coupon} coupon - 优惠券信息 * @returns {void} 无返回值 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private couponCard AST#parameter_list#Left ( AST#parameter#Left coupon : AST#type_annotation#Left AST#primary_type#Left Coupon 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 AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RowStartCenter ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_coupon" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . attributeModifier ( AST#expression#Left AST#call_expression#Left AST#expression#Left size AST#expression#Right AST#argument_list#Left ( AST#expression#Left 18 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_small_x" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_grey" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_small_x" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceHorizontalSmall ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left coupon AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.body_large" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct HomeCouponSection { @Param coupons: Coupon[] = []; build(): void { Card({ paddingValue: $r("app.float.space_vertical_medium") }) { Row() { Swiper() { ForEach(this.coupons, (coupon: Coupon): void => { this.couponCard(coupon); }, (coupon: Coupon): string => `${coupon.id}-${coupon.title}`); } .indicator(false) .autoPlay(false) .loop(false) .layoutWeight(1); Column() .width($r("app.float.space_divider")) .height(20) .backgroundColor($r("app.color.border")) .margin({ left: $r("app.float.space_padding_medium"), right: $r("app.float.space_padding_medium") }); Text($r("app.string.receive")) .fontSize($r("app.float.body_medium")) .fontColor($r("app.color.primary")); } } } @Builder private couponCard(coupon: Coupon): void { RowStartCenter({ widthValue: P100 }) { Row() { Image($r("app.media.ic_coupon")) .fillColor($r("app.color.text_primary")) .attributeModifier(size(18)); } .padding($r("app.float.space_padding_small_x")) .backgroundColor($r("app.color.bg_grey")) .borderRadius($r("app.float.radius_small_x")); SpaceHorizontalSmall(); Text(coupon.title) .fontSize($r("app.float.body_large")) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) .layoutWeight(1); } } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCouponSection.ets#L9-L76
5bfdf7eee02ea9f0f03375f287ae842fae496c30
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets
arkts
loadCA
从文件加载内容
loadCA() { this.loadFile(caFileUri, (content: string) => { this.ca = content; }) }
AST#method_declaration#Left loadCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left caFileUri AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ca AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
loadCA() { this.loadFile(caFileUri, (content: string) => { this.ca = content; }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L289-L293
ea115426f788fca6ba36e562f87ce5bffe0a6f0e
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
finishWithResult
@deprecated @see {ZRouter.getInstance().finishWithResult} @param result @param animated
public static finishWithResult<T>(result: T, animated: boolean = true) { return ZRouter.getRouterMgr().finishWithResult<T>(result, animated) }
AST#method_declaration#Left public static finishWithResult AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animated : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ZRouter AST#expression#Right . getRouterMgr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . finishWithResult AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right , AST#expression#Left animated AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static finishWithResult<T>(result: T, animated: boolean = true) { return ZRouter.getRouterMgr().finishWithResult<T>(result, animated) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L488-L490
7cee1692d32f8482e1b216fcf87fc03d88b44e08
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
readC2
读取C2部分 @param sm2_sequence sm2序列工具 @param data 待读取的数据 @returns C2部分
private readC2(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith(ASN1Util.OCTEN_STRING)) { data = data.slice(ASN1Util.OCTEN_STRING.length, data.length); let C2_lenHex = this.getLenHex(data); data = data.slice(C2_lenHex.length, data.length); if (this.lenHex2number(C2_lenHex) != data.length / 2) { Logger.debug('SM2字符串中的C2长度不正确~'); } sm2_sequence.C2 = data; } else { Logger.debug('读取SM2字符串中的C2出错'); } return data; }
AST#method_declaration#Left private readC2 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . OCTEN_STRING AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ASN1Util AST#expression#Right . OCTEN_STRING AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left C2_lenHex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLenHex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left C2_lenHex AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lenHex2number AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left C2_lenHex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right != AST#expression#Left data AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SM2字符串中的C2长度不正确~' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left sm2_sequence AST#expression#Right . C2 AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '读取SM2字符串中的C2出错' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private readC2(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith(ASN1Util.OCTEN_STRING)) { data = data.slice(ASN1Util.OCTEN_STRING.length, data.length); let C2_lenHex = this.getLenHex(data); data = data.slice(C2_lenHex.length, data.length); if (this.lenHex2number(C2_lenHex) != data.length / 2) { Logger.debug('SM2字符串中的C2长度不正确~'); } sm2_sequence.C2 = data; } else { Logger.debug('读取SM2字符串中的C2出错'); } return data; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L232-L245
25c6d75a6a893cb892f2c66c9253b4efa015786b
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/pages/SettingsPage.ets
arkts
clearApiKey
清除API密钥
private async clearApiKey(): Promise<void> { try { await this.configService.clearApiConfig(); this.apiKeyMasked = ''; this.apiKeyInput = ''; } catch (error) { console.error('[SettingsPage] 清除API密钥失败'); } }
AST#method_declaration#Left private async clearApiKey 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#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . configService AST#member_expression#Right AST#expression#Right . clearApiConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . apiKeyMasked AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . apiKeyInput AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) 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#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SettingsPage] 清除API密钥失败' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async clearApiKey(): Promise<void> { try { await this.configService.clearApiConfig(); this.apiKeyMasked = ''; this.apiKeyInput = ''; } catch (error) { console.error('[SettingsPage] 清除API密钥失败'); } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/SettingsPage.ets#L92-L100
37cae573a7d82b2994e940a3df8cce21c865581b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customstepper/Index.ets
arkts
CustomStepperViewComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { CustomStepperViewComponent } from './src/main/ets/view/CustomStepperView';
AST#export_declaration#Left export { CustomStepperViewComponent } from './src/main/ets/view/CustomStepperView' ; AST#export_declaration#Right
export { CustomStepperViewComponent } from './src/main/ets/view/CustomStepperView';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/Index.ets#L15-L15
6c7993ab8157151fe946529834810d34112ac701
gitee
wustcat404/time-bar
d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
Get epoch milliseconds at today's 00:00:00. @returns Epoch ms of the start of today.
export function getTodayStartMs(): number { return dayjs().startOf('day').valueOf(); }
AST#export_declaration#Left export AST#function_declaration#Left function getTodayStartMs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left dayjs AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . startOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'day' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getTodayStartMs(): number { return dayjs().startOf('day').valueOf(); }
https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L45-L47
5073fb20777ab79a3f9d0b5cb7b78d2f720600cf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets
arkts
scalingComponents
缩放组件
@Builder scalingComponents() { Scroll(this.scrollerForScaling) { Column() { Grid() { LazyForEach(this.dataSource, (item: string) => { GridItem() { this.scalingContentComponent(item) } }, (item: string) => item) } .backgroundColor($r('app.color.key_board_page_background_color')) .cachedCount(Number($r('app.integer.key_board_grid_cache_count'))) } .id('KeyboardAvoidScalingComponents') .width($r('app.string.key_board_components_weight')) .alignItems(HorizontalAlign.Center) .justifyContent(FlexAlign.End) } .height($r('app.string.key_board_lift_up_components_height')) .layoutWeight(1) .visibility(this.isScalingShow ? Visibility.Visible : Visibility.None) .borderRadius($r('app.string.key_board_scenes_main_page_list_borderRadius')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right scalingComponents 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 Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scrollerForScaling AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Grid ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : 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#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scalingContentComponent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : 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#expression#Left item AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.key_board_page_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . cachedCount ( AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.key_board_grid_cache_count' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'KeyboardAvoidScalingComponents' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.key_board_components_weight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.key_board_lift_up_components_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isScalingShow AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.key_board_scenes_main_page_list_borderRadius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder scalingComponents() { Scroll(this.scrollerForScaling) { Column() { Grid() { LazyForEach(this.dataSource, (item: string) => { GridItem() { this.scalingContentComponent(item) } }, (item: string) => item) } .backgroundColor($r('app.color.key_board_page_background_color')) .cachedCount(Number($r('app.integer.key_board_grid_cache_count'))) } .id('KeyboardAvoidScalingComponents') .width($r('app.string.key_board_components_weight')) .alignItems(HorizontalAlign.Center) .justifyContent(FlexAlign.End) } .height($r('app.string.key_board_lift_up_components_height')) .layoutWeight(1) .visibility(this.isScalingShow ? Visibility.Visible : Visibility.None) .borderRadius($r('app.string.key_board_scenes_main_page_list_borderRadius')) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets#L116-L139
e822bdd2d8690a3ca4725650c595bd893ff3271e
gitee
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/datasource/BasicDataSource.ets
arkts
getDataSource
获取数据源
getDataSource(): Array<T> { return this.dataSource; }
AST#method_declaration#Left getDataSource 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 T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getDataSource(): Array<T> { return this.dataSource; }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L109-L111
a76162ff538ad08bfa2504227cb72a2cf82af908
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/goods/GoodsNavigator.ets
arkts
toCategory
跳转到商品分类 @param {GoodsCategoryParam} [params] - 商品分类参数 @returns {void} 无返回值
static toCategory(params?: GoodsCategoryParam): void { if (params) { navigateTo(GoodsRoutes.Category, params); return; } navigateTo(GoodsRoutes.Category); }
AST#method_declaration#Left static toCategory AST#parameter_list#Left ( AST#parameter#Left params ? : AST#type_annotation#Left AST#primary_type#Left GoodsCategoryParam 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 AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left params AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left navigateTo ( AST#expression#Left AST#member_expression#Left AST#expression#Left GoodsRoutes AST#expression#Right . Category AST#member_expression#Right AST#expression#Right , AST#expression#Left params AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expression#Left AST#expression#Left GoodsRoutes AST#expression#Right . Category AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static toCategory(params?: GoodsCategoryParam): void { if (params) { navigateTo(GoodsRoutes.Category, params); return; } navigateTo(GoodsRoutes.Category); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/goods/GoodsNavigator.ets#L44-L50
5d3118b2a58e15dc6df18c2eaa87fdb391cf9b06
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/main/sub/report/RadarView.ets
arkts
drawGuideLinesSquare
========== 绘制引导线 ========== ========== 绘制引导线(改为直线连接) ==========
private drawGuideLinesSquare(centerX: number, centerY: number, radius: number): void { this.ctx.strokeStyle = this.GUIDE_LINE_COLOR; this.ctx.lineWidth = 1; //this.ctx.setLineDash([5, 3]); // 虚线 const count = this.parts.length; if (count === 0) return; const angleStep = (2 * Math.PI) / count; // ---------- 多边形层 ---------- for (let i = 1; i <= this.guideLineCount; i++) { const r = radius * (i / this.guideLineCount); this.ctx.beginPath(); for (let j = 0; j < count; j++) { const angle = this.START_ANGLE_OFFSET + angleStep * j; const x = centerX + r * Math.cos(angle); const y = centerY + r * Math.sin(angle); if (j === 0) { this.ctx.moveTo(x, y); } else { this.ctx.lineTo(x, y); } } this.ctx.closePath(); this.ctx.stroke(); // ---------- 旁边的百分比文本 ---------- if (this.showPercentText) { const percent = `${(i / this.guideLineCount * 100).toFixed(0)}%`; this.ctx.fillStyle = this.GUIDE_LINE_COLOR; this.ctx.font = '10px sans-serif'; this.ctx.textAlign = 'center'; this.ctx.textBaseline = 'middle'; this.ctx.fillText(percent, centerX + r + 15, centerY); } } // ---------- 维度分隔线 ---------- this.ctx.setLineDash([]); for (let i = 0; i < count; i++) { const angle = this.START_ANGLE_OFFSET + angleStep * i; const endX = centerX + radius * Math.cos(angle); const endY = centerY + radius * Math.sin(angle); this.ctx.beginPath(); this.ctx.moveTo(centerX, centerY); this.ctx.lineTo(endX, endY); this.ctx.stroke(); } }
AST#method_declaration#Left private drawGuideLinesSquare AST#parameter_list#Left ( AST#parameter#Left centerX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left centerY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left radius : 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 AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . strokeStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . GUIDE_LINE_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . lineWidth AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //this.ctx.setLineDash([5, 3]); // 虚线 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left count = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parts AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left angleStep = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 2 AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . PI AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // ---------- 多边形层 ---------- AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right <= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . guideLineCount AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left r = AST#expression#Left AST#binary_expression#Left AST#expression#Left radius AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . guideLineCount AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . beginPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left j AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left angle = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . START_ANGLE_OFFSET AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left angleStep AST#expression#Right * AST#expression#Left j AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left x = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left centerX AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . cos AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left angle AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left y = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left centerY AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . sin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left angle AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . moveTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . lineTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . closePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . stroke AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // ---------- 旁边的百分比文本 ---------- AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showPercentText AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left percent = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . guideLineCount AST#member_expression#Right AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right % ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . GUIDE_LINE_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . font AST#member_expression#Right = AST#expression#Left '10px sans-serif' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . textAlign AST#member_expression#Right = AST#expression#Left 'center' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . textBaseline AST#member_expression#Right = AST#expression#Left 'middle' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . fillText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left percent AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left centerX AST#expression#Right + AST#expression#Left r AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 15 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left centerY AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // ---------- 维度分隔线 ---------- AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . setLineDash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left angle = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . START_ANGLE_OFFSET AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left angleStep AST#expression#Right * AST#expression#Left i AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left endX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left centerX AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left radius AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . cos AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left angle AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left endY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left centerY AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left radius AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . sin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left angle AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . beginPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . moveTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left centerX AST#expression#Right , AST#expression#Left centerY AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . lineTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left endX AST#expression#Right , AST#expression#Left endY AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . stroke AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private drawGuideLinesSquare(centerX: number, centerY: number, radius: number): void { this.ctx.strokeStyle = this.GUIDE_LINE_COLOR; this.ctx.lineWidth = 1; const count = this.parts.length; if (count === 0) return; const angleStep = (2 * Math.PI) / count; for (let i = 1; i <= this.guideLineCount; i++) { const r = radius * (i / this.guideLineCount); this.ctx.beginPath(); for (let j = 0; j < count; j++) { const angle = this.START_ANGLE_OFFSET + angleStep * j; const x = centerX + r * Math.cos(angle); const y = centerY + r * Math.sin(angle); if (j === 0) { this.ctx.moveTo(x, y); } else { this.ctx.lineTo(x, y); } } this.ctx.closePath(); this.ctx.stroke(); if (this.showPercentText) { const percent = `${(i / this.guideLineCount * 100).toFixed(0)}%`; this.ctx.fillStyle = this.GUIDE_LINE_COLOR; this.ctx.font = '10px sans-serif'; this.ctx.textAlign = 'center'; this.ctx.textBaseline = 'middle'; this.ctx.fillText(percent, centerX + r + 15, centerY); } } this.ctx.setLineDash([]); for (let i = 0; i < count; i++) { const angle = this.START_ANGLE_OFFSET + angleStep * i; const endX = centerX + radius * Math.cos(angle); const endY = centerY + radius * Math.sin(angle); this.ctx.beginPath(); this.ctx.moveTo(centerX, centerY); this.ctx.lineTo(endX, endY); this.ctx.stroke(); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L150-L205
a115b7040111c919e0cdc232780bb421744c9d8e
github
euler1129/Cloud-flash-payment.git
dfb70c1c67b3b69447f4384661e16b60f40495de
entry/src/main/ets/pages/home/RefreshImage.ets
arkts
this
设置属性
this.refreshConfigurator .setHasRefresh(true) // 是否具有下拉刷新功能 .setHasLoadMore(true) // 是否具有上拉加载功能 .setMaxTranslate(150) // 可下拉上拉的最大距离 .setSensitivity(12) // 下拉上拉灵敏度 .setListIsPlacement(false) // 滑动结束后列表是否归位 .setAnimDuration(300) // 滑动结束后,回弹动画执行时间 .setRefreshHeight(80) // 下拉动画高度 .setRefreshColor('#ff0000') // 下拉动画颜色 //.setRefreshBackgroundColor('#ffbbfaf5') // 下拉动画区域背景色 //.setRefreshTextColor('red') // 下拉加载完毕后提示文本的字体颜色 //.setRefreshTextSize(25) // 下拉加载完毕后提示文本的字体大小 .setRefreshAnimDuration(1000) // 下拉动画执行一次的时间 .setLoadImgHeight(50) // 上拉图片高度 .setLoadBackgroundColor('#F5F5F5') // 上拉动画区域背景色 .setLoadTextColor('#141414') // 上拉文本的字体颜色 //.setLoadTextSize(25) // 上拉文本的字体大小 //.setLoadTextPullUp1('请继续上拉...') // 上拉1阶段文本 //.setLoadTextPullUp2('释放即可刷新') // 上拉2阶段文本 .setLoadTextLoading('继续上滑进入优惠') // 上拉加载更多中时的文本
AST#method_declaration#Left this AST#ERROR#Left . refreshConfigurator . setH as Refresh AST#parameter_list#Left ( AST#parameter#Left true AST#parameter#Right ) AST#parameter_list#Right // 是否具有下拉刷新功能 . setH as LoadMore AST#parameter_list#Left ( AST#parameter#Left true AST#parameter#Right ) AST#parameter_list#Right // 是否具有上拉加载功能 . setMaxTranslate AST#parameter_list#Left ( AST#ERROR#Left 150 AST#ERROR#Right ) AST#parameter_list#Right // 可下拉上拉的最大距离 . setSensitivity AST#parameter_list#Left ( AST#ERROR#Left 12 AST#ERROR#Right ) AST#parameter_list#Right // 下拉上拉灵敏度 . set List IsPlacement AST#parameter_list#Left ( AST#parameter#Left false AST#parameter#Right ) AST#parameter_list#Right // 滑动结束后列表是否归位 . setAnimDuration AST#parameter_list#Left ( AST#ERROR#Left 300 AST#ERROR#Right ) AST#parameter_list#Right // 滑动结束后,回弹动画执行时间 . setRefreshHeight AST#parameter_list#Left ( AST#ERROR#Left 80 AST#ERROR#Right ) AST#parameter_list#Right // 下拉动画高度 . setRefreshColor AST#parameter_list#Left ( AST#ERROR#Left '#ff0000' AST#ERROR#Right ) AST#parameter_list#Right // 下拉动画颜色 //.setRefreshBackgroundColor('#ffbbfaf5') // 下拉动画区域背景色 //.setRefreshTextColor('red') // 下拉加载完毕后提示文本的字体颜色 //.setRefreshTextSize(25) // 下拉加载完毕后提示文本的字体大小 . setRefreshAnimDuration AST#parameter_list#Left ( AST#ERROR#Left 1000 AST#ERROR#Right ) AST#parameter_list#Right // 下拉动画执行一次的时间 . setLoadImgHeight AST#parameter_list#Left ( AST#ERROR#Left 50 AST#ERROR#Right ) AST#parameter_list#Right // 上拉图片高度 . setLoadBackgroundColor AST#parameter_list#Left ( AST#ERROR#Left '#F5F5F5' AST#ERROR#Right ) AST#parameter_list#Right // 上拉动画区域背景色 . setLoad Text Color AST#parameter_list#Left ( AST#ERROR#Left '#141414' AST#ERROR#Right ) AST#parameter_list#Right // 上拉文本的字体颜色 //.setLoadTextSize(25) // 上拉文本的字体大小 //.setLoadTextPullUp1('请继续上拉...') // 上拉1阶段文本 //.setLoadTextPullUp2('释放即可刷新') // 上拉2阶段文本 . setLoad Text Load in g AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left '继续上滑进入优惠' AST#ERROR#Right ) AST#parameter_list#Right // 上拉加载更多中时的文本 AST#method_declaration#Right
this.refreshConfigurator .setHasRefresh(true) .setHasLoadMore(true) .setMaxTranslate(150) .setSensitivity(12) .setListIsPlacement(false) .setAnimDuration(300) .setRefreshHeight(80) .setRefreshColor('#ff0000') .setRefreshAnimDuration(1000) .setLoadImgHeight(50) .setLoadBackgroundColor('#F5F5F5') .setLoadTextColor('#141414') .setLoadTextLoading('继续上滑进入优惠')
https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/home/RefreshImage.ets#L45-L64
9af4aa2fdfb77aadecb456a6d7638c551320bf90
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/image/ImageUtil.ets
arkts
createCompressedPixelMap
生成压缩图片 @param {Resource | image.PixelMap} src 未压缩的Resource图片或PixelMap对象 @param {number} maxSize 图像大小限制,默认不超过2MB @returns {Promise<image.PixelMap>} 返回压缩后的PixelMap对象
static async createCompressedPixelMap(src: Resource | image.PixelMap, maxSize: number = 2 * 1024 * 1024): Promise<image.PixelMap> { if (typeof (src as Resource).id == 'number') { src = await ImageUtil.getPixelMapFromResource((src as Resource)); } const pixelMap = src as image.PixelMap; let pixelBytes = pixelMap.getPixelBytesNumber(); // 总字节数 while (pixelBytes > maxSize) { await pixelMap.scale(0.7, 0.7, image.AntiAliasingLevel.LOW); pixelBytes = pixelMap.getPixelBytesNumber(); } return pixelMap; }
AST#method_declaration#Left static async createCompressedPixelMap 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#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 2 AST#expression#Right * AST#expression#Left 1024 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 1024 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#parameter#Right ) 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#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right == AST#expression#Left 'number' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left src = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left ImageUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getPixelMapFromResource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixelMap = AST#expression#Left AST#as_expression#Left AST#expression#Left src AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixelBytes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getPixelBytesNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 总字节数 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left pixelBytes AST#expression#Right > AST#expression#Left maxSize AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left pixelMap AST#expression#Right AST#await_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.7 AST#expression#Right , AST#expression#Left 0.7 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . AntiAliasingLevel AST#member_expression#Right AST#expression#Right . LOW AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left pixelBytes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getPixelBytesNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left pixelMap AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static async createCompressedPixelMap(src: Resource | image.PixelMap, maxSize: number = 2 * 1024 * 1024): Promise<image.PixelMap> { if (typeof (src as Resource).id == 'number') { src = await ImageUtil.getPixelMapFromResource((src as Resource)); } const pixelMap = src as image.PixelMap; let pixelBytes = pixelMap.getPixelBytesNumber(); while (pixelBytes > maxSize) { await pixelMap.scale(0.7, 0.7, image.AntiAliasingLevel.LOW); pixelBytes = pixelMap.getPixelBytesNumber(); } return pixelMap; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/image/ImageUtil.ets#L98-L109
1c92375030d09b27b3f05edb405d847d03430f3d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets
arkts
query
query taskInfo @param date @param callback
query(date: string, isOpen: boolean = true, callback: Function): void { let tableName = Const.TASK_INFO.tableName; if (!tableName) { return; } let predicates = new dataRdb.RdbPredicates(tableName); predicates.equalTo('date', date); if (isOpen) { predicates.equalTo('isOpen', true); } predicates.orderByAsc('taskID'); RdbUtils.query(predicates).then(resultSet => { let count = resultSet.rowCount; if (count === 0 || typeof count === 'string') { Logger.error('TaskInfoTable', `${date} query no results!`); const result: TaskInfo[] = []; callback(result); } else { resultSet.goToFirstRow(); const result: TaskInfo[] = []; for (let i = 0; i < count; i++) { let tmp = new TaskInfo(0, '', 0, '', false, '', '', '', false, ''); tmp.isOpen = resultSet.getDouble(resultSet.getColumnIndex('isOpen')) ? true : false; tmp.id = resultSet.getDouble(resultSet.getColumnIndex('id')); tmp.date = resultSet.getString(resultSet.getColumnIndex('date')); tmp.taskID = resultSet.getDouble(resultSet.getColumnIndex('taskID')); tmp.targetValue = resultSet.getString(resultSet.getColumnIndex('targetValue')); tmp.isAlarm = resultSet.getDouble(resultSet.getColumnIndex('isAlarm')) ? true : false; tmp.startTime = resultSet.getString(resultSet.getColumnIndex('startTime')); tmp.endTime = resultSet.getString(resultSet.getColumnIndex('endTime')); tmp.frequency = resultSet.getString(resultSet.getColumnIndex('frequency')); tmp.isDone = resultSet.getDouble(resultSet.getColumnIndex('isDone')) ? true : false; tmp.finValue = resultSet.getString(resultSet.getColumnIndex('finValue')); result[i] = tmp; resultSet.goToNextRow(); } callback(result); } }); }
AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isOpen : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tableName = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . TASK_INFO AST#member_expression#Right AST#expression#Right . tableName AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left tableName AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left predicates = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left dataRdb AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tableName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'date' AST#expression#Right , AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isOpen AST#expression#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 predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'isOpen' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . orderByAsc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'taskID' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RdbUtils AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left resultSet => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count = AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . rowCount AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left count AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'TaskInfoTable' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left date AST#expression#Right } AST#template_substitution#Right query no results! ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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 resultSet AST#expression#Right . goToFirstRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tmp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TaskInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left '' AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left '' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right , AST#expression#Left '' AST#expression#Right , AST#expression#Left '' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . isOpen AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'isOpen' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . date AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'date' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . taskID AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'taskID' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . targetValue AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'targetValue' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . isAlarm AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'isAlarm' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . startTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'startTime' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . endTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'endTime' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . frequency AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'frequency' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . isDone AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'isDone' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left tmp AST#expression#Right . finValue AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'finValue' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = tmp AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
query(date: string, isOpen: boolean = true, callback: Function): void { let tableName = Const.TASK_INFO.tableName; if (!tableName) { return; } let predicates = new dataRdb.RdbPredicates(tableName); predicates.equalTo('date', date); if (isOpen) { predicates.equalTo('isOpen', true); } predicates.orderByAsc('taskID'); RdbUtils.query(predicates).then(resultSet => { let count = resultSet.rowCount; if (count === 0 || typeof count === 'string') { Logger.error('TaskInfoTable', `${date} query no results!`); const result: TaskInfo[] = []; callback(result); } else { resultSet.goToFirstRow(); const result: TaskInfo[] = []; for (let i = 0; i < count; i++) { let tmp = new TaskInfo(0, '', 0, '', false, '', '', '', false, ''); tmp.isOpen = resultSet.getDouble(resultSet.getColumnIndex('isOpen')) ? true : false; tmp.id = resultSet.getDouble(resultSet.getColumnIndex('id')); tmp.date = resultSet.getString(resultSet.getColumnIndex('date')); tmp.taskID = resultSet.getDouble(resultSet.getColumnIndex('taskID')); tmp.targetValue = resultSet.getString(resultSet.getColumnIndex('targetValue')); tmp.isAlarm = resultSet.getDouble(resultSet.getColumnIndex('isAlarm')) ? true : false; tmp.startTime = resultSet.getString(resultSet.getColumnIndex('startTime')); tmp.endTime = resultSet.getString(resultSet.getColumnIndex('endTime')); tmp.frequency = resultSet.getString(resultSet.getColumnIndex('frequency')); tmp.isDone = resultSet.getDouble(resultSet.getColumnIndex('isDone')) ? true : false; tmp.finValue = resultSet.getString(resultSet.getColumnIndex('finValue')); result[i] = tmp; resultSet.goToNextRow(); } callback(result); } }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets#L82-L121
3706bd44ecced7fa44e3dc7ae981740a1e78e1b1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets
arkts
列表内容
constructor(id: Resource, title: Resource, content: Resource | string) { this.id = id; this.title = title; this.content = content; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor(id: Resource, title: Resource, content: Resource | string) { this.id = id; this.title = title; this.content = content; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets#L34-L38
6fd3220166482ed98fffa93cabff09d9ee238d4b
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/ValidationUtils.ets
arkts
isValidIdCard
验证身份证(18位)
static isValidIdCard(idCard: string): boolean { const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/; return idCardRegex.test(idCard); }
AST#method_declaration#Left static isValidIdCard AST#parameter_list#Left ( AST#parameter#Left idCard : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left idCardRegex = AST#ERROR#Left / ^ AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right \d AST#expression#Left AST#call_expression#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 5 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 18 AST#expression#Right | AST#expression#Left 19 AST#expression#Right AST#binary_expression#Right AST#expression#Right | AST#expression#Left 20 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right \d AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 2 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left 0 AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right | AST#expression#Left AST#subscript_expression#Left AST#expression#Left 1 AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left 0 AST#expression#Right - AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left 0 AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right | AST#expression#Left AST#array_literal#Left [ AST#expression#Left 12 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left \d AST#ERROR#Right | AST#expression#Left AST#subscript_expression#Left AST#expression#Left 3 AST#expression#Right [ AST#expression#Left 01 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right \d AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left 3 AST#property_name#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left [ AST#ERROR#Left \dXx ] AST#ERROR#Right $ / AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left idCardRegex AST#expression#Right . test AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left idCard AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isValidIdCard(idCard: string): boolean { const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/; return idCardRegex.test(idCard); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ValidationUtils.ets#L25-L28
baf13f7f2baa1e150f525fe79b9cca5aac8c12f8
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
isWeekend
判断指定的日期在日历中是否为周末 @param date @returns
static isWeekend(date?: number | string | Date) { const day = DateUtils.getFormatDate(date).getDay(); //getDay() 方法返回值:0(周日) 到 6(周六) return day === 0 || day === 6; //周六(6)或周日(0)都视为周末 }
AST#method_declaration#Left static isWeekend AST#parameter_list#Left ( AST#parameter#Left date ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left day = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . getFormatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //getDay() 方法返回值:0(周日) 到 6(周六) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left day AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left day AST#expression#Right === AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right //周六(6)或周日(0)都视为周末 } AST#block_statement#Right AST#method_declaration#Right
static isWeekend(date?: number | string | Date) { const day = DateUtils.getFormatDate(date).getDay(); return day === 0 || day === 6; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L232-L235
c2fa5f3faad0a91be9236ae3111aaa7d338a7478
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CategoryPage.ets
arkts
buildCategoryGrid
构建分类网格 @param {CategoryTree[]} children - 子分类列表 @returns {void} 无返回值
@Builder private buildCategoryGrid(children: CategoryTree[]): void { Grid() { ForEach(children, (item: CategoryTree): void => { GridItem() { this.buildCategoryItem(item); }; }, (item: CategoryTree): string => `${item.id}-${item.name}`); } .columnsTemplate(this.getCategoryColumnsTemplate()) .columnsGap($r("app.float.space_padding_small")) .rowsGap($r("app.float.space_padding_small")) .width(P100); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildCategoryGrid AST#parameter_list#Left ( AST#parameter#Left children : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CategoryTree [ ] AST#array_type#Right 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 AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Grid ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left children AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CategoryTree 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 AST#type_annotation#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildCategoryItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CategoryTree 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#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCategoryColumnsTemplate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_small" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_small" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private buildCategoryGrid(children: CategoryTree[]): void { Grid() { ForEach(children, (item: CategoryTree): void => { GridItem() { this.buildCategoryItem(item); }; }, (item: CategoryTree): string => `${item.id}-${item.name}`); } .columnsTemplate(this.getCategoryColumnsTemplate()) .columnsGap($r("app.float.space_padding_small")) .rowsGap($r("app.float.space_padding_small")) .width(P100); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L149-L162
9b8af4b63d9e87c8ea8adedf3af6df2e7befa70d
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.fs.d.ets
arkts
File filter type @interface Filter @syscap SystemCapability.FileManagement.File.FileIO @since 20
export interface Filter { /** * The suffix of the file. * * @type { ?Array<string> } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ suffix?: Array<string>; /** * The display name of the file. * * @type { ?Array<string> } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ displayName?: Array<string>; /** * The mimetype of the file. * * @type { ?Array<string> } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ mimeType?: Array<string>; /** * The exceeding size of the file. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ fileSizeOver?: number; /** * The last modification time of the file. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ lastModifiedAfter?: number; /** * Whether to exclude media files. * * @type { ?boolean } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ excludeMedia?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Filter AST#object_type#Left { /** * The suffix of the file. * * @type { ?Array<string> } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left suffix ? : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The display name of the file. * * @type { ?Array<string> } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left displayName ? : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The mimetype of the file. * * @type { ?Array<string> } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left mimeType ? : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The exceeding size of the file. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left fileSizeOver ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The last modification time of the file. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left lastModifiedAfter ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Whether to exclude media files. * * @type { ?boolean } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left excludeMedia ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface Filter { suffix?: Array<string>; displayName?: Array<string>; mimeType?: Array<string>; fileSizeOver?: number; lastModifiedAfter?: number; excludeMedia?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4242-L4297
6cebbc58fba8afab404b8a9719ded70dacc012a4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/TimedReminderService.ets
arkts
提醒配置接口
export interface ReminderConfig { id: string; type: ReminderType; title: string; content: string; triggerTime: Date; repeatType?: reminderAgentManager.ReminderType; contactId?: string; metadata?: Record<string, string>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ReminderConfig AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left ReminderType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left triggerTime : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left repeatType ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left reminderAgentManager . ReminderType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left contactId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left metadata ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ReminderConfig { id: string; type: ReminderType; title: string; content: string; triggerTime: Date; repeatType?: reminderAgentManager.ReminderType; contactId?: string; metadata?: Record<string, string>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L20-L29
99536b75edc35d24b2dba1dc4f1c25501846ac10
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets
arkts
滑动系数
build() { Column() { Stack() { Image(this.resource.getImg()) .width('100%') .height('100%') .borderRadius(20) .shadow({ radius: 20, color: $r('app.color.btn_border_color') }) } .width('100%') .height('100%') .scale({ x: this.scaleX, y: this.scaleX, z: this.scaleX, }) .rotate({ x: 1, y: 0, z: 0, centerX: '50%', centerY: '100%', angle: this.angle }) .translate({ x: 0, y: this.translateY, z: this.translateY }) .opacity(this.sx) } .borderRadius(20) .justifyContent(FlexAlign.Center) .gesture( PanGesture(this.panOption) .onActionStart((event: GestureEvent) => { console.info('Pan start'); }) .onActionUpdate((event: GestureEvent) => { let sx: number = 0; if (event.offsetY - this.offsetY <= 0) { sx = (this.sx - Math.abs(event.offsetY - this.offsetY) / this.windowHeight); } else if (event.offsetY - this.offsetY > 0) { sx = (this.sx + Math.abs(event.offsetY - this.offsetY) / this.windowHeight); } this.move(sx); this.offsetX = event.offsetX; this.offsetY = event.offsetY; }) .onActionEnd(() => { this.offsetX = 0; this.offsetY = 0; console.info('Pan end'); if (this.scaleX >= 0.15 && this.scaleX < 1) { this.restore(); } else if (this.scaleX < 0.15) { this.delete(); } }) ) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resource AST#member_expression#Right AST#expression#Right . getImg AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.btn_border_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleX AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleX AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleX AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerX AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerY AST#property_name#Right : AST#expression#Left '100%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translateY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translateY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sx AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . gesture ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left PanGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . panOption AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Pan start' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionUpdate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right <= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sx = AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sx AST#member_expression#Right AST#expression#Right - AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . windowHeight AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sx = AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sx AST#member_expression#Right AST#expression#Right + AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . windowHeight AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sx AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetY AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offsetY AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Pan end' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleX AST#member_expression#Right AST#expression#Right >= AST#expression#Left 0.15 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scaleX AST#member_expression#Right AST#expression#Right < AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#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 this AST#expression#Right . restore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleX AST#member_expression#Right AST#expression#Right < AST#expression#Left 0.15 AST#expression#Right AST#binary_expression#Right AST#expression#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 this AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Column() { Stack() { Image(this.resource.getImg()) .width('100%') .height('100%') .borderRadius(20) .shadow({ radius: 20, color: $r('app.color.btn_border_color') }) } .width('100%') .height('100%') .scale({ x: this.scaleX, y: this.scaleX, z: this.scaleX, }) .rotate({ x: 1, y: 0, z: 0, centerX: '50%', centerY: '100%', angle: this.angle }) .translate({ x: 0, y: this.translateY, z: this.translateY }) .opacity(this.sx) } .borderRadius(20) .justifyContent(FlexAlign.Center) .gesture( PanGesture(this.panOption) .onActionStart((event: GestureEvent) => { console.info('Pan start'); }) .onActionUpdate((event: GestureEvent) => { let sx: number = 0; if (event.offsetY - this.offsetY <= 0) { sx = (this.sx - Math.abs(event.offsetY - this.offsetY) / this.windowHeight); } else if (event.offsetY - this.offsetY > 0) { sx = (this.sx + Math.abs(event.offsetY - this.offsetY) / this.windowHeight); } this.move(sx); this.offsetX = event.offsetX; this.offsetY = event.offsetY; }) .onActionEnd(() => { this.offsetX = 0; this.offsetY = 0; console.info('Pan end'); if (this.scaleX >= 0.15 && this.scaleX < 1) { this.restore(); } else if (this.scaleX < 0.15) { this.delete(); } }) ) }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets#L31-L94
2f9cba1a6fde6360bf1b368cd59f6436515a638e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
getSlot
获取一个指定类型的通知渠道。 @param type 要创建的通知渠道的类型
static async getSlot(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> { return notificationManager.getSlot(type); }
AST#method_declaration#Left static async getSlot AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationSlot AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . getSlot AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async getSlot(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> { return notificationManager.getSlot(type); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L370-L372
0a9543c8af88aaa93908d619090e649f7e2a2d46
gitee
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/pages/Index.ets
arkts
changeTab
切换到指定标签页(供子组件调用)
private changeTab(index: number): void { hilog.info(DOMAIN, TAG, 'Changing tab to: %{public}d', index); this.tabsController.changeIndex(index); this.currentTabIndex = index; }
AST#method_declaration#Left private changeTab 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#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Changing tab to: %{public}d' AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabsController AST#member_expression#Right AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
private changeTab(index: number): void { hilog.info(DOMAIN, TAG, 'Changing tab to: %{public}d', index); this.tabsController.changeIndex(index); this.currentTabIndex = index; }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/Index.ets#L39-L43
b75d64e6f0b523c81071543558f219f39dc983ab
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets
arkts
setSourceInfo
视频信息上报函数
async setSourceInfo(): Promise<void> { this.isLoadingVideo = false; // 视频未加载完成 this.isLoading = true; // 加载动画继续加载 // 时间上报函数 this.avPlayer.on('timeUpdate', (time: number) => { this.callbackTimeUpdate(time); }); // 音量变化回调函数 this.avPlayer.on('volumeChange', (vol: number) => { logger.info('volumeChange success,and new volume is :' + vol); }); // 视频播放结束触发回调 this.avPlayer.on('endOfStream', () => { logger.info('endOfStream success'); }); // seek操作回调函数 this.avPlayer.on('seekDone', (seekDoneTime: number) => { logger.info('seekDone success,and seek time is:' + seekDoneTime); }); // 视频总时长上报函数 this.avPlayer.on('durationUpdate', (duration: number) => { logger.info('durationUpdate success,and durationUpdate is:' + duration); }); // 设置倍速播放回调函数 this.avPlayer.on('speedDone', (speed: number) => { logger.info('speedDone success,and speed value is:' + speed); }); // bitrate设置成功回调函数 this.avPlayer.on('bitrateDone', (bitrate: number) => { logger.info('bitrateDone success,and bitrate value is:' + bitrate); }); // 缓冲上报回调函数 this.avPlayer.on('bufferingUpdate', (infoType: media.BufferingInfoType, value: number) => { logger.info('bufferingUpdate success,and infoType value is:' + infoType + ', value is :' + value); }); // 首帧上报回调函数 this.avPlayer.on('startRenderFrame', () => { logger.info('startRenderFrame success 1'); }); // 视频宽高上报回调函数 this.avPlayer.on('videoSizeChange', (width: number, height: number) => { logger.info('videoSizeChange success,and width is:' + width + ', height is :' + height); }); // 焦点上报回调函数 this.avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { // 触发焦点上报后调用暂停接口暂停播放 logger.info('audioInterrupt success,and InterruptEvent info is:' + JSON.stringify(info)); }); // HLS上报所有支持的比特率 this.avPlayer.on('availableBitrates', (bitrates: number[]) => { logger.info('availableBitrates success,and availableBitrates length is:' + bitrates.length); this.callbackBitrateUpdate(bitrates); }); // 设置错误监听 this.avPlayer.on('error', (error) => { logger.error('error happened,message is :' + error.message); this.callbackErrorUpdate('Error ' + error.code + ' - ' + error.message); }); }
AST#method_declaration#Left async setSourceInfo 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#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoadingVideo AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 视频未加载完成 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 加载动画继续加载 // 时间上报函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'timeUpdate' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left time : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callbackTimeUpdate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left time AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 音量变化回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'volumeChange' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left vol : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'volumeChange success,and new volume is :' AST#expression#Right + AST#expression#Left vol AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 视频播放结束触发回调 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'endOfStream' AST#expression#Right , AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'endOfStream success' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // seek操作回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seekDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left seekDoneTime : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'seekDone success,and seek time is:' AST#expression#Right + AST#expression#Left seekDoneTime AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 视频总时长上报函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'durationUpdate' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left duration : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'durationUpdate success,and durationUpdate is:' AST#expression#Right + AST#expression#Left duration AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 设置倍速播放回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'speedDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left speed : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'speedDone success,and speed value is:' AST#expression#Right + AST#expression#Left speed AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // bitrate设置成功回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bitrateDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bitrate : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'bitrateDone success,and bitrate value is:' AST#expression#Right + AST#expression#Left bitrate AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 缓冲上报回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bufferingUpdate' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left infoType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . BufferingInfoType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'bufferingUpdate success,and infoType value is:' AST#expression#Right + AST#expression#Left infoType AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ', value is :' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 首帧上报回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'startRenderFrame' AST#expression#Right , AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'startRenderFrame success 1' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 视频宽高上报回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'videoSizeChange' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'videoSizeChange success,and width is:' AST#expression#Right + AST#expression#Left width AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ', height is :' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left height AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 焦点上报回调函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'audioInterrupt' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left audio . InterruptEvent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 触发焦点上报后调用暂停接口暂停播放 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'audioInterrupt success,and InterruptEvent info is:' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left info AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // HLS上报所有支持的比特率 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'availableBitrates' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bitrates : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'availableBitrates success,and availableBitrates length is:' AST#expression#Right + AST#expression#Left bitrates AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callbackBitrateUpdate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bitrates AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 设置错误监听 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right ) 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 logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'error happened,message is :' AST#expression#Right + AST#expression#Left error AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callbackErrorUpdate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Error ' AST#expression#Right + AST#expression#Left error AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right + AST#expression#Left ' - ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left error AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
async setSourceInfo(): Promise<void> { this.isLoadingVideo = false; this.isLoading = true; this.avPlayer.on('timeUpdate', (time: number) => { this.callbackTimeUpdate(time); }); this.avPlayer.on('volumeChange', (vol: number) => { logger.info('volumeChange success,and new volume is :' + vol); }); this.avPlayer.on('endOfStream', () => { logger.info('endOfStream success'); }); this.avPlayer.on('seekDone', (seekDoneTime: number) => { logger.info('seekDone success,and seek time is:' + seekDoneTime); }); this.avPlayer.on('durationUpdate', (duration: number) => { logger.info('durationUpdate success,and durationUpdate is:' + duration); }); this.avPlayer.on('speedDone', (speed: number) => { logger.info('speedDone success,and speed value is:' + speed); }); this.avPlayer.on('bitrateDone', (bitrate: number) => { logger.info('bitrateDone success,and bitrate value is:' + bitrate); }); this.avPlayer.on('bufferingUpdate', (infoType: media.BufferingInfoType, value: number) => { logger.info('bufferingUpdate success,and infoType value is:' + infoType + ', value is :' + value); }); this.avPlayer.on('startRenderFrame', () => { logger.info('startRenderFrame success 1'); }); this.avPlayer.on('videoSizeChange', (width: number, height: number) => { logger.info('videoSizeChange success,and width is:' + width + ', height is :' + height); }); this.avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { logger.info('audioInterrupt success,and InterruptEvent info is:' + JSON.stringify(info)); }); this.avPlayer.on('availableBitrates', (bitrates: number[]) => { logger.info('availableBitrates success,and availableBitrates length is:' + bitrates.length); this.callbackBitrateUpdate(bitrates); }); this.avPlayer.on('error', (error) => { logger.error('error happened,message is :' + error.message); this.callbackErrorUpdate('Error ' + error.code + ' - ' + error.message); }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L152-L210
1063dfe76759d10f7a7e77bed0623be50ab9c3d6
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets
arkts
blurFirstAnim
向外翻转90°同时
blurFirstAnim() { Logger.info(TAG, 'blurFirstAnim E'); // 初始化动效参数 this.shotImgBlur = 0; //无模糊 this.shotImgOpacity = 1; //不透明 this.shotImgScale = { x: 1, y: 1 }; animateToImmediately( { duration: BlurAnimateUtil.ROTATION_DURATION, curve: Curve.Sharp, onFinish: () => { Logger.info(TAG, 'blurFirstAnim X'); this.blurSecondAnim(); } }, () => { // 截图模糊度变化动效 this.shotImgBlur = BlurAnimateUtil.ANIM_MODE_SWITCH_BLUR; // 截图比例动效 this.shotImgScale = { x: BlurAnimateUtil.IMG_SCALE, y: BlurAnimateUtil.IMG_SCALE }; } ); }
AST#method_declaration#Left blurFirstAnim 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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'blurFirstAnim E' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 初始化动效参数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shotImgBlur AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //无模糊 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shotImgOpacity AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //不透明 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shotImgScale AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateToImmediately AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BlurAnimateUtil AST#expression#Right . ROTATION_DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Sharp AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFinish AST#property_name#Right : AST#expression#Left AST#arrow_function#Left 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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'blurFirstAnim X' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . blurSecondAnim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 截图模糊度变化动效 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shotImgBlur AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BlurAnimateUtil AST#expression#Right . ANIM_MODE_SWITCH_BLUR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 截图比例动效 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shotImgScale AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BlurAnimateUtil AST#expression#Right . IMG_SCALE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BlurAnimateUtil AST#expression#Right . IMG_SCALE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
blurFirstAnim() { Logger.info(TAG, 'blurFirstAnim E'); this.shotImgBlur = 0; this.shotImgOpacity = 1; this.shotImgScale = { x: 1, y: 1 }; animateToImmediately( { duration: BlurAnimateUtil.ROTATION_DURATION, curve: Curve.Sharp, onFinish: () => { Logger.info(TAG, 'blurFirstAnim X'); this.blurSecondAnim(); } }, () => { this.shotImgBlur = BlurAnimateUtil.ANIM_MODE_SWITCH_BLUR; this.shotImgScale = { x: BlurAnimateUtil.IMG_SCALE, y: BlurAnimateUtil.IMG_SCALE }; } ); }
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets#L239-L261
b1fae99c7f513422e3b5b5816915d9b41e59a78b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/LinkDataModel.ets
arkts
initial data model.
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/LinkDataModel.ets#L19-L19
317bbe676a9f46470233f6206311d5d065aeadcc
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
getJobTypeText
获取工作类型显示文本
getJobTypeText(): string { switch (this.jobType) { case JobType.FULL_TIME: return '全职'; case JobType.PART_TIME: return '兼职'; case JobType.INTERN: return '实习'; case JobType.CONTRACT: return '合同工'; default: return '未知'; } }
AST#method_declaration#Left getJobTypeText 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . jobType AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JobType AST#expression#Right . FULL_TIME AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '全职' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JobType AST#expression#Right . PART_TIME AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '兼职' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JobType AST#expression#Right . INTERN AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '实习' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JobType AST#expression#Right . CONTRACT AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '合同工' AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left '未知' AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
getJobTypeText(): string { switch (this.jobType) { case JobType.FULL_TIME: return '全职'; case JobType.PART_TIME: return '兼职'; case JobType.INTERN: return '实习'; case JobType.CONTRACT: return '合同工'; default: return '未知'; } }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L108-L121
d8328a5fd740782cdc459e8c6bc890940cf51a45
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
使用行为事件 事件数据接口
export interface AppLaunchEventData { sessionId: string; timestamp: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AppLaunchEventData AST#object_type#Left { AST#type_member#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left timestamp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface AppLaunchEventData { sessionId: string; timestamp: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L241-L244
c6b500f51e151775e1362c2c50e037f16e28327f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/mainpage/DragToSwitchPictures.ets
arkts
DragToSwitchPicturesComponent
功能描述: 本示例使用滑动手势监听,实时调整左右两侧内容显示区域大小和效果。通过绑定gesture事件中的PanGesture平移手势,实时获取拖动距离。当拖动时,实时地调节左右两个Image组件的宽度,从而成功实现左右拖动切换图片效果的功能 推荐场景: 调整左右两侧内容显示区域大小和效果 核心组件: 1. onActionUpdate 实现步骤: 1.创建三个Stack组件,用来展示装修前后对比图,第一个和第三个Stack分别存放装修前的图片和装修后的图片,zIndex设置为1。第二个Stack存放按钮的图片,zIndex设置为2,这样按钮的图片就会覆盖在两张装修图片之上。 2.将Image组件放在Row容器里,将Row容器的宽度设置为状态变量,再利用clip属性对于Row容器进行裁剪。 3.右边的Image组件与左边同样的操作,但是新增了一个direction属性,使元素从右至左进行布局,为的是让Row从左侧开始裁剪。 4.中间的Image组件通过手势事件中的滑动手势对Image组件滑动进行监听,对左右Image组件的宽度进行计算从而重新布局渲染。
@Component export struct DragToSwitchPicturesComponent { build() { Scroll() { Column() { // AI设计视图 DesignCattleView(); // 瀑布流视图 TabsWaterFlowView(); } .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.dragtoswitchpictures_home_page_backgroundcolor')) } .width($r('app.string.dragtoswitchpictures_full_size')) .height($r('app.string.dragtoswitchpictures_full_size')) .scrollBar(BarState.Off) .scrollable(ScrollDirection.Vertical) .zIndex(CONFIGURATION.ZINDEX1) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DragToSwitchPicturesComponent 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 Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // AI设计视图 AST#ui_custom_component_statement#Left DesignCattleView ( ) ; AST#ui_custom_component_statement#Right // 瀑布流视图 AST#ui_custom_component_statement#Left TabsWaterFlowView ( ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.dragtoswitchpictures_home_page_backgroundcolor' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.dragtoswitchpictures_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.dragtoswitchpictures_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollable ( AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollDirection AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left AST#member_expression#Left AST#expression#Left CONFIGURATION AST#expression#Right . ZINDEX1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct DragToSwitchPicturesComponent { build() { Scroll() { Column() { DesignCattleView(); TabsWaterFlowView(); } .justifyContent(FlexAlign.Center) .backgroundColor($r('app.color.dragtoswitchpictures_home_page_backgroundcolor')) } .width($r('app.string.dragtoswitchpictures_full_size')) .height($r('app.string.dragtoswitchpictures_full_size')) .scrollBar(BarState.Off) .scrollable(ScrollDirection.Vertical) .zIndex(CONFIGURATION.ZINDEX1) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/mainpage/DragToSwitchPictures.ets#L34-L54
5df4c476b8359db9774af6de4970e51367d2e375
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets
arkts
encodeECB
加密-ECB模式 @param str 待加密的字符串 @param sm4Key SM4密钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns
static encodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeECB 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . encodeECB AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left sm4Key AST#expression#Right , AST#expression#Left 'SM4_128' AST#expression#Right , AST#expression#Left 'SM4_128|ECB|PKCS7' AST#expression#Right , AST#expression#Left 128 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static encodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L45-L48
b10d686b3587a3873eead58425575bc1413ff06e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/view/VideoMask.ets
arkts
是否展示全局弹窗
build() { // 展示视频信息 Stack({ alignContent: Alignment.BottomStart }) { // 视频播放组件 Stack({ alignContent: Alignment.TopEnd }) { // 展示视频播放界面右侧用户头像、视频评论数量、收藏数量、分享数量等信息 Side({ head: this.videoData.videoMask.head, likeCount: this.videoData.videoMask.likeCount, commentCount: this.videoData.videoMask.commentCount, favoriteCount: this.videoData.videoMask.favoriteCount, shareCount: this.videoData.videoMask.shareCount, commentData: this.videoData.videoMask.commentDataSource }) } .width($r('app.string.shortvideo_hundred_percent')) .height($r('app.string.shortvideo_hundred_percent')) .padding($r("app.integer.shortvideo_stack_padding")) // 展示视频播放界面左下角作者名字、作品描述等相关信息 VideoDes({ name: this.videoData.videoMask.name, description: this.videoData.videoMask.description, hotspot: this.videoData.videoMask.hotspot, time: this.videoData.videoMask.time }) .margin({ bottom: $r("app.integer.shortvideo_video_des_margin_bottom") }) Row() { Row() { Image($r("app.media.shortvideo_ic_public_upgrade_filled")) .height($r("app.integer.shortvideo_upgrade_icon_size")) .width($r("app.integer.shortvideo_upgrade_icon_size")) Text($r("app.string.shortvideo_upgrade_hot")) .fontSize($r("app.integer.shortvideo_upgrade_text_font_size")) .fontColor($r("app.color.shortvideo_up_color")) Text(' · ' + this.videoData.videoMask.hotspot) .fontSize($r("app.integer.shortvideo_mus_font_size")) .maxLines(1) .width(this.videoData.videoMask.hotspot.length * 12) .fontColor(Color.White) .height($r("app.integer.shortvideo_mus_height")) .textOverflow({ overflow: TextOverflow.Ellipsis }) .layoutWeight(1) } .width($r('app.string.shortvideo_upgrade_hot_width')) // 上升热点 Row() { Divider() .vertical(true) .color(Color.White) .strokeWidth(1) .height($r("app.integer.shortvideo_upgrade_text_font_size")) .margin({ left: $r("app.integer.shortvideo_upgrade_margin"), right: $r("app.integer.shortvideo_upgrade_margin") }) Text($r("app.string.shortvideo_online_people")) .fontSize($r("app.integer.shortvideo_mus_font_size")) .fontColor(Color.White) Image($r("app.media.shortvideo_ic_arrow_right")) .width($r("app.integer.shortvideo_upgrade_text_font_size")) } .layoutWeight(1) .justifyContent(FlexAlign.End) } .width($r('app.string.shortvideo_hundred_percent')) .height($r("app.integer.shortvideo_upgrade_height")) .backgroundColor(Color.Gray) .opacity($r("app.float.shortvideo_fabulous_opacity")) .padding({ left: $r("app.integer.shortvideo_upgrade_padding"), right: $r("app.integer.shortvideo_upgrade_padding") }) .justifyContent(FlexAlign.Start) .onClick(() => { // 调用Toast显示提示:此样式仅为案例演示 promptAction.showToast({ message: $r("app.string.shortvideo_demo_toast_tips") }); }) }.width($r('app.string.shortvideo_hundred_percent')) .height($r('app.string.shortvideo_hundred_percent')) .padding($r("app.integer.shortvideo_stack_padding")) .hitTestBehavior(HitTestMode.Transparent) }
AST#build_method#Left build ( ) AST#build_body#Left { // 展示视频信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . BottomStart AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 视频播放组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopEnd AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 展示视频播放界面右侧用户头像、视频评论数量、收藏数量、分享数量等信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Side ( AST#component_parameters#Left { AST#component_parameter#Left head : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . head AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left likeCount : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . likeCount AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left commentCount : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . commentCount AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left favoriteCount : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . favoriteCount AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left shareCount : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . shareCount AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left commentData : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . commentDataSource AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shortvideo_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shortvideo_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_stack_padding" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 展示视频播放界面左下角作者名字、作品描述等相关信息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left VideoDes ( AST#component_parameters#Left { AST#component_parameter#Left name : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left description : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . description AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hotspot : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . hotspot AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left time : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . time AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_video_des_margin_bottom" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.shortvideo_ic_public_upgrade_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_icon_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_icon_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.shortvideo_upgrade_hot" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_text_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.shortvideo_up_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ' · ' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . hotspot AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_mus_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoData AST#member_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . hotspot AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right * AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_mus_height" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shortvideo_upgrade_hot_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 上升热点 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_text_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_margin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_margin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.shortvideo_online_people" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_mus_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.shortvideo_ic_arrow_right" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_text_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shortvideo_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_height" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.shortvideo_fabulous_opacity" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_padding" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_upgrade_padding" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 调用Toast显示提示:此样式仅为案例演示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.shortvideo_demo_toast_tips" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shortvideo_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shortvideo_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.shortvideo_stack_padding" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . hitTestBehavior ( AST#expression#Left AST#member_expression#Left AST#expression#Left HitTestMode AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Stack({ alignContent: Alignment.BottomStart }) { Stack({ alignContent: Alignment.TopEnd }) { Side({ head: this.videoData.videoMask.head, likeCount: this.videoData.videoMask.likeCount, commentCount: this.videoData.videoMask.commentCount, favoriteCount: this.videoData.videoMask.favoriteCount, shareCount: this.videoData.videoMask.shareCount, commentData: this.videoData.videoMask.commentDataSource }) } .width($r('app.string.shortvideo_hundred_percent')) .height($r('app.string.shortvideo_hundred_percent')) .padding($r("app.integer.shortvideo_stack_padding")) VideoDes({ name: this.videoData.videoMask.name, description: this.videoData.videoMask.description, hotspot: this.videoData.videoMask.hotspot, time: this.videoData.videoMask.time }) .margin({ bottom: $r("app.integer.shortvideo_video_des_margin_bottom") }) Row() { Row() { Image($r("app.media.shortvideo_ic_public_upgrade_filled")) .height($r("app.integer.shortvideo_upgrade_icon_size")) .width($r("app.integer.shortvideo_upgrade_icon_size")) Text($r("app.string.shortvideo_upgrade_hot")) .fontSize($r("app.integer.shortvideo_upgrade_text_font_size")) .fontColor($r("app.color.shortvideo_up_color")) Text(' · ' + this.videoData.videoMask.hotspot) .fontSize($r("app.integer.shortvideo_mus_font_size")) .maxLines(1) .width(this.videoData.videoMask.hotspot.length * 12) .fontColor(Color.White) .height($r("app.integer.shortvideo_mus_height")) .textOverflow({ overflow: TextOverflow.Ellipsis }) .layoutWeight(1) } .width($r('app.string.shortvideo_upgrade_hot_width')) Row() { Divider() .vertical(true) .color(Color.White) .strokeWidth(1) .height($r("app.integer.shortvideo_upgrade_text_font_size")) .margin({ left: $r("app.integer.shortvideo_upgrade_margin"), right: $r("app.integer.shortvideo_upgrade_margin") }) Text($r("app.string.shortvideo_online_people")) .fontSize($r("app.integer.shortvideo_mus_font_size")) .fontColor(Color.White) Image($r("app.media.shortvideo_ic_arrow_right")) .width($r("app.integer.shortvideo_upgrade_text_font_size")) } .layoutWeight(1) .justifyContent(FlexAlign.End) } .width($r('app.string.shortvideo_hundred_percent')) .height($r("app.integer.shortvideo_upgrade_height")) .backgroundColor(Color.Gray) .opacity($r("app.float.shortvideo_fabulous_opacity")) .padding({ left: $r("app.integer.shortvideo_upgrade_padding"), right: $r("app.integer.shortvideo_upgrade_padding") }) .justifyContent(FlexAlign.Start) .onClick(() => { promptAction.showToast({ message: $r("app.string.shortvideo_demo_toast_tips") }); }) }.width($r('app.string.shortvideo_hundred_percent')) .height($r('app.string.shortvideo_hundred_percent')) .padding($r("app.integer.shortvideo_stack_padding")) .hitTestBehavior(HitTestMode.Transparent) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/VideoMask.ets#L27-L111
aca8808eaf24918da948c50abf8165ae096656ff
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
convertPriKeyFromStr
将非对称加密字符串priKey转换为symKey对象 @param privateKey字符串key @param symAlgName 秘钥规格 @param keyName 密钥长度 @param keyCoding 私钥的编码方式(utf8/hex/base64) @returns
static convertPriKeyFromStr(privateKey: string, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding) { let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(privateKey, keyName, keyCoding) }; let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertKeySync(null, symKeyBlob); return symKey; }
AST#method_declaration#Left static convertPriKeyFromStr AST#parameter_list#Left ( AST#parameter#Left privateKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyName : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKeyBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . strKey2Uint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left privateKey AST#expression#Right , AST#expression#Left keyName AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aesGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symAlgName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left aesGenerator AST#expression#Right . convertKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left symKeyBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left symKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static convertPriKeyFromStr(privateKey: string, symAlgName: string, keyName: number, keyCoding: buffer.BufferEncoding) { let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(privateKey, keyName, keyCoding) }; let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertKeySync(null, symKeyBlob); return symKey; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L64-L70
4f0f82af980ce7cceace8261cfe8ec09afcd6ea8
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_bookmarks.ets
arkts
get_type
gets the type of this object @returns "bookmark"
get_type() { return this.is_folder ? "folder" : "bookmark"; }
AST#method_declaration#Left get_type AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . is_folder AST#member_expression#Right AST#expression#Right ? AST#expression#Left "folder" AST#expression#Right : AST#expression#Left "bookmark" AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
get_type() { return this.is_folder ? "folder" : "bookmark"; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L745-L747
0778614af7138e84f8366e2f56528e5ca10d77f1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
clearBadge
清空桌面角标,在应用的桌面图标上呈现。
static async clearBadge(): Promise<void> { return notificationManager.setBadgeNumber(0); }
AST#method_declaration#Left static async clearBadge 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#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . setBadgeNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async clearBadge(): Promise<void> { return notificationManager.setBadgeNumber(0); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L328-L330
6591852257cf07bc0e19caa6742f9892c6f11a99
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleDataSet.ets
arkts
setBarSpace
Sets the space that is left out on the left and right side of each candle, default 0.1f (10%), max 0.45f, min 0f @param space
public setBarSpace(space: number): void { if (space < 0) { space = 0; } if (space > 0.45) { space = 0.45; } this.mBarSpace = space; }
AST#method_declaration#Left public setBarSpace AST#parameter_list#Left ( AST#parameter#Left space : 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 AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left space AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left space = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left space AST#expression#Right > AST#expression#Left 0.45 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left space = AST#expression#Left 0.45 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mBarSpace AST#member_expression#Right = AST#expression#Left space AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setBarSpace(space: number): void { if (space < 0) { space = 0; } if (space > 0.45) { space = 0.45; } this.mBarSpace = space; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleDataSet.ets#L149-L158
31df813702b170825e72d7838ea7f428a5e84fb0
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
2000ms
export const DURATION_1000: number = 1000;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DURATION_1000 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1000 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const DURATION_1000: number = 1000;
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L99-L99
41d4caf063a516bfb6f4f16625d5d42d87357af4
github
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/api/auth.ets
arkts
login
登录用户
static login<T = null, D = Recorder>(data?: D): ApiResult<T> { return request<T>({ url: '/auth/login', method: 'post', data: data, cache: true, retry: 2, }) }
AST#method_declaration#Left static login AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right , AST#type_parameter#Left D = AST#type_annotation#Left AST#primary_type#Left Recorder AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left D 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 ApiResult AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left '/auth/login' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left 'post' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left data AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cache AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left retry AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static login<T = null, D = Recorder>(data?: D): ApiResult<T> { return request<T>({ url: '/auth/login', method: 'post', data: data, cache: true, retry: 2, }) }
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/api/auth.ets#L7-L15
418eb25ecdbf83bb70b52794319d120cdfef3dfc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/model/NavgationModel.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export class CommentDataSource implements IDataSource { private elements: number[] = []; private listeners: Set<DataChangeListener>; constructor(elements: number[]) { this.elements = elements; this.listeners = new Set(); } totalCount(): number { return this.elements.length; } getData(index: number): number { return this.elements[index]; } registerDataChangeListener(listener: DataChangeListener): void { this.listeners.add(listener); } unregisterDataChangeListener(listener: DataChangeListener): void { this.listeners.delete(listener); } pushItem(item: number) { this.elements.push(item); this.listeners.forEach(listeners => { listeners.onDataAdd(this.elements.length); }) } }
AST#export_declaration#Left export AST#class_declaration#Left class CommentDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private elements : 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Set AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left elements : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . elements AST#member_expression#Right = AST#expression#Left elements AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . elements AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . elements AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left pushItem AST#parameter_list#Left ( AST#parameter#Left item : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . elements AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listeners => 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 listeners AST#expression#Right . onDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . elements AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommentDataSource implements IDataSource { private elements: number[] = []; private listeners: Set<DataChangeListener>; constructor(elements: number[]) { this.elements = elements; this.listeners = new Set(); } totalCount(): number { return this.elements.length; } getData(index: number): number { return this.elements[index]; } registerDataChangeListener(listener: DataChangeListener): void { this.listeners.add(listener); } unregisterDataChangeListener(listener: DataChangeListener): void { this.listeners.delete(listener); } pushItem(item: number) { this.elements.push(item); this.listeners.forEach(listeners => { listeners.onDataAdd(this.elements.length); }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/model/NavgationModel.ets#L16-L47
1dd5b2fa536acc4cfdbaa801c854090216948ec8
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets
arkts
sign
对数据进行签名,异步 @param dataBlob 待签名数据 @param priKey 私钥 @returns
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey): Promise<cryptoFramework.DataBlob> { return CryptoUtil.sign(dataBlob,priKey,'ECC256|SHA256') }
AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . sign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataBlob AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'ECC256|SHA256' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey): Promise<cryptoFramework.DataBlob> { return CryptoUtil.sign(dataBlob,priKey,'ECC256|SHA256') }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets#L34-L36
d49f9b7afbf1a1effcc110febf6874c1f0fc1622
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519Sync.ets
arkts
@Author csx @DateTime 2024/3/20 21:29 @TODO X25519Sync
export class X25519Sync { /** * X25519动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns 256位共享密钥字符串 */ static x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'X25519', 256, keyCoding, resultCoding); } }
AST#export_declaration#Left export AST#class_declaration#Left class X25519Sync AST#class_body#Left { /** * X25519动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns 256位共享密钥字符串 */ AST#method_declaration#Left static x25519 AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DynamicSyncUtil AST#expression#Right . dynamicKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'X25519' AST#expression#Right , AST#expression#Left 256 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class X25519Sync { static x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'X25519', 256, keyCoding, resultCoding); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519Sync.ets#L26-L39
0db2776b8c1708dc02c988a5b8b9f6318b288a67
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SHASync.ets
arkts
digest
SHA256摘要 @param str 带摘要的字符串 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @returns 摘要后的字符串
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.digest(str, 'SHA256', resultCoding); }
AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . digest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 'SHA256' AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.digest(str, 'SHA256', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHASync.ets#L55-L57
d1e316ba95c89bc4047e6dbc8485972330fe5854
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/utils/HttpUtil.ets
arkts
get
GET请求
static get<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> { const getConfig: RequestConfig = { method: http.RequestMethod.GET, headers: config.headers, timeout: config.timeout, data: config.data }; return HttpUtil.request<T>(url, getConfig); }
AST#method_declaration#Left static get AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left getConfig : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left getConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static get<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> { const getConfig: RequestConfig = { method: http.RequestMethod.GET, headers: config.headers, timeout: config.timeout, data: config.data }; return HttpUtil.request<T>(url, getConfig); }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L129-L137
a2a2c4cf61b94217a7de4df3da9f228ef8e2c77f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/textInput/KeyboardAvoidance.ets
arkts
KeyboardAvoidance
[Start keyboard_avoid]
@Entry @Component export struct KeyboardAvoidance { placeHolderArr: string[] = ['1', '2', '3', '4', '5', '6', '7']; build() { // [StartExclude keyboard_avoid] NavDestination() { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.KeyboardAvoidance_title') }) { Column({ space: 12 }) { // [EndExclude keyboard_avoid] Scroll() { Column() { ForEach(this.placeHolderArr, (placeholder: string) => { TextInput({ placeholder: 'TextInput ' + placeholder }) .margin(30) }) } } .height('95%') .width('100%') } } // [End keyboard_avoid] } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.KeyboardAvoidance_title')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct KeyboardAvoidance AST#component_body#Left { AST#property_declaration#Left placeHolderArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '1' AST#expression#Right , AST#expression#Left '2' AST#expression#Right , AST#expression#Left '3' AST#expression#Right , AST#expression#Left '4' AST#expression#Right , AST#expression#Left '5' AST#expression#Right , AST#expression#Left '6' AST#expression#Right , AST#expression#Left '7' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude keyboard_avoid] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ComponentCard ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.KeyboardAvoidance_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // [EndExclude keyboard_avoid] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . placeHolderArr AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left placeholder : 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#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#binary_expression#Left AST#expression#Left 'TextInput ' AST#expression#Right + AST#expression#Left placeholder AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '95%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [End keyboard_avoid] } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.KeyboardAvoidance_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Entry @Component export struct KeyboardAvoidance { placeHolderArr: string[] = ['1', '2', '3', '4', '5', '6', '7']; build() { NavDestination() { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.KeyboardAvoidance_title') }) { Column({ space: 12 }) { Scroll() { Column() { ForEach(this.placeHolderArr, (placeholder: string) => { TextInput({ placeholder: 'TextInput ' + placeholder }) .margin(30) }) } } .height('95%') .width('100%') } } } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.KeyboardAvoidance_title')) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/textInput/KeyboardAvoidance.ets#L19-L52
1f9480f1575f86cf4ec5718f7645c441c5cca9e3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets
arkts
loadUrl
此函数为自定义函数,可作为初始化函数使用
loadUrl(url: string) { if (this.rootWebviewController !== null) { // 复用预创建组件,重新加载url this.rootWebviewController.loadUrl(url); } }
AST#method_declaration#Left loadUrl AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootWebviewController AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // 复用预创建组件,重新加载url AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootWebviewController AST#member_expression#Right AST#expression#Right . loadUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
loadUrl(url: string) { if (this.rootWebviewController !== null) { this.rootWebviewController.loadUrl(url); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets#L90-L95
5f8cc25e71bb5fe900f070bae1fe5ffd804738e2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/bluetoothSample/entry/src/main/ets/common/ScanDialog.ets
arkts
ScanDialog
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@CustomDialog @Component export struct ScanDialog { @Link textValueOfInterval: string; @Link inputValueOfInterval: string; @Link textValueOfManufactureId: string; @Link inputValueOfManufactureId: string; @Link textValueOfDeviceName: string; @Link inputValueOfDeviceName: string; @Link textValueOfDeviceId: string; @Link inputValueOfDeviceId: string; controller?: CustomDialogController cancel: () => void = () => { } confirm: () => void = () => { } build() { Column() { Text('set scan filtering parameters').fontSize(20).margin({ top: 10, bottom: 10 }); Row() { Text('interval') .width('30%') .margin(5) TextInput({ placeholder: 'default is 0', text: this.textValueOfInterval }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfInterval = value; }) } Row() { Text('manufactureId') .width('30%') .margin(5) TextInput({ placeholder: 'default is 4567', text: this.textValueOfManufactureId }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfManufactureId = value; }) } Row() { Text('deviceName') .width('30%') .margin(5) TextInput({ placeholder: 'default is \'\'', text: this.textValueOfDeviceName }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfDeviceName = value; }) } Row() { Text('deviceId') .width('30%') .margin(5) TextInput({ placeholder: 'default is \'\'', text: this.textValueOfDeviceId }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfDeviceId = value; }) } Flex({ justifyContent: FlexAlign.SpaceAround }) { Button('cancel') .onClick(() => { if (this.controller != undefined) { this.controller.close(); this.cancel(); } }).backgroundColor(0xffffff).fontColor(Color.Black) Button('clean up') .onClick(() => { this.textValueOfInterval = ''; this.inputValueOfInterval = '0'; this.textValueOfManufactureId = ''; this.inputValueOfManufactureId = '4567'; this.textValueOfDeviceName = ''; this.inputValueOfDeviceName = ''; this.textValueOfDeviceId = ''; this.inputValueOfDeviceId = ''; }).backgroundColor(0xffffff).fontColor(Color.Red) Button('confirm') .onClick(() => { if (this.controller != undefined) { this.inputValueOfInterval = this.textValueOfInterval; this.inputValueOfManufactureId = this.textValueOfManufactureId; this.inputValueOfDeviceName = this.textValueOfDeviceName; this.inputValueOfDeviceId = this.textValueOfDeviceId; this.controller.close(); this.confirm(); } }).backgroundColor(0xffffff).fontColor(Color.Red) }.margin({ bottom: 10 }) }.borderRadius(10) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ScanDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textValueOfInterval : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValueOfInterval : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textValueOfManufactureId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValueOfManufactureId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textValueOfDeviceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValueOfDeviceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textValueOfDeviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValueOfDeviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left controller ? : AST#ERROR#Left CustomDialogController cancel : AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left 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#function_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#ERROR#Left confirm : AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right => void AST#ERROR#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'set scan filtering parameters' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'interval' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left 'default is 0' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfInterval AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '65%' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfInterval AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'manufactureId' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left 'default is 4567' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfManufactureId AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '65%' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfManufactureId AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'deviceName' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left 'default is \'\'' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceName AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '65%' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceName AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'deviceId' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '30%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left 'default is \'\'' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceId AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '65%' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceId AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'cancel' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xffffff AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'clean up' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfInterval AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfInterval AST#member_expression#Right = AST#expression#Left '0' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfManufactureId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfManufactureId AST#member_expression#Right = AST#expression#Left '4567' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceName AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfDeviceName AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfDeviceId AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xffffff AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'confirm' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfInterval AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfInterval AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfManufactureId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfManufactureId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfDeviceName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceName AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inputValueOfDeviceId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textValueOfDeviceId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . confirm AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xffffff AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@CustomDialog @Component export struct ScanDialog { @Link textValueOfInterval: string; @Link inputValueOfInterval: string; @Link textValueOfManufactureId: string; @Link inputValueOfManufactureId: string; @Link textValueOfDeviceName: string; @Link inputValueOfDeviceName: string; @Link textValueOfDeviceId: string; @Link inputValueOfDeviceId: string; controller?: CustomDialogController cancel: () => void = () => { } confirm: () => void = () => { } build() { Column() { Text('set scan filtering parameters').fontSize(20).margin({ top: 10, bottom: 10 }); Row() { Text('interval') .width('30%') .margin(5) TextInput({ placeholder: 'default is 0', text: this.textValueOfInterval }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfInterval = value; }) } Row() { Text('manufactureId') .width('30%') .margin(5) TextInput({ placeholder: 'default is 4567', text: this.textValueOfManufactureId }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfManufactureId = value; }) } Row() { Text('deviceName') .width('30%') .margin(5) TextInput({ placeholder: 'default is \'\'', text: this.textValueOfDeviceName }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfDeviceName = value; }) } Row() { Text('deviceId') .width('30%') .margin(5) TextInput({ placeholder: 'default is \'\'', text: this.textValueOfDeviceId }) .height(40) .width('65%') .onChange((value: string) => { this.textValueOfDeviceId = value; }) } Flex({ justifyContent: FlexAlign.SpaceAround }) { Button('cancel') .onClick(() => { if (this.controller != undefined) { this.controller.close(); this.cancel(); } }).backgroundColor(0xffffff).fontColor(Color.Black) Button('clean up') .onClick(() => { this.textValueOfInterval = ''; this.inputValueOfInterval = '0'; this.textValueOfManufactureId = ''; this.inputValueOfManufactureId = '4567'; this.textValueOfDeviceName = ''; this.inputValueOfDeviceName = ''; this.textValueOfDeviceId = ''; this.inputValueOfDeviceId = ''; }).backgroundColor(0xffffff).fontColor(Color.Red) Button('confirm') .onClick(() => { if (this.controller != undefined) { this.inputValueOfInterval = this.textValueOfInterval; this.inputValueOfManufactureId = this.textValueOfManufactureId; this.inputValueOfDeviceName = this.textValueOfDeviceName; this.inputValueOfDeviceId = this.textValueOfDeviceId; this.controller.close(); this.confirm(); } }).backgroundColor(0xffffff).fontColor(Color.Red) }.margin({ bottom: 10 }) }.borderRadius(10) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/common/ScanDialog.ets#L16-L120
459e115e439056323bada6313673b2f5e9cf935f
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/ActionSheetDialogView.ets
arkts
headBuilder
标题
@Builder headBuilder() { Column() { Text(this.options.title) .fontSize(this.options.style?.titleFontSize ?? 16) .fontColor(this.options.style?.titleFontColor ?? $r('app.color.harmony_dialog_title_color')) .align(Alignment.Center) .textAlign(TextAlign.Center) .padding(this.options.style?.titlePadding ?? { left: 10, right: 10, bottom: 15, top: 15 }) .width('100%') .backgroundColor(this.options.style?.backgroundColor) .backgroundBlurStyle(this.options.style?.backgroundBlurStyle) Divider() .width('100%') .strokeWidth(1) .color(this.dividerColor) } .width('100%') .backgroundColor(this.options.style?.backgroundColor) .backgroundBlurStyle(this.options.style?.backgroundBlurStyle) .visibility(this.options.title ? Visibility.Visible : Visibility.None) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right headBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ?. titleFontSize AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ?. titleFontColor AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.harmony_dialog_title_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ?. titlePadding AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ?. backgroundColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundBlurStyle ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ?. backgroundBlurStyle AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dividerColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ?. backgroundColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundBlurStyle ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . style AST#member_expression#Right AST#expression#Right ?. backgroundBlurStyle AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder headBuilder() { Column() { Text(this.options.title) .fontSize(this.options.style?.titleFontSize ?? 16) .fontColor(this.options.style?.titleFontColor ?? $r('app.color.harmony_dialog_title_color')) .align(Alignment.Center) .textAlign(TextAlign.Center) .padding(this.options.style?.titlePadding ?? { left: 10, right: 10, bottom: 15, top: 15 }) .width('100%') .backgroundColor(this.options.style?.backgroundColor) .backgroundBlurStyle(this.options.style?.backgroundBlurStyle) Divider() .width('100%') .strokeWidth(1) .color(this.dividerColor) } .width('100%') .backgroundColor(this.options.style?.backgroundColor) .backgroundBlurStyle(this.options.style?.backgroundBlurStyle) .visibility(this.options.title ? Visibility.Visible : Visibility.None) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/ActionSheetDialogView.ets#L97-L123
160ea6c8623269bfb016ac939710fc33e91ca74b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/view/ShortVideo.ets
arkts
aboutToAppear
视频数据初始化
async aboutToAppear() { // 进入沉浸式 this.windowClass = await window.getLastWindow(getContext(this)); let sysBarProps: window.SystemBarProperties = { statusBarContentColor: '#FFFFFF' }; this.windowClass?.setWindowSystemBarProperties(sysBarProps); this.statusHeight = this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height; this.bottomHeight = this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect.height; AppStorage.setOrCreate('statusHeight', this.statusHeight); AppStorage.setOrCreate('bottomHeight', this.bottomHeight); this.windowClass.setWindowLayoutFullScreen(true); for (let i = 0; i < VIDEO_DATA.length; i++) { // 模拟评论数据,真实场景需要请求后台获取评论数据 for (let j = 0; j < 100; j++) { VIDEO_DATA[i].videoMask.commentDataSource.pushData({ id: j + "", avatar: VIDEO_DATA[i].videoMask.head, name: "精灵球收七龙珠" + j, commentContent: "我没有看到后续,但总有人会看到" + j, timeAgo: j + "小时前", address: "广州", likeCount: j + "" }); } this.data.pushData(new VideoBuilder(VIDEO_DATA[i], wrapBuilder(VideoComponent))); } // 注册事件监听 this.listenBackPress(); }
AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 进入沉浸式 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left window AST#expression#Right AST#await_expression#Right AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sysBarProps : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . SystemBarProperties AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left statusBarContentColor AST#property_name#Right : AST#expression#Left '#FFFFFF' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right ?. setWindowSystemBarProperties AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sysBarProps AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusHeight AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_SYSTEM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . topRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomHeight AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . bottomRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'statusHeight' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . statusHeight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bottomHeight' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomHeight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowClass AST#member_expression#Right AST#expression#Right . setWindowLayoutFullScreen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left VIDEO_DATA AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { // 模拟评论数据,真实场景需要请求后台获取评论数据 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left j AST#expression#Right ++ AST#update_expression#Right AST#expression#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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left VIDEO_DATA AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . commentDataSource AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left avatar AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left VIDEO_DATA AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . videoMask AST#member_expression#Right AST#expression#Right . head AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left "精灵球收七龙珠" AST#expression#Right + AST#expression#Left j AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left commentContent AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left "我没有看到后续,但总有人会看到" AST#expression#Right + AST#expression#Left j AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeAgo AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left "小时前" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left "广州" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left likeCount AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left VideoBuilder AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left VIDEO_DATA AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left VideoComponent AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 注册事件监听 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listenBackPress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async aboutToAppear() { this.windowClass = await window.getLastWindow(getContext(this)); let sysBarProps: window.SystemBarProperties = { statusBarContentColor: '#FFFFFF' }; this.windowClass?.setWindowSystemBarProperties(sysBarProps); this.statusHeight = this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height; this.bottomHeight = this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect.height; AppStorage.setOrCreate('statusHeight', this.statusHeight); AppStorage.setOrCreate('bottomHeight', this.bottomHeight); this.windowClass.setWindowLayoutFullScreen(true); for (let i = 0; i < VIDEO_DATA.length; i++) { for (let j = 0; j < 100; j++) { VIDEO_DATA[i].videoMask.commentDataSource.pushData({ id: j + "", avatar: VIDEO_DATA[i].videoMask.head, name: "精灵球收七龙珠" + j, commentContent: "我没有看到后续,但总有人会看到" + j, timeAgo: j + "小时前", address: "广州", likeCount: j + "" }); } this.data.pushData(new VideoBuilder(VIDEO_DATA[i], wrapBuilder(VideoComponent))); } this.listenBackPress(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/ShortVideo.ets#L102-L131
6830c5dafc281ee85bea0715562c80fcb149806b
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
onActionUpdate
Callback when the Pinch gesture is moving. @param { Callback<GestureEvent> } event @returns { PinchGesture } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
onActionUpdate(event: Callback<GestureEvent>): PinchGesture;
AST#method_declaration#Left onActionUpdate AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PinchGesture AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
onActionUpdate(event: Callback<GestureEvent>): PinchGesture;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L615-L615
7c2f9a0eb4008af66fb1d39d1b31572469702ec1
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineRadarDataSet.ets
arkts
Base dataset for line and radar DataSets.
export default abstract class LineRadarDataSet<T extends EntryOhos> extends LineScatterCandleRadarDataSet<T> implements ILineRadarDataSet<T> { /** * the color that is used for filling the line surface */ // private mFillColor: number = Color.rgb(140, 234, 255); private mFillColor: number = ChartColor.rgb(140, 234, 255); private mLinearGradientColors: JArrayList<ChartColorStop> | null = null; /** * the drawable to be used for filling the line surface */ protected mFillDrawable: ChartPixelMap | null = null; /** * transparency used for filling line surface */ private mFillAlpha: number = 85; /** * the width of the drawn data lines */ private mLineWidth: number = 2.5; /** * if true, the data will also be drawn filled */ private mDrawFilled: boolean = false; // private mShowFillLine: boolean = true; constructor(yVals: JArrayList<T> | null, label: string) { super(yVals, label); } public getFillColor(): number { return this.mFillColor; } /** * Sets the color that is used for filling the area below the line. * Resets an eventually set "fillDrawable". * * @param color */ public setFillColor(color: number): void { this.mFillColor = color; this.mFillDrawable = null; } public setGradientFillColor(linearGradientColors: JArrayList<ChartColorStop>): void { this.mLinearGradientColors = linearGradientColors; this.mFillDrawable = null; this.mFillColor = 0; } public getGradientFillColor(): JArrayList<ChartColorStop> | null { return this.mLinearGradientColors; } public getFillDrawable(): ChartPixelMap | null { return this.mFillDrawable; } /** * Sets the drawable to be used to fill the area below the line. * * @param drawable */ // @TargetApi(18) public setFillDrawable(drawable: ChartPixelMap): void { this.mFillDrawable = drawable; } public getFillAlpha(): number { return this.mFillAlpha; } /** * sets the alpha value (transparency) that is used for filling the line * surface (0-255), default: 85 * * @param alpha */ public setFillAlpha(alpha: number): void { this.mFillAlpha = alpha; } /** * set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE: * thinner line == better performance, thicker line == worse performance * * @param width */ public setLineWidth(width: number): void { if (width < 0.0) width = 0.0; if (width > 10.0) width = 10.0; this.mLineWidth = width; } public getLineWidth(): number { return this.mLineWidth; } public setDrawFilled(filled: boolean): void { this.mDrawFilled = filled; } public isDrawFilledEnabled(): boolean { return this.mDrawFilled; } // public setShowFillLine(showFillLine: boolean): void { // this.mShowFillLine = showFillLine; // } // // public getShowFillLine(): boolean { // return this.mShowFillLine; // } protected copyTo(lineRadarDataSet: LineRadarDataSet<T>): void { super.copyTo(lineRadarDataSet); lineRadarDataSet.mDrawFilled = this.mDrawFilled; lineRadarDataSet.mFillAlpha = this.mFillAlpha; lineRadarDataSet.mFillColor = this.mFillColor; lineRadarDataSet.mFillDrawable = this.mFillDrawable; lineRadarDataSet.mLineWidth = this.mLineWidth; } }
AST#export_declaration#Left export default AST#class_declaration#Left abstract class LineRadarDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left LineScatterCandleRadarDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements AST#generic_type#Left ILineRadarDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#implements_clause#Right AST#class_body#Left { /** * the color that is used for filling the line surface */ // private mFillColor: number = Color.rgb(140, 234, 255); AST#property_declaration#Left private mFillColor : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ChartColor AST#expression#Right . rgb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 140 AST#expression#Right , AST#expression#Left 234 AST#expression#Right , AST#expression#Left 255 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mLinearGradientColors : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ChartColorStop AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * the drawable to be used for filling the line surface */ AST#property_declaration#Left protected mFillDrawable : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChartPixelMap AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * transparency used for filling line surface */ AST#property_declaration#Left private mFillAlpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 85 AST#expression#Right ; AST#property_declaration#Right /** * the width of the drawn data lines */ AST#property_declaration#Left private mLineWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2.5 AST#expression#Right ; AST#property_declaration#Right /** * if true, the data will also be drawn filled */ AST#property_declaration#Left private mDrawFilled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // private mShowFillLine: boolean = true; AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left yVals : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( AST#expression#Left yVals AST#expression#Right , AST#expression#Left label AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left public getFillColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillColor AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the color that is used for filling the area below the line. * Resets an eventually set "fillDrawable". * * @param color */ AST#method_declaration#Left public setFillColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillColor AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillDrawable AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public setGradientFillColor AST#parameter_list#Left ( AST#parameter#Left linearGradientColors : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ChartColorStop AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLinearGradientColors AST#member_expression#Right = AST#expression#Left linearGradientColors AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillDrawable AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillColor AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getGradientFillColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ChartColorStop AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLinearGradientColors AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public getFillDrawable AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChartPixelMap AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillDrawable AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the drawable to be used to fill the area below the line. * * @param drawable */ // @TargetApi(18) AST#method_declaration#Left public setFillDrawable AST#parameter_list#Left ( AST#parameter#Left drawable : AST#type_annotation#Left AST#primary_type#Left ChartPixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillDrawable AST#member_expression#Right = AST#expression#Left drawable AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getFillAlpha AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillAlpha AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * sets the alpha value (transparency) that is used for filling the line * surface (0-255), default: 85 * * @param alpha */ AST#method_declaration#Left public setFillAlpha AST#parameter_list#Left ( AST#parameter#Left alpha : 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 AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillAlpha AST#member_expression#Right = AST#expression#Left alpha AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE: * thinner line == better performance, thicker line == worse performance * * @param width */ AST#method_declaration#Left public setLineWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right < AST#expression#Left 0.0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left width = AST#expression#Left 0.0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left width AST#expression#Right > AST#expression#Left 10.0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left width = AST#expression#Left 10.0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLineWidth AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public getLineWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLineWidth AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public setDrawFilled AST#parameter_list#Left ( AST#parameter#Left filled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawFilled AST#member_expression#Right = AST#expression#Left filled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public isDrawFilledEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawFilled AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // public setShowFillLine(showFillLine: boolean): void { // this.mShowFillLine = showFillLine; // } // // public getShowFillLine(): boolean { // return this.mShowFillLine; // } AST#method_declaration#Left protected copyTo AST#parameter_list#Left ( AST#parameter#Left lineRadarDataSet : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left LineRadarDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . copyTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lineRadarDataSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left lineRadarDataSet AST#expression#Right . mDrawFilled AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawFilled AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left lineRadarDataSet AST#expression#Right . mFillAlpha AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillAlpha AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left lineRadarDataSet AST#expression#Right . mFillColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillColor AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left lineRadarDataSet AST#expression#Right . mFillDrawable AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mFillDrawable AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left lineRadarDataSet AST#expression#Right . mLineWidth AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLineWidth AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default abstract class LineRadarDataSet<T extends EntryOhos> extends LineScatterCandleRadarDataSet<T> implements ILineRadarDataSet<T> { private mFillColor: number = ChartColor.rgb(140, 234, 255); private mLinearGradientColors: JArrayList<ChartColorStop> | null = null; protected mFillDrawable: ChartPixelMap | null = null; private mFillAlpha: number = 85; private mLineWidth: number = 2.5; private mDrawFilled: boolean = false; constructor(yVals: JArrayList<T> | null, label: string) { super(yVals, label); } public getFillColor(): number { return this.mFillColor; } public setFillColor(color: number): void { this.mFillColor = color; this.mFillDrawable = null; } public setGradientFillColor(linearGradientColors: JArrayList<ChartColorStop>): void { this.mLinearGradientColors = linearGradientColors; this.mFillDrawable = null; this.mFillColor = 0; } public getGradientFillColor(): JArrayList<ChartColorStop> | null { return this.mLinearGradientColors; } public getFillDrawable(): ChartPixelMap | null { return this.mFillDrawable; } public setFillDrawable(drawable: ChartPixelMap): void { this.mFillDrawable = drawable; } public getFillAlpha(): number { return this.mFillAlpha; } public setFillAlpha(alpha: number): void { this.mFillAlpha = alpha; } public setLineWidth(width: number): void { if (width < 0.0) width = 0.0; if (width > 10.0) width = 10.0; this.mLineWidth = width; } public getLineWidth(): number { return this.mLineWidth; } public setDrawFilled(filled: boolean): void { this.mDrawFilled = filled; } public isDrawFilledEnabled(): boolean { return this.mDrawFilled; } public getShowFillLine(): boolean { return this.mShowFillLine; protected copyTo(lineRadarDataSet: LineRadarDataSet<T>): void { super.copyTo(lineRadarDataSet); lineRadarDataSet.mDrawFilled = this.mDrawFilled; lineRadarDataSet.mFillAlpha = this.mFillAlpha; lineRadarDataSet.mFillColor = this.mFillColor; lineRadarDataSet.mFillDrawable = this.mFillDrawable; lineRadarDataSet.mLineWidth = this.mLineWidth; } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineRadarDataSet.ets#L27-L155
47794a08f717fa9d6faea2402be0e07a45d0a3fc
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
downloadHls
HLS 流下载
public static downloadHls(hlsUrl: string, output: string): string[] { return ['ffmpeg', '-i', hlsUrl, '-c:v', 'copy', '-c:a', 'copy', '-y', output]; }
AST#method_declaration#Left public static downloadHls AST#parameter_list#Left ( AST#parameter#Left hlsUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'ffmpeg' AST#expression#Right , AST#expression#Left '-i' AST#expression#Right , AST#expression#Left hlsUrl AST#expression#Right , AST#expression#Left '-c:v' AST#expression#Right , AST#expression#Left 'copy' AST#expression#Right , AST#expression#Left '-c:a' AST#expression#Right , AST#expression#Left 'copy' AST#expression#Right , AST#expression#Left '-y' AST#expression#Right , AST#expression#Left output AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static downloadHls(hlsUrl: string, output: string): string[] { return ['ffmpeg', '-i', hlsUrl, '-c:v', 'copy', '-c:a', 'copy', '-y', output]; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L214-L216
b9937b5f264e433ce5f9110023d45bcad0c7d55d
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/PieChartRenderer.ets
arkts
getSliceSpace
Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. @param dataSet @return
protected getSliceSpace(dataSet: IPieDataSet): number { let chartData = this.mChart.getData(); if (!chartData || !this.mViewPortHandler) { return -1; } if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled()) return dataSet.getSliceSpace(); let spaceSizeRatio: number = dataSet.getSliceSpace() / this.mViewPortHandler.getSmallestContentExtension(); let minValueRatio: number = dataSet.getYMin() / chartData.getYValueSum() * 2; let sliceSpace: number = spaceSizeRatio > minValueRatio ? 0 : dataSet.getSliceSpace(); return sliceSpace; }
AST#method_declaration#Left protected getSliceSpace AST#parameter_list#Left ( AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left IPieDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left chartData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChart AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left chartData AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left dataSet AST#expression#Right AST#unary_expression#Right AST#expression#Right . isAutomaticallyDisableSliceSpacingEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getSliceSpace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left spaceSizeRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getSliceSpace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . getSmallestContentExtension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minValueRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSet AST#expression#Right . getYMin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left chartData AST#expression#Right AST#binary_expression#Right AST#expression#Right . getYValueSum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sliceSpace : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left spaceSizeRatio AST#expression#Right > AST#expression#Left minValueRatio AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left dataSet AST#expression#Right AST#conditional_expression#Right AST#expression#Right . getSliceSpace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left sliceSpace AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
protected getSliceSpace(dataSet: IPieDataSet): number { let chartData = this.mChart.getData(); if (!chartData || !this.mViewPortHandler) { return -1; } if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled()) return dataSet.getSliceSpace(); let spaceSizeRatio: number = dataSet.getSliceSpace() / this.mViewPortHandler.getSmallestContentExtension(); let minValueRatio: number = dataSet.getYMin() / chartData.getYValueSum() * 2; let sliceSpace: number = spaceSizeRatio > minValueRatio ? 0 : dataSet.getSliceSpace(); return sliceSpace; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/PieChartRenderer.ets#L185-L202
7ca57dd94d7ba4a82f5efffb78989d03a3dddacf
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/ChatTools.ets
arkts
setKeyboardAvoidModeToRESIZE
设置输入法软键盘避让模式为RESIZE(表示当输入显示时,压缩窗体高度,而不是使用默认的OFFSET模式将窗体整体上推)。 详见官方资料:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-keyboard-layout-adapt-V5#section08221814182316 @param toRESIZE true表示设置为KeyboardAvoidMode.RESIZE模式,否则还原为系统默认的 KeyboardAvoidMode.OFFSET模式
static setKeyboardAvoidModeToRESIZE(context: UIContext, toRESIZE: boolean) { context.setKeyboardAvoidMode(toRESIZE ? KeyboardAvoidMode.RESIZE : KeyboardAvoidMode.OFFSET); }
AST#method_declaration#Left static setKeyboardAvoidModeToRESIZE AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toRESIZE : 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . setKeyboardAvoidMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left toRESIZE AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left KeyboardAvoidMode AST#expression#Right . RESIZE AST#member_expression#Right AST#expression#Right : AST#expression#Left KeyboardAvoidMode AST#expression#Right AST#conditional_expression#Right AST#expression#Right . OFFSET AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static setKeyboardAvoidModeToRESIZE(context: UIContext, toRESIZE: boolean) { context.setKeyboardAvoidMode(toRESIZE ? KeyboardAvoidMode.RESIZE : KeyboardAvoidMode.OFFSET); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L64-L66
74fcda3f349d5b290880e63de9c59fa3f439f46a
gitee
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets
arkts
Provides the definition of the point in 3D. @typedef Point3d @extends Point @syscap SystemCapability.Graphics.Drawing @since 12
export interface Point3d extends Point { /** * Z-axis coordinate. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 12 */ z: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Point3d AST#extends_clause#Left extends Point AST#extends_clause#Right AST#object_type#Left { /** * Z-axis coordinate. * @type { number } * @syscap SystemCapability.Graphics.Drawing * @since 12 */ AST#type_member#Left z : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface Point3d extends Point { z: number; }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets#L134-L142
1b39a6189ed80180b8ac05c96feb28d2e80b254f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSA.ets
arkts
sign2048PKCS1
2048位签名-PKCS1 @param str 需要签名的字符串 @param priKey 2048位私钥 @returns string> 签名对象
static async sign2048PKCS1(str: string, priKey: string): Promise<string> { return CryptoUtil.sign(str, priKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048); }
AST#method_declaration#Left static async sign2048PKCS1 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 priKey : 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 Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . sign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'RSA2048' AST#expression#Right , AST#expression#Left 'RSA2048|PKCS1|SHA256' AST#expression#Right , AST#expression#Left 2048 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async sign2048PKCS1(str: string, priKey: string): Promise<string> { return CryptoUtil.sign(str, priKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L134-L136
2094251910e3baf7fedeed781b19091bccb4fd26
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
getSignalType
查询当前网络是3G/4G/5G SignalInformation.signalType表示蜂窝网络的类型 未知(值为0) 2G:GSM(值为1)、CDMA(值为2) 3G:WCDMA(值为3)、TDSCDMA(值为4) 4G:LTE(值为5) 5G:NR(值为6) @returns 指定SIM卡槽对应的注册网络信号强度信息列表
async getSignalType(): Promise<radio.SignalInformation[]> { let slotId: number = await radio.getPrimarySlotId(); let data: Array<radio.SignalInformation> = radio.getSignalInformationSync(slotId); // signalType代表网络类型NetworkType let signalType = data[0].signalType; logger.info("getSignalType:" + JSON.stringify(data)); return data; }
AST#method_declaration#Left async getSignalType 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#qualified_type#Left radio . SignalInformation AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left [ ] AST#ERROR#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left slotId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left radio AST#expression#Right AST#await_expression#Right AST#expression#Right . getPrimarySlotId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left radio . SignalInformation AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left radio AST#expression#Right . getSignalInformationSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left slotId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // signalType代表网络类型NetworkType AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left signalType = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left data AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . signalType AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "getSignalType:" AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getSignalType(): Promise<radio.SignalInformation[]> { let slotId: number = await radio.getPrimarySlotId(); let data: Array<radio.SignalInformation> = radio.getSignalInformationSync(slotId); let signalType = data[0].signalType; logger.info("getSignalType:" + JSON.stringify(data)); return data; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L208-L215
ff124b064e13645874b364363b11d6d95fcd4970
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets
arkts
getChatInfo
获取提交给AI的问题
getChatInfo() { let newMessage = new Message("user", this.question) this.chatHistory.add(newMessage) let chatInfo: ChatInfo = new ChatInfo(this.modelName, this.chatHistory.convertToArray()) return chatInfo }
AST#method_declaration#Left getChatInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left newMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Message AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "user" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . question AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . chatHistory AST#member_expression#Right AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newMessage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left chatInfo : AST#type_annotation#Left AST#primary_type#Left ChatInfo AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ChatInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modelName AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . chatHistory AST#member_expression#Right AST#expression#Right . convertToArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left chatInfo AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getChatInfo() { let newMessage = new Message("user", this.question) this.chatHistory.add(newMessage) let chatInfo: ChatInfo = new ChatInfo(this.modelName, this.chatHistory.convertToArray()) return chatInfo }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets#L156-L161
9290ccf6f93ff0fe27733715b9a877065feb2bd2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/slidetohideanddisplace/Index.ets
arkts
SlideToHideAndDisplaceComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { SlideToHideAndDisplaceComponent } from './src/main/ets/view/SlideToHideAndDisplace';
AST#export_declaration#Left export { SlideToHideAndDisplaceComponent } from './src/main/ets/view/SlideToHideAndDisplace' ; AST#export_declaration#Right
export { SlideToHideAndDisplaceComponent } from './src/main/ets/view/SlideToHideAndDisplace';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/Index.ets#L15-L15
78efd089cc055f5030a0e218f98ea281f31449f8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/model/MainTabItem.ets
arkts
@file 主页面底部 Tab 配置项 @author Joker.X
export interface MainTabItem { /** * 文本标题 */ title: Resource; /** * 图标资源 */ icon: Resource; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MainTabItem AST#object_type#Left { /** * 文本标题 */ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 图标资源 */ AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface MainTabItem { title: Resource; icon: Resource; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/model/MainTabItem.ets#L5-L15
ebbdea1202371e9cbcc393fff6fcf52f932ea650
github
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/utils/PreferenceModel.ets
arkts
setToken
写入 token
async setToken(token: string) { await this.putPreference('token', token); }
AST#method_declaration#Left async setToken AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . putPreference AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'token' AST#expression#Right , AST#expression#Left token AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
async setToken(token: string) { await this.putPreference('token', token); }
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L90-L92
935b8c48111fb51240bfd6f29cc7ce096685bd68
github
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/Main.ets
arkts
calculateDayStats
计算某一天的支出和收入
calculateDayStats(bills: BillItem[]): DayStats { let expense = 0; let income = 0; bills.forEach(bill => { if (bill.type === 0) { expense += parseFloat(bill.amount) || 0; } else { income += parseFloat(bill.amount) || 0; } }); const result: DayStats = { expense: expense.toFixed(2), income: income.toFixed(2) }; return result; }
AST#method_declaration#Left calculateDayStats AST#parameter_list#Left ( AST#parameter#Left bills : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left BillItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DayStats AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left expense = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left income = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bills AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left bill => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left expense += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left parseFloat AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . amount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left income += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left parseFloat AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left bill AST#expression#Right . amount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left DayStats AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left expense AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left expense AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left income AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left income AST#expression#Right . toFixed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
calculateDayStats(bills: BillItem[]): DayStats { let expense = 0; let income = 0; bills.forEach(bill => { if (bill.type === 0) { expense += parseFloat(bill.amount) || 0; } else { income += parseFloat(bill.amount) || 0; } }); const result: DayStats = { expense: expense.toFixed(2), income: income.toFixed(2) }; return result; }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L193-L208
56ab83f0c53e2f1346d348c5af560332651333b6
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/ScanUtils.ets
arkts
onPickerScanForResult
通过picker拉起图库并选择图片,并调用图片识码 @param options @returns
static async onPickerScanForResult(options?: scanBarcode.ScanOptions): Promise<Array<scanBarcode.ScanResult>> { try { let photoOption = new picker.PhotoSelectOptions() photoOption.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE photoOption.maxSelectNumber = 1 let photoPicker = new picker.PhotoViewPicker() let uris = await photoPicker.select(photoOption) return await ScanUtils.onDetectBarCode(uris[0], options) } catch (err) { let error = err as BusinessError; LogUtils.debug('ScanUtils-onPickerScanForResult err', `code: ${error.code} -·- message: ${error.message}`) return []; } }
AST#method_declaration#Left static async onPickerScanForResult AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left scanBarcode . ScanOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left scanBarcode . ScanResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#ERROR#Left let photoOption = AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoSelectOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left photoOption AST#ERROR#Right . MIMEType AST#member_expression#Right = AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left picker AST#expression#Right . PhotoViewMIMETypes AST#member_expression#Right AST#expression#Right . IMAGE_TYPE AST#member_expression#Right AST#expression#Right AST#ERROR#Left photoOption AST#ERROR#Right . maxSelectNumber AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uris = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left photoPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left photoOption AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left ScanUtils AST#expression#Right AST#await_expression#Right AST#expression#Right . onDetectBarCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left uris AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left error = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtils AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ScanUtils-onPickerScanForResult err' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right -·- message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async onPickerScanForResult(options?: scanBarcode.ScanOptions): Promise<Array<scanBarcode.ScanResult>> { try { let photoOption = new picker.PhotoSelectOptions() photoOption.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE photoOption.maxSelectNumber = 1 let photoPicker = new picker.PhotoViewPicker() let uris = await photoPicker.select(photoOption) return await ScanUtils.onDetectBarCode(uris[0], options) } catch (err) { let error = err as BusinessError; LogUtils.debug('ScanUtils-onPickerScanForResult err', `code: ${error.code} -·- message: ${error.message}`) return []; } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ScanUtils.ets#L87-L100
2ff32212f93bb99cf68e2e35941df6707d00333c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/greetings/GreetingSendPage.ets
arkts
buildStyleOption
构建样式选项
@Builder buildStyleOption(label: string, style: GreetingStyle, description: string) { Row({ space: 12 }) { Radio({ value: style.toString(), group: 'style' }) .checked(this.selectedStyle === style) .onChange((isChecked: boolean) => { if (isChecked) { this.selectedStyle = style; } }) Column({ space: 4 }) { Text(label) .fontSize(16) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text(description) .fontSize(12) .fontColor('#666666') .alignSelf(ItemAlign.Start) } .alignItems(HorizontalAlign.Start) .layoutWeight(1) } .width('100%') .padding(12) .borderRadius(8) .backgroundColor('#f8f9fa') .onClick(() => { this.selectedStyle = style; }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStyleOption AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left GreetingStyle AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Radio ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left style AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left group : AST#expression#Left 'style' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . checked ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedStyle AST#member_expression#Right AST#expression#Right === AST#expression#Left style AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isChecked : 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isChecked AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedStyle AST#member_expression#Right = AST#expression#Left style AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left label AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left description AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f8f9fa' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedStyle AST#member_expression#Right = AST#expression#Left style AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildStyleOption(label: string, style: GreetingStyle, description: string) { Row({ space: 12 }) { Radio({ value: style.toString(), group: 'style' }) .checked(this.selectedStyle === style) .onChange((isChecked: boolean) => { if (isChecked) { this.selectedStyle = style; } }) Column({ space: 4 }) { Text(label) .fontSize(16) .fontColor('#333333') .alignSelf(ItemAlign.Start) Text(description) .fontSize(12) .fontColor('#666666') .alignSelf(ItemAlign.Start) } .alignItems(HorizontalAlign.Start) .layoutWeight(1) } .width('100%') .padding(12) .borderRadius(8) .backgroundColor('#f8f9fa') .onClick(() => { this.selectedStyle = style; }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L656-L688
d13928f6c2e375b468fa37fac31120186cb650a1
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
buildSettingsContent
构建设置内容占位符
@Builder buildSettingsContent() { Text('设置页面') .fontSize(18) .fontColor('#333333') .textAlign(TextAlign.Center) .width('100%') .height('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingsContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '设置页面' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildSettingsContent() { Text('设置页面') .fontSize(18) .fontColor('#333333') .textAlign(TextAlign.Center) .width('100%') .height('100%') }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L446-L454
eb1345363fe5e82ba29480a114ecbcaf04f8a883
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinF.ets
arkts
SpinF
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinF { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0; @Local scale2: number = 1; @Local angle1: number = 0; build() { RelativeContainer() { Canvas() .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, middle: { anchor: '__container__', align: HorizontalAlign.Center }, }) .scale({ x: this.scale1, y: this.scale1 }) .bounceStyle() Canvas() .alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, middle: { anchor: '__container__', align: HorizontalAlign.Center }, }) .scale({ x: this.scale2, y: this.scale2 }) .bounceStyle() } .width(this.spinSize) .height(this.spinSize) .rotate({ angle: this.angle1 }) .onAppear(() => { let keyframes1: Array<KeyframeState> = [ { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale1 = 1; this.scale2 = 0; } }, { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale1 = 0; this.scale2 = 1; } } ]; let keyframes2: Array<KeyframeState> = [ { duration: 2000, curve: Curve.Linear, event: () => { this.angle1 = 360; } } ]; this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1); this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes2); }) } @Styles bounceStyle() { .width('60%') .height('60%') .borderRadius(this.spinSize) .backgroundColor(this.spinColor) .shadow(ShadowStyle.OUTER_DEFAULT_XS) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinF AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right angle1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left middle AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . bounceStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left middle AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . bounceStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angle1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes1 : 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 KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale1 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale1 AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes2 : 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 KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angle1 AST#member_expression#Right = AST#expression#Left 360 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right bounceStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '60%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '60%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left ShadowStyle AST#expression#Right . OUTER_DEFAULT_XS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct SpinF { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0; @Local scale2: number = 1; @Local angle1: number = 0; build() { RelativeContainer() { Canvas() .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, middle: { anchor: '__container__', align: HorizontalAlign.Center }, }) .scale({ x: this.scale1, y: this.scale1 }) .bounceStyle() Canvas() .alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, middle: { anchor: '__container__', align: HorizontalAlign.Center }, }) .scale({ x: this.scale2, y: this.scale2 }) .bounceStyle() } .width(this.spinSize) .height(this.spinSize) .rotate({ angle: this.angle1 }) .onAppear(() => { let keyframes1: Array<KeyframeState> = [ { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale1 = 1; this.scale2 = 0; } }, { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale1 = 0; this.scale2 = 1; } } ]; let keyframes2: Array<KeyframeState> = [ { duration: 2000, curve: Curve.Linear, event: () => { this.angle1 = 360; } } ]; this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1); this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes2); }) } @Styles bounceStyle() { .width('60%') .height('60%') .borderRadius(this.spinSize) .backgroundColor(this.spinColor) .shadow(ShadowStyle.OUTER_DEFAULT_XS) } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinF.ets#L26-L95
f769254d3209229fd7ca4056ba34e0651fb16325
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinV.ets
arkts
SpinV
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinV { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local scale2: number = 0.5; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.spinSize * 0.08, radius: this.spinSize, color: { top: this.spinColor, bottom: this.spinColor, left: Color.Transparent, right: Color.Transparent }, }) .rotate({ angle: this.angle1 }) Canvas() .width(this.spinSize * 0.4) .height(this.spinSize * 0.4) .border({ width: this.spinSize * 0.08, radius: this.spinSize, color: this.spinColor, }) .shadow(ShadowStyle.OUTER_DEFAULT_XS) .scale({ x: this.scale2, y: this.scale2 }) } .renderFit(RenderFit.CENTER) .width(this.spinSize) .height(this.spinSize) .onAppear(() => { let keyframes1: Array<KeyframeState> = [ { duration: 1500, curve: Curve.Linear, event: () => { this.angle1 = 360 } }]; let keyframes2: Array<KeyframeState> = [ { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale2 = 1 } }, { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale2 = 0.5 } }]; this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1); this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes2); }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinV AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right angle1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.5 AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.08 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angle1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.08 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left ShadowStyle AST#expression#Right . OUTER_DEFAULT_XS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . renderFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left RenderFit AST#expression#Right . CENTER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes1 : 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 KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1500 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . angle1 AST#member_expression#Right = AST#expression#Left 360 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes2 : 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 KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 0.5 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct SpinV { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local scale2: number = 0.5; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.spinSize * 0.08, radius: this.spinSize, color: { top: this.spinColor, bottom: this.spinColor, left: Color.Transparent, right: Color.Transparent }, }) .rotate({ angle: this.angle1 }) Canvas() .width(this.spinSize * 0.4) .height(this.spinSize * 0.4) .border({ width: this.spinSize * 0.08, radius: this.spinSize, color: this.spinColor, }) .shadow(ShadowStyle.OUTER_DEFAULT_XS) .scale({ x: this.scale2, y: this.scale2 }) } .renderFit(RenderFit.CENTER) .width(this.spinSize) .height(this.spinSize) .onAppear(() => { let keyframes1: Array<KeyframeState> = [ { duration: 1500, curve: Curve.Linear, event: () => { this.angle1 = 360 } }]; let keyframes2: Array<KeyframeState> = [ { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale2 = 1 } }, { duration: 1000, curve: Curve.EaseInOut, event: () => { this.scale2 = 0.5 } }]; this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1); this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes2); }) } }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinV.ets#L26-L87
91e040dc94407e3a0c37e636d6b17dad200951dd
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_EventHub.ets
arkts
页面展示
build() { Column() { Row() { Flex({ justifyContent: FlexAlign.Start, alignContent: FlexAlign.Center }) { Text($r('app.string.DataSynchronization')) .fontSize(24) .fontWeight(700) .textAlign(TextAlign.Start) .margin({ top: 12 , bottom: 11 , right: 24 , left: 24}) } } .width('100%') .height(56) .justifyContent(FlexAlign.Start) .backgroundColor($r('app.color.backGrounding')) List({ initialIndex: 0 }) { ListItem() { Row() { Row(){ Text($r('app.string.EventHubFuncA')) .textAlign(TextAlign.Start) .fontWeight(500) .margin({ top: 13, bottom: 13, left: 0, right: 8 }) .fontSize(16) .width(232) .height(22) .fontColor($r('app.color.text_color')) } .height(48) .width('100%') .borderRadius(24) .margin({ top: 4, bottom: 4, left: 12, right: 12 }) } .onClick(() => { this.eventHubFunc(); promptAction.showToast({ message: $r('app.string.EventHubFuncA') }); }) } .height(56) .backgroundColor($r('app.color.start_window_background')) .borderRadius(24) .margin({ top: 8, right: 12, left: 12 }) ListItem() { Row() { Row(){ Text($r('app.string.EventHubFuncB')) .textAlign(TextAlign.Start) .fontWeight(500) .margin({ top: 13, bottom: 13, left: 0, right: 8 }) .fontSize(16) .width(232) .height(22) .fontColor($r('app.color.text_color')) } .height(48) .width('100%') .borderRadius(24) .margin({ top: 4, bottom: 4, left: 12, right: 12 }) } .onClick(() => { // context为UIAbility实例的AbilityContext this.context.eventHub.off('event1'); promptAction.showToast({ message: $r('app.string.EventHubFuncB') }); }) } .height(56) .backgroundColor($r('app.color.start_window_background')) .borderRadius(24) .margin({ top: 12, right: 12, left: 12 }) } .height('100%') .backgroundColor($r('app.color.backGrounding')) } .width('100%') .margin({ top: 8 }) .backgroundColor($r('app.color.backGrounding')) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.DataSynchronization' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 700 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 11 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 56 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.backGrounding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left initialIndex : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.EventHubFuncA' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 500 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 13 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 13 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 232 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left 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 this AST#expression#Right . eventHubFunc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.EventHubFuncA' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 56 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.start_window_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.EventHubFuncB' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 500 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 13 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 13 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 232 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // context为UIAbility实例的AbilityContext AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . eventHub AST#member_expression#Right AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'event1' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.EventHubFuncB' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 56 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.start_window_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.backGrounding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.backGrounding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Column() { Row() { Flex({ justifyContent: FlexAlign.Start, alignContent: FlexAlign.Center }) { Text($r('app.string.DataSynchronization')) .fontSize(24) .fontWeight(700) .textAlign(TextAlign.Start) .margin({ top: 12 , bottom: 11 , right: 24 , left: 24}) } } .width('100%') .height(56) .justifyContent(FlexAlign.Start) .backgroundColor($r('app.color.backGrounding')) List({ initialIndex: 0 }) { ListItem() { Row() { Row(){ Text($r('app.string.EventHubFuncA')) .textAlign(TextAlign.Start) .fontWeight(500) .margin({ top: 13, bottom: 13, left: 0, right: 8 }) .fontSize(16) .width(232) .height(22) .fontColor($r('app.color.text_color')) } .height(48) .width('100%') .borderRadius(24) .margin({ top: 4, bottom: 4, left: 12, right: 12 }) } .onClick(() => { this.eventHubFunc(); promptAction.showToast({ message: $r('app.string.EventHubFuncA') }); }) } .height(56) .backgroundColor($r('app.color.start_window_background')) .borderRadius(24) .margin({ top: 8, right: 12, left: 12 }) ListItem() { Row() { Row(){ Text($r('app.string.EventHubFuncB')) .textAlign(TextAlign.Start) .fontWeight(500) .margin({ top: 13, bottom: 13, left: 0, right: 8 }) .fontSize(16) .width(232) .height(22) .fontColor($r('app.color.text_color')) } .height(48) .width('100%') .borderRadius(24) .margin({ top: 4, bottom: 4, left: 12, right: 12 }) } .onClick(() => { this.context.eventHub.off('event1'); promptAction.showToast({ message: $r('app.string.EventHubFuncB') }); }) } .height(56) .backgroundColor($r('app.color.start_window_background')) .borderRadius(24) .margin({ top: 12, right: 12, left: 12 }) } .height('100%') .backgroundColor($r('app.color.backGrounding')) } .width('100%') .margin({ top: 8 }) .backgroundColor($r('app.color.backGrounding')) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_EventHub.ets#L44-L126
4c2cb59ade7354951d71b57eb2dc5b6b1d9fbe3a
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/FileUtil.ets
arkts
getCacheDirPath
获取缓存目录下的文件夹路径或文件路径。 @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns
static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir; //根目录 if (StrUtil.isNotEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。 filePath = dirPath; } else { //路径中不包含根目录,拼接成完整路径。 filePath = filePath + FileUtil.separator + dirPath; } if (!FileUtil.accessSync(filePath)) { FileUtil.mkdirSync(filePath); //如果文件夹不存在就创建 } } if (StrUtil.isNotEmpty(fileName)) { filePath = filePath + FileUtil.separator + fileName; } return filePath; }
AST#method_declaration#Left static getCacheDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left blHap : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) 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 let AST#variable_declarator#Left filePath = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left blHap AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . cacheDir AST#member_expression#Right AST#expression#Right : AST#expression#Left getContext AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getApplicationContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . cacheDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //根目录 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtil AST#expression#Right . hasDirPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { //路径中包含根目录,是完整路径。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left dirPath AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { //路径中不包含根目录,拼接成完整路径。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filePath AST#expression#Right + AST#expression#Left FileUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . separator AST#member_expression#Right AST#expression#Right + AST#expression#Left dirPath AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left FileUtil AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#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 FileUtil AST#expression#Right . mkdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //如果文件夹不存在就创建 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filePath AST#expression#Right + AST#expression#Left FileUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . separator AST#member_expression#Right AST#expression#Right + AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left filePath AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir; if (StrUtil.isNotEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { filePath = dirPath; } else { filePath = filePath + FileUtil.separator + dirPath; } if (!FileUtil.accessSync(filePath)) { FileUtil.mkdirSync(filePath); } } if (StrUtil.isNotEmpty(fileName)) { filePath = filePath + FileUtil.separator + fileName; } return filePath; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FileUtil.ets#L63-L79
3d37f2f1f614590af547f48d603d3ec962d42add
gitee
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/userModel.ets
arkts
confirmUser
确认用户是否存在
confirmUser(username: string, password: string): boolean { const user = this.getUser(username); if(user){ console.info(user.username); }else { console.info("666"); return false; } if (user && user.password === password) { return true; } return false; }
AST#method_declaration#Left confirmUser AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left user = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left username AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left user AST#expression#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#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . username AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "666" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left user AST#expression#Right && AST#expression#Left user AST#expression#Right AST#binary_expression#Right AST#expression#Right . password AST#member_expression#Right AST#expression#Right === AST#expression#Left password AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
confirmUser(username: string, password: string): boolean { const user = this.getUser(username); if(user){ console.info(user.username); }else { console.info("666"); return false; } if (user && user.password === password) { return true; } return false; }
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L85-L97
0e9661c14e75582d1c4b4beca26b5d75820c5587
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/data_operation_tools.ets
arkts
Converts a boolean to string. @param str A string form of the boolean: 'true' | 'false'. @returns A boolean, true if the str is exactly 'true'. @returns A boolean, false if otherwise.
export function string_to_boolean(str: string) { return (str == 'true') ? true : false; }
AST#export_declaration#Left export AST#function_declaration#Left function string_to_boolean 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left str AST#expression#Right == AST#expression#Left 'true' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function string_to_boolean(str: string) { return (str == 'true') ? true : false; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L244-L246
d6dfc0a829e2488e484e37aa79335447b4acd516
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/want_tools.ets
arkts
Wants Respond to want. @param uri the want uri @param action the want action @param type the want type @returns True if a want is detected and processed.
export function check_want(uri: string, action: string, type: string, storage: LocalStorage) { if (uri.length == 0) { console.log('[Meow][init] Didn\'t load want for an empty want.'); return false; } console.log('[Meow][want] Load want with uri: ' + uri + ', action: ' + action + ', type: ' + type + ', storage id: ' + storage.get('my_window_id')); // Respond to want if (uri.substring(0, 7) == 'file://') { want_file(uri, storage); } else { if (action == 'ohos.want.action.viewData') { want_web(uri, storage); } } uri = ""; return true; }
AST#export_declaration#Left export AST#function_declaration#Left function check_want AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uri AST#expression#Right . length AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#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#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[Meow][init] Didn\'t load want for an empty want.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right 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#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[Meow][want] Load want with uri: ' AST#expression#Right + AST#expression#Left uri AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ', action: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left action AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ', type: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left type AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ', storage id: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left storage AST#expression#Right AST#binary_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'my_window_id' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Respond to want AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uri AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 7 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 'file://' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left want_file AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right , AST#expression#Left storage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left action AST#expression#Right == AST#expression#Left 'ohos.want.action.viewData' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left want_web AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right , AST#expression#Left storage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left uri = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function check_want(uri: string, action: string, type: string, storage: LocalStorage) { if (uri.length == 0) { console.log('[Meow][init] Didn\'t load want for an empty want.'); return false; } console.log('[Meow][want] Load want with uri: ' + uri + ', action: ' + action + ', type: ' + type + ', storage id: ' + storage.get('my_window_id')); if (uri.substring(0, 7) == 'file://') { want_file(uri, storage); } else { if (action == 'ohos.want.action.viewData') { want_web(uri, storage); } } uri = ""; return true; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/want_tools.ets#L10-L27
3288d8d8b9ee4adf7ec1df1eed288e4e270d5675
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets
arkts
SwiperMainPage
功能说明: 通过Stack组件堆叠图片,实现多层级效果,配合手势滑动和显式动画实现切换的动画效果。同时通过改变数据中间值currentIndex来改变组件zIndex层级和高度来实现切换的效果。 推荐场景: 购物类、资讯类应用的首页轮播 核心组件: 1. SwiperSection: 自定义轮播图 实现步骤: 1. 数据准备。设置SwiperItemViewType(轮播图属性配置)以及初始化轮播图数据。其中SwiperItemViewType包含SwiperData(轮播项数据类)以及 contentBuilder(轮播项视图)两个属性。 @example class SwiperItemViewType { data: SwiperData; contentBuilder: WrappedBuilder<[SwiperData]>; constructor(data: SwiperData, contentBuilder: WrappedBuilder<[SwiperData]>) { this.data = data; this.contentBuilder = contentBuilder; } } SwiperData包含imageSrc(图片路径-必传)、name(标题名称)、appUri(功能模块地址)以及param(传递的参数)。 开发者可以使用以上默认的属性配置,也可以自行配置SwiperItemViewType和SwiperData的属性。 根据以上属性初始化数据。 @example aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData($r('app.media.swipercomponent_mp_chart'), $r('app.string.swipercomponent_swiper_data1'), 'barchart/BarChartPage'), new SwiperData($r('app.media.swipercomponent_lottie'), $r('app.string.swipercomponent_swiper_data2'), 'lottieview/LottieComponent'), new SwiperData($r('app.media.swipercomponent_component_tack'), $r('app.string.swipercomponent_swiper_data3'), 'componentstack/ComponentStack')]; swiperData.forEach((item: SwiperData) => { this.swiperListView.push(new SwiperItemViewType(item, wrapBuilder(SwiperItemView))) }) } 2. 构建indicatorBuilder(自定义导航点)。 @Builder indicatorBuilder() { ··· } 3. 构造自定义轮播视图。 @example SwiperSection({ swiperListView: this.swiperListView, currentIndex: this.currentIndex, swiperAnimationDuration: CommonConstants.SWIPER_ANIMATION_DURATION, swiperSwitchDuration: CommonConstants.SWIPER_SWITCH_DURATION, isLoop: CommonConstants.SWIPER_IS_LOOP, indicatorBuilder: () => { this.indicatorBuilder(); }, swiperItemHandle: (swiperItemData: SwiperData) => { TODO:点击swiper逻辑处理 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈 this.dynamicsRouterPush(swiperItemData); } })
@Component export struct SwiperMainPage { // 轮播模块列表 swiperListView: SwiperItemViewType[] = []; dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{}; // 当前索引 @State currentIndex: number = 0; aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData($r('app.media.swipercomponent_mp_chart'), $r('app.string.swipercomponent_swiper_data1'), 'barchart/BarChartPage'), new SwiperData($r('app.media.swipercomponent_lottie'), $r('app.string.swipercomponent_swiper_data2'), 'lottieview/LottieComponent'), new SwiperData($r('app.media.swipercomponent_component_tack'), $r('app.string.swipercomponent_swiper_data3'), 'componentstack/ComponentStack'), ]; swiperData.forEach((item: SwiperData) => { // item单个轮播图数据,WrapBuilder单个轮播图视图。开发者可以自己配置轮播图数据和视图 this.swiperListView.push(new SwiperItemViewType(item, wrapBuilder(SwiperItemView))); }) } build() { Column() { /** * 轮播图视图 * @param swiperListView: 轮播图列表视图数据 * @param currentIndex: 当前索引值 * @param swiperAnimationDuration: 轮播图切换动画时间 * @param swiperSwitchDuration: 轮播图切换间隔时间 * @param isLoop: 轮播图是否自动循环播放 * @param indicatorBuilder: 导航点自定义视图 * @param swiperItemHandle: 点击轮播图处理逻辑 */ SwiperSection({ swiperListView: this.swiperListView, currentIndex: this.currentIndex, swiperAnimationDuration: CommonConstants.SWIPER_ANIMATION_DURATION, swiperSwitchDuration: CommonConstants.SWIPER_SWITCH_DURATION, isLoop: CommonConstants.SWIPER_IS_LOOP, indicatorBuilder: this.indicatorBuilder, swiperItemHandle: (swiperItemData: SwiperData) => { // TODO:点击swiper逻辑处理 // 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈 this.dynamicsRouterPush(swiperItemData); } }) } } @Builder indicatorBuilder() { Row({ space: CommonConstants.INDICATOR_SPACE }) { ForEach(this.swiperListView, (item: SwiperData, index: number) => { Ellipse(index !== this.currentIndex ? { width: CommonConstants.INDICATOR_DEFAULT_WIDTH, height: CommonConstants.INDICATOR_HEIGHT } : { width: CommonConstants.INDICATOR_SELECTED_WIDTH, height: CommonConstants.INDICATOR_HEIGHT }) .fill(index !== this.currentIndex ? Color.Black : Color.Red) .fillOpacity(CommonConstants.INDICATOR_FILL_OPACITY) }) } .margin({ top: CommonConstants.INDICATOR_MARGIN_TOP }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperMainPage AST#component_body#Left { // 轮播模块列表 AST#property_declaration#Left swiperListView : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SwiperItemViewType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left dynamicsRouterPush : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData 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 AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 当前索引 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left swiperData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SwiperData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = 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 SwiperData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.swipercomponent_mp_chart' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_data1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'barchart/BarChartPage' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SwiperData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.swipercomponent_lottie' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_data2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'lottieview/LottieComponent' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SwiperData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.swipercomponent_component_tack' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.swipercomponent_swiper_data3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'componentstack/ComponentStack' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left swiperData AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // item单个轮播图数据,WrapBuilder单个轮播图视图。开发者可以自己配置轮播图数据和视图 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SwiperItemViewType AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left SwiperItemView AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { /** * 轮播图视图 * @param swiperListView: 轮播图列表视图数据 * @param currentIndex: 当前索引值 * @param swiperAnimationDuration: 轮播图切换动画时间 * @param swiperSwitchDuration: 轮播图切换间隔时间 * @param isLoop: 轮播图是否自动循环播放 * @param indicatorBuilder: 导航点自定义视图 * @param swiperItemHandle: 点击轮播图处理逻辑 */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SwiperSection ( AST#component_parameters#Left { AST#component_parameter#Left swiperListView : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left currentIndex : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left swiperAnimationDuration : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_ANIMATION_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left swiperSwitchDuration : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_SWITCH_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLoop : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SWIPER_IS_LOOP AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left indicatorBuilder : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . indicatorBuilder AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left swiperItemHandle : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left swiperItemData : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:点击swiper逻辑处理 // 点击轮播图Item时,根据点击的模块信息,将页面放入路由栈 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dynamicsRouterPush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left swiperItemData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right indicatorBuilder 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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_SPACE AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperListView AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SwiperData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Ellipse ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_DEFAULT_WIDTH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_HEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_SELECTED_WIDTH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_HEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fillOpacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_FILL_OPACITY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . INDICATOR_MARGIN_TOP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct SwiperMainPage { swiperListView: SwiperItemViewType[] = []; dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{}; @State currentIndex: number = 0; aboutToAppear(): void { let swiperData: SwiperData[] = [ new SwiperData($r('app.media.swipercomponent_mp_chart'), $r('app.string.swipercomponent_swiper_data1'), 'barchart/BarChartPage'), new SwiperData($r('app.media.swipercomponent_lottie'), $r('app.string.swipercomponent_swiper_data2'), 'lottieview/LottieComponent'), new SwiperData($r('app.media.swipercomponent_component_tack'), $r('app.string.swipercomponent_swiper_data3'), 'componentstack/ComponentStack'), ]; swiperData.forEach((item: SwiperData) => { this.swiperListView.push(new SwiperItemViewType(item, wrapBuilder(SwiperItemView))); }) } build() { Column() { SwiperSection({ swiperListView: this.swiperListView, currentIndex: this.currentIndex, swiperAnimationDuration: CommonConstants.SWIPER_ANIMATION_DURATION, swiperSwitchDuration: CommonConstants.SWIPER_SWITCH_DURATION, isLoop: CommonConstants.SWIPER_IS_LOOP, indicatorBuilder: this.indicatorBuilder, swiperItemHandle: (swiperItemData: SwiperData) => { this.dynamicsRouterPush(swiperItemData); } }) } } @Builder indicatorBuilder() { Row({ space: CommonConstants.INDICATOR_SPACE }) { ForEach(this.swiperListView, (item: SwiperData, index: number) => { Ellipse(index !== this.currentIndex ? { width: CommonConstants.INDICATOR_DEFAULT_WIDTH, height: CommonConstants.INDICATOR_HEIGHT } : { width: CommonConstants.INDICATOR_SELECTED_WIDTH, height: CommonConstants.INDICATOR_HEIGHT }) .fill(index !== this.currentIndex ? Color.Black : Color.Red) .fillOpacity(CommonConstants.INDICATOR_FILL_OPACITY) }) } .margin({ top: CommonConstants.INDICATOR_MARGIN_TOP }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets#L83-L147
b29ec2e7319889fffccf4d8631669c5d85f538cf
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/im/IMManager.ets
arkts
connect
连接IM服务(WebSocket)
async connect(): Promise<boolean> { try { Logger.info('IMManager', 'Connecting to IM service'); // 实际实现需要建立WebSocket连接 EventBus.emit('IM_CONNECTED'); return true; } catch (error) { Logger.error('IMManager', `Failed to connect: ${String(error)}`); return false; } }
AST#method_declaration#Left async connect 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#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 AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'IMManager' AST#expression#Right , AST#expression#Left 'Connecting to IM service' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 实际实现需要建立WebSocket连接 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBus AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'IM_CONNECTED' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'IMManager' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to connect: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async connect(): Promise<boolean> { try { Logger.info('IMManager', 'Connecting to IM service'); EventBus.emit('IM_CONNECTED'); return true; } catch (error) { Logger.error('IMManager', `Failed to connect: ${String(error)}`); return false; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L179-L189
f731818ce7dc1555c2377a53f585e96ca2c5c599
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets
arkts
queryAllAudios
获取所有音频文件 @returns
async queryAllAudios(): Promise<Array<Record>> { let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates(); predicates.greaterThan('duration', 0) let fetchOptions: userFileManager.FetchOptions = { fetchColumns: ['duration', 'date_added'], predicates: predicates }; let fetchResult: userFileManager.FetchResult<userFileManager.FileAsset> = await this.mediaTest!.getAudioAssets(fetchOptions); Logger.info(TAG,`queryAllAudios count ${fetchResult.getCount()}`); let fetchArr = await fetchResult.getAllObject(); let result: Record[] = []; for (let i = 0; i < fetchArr.length; i++) { let record: Record = new Record(this.context); await record.init(fetchArr[i], false); result.push(record); } Logger.info(TAG, `queryAllAudios fetchFileResult=${result.length}`); return result; }
AST#method_declaration#Left async queryAllAudios AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Record AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataSharePredicates . DataSharePredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left dataSharePredicates AST#expression#Right AST#new_expression#Right AST#expression#Right . DataSharePredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left predicates AST#expression#Right . greaterThan AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'duration' AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fetchOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userFileManager . FetchOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left fetchColumns AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'duration' AST#expression#Right , AST#expression#Left 'date_added' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left predicates AST#property_name#Right : AST#expression#Left predicates AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fetchResult : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left userFileManager . FetchResult AST#qualified_type#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userFileManager . FileAsset AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . mediaTest AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getAudioAssets AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fetchOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` queryAllAudios count AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fetchResult AST#expression#Right . getCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fetchArr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left fetchResult AST#expression#Right AST#await_expression#Right AST#expression#Right . getAllObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Record [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left fetchArr AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left record : AST#type_annotation#Left AST#primary_type#Left Record AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Record AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left record AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left fetchArr AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left record AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` queryAllAudios fetchFileResult= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async queryAllAudios(): Promise<Array<Record>> { let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates(); predicates.greaterThan('duration', 0) let fetchOptions: userFileManager.FetchOptions = { fetchColumns: ['duration', 'date_added'], predicates: predicates }; let fetchResult: userFileManager.FetchResult<userFileManager.FileAsset> = await this.mediaTest!.getAudioAssets(fetchOptions); Logger.info(TAG,`queryAllAudios count ${fetchResult.getCount()}`); let fetchArr = await fetchResult.getAllObject(); let result: Record[] = []; for (let i = 0; i < fetchArr.length; i++) { let record: Record = new Record(this.context); await record.init(fetchArr[i], false); result.push(record); } Logger.info(TAG, `queryAllAudios fetchFileResult=${result.length}`); return result; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets#L68-L88
ed0037819f6c1334de67ae96fedb4520697dbbec
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/CalendarPage.ets
arkts
buildCalendarDay
构建日历天数
@Builder buildCalendarDay(day: CalendarDay) { Stack() { Column({ space: 2 }) { // 日期数字 Text(day.day.toString()) .fontSize(16) .fontColor(day.isCurrentMonth ? (day.isToday ? '#ffffff' : '#333333') : '#cccccc') .fontWeight(day.isToday ? FontWeight.Bold : FontWeight.Normal) // 农历日期或生日标记 if (this.showLunarCalendar && day.lunarDay) { Text(day.lunarDay) .fontSize(10) .fontColor(day.isCurrentMonth ? '#666666' : '#cccccc') .maxLines(1) } else if (day.hasBirthday) { Text(`${day.birthdays.length}`) .fontSize(10) .fontColor('#ffffff') .backgroundColor('#ff6b6b') .width(16) .height(16) .borderRadius(8) .textAlign(TextAlign.Center) } } .width('100%') .height(50) .justifyContent(FlexAlign.Center) // 今天的背景 if (day.isToday) { Circle({ width: 36, height: 36 }) .fill('#007AFF') .position({ x: '50%', y: '50%' }) .translate({ x: '-50%', y: '-50%' }) } // 选中状态 if (day.date === this.selectedDate && !day.isToday) { Circle({ width: 36, height: 36 }) .fill('transparent') .stroke('#007AFF') .strokeWidth(2) .position({ x: '50%', y: '50%' }) .translate({ x: '-50%', y: '-50%' }) } } .width(`${100/7}%`) .height(50) .onClick(() => { this.onDateSelect(day); }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCalendarDay AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left CalendarDay AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 2 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 日期数字 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . day AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . isCurrentMonth AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . isToday AST#member_expression#Right AST#expression#Right ? AST#expression#Left '#ffffff' AST#expression#Right : AST#expression#Left '#333333' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right : AST#expression#Left '#cccccc' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . isToday AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right : AST#expression#Left FontWeight AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 农历日期或生日标记 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showLunarCalendar AST#member_expression#Right AST#expression#Right && AST#expression#Left day AST#expression#Right AST#binary_expression#Right AST#expression#Right . lunarDay AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . lunarDay AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . isCurrentMonth AST#member_expression#Right AST#expression#Right ? AST#expression#Left '#666666' AST#expression#Right : AST#expression#Left '#cccccc' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . hasBirthday AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . birthdays AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ff6b6b' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 今天的背景 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . isToday AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left 36 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left 36 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '-50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '-50%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 选中状态 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left day AST#expression#Right . date AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . selectedDate AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left day AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isToday AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left 36 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left 36 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( AST#expression#Left 'transparent' AST#expression#Right ) AST#modifier_chain_expression#Left . stroke ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '50%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . translate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '-50%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '-50%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left 100 AST#expression#Right / AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right % ` AST#template_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left 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 this AST#expression#Right . onDateSelect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left day AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildCalendarDay(day: CalendarDay) { Stack() { Column({ space: 2 }) { Text(day.day.toString()) .fontSize(16) .fontColor(day.isCurrentMonth ? (day.isToday ? '#ffffff' : '#333333') : '#cccccc') .fontWeight(day.isToday ? FontWeight.Bold : FontWeight.Normal) if (this.showLunarCalendar && day.lunarDay) { Text(day.lunarDay) .fontSize(10) .fontColor(day.isCurrentMonth ? '#666666' : '#cccccc') .maxLines(1) } else if (day.hasBirthday) { Text(`${day.birthdays.length}`) .fontSize(10) .fontColor('#ffffff') .backgroundColor('#ff6b6b') .width(16) .height(16) .borderRadius(8) .textAlign(TextAlign.Center) } } .width('100%') .height(50) .justifyContent(FlexAlign.Center) if (day.isToday) { Circle({ width: 36, height: 36 }) .fill('#007AFF') .position({ x: '50%', y: '50%' }) .translate({ x: '-50%', y: '-50%' }) } if (day.date === this.selectedDate && !day.isToday) { Circle({ width: 36, height: 36 }) .fill('transparent') .stroke('#007AFF') .strokeWidth(2) .position({ x: '50%', y: '50%' }) .translate({ x: '-50%', y: '-50%' }) } } .width(`${100/7}%`) .height(50) .onClick(() => { this.onDateSelect(day); }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L318-L374
fe5eb8cca2b5bd912efb80724c3369f9c19f82cc
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
isThirdPartyCookieAllowed
获取WebCookieManager实例是否拥有发送和接收第三方cookie的权限。 @returns
static isThirdPartyCookieAllowed(): boolean { return webview.WebCookieManager.isThirdPartyCookieAllowed(); }
AST#method_declaration#Left static isThirdPartyCookieAllowed AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . isThirdPartyCookieAllowed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isThirdPartyCookieAllowed(): boolean { return webview.WebCookieManager.isThirdPartyCookieAllowed(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L179-L181
01d6eac704d3116a7f95a3f8e3329148e88ec178
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
toNotificationSetting
跳转通知设置页面
static toNotificationSetting(): Promise<void> { const parameters: Record<string, Record<string, string>> = { 'pushParams': { 'bundleName': ArkWebHelper.getContext().abilityInfo.bundleName // 应用包名 } }; const URI_NOTIFICATION: string = "systemui_notification_settings"; //通知设置页面 return Tools.toSetting(URI_NOTIFICATION, parameters); }
AST#method_declaration#Left static toNotificationSetting 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#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parameters : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'pushParams' AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'bundleName' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right // 应用包名 } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left URI_NOTIFICATION : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "systemui_notification_settings" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //通知设置页面 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tools AST#expression#Right . toSetting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left URI_NOTIFICATION AST#expression#Right , AST#expression#Left parameters AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static toNotificationSetting(): Promise<void> { const parameters: Record<string, Record<string, string>> = { 'pushParams': { 'bundleName': ArkWebHelper.getContext().abilityInfo.bundleName } }; const URI_NOTIFICATION: string = "systemui_notification_settings"; return Tools.toSetting(URI_NOTIFICATION, parameters); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L64-L72
117672621eff301b4329221a9d8fc5ae2581a3e1
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/Base64Util.ets
arkts
TODO Base64工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class Base64Util { /** * 编码,通过输入参数编码后输出Uint8Array对象。 * @param array * @returns */ static encode(array: Uint8Array): Promise<Uint8Array> { const base64 = new util.Base64Helper(); return base64.encode(array); } /** * 编码,通过输入参数编码后输出Uint8Array对象。 * @param array * @returns */ static encodeSync(array: Uint8Array): Uint8Array { const base64 = new util.Base64Helper(); const result = base64.encodeSync(array); return result; } /** * 编码,通过输入参数编码后输出对应文本。 * @param array * @returns */ static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> { const base64 = new util.Base64Helper(); return base64.encodeToString(array, options); } /** * 编码,通过输入参数编码后输出对应文本。 * @param array * @returns */ static encodeToStrSync(array: Uint8Array, options?: util.Type): string { const base64 = new util.Base64Helper(); const result = base64.encodeToStringSync(array, options); return result; } /** * 解码,通过输入参数解码后输出对应Uint8Array对象。 * @param array * @returns */ static decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> { const base64 = new util.Base64Helper(); return base64.decode(array, options); } /** * 解码,通过输入参数解码后输出对应Uint8Array对象。 * @param array * @returns */ static decodeSync(array: Uint8Array | string, options?: util.Type): Uint8Array { const base64 = new util.Base64Helper(); const result = base64.decodeSync(array, options); return result; } }
AST#export_declaration#Left export AST#class_declaration#Left class Base64Util AST#class_body#Left { /** * 编码,通过输入参数编码后输出Uint8Array对象。 * @param array * @returns */ AST#method_declaration#Left static encode AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . encode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 编码,通过输入参数编码后输出Uint8Array对象。 * @param array * @returns */ AST#method_declaration#Left static encodeSync AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . encodeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 编码,通过输入参数编码后输出对应文本。 * @param array * @returns */ AST#method_declaration#Left static encodeToStr AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Type AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . encodeToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 编码,通过输入参数编码后输出对应文本。 * @param array * @returns */ AST#method_declaration#Left static encodeToStrSync AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Type AST#qualified_type#Right 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#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . encodeToStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 解码,通过输入参数解码后输出对应Uint8Array对象。 * @param array * @returns */ AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Type AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . decode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 解码,通过输入参数解码后输出对应Uint8Array对象。 * @param array * @returns */ AST#method_declaration#Left static decodeSync AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Type AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . decodeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Base64Util { static encode(array: Uint8Array): Promise<Uint8Array> { const base64 = new util.Base64Helper(); return base64.encode(array); } static encodeSync(array: Uint8Array): Uint8Array { const base64 = new util.Base64Helper(); const result = base64.encodeSync(array); return result; } static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> { const base64 = new util.Base64Helper(); return base64.encodeToString(array, options); } static encodeToStrSync(array: Uint8Array, options?: util.Type): string { const base64 = new util.Base64Helper(); const result = base64.encodeToStringSync(array, options); return result; } static decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> { const base64 = new util.Base64Helper(); return base64.decode(array, options); } static decodeSync(array: Uint8Array | string, options?: util.Type): Uint8Array { const base64 = new util.Base64Helper(); const result = base64.decodeSync(array, options); return result; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/Base64Util.ets#L23-L92
7e252eb6ae37579fd8048f2531e048a3a7085480
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/common/Ids.ets
arkts
ID数组 @author Joker.X
export class Ids { /** * 地址ID数组 */ ids: number[]; constructor(ids: number[]) { this.ids = ids; } }
AST#export_declaration#Left export AST#class_declaration#Left class Ids AST#class_body#Left { /** * 地址ID数组 */ AST#property_declaration#Left ids : 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#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left ids : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ids AST#member_expression#Right = AST#expression#Left ids AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Ids { ids: number[]; constructor(ids: number[]) { this.ids = ids; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/common/Ids.ets#L5-L14
96384bd12a0cbd610ca85d9180c7a870d0b27777
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/harB/src/main/ets/components/mainpage/B4.ets
arkts
harBuilder
[Start function_har_builder]
@Builder export function harBuilder(value: object) { NavDestination() { Column() { // [StartExclude function_har_builder] Button($r("app.string.to_harb_pageB3"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { buildRouterModel(RouterNameConstants.ENTRY_HAP, BuilderNameConstants.HARB_B3); }) Button($r("app.string.pop_to_pre_page"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { RouterModule.pop(RouterNameConstants.ENTRY_HAP); }) // [EndExclude function_har_builder] Button($r("app.string.direct_to_harb_pageB1"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { RouterModule.popToName(RouterNameConstants.ENTRY_HAP, BuilderNameConstants.HARB_B1) }) } // [StartExclude function_har_builder] .width('100%') .height('100%') // [EndExclude function_har_builder] } // [StartExclude function_har_builder] .title('B2Page') .onBackPressed(() => { RouterModule.pop(RouterNameConstants.ENTRY_HAP); return true; }) // [EndExclude function_har_builder] }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function harBuilder AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // [StartExclude function_har_builder] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#ERROR#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.to_harb_pageB3" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#ERROR#Right AST#component_parameters#Left { AST#component_parameter#Left stateEffect : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left 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 buildRouterModel AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RouterNameConstants AST#expression#Right . ENTRY_HAP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left BuilderNameConstants AST#expression#Right . HARB_B3 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#ERROR#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.pop_to_pre_page" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#ERROR#Right AST#component_parameters#Left { AST#component_parameter#Left stateEffect : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left 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 RouterModule AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RouterNameConstants AST#expression#Right . ENTRY_HAP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude function_har_builder] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#ERROR#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.direct_to_harb_pageB1" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#ERROR#Right AST#component_parameters#Left { AST#component_parameter#Left stateEffect : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left 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 RouterModule AST#expression#Right . popToName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RouterNameConstants AST#expression#Right . ENTRY_HAP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left BuilderNameConstants AST#expression#Right . HARB_B1 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // [StartExclude function_har_builder] AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude function_har_builder] } AST#container_content_body#Right AST#ui_component#Right // [StartExclude function_har_builder] AST#modifier_chain_expression#Left . title ( AST#expression#Left 'B2Page' AST#expression#Right ) AST#modifier_chain_expression#Left . onBackPressed ( AST#expression#Left AST#arrow_function#Left 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 RouterModule AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RouterNameConstants AST#expression#Right . ENTRY_HAP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude function_har_builder] } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function harBuilder(value: object) { NavDestination() { Column() { Button($r("app.string.to_harb_pageB3"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { buildRouterModel(RouterNameConstants.ENTRY_HAP, BuilderNameConstants.HARB_B3); }) Button($r("app.string.pop_to_pre_page"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { RouterModule.pop(RouterNameConstants.ENTRY_HAP); }) Button($r("app.string.direct_to_harb_pageB1"), { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onClick(() => { RouterModule.popToName(RouterNameConstants.ENTRY_HAP, BuilderNameConstants.HARB_B1) }) } .width('100%') .height('100%') } .title('B2Page') .onBackPressed(() => { RouterModule.pop(RouterNameConstants.ENTRY_HAP); return true; }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/harB/src/main/ets/components/mainpage/B4.ets#L18-L62
20d461ea7b31cade18329175e9bdc4191cb6c9d5
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines suffix icon options. @interface SuffixImageIconOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 14
export interface SuffixImageIconOptions extends IconOptions { /** * Called when the suffix image icon is clicked. * * @type { ?VoidCallback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ action?: VoidCallback; /** * Set accessibility text for icon. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ accessibilityText?: ResourceStr; /** * Set accessibility description for icon. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ accessibilityDescription?: ResourceStr; /** * Set accessibility level for icon. * * @type { ?string } * @default "auto" * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ accessibilityLevel?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SuffixImageIconOptions AST#extends_clause#Left extends IconOptions AST#extends_clause#Right AST#object_type#Left { /** * Called when the suffix image icon is clicked. * * @type { ?VoidCallback } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ AST#type_member#Left action ? : AST#type_annotation#Left AST#primary_type#Left VoidCallback AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Set accessibility text for icon. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ AST#type_member#Left accessibilityText ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Set accessibility description for icon. * * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ AST#type_member#Left accessibilityDescription ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Set accessibility level for icon. * * @type { ?string } * @default "auto" * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ AST#type_member#Left accessibilityLevel ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface SuffixImageIconOptions extends IconOptions { action?: VoidCallback; accessibilityText?: ResourceStr; accessibilityDescription?: ResourceStr; accessibilityLevel?: string; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L68-L113
87cd328ef56d2e7e6e2e71439fcb74eebd44bca2
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Learn.ets
arkts
compareTo
MARK: - Comparable
compareTo(other: Learn): number { if (this.planId === other.planId) { return (this.bookId ?? 0) - (other.bookId ?? 0); } else if (this.bookId === other.bookId) { return (this.num ?? 0) - (other.num ?? 0); } else if (this.num === other.num) { return (this.distance ?? 0) - (other.distance ?? 0); } else if (this.distance === other.distance) { return (this.pieceNo ?? 0) - (other.pieceNo ?? 0); } else if (this.pieceNo === other.pieceNo) { return (this.wordId ?? 0) - (other.wordId ?? 0); } else { return (this.wordId ?? 0) === (other.wordId ?? 0) ? 0 : 1; } }
AST#method_declaration#Left compareTo AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left Learn AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . planId AST#member_expression#Right AST#expression#Right === AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . planId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bookId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left other AST#expression#Right . bookId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bookId AST#member_expression#Right AST#expression#Right === AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . bookId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . num AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left other AST#expression#Right . num AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . num AST#member_expression#Right AST#expression#Right === AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . num AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . distance AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left other AST#expression#Right . distance AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . distance AST#member_expression#Right AST#expression#Right === AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . distance AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left other AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right === AST#expression#Left other AST#expression#Right AST#binary_expression#Right AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wordId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left other AST#expression#Right . wordId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wordId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right === AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left other AST#expression#Right . wordId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
compareTo(other: Learn): number { if (this.planId === other.planId) { return (this.bookId ?? 0) - (other.bookId ?? 0); } else if (this.bookId === other.bookId) { return (this.num ?? 0) - (other.num ?? 0); } else if (this.num === other.num) { return (this.distance ?? 0) - (other.distance ?? 0); } else if (this.distance === other.distance) { return (this.pieceNo ?? 0) - (other.pieceNo ?? 0); } else if (this.pieceNo === other.pieceNo) { return (this.wordId ?? 0) - (other.wordId ?? 0); } else { return (this.wordId ?? 0) === (other.wordId ?? 0) ? 0 : 1; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Learn.ets#L45-L59
fdec641a091b7d36eb2e1aecdc8f4d235034a188
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
disableLoading
全局加载框 @returns
disableLoading(status: boolean = false): EfRcp { efRcpConfig.loading.enable = status; return this; }
AST#method_declaration#Left disableLoading AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EfRcp AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efRcpConfig AST#expression#Right . loading AST#member_expression#Right AST#expression#Right . enable AST#member_expression#Right = AST#expression#Left status AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
disableLoading(status: boolean = false): EfRcp { efRcpConfig.loading.enable = status; return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L389-L392
7201050470209b3b5e1849baa021623d9f25cf97
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets
arkts
AVSession管理模块,负责以下业务功能: 1. 创建/销毁AVSession实例 2. 注册AVSession实例业务回调功能 3. 启动/关闭于AVSession共同使用的音频后台任务
export class AVSessionModel { private bindContext?: Context; private session?: AVSessionManager.AVSession; private avSessionTag: string = 'MUSIC_PLAYER'; private avSessionType: AVSessionManager.AVSessionType = 'audio'; private curState: AVSessionManager.AVPlaybackState = { state: AVSessionManager.PlaybackState.PLAYBACK_STATE_INITIAL, position: { elapsedTime: 0, updateTime: 0, }, loopMode:AVSessionManager.LoopMode.LOOP_MODE_LIST, }; private isBackgroundTaskRunning: boolean = false; // AVPlayer状态同AVSession状态业务对应关系 private playerState2PlaybackStateMap: Map<string, number> = new Map([ [CommonConstants.AVPLAYER_STATE_IDLE, AVSessionManager.PlaybackState.PLAYBACK_STATE_IDLE], [CommonConstants.AVPLAYER_STATE_INITIALIZED, AVSessionManager.PlaybackState.PLAYBACK_STATE_INITIAL], [CommonConstants.AVPLAYER_STATE_PREPARED, AVSessionManager.PlaybackState.PLAYBACK_STATE_PREPARE], [CommonConstants.AVPLAYER_STATE_PLAYING, AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY], [CommonConstants.AVPLAYER_STATE_PAUSED, AVSessionManager.PlaybackState.PLAYBACK_STATE_PAUSE], [CommonConstants.AVPLAYER_STATE_COMPLETED, AVSessionManager.PlaybackState.PLAYBACK_STATE_COMPLETED], [CommonConstants.AVPLAYER_STATE_STOPPED, AVSessionManager.PlaybackState.PLAYBACK_STATE_STOP], [CommonConstants.AVPLAYER_STATE_RELEASED, AVSessionManager.PlaybackState.PLAYBACK_STATE_RELEASED], [CommonConstants.AVPLAYER_STATE_ERROR, AVSessionManager.PlaybackState.PLAYBACK_STATE_ERROR], ]); constructor(context: Context) { this.bindContext = context; } /** * 创建AVSession实例 * @param eventListener AVSession事件回调 * @returns {Promise<void>} */ async createSession(eventListener: AVSessionEventListener): Promise<void> { // TODO:知识点:创建AVSession实例 this.session = await AVSessionManager.createAVSession(this.bindContext!, this.avSessionTag, this.avSessionType); // TODO:知识点:注册AVSession事件 this.registerSessionListener(eventListener); // TODO:知识点:激活AVSession实例 await this.session.activate().catch((error: BusinessError) => { logger.error('activate error: ', error.code.toString(), error.message) }); logger.info(`session create done : sessionId : ${this.session.sessionId}`); } /** * 销毁AVSession实例 * @returns {void} */ destroySession(): void { // TODO:知识点:注销AVSession事件 this.unRegisterListener(); // TODO:知识点:销毁AVSession实例 this.session?.destroy((err) => { if (err) { logger.error(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`); } else { logger.info('Destroy : SUCCESS'); } }); } /** * 注册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(); }); // 停止 this.session?.on('stop', () => { logger.info('avsession on stop'); eventListener.onStop(); }); // 下一首 this.session?.on('playNext', async () => { logger.info('avsession on playNext'); eventListener.onPlayNext(); }); // 上一首 this.session?.on('playPrevious', async () => { logger.info('avsession on playPrevious'); eventListener.onPlayPrevious(); }); // 拖进度 this.session?.on('seek', (position) => { logger.info('avsession on seek', position.toString()); eventListener.onSeek(position); }); // 标记喜好 this.session?.on('toggleFavorite', (assetId) => { logger.info('avsession on toggleFavorite', assetId); }); // 播放循环模式切换 this.session?.on('setLoopMode', (mode) => { logger.info('avsession on setLoopMode', mode.toString()); eventListener.onSetLoopMode(); }); // 快进 this.session?.on('fastForward', (skipInterval?: number) => { logger.info('avsession on fastForward', skipInterval ? skipInterval?.toString() : 'no skipInterval'); }); // 快退 this.session?.on('rewind', (skipInterval?: number) => { logger.info('avsession on rewind', skipInterval ? skipInterval?.toString() : 'no skipInterval'); }); } /** * 注销AVSession实例事件 * @returns {void} */ unRegisterListener(): void { this.session?.off('play'); this.session?.off('pause'); this.session?.off('stop'); this.session?.off('playNext'); this.session?.off('playPrevious'); this.session?.off('fastForward'); this.session?.off('rewind'); this.session?.off('seek'); this.session?.off('setLoopMode'); this.session?.off('toggleFavorite'); } /** * 设置AVSession实例初始化数据和状态 * @param {MusicModel | undefined} musicModel 歌曲数据 * @returns {Promise<void>} */ async setSessionInfo(musicModel?: MusicModel): Promise<void> { const resourceManager = this.bindContext!.resourceManager; const coverUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.cover!); const imageBuffer: ArrayBuffer = coverUInt8Arr.buffer as ArrayBuffer; const imageSource: image.ImageSource = image.createImageSource(imageBuffer); const imagePixel: image.PixelMap = await imageSource.createPixelMap({ desiredSize: { width: CommonConstants.MUSIC_MEDIA_IMAGE_WIDTH, height: CommonConstants.MUSIC_MEDIA_IMAGE_HEIGHT } }); const lrcUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.lrcRes!); const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const lrcStr: string = textDecoder.decodeToString(lrcUInt8Arr, { stream: false }); // 设置必要的媒体信息 let metadata: AVSessionManager.AVMetadata = { assetId: 'testMusic', // 由应用指定,用于标识应用媒体库里的媒体 title: musicModel?.title, mediaImage: imagePixel, artist: musicModel?.singer, duration: musicModel?.totalTime, lyric: lrcStr } // TODO:知识点:设置AVSession元信息 this.session?.setAVMetadata(metadata).then(() => { logger.info(`SetAVMetadata successfully`); }).catch((err: BusinessError) => { logger.error(`Failed to set AVMetadata. Code: ${err.code}, message: ${err.message}`); }); // 设置状态: 播放状态,进度位置,播放倍速,缓存的时间 this.curState.state = AVSessionManager.PlaybackState.PLAYBACK_STATE_PREPARE; this.curState.position = { elapsedTime: 0, updateTime: new Date().getTime() } this.setAVPlaybackState(); } /** * 更新AVSession实例状态 * @param {AVSessionUpdateState} updateState 更新状态数据 * @returns {void} */ updateCurState(updateState: AVSessionUpdateState): void { const newState: string | undefined = updateState.playerState; const newElapsedTime: number | undefined = updateState.curTime; const newLoopMode: number | undefined = updateState.loopMode; logger.info('avsession updateCurState', newState + '', newElapsedTime + ''); // 播控中心状态更新 if (newState !== undefined) { this.curState.state = this.playerState2PlaybackStateMap.get(newState); } // 单曲进度更新 if (newElapsedTime !== undefined) { this.curState.position = { elapsedTime: newElapsedTime, updateTime: new Date().getTime() } } // 循环播放模式更新 if (newLoopMode !== undefined) { this.curState.loopMode = newLoopMode; } this.setAVPlaybackState(); } /** * 设置AVSession实例状态 * @returns {void} */ setAVPlaybackState(): void { logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState)); // TODO:知识点:设置AVSession当前状态 this.session?.setAVPlaybackState(this.curState, (err) => { if (err) { logger.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`); } else { logger.info(`SetAVPlaybackState successfully`); } }); } /** * 启动后台任务 * @returns {void} */ startContinuousTask(): void { // 避免重新启动后台任务 if (this.isBackgroundTaskRunning) { return; } // TODO:知识点:创建WantAgent实例,在后台任务时拉起应用 let wantAgentInfo: wantAgent.WantAgentInfo = { // 点击通知后,将要执行的动作列表 // 添加需要被拉起应用的bundleName和abilityName wants: [ { bundleName: 'com.samples.musicplayer', abilityName: 'com.samples.musicplayer.EntryAbility' } ], // 指定点击通知栏消息后的动作是拉起ability actionType: wantAgent.OperationType.START_ABILITY, // 使用者自定义的一个私有值 requestCode: 0, // 点击通知后,动作执行属性 actionFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] }; // 通过wantAgent模块下getWantAgent方法获取WantAgent对象 wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj: WantAgent) => { // TODO:知识点:设置后台任务类型,启动后台任务 backgroundTaskManager.startBackgroundRunning(this.bindContext!, backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, wantAgentObj).then(() => { // 此处执行具体的长时任务逻辑,如放音等。 logger.info(`Succeeded in operationing startBackgroundRunning.`); this.isBackgroundTaskRunning = true; }).catch((err: BusinessError) => { logger.error(`Failed to operation startBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); }); } /** * 结束后台任务 * @returns {void} */ stopContinuousTask(): void { // 避免重新停止后台任务 if (!this.isBackgroundTaskRunning) { return; } // TODO:知识点:停止后台任务 backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => { logger.info(`Succeeded in operationing stopBackgroundRunning.`); this.isBackgroundTaskRunning = false; }).catch((err: BusinessError) => { logger.error(`Failed to operation stopBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); } }
AST#export_declaration#Left export AST#class_declaration#Left class AVSessionModel AST#class_body#Left { AST#property_declaration#Left private bindContext ? : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private session ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AVSessionManager . AVSession AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private avSessionTag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'MUSIC_PLAYER' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private avSessionType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AVSessionManager . AVSessionType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'audio' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private curState : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AVSessionManager . AVPlaybackState AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left state AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_INITIAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left position AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left elapsedTime AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updateTime AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left loopMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . LoopMode AST#member_expression#Right AST#expression#Right . LOOP_MODE_LIST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private isBackgroundTaskRunning : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // AVPlayer状态同AVSession状态业务对应关系 AST#property_declaration#Left private playerState2PlaybackStateMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_IDLE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_IDLE AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_INITIALIZED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_INITIAL AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_PREPARED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_PREPARE AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_PLAYING AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_PLAY AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_PAUSED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_PAUSE AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_COMPLETED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_COMPLETED AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_STOPPED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_STOP AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_RELEASED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_RELEASED AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . AVPLAYER_STATE_ERROR AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_ERROR AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindContext AST#member_expression#Right = AST#expression#Left context AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /** * 创建AVSession实例 * @param eventListener AVSession事件回调 * @returns {Promise<void>} */ AST#method_declaration#Left async createSession 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_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#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // TODO:知识点:创建AVSession实例 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AVSessionManager AST#expression#Right AST#await_expression#Right AST#expression#Right . createAVSession AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindContext AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avSessionTag AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avSessionType AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO:知识点:注册AVSession事件 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . registerSessionListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left eventListener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO:知识点:激活AVSession实例 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . session AST#member_expression#Right AST#expression#Right . activate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'activate error: ' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` session create done : sessionId : AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right . sessionId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 销毁AVSession实例 * @returns {void} */ AST#method_declaration#Left destroySession 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 { // TODO:知识点:注销AVSession事件 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . unRegisterListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO:知识点:销毁AVSession实例 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#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 logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Destroy BusinessError: code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Destroy : SUCCESS' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 注册AVSession实例事件 * 播控中心有多种操作,播放、暂停、停止、下一首、上一首、拖进度、标记喜好、播放循环模式切换、快进、快退 * @returns {void} */ 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_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 播放 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'play' AST#expression#Right , AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on play' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventListener AST#expression#Right . onPlay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 暂停 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pause' AST#expression#Right , AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on pause' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventListener AST#expression#Right . onPause AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 停止 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stop' AST#expression#Right , AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on stop' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventListener AST#expression#Right . onStop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 下一首 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'playNext' AST#expression#Right , AST#expression#Left AST#arrow_function#Left async 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on playNext' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventListener AST#expression#Right . onPlayNext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 上一首 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'playPrevious' AST#expression#Right , AST#expression#Left AST#arrow_function#Left async 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on playPrevious' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventListener AST#expression#Right . onPlayPrevious AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 拖进度 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seek' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left position AST#parameter#Right ) 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on seek' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left position AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventListener AST#expression#Right . onSeek AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left position AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 标记喜好 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'toggleFavorite' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left assetId AST#parameter#Right ) 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on toggleFavorite' AST#expression#Right , AST#expression#Left assetId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 播放循环模式切换 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'setLoopMode' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left mode AST#parameter#Right ) 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on setLoopMode' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mode AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eventListener AST#expression#Right . onSetLoopMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 快进 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'fastForward' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left skipInterval ? : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on fastForward' AST#expression#Right , AST#expression#Left AST#conditional_expression#Left AST#expression#Left skipInterval AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left skipInterval AST#expression#Right ?. toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 'no skipInterval' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 快退 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'rewind' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left skipInterval ? : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession on rewind' AST#expression#Right , AST#expression#Left AST#conditional_expression#Left AST#expression#Left skipInterval AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left skipInterval AST#expression#Right ?. toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left 'no skipInterval' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 注销AVSession实例事件 * @returns {void} */ AST#method_declaration#Left unRegisterListener AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'play' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pause' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stop' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'playNext' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'playPrevious' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'fastForward' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'rewind' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seek' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'setLoopMode' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'toggleFavorite' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 设置AVSession实例初始化数据和状态 * @param {MusicModel | undefined} musicModel 歌曲数据 * @returns {Promise<void>} */ AST#method_declaration#Left async setSessionInfo AST#parameter_list#Left ( AST#parameter#Left musicModel ? : AST#type_annotation#Left AST#primary_type#Left MusicModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resourceManager = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindContext AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left coverUInt8Arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left resourceManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getRawFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left musicModel AST#expression#Right ?. cover AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imageBuffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left coverUInt8Arr AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageBuffer AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imagePixel : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left imageSource AST#expression#Right AST#await_expression#Right AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left desiredSize AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MUSIC_MEDIA_IMAGE_WIDTH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MUSIC_MEDIA_IMAGE_HEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lrcUInt8Arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left resourceManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getRawFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left musicModel AST#expression#Right ?. lrcRes AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left textDecoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . TextDecoder AST#member_expression#Right AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'utf-8' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left ignoreBOM AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lrcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textDecoder AST#expression#Right . decodeToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lrcUInt8Arr AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left stream AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 设置必要的媒体信息 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left metadata : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AVSessionManager . AVMetadata AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left assetId AST#property_name#Right : AST#expression#Left 'testMusic' AST#expression#Right AST#property_assignment#Right , // 由应用指定,用于标识应用媒体库里的媒体 AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left musicModel AST#expression#Right ?. title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left mediaImage AST#property_name#Right : AST#expression#Left imagePixel AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left artist AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left musicModel AST#expression#Right ?. singer AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left musicModel AST#expression#Right ?. totalTime AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lyric AST#property_name#Right : AST#expression#Left lrcStr AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right // TODO:知识点:设置AVSession元信息 AST#ERROR#Left this AST#ERROR#Right . session AST#member_expression#Right AST#expression#Right ?. setAVMetadata AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left metadata AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` SetAVMetadata successfully ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set AVMetadata. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 设置状态: 播放状态,进度位置,播放倍速,缓存的时间 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right . state AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AVSessionManager AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_PREPARE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left elapsedTime AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updateTime AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setAVPlaybackState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 更新AVSession实例状态 * @param {AVSessionUpdateState} updateState 更新状态数据 * @returns {void} */ AST#method_declaration#Left updateCurState AST#parameter_list#Left ( AST#parameter#Left updateState : AST#type_annotation#Left AST#primary_type#Left AVSessionUpdateState 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 AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newState : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left updateState AST#expression#Right . playerState AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newElapsedTime : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left updateState AST#expression#Right . curTime AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newLoopMode : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left updateState AST#expression#Right . loopMode AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession updateCurState' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left newState AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left newElapsedTime AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 播控中心状态更新 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left newState AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right . state AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playerState2PlaybackStateMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newState AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 单曲进度更新 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left newElapsedTime AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right . position AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left elapsedTime AST#property_name#Right : AST#expression#Left newElapsedTime AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updateTime AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 循环播放模式更新 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left newLoopMode AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right . loopMode AST#member_expression#Right = AST#expression#Left newLoopMode AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setAVPlaybackState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 设置AVSession实例状态 * @returns {void} */ AST#method_declaration#Left setAVPlaybackState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession setAVPlaybackState' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO:知识点:设置AVSession当前状态 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. setAVPlaybackState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#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 logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set AVPlaybackState. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` SetAVPlaybackState successfully ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 启动后台任务 * @returns {void} */ AST#method_declaration#Left startContinuousTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 避免重新启动后台任务 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBackgroundTaskRunning AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // TODO:知识点:创建WantAgent实例,在后台任务时拉起应用 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left wantAgentInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left wantAgent . WantAgentInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { // 点击通知后,将要执行的动作列表 // 添加需要被拉起应用的bundleName和abilityName AST#property_assignment#Left AST#property_name#Left wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left 'com.samples.musicplayer' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'com.samples.musicplayer.EntryAbility' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , // 指定点击通知栏消息后的动作是拉起ability AST#property_assignment#Left AST#property_name#Left actionType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . START_ABILITY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 使用者自定义的一个私有值 AST#property_assignment#Left AST#property_name#Left requestCode AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 点击通知后,动作执行属性 AST#property_assignment#Left AST#property_name#Left actionFlags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . WantAgentFlags AST#member_expression#Right AST#expression#Right . UPDATE_PRESENT_FLAG AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过wantAgent模块下getWantAgent方法获取WantAgent对象 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . getWantAgent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wantAgentInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left wantAgentObj : AST#type_annotation#Left AST#primary_type#Left WantAgent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:知识点:设置后台任务类型,启动后台任务 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left backgroundTaskManager AST#expression#Right . startBackgroundRunning AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindContext AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left backgroundTaskManager AST#expression#Right . BackgroundMode AST#member_expression#Right AST#expression#Right . AUDIO_PLAYBACK AST#member_expression#Right AST#expression#Right , AST#expression#Left wantAgentObj AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Succeeded in operationing startBackgroundRunning. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBackgroundTaskRunning AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to operation startBackgroundRunning. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 结束后台任务 * @returns {void} */ AST#method_declaration#Left stopContinuousTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 避免重新停止后台任务 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isBackgroundTaskRunning AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // TODO:知识点:停止后台任务 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left backgroundTaskManager AST#expression#Right . stopBackgroundRunning AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindContext AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Succeeded in operationing stopBackgroundRunning. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBackgroundTaskRunning AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to operation stopBackgroundRunning. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class AVSessionModel { private bindContext?: Context; private session?: AVSessionManager.AVSession; private avSessionTag: string = 'MUSIC_PLAYER'; private avSessionType: AVSessionManager.AVSessionType = 'audio'; private curState: AVSessionManager.AVPlaybackState = { state: AVSessionManager.PlaybackState.PLAYBACK_STATE_INITIAL, position: { elapsedTime: 0, updateTime: 0, }, loopMode:AVSessionManager.LoopMode.LOOP_MODE_LIST, }; private isBackgroundTaskRunning: boolean = false; private playerState2PlaybackStateMap: Map<string, number> = new Map([ [CommonConstants.AVPLAYER_STATE_IDLE, AVSessionManager.PlaybackState.PLAYBACK_STATE_IDLE], [CommonConstants.AVPLAYER_STATE_INITIALIZED, AVSessionManager.PlaybackState.PLAYBACK_STATE_INITIAL], [CommonConstants.AVPLAYER_STATE_PREPARED, AVSessionManager.PlaybackState.PLAYBACK_STATE_PREPARE], [CommonConstants.AVPLAYER_STATE_PLAYING, AVSessionManager.PlaybackState.PLAYBACK_STATE_PLAY], [CommonConstants.AVPLAYER_STATE_PAUSED, AVSessionManager.PlaybackState.PLAYBACK_STATE_PAUSE], [CommonConstants.AVPLAYER_STATE_COMPLETED, AVSessionManager.PlaybackState.PLAYBACK_STATE_COMPLETED], [CommonConstants.AVPLAYER_STATE_STOPPED, AVSessionManager.PlaybackState.PLAYBACK_STATE_STOP], [CommonConstants.AVPLAYER_STATE_RELEASED, AVSessionManager.PlaybackState.PLAYBACK_STATE_RELEASED], [CommonConstants.AVPLAYER_STATE_ERROR, AVSessionManager.PlaybackState.PLAYBACK_STATE_ERROR], ]); constructor(context: Context) { this.bindContext = context; } async createSession(eventListener: AVSessionEventListener): Promise<void> { this.session = await AVSessionManager.createAVSession(this.bindContext!, this.avSessionTag, this.avSessionType); this.registerSessionListener(eventListener); await this.session.activate().catch((error: BusinessError) => { logger.error('activate error: ', error.code.toString(), error.message) }); logger.info(`session create done : sessionId : ${this.session.sessionId}`); } destroySession(): void { this.unRegisterListener(); this.session?.destroy((err) => { if (err) { logger.error(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`); } else { logger.info('Destroy : SUCCESS'); } }); } 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(); }); this.session?.on('stop', () => { logger.info('avsession on stop'); eventListener.onStop(); }); this.session?.on('playNext', async () => { logger.info('avsession on playNext'); eventListener.onPlayNext(); }); this.session?.on('playPrevious', async () => { logger.info('avsession on playPrevious'); eventListener.onPlayPrevious(); }); this.session?.on('seek', (position) => { logger.info('avsession on seek', position.toString()); eventListener.onSeek(position); }); this.session?.on('toggleFavorite', (assetId) => { logger.info('avsession on toggleFavorite', assetId); }); 循环模式切换 this.session?.on('setLoopMode', (mode) => { logger.info('avsession on setLoopMode', mode.toString()); eventListener.onSetLoopMode(); }); this.session?.on('fastForward', (skipInterval?: number) => { logger.info('avsession on fastForward', skipInterval ? skipInterval?.toString() : 'no skipInterval'); }); this.session?.on('rewind', (skipInterval?: number) => { logger.info('avsession on rewind', skipInterval ? skipInterval?.toString() : 'no skipInterval'); }); } unRegisterListener(): void { this.session?.off('play'); this.session?.off('pause'); this.session?.off('stop'); this.session?.off('playNext'); this.session?.off('playPrevious'); this.session?.off('fastForward'); this.session?.off('rewind'); this.session?.off('seek'); this.session?.off('setLoopMode'); this.session?.off('toggleFavorite'); } async setSessionInfo(musicModel?: MusicModel): Promise<void> { const resourceManager = this.bindContext!.resourceManager; const coverUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.cover!); const imageBuffer: ArrayBuffer = coverUInt8Arr.buffer as ArrayBuffer; const imageSource: image.ImageSource = image.createImageSource(imageBuffer); const imagePixel: image.PixelMap = await imageSource.createPixelMap({ desiredSize: { width: CommonConstants.MUSIC_MEDIA_IMAGE_WIDTH, height: CommonConstants.MUSIC_MEDIA_IMAGE_HEIGHT } }); const lrcUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.lrcRes!); const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const lrcStr: string = textDecoder.decodeToString(lrcUInt8Arr, { stream: false }); let metadata: AVSessionManager.AVMetadata = { assetId: 'testMusic', title: musicModel?.title, mediaImage: imagePixel, artist: musicModel?.singer, duration: musicModel?.totalTime, lyric: lrcStr } this.session?.setAVMetadata(metadata).then(() => { logger.info(`SetAVMetadata successfully`); }).catch((err: BusinessError) => { logger.error(`Failed to set AVMetadata. Code: ${err.code}, message: ${err.message}`); }); this.curState.state = AVSessionManager.PlaybackState.PLAYBACK_STATE_PREPARE; this.curState.position = { elapsedTime: 0, updateTime: new Date().getTime() } this.setAVPlaybackState(); } updateCurState(updateState: AVSessionUpdateState): void { const newState: string | undefined = updateState.playerState; const newElapsedTime: number | undefined = updateState.curTime; const newLoopMode: number | undefined = updateState.loopMode; logger.info('avsession updateCurState', newState + '', newElapsedTime + ''); if (newState !== undefined) { this.curState.state = this.playerState2PlaybackStateMap.get(newState); } if (newElapsedTime !== undefined) { this.curState.position = { elapsedTime: newElapsedTime, updateTime: new Date().getTime() } } if (newLoopMode !== undefined) { this.curState.loopMode = newLoopMode; } this.setAVPlaybackState(); } setAVPlaybackState(): void { logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState)); this.session?.setAVPlaybackState(this.curState, (err) => { if (err) { logger.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`); } else { logger.info(`SetAVPlaybackState successfully`); } }); } startContinuousTask(): void { if (this.isBackgroundTaskRunning) { return; } let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: 'com.samples.musicplayer', abilityName: 'com.samples.musicplayer.EntryAbility' } ], actionType: wantAgent.OperationType.START_ABILITY, requestCode: 0, actionFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] }; wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj: WantAgent) => { backgroundTaskManager.startBackgroundRunning(this.bindContext!, backgroundTaskManager.BackgroundMode.AUDIO_PLAYBACK, wantAgentObj).then(() => { logger.info(`Succeeded in operationing startBackgroundRunning.`); this.isBackgroundTaskRunning = true; }).catch((err: BusinessError) => { logger.error(`Failed to operation startBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); }); } stopContinuousTask(): void { if (!this.isBackgroundTaskRunning) { return; } backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => { logger.info(`Succeeded in operationing stopBackgroundRunning.`); this.isBackgroundTaskRunning = false; }).catch((err: BusinessError) => { logger.error(`Failed to operation stopBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets#L33-L334
68f44625286e5d59e7e62fcdf9f1ae46c4812d7e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets
arkts
initCircleRadius
设置悬浮球直径
initCircleRadius(): void { this.circleDiameter = this.getMinWidth(); // 获取半径 this.circleRadius = this.circleDiameter / 2; this.circleOffsetX = this.circleRadius; // 悬浮球 y 轴偏移直径的 三分之一 this.circleOffsetY = this.circleDiameter / 3; }
AST#method_declaration#Left initCircleRadius 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleDiameter AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMinWidth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 获取半径 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleRadius AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleDiameter AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleOffsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleRadius AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 悬浮球 y 轴偏移直径的 三分之一 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleOffsetY AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . circleDiameter AST#member_expression#Right AST#expression#Right / AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
initCircleRadius(): void { this.circleDiameter = this.getMinWidth(); this.circleRadius = this.circleDiameter / 2; this.circleOffsetX = this.circleRadius; this.circleOffsetY = this.circleDiameter / 3; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L190-L198
29b9021561b98ee0d2080a3c35fc2ae313a69503
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/database/SensorData.ets
arkts
Database sensor steps entity class.
export default class SensorData { /** * Time of walking steps. */ date: string = ''; /** * Value of steps. */ stepsValue: number = 0; /** * Gets the number of steps to insert a form. * * @return Return steps. */ toValuesBucket(): relationalStore.ValuesBucket { return { 'date': this.date, 'stepsValue': this.stepsValue }; } }
AST#export_declaration#Left export default AST#class_declaration#Left class SensorData AST#class_body#Left { /** * Time of walking steps. */ AST#property_declaration#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right /** * Value of steps. */ AST#property_declaration#Left stepsValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /** * Gets the number of steps to insert a form. * * @return Return steps. */ AST#method_declaration#Left toValuesBucket AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'date' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'stepsValue' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . stepsValue AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class SensorData { date: string = ''; stepsValue: number = 0; toValuesBucket(): relationalStore.ValuesBucket { return { 'date': this.date, 'stepsValue': this.stepsValue }; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/database/SensorData.ets#L21-L42
e3b146e989ed56c7273d77c828ec0a0c9420e3d5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
navigateToAddressSelection
跳转到地址选择页面 @returns {void} 无返回值
navigateToAddressSelection(): void { UserNavigator.toAddressList(true) .then((result?: UserSelectAddressResult): void => { if (result?.address) { this.updateSelectedAddress(result.address); } }); }
AST#method_declaration#Left navigateToAddressSelection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left UserNavigator AST#expression#Right . toAddressList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result ? : AST#type_annotation#Left AST#primary_type#Left UserSelectAddressResult 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 AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right ?. address AST#member_expression#Right AST#expression#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 this AST#expression#Right . updateSelectedAddress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . address AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
navigateToAddressSelection(): void { UserNavigator.toAddressList(true) .then((result?: UserSelectAddressResult): void => { if (result?.address) { this.updateSelectedAddress(result.address); } }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L273-L280
69b3e50297f197169f0d8ad46770a6903fc0b275
github