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
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
排行榜条目接口
export interface LeaderboardEntry { userId: string; username: string; avatar?: string; level: number; points: number; rank: number; change: number; achievements: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LeaderboardEntry AST#object_type#Left { AST#type_member#Left userId : 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 username : 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 avatar ? : 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 level : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left points : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left rank : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left change : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left achievements : 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 LeaderboardEntry { userId: string; username: string; avatar?: string; level: number; points: number; rank: number; change: number; achievements: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L237-L246
0cb8bf0d678ac06aa9e445a5169774a748653193
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_ecb_encryption_decryption/sm4_ecb_encryption_decryption_asynchronous.ets
arkts
decryptMessagePromise
解密消息
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|ECB|PKCS7'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null); let decryptData = await decoder.doFinal(cipherText); return decryptData; }
AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cipherText : 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_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SM4_128|ECB|PKCS7' 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 decoder 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_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 decryptData = 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 decoder AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cipherText 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 decryptData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('SM4_128|ECB|PKCS7'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, null); let decryptData = await decoder.doFinal(cipherText); return decryptData; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_ecb_encryption_decryption/sm4_ecb_encryption_decryption_asynchronous.ets#L29-L34
c54e09e86dbda6168e5ffa67f30c67f8e2f50735
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KvUtil.ets
arkts
get
获取指定键的值。 @param key 要查询数据的Key @param callback
static async get(key: string, defValue?: string | number | boolean | Uint8Array): Promise<string | number | boolean | Uint8Array | undefined> { let kvStore = await KvUtil.getKvStore(); return kvStore.get(key).catch((e: BusinessError) => { return defValue; }); }
AST#method_declaration#Left static async get AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defValue ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_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 kvStore = 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 KvUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getKvStore 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left kvStore AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key 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 e : 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#return_statement#Left return AST#expression#Left defValue AST#expression#Right ; AST#return_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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async get(key: string, defValue?: string | number | boolean | Uint8Array): Promise<string | number | boolean | Uint8Array | undefined> { let kvStore = await KvUtil.getKvStore(); return kvStore.get(key).catch((e: BusinessError) => { return defValue; }); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L72-L77
f8a962626d62f7e1d0cc4ddda2b88f1a8d9aba70
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/common/CommonConstants.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 CommonConstants { //toast停留时间 static readonly TOAST_DURATION: number = 2000; static readonly FONT_WEIGHT: number = 500; //分割线高度 static readonly DIVIDER_HEIGHT: number = 2; static readonly MIN_BORDER_WIDTH: number = 1; //输入地址最大字数 static readonly ADDRESS_MAX_LENGTH: number = 200; static readonly BOTTOM_MARGIN: number = 10; //组件间距 static readonly SPACE_GAP_24 = 24; static readonly SPACE_GAP_12 = 12; static readonly SPACE_GAP_10 = 10; static readonly SPACE_GAP_8 = 8; static readonly SPACE_GAP_4 = 4; static readonly SPACE_GAP_2 = 2; //动画过渡时长 static readonly ANIMATION_DURATION = 200; static readonly DEFAULT_TEXT: string = '粘贴文本到此处,将自动识别收货信息 例:涛涛,18888888888,浙江省杭州市西湖区某小区'; // 相机选择器处理成功 static readonly CAMERA_PICKER_RESULT_CODE_SUCCESS: number = 0; // 相机选择器处理失败 static readonly CAMERA_PICKER_RESULT_CODE_FAILURE: number = -1; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { //toast停留时间 AST#property_declaration#Left static readonly TOAST_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2000 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right //分割线高度 AST#property_declaration#Left static readonly DIVIDER_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MIN_BORDER_WIDTH : 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 static readonly ADDRESS_MAX_LENGTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BOTTOM_MARGIN : 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#property_declaration#Right //组件间距 AST#property_declaration#Left static readonly SPACE_GAP_24 = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SPACE_GAP_12 = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SPACE_GAP_10 = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SPACE_GAP_8 = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SPACE_GAP_4 = AST#expression#Left 4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SPACE_GAP_2 = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right //动画过渡时长 AST#property_declaration#Left static readonly ANIMATION_DURATION = AST#expression#Left 200 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DEFAULT_TEXT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '粘贴文本到此处,将自动识别收货信息 例:涛涛,18888888888,浙江省杭州市西湖区某小区' AST#expression#Right ; AST#property_declaration#Right // 相机选择器处理成功 AST#property_declaration#Left static readonly CAMERA_PICKER_RESULT_CODE_SUCCESS : 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 static readonly CAMERA_PICKER_RESULT_CODE_FAILURE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommonConstants { static readonly TOAST_DURATION: number = 2000; static readonly FONT_WEIGHT: number = 500; static readonly DIVIDER_HEIGHT: number = 2; static readonly MIN_BORDER_WIDTH: number = 1; static readonly ADDRESS_MAX_LENGTH: number = 200; static readonly BOTTOM_MARGIN: number = 10; static readonly SPACE_GAP_24 = 24; static readonly SPACE_GAP_12 = 12; static readonly SPACE_GAP_10 = 10; static readonly SPACE_GAP_8 = 8; static readonly SPACE_GAP_4 = 4; static readonly SPACE_GAP_2 = 2; static readonly ANIMATION_DURATION = 200; static readonly DEFAULT_TEXT: string = '粘贴文本到此处,将自动识别收货信息 例:涛涛,18888888888,浙江省杭州市西湖区某小区'; static readonly CAMERA_PICKER_RESULT_CODE_SUCCESS: number = 0; static readonly CAMERA_PICKER_RESULT_CODE_FAILURE: number = -1; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/common/CommonConstants.ets#L16-L41
542d95e31e3d5991cb2a935960e7df92d5ad4c02
gitee
openharmony/xts_tools
784a2e99d894e6bc2aba8c38f6bb68032442b1c8
sample/AppSampleE/entry/src/main/ets/pages/takeaway/Commodity.ets
arkts
rowStyleShop
重置
@Extend(Row) function rowStyleShop() { .width('95%') .height(170) .borderRadius(8) .margin({ top: 12 }) .padding(12) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Row AST#expression#Right ) AST#decorator#Right function rowStyleShop AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '95%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 170 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 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#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 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#decorated_function_declaration#Right
@Extend(Row) function rowStyleShop() { .width('95%') .height(170) .borderRadius(8) .margin({ top: 12 }) .padding(12) }
https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleE/entry/src/main/ets/pages/takeaway/Commodity.ets#L29-L35
2240860605b3daf5e793e5563264a7c5df9434a3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
onBLEDeviceFind
订阅查找蓝牙设备
private onBLEDeviceFind() { try { ble.on('BLEDeviceFind', (arr: Array<ble.ScanResult>) => { Log.showInfo(TAG, `onBLEDeviceFind: BLEDeviceFind arr.length = ${arr.length}, arr = ${JSON.stringify(arr)}`); let deviceId: string = arr[0].deviceId; let device = this.mAvailableDevices.find(availableDevice => { return availableDevice.deviceId === deviceId; }) if (!device) { let data: ArrayBuffer = arr[0].data; let deviceName: string = util.TextDecoder.create('utf-8', { ignoreBOM: true }).decodeWithStream(new Uint8Array(data), { stream: false }); Log.showInfo(TAG, `onBLEDeviceFind: deviceId = ${deviceId}, deviceName = ${deviceName}`); // deviceName里存在一些未知数据导致显示乱码,暂时使用deviceId替代 deviceName = deviceId; this.mAvailableDevices.push(this.getDevice(deviceId, arr[0].deviceName)); AppStorage.setOrCreate('availableDevices', this.mAvailableDevices); } }) } catch (err) { Log.showError(TAG, `onBLEDeviceFind: err = ${err}`); } }
AST#method_declaration#Left private onBLEDeviceFind AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ble AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'BLEDeviceFind' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left arr : 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 ble . 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#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 Log AST#expression#Right . showInfo 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 ` onBLEDeviceFind: BLEDeviceFind arr.length = AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left arr AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , arr = AST#template_substitution#Left $ { 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 arr 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#variable_declaration#Left let AST#variable_declarator#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . deviceId 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 let AST#variable_declarator#Left device = 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 . mAvailableDevices AST#member_expression#Right AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left availableDevice => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left availableDevice AST#expression#Right . deviceId AST#member_expression#Right AST#expression#Right === AST#expression#Left deviceId AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left device AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . data 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 let AST#variable_declarator#Left deviceName : 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 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 . decodeWithStream 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 Uint8Array AST#expression#Right AST#new_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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showInfo 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 ` onBLEDeviceFind: deviceId = AST#template_substitution#Left $ { AST#expression#Left deviceId AST#expression#Right } AST#template_substitution#Right , deviceName = AST#template_substitution#Left $ { AST#expression#Left deviceName 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 // deviceName里存在一些未知数据导致显示乱码,暂时使用deviceId替代 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left deviceName = AST#expression#Left deviceId 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 . mAvailableDevices 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#member_expression#Left AST#expression#Left this AST#expression#Right . getDevice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left deviceId AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . deviceName 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 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 'availableDevices' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAvailableDevices 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#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) 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 Log AST#expression#Right . showError 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 ` onBLEDeviceFind: err = AST#template_substitution#Left $ { AST#expression#Left err 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
private onBLEDeviceFind() { try { ble.on('BLEDeviceFind', (arr: Array<ble.ScanResult>) => { Log.showInfo(TAG, `onBLEDeviceFind: BLEDeviceFind arr.length = ${arr.length}, arr = ${JSON.stringify(arr)}`); let deviceId: string = arr[0].deviceId; let device = this.mAvailableDevices.find(availableDevice => { return availableDevice.deviceId === deviceId; }) if (!device) { let data: ArrayBuffer = arr[0].data; let deviceName: string = util.TextDecoder.create('utf-8', { ignoreBOM: true }).decodeWithStream(new Uint8Array(data), { stream: false }); Log.showInfo(TAG, `onBLEDeviceFind: deviceId = ${deviceId}, deviceName = ${deviceName}`); deviceName = deviceId; this.mAvailableDevices.push(this.getDevice(deviceId, arr[0].deviceName)); AppStorage.setOrCreate('availableDevices', this.mAvailableDevices); } }) } catch (err) { Log.showError(TAG, `onBLEDeviceFind: err = ${err}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L198-L223
aac6b5d0e200d7f242ac29b72a1cd9025952afff
gitee
FantasyWind/fwrouter
eea785a7bf728862de1f88de487ef3857dee3364
router/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '0.2.1';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '0.2.1' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '0.2.1';
https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/router/BuildProfile.ets#L4-L4
98c7f776dbd34ffa84b98fa6a5c60afc42461af2
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines chip group space. @interface ChipGroupSpaceOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ChipGroupSpaceOptions { /** * Space between items. * * @type { ?(string | number) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ itemSpace?: string | number; /** * Start space. * * @type { ?Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ startSpace?: Length; /** * End space. * * @type { ?Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ endSpace?: Length; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ChipGroupSpaceOptions AST#object_type#Left { /** * Space between items. * * @type { ?(string | number) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left itemSpace ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Start space. * * @type { ?Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left startSpace ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * End space. * * @type { ?Length } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left endSpace ? : AST#type_annotation#Left AST#primary_type#Left Length 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 ChipGroupSpaceOptions { itemSpace?: string | number; startSpace?: Length; endSpace?: Length; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets#L214-L245
0b22e5a527cd46f0770b52a06147a282dc7961a3
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
datePickerDialog
Date dialog dialog
datePickerDialog(dateCallback: (birthValue: string) => void) { DatePickerDialog.show({ start: new Date(CommonConstants.START_TIME), end: new Date(), selected: new Date(CommonConstants.SELECT_TIME), lunar: false, onAccept: (value: DatePickerResult) => { let year = value.year as number; let month = value.month as number + CommonConstants.PLUS_ONE; let day = value.day as number; let birthdate: string = this.getBirthDateValue(year, month, day); dateCallback(birthdate); } }); }
AST#method_declaration#Left datePickerDialog AST#parameter_list#Left ( AST#parameter#Left dateCallback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left birthValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_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 DatePickerDialog AST#expression#Right . show 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 start AST#property_name#Right : 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#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . START_TIME AST#member_expression#Right 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 end AST#property_name#Right : 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 AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : 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#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . SELECT_TIME AST#member_expression#Right 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 lunar AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAccept AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left DatePickerResult 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 year = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . year AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number 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 let AST#variable_declarator#Left month = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . month AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right + AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . PLUS_ONE 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 let AST#variable_declarator#Left day = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . day AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number 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 let AST#variable_declarator#Left birthdate : 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 this AST#expression#Right . getBirthDateValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left month AST#expression#Right , AST#expression#Left day 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 dateCallback AST#expression#Right AST#argument_list#Left ( AST#expression#Left birthdate 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#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#builder_function_body#Right AST#method_declaration#Right
datePickerDialog(dateCallback: (birthValue: string) => void) { DatePickerDialog.show({ start: new Date(CommonConstants.START_TIME), end: new Date(), selected: new Date(CommonConstants.SELECT_TIME), lunar: false, onAccept: (value: DatePickerResult) => { let year = value.year as number; let month = value.month as number + CommonConstants.PLUS_ONE; let day = value.day as number; let birthdate: string = this.getBirthDateValue(year, month, day); dateCallback(birthdate); } }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets#L57-L71
4e7d5d44d63bae7dd81d37a8f59f91ad2d2c0464
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/DetailPage.ets
arkts
pageTransition
定义页面进入和退出的过渡效果
pageTransition() { // 页面进入效果 PageTransitionEnter({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); // 页面退出效果 PageTransitionExit({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); }
AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left RouteType AST#expression#Right . None AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left duration : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ANIMATION_SHORT_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Bottom AST#member_expression#Right AST#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PageTransitionExit ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left RouteType AST#expression#Right . None AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left duration : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ANIMATION_SHORT_DURATION AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Bottom AST#member_expression#Right AST#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
pageTransition() { PageTransitionEnter({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); PageTransitionExit({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/DetailPage.ets#L77-L84
810ca792783d49e31f2e390924359cc25f7624e0
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/IPC/ObjectTransfer/IPC_Client/entry/src/main/ets/client/cnn/IPC_Client.ets
arkts
connectIpc
连接服务端
function connectIpc(context: common.UIAbilityContext, callback: () => void) { let connect: common.ConnectOptions = { onConnect: (elementName, remoteProxy) => { hilog.info(DOMAIN, TAG, 'IpcClient:onConnect.callend(server),elementName:' + JSON.stringify(elementName)); proxy = remoteProxy; obtainResult.result = 'success'; callback(); }, onDisconnect: (elementName) => { hilog.info(DOMAIN, TAG, 'IpcClient onDisconnect:' + elementName); }, onFailed: (code: number) => { obtainResult.result = 'error ' + code; hilog.info(DOMAIN, TAG, 'IpcClient onFailed,code:' + code); callback(); }, } connectid = context.connectServiceExtensionAbility(want, connect); hilog.info(DOMAIN, TAG, 'IpcClient connectid:' + connectid); }
AST#function_declaration#Left function connectIpc AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : 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#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left connect : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . ConnectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onConnect AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left elementName AST#parameter#Right , AST#parameter#Left remoteProxy 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 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'IpcClient:onConnect.callend(server),elementName:' 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 elementName 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left proxy = AST#expression#Left remoteProxy 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 obtainResult AST#expression#Right . result AST#member_expression#Right = AST#expression#Left '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 callback 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#property_assignment#Left AST#property_name#Left onDisconnect AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left elementName 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 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 AST#binary_expression#Left AST#expression#Left 'IpcClient onDisconnect:' AST#expression#Right + AST#expression#Left elementName 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFailed AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left code : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left obtainResult AST#expression#Right . result AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left 'error ' AST#expression#Right + AST#expression#Left code 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#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 DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'IpcClient onFailed,code:' AST#expression#Right + AST#expression#Left code 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback 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 connectid AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . connectServiceExtensionAbility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right , AST#expression#Left connect 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 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 AST#binary_expression#Left AST#expression#Left 'IpcClient connectid:' AST#expression#Right + AST#expression#Left connectid 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#function_declaration#Right
function connectIpc(context: common.UIAbilityContext, callback: () => void) { let connect: common.ConnectOptions = { onConnect: (elementName, remoteProxy) => { hilog.info(DOMAIN, TAG, 'IpcClient:onConnect.callend(server),elementName:' + JSON.stringify(elementName)); proxy = remoteProxy; obtainResult.result = 'success'; callback(); }, onDisconnect: (elementName) => { hilog.info(DOMAIN, TAG, 'IpcClient onDisconnect:' + elementName); }, onFailed: (code: number) => { obtainResult.result = 'error ' + code; hilog.info(DOMAIN, TAG, 'IpcClient onFailed,code:' + code); callback(); }, } connectid = context.connectServiceExtensionAbility(want, connect); hilog.info(DOMAIN, TAG, 'IpcClient connectid:' + connectid); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/IPC/ObjectTransfer/IPC_Client/entry/src/main/ets/client/cnn/IPC_Client.ets#L126-L147
8d08cdf2f0b370e99c11a3a633e16b14cf5ddd3d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets
arkts
updateXComponentSize
更新XComponent @param width @param height @param offsetX @param offsetY
public updateXComponentSize(width: number, height: number, offsetX: number, offsetY: number): void { logger.info('Start to update XComponent size.'); this.xComponentSize.width = width; this.xComponentSize.height = height; this.xComponentSize.offsetX = offsetX; this.xComponentSize.offsetY = offsetY; }
AST#method_declaration#Left public updateXComponentSize 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#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offsetY : 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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Start to update XComponent size.' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . xComponentSize AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right = AST#expression#Left width 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . xComponentSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right = AST#expression#Left height 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . xComponentSize AST#member_expression#Right AST#expression#Right . offsetX AST#member_expression#Right = AST#expression#Left offsetX 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . xComponentSize AST#member_expression#Right AST#expression#Right . offsetY AST#member_expression#Right = AST#expression#Left offsetY AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public updateXComponentSize(width: number, height: number, offsetX: number, offsetY: number): void { logger.info('Start to update XComponent size.'); this.xComponentSize.width = width; this.xComponentSize.height = height; this.xComponentSize.offsetX = offsetX; this.xComponentSize.offsetY = offsetY; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets#L187-L193
ab6591deab056cf8d1f14931ef5b4f3d30ca21f3
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/partView/TextPickerComponent.ets
arkts
TextPickerComponent
picker选择器组件
@ComponentV2 export struct TextPickerComponent { // 文本数据 @Require @Param options: ITextPickerOptions; @Require @Param onChange?: (value: string | string[], index: number | number[]) => void; @Local value: string | string[] = ''; private longestLeftWidthVp: number = 0 private longestRightWidthVp?: number calculateLength(str: string): number { let length = 0; for (const char of str) { // 汉字按两个长度计算,其他字符按一个长度计算 length += char.charCodeAt(0) > 255 ? 2 : 1; } return length; }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TextPickerComponent AST#component_body#Left { // 文本数据 AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#primary_type#Left ITextPickerOptions 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 onChange ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_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#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private longestLeftWidthVp : 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 private longestRightWidthVp ? : AST#ERROR#Left number calculateLength 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#ERROR#Right AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left { let length AST#ERROR#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left for AST#parameter_list#Left ( AST#parameter#Left const AST#parameter#Right AST#ERROR#Left char of str AST#ERROR#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 汉字按两个长度计算,其他字符按一个长度计算 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left length += AST#expression#Left AST#conditional_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 char AST#expression#Right . charCodeAt 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#expression#Left 255 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 2 AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_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#property_declaration#Left return AST#ERROR#Left length AST#ERROR#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct TextPickerComponent { @Require @Param options: ITextPickerOptions; @Require @Param onChange?: (value: string | string[], index: number | number[]) => void; @Local value: string | string[] = ''; private longestLeftWidthVp: number = 0 private longestRightWidthVp?: number calculateLength(str: string): number { let length = 0; for (const char of str) { length += char.charCodeAt(0) > 255 ? 2 : 1; } return length; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/partView/TextPickerComponent.ets#L8-L24
c1151cd93a9df423360a3c3454a790432bc557c6
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/crypto/SM2Page.ets
arkts
mock
非对称密钥
@MockSetup mock() { this.describe = new DescribeBean("SM2", "SM2加解密"); }
AST#method_declaration#Left AST#decorator#Left @ MockSetup AST#decorator#Right mock AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . describe AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DescribeBean AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "SM2" AST#expression#Right , AST#expression#Left "SM2加解密" 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#builder_function_body#Right AST#method_declaration#Right
@MockSetup mock() { this.describe = new DescribeBean("SM2", "SM2加解密"); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/crypto/SM2Page.ets#L23-L26
852efd1b90cf9d6b6413f3d6b51b996d67e7a7de
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/votingcomponent/src/main/ets/view/VotingComponent.ets
arkts
VotingViewComponent
功能描述: 本示例介绍使用绘制组件中的Polygon组件配合使用显式动画以及borderRadius实现投票pk组件。 推荐场景: 需要投票pk的场景 核心组件: 1. VotingView: 投票组件 实现步骤: 1. 初始化投票资源属性内容。 @example @State votingSource: VotingType = new VotingType(); 2. 构建投票视图组件。 @example VotingView({ votingSource: this.votingSource, votingHandle: (isClick: boolean, notice: string) => { this.isClick = isClick; this.notice = notice; } })
@Component export struct VotingViewComponent { // 是否已投票 @State isClick: boolean = false; // 投票组件下方提示的内容 @State notice: string = '点击上方按钮,选择你的观点'; // 投票资源属性 @State votingSource: VotingType = new VotingType(4, 13); build() { Column() { // 投票主题 Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start }) { Image($r("app.media.voting_component_avatars"))// 投票举行者头像 .width($r("app.integer.voting_component_voting_theme_image_width")) .height($r("app.integer.voting_component_voting_theme_image_height")) .margin({ left: $r("app.integer.voting_component_voting_theme_image_margin_left"), right: $r("app.integer.voting_component_voting_theme_image_margin_right") }) Text($r("app.string.voting_component_voting_theme_image_text"))// 投票主题内容 .fontSize($r("app.integer.voting_component_voting_theme_image_text_font_size")) } /** * 投票视图 * * @param {VotingType} votingSource - 投票资源属性 * @param {void} votingHandle - 点击投票逻辑 */ VotingView({ votingSource: this.votingSource, votingHandle: (option: string) => { this.notice = '已选择"' + option + '"'; if (!this.isClick) { this.isClick = true; } } }) Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { // 提示 Text(this.notice) .fontSize($r("app.integer.voting_component_bottom_text_font_size")) .margin({ left: $r("app.integer.voting_component_bottom_text_margin") }) Stack() { if (this.isClick) { Text(this.votingSource.leftOptionChoose + this.votingSource.rightOptionChoose + Constants.BOTTOM_TEXT_SUFFIX) .fontSize($r("app.integer.voting_component_bottom_text_font_size")) .margin({ right: $r("app.integer.voting_component_bottom_text_margin") }) } } } } .backgroundColor(Color.White) .height($r("app.string.voting_component_parent_column_height")) .width($r("app.string.voting_component_parent_column_width")) .justifyContent(FlexAlign.Center) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VotingViewComponent AST#component_body#Left { // 是否已投票 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isClick : 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 // 投票组件下方提示的内容 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right notice : 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#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right votingSource : AST#type_annotation#Left AST#primary_type#Left VotingType 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 VotingType AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right , AST#expression#Left 13 AST#expression#Right ) AST#argument_list#Right AST#call_expression#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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Row AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , 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_parameters#Right ) 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.voting_component_avatars" 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.voting_component_voting_theme_image_width" 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.voting_component_voting_theme_image_height" 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.voting_component_voting_theme_image_margin_left" 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.voting_component_voting_theme_image_margin_right" 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#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.voting_component_voting_theme_image_text" 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.voting_component_voting_theme_image_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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right /** * 投票视图 * * @param {VotingType} votingSource - 投票资源属性 * @param {void} votingHandle - 点击投票逻辑 */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left VotingView ( AST#component_parameters#Left { AST#component_parameter#Left votingSource : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . votingSource AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left votingHandle : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left option : 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 . notice AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '已选择"' AST#expression#Right + AST#expression#Left option AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '"' 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#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 . isClick AST#member_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 . isClick 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#if_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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Row AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween 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#member_expression#Left AST#expression#Left this AST#expression#Right . notice 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.voting_component_bottom_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.voting_component_bottom_text_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#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 Stack ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClick 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 AST#binary_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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . votingSource AST#member_expression#Right AST#expression#Right . leftOptionChoose AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . votingSource AST#member_expression#Right AST#expression#Right . rightOptionChoose AST#member_expression#Right AST#expression#Right + AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . BOTTOM_TEXT_SUFFIX 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.voting_component_bottom_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 right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voting_component_bottom_text_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#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#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 . backgroundColor ( 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.string.voting_component_parent_column_height" 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.string.voting_component_parent_column_width" AST#expression#Right ) AST#resource_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 . 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#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 VotingViewComponent { @State isClick: boolean = false; @State notice: string = '点击上方按钮,选择你的观点'; @State votingSource: VotingType = new VotingType(4, 13); build() { Column() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start }) { Image($r("app.media.voting_component_avatars")) .width($r("app.integer.voting_component_voting_theme_image_width")) .height($r("app.integer.voting_component_voting_theme_image_height")) .margin({ left: $r("app.integer.voting_component_voting_theme_image_margin_left"), right: $r("app.integer.voting_component_voting_theme_image_margin_right") }) Text($r("app.string.voting_component_voting_theme_image_text"))内容 .fontSize($r("app.integer.voting_component_voting_theme_image_text_font_size")) } VotingView({ votingSource: this.votingSource, votingHandle: (option: string) => { this.notice = '已选择"' + option + '"'; if (!this.isClick) { this.isClick = true; } } }) Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { Text(this.notice) .fontSize($r("app.integer.voting_component_bottom_text_font_size")) .margin({ left: $r("app.integer.voting_component_bottom_text_margin") }) Stack() { if (this.isClick) { Text(this.votingSource.leftOptionChoose + this.votingSource.rightOptionChoose + Constants.BOTTOM_TEXT_SUFFIX) .fontSize($r("app.integer.voting_component_bottom_text_font_size")) .margin({ right: $r("app.integer.voting_component_bottom_text_margin") }) } } } } .backgroundColor(Color.White) .height($r("app.string.voting_component_parent_column_height")) .width($r("app.string.voting_component_parent_column_width")) .justifyContent(FlexAlign.Center) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/votingcomponent/src/main/ets/view/VotingComponent.ets#L47-L109
37f2978bfdad58548baff5d41d32e0292579865b
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/SettingsPage.ets
arkts
confirmEnableNewEpisodeNotification
确认启用新单集通知
confirmEnableNewEpisodeNotification(): void { const buttons: ButtonOptions[] = [ new ButtonOptions('取消', '#999999'), new ButtonOptions('允许', '#007AFF') ]; UIUtils.showDialog(new DialogOptions( '新单集通知', '开启后,当订阅的播客发布新单集时,将会收到通知提醒。\n\n是否允许新单集通知?', buttons )).then((index: number) => { if (index === 1) { // 用户点击"允许",检查并启用新单集通知 console.info('[SettingsPage] New episode notifications enabled'); this.checkAndEnableNewEpisodeNotification(); } else { // 用户点击"取消",保持关闭状态 console.info('[SettingsPage] New episode notifications cancelled'); this.settings.notifyNewEpisodes = false; } }); }
AST#method_declaration#Left confirmEnableNewEpisodeNotification 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 buttons : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ButtonOptions [ ] 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 ButtonOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '取消' AST#expression#Right , AST#expression#Left '#999999' 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 ButtonOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '允许' AST#expression#Right , AST#expression#Left '#007AFF' 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left UIUtils AST#expression#Right . showDialog 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 DialogOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '新单集通知' AST#expression#Right , AST#expression#Left '开启后,当订阅的播客发布新单集时,将会收到通知提醒。\n\n是否允许新单集通知?' AST#expression#Right , AST#expression#Left buttons 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 . 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 index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SettingsPage] New episode notifications enabled' 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 . checkAndEnableNewEpisodeNotification 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#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 '[SettingsPage] New episode notifications cancelled' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right . notifyNewEpisodes 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#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
confirmEnableNewEpisodeNotification(): void { const buttons: ButtonOptions[] = [ new ButtonOptions('取消', '#999999'), new ButtonOptions('允许', '#007AFF') ]; UIUtils.showDialog(new DialogOptions( '新单集通知', '开启后,当订阅的播客发布新单集时,将会收到通知提醒。\n\n是否允许新单集通知?', buttons )).then((index: number) => { if (index === 1) { console.info('[SettingsPage] New episode notifications enabled'); this.checkAndEnableNewEpisodeNotification(); } else { console.info('[SettingsPage] New episode notifications cancelled'); this.settings.notifyNewEpisodes = false; } }); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SettingsPage.ets#L277-L297
5b05467c67b72861e754ad8b8c330ace76db5358
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/SysUtil.ets
arkts
getStatusBarHeight
获取状态栏的高度,单位为px。 TODO 改造,此方法放入DialogHub? 或换个方式获取getUIAbilityContext @returns
static getStatusBarHeight(uiContext?: common.UIAbilityContext): number { try { if (!uiContext) { uiContext = DialogHub.getUIAbilityContext(); } let height = uiContext.windowStage.getMainWindowSync() .getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM) .topRect.height; if (height > 0) { return px2vp(height); } return 32; } catch (err) { return 32; } }
AST#method_declaration#Left static getStatusBarHeight AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left uiContext AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left uiContext = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHub AST#expression#Right . getUIAbilityContext 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#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 height = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uiContext AST#expression#Right . windowStage AST#member_expression#Right AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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#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 height 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left height 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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 32 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#return_statement#Left return AST#expression#Left 32 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 getStatusBarHeight(uiContext?: common.UIAbilityContext): number { try { if (!uiContext) { uiContext = DialogHub.getUIAbilityContext(); } let height = uiContext.windowStage.getMainWindowSync() .getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM) .topRect.height; if (height > 0) { return px2vp(height); } return 32; } catch (err) { return 32; } }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L64-L79
6883f4dd77b78a3adac0cdfe7286a7f57f1b08fb
github
Classaspen/ArkTS_PasswordManagement.git
66aea6e4f8ee3a78e5029c63186dba70707ca2d9
entry/src/main/ets/components/database/Database.ets
arkts
checkTableSchema
单独的校验方法
private async checkTableSchema(tableName: string): Promise<void> { if(this.store) { try { const actualColumns = await this.getTableColumns(this.store, tableName); const expectedColumns = ['id', 'name', 'content', 'timestamp']; // 简化的校验逻辑 if (actualColumns.length !== expectedColumns.length) { console.warn(`Column count mismatch for table ${tableName}`); return; } for (let i = 0; i < expectedColumns.length; i++) { if (actualColumns[i] !== expectedColumns[i]) { console.warn(`Column mismatch at index ${i}: ${actualColumns[i]} vs ${expectedColumns[i]}`); return; } } console.info(`Table ${tableName} schema validation passed`); } catch (err) { console.error(`Schema validation failed: ${err.message}`); } } }
AST#method_declaration#Left private async checkTableSchema AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . store AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left actualColumns = 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 . getTableColumns 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 . store AST#member_expression#Right AST#expression#Right , 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#variable_declaration#Left const AST#variable_declarator#Left expectedColumns = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'id' AST#expression#Right , AST#expression#Left 'name' AST#expression#Right , AST#expression#Left 'content' AST#expression#Right , AST#expression#Left 'timestamp' 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#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 actualColumns AST#expression#Right . length AST#member_expression#Right AST#expression#Right !== AST#expression#Left expectedColumns AST#expression#Right AST#binary_expression#Right AST#expression#Right . length 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 console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Column count mismatch for table AST#template_substitution#Left $ { AST#expression#Left tableName 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_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 expectedColumns 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left actualColumns AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right !== AST#expression#Left AST#subscript_expression#Left AST#expression#Left expectedColumns AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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 console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Column mismatch at index AST#template_substitution#Left $ { AST#expression#Left i AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left actualColumns AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right } AST#template_substitution#Right vs AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left expectedColumns AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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#return_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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Table AST#template_substitution#Left $ { AST#expression#Left tableName AST#expression#Right } AST#template_substitution#Right schema validation passed ` 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#Left catch ( err ) 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 AST#template_literal#Left ` Schema validation failed: 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async checkTableSchema(tableName: string): Promise<void> { if(this.store) { try { const actualColumns = await this.getTableColumns(this.store, tableName); const expectedColumns = ['id', 'name', 'content', 'timestamp']; if (actualColumns.length !== expectedColumns.length) { console.warn(`Column count mismatch for table ${tableName}`); return; } for (let i = 0; i < expectedColumns.length; i++) { if (actualColumns[i] !== expectedColumns[i]) { console.warn(`Column mismatch at index ${i}: ${actualColumns[i]} vs ${expectedColumns[i]}`); return; } } console.info(`Table ${tableName} schema validation passed`); } catch (err) { console.error(`Schema validation failed: ${err.message}`); } } }
https://github.com/Classaspen/ArkTS_PasswordManagement.git/blob/66aea6e4f8ee3a78e5029c63186dba70707ca2d9/entry/src/main/ets/components/database/Database.ets#L74-L99
ff07961aa3e1f963424236e1f3224afe335ff9cf
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
entry/src/main/ets/pages/Index.ets
arkts
contactPicker
联系人选择器,通过联系人选择器获取联系人,不需要申请通讯录权限。 如果申请通讯录权限,应用就能获取到所有的联系人,联系人选择器只允许应用获取到用户选择的联系人
contactPicker() { TaoYao.with(this.context) .contact() .onSuccess((data) => { // 联系人列表 if (data.length > 0) { // 联系人名称 console.log("yunfei", data[0].name?.fullName) // 联系人号码 console.log("yunfei", data[0]?.phoneNumbers?.[0]?.phoneNumber) } }) .onError((err) => { console.log(err.message) }) .selectContacts(new ContactBuilder() // 可以选择多个联系人 .setMultiSelect(true)) }
AST#method_declaration#Left contactPicker AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 AST#member_expression#Left AST#expression#Left TaoYao AST#expression#Right . with 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 . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . contact AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onSuccess 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 data 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 data 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 "yunfei" AST#expression#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 data AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ?. fullName 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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "yunfei" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left 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 ?. phoneNumbers AST#member_expression#Right AST#expression#Right ?. [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ?. phoneNumber 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 . onError 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#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#member_expression#Left AST#expression#Left err 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 . selectContacts 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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ContactBuilder 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 // 可以选择多个联系人 . setMultiSelect 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
contactPicker() { TaoYao.with(this.context) .contact() .onSuccess((data) => { if (data.length > 0) { console.log("yunfei", data[0].name?.fullName) console.log("yunfei", data[0]?.phoneNumbers?.[0]?.phoneNumber) } }) .onError((err) => { console.log(err.message) }) .selectContacts(new ContactBuilder() .setMultiSelect(true)) }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/entry/src/main/ets/pages/Index.ets#L141-L159
03818486520474aa7b325565c259881a5e188bef
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhColorUtils.ets
arkts
randomColor
/ 取随机颜色
public static randomColor() { return RandomUtil.getRandomColor() }
AST#method_declaration#Left public static randomColor AST#parameter_list#Left ( ) 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 RandomUtil AST#expression#Right . getRandomColor 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
public static randomColor() { return RandomUtil.getRandomColor() }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhColorUtils.ets#L10-L12
c1328320af4ad67546b42156875141c2ab3aca02
github
longchenxu123/HongmengDemoPandaCommunity.git
331aee32e89ac94764e63aa6d0c8c458201b7df8
entry/src/main/ets/pages/views/orderView.ets
arkts
TextItem
自定义构建函数 可以定义全局 也可以定义 局部
@Builder TextItem(item:string, index: number) { Row() { if (this.tabsIndex === index) { Text(item + '').fontColor($r('app.color.start_window_backgroundMain')).border({ width: { bottom: 4 }, color: { bottom: $r('app.color.start_window_backgroundMain') } }).padding({bottom: 3}) } else { Text(item + '').fontColor('#000').border({ width: { bottom: 4 }, color: { bottom: '#fff' } }) } } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TextItem 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#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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#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 . tabsIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_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#binary_expression#Left AST#expression#Left item AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.start_window_backgroundMain' AST#expression#Right ) AST#resource_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#object_literal#Left { 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#object_literal#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 bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.start_window_backgroundMain' AST#expression#Right ) AST#resource_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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 3 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 } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left item AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#000' 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#object_literal#Left { 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#object_literal#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 bottom AST#property_name#Right : AST#expression#Left '#fff' 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder TextItem(item:string, index: number) { Row() { if (this.tabsIndex === index) { Text(item + '').fontColor($r('app.color.start_window_backgroundMain')).border({ width: { bottom: 4 }, color: { bottom: $r('app.color.start_window_backgroundMain') } }).padding({bottom: 3}) } else { Text(item + '').fontColor('#000').border({ width: { bottom: 4 }, color: { bottom: '#fff' } }) } } }
https://github.com/longchenxu123/HongmengDemoPandaCommunity.git/blob/331aee32e89ac94764e63aa6d0c8c458201b7df8/entry/src/main/ets/pages/views/orderView.ets#L44-L58
8964ce25daced45a0688a92f0180e1ff670d1123
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
app management service class
export class ExtensionServiceManagementModel extends BaseModel { private serviceInfoList: serviceItem[] = []; constructor() { super(); try { let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; context.resourceManager.getMediaBase64ByName(icon_default) .then((res: string) => { icon_default_str = res; LogUtil.info(`${MODULE_TAG} getResourceManager init defaultIcon res: ${JSON.stringify(icon_default_str)}`); }) .catch((err: object) => { icon_default_str = ''; LogUtil.info(`${MODULE_TAG} getResourceManager init defaultIcon error: ${JSON.stringify(err)}`); }); } catch (err) { icon_default_str = ''; LogUtil.info(`${MODULE_TAG} getResourceManager init defaultIcon error: ${JSON.stringify(err)}`); } } /** * listen extensionService status */ openExtensionServiceManagementStatusListener() { try { config.on('enabledAccessibilityExtensionListChange', () => { LogUtil.info(`subscribe enabled accessibility extension list change state success`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`failed to subscribe enabled accessibility extension list change state, because ${JSON.stringify(exception)}`); } } closeExtensionServiceManagementStatusListener() { try { config.off('enabledAccessibilityExtensionListChange', () => { LogUtil.info(`Unsubscribe enabled accessibility extension list change state success`); }); } catch (exception) { LogUtil.info(`failed to Unsubscribe enabled accessibility extension list change state, because ${JSON.stringify(exception)}`); } } /** * listen extensionService application */ openExtensionServiceManagementApplicationListener() { try { bundleMonitor.on('add', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor add, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('update', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Update bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor update, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('remove', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Remove bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor remove, result: ${JSON.stringify(exception)}`); } } closeExtensionServiceManagementApplicationListener() { try { bundleMonitor.off('add'); bundleMonitor.off('update'); bundleMonitor.off('remove'); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor, result: ${JSON.stringify(exception)}`); } } /** * get extensionService data */ setExtensionServiceManagementListener() { this.serviceInfoList = []; accessibility.getAccessibilityExtensionList('all', 'install').then((data) => { LogUtil.info(`${MODULE_TAG} extensionService data.length: ${data.length} data: ${JSON.stringify(data)}`); if (!data || data.length < 1) { router.back(); return; } this.getResourceItemAndState(INDEX, data.length, data); }).catch((err: object) => { LogUtil.error(`${MODULE_TAG} getExtensionServiceList failed, err: ${JSON.stringify(err)}`); }); } /** * get resource information according to resource id * * @param index - array position * @param count - array length * @param data - data */ async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility.getAccessibilityExtensionList('all', 'enable'); for (let serviceInfo of data) { if (!serviceInfo || !serviceInfo.id) { continue; } LogUtil.info(`${MODULE_TAG} extensionService name : ${JSON.stringify(serviceInfo.id)}`); let serviceState: boolean = false; for (let enabledService of enabledServiceList) { if (enabledService.id && enabledService.id === serviceInfo.id) { serviceState = true; break; } } LogUtil.info(`${MODULE_TAG} + ${JSON.stringify(serviceInfo.name)} : ${JSON.stringify(serviceState)}`); let bundleFlag: number = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY; let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfo(serviceInfo.bundleName as string, bundleFlag); imageValue = await this.loadIcon(bundleInfo); description = await this.loadDescription(bundleInfo, serviceInfo.name as string); LogUtil.info(`${MODULE_TAG} getResourceManager getMediaBase64() value: ${imageValue}`); this.serviceInfoList.push({ serviceIcon: imageValue, serviceTitle: serviceInfo.name, serviceArrow: icon_arrow, serviceSummary: description, serviceEndText: serviceState ? $r('app.string.enabled') : $r('app.string.disabled'), serviceState: serviceState, serviceId: serviceInfo.id, serviceBundleName: serviceInfo.bundleName, serviceUri: URI_PAGE, }); } AppStorage.SetOrCreate('extensionServiceManagementList', this.serviceInfoList); LogUtil.info(`${MODULE_TAG} loadExtensionService end`); } /** * Load icon of AccessibilityService */ async loadIcon(bundleInfo: bundleManager.BundleInfo): Promise<string> { let appInfo = bundleInfo.appInfo; let imageValue = ''; let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; LogUtil.info(`${MODULE_TAG} getResourceManager appInfo.iconResource: ${JSON.stringify(appInfo.iconResource)}`); if (appInfo.iconResource.id > 0) { imageValue = await context.resourceManager.getMediaContentBase64(appInfo.iconResource); if (!imageValue) { LogUtil.warn(`${MODULE_TAG} load icon invalid`); imageValue = icon_default_str; } LogUtil.info(`${MODULE_TAG} + getResourceManager loadIcon end`); return imageValue; } imageValue = icon_default_str; return imageValue; } /** * Load description of AccessibilityService */ async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> { let description: ResourceStr = $r('app.string.no_description_provided'); let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; let moduleInfo: Array<bundleManager.HapModuleInfo> = bundleInfo.hapModulesInfo; if (moduleInfo.length > 0) { for (let hapInfo of moduleInfo) { let bundleContext: Context = context.createBundleContext(bundleInfo.name); for (let ability of hapInfo.extensionAbilitiesInfo) { if (ability.name === serviceName && ability.descriptionId > 0) { LogUtil.info(`${MODULE_TAG} descriptionId: ${JSON.stringify(ability.descriptionId)}`); await bundleContext.resourceManager.getStringValue(ability.descriptionId) .then((res) => { description = res; LogUtil.info(`${MODULE_TAG} description: ${JSON.stringify(description)}`); }) .catch((err: object) => { LogUtil.info(`${MODULE_TAG} get description error: ${JSON.stringify(err)}`); }); if (!description) { LogUtil.warn(`${MODULE_TAG} load description invalid`); description = $r('app.string.no_description_provided'); } LogUtil.info(`${MODULE_TAG} load description end`); return description; } } } } return description; } }
AST#export_declaration#Left export AST#class_declaration#Left class ExtensionServiceManagementModel extends AST#type_annotation#Left AST#primary_type#Left BaseModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private serviceInfoList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left serviceItem [ ] 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#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#as_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 GlobalContext 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 . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . globalKeySettingsAbilityContext AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Context 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 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 context AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaBase64ByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left icon_default 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 res : 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 icon_default_str = AST#expression#Left res 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getResourceManager init defaultIcon res: AST#template_substitution#Left $ { 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 icon_default_str 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#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 object 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 icon_default_str = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getResourceManager init defaultIcon error: AST#template_substitution#Left $ { 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 err 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#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#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left icon_default_str = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getResourceManager init defaultIcon error: AST#template_substitution#Left $ { 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 err 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /** * listen extensionService status */ AST#method_declaration#Left openExtensionServiceManagementStatusListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'enabledAccessibilityExtensionListChange' 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` subscribe enabled accessibility extension list change state success ` 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setExtensionServiceManagementListener 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#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` failed to subscribe enabled accessibility extension list change state, because AST#template_substitution#Left $ { 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 exception 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left closeExtensionServiceManagementStatusListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'enabledAccessibilityExtensionListChange' 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Unsubscribe enabled accessibility extension list change state success ` 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#catch_clause#Left catch ( exception ) 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` failed to Unsubscribe enabled accessibility extension list change state, because AST#template_substitution#Left $ { 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 exception 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * listen extensionService application */ AST#method_declaration#Left openExtensionServiceManagementApplicationListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleMonitor AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'add' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bundleChangeInfo 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right Add bundleName: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right userId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . userId 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setExtensionServiceManagementListener 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#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right failed subscribe bundleMonitor add, result: AST#template_substitution#Left $ { 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 exception 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right 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 bundleMonitor AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'update' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bundleChangeInfo 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right Update bundleName: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right userId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . userId 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setExtensionServiceManagementListener 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#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right failed subscribe bundleMonitor update, result: AST#template_substitution#Left $ { 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 exception 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right 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 bundleMonitor AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'remove' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left bundleChangeInfo 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right Remove bundleName: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right userId: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left bundleChangeInfo AST#expression#Right . userId 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setExtensionServiceManagementListener 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#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right failed subscribe bundleMonitor remove, result: AST#template_substitution#Left $ { 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 exception 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left closeExtensionServiceManagementApplicationListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleMonitor AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'add' 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 bundleMonitor AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'update' 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 bundleMonitor AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'remove' 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#Left catch ( exception ) 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right failed subscribe bundleMonitor, result: AST#template_substitution#Left $ { 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 exception 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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * get extensionService data */ AST#method_declaration#Left setExtensionServiceManagementListener AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . serviceInfoList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_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#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 accessibility AST#expression#Right . getAccessibilityExtensionList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'all' AST#expression#Right , AST#expression#Left 'install' 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 data 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right extensionService data.length: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right data: AST#template_substitution#Left $ { 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 data 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#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#unary_expression#Left ! AST#expression#Left data AST#expression#Right AST#unary_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 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 router AST#expression#Right . back 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getResourceItemAndState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left INDEX 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#expression#Left data 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 object 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 LogUtil AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getExtensionServiceList failed, err: AST#template_substitution#Left $ { 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 err 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#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 /** * get resource information according to resource id * * @param index - array position * @param count - array length * @param data - data */ AST#method_declaration#Left async getResourceItemAndState AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left serviceInfo [ ] 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getIconItem start data.length: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left data 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#variable_declaration#Left let AST#variable_declarator#Left imageValue = AST#expression#Left '' 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 description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left enabledServiceList : 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 accessibility . AccessibilityAbilityInfo 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#await_expression#Left await AST#expression#Left accessibility AST#expression#Right AST#await_expression#Right AST#expression#Right . getAccessibilityExtensionList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'all' AST#expression#Right , AST#expression#Left 'enable' 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#for_statement#Left for ( let serviceInfo of AST#expression#Left data AST#expression#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#unary_expression#Left ! AST#expression#Left serviceInfo AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left serviceInfo AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#continue_statement#Left continue ; AST#continue_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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right extensionService name : AST#template_substitution#Left $ { 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 serviceInfo AST#expression#Right . id AST#member_expression#Right 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#variable_declaration#Left let AST#variable_declarator#Left serviceState : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let enabledService of AST#expression#Left enabledServiceList AST#expression#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left enabledService AST#expression#Right . id AST#member_expression#Right AST#expression#Right && AST#expression#Left enabledService AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left serviceInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left serviceState = 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#statement#Left AST#break_statement#Left break ; AST#break_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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right + AST#template_substitution#Left $ { 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 serviceInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { 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 serviceState 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#variable_declaration#Left let AST#variable_declarator#Left bundleFlag : 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#binary_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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleManager AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_APPLICATION AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_HAP_MODULE AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY 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 let AST#variable_declarator#Left bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo 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 bundleManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getBundleInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left bundleFlag 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 imageValue = 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 . loadIcon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bundleInfo 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 description = 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 . loadDescription AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bundleInfo AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getResourceManager getMediaBase64() value: AST#template_substitution#Left $ { AST#expression#Left imageValue 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#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 . serviceInfoList AST#member_expression#Right AST#expression#Right . push 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 serviceIcon AST#property_name#Right : AST#expression#Left imageValue AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceArrow AST#property_name#Right : AST#expression#Left icon_arrow AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceSummary AST#property_name#Right : AST#expression#Left description AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceEndText AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left serviceState AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.enabled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.disabled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceState AST#property_name#Right : AST#expression#Left serviceState AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceBundleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceUri AST#property_name#Right : AST#expression#Left URI_PAGE 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 AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'extensionServiceManagementList' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . serviceInfoList 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right loadExtensionService end ` 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#method_declaration#Right /** * Load icon of AccessibilityService */ AST#method_declaration#Left async loadIcon AST#parameter_list#Left ( AST#parameter#Left bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo 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 let AST#variable_declarator#Left appInfo = AST#expression#Left AST#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . appInfo 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 let AST#variable_declarator#Left imageValue = AST#expression#Left '' 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 context = AST#expression#Left AST#as_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 GlobalContext 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 . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . globalKeySettingsAbilityContext AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Context 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getResourceManager appInfo.iconResource: AST#template_substitution#Left $ { 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 appInfo AST#expression#Right . iconResource AST#member_expression#Right 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left appInfo AST#expression#Right . iconResource AST#member_expression#Right AST#expression#Right . id 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 imageValue = 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 context AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaContentBase64 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left appInfo AST#expression#Right . iconResource 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#unary_expression#Left ! AST#expression#Left imageValue AST#expression#Right AST#unary_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 LogUtil AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right load icon invalid ` 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 imageValue = AST#expression#Left icon_default_str 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right + getResourceManager loadIcon end ` 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 imageValue 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#assignment_expression#Left imageValue = AST#expression#Left icon_default_str 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 imageValue AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Load description of AccessibilityService */ AST#method_declaration#Left async loadDescription AST#parameter_list#Left ( AST#parameter#Left bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left serviceName : 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 ResourceStr 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 description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.no_description_provided' AST#expression#Right ) AST#resource_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 context = AST#expression#Left AST#as_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 GlobalContext 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 . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GlobalContext AST#expression#Right . globalKeySettingsAbilityContext AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Context 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 let AST#variable_declarator#Left moduleInfo : 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 bundleManager . HapModuleInfo 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#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . hapModulesInfo 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#member_expression#Left AST#expression#Left moduleInfo 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#for_statement#Left for ( let hapInfo of AST#expression#Left moduleInfo AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleContext : AST#type_annotation#Left AST#primary_type#Left Context 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 context AST#expression#Right . createBundleContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . name 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#for_statement#Left for ( let ability of AST#expression#Left AST#member_expression#Left AST#expression#Left hapInfo AST#expression#Right . extensionAbilitiesInfo AST#member_expression#Right AST#expression#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 AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ability AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left serviceName AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left ability AST#expression#Right AST#binary_expression#Right AST#expression#Right . descriptionId 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right descriptionId: AST#template_substitution#Left $ { 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 ability AST#expression#Right . descriptionId AST#member_expression#Right 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#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 AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left bundleContext AST#expression#Right AST#await_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ability AST#expression#Right . descriptionId AST#member_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#Left res 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 description = AST#expression#Left res 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right description: AST#template_substitution#Left $ { 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 description 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#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 object 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right get description error: AST#template_substitution#Left $ { 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 err 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#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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left description AST#expression#Right AST#unary_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 LogUtil AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right load description invalid ` 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 description = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.no_description_provided' AST#expression#Right ) AST#resource_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right load description end ` 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 description AST#expression#Right ; AST#return_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#block_statement#Right AST#for_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 description 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 ExtensionServiceManagementModel extends BaseModel { private serviceInfoList: serviceItem[] = []; constructor() { super(); try { let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; context.resourceManager.getMediaBase64ByName(icon_default) .then((res: string) => { icon_default_str = res; LogUtil.info(`${MODULE_TAG} getResourceManager init defaultIcon res: ${JSON.stringify(icon_default_str)}`); }) .catch((err: object) => { icon_default_str = ''; LogUtil.info(`${MODULE_TAG} getResourceManager init defaultIcon error: ${JSON.stringify(err)}`); }); } catch (err) { icon_default_str = ''; LogUtil.info(`${MODULE_TAG} getResourceManager init defaultIcon error: ${JSON.stringify(err)}`); } } openExtensionServiceManagementStatusListener() { try { config.on('enabledAccessibilityExtensionListChange', () => { LogUtil.info(`subscribe enabled accessibility extension list change state success`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`failed to subscribe enabled accessibility extension list change state, because ${JSON.stringify(exception)}`); } } closeExtensionServiceManagementStatusListener() { try { config.off('enabledAccessibilityExtensionListChange', () => { LogUtil.info(`Unsubscribe enabled accessibility extension list change state success`); }); } catch (exception) { LogUtil.info(`failed to Unsubscribe enabled accessibility extension list change state, because ${JSON.stringify(exception)}`); } } openExtensionServiceManagementApplicationListener() { try { bundleMonitor.on('add', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Add bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor add, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('update', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Update bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor update, result: ${JSON.stringify(exception)}`); } try { bundleMonitor.on('remove', (bundleChangeInfo) => { LogUtil.info(`${MODULE_TAG} Remove bundleName: ${bundleChangeInfo.bundleName} userId: ${bundleChangeInfo.userId}`); this.setExtensionServiceManagementListener(); }); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor remove, result: ${JSON.stringify(exception)}`); } } closeExtensionServiceManagementApplicationListener() { try { bundleMonitor.off('add'); bundleMonitor.off('update'); bundleMonitor.off('remove'); } catch (exception) { LogUtil.info(`${MODULE_TAG} failed subscribe bundleMonitor, result: ${JSON.stringify(exception)}`); } } setExtensionServiceManagementListener() { this.serviceInfoList = []; accessibility.getAccessibilityExtensionList('all', 'install').then((data) => { LogUtil.info(`${MODULE_TAG} extensionService data.length: ${data.length} data: ${JSON.stringify(data)}`); if (!data || data.length < 1) { router.back(); return; } this.getResourceItemAndState(INDEX, data.length, data); }).catch((err: object) => { LogUtil.error(`${MODULE_TAG} getExtensionServiceList failed, err: ${JSON.stringify(err)}`); }); } async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility.getAccessibilityExtensionList('all', 'enable'); for (let serviceInfo of data) { if (!serviceInfo || !serviceInfo.id) { continue; } LogUtil.info(`${MODULE_TAG} extensionService name : ${JSON.stringify(serviceInfo.id)}`); let serviceState: boolean = false; for (let enabledService of enabledServiceList) { if (enabledService.id && enabledService.id === serviceInfo.id) { serviceState = true; break; } } LogUtil.info(`${MODULE_TAG} + ${JSON.stringify(serviceInfo.name)} : ${JSON.stringify(serviceState)}`); let bundleFlag: number = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY; let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfo(serviceInfo.bundleName as string, bundleFlag); imageValue = await this.loadIcon(bundleInfo); description = await this.loadDescription(bundleInfo, serviceInfo.name as string); LogUtil.info(`${MODULE_TAG} getResourceManager getMediaBase64() value: ${imageValue}`); this.serviceInfoList.push({ serviceIcon: imageValue, serviceTitle: serviceInfo.name, serviceArrow: icon_arrow, serviceSummary: description, serviceEndText: serviceState ? $r('app.string.enabled') : $r('app.string.disabled'), serviceState: serviceState, serviceId: serviceInfo.id, serviceBundleName: serviceInfo.bundleName, serviceUri: URI_PAGE, }); } AppStorage.SetOrCreate('extensionServiceManagementList', this.serviceInfoList); LogUtil.info(`${MODULE_TAG} loadExtensionService end`); } async loadIcon(bundleInfo: bundleManager.BundleInfo): Promise<string> { let appInfo = bundleInfo.appInfo; let imageValue = ''; let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; LogUtil.info(`${MODULE_TAG} getResourceManager appInfo.iconResource: ${JSON.stringify(appInfo.iconResource)}`); if (appInfo.iconResource.id > 0) { imageValue = await context.resourceManager.getMediaContentBase64(appInfo.iconResource); if (!imageValue) { LogUtil.warn(`${MODULE_TAG} load icon invalid`); imageValue = icon_default_str; } LogUtil.info(`${MODULE_TAG} + getResourceManager loadIcon end`); return imageValue; } imageValue = icon_default_str; return imageValue; } async loadDescription(bundleInfo: bundleManager.BundleInfo, serviceName: string): Promise<ResourceStr> { let description: ResourceStr = $r('app.string.no_description_provided'); let context = GlobalContext.getContext().getObject(GlobalContext.globalKeySettingsAbilityContext) as Context; let moduleInfo: Array<bundleManager.HapModuleInfo> = bundleInfo.hapModulesInfo; if (moduleInfo.length > 0) { for (let hapInfo of moduleInfo) { let bundleContext: Context = context.createBundleContext(bundleInfo.name); for (let ability of hapInfo.extensionAbilitiesInfo) { if (ability.name === serviceName && ability.descriptionId > 0) { LogUtil.info(`${MODULE_TAG} descriptionId: ${JSON.stringify(ability.descriptionId)}`); await bundleContext.resourceManager.getStringValue(ability.descriptionId) .then((res) => { description = res; LogUtil.info(`${MODULE_TAG} description: ${JSON.stringify(description)}`); }) .catch((err: object) => { LogUtil.info(`${MODULE_TAG} get description error: ${JSON.stringify(err)}`); }); if (!description) { LogUtil.warn(`${MODULE_TAG} load description invalid`); description = $r('app.string.no_description_provided'); } LogUtil.info(`${MODULE_TAG} load description end`); return description; } } } } return description; } }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L55-L258
41ffb8a006dc7fd9873d22ee151306e52baf5457
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/DES.ets
arkts
encryptECBSync
加密(ECB模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @returns
static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob { return DES.encryptSync(data, symKey, null, '3DES192|ECB|PKCS7'); }
AST#method_declaration#Left static encryptECBSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : 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#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 DES AST#expression#Right . encryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left '3DES192|ECB|PKCS7' 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 encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFramework.DataBlob { return DES.encryptSync(data, symKey, null, '3DES192|ECB|PKCS7'); }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets#L42-L44
a6704d00efffba5cdc4e9caa0fee2a9f1b84ba52
github
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
‘12%’
export const THOUSANDTH_160: string = '16%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_160 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '16%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const THOUSANDTH_160: string = '16%';
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L53-L53
3c5b22920030245865d0f8b70e9295eff002fe2c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Image($r('app.media.ic_birthday_cake')) .width(20) .height(20) .fillColor($r('app.color.primary')) Text('生日提醒') .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .layoutWeight(1) .margin({ left: 8 }) if (this.widgetData.hasData && this.widgetData.totalCount > 0) { Text(`${this.widgetData.totalCount}`) .fontSize(12) .fontColor($r('app.color.text_secondary')) .width(20) .height(20) .textAlign(TextAlign.Center) .backgroundColor($r('app.color.primary_background')) .borderRadius(10) } } .width('100%') .alignItems(VerticalAlign.Center) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#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_birthday_cake' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( 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#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#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#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 . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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 8 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widgetData AST#member_expression#Right AST#expression#Right . hasData AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . widgetData AST#member_expression#Right AST#expression#Right . totalCount AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_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 this AST#expression#Right . widgetData AST#member_expression#Right AST#expression#Right . totalCount 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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 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_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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center 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#builder_function_body#Right AST#method_declaration#Right
@Builder buildHeader() { Row() { Image($r('app.media.ic_birthday_cake')) .width(20) .height(20) .fillColor($r('app.color.primary')) Text('生日提醒') .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .layoutWeight(1) .margin({ left: 8 }) if (this.widgetData.hasData && this.widgetData.totalCount > 0) { Text(`${this.widgetData.totalCount}`) .fontSize(12) .fontColor($r('app.color.text_secondary')) .width(20) .height(20) .textAlign(TextAlign.Center) .backgroundColor($r('app.color.primary_background')) .borderRadius(10) } } .width('100%') .alignItems(VerticalAlign.Center) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/widgets/pages/WidgetCard2x4.ets#L39-L67
2c774470a82c5ee003bcccb5dda84bf2a1aead22
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/Base64Utils.ets
arkts
decode
解码,通过输入参数解码后输出对应Uint8Array对象。 @param array @returns
static decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> { let base64 = new util.Base64Helper(); return base64.decode(array, options); }
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 let 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
static decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> { let base64 = new util.Base64Helper(); return base64.decode(array, options); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L72-L75
6cdab92a421ef36574e38c073fa777d09bbabe74
gitee
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getMultiFormDataList
Getter and setter for multiFormDataList
getMultiFormDataList(): Array<http.MultiFormData> | undefined { return this.multiFormDataList; }
AST#method_declaration#Left getMultiFormDataList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#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 http . MultiFormData 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#primary_type#Left undefined 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 . multiFormDataList AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getMultiFormDataList(): Array<http.MultiFormData> | undefined { return this.multiFormDataList; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L182-L184
4199b29c3e4946f2fa6eb32b96a1ef4dd9ab6722
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets
arkts
ClickIconDataSource 类继承自 BasicDataSource<ClickIconItem>,处理图标集合数据源操作 @extends {BasicDataSource<ClickIconItem>}
export class ClickIconDataSource extends BasicDataSource<ClickIconItem> {}
AST#export_declaration#Left export AST#class_declaration#Left class ClickIconDataSource extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasicDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ClickIconItem 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#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ClickIconDataSource extends BasicDataSource<ClickIconItem> {}
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets#L65-L65
2232041021462df5f51e70769a15ecf090ba57bd
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/LoginPage.ets
arkts
canSubmit
检查是否可以提交
canSubmit(): boolean { if (this.isResetMode) { return this.account !== '' && this.newPassword !== ''; } else { return this.account !== '' && this.password !== ''; } }
AST#method_declaration#Left canSubmit 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isResetMode 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#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 . account AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . newPassword AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' 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#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 . account AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . password AST#member_expression#Right AST#expression#Right !== AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
canSubmit(): boolean { if (this.isResetMode) { return this.account !== '' && this.newPassword !== ''; } else { return this.account !== '' && this.password !== ''; } }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/LoginPage.ets#L456-L462
6c239aaa21da2b0e9668b9bdb85a171cd85fc407
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/advertisingpage/src/main/ets/components/AdvertisingPage.ets
arkts
changeFullScreen
页面显示打开沉浸式,页面销毁关闭 @param isFull是否需要打开沉浸式
changeFullScreen(isFull: boolean) { let context = getContext(); window.getLastWindow(context, (err, window) => { window.setWindowLayoutFullScreen(isFull); }) }
AST#method_declaration#Left changeFullScreen AST#parameter_list#Left ( AST#parameter#Left isFull : 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#variable_declaration#Left let AST#variable_declarator#Left context = 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 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 window AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left window 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 window AST#expression#Right . setWindowLayoutFullScreen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left isFull 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
changeFullScreen(isFull: boolean) { let context = getContext(); window.getLastWindow(context, (err, window) => { window.setWindowLayoutFullScreen(isFull); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/advertisingpage/src/main/ets/components/AdvertisingPage.ets#L49-L54
14c50d9a08dd3346b0255dc11738c778bd73d470
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/constants/AppConstants.ets
arkts
路由常量
export class RouteConstants { static readonly INDEX: string = 'pages/Index'; static readonly CONTACT_DETAIL: string = 'pages/ContactDetailPage'; static readonly CONTACT_EDIT: string = 'pages/ContactEditPage'; static readonly CONTACT_IMPORT: string = 'pages/ContactImportPage'; static readonly GREETING_SEND: string = 'pages/GreetingSendPage'; static readonly SEARCH: string = 'pages/SearchPage'; static readonly STATISTICS: string = 'pages/StatisticsPage'; static readonly SETTINGS: string = 'pages/SettingsPage'; }
AST#export_declaration#Left export AST#class_declaration#Left class RouteConstants AST#class_body#Left { AST#property_declaration#Left static readonly INDEX : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/Index' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CONTACT_DETAIL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/ContactDetailPage' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CONTACT_EDIT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/ContactEditPage' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly CONTACT_IMPORT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/ContactImportPage' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly GREETING_SEND : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/GreetingSendPage' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SEARCH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/SearchPage' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly STATISTICS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/StatisticsPage' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SETTINGS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/SettingsPage' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class RouteConstants { static readonly INDEX: string = 'pages/Index'; static readonly CONTACT_DETAIL: string = 'pages/ContactDetailPage'; static readonly CONTACT_EDIT: string = 'pages/ContactEditPage'; static readonly CONTACT_IMPORT: string = 'pages/ContactImportPage'; static readonly GREETING_SEND: string = 'pages/GreetingSendPage'; static readonly SEARCH: string = 'pages/SearchPage'; static readonly STATISTICS: string = 'pages/StatisticsPage'; static readonly SETTINGS: string = 'pages/SettingsPage'; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/constants/AppConstants.ets#L60-L69
a2342465f0cf4c70a56564ac2de48e5aa90cee00
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
notifyUpdateStatusRemote
状态刷新 @param otaStatus 状态
private async notifyUpdateStatusRemote(eventInfo: update.EventInfo): Promise<void> { this.log(`notifyUpdateStatusRemote ${JSON.stringify(eventInfo)}`); let message: Message = { context: globalThis.extensionContext || globalThis.abilityContext, eventInfo: eventInfo, }; this.messageQueue.execute(message); }
AST#method_declaration#Left private async notifyUpdateStatusRemote AST#parameter_list#Left ( AST#parameter#Left eventInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left update . EventInfo 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 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 this AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` notifyUpdateStatusRemote AST#template_substitution#Left $ { 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 eventInfo 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#variable_declaration#Left let AST#variable_declarator#Left message : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left context AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left globalThis AST#expression#Right . extensionContext AST#member_expression#Right AST#expression#Right || AST#expression#Left globalThis AST#expression#Right AST#binary_expression#Right AST#expression#Right . abilityContext AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left eventInfo AST#property_name#Right : AST#expression#Left eventInfo 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 . messageQueue AST#member_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left message 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
private async notifyUpdateStatusRemote(eventInfo: update.EventInfo): Promise<void> { this.log(`notifyUpdateStatusRemote ${JSON.stringify(eventInfo)}`); let message: Message = { context: globalThis.extensionContext || globalThis.abilityContext, eventInfo: eventInfo, }; this.messageQueue.execute(message); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L294-L302
ad55ae826be4e755344dc0c0dd96d8be3a3c532c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets
arkts
setSize
设置缓存文件大小 @param size 文件大小
setSize(size: number) { this.size = size; }
AST#method_declaration#Left setSize AST#parameter_list#Left ( AST#parameter#Left size : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . size AST#member_expression#Right = AST#expression#Left size AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
setSize(size: number) { this.size = size; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets#L49-L51
284b7c0492dce8bae1f789d73fbb72c3835f56bf
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getDeviceCapabilitySync
获取设备的DeviceCapability @returns
static getDeviceCapabilitySync(): resourceManager.DeviceCapability { return ResUtil.getResourceManager().getDeviceCapabilitySync(); }
AST#method_declaration#Left static getDeviceCapabilitySync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left resourceManager . DeviceCapability 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#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 ResUtil AST#expression#Right . getResourceManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDeviceCapabilitySync 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 getDeviceCapabilitySync(): resourceManager.DeviceCapability { return ResUtil.getResourceManager().getDeviceCapabilitySync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L530-L532
9fc92274baa4b9799bfd771d4b8529b5602d27f8
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/OptionTypes.ets
arkts
字符串选项接口定义 用于字符串值的下拉选择框等组件的数据结构
export interface StringOption { value: string; label: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface StringOption AST#object_type#Left { AST#type_member#Left value : 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 label : 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 StringOption { value: string; label: string; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/OptionTypes.ets#L14-L17
e3fdcba1cd5c5d3d4949b19eba4a2e3d63773c21
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/StrUtil.ets
arkts
isBlank
判断字符串是否为空白符(空白符包括空格、制表符、全角空格和不间断空格)true为空,否则false @param str @returns
static isBlank(str: string): boolean { let length: number; if ((str == null) || ((length = str.length) == 0)) { return true; } for (let i = 0; i < length; i++) { // 只要有一个非空字符即为非空字符串 if (false == CharUtil.isBlankChar(str.charCodeAt(i))) { return false; } } return true; }
AST#method_declaration#Left static isBlank AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left length : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#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#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left str 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 ) 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#parenthesized_expression#Left ( AST#expression#Left AST#assignment_expression#Left length = AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#parenthesized_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#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#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 length 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#if_statement#Left if ( 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#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right == AST#expression#Left CharUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . isBlankChar 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 str AST#expression#Right . charCodeAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i 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#block_statement#Left { 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#block_statement#Right AST#for_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#method_declaration#Right
static isBlank(str: string): boolean { let length: number; if ((str == null) || ((length = str.length) == 0)) { return true; } for (let i = 0; i < length; i++) { if (false == CharUtil.isBlankChar(str.charCodeAt(i))) { return false; } } return true; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L35-L48
b8ff9bfdb321808bfe53a6c299acd8db4417aea7
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
评论模型
export interface Comment { id: number; postId: number; userId: number; content: string; parentId?: number; status?: number; createdAt: string; updatedAt?: string; username?: string; userAvatar?: string; likeCount?: number; isLiked?: boolean; replies?: Comment[]; author?: User; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Comment AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left postId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left 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 parentId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left status ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createdAt : 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 updatedAt ? : 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 username ? : 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 userAvatar ? : 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 likeCount ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isLiked ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left replies ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left author ? : AST#type_annotation#Left AST#primary_type#Left User 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 Comment { id: number; postId: number; userId: number; content: string; parentId?: number; status?: number; createdAt: string; updatedAt?: string; username?: string; userAvatar?: string; likeCount?: number; isLiked?: boolean; replies?: Comment[]; author?: User; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L165-L180
dac18f25bd99481ecb811d847c53dff877ff051a
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/view/NavigationPage.ets
arkts
ResultSection
结果回传展示区 @returns {void} 无返回值
@Builder private ResultSection(): void { if (this.vm.shouldShowResult()) { IBestCellGroup({ inset: true, outerMargin: 0 }) { if (this.vm.hasResultTitle()) { IBestCell({ title: $r("app.string.main_navigation_result_title_label"), label: this.vm.resultTitle, isLink: false, hasBorder: this.vm.hasResultDesc() }); } if (this.vm.hasResultDesc()) { IBestCell({ title: $r("app.string.main_navigation_result_desc_label"), label: this.vm.resultDescription, isLink: false, hasBorder: false }); } }; } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ResultSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . shouldShowResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestCellGroup ( AST#component_parameters#Left { AST#component_parameter#Left inset : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left outerMargin : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( 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 . vm AST#member_expression#Right AST#expression#Right . hasResultTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestCell ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_result_title_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left label : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . resultTitle AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLink : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : 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 . vm AST#member_expression#Right AST#expression#Right . hasResultDesc 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_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hasResultDesc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestCell ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_result_desc_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left label : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . resultDescription AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLink : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#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#ERROR#Left ; AST#ERROR#Right } AST#ui_if_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#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private ResultSection(): void { if (this.vm.shouldShowResult()) { IBestCellGroup({ inset: true, outerMargin: 0 }) { if (this.vm.hasResultTitle()) { IBestCell({ title: $r("app.string.main_navigation_result_title_label"), label: this.vm.resultTitle, isLink: false, hasBorder: this.vm.hasResultDesc() }); } if (this.vm.hasResultDesc()) { IBestCell({ title: $r("app.string.main_navigation_result_desc_label"), label: this.vm.resultDescription, isLink: false, hasBorder: false }); } }; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/NavigationPage.ets#L76-L98
cc742a0ddfb4d203ec4f893becd6e6f7400cda82
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets
arkts
requestSuspendDelay
申请短时任务
requestSuspendDelay() { try { let delayInfo = backgroundTaskManager.requestSuspendDelay('compute', () => { console.info('Request suspension delay will time out.'); // 任务即将超时,取消短时任务 this.cancelSuspendDelay(); }) this.requestId = delayInfo.requestId; } catch (error) { console.error(`requestSuspendDelay failed. message is ${(error as BusinessError).message}`); } }
AST#method_declaration#Left requestSuspendDelay AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left delayInfo = AST#expression#Left AST#assignment_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 . requestSuspendDelay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'compute' 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Request suspension delay will time out.' 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 . cancelSuspendDelay 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#ERROR#Left this AST#ERROR#Right . requestId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left delayInfo AST#expression#Right . requestId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#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 AST#template_literal#Left ` requestSuspendDelay failed. message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error 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#parenthesized_expression#Right 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
requestSuspendDelay() { try { let delayInfo = backgroundTaskManager.requestSuspendDelay('compute', () => { console.info('Request suspension delay will time out.'); this.cancelSuspendDelay(); }) this.requestId = delayInfo.requestId; } catch (error) { console.error(`requestSuspendDelay failed. message is ${(error as BusinessError).message}`); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/backgroundTask/src/main/ets/view/TransientTaskView.ets#L31-L42
1175ffd3102a191fcaaf4682477f801208634b8b
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
arkts
createDbIfNeeds
====== 创建表 ====== MARK: - 创建表(完全等价 Java createLearnDbIfNeeded)
createDbIfNeeds(): void { if (!this.db) return const sqlLearn = ` CREATE TABLE IF NOT EXISTS ${Tables.Learn.NAME} ( ${Tables.Learn.Col.TITLE_EN} TEXT PRIMARY KEY NOT NULL, ${Tables.Learn.Col.LEARN_TIMES} INTEGER NOT NULL, ${Tables.Learn.Col.CORRECTED_TIMES} INTEGER NOT NULL, ${Tables.Learn.Col.WRANG_TIMES} INTEGER NOT NULL, ${Tables.Learn.Col.FAVORITE_LEVEL} INTEGER NOT NULL, ${Tables.Learn.Col.LAST_RESULT} INTEGER NOT NULL, ${Tables.Learn.Col.WRANG_DATE} TIMESTAMP, ${Tables.Learn.Col.UNIT_ID} INTEGER NOT NULL, ${Tables.Learn.Col.PART_ID} INTEGER NOT NULL, ${Tables.Learn.Col.MEMO} TEXT, ${Tables.Learn.Col.SHARE_MEMOS} TEXT ) ` const sqlDeleteWord = ` CREATE TABLE IF NOT EXISTS ${Tables.DeleteWord.NAME} ( ${Tables.DeleteWord.Col.TITLE_EN} TEXT PRIMARY KEY NOT NULL, ${Tables.DeleteWord.Col.DELETED} INTEGER NOT NULL ) ` const sqlWordTable = ` CREATE TABLE IF NOT EXISTS ${WordTable.TableOnline_Name} ( ${WordTable.Col.IDX} INTEGER, ${WordTable.Col.PARTID} INTEGER, ${WordTable.Col.PARTNAME} TEXT, ${WordTable.Col.UNITID} INTEGER, ${WordTable.Col.UNITNAME} TEXT, ${WordTable.Col.UNITNO} INTEGER, ${WordTable.Col.TITLEEN} TEXT, ${WordTable.Col.PRONEN} TEXT, ${WordTable.Col.PRONUS} TEXT, ${WordTable.Col.TITLECN1} TEXT, ${WordTable.Col.TITLECN2} TEXT, ${WordTable.Col.TITLECN3} TEXT, ${WordTable.Col.WORDIMAGE} TEXT, ${WordTable.Col.WORDCHANGE} TEXT, ${WordTable.Col.SYNWORDS} TEXT, ${WordTable.Col.ASYNWORDS} TEXT, ${WordTable.Col.EXAMPLEEN1} TEXT, ${WordTable.Col.EXAMPLECN1} TEXT, ${WordTable.Col.EXAMPLEEN2} TEXT, ${WordTable.Col.EXAMPLECN2} TEXT, ${WordTable.Col.EXAMPLEEN3} TEXT, ${WordTable.Col.EXAMPLECN3} TEXT, ${WordTable.Col.USEDPHRASE} TEXT, ${WordTable.Col.EN2EN} TEXT, ${WordTable.Col.DISCRIMINATE} TEXT ) ` try { this.db.updateDb(sqlLearn) this.db.updateDb(sqlDeleteWord) this.db.updateDb(sqlWordTable) } catch (e) { DebugLog.e(`LearnDbAccess >>> createDbIfNeeds: ${e}`) } }
AST#method_declaration#Left createDbIfNeeds 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 . db AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#assignment_expression#Left const AST#ERROR#Left sqlLearn AST#ERROR#Right = AST#expression#Left AST#template_literal#Left ` CREATE TABLE IF NOT EXISTS AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . NAME 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLE_EN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT PRIMARY KEY NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . LEARN_TIMES AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . CORRECTED_TIMES AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . WRANG_TIMES AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . FAVORITE_LEVEL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . LAST_RESULT AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . WRANG_DATE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TIMESTAMP, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . UNIT_ID AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PART_ID AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . MEMO AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#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 Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . SHARE_MEMOS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT ) ` AST#template_literal#Right AST#expression#Right AST#assignment_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 const AST#variable_declarator#Left sqlDeleteWord = AST#expression#Left AST#template_literal#Left ` CREATE TABLE IF NOT EXISTS AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . DeleteWord AST#member_expression#Right AST#expression#Right . NAME 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . DeleteWord AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLE_EN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT PRIMARY KEY NOT NULL, AST#template_substitution#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 Tables AST#expression#Right . DeleteWord AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . DELETED AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER NOT NULL ) ` AST#template_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 sqlWordTable = AST#expression#Left AST#template_literal#Left ` CREATE TABLE IF NOT EXISTS AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . TableOnline_Name 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 AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . IDX AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PARTID AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PARTNAME AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . UNITID AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . UNITNAME AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . UNITNO AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right INTEGER, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLEEN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PRONEN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . PRONUS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLECN1 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLECN2 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLECN3 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . WORDIMAGE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . WORDCHANGE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . SYNWORDS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . ASYNWORDS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLEEN1 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLECN1 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLEEN2 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLECN2 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLEEN3 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EXAMPLECN3 AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . USEDPHRASE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . EN2EN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordTable AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . DISCRIMINATE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right TEXT ) ` AST#template_literal#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#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 . db AST#member_expression#Right AST#expression#Right . updateDb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sqlLearn 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 . db AST#member_expression#Right AST#expression#Right . updateDb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sqlDeleteWord 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 . db AST#member_expression#Right AST#expression#Right . updateDb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sqlWordTable 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#Left catch ( e ) 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 DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` LearnDbAccess >>> createDbIfNeeds: AST#template_substitution#Left $ { AST#expression#Left e 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
createDbIfNeeds(): void { if (!this.db) return const sqlLearn = ` CREATE TABLE IF NOT EXISTS ${Tables.Learn.NAME} ( ${Tables.Learn.Col.TITLE_EN} TEXT PRIMARY KEY NOT NULL, ${Tables.Learn.Col.LEARN_TIMES} INTEGER NOT NULL, ${Tables.Learn.Col.CORRECTED_TIMES} INTEGER NOT NULL, ${Tables.Learn.Col.WRANG_TIMES} INTEGER NOT NULL, ${Tables.Learn.Col.FAVORITE_LEVEL} INTEGER NOT NULL, ${Tables.Learn.Col.LAST_RESULT} INTEGER NOT NULL, ${Tables.Learn.Col.WRANG_DATE} TIMESTAMP, ${Tables.Learn.Col.UNIT_ID} INTEGER NOT NULL, ${Tables.Learn.Col.PART_ID} INTEGER NOT NULL, ${Tables.Learn.Col.MEMO} TEXT, ${Tables.Learn.Col.SHARE_MEMOS} TEXT ) ` const sqlDeleteWord = ` CREATE TABLE IF NOT EXISTS ${Tables.DeleteWord.NAME} ( ${Tables.DeleteWord.Col.TITLE_EN} TEXT PRIMARY KEY NOT NULL, ${Tables.DeleteWord.Col.DELETED} INTEGER NOT NULL ) ` const sqlWordTable = ` CREATE TABLE IF NOT EXISTS ${WordTable.TableOnline_Name} ( ${WordTable.Col.IDX} INTEGER, ${WordTable.Col.PARTID} INTEGER, ${WordTable.Col.PARTNAME} TEXT, ${WordTable.Col.UNITID} INTEGER, ${WordTable.Col.UNITNAME} TEXT, ${WordTable.Col.UNITNO} INTEGER, ${WordTable.Col.TITLEEN} TEXT, ${WordTable.Col.PRONEN} TEXT, ${WordTable.Col.PRONUS} TEXT, ${WordTable.Col.TITLECN1} TEXT, ${WordTable.Col.TITLECN2} TEXT, ${WordTable.Col.TITLECN3} TEXT, ${WordTable.Col.WORDIMAGE} TEXT, ${WordTable.Col.WORDCHANGE} TEXT, ${WordTable.Col.SYNWORDS} TEXT, ${WordTable.Col.ASYNWORDS} TEXT, ${WordTable.Col.EXAMPLEEN1} TEXT, ${WordTable.Col.EXAMPLECN1} TEXT, ${WordTable.Col.EXAMPLEEN2} TEXT, ${WordTable.Col.EXAMPLECN2} TEXT, ${WordTable.Col.EXAMPLEEN3} TEXT, ${WordTable.Col.EXAMPLECN3} TEXT, ${WordTable.Col.USEDPHRASE} TEXT, ${WordTable.Col.EN2EN} TEXT, ${WordTable.Col.DISCRIMINATE} TEXT ) ` try { this.db.updateDb(sqlLearn) this.db.updateDb(sqlDeleteWord) this.db.updateDb(sqlWordTable) } catch (e) { DebugLog.e(`LearnDbAccess >>> createDbIfNeeds: ${e}`) } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L93-L156
871be3d66da4b995113de2ca8336fa472aa2893e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets
arkts
buildSendButton
构建发送按钮
@Builder buildSendButton() { LoadingButton({ text: '发送祝福', loadingText: '发送中...', loading: this.sending, disabled: !this.customContent.trim(), backgroundColor: '#ff6b6b', height: 48, onButtonClick: () => { this.sendGreeting(); } }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSendButton 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 LoadingButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left '发送祝福' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left loadingText : AST#expression#Left '发送中...' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left loading : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sending AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left disabled : 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . customContent AST#member_expression#Right AST#expression#Right . trim 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 backgroundColor : AST#expression#Left '#ff6b6b' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left 48 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onButtonClick : 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 . sendGreeting 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#component_parameter#Right } AST#component_parameters#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
@Builder buildSendButton() { LoadingButton({ text: '发送祝福', loadingText: '发送中...', loading: this.sending, disabled: !this.customContent.trim(), backgroundColor: '#ff6b6b', height: 48, onButtonClick: () => { this.sendGreeting(); } }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L574-L587
c954bb43ca0e2c8c6d448638603a7e5234114688
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/common/utils/UserAuthUtil.ets
arkts
startAuth
发起用户身份认证
static async startAuth(title: string = '请验证身份以继续'): Promise<boolean> { const challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]); const authType: userAuth.UserAuthType[] = [ userAuth.UserAuthType.PIN, userAuth.UserAuthType.FACE, userAuth.UserAuthType.FINGERPRINT ]; // 准备信任等级 const authTrustLevel: userAuth.AuthTrustLevel = userAuth.AuthTrustLevel.ATL1; try { // 构造 AuthParam 对象 const authParam: userAuth.AuthParam = { challenge: challenge, authType: authType, authTrustLevel: authTrustLevel }; // 构造 WidgetParam 对象 const widgetParam: userAuth.WidgetParam = { title: title }; // 获取认证实例 const userAuthInstance = userAuth.getUserAuthInstance(authParam, widgetParam); console.info('获取认证实例成功'); // 启动认证 return new Promise<boolean>((resolve) => { // 定义回调 const callback: userAuth.IAuthCallback = { onResult: (result: userAuth.UserAuthResult) => { console.info('UserAuth result: ' + JSON.stringify(result)); // 判断结果是否成功 if (result.result === userAuth.UserAuthResultCode.SUCCESS) { resolve(true); } else { resolve(false); } // 认证结束,释放资源 try { userAuthInstance.off('result', callback); } catch (e) { // 忽略解绑错误 } } }; // 订阅结果 userAuthInstance.on('result', callback); // 启动认证 console.info('开始启动认证...'); userAuthInstance.start(); }); } catch (error) { const err = error as BusinessError; console.error(`auth catch error. Code is ${err.code}, message is ${err.message}`); return false; } }
AST#method_declaration#Left static async startAuth 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#expression#Left '请验证身份以继续' 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 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#variable_declaration#Left const AST#variable_declarator#Left challenge = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( 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#expression#Left 8 AST#expression#Right ] AST#array_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 authType : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left userAuth AST#ERROR#Left . UserAuthType AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#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 userAuth AST#expression#Right . UserAuthType AST#member_expression#Right AST#expression#Right . PIN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . UserAuthType AST#member_expression#Right AST#expression#Right . FACE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . UserAuthType AST#member_expression#Right AST#expression#Right . FINGERPRINT AST#member_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#variable_declaration#Left const AST#variable_declarator#Left authTrustLevel : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . AuthTrustLevel AST#qualified_type#Right 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 userAuth AST#expression#Right . AuthTrustLevel AST#member_expression#Right AST#expression#Right . ATL1 AST#member_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 { // 构造 AuthParam 对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left authParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . AuthParam 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 challenge AST#property_name#Right : AST#expression#Left challenge AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left authType AST#property_name#Right : AST#expression#Left authType AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left authTrustLevel AST#property_name#Right : AST#expression#Left authTrustLevel 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 // 构造 WidgetParam 对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left widgetParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . WidgetParam 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 title AST#property_name#Right : AST#expression#Left title 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 userAuthInstance = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . getUserAuthInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left authParam AST#expression#Right , AST#expression#Left widgetParam 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '获取认证实例成功' 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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right 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#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 定义回调 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . IAuthCallback 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 onResult AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . UserAuthResult 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 console 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 'UserAuth result: ' 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 result 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#if_statement#Left if ( 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#member_expression#Left AST#expression#Left result AST#expression#Right . result AST#member_expression#Right AST#expression#Right === AST#expression#Left userAuth AST#expression#Right AST#binary_expression#Right AST#expression#Right . UserAuthResultCode AST#member_expression#Right AST#expression#Right . SUCCESS 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 resolve 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#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 resolve AST#expression#Right AST#argument_list#Left ( 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#block_statement#Right AST#if_statement#Right AST#statement#Right // 认证结束,释放资源 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 userAuthInstance AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'result' AST#expression#Right , AST#expression#Left callback 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#Left catch ( e ) AST#block_statement#Left { // 忽略解绑错误 } AST#block_statement#Right AST#catch_clause#Right AST#try_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#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 userAuthInstance AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'result' AST#expression#Right , AST#expression#Left callback 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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '开始启动认证...' 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 userAuthInstance AST#expression#Right . start 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` auth catch error. 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#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
static async startAuth(title: string = '请验证身份以继续'): Promise<boolean> { const challenge = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]); const authType: userAuth.UserAuthType[] = [ userAuth.UserAuthType.PIN, userAuth.UserAuthType.FACE, userAuth.UserAuthType.FINGERPRINT ]; const authTrustLevel: userAuth.AuthTrustLevel = userAuth.AuthTrustLevel.ATL1; try { const authParam: userAuth.AuthParam = { challenge: challenge, authType: authType, authTrustLevel: authTrustLevel }; const widgetParam: userAuth.WidgetParam = { title: title }; const userAuthInstance = userAuth.getUserAuthInstance(authParam, widgetParam); console.info('获取认证实例成功'); return new Promise<boolean>((resolve) => { const callback: userAuth.IAuthCallback = { onResult: (result: userAuth.UserAuthResult) => { console.info('UserAuth result: ' + JSON.stringify(result)); if (result.result === userAuth.UserAuthResultCode.SUCCESS) { resolve(true); } else { resolve(false); } try { userAuthInstance.off('result', callback); } catch (e) { } } }; userAuthInstance.on('result', callback); console.info('开始启动认证...'); userAuthInstance.start(); }); } catch (error) { const err = error as BusinessError; console.error(`auth catch error. Code is ${err.code}, message is ${err.message}`); return false; } }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/UserAuthUtil.ets#L8-L73
a663ebf137afd30975f03cee29bcc6fbed5a8ce1
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/util/MosaicPixelMapHelper.ets
arkts
process
根据压缩后的像素图生成马赛克像素图 @param pixelMap 压缩后的像素图 @param oriSize 原图尺寸 @returns Promise<PixelMap | undefined>
static async process(pixelMap: PixelMap, oriSize: image.Size): Promise<PixelMap | undefined> { let start = Date.now() try { let imgInfo = pixelMap.getImageInfoSync() LoggerWrapper.i(MODULE, TAG, 'process ' + JSON.stringify(imgInfo) + ',oriSize=' + JSON.stringify(oriSize)); let mosaicSize: image.Size = { width: imgInfo.size.width, height: imgInfo.size.height } let bufferData = new ArrayBuffer(pixelMap.getPixelBytesNumber()); await pixelMap.readPixelsToBuffer(bufferData); let dataArray = new Uint8Array(bufferData); mosaicSize.width = Math.floor(mosaicSize.width) mosaicSize.height = Math.floor(mosaicSize.height) let modifySucc = MosaicPixelMapHelper.modifyPixelMapColors(dataArray, mosaicSize, oriSize) if (modifySucc) { let mosaicPixelMap = await image.createPixelMap(dataArray.buffer, { size: { width: mosaicSize.width, height: mosaicSize.height }, pixelFormat: image.PixelMapFormat.RGBA_8888, srcPixelFormat: imgInfo.pixelFormat }); LoggerWrapper.i(MODULE, TAG, 'process end cost(ms)=' + (Date.now() - start) + ' succ=' + (mosaicPixelMap != undefined)); return mosaicPixelMap } } catch (e) { LoggerWrapper.e(MODULE, TAG, 'process error', e); } return undefined }
AST#method_declaration#Left static async process AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oriSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Size 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#union_type#Left AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_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 start = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imgInfo = 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 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#ERROR#Left LoggerWrapper AST#ERROR#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MODULE AST#expression#Right , AST#expression#Left TAG AST#expression#Right , 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'process ' 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 imgInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left ',oriSize=' AST#expression#Right AST#binary_expression#Right 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 oriSize 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mosaicSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Size 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 width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . 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 AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height 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#variable_declaration#Left let AST#variable_declarator#Left bufferData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ArrayBuffer AST#expression#Right AST#new_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 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#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 pixelMap AST#expression#Right AST#await_expression#Right AST#expression#Right . readPixelsToBuffer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bufferData 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 dataArray = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bufferData 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 mosaicSize AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left mosaicSize AST#expression#Right . width 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left mosaicSize AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left mosaicSize AST#expression#Right . height 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 modifySucc = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MosaicPixelMapHelper AST#expression#Right . modifyPixelMapColors AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dataArray AST#expression#Right , AST#expression#Left mosaicSize AST#expression#Right , AST#expression#Left oriSize 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 modifySucc AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mosaicPixelMap = 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 image 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#member_expression#Left AST#expression#Left dataArray AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size 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 mosaicSize AST#expression#Right . 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 mosaicSize AST#expression#Right . height 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 pixelFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . PixelMapFormat AST#member_expression#Right AST#expression#Right . RGBA_8888 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left srcPixelFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . pixelFormat 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 LoggerWrapper AST#expression#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MODULE AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'process end cost(ms)=' AST#expression#Right + AST#expression#Left AST#parenthesized_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 Date AST#expression#Right . now 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 start 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 ' succ=' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left mosaicPixelMap AST#expression#Right != AST#expression#Left undefined 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#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 mosaicPixelMap AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) 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 LoggerWrapper AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MODULE AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'process error' AST#expression#Right , AST#expression#Left e 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#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async process(pixelMap: PixelMap, oriSize: image.Size): Promise<PixelMap | undefined> { let start = Date.now() try { let imgInfo = pixelMap.getImageInfoSync() LoggerWrapper.i(MODULE, TAG, 'process ' + JSON.stringify(imgInfo) + ',oriSize=' + JSON.stringify(oriSize)); let mosaicSize: image.Size = { width: imgInfo.size.width, height: imgInfo.size.height } let bufferData = new ArrayBuffer(pixelMap.getPixelBytesNumber()); await pixelMap.readPixelsToBuffer(bufferData); let dataArray = new Uint8Array(bufferData); mosaicSize.width = Math.floor(mosaicSize.width) mosaicSize.height = Math.floor(mosaicSize.height) let modifySucc = MosaicPixelMapHelper.modifyPixelMapColors(dataArray, mosaicSize, oriSize) if (modifySucc) { let mosaicPixelMap = await image.createPixelMap(dataArray.buffer, { size: { width: mosaicSize.width, height: mosaicSize.height }, pixelFormat: image.PixelMapFormat.RGBA_8888, srcPixelFormat: imgInfo.pixelFormat }); LoggerWrapper.i(MODULE, TAG, 'process end cost(ms)=' + (Date.now() - start) + ' succ=' + (mosaicPixelMap != undefined)); return mosaicPixelMap } } catch (e) { LoggerWrapper.e(MODULE, TAG, 'process error', e); } return undefined }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/MosaicPixelMapHelper.ets#L59-L85
b3e6ad1d81846ec12c344969e99ffb444b32569c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage.ets
arkts
[Start person] somePackage.ets
export class Person { name: string; age: number; constructor(n: string, a: number) { this.name = n; this.age = a; } getInfo(): string { return 'name: ' + this.name + ', ' + 'age: ' + this.age.toString(); } }
AST#export_declaration#Left export AST#class_declaration#Left class Person AST#class_body#Left { AST#property_declaration#Left name : 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 age : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left n : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left a : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right = AST#expression#Left n 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 . age AST#member_expression#Right = AST#expression#Left a 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 getInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 AST#binary_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 'name: ' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right + AST#expression#Left ', ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 'age: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . age 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#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 Person { name: string; age: number; constructor(n: string, a: number) { this.name = n; this.age = a; } getInfo(): string { return 'name: ' + this.name + ', ' + 'age: ' + this.age.toString(); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage.ets#L29-L39
458dd2292ad997eba2bcf76dc8f3068b9e60865b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/components/listAndGrid/waterFlowSample/WaterFlowDataSource.ets
arkts
实现IDataSource接口的对象,用于瀑布流组件加载数据
export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = [] private listeners: DataChangeListener[] = [] constructor
AST#export_declaration#Left export AST#ERROR#Left class WaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right { AST#property_declaration#Left private dataArray : 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 private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener [ ] 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#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class WaterFlowDataSource implements IDataSource { private dataArray: number[] = [] private listeners: DataChangeListener[] = [] constructor
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/components/listAndGrid/waterFlowSample/WaterFlowDataSource.ets#L225-L229
5f9688b74f3555eb092f0821b40a21af569ee7e7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
clearData
清空系统剪贴板内容,使用Promise异步回调。 @returns
static async clearData(): Promise<void> { PasteboardUtil.getSystemPasteboard().clearData(); }
AST#method_declaration#Left static async clearData 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#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 PasteboardUtil AST#expression#Right . getSystemPasteboard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . clearData 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
static async clearData(): Promise<void> { PasteboardUtil.getSystemPasteboard().clearData(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L357-L359
7f39e74e89d197d0391b25f5b0420eff6eda4763
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/BusinessSample/entry/src/main/ets/viewmodel/BusinessViewModel.ets
arkts
getListItems
Get list items. @return {Array<ListItemData>} listItems.
getListItems(): Array<ListItemData> { let widgets: Array<WidgetType> = [WidgetType.TOGGLE, WidgetType.INFO, WidgetType.TEXT, WidgetType.default]; let listItems: Array<ListItemData> = []; for (let i = 0; i < widgets.length; i++) { for (let j = 0; j < CommonConstants.REPEAT_TIMES; j++) { let cardItem = new ListItemData(); cardItem.title = $r('app.string.list_item_title'); cardItem.subTitle = $r('app.string.list_item_sub_title'); cardItem.widget = widgets[i]; listItems.push(cardItem); } } return listItems; }
AST#method_declaration#Left getListItems 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 ListItemData 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 widgets : 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 WidgetType 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#member_expression#Left AST#expression#Left WidgetType AST#expression#Right . TOGGLE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left WidgetType AST#expression#Right . INFO AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left WidgetType AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left WidgetType AST#expression#Right . default AST#member_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#variable_declaration#Left let AST#variable_declarator#Left listItems : 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 ListItemData 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#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 widgets 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . REPEAT_TIMES AST#member_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 let AST#variable_declarator#Left cardItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListItemData 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#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 cardItem AST#expression#Right . title AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.list_item_title' AST#expression#Right ) AST#resource_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 cardItem AST#expression#Right . subTitle AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.list_item_sub_title' AST#expression#Right ) AST#resource_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 cardItem AST#expression#Right . widget AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left widgets AST#expression#Right [ AST#expression#Left i 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 listItems AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cardItem 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#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left listItems AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getListItems(): Array<ListItemData> { let widgets: Array<WidgetType> = [WidgetType.TOGGLE, WidgetType.INFO, WidgetType.TEXT, WidgetType.default]; let listItems: Array<ListItemData> = []; for (let i = 0; i < widgets.length; i++) { for (let j = 0; j < CommonConstants.REPEAT_TIMES; j++) { let cardItem = new ListItemData(); cardItem.title = $r('app.string.list_item_title'); cardItem.subTitle = $r('app.string.list_item_sub_title'); cardItem.widget = widgets[i]; listItems.push(cardItem); } } return listItems; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/viewmodel/BusinessViewModel.ets#L15-L28
ea2b62e21dc8632612423a66564e0d11542997ab
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/utils/EncryptUtils.ets
arkts
sha256
SHA256 哈希
static async sha256(text: string): Promise<string> { try { // 实际实现需要使用 cryptoFramework return `sha256_${text}`; } catch (error) { return ''; } }
AST#method_declaration#Left static async sha256 AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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#try_statement#Left try AST#block_statement#Left { // 实际实现需要使用 cryptoFramework AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` sha256_ AST#template_substitution#Left $ { AST#expression#Left text AST#expression#Right } AST#template_substitution#Right ` AST#template_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#return_statement#Left return AST#expression#Left '' 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 sha256(text: string): Promise<string> { try { return `sha256_${text}`; } catch (error) { return ''; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/EncryptUtils.ets#L25-L32
1917a59a5cc298491f8782e5f1a34ad34afac3fa
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/order/OrderParam.ets
arkts
订单评价参数
export interface OrderCommentParam extends OrderIdParam, GoodsIdParam {}
AST#export_declaration#Left export AST#interface_declaration#Left interface OrderCommentParam AST#extends_clause#Left extends OrderIdParam , GoodsIdParam AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface OrderCommentParam extends OrderIdParam, GoodsIdParam {}
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderParam.ets#L35-L35
33bfe4ac8d031c9b9ad9c432fca5d4af66bb7dda
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语状态枚举
export enum GreetingStatus { DRAFT = 'draft', // 草稿 ACTIVE = 'active', // 活跃 SENT = 'sent', // 已发送 DELIVERED = 'delivered', // 已送达 READ = 'read', // 已读 FAILED = 'failed', // 发送失败 ARCHIVED = 'archived' // 已归档 }
AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingStatus AST#enum_body#Left { AST#enum_member#Left DRAFT = AST#expression#Left 'draft' AST#expression#Right AST#enum_member#Right , // 草稿 AST#enum_member#Left ACTIVE = AST#expression#Left 'active' AST#expression#Right AST#enum_member#Right , // 活跃 AST#enum_member#Left SENT = AST#expression#Left 'sent' AST#expression#Right AST#enum_member#Right , // 已发送 AST#enum_member#Left DELIVERED = AST#expression#Left 'delivered' AST#expression#Right AST#enum_member#Right , // 已送达 AST#enum_member#Left READ = AST#expression#Left 'read' AST#expression#Right AST#enum_member#Right , // 已读 AST#enum_member#Left FAILED = AST#expression#Left 'failed' AST#expression#Right AST#enum_member#Right , // 发送失败 AST#enum_member#Left ARCHIVED = AST#expression#Left 'archived' AST#expression#Right AST#enum_member#Right // 已归档 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum GreetingStatus { DRAFT = 'draft', ACTIVE = 'active', SENT = 'sent', DELIVERED = 'delivered', READ = 'read', FAILED = 'failed', ARCHIVED = 'archived' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L114-L122
f8da8d58176bf32824021fb0a56a86c97f703703
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/OnChartValueSelectedListener.ets
arkts
Listener for callbacks when selecting values inside the chart by touch-gesture. @author Philipp Jahoda
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/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/listener/OnChartValueSelectedListener.ets#L24-L24
76329594c43af6cfaeebe86d4268e794176372ca
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/loop_stmt/for_init_002_F.ets
arkts
Introduction 循环结构-init语句
export function for_init_002_F(taint_src : string) { let clean = "" let _t = taint_src; let ini = ""; let j = 0; for (ini = "_"; j < 2; j++) { clean = clean + ini; } taint.Sink(clean); }
AST#export_declaration#Left export AST#function_declaration#Left function for_init_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left clean = AST#expression#Left "" 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 _t = AST#expression#Left taint_src 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 ini = AST#expression#Left "" 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 j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#expression#Left AST#assignment_expression#Left ini = AST#expression#Left "_" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left 2 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#assignment_expression#Left clean = AST#expression#Left AST#binary_expression#Left AST#expression#Left clean AST#expression#Right + AST#expression#Left ini 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#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 taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left clean 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#function_declaration#Right AST#export_declaration#Right
export function for_init_002_F(taint_src : string) { let clean = "" let _t = taint_src; let ini = ""; let j = 0; for (ini = "_"; j < 2; j++) { clean = clean + ini; } taint.Sink(clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/for_init_002_F.ets#L6-L15
c977d3bbabb58af6ea6703f3b745aefce6e50ecd
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/Index.ets
arkts
MiniPlayerAnimation
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 { MiniPlayerAnimation } from './src/main/ets/view/MiniPlayerAnimation';
AST#export_declaration#Left export { MiniPlayerAnimation } from './src/main/ets/view/MiniPlayerAnimation' ; AST#export_declaration#Right
export { MiniPlayerAnimation } from './src/main/ets/view/MiniPlayerAnimation';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/Index.ets#L16-L16
2099ed49c944a40a816166c155b1ff6631968671
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
clearDataSync
清空系统剪贴板内容。 @returns
static clearDataSync() { PasteboardUtil.getSystemPasteboard().clearDataSync(); }
AST#method_declaration#Left static clearDataSync AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil AST#expression#Right . getSystemPasteboard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . clearDataSync 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
static clearDataSync() { PasteboardUtil.getSystemPasteboard().clearDataSync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L365-L367
94c1138ef3f7f7e38db9ec953790017d80fc0707
gitee
yangsongming/ArkTs-HuXiHelper.git
ed148299fc6dcf351bcc0f2863a5aee4885fbaf5
ets/viewmodel/CollegesItem.ets
arkts
Item info of the zones.
export default class ZonesItem { id: number = 0; title: ResourceStr = $r('app.string.area_name_a'); subTitle: ResourceStr = $r('app.string.area_sub_name_a'); createTime: ResourceStr = $r('app.string.create_year_2015'); content: ResourceStr[] = []; thumbnail: ResourceStr = $r('app.media.ic_thumbnail_a'); swiperPic: ResourceStr = $r('app.media.ic_A'); subPicTop: ResourceStr = $r('app.media.ic_A_photo_top'); subPicBottom: ResourceStr = $r('app.media.ic_A_photo_bottom'); titleIcon: ResourceStr = $r('app.media.ic_title_top_A'); imageList: ResourceStr[] = []; buildingInformation: ResourceStr = $r('app.string.build_information_a'); buildingPic: ResourceStr = $r('app.media.ic_building_A'); geographyPic: ResourceStr = $r('app.media.ic_geography_dark_A'); geographyPicLight: ResourceStr = $r('app.media.ic_geography_lighter_A'); backgroundColor: ResourceStr = $r('app.color.introduction_page_green'); starLinePic: ResourceStr[] = []; }
AST#export_declaration#Left export default AST#class_declaration#Left class ZonesItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.area_name_a' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left subTitle : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.area_sub_name_a' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left createTime : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.create_year_2015' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left content : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResourceStr [ ] 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 thumbnail : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_thumbnail_a' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left swiperPic : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_A' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left subPicTop : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_A_photo_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left subPicBottom : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_A_photo_bottom' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left titleIcon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_title_top_A' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left imageList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResourceStr [ ] 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 buildingInformation : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.build_information_a' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left buildingPic : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_building_A' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left geographyPic : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_geography_dark_A' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left geographyPicLight : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_geography_lighter_A' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left backgroundColor : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.introduction_page_green' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left starLinePic : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResourceStr [ ] 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#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class ZonesItem { id: number = 0; title: ResourceStr = $r('app.string.area_name_a'); subTitle: ResourceStr = $r('app.string.area_sub_name_a'); createTime: ResourceStr = $r('app.string.create_year_2015'); content: ResourceStr[] = []; thumbnail: ResourceStr = $r('app.media.ic_thumbnail_a'); swiperPic: ResourceStr = $r('app.media.ic_A'); subPicTop: ResourceStr = $r('app.media.ic_A_photo_top'); subPicBottom: ResourceStr = $r('app.media.ic_A_photo_bottom'); titleIcon: ResourceStr = $r('app.media.ic_title_top_A'); imageList: ResourceStr[] = []; buildingInformation: ResourceStr = $r('app.string.build_information_a'); buildingPic: ResourceStr = $r('app.media.ic_building_A'); geographyPic: ResourceStr = $r('app.media.ic_geography_dark_A'); geographyPicLight: ResourceStr = $r('app.media.ic_geography_lighter_A'); backgroundColor: ResourceStr = $r('app.color.introduction_page_green'); starLinePic: ResourceStr[] = []; }
https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/viewmodel/CollegesItem.ets#L5-L23
387456dbd70460a418da53e7c7435e875b5eba37
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowBookmarks.ets
arkts
move_folder
Operations
move_folder() { this.moving_type = "folder"; this.woofBookmarksPathSelector_control.open(); }
AST#method_declaration#Left move_folder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . moving_type AST#member_expression#Right = AST#expression#Left "folder" 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 . woofBookmarksPathSelector_control AST#member_expression#Right AST#expression#Right . open 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
move_folder() { this.moving_type = "folder"; this.woofBookmarksPathSelector_control.open(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowBookmarks.ets#L869-L872
c6de6ea0f6ce6f5fa6b2c88625f3c7b4f572b26e
gitee
Duke_Bit/logan
37ce340f90e508cbf3914162df2254aca76a525a
core/src/main/ets/Logan.ets
arkts
@param url 接受日志的服务器完整url. @param date 日志日期 格式:时间戳. @param appId 当前应用的唯一标识,在多App时区分日志来源App. @param unionId 当前用户的唯一标识,用来区分日志来源用户. @param deviceId 设备id. @param buildVersion 上报源App的build号. @param appVersion 上报源的App版本. @param sendLogCallback 上报结果回调(子线程调用).
export function sendFromDefault(url: string, date:string,appId:string,unionId:string,deviceId:string,buildVersion:string,appVersion:string,sendLogCallback: (statusCode: number) => void){ let header:Map<string,string> = new Map<string,string>() header.set("fileDate", date); header.set("appId",appId) header.set("unionId",unionId) header.set("deviceId",deviceId) header.set("buildVersion",buildVersion) header.set("appVersion",appVersion) header.set("platform", "1"); sendFromDefaultWithHeader( url, date, header, sendLogCallback ) }
AST#export_declaration#Left export AST#function_declaration#Left function sendFromDefault 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 date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left appId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left unionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buildVersion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left appVersion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sendLogCallback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left statusCode : 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#function_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 header : 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 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#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 Map AST#expression#Right AST#new_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_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left header AST#ERROR#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "fileDate" AST#expression#Right , AST#expression#Left date 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 header AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "appId" AST#expression#Right , AST#expression#Left appId 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 header AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "unionId" AST#expression#Right , AST#expression#Left unionId 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 header AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "deviceId" AST#expression#Right , AST#expression#Left deviceId 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 header AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "buildVersion" AST#expression#Right , AST#expression#Left buildVersion 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 header AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "appVersion" AST#expression#Right , AST#expression#Left appVersion 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 header AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "platform" AST#expression#Right , AST#expression#Left "1" 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 sendFromDefaultWithHeader AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left date AST#expression#Right , AST#expression#Left header AST#expression#Right , AST#expression#Left sendLogCallback 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#function_declaration#Right AST#export_declaration#Right
export function sendFromDefault(url: string, date:string,appId:string,unionId:string,deviceId:string,buildVersion:string,appVersion:string,sendLogCallback: (statusCode: number) => void){ let header:Map<string,string> = new Map<string,string>() header.set("fileDate", date); header.set("appId",appId) header.set("unionId",unionId) header.set("deviceId",deviceId) header.set("buildVersion",buildVersion) header.set("appVersion",appVersion) header.set("platform", "1"); sendFromDefaultWithHeader( url, date, header, sendLogCallback ) }
https://github.com/Duke_Bit/logan/blob/37ce340f90e508cbf3914162df2254aca76a525a/core/src/main/ets/Logan.ets#L67-L82
ee504ef116127c38f634bc278db2852c8fd94c5f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/types/SettingsTypes.ets
arkts
安全设置接口
export interface SecuritySettings { level: SecurityLevel; biometricAuth: boolean; appLock: boolean; dataEncryption: boolean; sessionTimeout: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SecuritySettings AST#object_type#Left { AST#type_member#Left level : AST#type_annotation#Left AST#primary_type#Left SecurityLevel AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left biometricAuth : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left appLock : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left dataEncryption : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left sessionTimeout : 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 SecuritySettings { level: SecurityLevel; biometricAuth: boolean; appLock: boolean; dataEncryption: boolean; sessionTimeout: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L584-L590
359899462978e61a7978548cbe34a9752143422c
github
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/RadarChartModel.ets
arkts
getFactor
Returns the factor that is needed to transform values into pixels. @return
public getFactor(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); return Math.min(content.width() / 2, content.height() / 2) / this.mYAxis.mAxisRange * 0.7; }
AST#method_declaration#Left public getFactor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left content : AST#type_annotation#Left AST#primary_type#Left MyRect 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 this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . getContentRect 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#binary_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 Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#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 content AST#expression#Right . width 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#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left content AST#expression#Right . height 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#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mYAxis AST#member_expression#Right AST#expression#Right . mAxisRange AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.7 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getFactor(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); return Math.min(content.width() / 2, content.height() / 2) / this.mYAxis.mAxisRange * 0.7; }
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/RadarChartModel.ets#L181-L184
1a262ec981f5f89b2ee04ffd140bb1fd204cb38a
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/ChannelDelete.ets
arkts
应用约束18: 构造函数参数需在类字段中声明
constructor(client: any) { super(client); this.client = client; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 client 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 . client AST#member_expression#Right = AST#expression#Left client 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(client: any) { super(client); this.client = client; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/ChannelDelete.ets#L10-L13
efbc58a8f542242b72a3161bb065102b8ba01306
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_lite.ets
arkts
clear
Clears index by setting it a new empty Map.
static clear() { bunch_of_history_index_lite.index_map = new collections.Map<string, collections.Array<number>>(); }
AST#method_declaration#Left static clear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left bunch_of_history_index_lite AST#expression#Right . index_map AST#member_expression#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 collections AST#expression#Right AST#new_expression#Right AST#expression#Right . Map 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_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left collections . Array AST#qualified_type#Right AST#type_arguments#Left < 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#type_arguments#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#builder_function_body#Right AST#method_declaration#Right
static clear() { bunch_of_history_index_lite.index_map = new collections.Map<string, collections.Array<number>>(); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L20-L22
cdea5a12ef52c38d1ced946e3a65ffa231cb37d5
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
registerBuilder
[StartExclude class_routerModule] [Start static_registerBuilder] 通过名称注册路由栈
public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void { RouterModule.builderMap.set(builderName, builder); }
AST#method_declaration#Left public static registerBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_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#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 RouterModule AST#expression#Right . builderMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName AST#expression#Right , AST#expression#Left builder 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
public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void { RouterModule.builderMap.set(builderName, builder); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L28-L30
1a77a66d7a44548920de817b7cec8e85deda6334
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets
arkts
认证响应
export interface AuthResponse { user: UserInfo; token: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AuthResponse AST#object_type#Left { AST#type_member#Left user : AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left token : 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 AuthResponse { user: UserInfo; token: string; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/model/CommonTypes.ets#L288-L291
261e4fae438e22a567d846705af865d6cf6282e7
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
getSolarFestival
获取公历节日 @param month 公历月 @param day 公历日 @returns 节日名称,无节日返回空字符串
static getSolarFestival(month: number, day: number): string { const festivals: Record<string, string> = { '1-1': '元旦', '2-14': '情人节', '3-8': '妇女节', '3-12': '植树节', '4-1': '愚人节', '4-4': '清明节', '4-5': '清明节', '4-22': '世界地球日', '5-1': '劳动节', '5-4': '青年节', '5-12': '护士节', '6-1': '儿童节', '6-5': '世界环境日', '7-1': '建党节', '8-1': '建军节', '9-10': '教师节', '10-1': '国庆节', '11-11': '光棍节', '12-24': '平安夜', '12-25': '圣诞节' }; const key = `${month}-${day}`; return festivals[key] || ''; }
AST#method_declaration#Left static getSolarFestival AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left day : 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 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 festivals : 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left '1-1' AST#property_name#Right : AST#expression#Left '元旦' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '2-14' AST#property_name#Right : AST#expression#Left '情人节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '3-8' AST#property_name#Right : AST#expression#Left '妇女节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '3-12' AST#property_name#Right : AST#expression#Left '植树节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '4-1' AST#property_name#Right : AST#expression#Left '愚人节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '4-4' AST#property_name#Right : AST#expression#Left '清明节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '4-5' AST#property_name#Right : AST#expression#Left '清明节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '4-22' AST#property_name#Right : AST#expression#Left '世界地球日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '5-1' AST#property_name#Right : AST#expression#Left '劳动节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '5-4' AST#property_name#Right : AST#expression#Left '青年节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '5-12' AST#property_name#Right : AST#expression#Left '护士节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '6-1' AST#property_name#Right : AST#expression#Left '儿童节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '6-5' AST#property_name#Right : AST#expression#Left '世界环境日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '7-1' AST#property_name#Right : AST#expression#Left '建党节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '8-1' AST#property_name#Right : AST#expression#Left '建军节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '9-10' AST#property_name#Right : AST#expression#Left '教师节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '10-1' AST#property_name#Right : AST#expression#Left '国庆节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '11-11' AST#property_name#Right : AST#expression#Left '光棍节' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '12-24' AST#property_name#Right : AST#expression#Left '平安夜' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left '12-25' AST#property_name#Right : AST#expression#Left '圣诞节' 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 key = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left day 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#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left festivals AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getSolarFestival(month: number, day: number): string { const festivals: Record<string, string> = { '1-1': '元旦', '2-14': '情人节', '3-8': '妇女节', '3-12': '植树节', '4-1': '愚人节', '4-4': '清明节', '4-5': '清明节', '4-22': '世界地球日', '5-1': '劳动节', '5-4': '青年节', '5-12': '护士节', '6-1': '儿童节', '6-5': '世界环境日', '7-1': '建党节', '8-1': '建军节', '9-10': '教师节', '10-1': '国庆节', '11-11': '光棍节', '12-24': '平安夜', '12-25': '圣诞节' }; const key = `${month}-${day}`; return festivals[key] || ''; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L451-L477
6fc91912ff25aff342232db705354bc9e821fe42
github
linwu-hi/open_neteasy_cloud.git
b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4
entry/src/main/ets/view/CategoryComponent.ets
arkts
CategoryComponent
This is the list of category item.
@Component export struct CategoryComponent { private listData: Array<ListItemData>; build() { Column() { List() { ForEach(this.listData, (listItemData: ListItemData) => { ListItem() { Row() { Text(listItemData.title) .fontSize($r('app.float.sub_title_left_size')) .fontColor($r('app.color.list_item_title')) .margin({ left: $r('app.float.item_text_margin_left') }) Blank(); Text(listItemData.summary) .fontSize($r('app.float.sub_title_right_size')) .fontColor($r('app.color.list_item_summary')) .margin({ right: $r('app.float.item_text_margin_right') }) Image(listItemData.imageArrow) .width($r('app.float.image_right_arrow_width')) .height($r('app.float.image_right_arrow_height')) .objectFit(ImageFit.Contain) .margin({ right: $r('app.float.sub_item_margin_right') }) } .width(CommonConstants.ROW_WIDTH_PERCENT) .height($r('app.float.list_item_height')) .onClick(() => { router.pushUrl({ url: CommonConstants.DETAIL_PAGE, params: { data: listItemData.title } }); }) } }, (listItemData, index) => index + JSON.stringify(listItemData)); } .divider({ strokeWidth: $r('app.float.divider_height'), color: $r('app.color.list_divider'), startMargin: $r('app.float.list_divider_margin'), endMargin: $r('app.float.list_divider_margin') }) } .padding({ top: $r('app.float.list_padding_top'), bottom: $r('app.float.list_padding_bottom') }) .backgroundColor($r('app.color.start_window_background')) .borderRadius($r('app.float.detail_list_radius')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CategoryComponent AST#component_body#Left { AST#property_declaration#Left private listData : 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 ListItemData 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#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#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 . listData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left listItemData : AST#type_annotation#Left AST#primary_type#Left ListItemData 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 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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left listItemData 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.sub_title_left_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.list_item_title' 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.item_text_margin_left' 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_custom_component_statement#Left Blank ( ) ; 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 listItemData AST#expression#Right . summary 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.sub_title_right_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.list_item_summary' 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 right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.item_text_margin_right' 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#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#member_expression#Left AST#expression#Left listItemData AST#expression#Right . imageArrow AST#member_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.float.image_right_arrow_width' 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.float.image_right_arrow_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain 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 right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.sub_item_margin_right' 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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_WIDTH_PERCENT 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.float.list_item_height' AST#expression#Right ) AST#resource_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 { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl 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 url AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DETAIL_PAGE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#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#member_expression#Left AST#expression#Left listItemData AST#expression#Right . title 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#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#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 listItemData AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_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 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 listItemData AST#expression#Right ) AST#argument_list#Right AST#call_expression#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 . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.divider_height' AST#expression#Right ) AST#resource_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#resource_expression#Left $r ( AST#expression#Left 'app.color.list_divider' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left startMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_divider_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_divider_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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_top' AST#expression#Right ) AST#resource_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#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_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#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 AST#resource_expression#Left $r ( AST#expression#Left 'app.float.detail_list_radius' 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 } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct CategoryComponent { private listData: Array<ListItemData>; build() { Column() { List() { ForEach(this.listData, (listItemData: ListItemData) => { ListItem() { Row() { Text(listItemData.title) .fontSize($r('app.float.sub_title_left_size')) .fontColor($r('app.color.list_item_title')) .margin({ left: $r('app.float.item_text_margin_left') }) Blank(); Text(listItemData.summary) .fontSize($r('app.float.sub_title_right_size')) .fontColor($r('app.color.list_item_summary')) .margin({ right: $r('app.float.item_text_margin_right') }) Image(listItemData.imageArrow) .width($r('app.float.image_right_arrow_width')) .height($r('app.float.image_right_arrow_height')) .objectFit(ImageFit.Contain) .margin({ right: $r('app.float.sub_item_margin_right') }) } .width(CommonConstants.ROW_WIDTH_PERCENT) .height($r('app.float.list_item_height')) .onClick(() => { router.pushUrl({ url: CommonConstants.DETAIL_PAGE, params: { data: listItemData.title } }); }) } }, (listItemData, index) => index + JSON.stringify(listItemData)); } .divider({ strokeWidth: $r('app.float.divider_height'), color: $r('app.color.list_divider'), startMargin: $r('app.float.list_divider_margin'), endMargin: $r('app.float.list_divider_margin') }) } .padding({ top: $r('app.float.list_padding_top'), bottom: $r('app.float.list_padding_bottom') }) .backgroundColor($r('app.color.start_window_background')) .borderRadius($r('app.float.detail_list_radius')) } }
https://github.com/linwu-hi/open_neteasy_cloud.git/blob/b562a70ffdbee5e192a1c3fb7fc8a4fb27119af4/entry/src/main/ets/view/CategoryComponent.ets#L8-L60
336950fae541314119c617bf73490f1af9e5be84
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/DetailMenuPanel.ets
arkts
DetailMenuPanel
Large picture button for dynamic refresh
@Component export struct DetailMenuPanel { @Link actionBarProp: ActionBarProp; onMenuClicked: Function | null = null; build() { Row() { ForEach(this.actionBarProp.getMenuList(), (menu: Action): void => { ActionBarButton({ res: menu.iconRes, action: menu, onMenuClicked: (action: Action): void => this.onMenuClicked?.(action), isAutoTint: menu.isAutoTint, colorMode: this.actionBarProp.getColorMode() }).id(menu.actionID.toString()) }, (menu: Action): string => { return JSON.stringify(menu.actionID) }) }.alignItems(VerticalAlign.Center) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DetailMenuPanel AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right actionBarProp : AST#type_annotation#Left AST#primary_type#Left ActionBarProp AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left onMenuClicked : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Function 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 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( 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 . actionBarProp AST#member_expression#Right AST#expression#Right . getMenuList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left menu : AST#type_annotation#Left AST#primary_type#Left Action 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 ActionBarButton ( AST#component_parameters#Left { AST#component_parameter#Left res : AST#expression#Left AST#member_expression#Left AST#expression#Left menu AST#expression#Right . iconRes AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left action : AST#expression#Left menu AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onMenuClicked : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left Action 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onMenuClicked AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left action AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isAutoTint : AST#expression#Left AST#member_expression#Left AST#expression#Left menu AST#expression#Right . isAutoTint AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left colorMode : 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 . actionBarProp AST#member_expression#Right AST#expression#Right . getColorMode 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_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left menu AST#expression#Right . actionID 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#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#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left menu : AST#type_annotation#Left AST#primary_type#Left Action 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#return_statement#Left return 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 menu AST#expression#Right . actionID AST#member_expression#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#arrow_function#Right AST#expression#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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right 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
@Component export struct DetailMenuPanel { @Link actionBarProp: ActionBarProp; onMenuClicked: Function | null = null; build() { Row() { ForEach(this.actionBarProp.getMenuList(), (menu: Action): void => { ActionBarButton({ res: menu.iconRes, action: menu, onMenuClicked: (action: Action): void => this.onMenuClicked?.(action), isAutoTint: menu.isAutoTint, colorMode: this.actionBarProp.getColorMode() }).id(menu.actionID.toString()) }, (menu: Action): string => { return JSON.stringify(menu.actionID) }) }.alignItems(VerticalAlign.Center) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/DetailMenuPanel.ets#L21-L39
de648fa13dd115675a180412ee9970048077672d
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/interfaces/LineConfig/CustomGridLineConfig.ets
arkts
Copyright (C) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, 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 interface DashPathEffectConfig { lineLength: number; spaceLength: number; phase: number }
AST#export_declaration#Left export AST#interface_declaration#Left interface DashPathEffectConfig AST#object_type#Left { AST#type_member#Left lineLength : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left spaceLength : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left phase : 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 DashPathEffectConfig { lineLength: number; spaceLength: number; phase: number }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/interfaces/LineConfig/CustomGridLineConfig.ets#L16-L20
a5659b0fc20d8fbdd06f9b1724bc016341687de4
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
getParams
Obtains information about the current page params. @returns { ParamsInterface } Page params. @syscap SystemCapability.ArkUI.ArkUI.Full @since 7 @deprecated since 8
static getParams(): ParamsInterface;
AST#method_declaration#Left static getParams AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ParamsInterface AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static getParams(): ParamsInterface;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L282-L282
f831c755b5a88d60641520ebc924e48881940ad7
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets
arkts
The request content type enum.
export const enum ContentType { JSON = 'application/json' }
AST#export_declaration#Left export AST#enum_declaration#Left const enum ContentType AST#enum_body#Left { AST#enum_member#Left JSON = AST#expression#Left 'application/json' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export const enum ContentType { JSON = 'application/json' }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/common/constant/CommonConstant.ets#L227-L229
93af37f6b0e3568b702625217a39305cdbc8de15
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets
arkts
FlowItemView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, 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.
@Component export struct FlowItemView { @Link _position: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private parentComponentKey: string; private referenceComponentKey: string; build() { Column({ space: 2 }) { WaterFlow() { FlowItem() { Column() { Text('N1').fontSize(12).height('16') } } .width('100%') .height('100%') .position(this._position) .backgroundColor(Color.White) .key(this.componentKey) FlowItem() { Column() { Text('N2').fontSize(12).height('16') } } .width('100%') .height('100%') .backgroundColor(Color.White) .key(this.referenceComponentKey) } .columnsTemplate('1fr 1fr') .backgroundColor(0xFAEEE0) .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) .layoutDirection(FlexDirection.Column) } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlowItemView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private componentKey : 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 private parentWidth : 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 private parentHeight : 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 private parentComponentKey : 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 private referenceComponentKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#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#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 WaterFlow ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left FlowItem ( ) 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 Text ( AST#expression#Left 'N1' 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 . height ( AST#expression#Left '16' 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#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 . position ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _position AST#member_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 . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentKey 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#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 FlowItem ( ) 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 Text ( AST#expression#Left 'N2' 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 . height ( AST#expression#Left '16' 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#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 . backgroundColor ( 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 . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . referenceComponentKey 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 . columnsTemplate ( AST#expression#Left '1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFAEEE0 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth 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 . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentComponentKey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column 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#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 FlowItemView { @Link _position: Position; private componentKey: string; private parentWidth: number; private parentHeight: number; private parentComponentKey: string; private referenceComponentKey: string; build() { Column({ space: 2 }) { WaterFlow() { FlowItem() { Column() { Text('N1').fontSize(12).height('16') } } .width('100%') .height('100%') .position(this._position) .backgroundColor(Color.White) .key(this.componentKey) FlowItem() { Column() { Text('N2').fontSize(12).height('16') } } .width('100%') .height('100%') .backgroundColor(Color.White) .key(this.referenceComponentKey) } .columnsTemplate('1fr 1fr') .backgroundColor(0xFAEEE0) .width(this.parentWidth) .height(this.parentHeight) .key(this.parentComponentKey) .layoutDirection(FlexDirection.Column) } } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/position/FlowItemView.ets#L16-L57
860ded378138b9ad51abb80a39ce2d46fe175f1f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/WindowUtil.ets
arkts
@Author csx @DateTime 2024/4/3 09:11:04 @TODO WindowUtil 提供对窗口的工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
export class WindowUtil { /** * 缓存窗体,关闭时需要 */ private static cacheWindow: window.Window; /** * 根据参数创建窗口 * @param options * @returns */ static async createWindow(options: WinOptions): Promise<void> { if (!options) { options = new WinOptions(); } if (!options.name) { options.name = 'eftool'; } if (options.windowType == undefined) { options.windowType = window.WindowType.TYPE_DIALOG; } if (!options.bgColor) { options.bgColor = '#33606266'; } try { //创建窗口 let windowClass = await window.createWindow({ name: options.name, windowType: options.windowType, ctx: getContext() as common.UIAbilityContext }); //将窗口缓存 WindowUtil.cacheWindow = windowClass; await windowClass.setUIContent(options.contentRouter); //获取屏幕四大角 let d = display.getDefaultDisplaySync(); //设置窗口大小 await windowClass.resize(d.width, d.height); // 设置窗口背景颜色 windowClass.setWindowBackgroundColor(options.bgColor); //显示窗口 await windowClass.showWindow(); } catch (exception) { ToastUtil.showToast('创建窗口失败,原因为:' + JSON.stringify(exception)); } } /** * 关闭窗口 * @returns */ static async closeWindow(): Promise<void> { if (WindowUtil.cacheWindow) { await WindowUtil.cacheWindow.destroyWindow(); } } }
AST#export_declaration#Left export AST#class_declaration#Left class WindowUtil AST#class_body#Left { /** * 缓存窗体,关闭时需要 */ AST#property_declaration#Left private static cacheWindow : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 根据参数创建窗口 * @param options * @returns */ AST#method_declaration#Left static async createWindow AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left WinOptions 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left options = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left WinOptions 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#if_statement#Right AST#statement#Right 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 options AST#expression#Right AST#unary_expression#Right AST#expression#Right . name AST#member_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 options AST#expression#Right . name AST#member_expression#Right = AST#expression#Left 'eftool' 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 AST#member_expression#Left AST#expression#Left options AST#expression#Right . windowType 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 options AST#expression#Right . windowType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . WindowType AST#member_expression#Right AST#expression#Right . TYPE_DIALOG 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#if_statement#Right AST#statement#Right 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 options AST#expression#Right AST#unary_expression#Right AST#expression#Right . bgColor AST#member_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 options AST#expression#Right . bgColor AST#member_expression#Right = AST#expression#Left '#33606266' 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#try_statement#Left try AST#block_statement#Left { //创建窗口 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left windowClass = 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 . createWindow 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 name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left windowType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . windowType AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ctx AST#property_name#Right : AST#expression#Left AST#as_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 as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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#assignment_expression#Left AST#member_expression#Left AST#expression#Left WindowUtil AST#expression#Right . cacheWindow AST#member_expression#Right = AST#expression#Left windowClass 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#await_expression#Left await AST#expression#Left windowClass AST#expression#Right AST#await_expression#Right AST#expression#Right . setUIContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . contentRouter 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#variable_declaration#Left let AST#variable_declarator#Left d = 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 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 windowClass AST#expression#Right AST#await_expression#Right AST#expression#Right . resize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left d AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left d AST#expression#Right . height 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 windowClass AST#expression#Right . setWindowBackgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . bgColor 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#await_expression#Left await AST#expression#Left windowClass AST#expression#Right AST#await_expression#Right AST#expression#Right . showWindow 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#catch_clause#Left catch ( exception ) 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 ToastUtil AST#expression#Right . showToast 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#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 exception 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 关闭窗口 * @returns */ AST#method_declaration#Left static async closeWindow 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left WindowUtil AST#expression#Right . cacheWindow AST#member_expression#Right AST#expression#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 AST#await_expression#Left await AST#expression#Left WindowUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . cacheWindow AST#member_expression#Right AST#expression#Right . destroyWindow 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class WindowUtil { private static cacheWindow: window.Window; static async createWindow(options: WinOptions): Promise<void> { if (!options) { options = new WinOptions(); } if (!options.name) { options.name = 'eftool'; } if (options.windowType == undefined) { options.windowType = window.WindowType.TYPE_DIALOG; } if (!options.bgColor) { options.bgColor = '#33606266'; } try { let windowClass = await window.createWindow({ name: options.name, windowType: options.windowType, ctx: getContext() as common.UIAbilityContext }); WindowUtil.cacheWindow = windowClass; await windowClass.setUIContent(options.contentRouter); let d = display.getDefaultDisplaySync(); await windowClass.resize(d.width, d.height); windowClass.setWindowBackgroundColor(options.bgColor); await windowClass.showWindow(); } catch (exception) { ToastUtil.showToast('创建窗口失败,原因为:' + JSON.stringify(exception)); } } static async closeWindow(): Promise<void> { if (WindowUtil.cacheWindow) { await WindowUtil.cacheWindow.destroyWindow(); } } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/WindowUtil.ets#L28-L84
0ff5c37712aa2e4e162c6254e60e7ce591f62beb
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets
arkts
updateNewPassword
更新新密码 @param {string} value - 新密码 @returns {void} 无返回值
updateNewPassword(value: string): void { }
AST#method_declaration#Left updateNewPassword 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
updateNewPassword(value: string): void { }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets#L30-L31
a5183eacf10dc74eabc7dde8b3510b0c41bc0ab2
github
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
‘42%’
export const THOUSANDTH_500: string = '50%';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_500 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '50%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const THOUSANDTH_500: string = '50%';
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L56-L56
3ffef6d3c1bd85ca947a4f76e26dd5daca85a2f4
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/viewmodel/WorldClockViewModel.ets
arkts
addCity
添加城市到城市列表中。 @param city 要添加的城市
public addCity(city: CityItem) { this.cities.push(city) this.setCitiesToDatabase() }
AST#method_declaration#Left public addCity AST#parameter_list#Left ( AST#parameter#Left city : AST#type_annotation#Left AST#primary_type#Left CityItem 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 . cities AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left city 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 this AST#expression#Right . setCitiesToDatabase 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
public addCity(city: CityItem) { this.cities.push(city) this.setCitiesToDatabase() }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/WorldClockViewModel.ets#L127-L130
016faa20a7cb17b9f4207b487e2177cd65800e97
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_commonAttrsVisual/ace_ets_module_commonAttrsVisual_api11/entry/src/main/ets/MainAbility/pages/imageEffects/common.ets
arkts
popupBuilder
popup构造器定义弹框内容
@Builder popupBuilder() { Row({ space: 2 }) { Text('Custom Popup') .fontSize(10) } .width(100) .height(50) .padding(5) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right popupBuilder 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 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 'Custom Popup' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 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 . 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 . padding ( AST#expression#Left 5 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 popupBuilder() { Row({ space: 2 }) { Text('Custom Popup') .fontSize(10) } .width(100) .height(50) .padding(5) }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_commonAttrsVisual/ace_ets_module_commonAttrsVisual_api11/entry/src/main/ets/MainAbility/pages/imageEffects/common.ets#L25-L34
c1564f5aeb5809bdeaa9f6981aaf807b1d3e161a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
addResource
应用运行时,加载指定的资源路径,实现资源覆盖。 @param path 资源路径。 @returns
static addResource(path: string) { ResUtil.getResourceManager().addResource(path); }
AST#method_declaration#Left static addResource AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 ResUtil AST#expression#Right . getResourceManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . addResource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path 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 addResource(path: string) { ResUtil.getResourceManager().addResource(path); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L548-L550
6217af0536d25856b4ca0919114ad8fd6847a956
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/PaySecurely/cloud/Index.ets
arkts
MerchantServer
Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable 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 { MerchantServer } from './src/main/ets/MerchantServer'
AST#export_declaration#Left export { MerchantServer } from './src/main/ets/MerchantServer' AST#export_declaration#Right
export { MerchantServer } from './src/main/ets/MerchantServer'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/PaySecurely/cloud/Index.ets#L16-L16
7763879302570de5454bb11c7c055f93be23c6fc
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowAppSettings.ets
arkts
version_clicked
Called when clicking the version code in Settings - About. Activates the Devs Ops.
version_clicked() { this.version_clicked_times += 1; if (this.version_clicked_times == 7) { // Enter Dev mode bunch_of_settings.set('DEV_MODE', true); } }
AST#method_declaration#Left version_clicked AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . version_clicked_times AST#member_expression#Right += AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right 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 . version_clicked_times AST#member_expression#Right AST#expression#Right == AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // Enter Dev mode AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'DEV_MODE' 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
version_clicked() { this.version_clicked_times += 1; if (this.version_clicked_times == 7) { bunch_of_settings.set('DEV_MODE', true); } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowAppSettings.ets#L1735-L1741
be6d28726f9fe0d01ad009e8a0b387534359e7c5
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/GlobalContext.ets
arkts
getObject
获取指定键对应的对象。 @param key 对象的键 @return 对应的对象,如果不存在则返回 undefined
getObject(key: string): Object | undefined { return this._objects.get(key); }
AST#method_declaration#Left getObject AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left undefined 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _objects AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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
getObject(key: string): Object | undefined { return this._objects.get(key); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/GlobalContext.ets#L29-L31
42863941767d78998c8d510a98adbd9dce4ceef4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/chat/AIAssistantPage.ets
arkts
buildAssistantMessage
构建助手消息
@Builder buildAssistantMessage(message: ChatMessage) { Row({ space: 12 }) { // 助手头像 Circle({ width: 32, height: 32 }) .fill($r('app.color.primary')) .overlay( Image($r('app.media.ic_robot')) .width('20vp') .height('20vp') .fillColor(Color.White) ) Column({ space: 8 }) { Column() { if (message.type === MessageType.TEXT) { Text(message.content) .fontSize(14) .fontColor($r('app.color.text_primary')) .lineHeight(20) .maxLines(20) } else if (message.type === MessageType.CARD) { this.buildMessageCard(message) } } .padding(12) .backgroundColor(Color.White) .borderRadius(16) .constraintSize({ maxWidth: '75%' }) .shadow({ radius: 4, color: Color.Black, offsetX: 0, offsetY: 2 }) // 时间戳 Text(this.formatMessageTime(message.timestamp)) .fontSize(10) .fontColor($r('app.color.text_secondary')) .alignSelf(ItemAlign.Start) } .alignItems(HorizontalAlign.Start) .layoutWeight(1) } .width('100%') .alignItems(VerticalAlign.Top) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAssistantMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ChatMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_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 Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left 32 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left 32 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( 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#Left . overlay ( 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 Image AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_robot' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '20vp' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '20vp' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fillColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_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#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 8 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#container_content_body#Left { 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 message AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left MessageType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXT 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 message AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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 . lineHeight ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 20 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 } else 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 message AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left MessageType AST#expression#Right AST#binary_expression#Right AST#expression#Right . CARD AST#member_expression#Right AST#expression#Right ) { 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 . buildMessageCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left message 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_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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 . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left maxWidth AST#property_name#Right : AST#expression#Left '75%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right 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 4 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 Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatMessageTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . timestamp AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_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#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right 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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top 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#builder_function_body#Right AST#method_declaration#Right
@Builder buildAssistantMessage(message: ChatMessage) { Row({ space: 12 }) { Circle({ width: 32, height: 32 }) .fill($r('app.color.primary')) .overlay( Image($r('app.media.ic_robot')) .width('20vp') .height('20vp') .fillColor(Color.White) ) Column({ space: 8 }) { Column() { if (message.type === MessageType.TEXT) { Text(message.content) .fontSize(14) .fontColor($r('app.color.text_primary')) .lineHeight(20) .maxLines(20) } else if (message.type === MessageType.CARD) { this.buildMessageCard(message) } } .padding(12) .backgroundColor(Color.White) .borderRadius(16) .constraintSize({ maxWidth: '75%' }) .shadow({ radius: 4, color: Color.Black, offsetX: 0, offsetY: 2 }) Text(this.formatMessageTime(message.timestamp)) .fontSize(10) .fontColor($r('app.color.text_secondary')) .alignSelf(ItemAlign.Start) } .alignItems(HorizontalAlign.Start) .layoutWeight(1) } .width('100%') .alignItems(VerticalAlign.Top) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L219-L266
9bac9a677f4699b23dfc85a17f15f694bdc34539
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
窗口阶段创建时调用。 @param windowStage 创建的窗口阶段
async onWindowStageCreate(windowStage: window.WindowStage) { // AlarmClock 窗口已创建,为该能力设置主页面 let globalDisplay: display.Display = display.getDefaultDisplaySync(); // 在全局上下文中设置全局对象实例 GlobalContext.getContext().setObject('globalDisplay', globalDisplay); let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; // 配置偏好设置处理器 await preference.configure(this.context.getApplicationContext()); // 加载主页面的内容 windowStage.loadContent('pages/MainPage', (err, data) => { if (err.code) { // 加载内容失败时记录错误日志 hilog.error(0x0000, 'testTag', '加载内容失败。原因:%{public}s', JSON.stringify(err) ?? ''); return; } // 加载内容成功时记录信息日志 hilog.info(0x0000, 'testTag', '加载内容成功。数据:%{public}s', JSON.stringify(data) ?? ''); }); }
AST#method_declaration#Left async onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // AlarmClock 窗口已创建,为该能力设置主页面 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left globalDisplay : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display 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 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 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 GlobalContext 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 . setObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'globalDisplay' AST#expression#Right , AST#expression#Left globalDisplay 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 preference = AST#expression#Left AST#as_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 GlobalContext 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 . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preference' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PreferencesHandler 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 AST#await_expression#Left await AST#expression#Left preference AST#expression#Right AST#await_expression#Right AST#expression#Right . configure 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#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_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 ) 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 windowStage AST#expression#Right . loadContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'pages/MainPage' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code 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 hilog AST#expression#Right . error 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 '加载内容失败。原因:%{public}s' AST#expression#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 JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#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#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 '加载内容成功。数据:%{public}s' AST#expression#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 JSON 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#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#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
async onWindowStageCreate(windowStage: window.WindowStage) { let globalDisplay: display.Display = display.getDefaultDisplaySync(); GlobalContext.getContext().setObject('globalDisplay', globalDisplay); let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; await preference.configure(this.context.getApplicationContext()); windowStage.loadContent('pages/MainPage', (err, data) => { if (err.code) { hilog.error(0x0000, 'testTag', '加载内容失败。原因:%{public}s', JSON.stringify(err) ?? ''); return; } hilog.info(0x0000, 'testTag', '加载内容成功。数据:%{public}s', JSON.stringify(data) ?? ''); }); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/entryability/EntryAbility.ets#L22-L41
b6a71c83b9d0b98a3bd301d51b7e188d20008533
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
Defines the state of router. @interface RouterState @syscap SystemCapability.ArkUI.ArkUI.Full @since 3 @deprecated since 8 @useinstead ohos.router#RouterState
export interface RouterState { /** * Index of the current page in the stack. * NOTE: The index starts from 1 from the bottom to the top of the stack. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ index: number; /** * Name of the current page, that is, the file name. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ name: string; /** * Path of the current page. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ path: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RouterState AST#object_type#Left { /** * Index of the current page in the stack. * NOTE: The index starts from 1 from the bottom to the top of the stack. * * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ AST#type_member#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Name of the current page, that is, the file name. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Path of the current page. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ AST#type_member#Left path : 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 RouterState { index: number; name: string; path: string; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L100-L131
7f7b69829bf185642a0cbebd113117b1f619cbe9
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/DeviceManagement/Vibrator/CustomHaptic/entry/src/main/ets/module/ImageData.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, 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 ImagesData { id ?: number src ?: Resource name ?: Resource vibratorFileL ?: string vibratorFileM ?: string vibratorFileH ?: string audioName ?: string }
AST#export_declaration#Left export AST#class_declaration#Left class ImagesData AST#class_body#Left { AST#property_declaration#Left id AST#ERROR#Left ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#ERROR#Left src ? : Resource name AST#ERROR#Right ? : AST#ERROR#Left Resource vibratorFileL ? : string vibratorFileM ? : string vibratorFileH ? : string audioName ? : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ImagesData { id ?: number src ?: Resource name ?: Resource vibratorFileL ?: string vibratorFileM ?: string vibratorFileH ?: string audioName ?: string }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/DeviceManagement/Vibrator/CustomHaptic/entry/src/main/ets/module/ImageData.ets#L16-L24
862a38ccc66e61e497bca2f3e7ba46d7a13bf929
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets
arkts
onChange
输入内容变化时的回调函数 @param onChange StringCalBack = (content: string) => void @returns
onChange(onChange: StringCallback) { this.builderOptions.onChange = onChange; return this }
AST#method_declaration#Left onChange AST#parameter_list#Left ( AST#parameter#Left onChange : AST#type_annotation#Left AST#primary_type#Left StringCallback 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . onChange AST#member_expression#Right = AST#expression#Left onChange 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
onChange(onChange: StringCallback) { this.builderOptions.onChange = onChange; return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseInputBuilderProxy.ets#L69-L72
05474fc416552b8b01a9ae439c8e52daf9dd5710
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
offApplicationStateChange
取消对应用前后台切换事件的监听。使用callback异步回调。仅支持主线程调用。 @param callback 回调函数。取值可以为使用ApplicationContext.on('applicationStateChange')方法定义的callback回调,也可以为空。 如果传入已定义的回调,则取消该监听。如果未传入参数,则取消当前应用对所有前后台切换事件的监听。
static offApplicationStateChange(callback?: ApplicationStateChangeCallback) { AppUtil.getApplicationContext().off('applicationStateChange', callback); }
AST#method_declaration#Left static offApplicationStateChange AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left ApplicationStateChangeCallback 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil 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 . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'applicationStateChange' AST#expression#Right , AST#expression#Left callback 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 offApplicationStateChange(callback?: ApplicationStateChangeCallback) { AppUtil.getApplicationContext().off('applicationStateChange', callback); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L274-L276
5ab41a5b970728ea4dd96b5c5424750fa946bb73
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildStatsOverview
数据概览卡片
@Builder buildStatsOverview() { Column({ space: 16 }) { Row() { Text('数据概览') .fontSize(this.getFontSize(18)) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('查看详情') .fontSize(this.getFontSize(14)) .fontColor(this.COLORS.primary) .onClick(() => { this.currentTab = 1; // 跳转到联系人页面 }) } .width('100%') // 统计卡片网格 Column({ space: 12 }) { // 第一行 Row({ space: 12 }) { this.buildStatCard('🎂', this.birthdayStats.total.toString(), '总联系人', this.COLORS.redPrimary) this.buildStatCard('🎉', this.birthdayStats.today.toString(), '今日生日', this.COLORS.orangePrimary) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) // 第二行 Row({ space: 12 }) { this.buildStatCard('📅', this.birthdayStats.thisWeek.toString(), '本周生日', this.COLORS.greenPrimary) this.buildStatCard('📆', this.birthdayStats.thisMonth.toString(), '本月生日', this.COLORS.primary) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) // 第三行 - 纪念日和代办事项 Row({ space: 12 }) { this.buildStatCard('🎯', this.anniversaries.length.toString(), '纪念日', this.COLORS.orangePrimary) this.buildStatCard('📝', this.todos.length.toString(), '代办事项', this.COLORS.purplePrimary) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) } } .width('100%') .padding(20) .backgroundColor(this.COLORS.whitePrimary) .borderRadius(16) .shadow({ radius: 8, color: 'rgba(0,0,0,0.08)', offsetX: 0, offsetY: 2 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStatsOverview AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 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 Text ( AST#expression#Left '数据概览' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFontSize AST#member_expression#Right 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#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textPrimary 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#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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 14 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary 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 { 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 . currentTab 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#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#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 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '🎂' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayStats AST#member_expression#Right AST#expression#Right . total 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#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . redPrimary 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '🎉' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayStats AST#member_expression#Right AST#expression#Right . today 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#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . orangePrimary AST#member_expression#Right 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#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '📅' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayStats AST#member_expression#Right AST#expression#Right . thisWeek 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#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . greenPrimary 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '📆' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . birthdayStats AST#member_expression#Right AST#expression#Right . thisMonth 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#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right 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#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween 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 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '🎯' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . anniversaries AST#member_expression#Right AST#expression#Right . length 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#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . orangePrimary 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '📝' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . todos AST#member_expression#Right AST#expression#Right . length 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#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . purplePrimary AST#member_expression#Right 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#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween 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#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 20 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 this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . whitePrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 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 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.08)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 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#builder_function_body#Right AST#method_declaration#Right
@Builder buildStatsOverview() { Column({ space: 16 }) { Row() { Text('数据概览') .fontSize(this.getFontSize(18)) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .layoutWeight(1) Text('查看详情') .fontSize(this.getFontSize(14)) .fontColor(this.COLORS.primary) .onClick(() => { this.currentTab = 1; }) } .width('100%') Column({ space: 12 }) { Row({ space: 12 }) { this.buildStatCard('🎂', this.birthdayStats.total.toString(), '总联系人', this.COLORS.redPrimary) this.buildStatCard('🎉', this.birthdayStats.today.toString(), '今日生日', this.COLORS.orangePrimary) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) Row({ space: 12 }) { this.buildStatCard('📅', this.birthdayStats.thisWeek.toString(), '本周生日', this.COLORS.greenPrimary) this.buildStatCard('📆', this.birthdayStats.thisMonth.toString(), '本月生日', this.COLORS.primary) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) Row({ space: 12 }) { this.buildStatCard('🎯', this.anniversaries.length.toString(), '纪念日', this.COLORS.orangePrimary) this.buildStatCard('📝', this.todos.length.toString(), '代办事项', this.COLORS.purplePrimary) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) } } .width('100%') .padding(20) .backgroundColor(this.COLORS.whitePrimary) .borderRadius(16) .shadow({ radius: 8, color: 'rgba(0,0,0,0.08)', offsetX: 0, offsetY: 2 }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1349-L1405
953002003eb5e98a611ba700971ea3958a3e10b8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TempUtil.ets
arkts
C2F
摄氏度转华氏度 @param c 摄氏度 @return 华氏度
static C2F(c: number): number { return c * (9 / 5) + 32 }
AST#method_declaration#Left static C2F AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left c AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 9 AST#expression#Right / AST#expression#Left 5 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 32 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static C2F(c: number): number { return c * (9 / 5) + 32 }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TempUtil.ets#L30-L32
f928d104bfe954da285fbbf4d582ccf8811c8509
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets
arkts
notifyDataAdd
Notify the LazyForEach component to add a child component at the index corresponding to the specified index.
notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) }
AST#method_declaration#Left notifyDataAdd 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 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 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#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 listener AST#expression#Right . onDataAdd 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#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
notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L52-L56
e2eea677e2d2cd55cf0da59b12c60e0b266fa691
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
getSelectFormat
获取当前选中的输出格式 @returns selectFormat 格式名
getSelectFormat(): string { let selectFormat: string = ''; switch (this.outputFormatIndex) { case 0: // 原格式 selectFormat = this.beforeCompressFmt; break; case 1: // PNG selectFormat = 'png';
AST#method_declaration#Left getSelectFormat AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left selectFormat : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' 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 switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . outputFormatIndex 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Left 0 AST#ERROR#Right : // 原格式 AST#expression#Left AST#assignment_expression#Left selectFormat = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beforeCompressFmt AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 1 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : // PNG AST#type_annotation#Left AST#primary_type#Left selectFormat AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = 'png' AST#ERROR#Right ; AST#method_declaration#Right
getSelectFormat(): string { let selectFormat: string = ''; switch (this.outputFormatIndex) { case 0: selectFormat = this.beforeCompressFmt; break; case 1: selectFormat = 'png';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L466-L473
bfc29201f0b3f1ada61eec53f25d1dfa0e28d366
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhToast.ets
arkts
showInfo
/ 警告弹框
public static showInfo(loadingText: ResourceStr) { JhToast._showToast(loadingText, _ToastType.info) }
AST#method_declaration#Left public static showInfo AST#parameter_list#Left ( AST#parameter#Left loadingText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 JhToast AST#expression#Right . _showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left loadingText AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left _ToastType AST#expression#Right . info 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
public static showInfo(loadingText: ResourceStr) { JhToast._showToast(loadingText, _ToastType.info) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L59-L61
3154f4590365f1de1fb64a9e8ace0f222bfe63e2
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
buildBirthdayTab
构建生日分析标签页
@Builder buildBirthdayTab(birthday: BirthdayStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { // 月份分布图 Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('月份分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) // 简化的月份分布展示 Grid() { ForEach(birthday.monthlyDistribution, (item, index) => { GridItem() { Column({ space: 4 }) { Text(item.count.toString()) .fontSize(UIConstants.FONT_SIZE_SUBHEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.primary')) Text(`${item.month}月`) .fontSize(UIConstants.FONT_SIZE_CAPTION) .fontColor($r('app.color.text_secondary')) Progress({ value: item.percentage, total: 100, type: ProgressType.Linear }) .width('100%') .height(4) .color($r('app.color.primary')) .backgroundColor($r('app.color.divider')) } .width('100%') .alignItems(HorizontalAlign.Center) } }) } .columnsTemplate('1fr 1fr 1fr') .rowsTemplate('1fr 1fr 1fr 1fr') .columnsGap(UIConstants.SMALL_PADDING) .rowsGap(UIConstants.SMALL_PADDING) .width('100%') .height(200) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } // 年龄分布 if (birthday.ageDistribution.length > 0) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('年龄分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) ForEach(birthday.ageDistribution, (item) => { Row() { Text(item.ageGroup) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .width(60) Progress({ value: item.percentage, total: 100, type: ProgressType.Linear }) .width('100%') .height(8) .color($r('app.color.accent')) .backgroundColor($r('app.color.divider')) .layoutWeight(1) Text(`${item.count}人`) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_secondary')) .width(50) .textAlign(TextAlign.End) } .width('100%') .alignItems(VerticalAlign.Center) }) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } } // 即将到来的生日 if (birthday.upcomingList.length > 0) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('即将到来的生日') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) ForEach(birthday.upcomingList.slice(0, 5), (item) => { Row() { Column() { Text(item.contact.name) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) if (item.contact.relation) { Text(item.contact.relation) .fontSize(UIConstants.FONT_SIZE_CAPTION) .fontColor($r('app.color.text_secondary')) } } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Text(item.daysUntil === 0 ? '今天' : `${item.daysUntil}天后`) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor(item.daysUntil === 0 ? $r('app.color.error') : $r('app.color.primary')) .fontWeight(item.daysUntil === 0 ? FontWeight.Medium : FontWeight.Normal) } .width('100%') .padding(UIConstants.SMALL_PADDING) .backgroundColor(item.daysUntil === 0 ? $r('app.color.error_background') : Color.Transparent) .borderRadius(UIConstants.BORDER_RADIUS) }) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } } } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } .width('100%') .height('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayTab AST#parameter_list#Left ( AST#parameter#Left birthday : AST#type_annotation#Left AST#primary_type#Left BirthdayStats 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 Scroll ( ) 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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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 Card ( ) 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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_HEADING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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#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 Grid ( ) 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 birthday AST#expression#Right . monthlyDistribution AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right , AST#parameter#Left index 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . count 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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_SUBHEADING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_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#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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . month 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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_CAPTION AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' 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 Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . percentage AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left 100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ProgressType AST#expression#Right . Linear 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 '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( 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#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.divider' 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#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 . 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#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#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 . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . rowsTemplate ( AST#expression#Left '1fr 1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . SMALL_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . SMALL_PADDING 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 200 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left birthday AST#expression#Right . ageDistribution AST#member_expression#Right 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( ) 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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_HEADING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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#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#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left birthday AST#expression#Right . ageDistribution AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item 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 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#member_expression#Left AST#expression#Left item AST#expression#Right . ageGroup AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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 . width ( AST#expression#Left 60 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 Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . percentage AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left 100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ProgressType AST#expression#Right . Linear 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 '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.accent' 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.divider' 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#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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . count 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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left birthday AST#expression#Right . upcomingList AST#member_expression#Right 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( ) 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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_HEADING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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#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#for_each_statement#Left ForEach ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left birthday AST#expression#Right . upcomingList AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item 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 Row ( ) 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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . contact AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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 . 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#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#member_expression#Left AST#expression#Left item AST#expression#Right . contact AST#member_expression#Right AST#expression#Right . relation 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 AST#member_expression#Left AST#expression#Left item AST#expression#Right . contact AST#member_expression#Right AST#expression#Right . relation AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_CAPTION AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' 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#ui_if_statement#Right AST#ui_control_flow#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . daysUntil AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '今天' AST#expression#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 . daysUntil AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 天后 ` AST#template_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . daysUntil AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.error' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : 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#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . daysUntil AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium 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#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 AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . SMALL_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . daysUntil AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.error_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . BORDER_RADIUS 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#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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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#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 '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING 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 '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 } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildBirthdayTab(birthday: BirthdayStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('月份分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) Grid() { ForEach(birthday.monthlyDistribution, (item, index) => { GridItem() { Column({ space: 4 }) { Text(item.count.toString()) .fontSize(UIConstants.FONT_SIZE_SUBHEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.primary')) Text(`${item.month}月`) .fontSize(UIConstants.FONT_SIZE_CAPTION) .fontColor($r('app.color.text_secondary')) Progress({ value: item.percentage, total: 100, type: ProgressType.Linear }) .width('100%') .height(4) .color($r('app.color.primary')) .backgroundColor($r('app.color.divider')) } .width('100%') .alignItems(HorizontalAlign.Center) } }) } .columnsTemplate('1fr 1fr 1fr') .rowsTemplate('1fr 1fr 1fr 1fr') .columnsGap(UIConstants.SMALL_PADDING) .rowsGap(UIConstants.SMALL_PADDING) .width('100%') .height(200) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } if (birthday.ageDistribution.length > 0) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('年龄分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) ForEach(birthday.ageDistribution, (item) => { Row() { Text(item.ageGroup) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .width(60) Progress({ value: item.percentage, total: 100, type: ProgressType.Linear }) .width('100%') .height(8) .color($r('app.color.accent')) .backgroundColor($r('app.color.divider')) .layoutWeight(1) Text(`${item.count}人`) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_secondary')) .width(50) .textAlign(TextAlign.End) } .width('100%') .alignItems(VerticalAlign.Center) }) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } } if (birthday.upcomingList.length > 0) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('即将到来的生日') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) ForEach(birthday.upcomingList.slice(0, 5), (item) => { Row() { Column() { Text(item.contact.name) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) if (item.contact.relation) { Text(item.contact.relation) .fontSize(UIConstants.FONT_SIZE_CAPTION) .fontColor($r('app.color.text_secondary')) } } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Text(item.daysUntil === 0 ? '今天' : `${item.daysUntil}天后`) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor(item.daysUntil === 0 ? $r('app.color.error') : $r('app.color.primary')) .fontWeight(item.daysUntil === 0 ? FontWeight.Medium : FontWeight.Normal) } .width('100%') .padding(UIConstants.SMALL_PADDING) .backgroundColor(item.daysUntil === 0 ? $r('app.color.error_background') : Color.Transparent) .borderRadius(UIConstants.BORDER_RADIUS) }) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } } } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } .width('100%') .height('100%') }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/analytics/AnalyticsPage.ets#L277-L419
01836c8309a043ca2c56098d563928c67c7a4bb7
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/common/FeedbackService.ets
arkts
showResultDialog
显示操作结果对话框
async showResultDialog( title: string, message: string, isSuccess: boolean, actions?: Array<FeedbackAction> ): Promise<void> { const icon = isSuccess ? '✅' : '❌'; const defaultActions: FeedbackAction[] = [{ text: '确定', callback: () => {} }]; const dialogActions = actions || defaultActions; promptAction.showDialog({ title: `${icon} ${title}`, message, buttons: [{ text: dialogActions[0].text, color: isSuccess ? '#4CAF50' : '#F44336' }] }); }
AST#method_declaration#Left async showResultDialog 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#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 isSuccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left actions ? : 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 FeedbackAction 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 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 icon = AST#expression#Left AST#conditional_expression#Left AST#expression#Left isSuccess AST#expression#Right ? AST#expression#Left '✅' AST#expression#Right : AST#expression#Left '❌' AST#expression#Right AST#conditional_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 defaultActions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FeedbackAction [ ] AST#array_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 text AST#property_name#Right : AST#expression#Left '确定' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left callback AST#property_name#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_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 const AST#variable_declarator#Left dialogActions = AST#expression#Left AST#binary_expression#Left AST#expression#Left actions AST#expression#Right || AST#expression#Left defaultActions 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 promptAction AST#expression#Right . showDialog 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 title AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left icon AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left title AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left message AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left buttons 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 text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left dialogActions AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . text 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#conditional_expression#Left AST#expression#Left isSuccess AST#expression#Right ? AST#expression#Left '#4CAF50' AST#expression#Right : AST#expression#Left '#F44336' AST#expression#Right AST#conditional_expression#Right 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 } 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#method_declaration#Right
async showResultDialog( title: string, message: string, isSuccess: boolean, actions?: Array<FeedbackAction> ): Promise<void> { const icon = isSuccess ? '✅' : '❌'; const defaultActions: FeedbackAction[] = [{ text: '确定', callback: () => {} }]; const dialogActions = actions || defaultActions; promptAction.showDialog({ title: `${icon} ${title}`, message, buttons: [{ text: dialogActions[0].text, color: isSuccess ? '#4CAF50' : '#F44336' }] }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/FeedbackService.ets#L170-L192
13d030a7cda80973396c4588056c92df98966fad
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/GifCreateView.ets
arkts
this
开始生成gif文件
this.createGif(this.srcFilePath, this.startTime, this.endTime);
AST#method_declaration#Left this AST#ERROR#Left . createG if AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . srcFilePath AST#ERROR#Right , AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . startTime AST#ERROR#Right , AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . endTime AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
this.createGif(this.srcFilePath, this.startTime, this.endTime);
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/GifCreateView.ets#L53-L53
f7174cd593142bedb1c22cf91824bc19fa604a53
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/PreferencesService.ets
arkts
getString
获取字符串值 @param key 键 @param defaultValue 默认值 @returns 字符串值
async getString(key: string, defaultValue: string = ''): Promise<string> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as string; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get string: ${businessError.message}`); return defaultValue; } }
AST#method_declaration#Left async getString AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : 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_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#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 this AST#expression#Right . checkInitialized 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#return_statement#Left return AST#expression#Left AST#as_expression#Left 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 . dataPreferences AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left defaultValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#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#variable_declaration#Left const AST#variable_declarator#Left businessError = AST#expression#Left AST#as_expression#Left AST#expression#Left error 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 hilog 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 LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to get string: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError 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 defaultValue 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 getString(key: string, defaultValue: string = ''): Promise<string> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as string; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get string: ${businessError.message}`); return defaultValue; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L82-L91
86d196bbafc54444722c13ac2057ea6fb43d9462
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
getLabelXOffset
returns the horizontal offset of the y-label
public getLabelXOffset(): number { return this.mXLabelOffset; }
AST#method_declaration#Left public getLabelXOffset 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 . mXLabelOffset AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getLabelXOffset(): number { return this.mXLabelOffset; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L190-L192
e09aa7c8f5a6febf3b288a94bc0a9073caee237f
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
off
Destroy event. @param { type } event Registered Events. @param { callback }. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Destroy event. @param { type } event Registered Events. @param { callback }. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void;
AST#method_declaration#Left off AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left callbackParam : AST#type_annotation#Left AST#primary_type#Left CallbackParam 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L174-L174
d1eb006a798e30a1e05f79f8a017a2d1035c6c1f
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/ArkState.ets
arkts
AbstractProperty is an alias to the referenced storage property.
export interface AbstractProperty<T> { /** * @returns the name of the referenced storage property */ info(): string /** * @returns the value of the referenced storage property */ get(): T /** * Updates the value of the referenced storage property. * @param newValue - new value for the referenced storage property */ set(newValue: T): void }
AST#export_declaration#Left export AST#interface_declaration#Left interface AbstractProperty AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { /** * @returns the name of the referenced storage property */ AST#type_member#Left info 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#type_member#Right /** * @returns the value of the referenced storage property */ AST#type_member#Left get AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /** * Updates the value of the referenced storage property. * @param newValue - new value for the referenced storage property */ AST#type_member#Left set AST#parameter_list#Left ( AST#parameter#Left newValue : AST#type_annotation#Left AST#primary_type#Left T 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#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface AbstractProperty<T> { info(): string get(): T set(newValue: T): void }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/ArkState.ets#L21-L35
09a84803adc2449abfdd7b3debc2ca135b956cc9
gitee
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets
arkts
Lattice is the class for dividing an image into grids. @syscap SystemCapability.Graphics.Drawing @since 12
export class Lattice { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
AST#export_declaration#Left export AST#class_declaration#Left class Lattice AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Lattice { static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L984-L985
9c03fcbe7d00cb181cd2b9d82949c42089377ac4
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/common/BillData.ets
arkts
getAllBills
获取所有账单
static async getAllBills(): Promise<BillItem[]> { try { const data = AppStorage.Get<string>(BillDataManager.STORAGE_KEY); console.info('BillDataManager: 读取数据:', data); if (data) { const bills: BillItem[] = JSON.parse(data as string) as BillItem[]; console.info('BillDataManager: 解析后账单数量:', bills.length); return bills; } console.info('BillDataManager: 没有数据,返回空数组'); return []; } catch (err) { console.error('获取账单失败:', err); return []; } }
AST#method_declaration#Left static async getAllBills AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left BillItem [ ] AST#array_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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . Get 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#member_expression#Left AST#expression#Left BillDataManager AST#expression#Right . STORAGE_KEY 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'BillDataManager: 读取数据:' AST#expression#Right , AST#expression#Left data 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 data AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#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#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left data AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as 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#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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'BillDataManager: 解析后账单数量:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left bills 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#return_statement#Left return AST#expression#Left bills 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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'BillDataManager: 没有数据,返回空数组' 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#Left catch ( err ) 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 '获取账单失败:' AST#expression#Right , AST#expression#Left err 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 getAllBills(): Promise<BillItem[]> { try { const data = AppStorage.Get<string>(BillDataManager.STORAGE_KEY); console.info('BillDataManager: 读取数据:', data); if (data) { const bills: BillItem[] = JSON.parse(data as string) as BillItem[]; console.info('BillDataManager: 解析后账单数量:', bills.length); return bills; } console.info('BillDataManager: 没有数据,返回空数组'); return []; } catch (err) { console.error('获取账单失败:', err); return []; } }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/BillData.ets#L40-L55
f5dce3b9a694ba030c8db7a23b33586aa4259021
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
bootloaderVersion
Bootloader版本号
static bootloaderVersion(): string { return deviceInfo.bootloaderVersion }
AST#method_declaration#Left static bootloaderVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left deviceInfo AST#expression#Right . bootloaderVersion AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static bootloaderVersion(): string { return deviceInfo.bootloaderVersion }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L92-L94
e12473ff32c011558ab20d490fbc5d5e88ec8735
gitee