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
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/Constraint.ets
arkts
string类型Callback
export declare type StringCallback = (content: string, dialogId: string) => void;
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type StringCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dialogId : 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#type_declaration#Right AST#export_declaration#Right
export declare type StringCallback = (content: string, dialogId: string) => void;
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/Constraint.ets#L5-L5
ebdccea3f1fdc2d140dc964834d3b0bf34f214da
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
bufferToUint8Array
ArrayBuffer转Uint8Array @param str @returns
static bufferToUint8Array(src: ArrayBuffer): Uint8Array { return new Uint8Array(src); }
AST#method_declaration#Left static bufferToUint8Array AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array 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#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 src 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 bufferToUint8Array(src: ArrayBuffer): Uint8Array { return new Uint8Array(src); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L358-L360
ed67eed05303a4a4209494945b591c9a19732925
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/components/common/EmptyView.ets
arkts
NetworkErrorView
网络错误状态组件
@Component export struct NetworkErrorView { onRetry?: () => void; build() { EmptyView({ message: '网络连接异常', description: '请检查网络设置后重试', icon: $r('app.media.ic_network_error'), showAction: true, actionText: '重试', onAction: this.onRetry }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NetworkErrorView AST#component_body#Left { AST#property_declaration#Left onRetry ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left EmptyView ( AST#component_parameters#Left { AST#component_parameter#Left message : AST#expression#Left '网络连接异常' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left description : AST#expression#Left '请检查网络设置后重试' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left icon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_network_error' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showAction : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left actionText : AST#expression#Left '重试' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onAction : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRetry AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct NetworkErrorView { onRetry?: () => void; build() { EmptyView({ message: '网络连接异常', description: '请检查网络设置后重试', icon: $r('app.media.ic_network_error'), showAction: true, actionText: '重试', onAction: this.onRetry }) } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/EmptyView.ets#L151-L165
9fd5778d8be9e74f2e9bacaefb7287d884f7bf64
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
sendMessageToRemoteService
连接成功后发送消息
async function sendMessageToRemoteService() { console.log('[handle]connectRemoteService sendMessageToRemoteService:') if (mRemote == null) { console.log('[handle]connectRemoteService mRemote == null') prompt.showToast({ message: "mRemote is null" }); return; } let option = new rpc.MessageOption(); let data = new rpc.MessageParcel(); let reply = new rpc.MessageParcel(); data.writeInt(actionType); data.writeInt(angle); await mRemote.sendRequest(1, data, reply, option); let msg = reply.readInt(); console.log('[handle]connectRemoteService msg:' + msg) }
AST#function_declaration#Left async function sendMessageToRemoteService 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 . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[handle]connectRemoteService sendMessageToRemoteService:' 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 mRemote 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#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 '[handle]connectRemoteService mRemote == null' 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 prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left "mRemote is null" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left option = 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 rpc AST#expression#Right AST#new_expression#Right AST#expression#Right . MessageOption AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left rpc AST#expression#Right AST#new_expression#Right AST#expression#Right . MessageParcel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left reply = 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 rpc AST#expression#Right AST#new_expression#Right AST#expression#Right . MessageParcel 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 data AST#expression#Right . writeInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left actionType 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 data AST#expression#Right . writeInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left angle AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 mRemote AST#expression#Right AST#await_expression#Right AST#expression#Right . sendRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left data AST#expression#Right , AST#expression#Left reply AST#expression#Right , AST#expression#Left option 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 msg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reply AST#expression#Right . readInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '[handle]connectRemoteService msg:' AST#expression#Right + AST#expression#Left msg 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
async function sendMessageToRemoteService() { console.log('[handle]connectRemoteService sendMessageToRemoteService:') if (mRemote == null) { console.log('[handle]connectRemoteService mRemote == null') prompt.showToast({ message: "mRemote is null" }); return; } let option = new rpc.MessageOption(); let data = new rpc.MessageParcel(); let reply = new rpc.MessageParcel(); data.writeInt(actionType); data.writeInt(angle); await mRemote.sendRequest(1, data, reply, option); let msg = reply.readInt(); console.log('[handle]connectRemoteService msg:' + msg) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L48-L65
cc0a3633dd2b4288eaaa2db06e780cac366ea1e5
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
arkts
executeRequest
发起请求 @returns {void} 无返回值
executeRequest(): void { RequestHelper.repository<T>(this.requestRepository()) .toast(this.showErrorToast) .start(() => this.onRequestStart()) .execute() .then((data: T) => this.onRequestSuccess(data)) .catch(() => this.onRequestError()); }
AST#method_declaration#Left executeRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . requestRepository 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 . toast 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 . showErrorToast AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRequestStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRequestSuccess 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#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_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onRequestError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#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
executeRequest(): void { RequestHelper.repository<T>(this.requestRepository()) .toast(this.showErrorToast) .start(() => this.onRequestStart()) .execute() .then((data: T) => this.onRequestSuccess(data)) .catch(() => this.onRequestError()); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L47-L54
c4b5b1cbbf4338113ea8dd0b3c641a4f288d41b6
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AppUtils.ets
arkts
getTargetVersion
获取应用运行目标版本。
static getTargetVersion(): number { return AppUtils.getBundleInfoSync().targetVersion }
AST#method_declaration#Left static getTargetVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtils AST#expression#Right . getBundleInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . targetVersion AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getTargetVersion(): number { return AppUtils.getBundleInfoSync().targetVersion }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L135-L137
4dcacaf4e5432d2ab6c7930820b92d773211cc3b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ResUtil.ets
arkts
getRawFileContentStr
获取resources/rawfile目录下对应的rawfile文件内容 @param path rawfile文件路径 @returns
static async getRawFileContentStr(path: string): Promise<string> { let uint8Array = await ResUtil.getRawFileContent(path); return StrUtil.unit8ArrayToStr(uint8Array); }
AST#method_declaration#Left static async getRawFileContentStr AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 uint8Array = 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 ResUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getRawFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrUtil AST#expression#Right . unit8ArrayToStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uint8Array 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 getRawFileContentStr(path: string): Promise<string> { let uint8Array = await ResUtil.getRawFileContent(path); return StrUtil.unit8ArrayToStr(uint8Array); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L456-L459
cd696c42aac17702136b5ba1444cc42ceb365533
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/CropSquareTransformation.ets
arkts
CropSquareTransformation
图片变换:正方形裁剪效果
@Sendable export class CropSquareTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let imageInfo: image.ImageInfo = await toTransform.getImageInfo(); let size: Size = { width: imageInfo.size.width, height: imageInfo.size.height }; if (!size) { console.error('CropSquareTransformation The image size does not exist.'); return toTransform; } let pixelMapWidth: number = size.width; let pixelMapHeight: number = size.height; let targetSize: number = pixelMapWidth > pixelMapHeight ? pixelMapHeight : pixelMapWidth; let region: image.Region = { size: { width: targetSize, height: targetSize }, x: pixelMapWidth / 2 - targetSize / 2, y: pixelMapHeight / 2 - targetSize / 2 }; await toTransform.crop(region); return toTransform; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class CropSquareTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { 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#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left async transform AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toTransform : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PixelMap 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 imageInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left toTransform AST#expression#Right AST#await_expression#Right AST#expression#Right . getImageInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left size : AST#type_annotation#Left AST#primary_type#Left Size 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 imageInfo 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 imageInfo 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left size 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'CropSquareTransformation The image size does not exist.' 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 toTransform 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#variable_declaration#Left let AST#variable_declarator#Left pixelMapWidth : 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 size AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pixelMapHeight : 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 size AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left let targetSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left pixelMapWidth AST#expression#Right > AST#expression#Left pixelMapHeight AST#expression#Right AST#binary_expression#Right AST#expression#Right ? pixelMapHeight : AST#type_annotation#Left AST#primary_type#Left pixelMapWidth AST#primary_type#Right AST#type_annotation#Right ; AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left region : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Region 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 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 targetSize AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left targetSize 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 x AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left pixelMapWidth 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 targetSize AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left pixelMapHeight 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 targetSize AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_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#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 toTransform AST#expression#Right AST#await_expression#Right AST#expression#Right . crop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left region 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 toTransform AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@Sendable export class CropSquareTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let imageInfo: image.ImageInfo = await toTransform.getImageInfo(); let size: Size = { width: imageInfo.size.width, height: imageInfo.size.height }; if (!size) { console.error('CropSquareTransformation The image size does not exist.'); return toTransform; } let pixelMapWidth: number = size.width; let pixelMapHeight: number = size.height; let targetSize: number = pixelMapWidth > pixelMapHeight ? pixelMapHeight : pixelMapWidth; let region: image.Region = { size: { width: targetSize, height: targetSize }, x: pixelMapWidth / 2 - targetSize / 2, y: pixelMapHeight / 2 - targetSize / 2 }; await toTransform.crop(region); return toTransform; } }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/CropSquareTransformation.ets#L22-L49
40b5b03210a280f103eb066a78ca217401513df7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/DialogOptions.ets
arkts
ActionSheet参数类
export class ActionSheetOptions extends DialogOptions { sheets: Array<SheetInfo | ResourceStr> = []; //title-选项的文本内容、icon-选项的图标、action-选项选中的回调。 confirm?: SheetConfirm | ResourceStr; }
AST#export_declaration#Left export AST#class_declaration#Left class ActionSheetOptions extends AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left sheets : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SheetInfo AST#primary_type#Right | AST#primary_type#Left ResourceStr 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#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right //title-选项的文本内容、icon-选项的图标、action-选项选中的回调。 AST#property_declaration#Left confirm ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SheetConfirm AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ActionSheetOptions extends DialogOptions { sheets: Array<SheetInfo | ResourceStr> = []; confirm?: SheetConfirm | ResourceStr; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/DialogOptions.ets#L92-L95
9dfd21d67fa06f3a8e5eb5be819d95500aa43c10
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/models/ThemeModel.ets
arkts
resetToDefault
重置为默认主题
async resetToDefault(): Promise<boolean> { return await this.setCurrentTheme(ThemeType.MINIMAL); }
AST#method_declaration#Left async resetToDefault AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . setCurrentTheme AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ThemeType AST#expression#Right . MINIMAL 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#method_declaration#Right
async resetToDefault(): Promise<boolean> { return await this.setCurrentTheme(ThemeType.MINIMAL); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/models/ThemeModel.ets#L292-L294
6bb91a637db4686aefb57ed5b4f61a736d3d663e
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
addImageCollapse
NodeInfo add collapse image @param isHasChildNode whether node has child node
addImageCollapse(isHasChildNode: boolean): void { if (isHasChildNode) { this.nodeItemView.imageCollapse = CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_RIGHT); } else { this.nodeItemView.imageCollapse = undefined; } }
AST#method_declaration#Left addImageCollapse AST#parameter_list#Left ( AST#parameter#Left isHasChildNode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left isHasChildNode AST#expression#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 . nodeItemView AST#member_expression#Right AST#expression#Right . imageCollapse AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CollapseImageNodeFlyweightFactory AST#expression#Right . getCollapseImageNodeByType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CollapseImageType AST#expression#Right . ARROW_RIGHT 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 } else { 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 . nodeItemView AST#member_expression#Right AST#expression#Right . imageCollapse AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
addImageCollapse(isHasChildNode: boolean): void { if (isHasChildNode) { this.nodeItemView.imageCollapse = CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_RIGHT); } else { this.nodeItemView.imageCollapse = undefined; } }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L457-L464
2efa5fb1e592594c208fa105827ca827d5ebe33d
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
imageWatermark
图片添加水印 @param input 输入图片路径 @param watermark 水印图片路径 @param output 输出图片路径 @param position 位置:'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center'
public static imageWatermark( input: string, watermark: string, output: string, position: string = 'bottom-right' ): string[] { let overlay = ''; switch (position) { case 'top-left': overlay = '10:10'; break; case 'top-right': overlay = 'main_w-overlay_w-10:10';
AST#method_declaration#Left public static imageWatermark AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left watermark : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left position : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'bottom-right' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left overlay = 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 position 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#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left 'top-left' AST#property_name#Right : AST#expression#Left AST#assignment_expression#Left overlay = AST#expression#Left '10:10' 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 'top-right' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left overlay AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left = 'main_w-overlay_w-10:10' AST#ERROR#Right ; AST#method_declaration#Right
public static imageWatermark( input: string, watermark: string, output: string, position: string = 'bottom-right' ): string[] { let overlay = ''; switch (position) { case 'top-left': overlay = '10:10'; break; case 'top-right': overlay = 'main_w-overlay_w-10:10';
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L327-L339
ad973c4bdd42b82c8045c2fbb89cb22385db8551
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
dividedPieces
/ 获取划分好的pieces / 获取划分好的 pieces(完全等效于 Swift 原版逻辑)
private static dividedPieces( wordIds: number[], countPerDay: number, pieceCounts: PieceCount[] | null = null, isRepeatPieceCount: boolean = false ): Piece[] { // 将 words 分隔为 piece const pieces: Piece[] = []; let tempWordIds: number[] = [...wordIds]; // 剩余wordId,等效 Swift 中的 tempIds let i = 0; // 循环处理剩余wordIds while (tempWordIds.length > 0) { const pieceNo = i; /// 重复执行为 true 时,此后的所有 piece 也是和目标 day 的 pieceCount 一样的。 /// 当 dayOfs 由少变多时,新增加的 dayOfs 在 pieceCounts 中找不到值,这时用最后一个即可 const arrayCount = pieceCounts?.find(p => p.pieceNo === pieceNo)?.count ?? (isRepeatPieceCount ? pieceCounts?.[pieceCounts.length - 1]?.count ?? countPerDay : countPerDay); // 取前 arrayCount 个wordId作为当前 piece const pieceWordIds = tempWordIds.slice(0, arrayCount); // 更新剩余wordIds tempWordIds = tempWordIds.slice(arrayCount); const piece = new Piece(pieceNo, pieceWordIds); pieces.push(piece); i += 1; } return pieces; }
AST#method_declaration#Left private static dividedPieces AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left countPerDay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pieceCounts : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left PieceCount [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left isRepeatPieceCount : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Piece [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 将 words 分隔为 piece AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pieces : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Piece [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tempWordIds : 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#expression#Left wordIds AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 剩余wordId,等效 Swift 中的 tempIds AST#statement#Left 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#statement#Right // 循环处理剩余wordIds AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tempWordIds 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#variable_declaration#Left const AST#variable_declarator#Left pieceNo = AST#expression#Left i AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right /// 重复执行为 true 时,此后的所有 piece 也是和目标 day 的 pieceCount 一样的。 /// 当 dayOfs 由少变多时,新增加的 dayOfs 在 pieceCounts 中找不到值,这时用最后一个即可 AST#ERROR#Left const arrayCount = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pieceCounts AST#expression#Right ?. find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left p => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left p AST#expression#Right . pieceNo AST#member_expression#Right AST#expression#Right === AST#expression#Left pieceNo AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. count AST#member_expression#Right AST#expression#Right ?? ( AST#expression#Left isRepeatPieceCount AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left pieceCounts AST#expression#Right ?. [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pieceCounts 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#subscript_expression#Right AST#expression#Right ?. count AST#member_expression#Right AST#expression#Right ?? countPerDay : AST#type_annotation#Left AST#primary_type#Left countPerDay AST#primary_type#Right AST#type_annotation#Right ) ; AST#ERROR#Right // 取前 arrayCount 个wordId作为当前 piece AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pieceWordIds = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tempWordIds 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 arrayCount 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 // 更新剩余wordIds AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left tempWordIds = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tempWordIds AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left arrayCount 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 const AST#variable_declarator#Left piece = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Piece AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pieceNo AST#expression#Right , AST#expression#Left pieceWordIds 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 pieces AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left piece 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 i += 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#while_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left pieces AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private static dividedPieces( wordIds: number[], countPerDay: number, pieceCounts: PieceCount[] | null = null, isRepeatPieceCount: boolean = false ): Piece[] { const pieces: Piece[] = []; let tempWordIds: number[] = [...wordIds]; let i = 0; while (tempWordIds.length > 0) { const pieceNo = i; const arrayCount = pieceCounts?.find(p => p.pieceNo === pieceNo)?.count ?? (isRepeatPieceCount ? pieceCounts?.[pieceCounts.length - 1]?.count ?? countPerDay : countPerDay); const pieceWordIds = tempWordIds.slice(0, arrayCount); tempWordIds = tempWordIds.slice(arrayCount); const piece = new Piece(pieceNo, pieceWordIds); pieces.push(piece); i += 1; } return pieces; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L481-L515
bf063382ea41d38b41769db3cbb86324691529b2
github
zhangyuhang0914/ArkTs-HarmonyOs.git
c9773cad7ebeee413f98ee1a57cc8fba91fecf7d
entry/src/main/ets/components/StateComponent.ets
arkts
holdContent
占位组件
@Builder holdContent() { if (this.showSkeleton && this.viewState === ViewStateConstant.VIEW_STATE_LOADING) { CommonSkeleton() } else { Column() { LoadingProgress().width($r('app.float.size_36')).height($r('app.float.size_36')).color('#3598DB') // Image(this.convertImage()) // .width($r('app.float.size_28')) // .height($r('app.float.size_28')) Text(this.convertValue()) .fontSize($r('app.float.size_text_15')) .fontColor($r("app.color.color_666")) .margin($r('app.float.size_10')) .padding({ bottom: $r('app.float.size_70') }) if (this.viewState != ViewStateConstant.VIEW_STATE_LOADING) Button($r('app.string.press_retry')) .width($r('app.float.size_120')) .height($r('app.float.size_35')) .backgroundColor($r('app.color.color_main_background')) .fontColor($r('app.color.color_fff')) .onClick(() => { this.retryCallback?.() }) } .width('100%').height('100%').alignItems(HorizontalAlign.Center).justifyContent(FlexAlign.Center) } } /** * 转换图片 * @returns */ convertImage() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.media.loading') break case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.media.loading_error') break case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: return $r('app.media.network_error') break case ViewStateConstant.VIEW_STATE_EMPTY: return $r('app.media.empty') break default: return $r('app.media.loading') break } } /** * 转换文案 * @returns */ convertValue() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.string.loading') break case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.string.load_error') break case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: return $r('app.string.net_error') break case ViewStateConstant.VIEW_STATE_EMPTY: return $r('app.string.load_empty') break default: return $r('app.string.load_success') break } } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right holdContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 this AST#expression#Right . showSkeleton AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . viewState AST#member_expression#Right AST#expression#Right === AST#expression#Left ViewStateConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . VIEW_STATE_LOADING AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CommonSkeleton ( ) AST#ui_component#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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.size_36' 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.size_36' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#3598DB' 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 // Image(this.convertImage()) // .width($r('app.float.size_28')) // .height($r('app.float.size_28')) 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 . convertValue 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#resource_expression#Left $r ( AST#expression#Left 'app.float.size_text_15' 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.color_666" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.size_10' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.size_70' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left if ( 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 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewState AST#member_expression#Right AST#expression#Right != AST#expression#Left ViewStateConstant AST#expression#Right AST#binary_expression#Right AST#expression#Right . VIEW_STATE_LOADING AST#member_expression#Right AST#expression#Right AST#ERROR#Left ) Button AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.press_retry' 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 AST#resource_expression#Left $r ( AST#expression#Left 'app.float.size_120' AST#expression#Right ) AST#resource_expression#Right 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 AST#resource_expression#Left $r ( AST#expression#Left 'app.float.size_35' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.color_main_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.color_fff' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . retryCallback 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 } AST#ERROR#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '100%' 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 '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . alignItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#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 /** * 转换图片 * @returns */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left convertImage ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewState AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_LOADING AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.loading' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_ERROR AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.loading_error' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_NETWORK_ERROR AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.network_error' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_EMPTY AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.loading' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right /** * 转换文案 * @returns */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left convertValue ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewState AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_LOADING AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.loading' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_ERROR AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.load_error' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_NETWORK_ERROR AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.net_error' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ViewStateConstant AST#expression#Right . VIEW_STATE_EMPTY AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.load_empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.load_success' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left break AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 holdContent() { if (this.showSkeleton && this.viewState === ViewStateConstant.VIEW_STATE_LOADING) { CommonSkeleton() } else { Column() { LoadingProgress().width($r('app.float.size_36')).height($r('app.float.size_36')).color('#3598DB') Text(this.convertValue()) .fontSize($r('app.float.size_text_15')) .fontColor($r("app.color.color_666")) .margin($r('app.float.size_10')) .padding({ bottom: $r('app.float.size_70') }) if (this.viewState != ViewStateConstant.VIEW_STATE_LOADING) Button($r('app.string.press_retry')) .width($r('app.float.size_120')) .height($r('app.float.size_35')) .backgroundColor($r('app.color.color_main_background')) .fontColor($r('app.color.color_fff')) .onClick(() => { this.retryCallback?.() }) } .width('100%').height('100%').alignItems(HorizontalAlign.Center).justifyContent(FlexAlign.Center) } } convertImage() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.media.loading') break case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.media.loading_error') break case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: return $r('app.media.network_error') break case ViewStateConstant.VIEW_STATE_EMPTY: return $r('app.media.empty') break default: return $r('app.media.loading') break } } convertValue() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.string.loading') break case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.string.load_error') break case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: return $r('app.string.net_error') break case ViewStateConstant.VIEW_STATE_EMPTY: return $r('app.string.load_empty') break default: return $r('app.string.load_success') break } } }
https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/components/StateComponent.ets#L27-L103
97f90b55f0e576570c3f8c5117bdfd46b3cae531
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List/entry/src/main/ets/common/CommonConstants.ets
arkts
font-size
export const GOODS_LIST_PADDING: number = 8;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GOODS_LIST_PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const GOODS_LIST_PADDING: number = 8;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L24-L24
565dc8b83216da6869f463b4dbb8e47caea27fb1
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets
arkts
logger
取消加载
logger.info('state playing called');
AST#method_declaration#Left logger AST#ERROR#Left . in fo AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 'state playing called' AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
logger.info('state playing called');
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets#L224-L224
85bfcb80bb6672a4541e8fd2300a938147fde512
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/model/Message.ets
arkts
isOutgoing
是否"我"发出的消息
static isOutgoing(senderId: string): boolean { if (senderId && senderId == (ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId)) { return true; } else { return false; } }
AST#method_declaration#Left static isOutgoing AST#parameter_list#Left ( AST#parameter#Left senderId : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left senderId AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left senderId AST#expression#Right == AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ClientCoreSDK AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . currentLoginInfo AST#member_expression#Right AST#expression#Right ?. loginUserId AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#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 else 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#method_declaration#Right
static isOutgoing(senderId: string): boolean { if (senderId && senderId == (ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId)) { return true; } else { return false; } }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/Message.ets#L66-L72
8835538e85a7a3db6a89b75efeb6cab0ad289e52
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets
arkts
The constant of TopBarComponent.
export class TopBar { /** * The size of image. */ static readonly IMAGE_SIZE: number = 30; /** * The height of BalanceComponent. */ static readonly HEIGHT: string = '4%'; };
AST#export_declaration#Left export AST#class_declaration#Left class TopBar AST#class_body#Left { /** * The size of image. */ AST#property_declaration#Left static readonly IMAGE_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right ; AST#property_declaration#Right /** * The height of BalanceComponent. */ AST#property_declaration#Left static readonly HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '4%' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right ; AST#export_declaration#Right
export class TopBar { static readonly IMAGE_SIZE: number = 30; static readonly HEIGHT: string = '4%'; };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/HomeConstants.ets#L276-L286
b373cf12b519cf920cf1686aba1b952deadb3366
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FormatUtil.ets
arkts
isPhone
判断传入的电话号码格式是否正确。 @param phone country string 表示电话号码所属国家或地区代码。 options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。 @returns
static isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean { const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option); return phoneNumberFormat.isValidNumber(phone); }
AST#method_declaration#Left static isPhone AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left country : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "CN" AST#expression#Right AST#parameter#Right , AST#parameter#Left option ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left i18n . PhoneNumberFormatOptions 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left phoneNumberFormat : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left i18n . PhoneNumberFormat AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left i18n AST#expression#Right AST#new_expression#Right AST#expression#Right . PhoneNumberFormat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left country AST#expression#Right , AST#expression#Left option AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left phoneNumberFormat AST#expression#Right . isValidNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left phone 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 isPhone(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): boolean { const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option); return phoneNumberFormat.isValidNumber(phone); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L38-L41
3bdff76897a7afc59b51d5cb1cee5ad758a251d4
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the Distribution OS api name. <p>Independent Software Vendor (ISV) may distribute OHOS with their own OS api name. distributionOSApiName will return the ISV OS api name @syscap SystemCapability.Startup.SystemInfo @since 20 @arkts 1.2
static get distributionOSApiName(): string;
AST#method_declaration#Left static get AST#ERROR#Left distributionOSApiName AST#ERROR#Right 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#method_declaration#Right
static get distributionOSApiName(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L432-L432
87afeb9d1046b084ffd3ecfb0c70cded9c96aae3
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkExamplePronUsable
/ 检查 例句发音功能 是否可用
public checkExamplePronUsable(showMessage: boolean = true): boolean { if (this.isActive) { return true } // 非会员才做检查 if (this.maxExamplePronCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.examplePron)) { if (showMessage) { Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit_example_pron'), this.maxExamplePronCountDaily)) } return false } return true }
AST#method_declaration#Left public checkExamplePronUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 . isActive AST#member_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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxExamplePronCountDaily AST#member_expression#Right AST#expression#Right <= AST#expression#Left DailyCountManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . dailyCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left DailyCountType AST#expression#Right . examplePron AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left showMessage 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 Toast AST#expression#Right . showMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getStringF AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.member_manager_msg_limit_example_pron' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxExamplePronCountDaily 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#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_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
public checkExamplePronUsable(showMessage: boolean = true): boolean { if (this.isActive) { return true } if (this.maxExamplePronCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.examplePron)) { if (showMessage) { Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit_example_pron'), this.maxExamplePronCountDaily)) } return false } return true }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L216-L227
22ce0c6eb6a69a583eb90b4a5fa6539f12b6116b
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/LineDataSet.ets
arkts
getMode
Returns the drawing mode for this line dataset @return
public getMode(): Mode { return this.mMode; }
AST#method_declaration#Left public getMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Mode 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 . mMode AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getMode(): Mode { return this.mMode; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L117-L119
050e9345f4234513ca2d8d5b399b1ea26788d7cc
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
clear
Set initial state.
private clear(): void { this.cropRatio = CropRatioType.RATIO_TYPE_FREE; this.isFlipHorizontal = false; this.isFlipVertically = false; this.rotationAngle = 0; this.sliderAngle = 0; }
AST#method_declaration#Left private clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cropRatio AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CropRatioType AST#expression#Right . RATIO_TYPE_FREE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipHorizontal AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipVertically AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rotationAngle AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sliderAngle AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
private clear(): void { this.cropRatio = CropRatioType.RATIO_TYPE_FREE; this.isFlipHorizontal = false; this.isFlipVertically = false; this.rotationAngle = 0; this.sliderAngle = 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L420-L426
bcbc49a6225afecdda15b0eb73a3ebc924a51650
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/pages/RegisterPage.ets
arkts
onConfirm
@description: 修改用户信息 @date: 2024-01-10 23:01 @author wuwenqiang
onConfirm(value) { this.userData.sex = value; this.dialogController.close(); }
AST#method_declaration#Left onConfirm AST#parameter_list#Left ( AST#parameter#Left value 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . userData AST#member_expression#Right AST#expression#Right . sex AST#member_expression#Right = AST#expression#Left value 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 . dialogController AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
onConfirm(value) { this.userData.sex = value; this.dialogController.close(); }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/pages/RegisterPage.ets#L359-L362
ef5b2684414fb121c5a63da05d3542908cdf54ad
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/DateUtil.ets
arkts
compareDays
比较日历和指定日期相差的天数(按毫秒级的精度,不足一天将按一天进行计算,正数代表日历时间更早,负数代表日历时间更晚)。 @param date1 @param date2 @returns
static compareDays(date1: number | string | Date, date2: number | string | Date): number { date1 = DateUtil.getFormatDate(date1); date2 = DateUtil.getFormatDate(date2); let calendar: i18n.Calendar = i18n.getCalendar("zh-Hans"); calendar.setTime(date1); return calendar.compareDays(date2); }
AST#method_declaration#Left static compareDays AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left date1 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getFormatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date1 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 date2 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getFormatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date2 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 calendar : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left i18n . Calendar 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 i18n AST#expression#Right . getCalendar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "zh-Hans" 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 calendar AST#expression#Right . setTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date1 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#member_expression#Left AST#expression#Left calendar AST#expression#Right . compareDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date2 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 compareDays(date1: number | string | Date, date2: number | string | Date): number { date1 = DateUtil.getFormatDate(date1); date2 = DateUtil.getFormatDate(date2); let calendar: i18n.Calendar = i18n.getCalendar("zh-Hans"); calendar.setTime(date1); return calendar.compareDays(date2); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/DateUtil.ets#L268-L274
cc22b7a22ab0f8f9215aedc68859fb4a72be6e36
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets
arkts
时间范围枚举
export enum TimeRange { LAST_7_DAYS = 'last_7_days', LAST_30_DAYS = 'last_30_days', LAST_90_DAYS = 'last_90_days', LAST_YEAR = 'last_year', CUSTOM = 'custom' }
AST#export_declaration#Left export AST#enum_declaration#Left enum TimeRange AST#enum_body#Left { AST#enum_member#Left LAST_7_DAYS = AST#expression#Left 'last_7_days' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LAST_30_DAYS = AST#expression#Left 'last_30_days' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LAST_90_DAYS = AST#expression#Left 'last_90_days' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LAST_YEAR = AST#expression#Left 'last_year' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left CUSTOM = AST#expression#Left 'custom' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum TimeRange { LAST_7_DAYS = 'last_7_days', LAST_30_DAYS = 'last_30_days', LAST_90_DAYS = 'last_90_days', LAST_YEAR = 'last_year', CUSTOM = 'custom' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L28-L34
fa89d96830fc4365ebc1508e07336d9e4908bbd3
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets
arkts
保存当前服务端 发过来的诗词
export function saveCurrentPoem(obj: PoemFromApi) { //保存 自行扩展成持久化的效果 保存的就得是一个数组 每一次把当前数据 塞进去数组中。 然后保存新数组。 // let baiShiArr:PoemFromApi[] = [] 这也不对。每次都会置空数组 // 应该用之前上次你存过的数组。 如果是第一次的话。之前没存过。给一个默认空数组。 let baiShiArr: PoemFromApi[] = getColl(Constants.baiShi) baiShiArr.unshift(obj) // API9版本。到next时会移除。 // AppStorage.SetOrCreate(Constants.baiShi, baiShiArr) // next版本 AppStorage.setOrCreate(Constants.baiShi,baiShiArr) }
AST#export_declaration#Left export AST#function_declaration#Left function saveCurrentPoem AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left PoemFromApi AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { //保存 自行扩展成持久化的效果 保存的就得是一个数组 每一次把当前数据 塞进去数组中。 然后保存新数组。 // let baiShiArr:PoemFromApi[] = [] 这也不对。每次都会置空数组 // 应该用之前上次你存过的数组。 如果是第一次的话。之前没存过。给一个默认空数组。 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left baiShiArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PoemFromApi [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getColl AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . baiShi AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left baiShiArr AST#ERROR#Right . unshift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left obj AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // API9版本。到next时会移除。 // AppStorage.SetOrCreate(Constants.baiShi, baiShiArr) // next版本 AST#ERROR#Left AppStorage AST#ERROR#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . baiShi AST#member_expression#Right AST#expression#Right , AST#expression#Left baiShiArr 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#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function saveCurrentPoem(obj: PoemFromApi) { let baiShiArr: PoemFromApi[] = getColl(Constants.baiShi) baiShiArr.unshift(obj) AppStorage.setOrCreate(Constants.baiShi,baiShiArr) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets#L24-L36
88bb1d52e520e6756f7228f517fef58106f3004e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/PreferencesService.ets
arkts
getBoolean
获取布尔值 @param key 键 @param defaultValue 默认值 @returns 布尔值
async getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as boolean; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get boolean: ${businessError.message}`); return defaultValue; } }
AST#method_declaration#Left async getBoolean 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 boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 boolean 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 boolean: 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 getBoolean(key: string, defaultValue: boolean = false): Promise<boolean> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as boolean; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get boolean: ${businessError.message}`); return defaultValue; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L150-L159
25236cc67faf6e242895928278976c14e9199e1f
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhAlert.ets
arkts
initConfig
设置默认统一样式
public static initConfig() { DialogUtil.setDefaultConfig((config) => { config.title = '' config.alignment = DialogAlignment.Center config.backgroundColor = Color.White config.cornerRadius = { topLeft: _borderRadius, topRight: _borderRadius, bottomLeft: _borderRadius, bottomRight: _borderRadius } config.autoCancel = false }); }
AST#method_declaration#Left public static initConfig 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 DialogUtil AST#expression#Right . setDefaultConfig 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 config 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 config AST#expression#Right . title AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . alignment AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . backgroundColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . cornerRadius AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left _borderRadius AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left _borderRadius AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left _borderRadius AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left _borderRadius AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . autoCancel AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public static initConfig() { DialogUtil.setDefaultConfig((config) => { config.title = '' config.alignment = DialogAlignment.Center config.backgroundColor = Color.White config.cornerRadius = { topLeft: _borderRadius, topRight: _borderRadius, bottomLeft: _borderRadius, bottomRight: _borderRadius } config.autoCancel = false }); }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhAlert.ets#L52-L65
07b606ec45c724013533423cece850570db9629c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets
arkts
addData
在指定索引位置增加一个元素 @param index
public addData(index: number, data: TabDataModel): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData 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 data : AST#type_annotation#Left AST#primary_type#Left TabDataModel 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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd 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#builder_function_body#Right AST#method_declaration#Right
public addData(index: number, data: TabDataModel): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/TabsData.ets#L140-L143
4c59c711dfe5cfc97fb0e17c46d4f6a940a3017d
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
entry/src/main/ets/pages/LiveEnterPage.ets
arkts
imSDKError
错误回调 @param im im @param error 错误
imSDKError(code: number, errorMsg: string) { }
AST#method_declaration#Left imSDKError 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#Left errorMsg : 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#builder_function_body#Right AST#method_declaration#Right
imSDKError(code: number, errorMsg: string) { }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/entry/src/main/ets/pages/LiveEnterPage.ets#L131-L133
fa0a15e8c07d445e237d3518d540d8bdaa899deb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/DrawerLayout.ets
arkts
DrawerLayout
自定义DrawerLayout组件
@Preview @ComponentV2 export struct DrawerLayout { @Require @Param options: DrawerOptions private scroller: Scroller = new Scroller(); private controller: TextInputController = new TextInputController(); @Local bottom: number = 0; //单位vp aboutToAppear(): void { //监听键盘高度 KeyboardUtil.onKeyboardListener((show: boolean, height: number) => { if (show) { this.bottom = px2vp(height); } else { this.bottom = 0; } }); } build() { Column() { Scroll(this.scroller) { Column() { Column() { Row() { Image($r('app.media.icon_user')) .objectFit(ImageFit.Auto) .width(60) .height(60) .borderRadius(5) .margin({ left: 12 }) Column() { Text("桃花镇童长老") .fontSize(18) Text("研发工程师") .fontSize(12) .margin({ top: 5 }) Text("QQ群:1029219059") .fontSize(10) .fontWeight(FontWeight.Bold) .margin({ top: 5 }) } .alignItems(HorizontalAlign.Start) .margin({ left: 12 }) } .width('100%') .alignItems(VerticalAlign.Center) .margin(30) .padding({ top: 15 }) Divider().height(2).color($r('app.color.color_line')) Image($r('app.media.test_as2')) .objectFit(ImageFit.Auto) .width('100%') .border({ width: 12, style: BorderStyle.Solid, color: $r('app.color.card_background') }) } Button('关闭') .type(ButtonType.Capsule) .controlSize(ControlSize.NORMAL) .margin({ top: 20, right: 12 }) .alignSelf(ItemAlign.End) .onClick(() => { //关闭Drawer DialogHelper.closeDialog(this.options.dialogId ?? ""); }) Blank().layoutWeight(1) Text('处理键盘与弹框间距问题') .fontColor(Color.Red) .margin(12) TextInput({ placeholder: '请输入', controller: this.controller }) .width('90%') .margin({ bottom: 28 }) } } .layoutWeight(1) .width('100%') } .height(`calc(100% - ${this.bottom}vp)`) .width(this.options.width) .backgroundColor($r('app.color.main_background')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct DrawerLayout 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 DrawerOptions AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller 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 Scroller 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_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left TextInputController 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 TextInputController 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_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right bottom : 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 //单位vp AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { //监听键盘高度 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left KeyboardUtil AST#expression#Right . onKeyboardListener 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 show : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left show 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 . bottom AST#member_expression#Right = 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottom AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right 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 Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_user' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Auto AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 5 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 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#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 18 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 Text ( AST#expression#Left "研发工程师" 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 5 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 Text ( AST#expression#Left "QQ群:1029219059" 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 . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#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#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#Left . margin ( AST#expression#Left 30 AST#expression#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 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.color_line' 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.test_as2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Auto 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 . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid 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#resource_expression#Left $r ( AST#expression#Left 'app.color.card_background' 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '关闭' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . controlSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left ControlSize AST#expression#Right . NORMAL AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . End 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 { //关闭Drawer AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . closeDialog AST#member_expression#Right AST#expression#Right AST#argument_list#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 . options AST#member_expression#Right AST#expression#Right . dialogId AST#member_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#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 Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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 Text ( AST#expression#Left '处理键盘与弹框间距问题' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '请输入' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller 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 '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 28 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#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 . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#template_literal#Left ` calc(100% - AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottom AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right vp) ` AST#template_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right . width 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.main_background' 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
@Preview @ComponentV2 export struct DrawerLayout { @Require @Param options: DrawerOptions private scroller: Scroller = new Scroller(); private controller: TextInputController = new TextInputController(); @Local bottom: number = 0; aboutToAppear(): void { KeyboardUtil.onKeyboardListener((show: boolean, height: number) => { if (show) { this.bottom = px2vp(height); } else { this.bottom = 0; } }); } build() { Column() { Scroll(this.scroller) { Column() { Column() { Row() { Image($r('app.media.icon_user')) .objectFit(ImageFit.Auto) .width(60) .height(60) .borderRadius(5) .margin({ left: 12 }) Column() { Text("桃花镇童长老") .fontSize(18) Text("研发工程师") .fontSize(12) .margin({ top: 5 }) Text("QQ群:1029219059") .fontSize(10) .fontWeight(FontWeight.Bold) .margin({ top: 5 }) } .alignItems(HorizontalAlign.Start) .margin({ left: 12 }) } .width('100%') .alignItems(VerticalAlign.Center) .margin(30) .padding({ top: 15 }) Divider().height(2).color($r('app.color.color_line')) Image($r('app.media.test_as2')) .objectFit(ImageFit.Auto) .width('100%') .border({ width: 12, style: BorderStyle.Solid, color: $r('app.color.card_background') }) } Button('关闭') .type(ButtonType.Capsule) .controlSize(ControlSize.NORMAL) .margin({ top: 20, right: 12 }) .alignSelf(ItemAlign.End) .onClick(() => { DialogHelper.closeDialog(this.options.dialogId ?? ""); }) Blank().layoutWeight(1) Text('处理键盘与弹框间距问题') .fontColor(Color.Red) .margin(12) TextInput({ placeholder: '请输入', controller: this.controller }) .width('90%') .margin({ bottom: 28 }) } } .layoutWeight(1) .width('100%') } .height(`calc(100% - ${this.bottom}vp)`) .width(this.options.width) .backgroundColor($r('app.color.main_background')) } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/DrawerLayout.ets#L15-L96
c54bb76ecbe4afbd5decd3634fdcbf35ae720864
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/NetworkRequestPage.ets
arkts
构建通用网络请求示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_network_request_title"), viewModel: this.vm }) { this.NetworkRequestContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_network_request_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_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 . NetworkRequestContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { AppNavDestination({ title: $r("app.string.demo_network_request_title"), viewModel: this.vm }) { this.NetworkRequestContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkRequestPage.ets#L22-L29
93276bbc70c9db8fe0fc36e01e2dd41197dc08e0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
learnedWordIdsWhenNew
/ 获取某天的新字wordIds
learnedWordIdsWhenNew(dayOf: DayOf): number[] { return this.learnedWordIdsFor(dayOf, [BoxType.New]); }
AST#method_declaration#Left learnedWordIdsWhenNew AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . learnedWordIdsFor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dayOf AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left BoxType AST#expression#Right . New AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
learnedWordIdsWhenNew(dayOf: DayOf): number[] { return this.learnedWordIdsFor(dayOf, [BoxType.New]); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L319-L321
214f720e4ed7a2df9117f4bda4f2bce26814e678
github
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/UserService.ets
arkts
signOut
登出
async signOut(): Promise<boolean> { this.currentUser = null; this.loggedIn = false; return true; }
AST#method_declaration#Left async signOut AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 . currentUser AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loggedIn AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
async signOut(): Promise<boolean> { this.currentUser = null; this.loggedIn = false; return true; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L83-L87
56a0d41794bf523db44c714fa941d451156db9b3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/formatter/IFillFormatter.ets
arkts
Interface for providing a custom logic to where the filling line of a LineDataSet should end. This of course only works if setFillEnabled(...) is set to true.
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-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/IFillFormatter.ets#L25-L25
2a691b05ed4cbced653580ac2079909b666caf49
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinPoetry/entry/src/main/ets/view/PoetryMenuEssence.ets
arkts
PoetryMenuEssence
@des 诗单精选模块组件 @author dxin
@Component export default struct PoetryMenuEssence { // 默认索引 @State defaultTabsIndex: number = 3 // 诗单精选数据源 PoetryMenuEssenceDataSource: PoetryTypeEssenceJsonType[] = PoetryMenuEssenceJsonArr as Array<PoetryTypeEssenceJsonType> build() { // 精选诗单 Column() { Text('精选诗单') .fontSize(20) // 默认选中宋词 Tabs({ index: this.defaultTabsIndex }) { ForEach(this.PoetryMenuEssenceDataSource, (PoetryTypeEssenceType: PoetryTypeEssenceJsonType) => { TabContent() { List({ space: 15 }) { ForEach(PoetryTypeEssenceType.data.list, (itemPoetry: PoetryType) => { ListItem() { Column({ space: 10 }) { Text(itemPoetry.title).fontSize(14).fontWeight(700) Text(itemPoetry.content[0]) .width('100%') .textAlign(TextAlign.Center) .fontSize(12) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) } .width('90%') .padding({ top: 10, bottom: 10 }) .backgroundColor('#7aeae5e5') .borderRadius(8) .justifyContent(FlexAlign.Center) .onClick(() => { router.pushUrl({ url: "pages/PoetryMenuEssenceItem", params: { // 题目 title: itemPoetry.title, // 当前诗词 的诗词内容 是一个字符串数组 content: itemPoetry.content, // 作者 author: itemPoetry.author.name, //朝代 dynasty: itemPoetry.dynasty, // 所属分类 tagsName: itemPoetry.tags[0] } }) }) } }) } .scrollBar(BarState.Off) .alignListItem(ListItemAlign.Center) .divider({ strokeWidth: 1, color: '#ffe35252', startMargin: 20, endMargin: 20 }) .width('100%') .height('100%') } .tabBar(PoetryTypeEssenceType.typeName) .width('100%') .height('100%') }) } .barMode(BarMode.Scrollable) .layoutWeight(1) // 禁止左右滑动 .scrollable(false) .onTabBarClick(async (value: number) => { console.log(`dxin => 点击了${POETRY_TYPE_ARR[value].typeName} `) // 可通过自己定义构建函数设置点击的UI效果。 }) } .layoutWeight(1) .alignItems(HorizontalAlign.Start) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct PoetryMenuEssence AST#component_body#Left { // 默认索引 AST#ERROR#Left AST#decorator#Left @ State AST#decorator#Right defaultTabsIndex AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right // 诗单精选数据源 Poe try MenuEssenceDataSource AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PoetryTypeEssenceJsonType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left PoetryMenuEssenceJsonArr AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Array AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right < AST#expression#Left PoetryTypeEssenceJsonType AST#expression#Right AST#binary_expression#Right AST#expression#Right > AST#expression#Left build AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 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 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 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#object_literal#Left { // 精选诗单 AST#property_assignment#Left AST#property_name#Left Column AST#property_name#Right 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 AST#call_expression#Left AST#expression#Left Text AST#expression#Right AST#argument_list#Left ( AST#expression#Left '精选诗单' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 20 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 Tabs AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left index AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . defaultTabsIndex 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#expression_statement#Right AST#statement#Right AST#ERROR#Left { AST#property_name#Left ForEach AST#property_name#Right ( this . Poe AST#ERROR#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 tryMenuEssenceDataSource AST#expression#Right AST#ERROR#Left , AST#ERROR#Right AST#argument_list#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 PoetryTypeEssenceType AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left PoetryTypeEssenceJsonType AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ) AST#ERROR#Right => { AST#property_name#Left TabContent AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left List AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left space AST#property_name#Right : AST#expression#Left 15 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#property_name#Left ForEach AST#property_name#Right ( PoetryTypeEssenceType AST#ERROR#Right . data AST#member_expression#Right AST#expression#Right . list AST#member_expression#Right AST#expression#Right AST#ERROR#Left , AST#parameter_list#Left ( AST#parameter#Left itemPoetry : AST#type_annotation#Left AST#primary_type#Left PoetryType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => { AST#property_name#Left ListItem AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Column AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left space AST#property_name#Right : AST#expression#Left 10 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#property_name#Left Text AST#property_name#Right ( itemPoetry AST#ERROR#Right . title AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize 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 . fontWeight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 700 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#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 Text AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left itemPoetry AST#expression#Right . content AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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 '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . textAlign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 12 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . maxLines AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . textOverflow 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 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '90%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padding 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 top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . backgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#7aeae5e5' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . borderRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 8 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 "pages/PoetryMenuEssenceItem" 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 title AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left itemPoetry AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 当前诗词 的诗词内容 是一个字符串数组 AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left itemPoetry AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 作者 AST#property_assignment#Left AST#property_name#Left author AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left itemPoetry AST#expression#Right . author AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , //朝代 AST#property_assignment#Left AST#property_name#Left dynasty AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left itemPoetry AST#expression#Right . dynasty AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 所属分类 AST#property_assignment#Left AST#property_name#Left tagsName AST#property_name#Right : AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left itemPoetry AST#expression#Right . tags AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } } ) } AST#ERROR#Right . scrollBar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . alignListItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . divider 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 strokeWidth AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#ffe35252' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left startMargin AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endMargin AST#property_name#Right : AST#expression#Left 20 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 . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '100%' 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 '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } AST#ERROR#Right . tabBar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left PoetryTypeEssenceType AST#expression#Right . typeName AST#member_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 '100%' 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 '100%' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left } ) } AST#ERROR#Right . barMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarMode AST#expression#Right . Scrollable AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . layoutWeight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right // 禁止左右滑动 . scrollable AST#member_expression#Right 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 . onTabBarClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` dxin => 点击了 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left POETRY_TYPE_ARR AST#expression#Right [ AST#expression#Left value AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . typeName 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 // 可通过自己定义构建函数设置点击的UI效果。 } 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 } AST#ERROR#Right . layoutWeight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . alignItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#ERROR#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export default struct PoetryMenuEssence { @State defaultTabsIndex: number = 3 PoetryMenuEssenceDataSource: PoetryTypeEssenceJsonType[] = PoetryMenuEssenceJsonArr as Array<PoetryTypeEssenceJsonType> build() { Column() { Text('精选诗单') .fontSize(20) Tabs({ index: this.defaultTabsIndex }) { ForEach(this.PoetryMenuEssenceDataSource, (PoetryTypeEssenceType: PoetryTypeEssenceJsonType) => { TabContent() { List({ space: 15 }) { ForEach(PoetryTypeEssenceType.data.list, (itemPoetry: PoetryType) => { ListItem() { Column({ space: 10 }) { Text(itemPoetry.title).fontSize(14).fontWeight(700) Text(itemPoetry.content[0]) .width('100%') .textAlign(TextAlign.Center) .fontSize(12) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) } .width('90%') .padding({ top: 10, bottom: 10 }) .backgroundColor('#7aeae5e5') .borderRadius(8) .justifyContent(FlexAlign.Center) .onClick(() => { router.pushUrl({ url: "pages/PoetryMenuEssenceItem", params: { title: itemPoetry.title, content: itemPoetry.content, author: itemPoetry.author.name, dynasty: itemPoetry.dynasty, tagsName: itemPoetry.tags[0] } }) }) } }) } .scrollBar(BarState.Off) .alignListItem(ListItemAlign.Center) .divider({ strokeWidth: 1, color: '#ffe35252', startMargin: 20, endMargin: 20 }) .width('100%') .height('100%') } .tabBar(PoetryTypeEssenceType.typeName) .width('100%') .height('100%') }) } .barMode(BarMode.Scrollable) .layoutWeight(1) .scrollable(false) .onTabBarClick(async (value: number) => { console.log(`dxin => 点击了${POETRY_TYPE_ARR[value].typeName} `) }) } .layoutWeight(1) .alignItems(HorizontalAlign.Start) } }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/view/PoetryMenuEssence.ets#L11-L94
141830ebbfc5df7f9dee2dbee759042246a7c802
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
getCurrentMonthDays
用于生成当前月份的所有天数的数组 @param year 年 @param month 月 @returns 返回所有天数
static getCurrentMonthDays(year: number, month: number): number[] { const DAYS: number[] = []; const LAST_DAY_OF_MONTH = TimeUtils.getLastDayOfMonth(year, month); for (let i = 1; i <= LAST_DAY_OF_MONTH; i++) { DAYS.push(i); } return DAYS; }
AST#method_declaration#Left static getCurrentMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_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 DAYS : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left LAST_DAY_OF_MONTH = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . getLastDayOfMonth 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#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 ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right <= AST#expression#Left LAST_DAY_OF_MONTH 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DAYS AST#expression#Right . push 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#expression_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 DAYS AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getCurrentMonthDays(year: number, month: number): number[] { const DAYS: number[] = []; const LAST_DAY_OF_MONTH = TimeUtils.getLastDayOfMonth(year, month); for (let i = 1; i <= LAST_DAY_OF_MONTH; i++) { DAYS.push(i); } return DAYS; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L70-L77
3bd6c2714c3f4a7748221ade61f87b0d12f24b5c
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/bluetooth.ets
arkts
showPairFailedDialog
Show pair failed dialog
showPairFailedDialog() { this.showPairingFailedDialog(); }
AST#method_declaration#Left showPairFailedDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showPairingFailedDialog 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
showPairFailedDialog() { this.showPairingFailedDialog(); }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/bluetooth.ets#L630-L632
b2dee88ae43ac340b6aac407945bd5ce5c51006d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
copySocialMedia
辅助方法:复制社交媒体对象
private copySocialMedia(socialMedia: Map<string, string>): Map<string, string> { const copy = new Map<string, string>(); socialMedia.forEach((value, key) => { copy.set(key, value); }); return copy; }
AST#method_declaration#Left private copySocialMedia AST#parameter_list#Left ( AST#parameter#Left socialMedia : 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#parameter#Right ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left copy = 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#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 socialMedia 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 value AST#parameter#Right , AST#parameter#Left key 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 copy AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value 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#return_statement#Left return AST#expression#Left copy AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private copySocialMedia(socialMedia: Map<string, string>): Map<string, string> { const copy = new Map<string, string>(); socialMedia.forEach((value, key) => { copy.set(key, value); }); return copy; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L59-L65
a15dd6a847c37d1c221537f411c4423449c15b88
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/udp/UdpDemo/entry/src/main/ets/pages/Index.ets
arkts
sendMsg2Target
发送消息到目的ip和端口
sendMsg2Target() { //目的ip和端口 let remoteAddress = { address: this.targetIp, port: this.targetPort, family: 1 } udpSocket.send({ data: this.sendMsg, address: remoteAddress }) .then(async () => { this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n" }) .catch((e) => { this.msgHistory += '发送失败' + e.message + "\r\n"; }) }
AST#method_declaration#Left sendMsg2Target AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //目的ip和端口 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left remoteAddress = 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetIp AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetPort AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left family AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left udpSocket AST#ERROR#Right . send 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 data AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sendMsg AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left remoteAddress 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 . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_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#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . sendMsg AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#await_expression#Left await AST#expression#Left getCurrentTimeString AST#expression#Right AST#await_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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#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 e 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 . msgHistory AST#member_expression#Right += 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#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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#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#block_statement#Right AST#method_declaration#Right
sendMsg2Target() { let remoteAddress = { address: this.targetIp, port: this.targetPort, family: 1 } udpSocket.send({ data: this.sendMsg, address: remoteAddress }) .then(async () => { this.msgHistory += "我:" + this.sendMsg + await getCurrentTimeString() + "\r\n" }) .catch((e) => { this.msgHistory += '发送失败' + e.message + "\r\n"; }) }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/udp/UdpDemo/entry/src/main/ets/pages/Index.ets#L137-L147
6415dee71e201fca23dbeb838447e138f3d473e5
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.SwipeRefresher.d.ets
arkts
SwipeRefresher
Declare component SwipeRefresher @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare component SwipeRefresher @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare component SwipeRefresher @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20 @noninterop
@Component export declare struct SwipeRefresher { /** * Sets the content when loading. * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the content when loading. * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the content when loading. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ @Prop content?: ResourceStr; /** * Whether the component is loading. * type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Whether the component is loading. * type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Whether the component is loading. * type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ @Prop isLoading: boolean; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct SwipeRefresher AST#component_body#Left { /** * Sets the content when loading. * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the content when loading. * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Sets the content when loading. * @type { ?ResourceStr } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right content ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Whether the component is loading. * type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Whether the component is loading. * type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Whether the component is loading. * type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export declare struct SwipeRefresher { @Prop content?: ResourceStr; @Prop isLoading: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SwipeRefresher.d.ets#L40-L87
66ab9622271ba3dc46b1175e8c2ecb1d8742dae8
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
addCommonHeaders
添加公共的header @param headers @returns
addCommonHeaders(headers: Record<string, string>): EfRcp { if (headers) { Object.entries(headers).forEach((row) => { if (this.cfg.headers) { this.cfg.headers[row[0]] = row[1]; } else { this.cfg.headers = {}; this.cfg.headers[row[0]] = row[1]; } }); } return this; }
AST#method_declaration#Left addCommonHeaders AST#parameter_list#Left ( AST#parameter#Left headers : 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EfRcp 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 headers 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left headers AST#expression#Right ) AST#argument_list#Right AST#call_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 row 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . cfg AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cfg AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = row AST#ERROR#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cfg AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cfg AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left row AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = row AST#ERROR#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left this AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
addCommonHeaders(headers: Record<string, string>): EfRcp { if (headers) { Object.entries(headers).forEach((row) => { if (this.cfg.headers) { this.cfg.headers[row[0]] = row[1]; } else { this.cfg.headers = {}; this.cfg.headers[row[0]] = row[1]; } }); } return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L174-L186
919d8f94ed46bd384d36dc3436555e17e12c35bb
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/ScatterDataSet.ets
arkts
copy
@Override
public copy(): DataSet<EntryOhos> { const entries: JArrayList<EntryOhos> = new JArrayList<EntryOhos>(); if (this.mEntries != null) { for (let i = 0; i < this.mEntries.size(); i++) { entries.add(this.mEntries.get(i).copy()); } } const copied: ScatterDataSet = new ScatterDataSet(entries, this.getLabel()); this.copyTo(copied); return copied; }
AST#method_declaration#Left public copy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left DataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos 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 entries : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left JArrayList AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left EntryOhos 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#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 this AST#expression#Right . mEntries AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { 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#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 i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mEntries AST#member_expression#Right AST#expression#Right . size 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left entries AST#expression#Right . add 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mEntries AST#member_expression#Right AST#expression#Right . get 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 . copy 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#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#variable_declaration#Left const AST#variable_declarator#Left copied : AST#type_annotation#Left AST#primary_type#Left ScatterDataSet 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 ScatterDataSet AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left entries AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getLabel 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 this AST#expression#Right . copyTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left copied 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 copied AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public copy(): DataSet<EntryOhos> { const entries: JArrayList<EntryOhos> = new JArrayList<EntryOhos>(); if (this.mEntries != null) { for (let i = 0; i < this.mEntries.size(); i++) { entries.add(this.mEntries.get(i).copy()); } } const copied: ScatterDataSet = new ScatterDataSet(entries, this.getLabel()); this.copyTo(copied); return copied; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L59-L69
80bc942a7bdfa813bb741d54689140d3b8ed4543
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.FoldSplitContainer.d.ets
arkts
FoldSplitContainer
Defines FoldSplitContainer container. @interface FoldSplitContainer @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
@Component export declare struct FoldSplitContainer { /** * The builder function which will be rendered in the major region of container. * * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @BuilderParam primary: Callback<void>; /** * The builder function which will be rendered in the minor region of container. * * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @BuilderParam secondary: Callback<void>; /** * The builder function which will be rendered in the extra region of container. * * @type { ?Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @BuilderParam extra?: Callback<void>; /** * The layout options for the container when the foldable screen is expanded. * * @type { ExpandedRegionLayoutOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @Prop expandedLayoutOptions: ExpandedRegionLayoutOptions; /** * The layout options for the container when the foldable screen is in hover mode. * * @type { HoverModeRegionLayoutOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @Prop hoverModeLayoutOptions: HoverModeRegionLayoutOptions; /** * The layout options for the container when the foldable screen is folded. * * @type { FoldedRegionLayoutOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @Prop foldedLayoutOptions: FoldedRegionLayoutOptions; /** * The animation options of layout * * @type { ?(AnimateParam | null) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ @Prop animationOptions?: AnimateParam | null; /** * The callback function that is triggered when the foldable screen enters or exits hover mode. * In hover mode, the upper half of the screen is used for display, and the lower half is used for operation. * * @type { ?OnHoverStatusChangeHandler } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ onHoverStatusChange?: OnHoverStatusChangeHandler; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct FoldSplitContainer AST#component_body#Left { /** * The builder function which will be rendered in the major region of container. * * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right primary : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#property_declaration#Right /** * The builder function which will be rendered in the minor region of container. * * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right secondary : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#property_declaration#Right /** * The builder function which will be rendered in the extra region of container. * * @type { ?Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right extra ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#property_declaration#Right /** * The layout options for the container when the foldable screen is expanded. * * @type { ExpandedRegionLayoutOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right expandedLayoutOptions : AST#type_annotation#Left AST#primary_type#Left ExpandedRegionLayoutOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * The layout options for the container when the foldable screen is in hover mode. * * @type { HoverModeRegionLayoutOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right hoverModeLayoutOptions : AST#type_annotation#Left AST#primary_type#Left HoverModeRegionLayoutOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * The layout options for the container when the foldable screen is folded. * * @type { FoldedRegionLayoutOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right foldedLayoutOptions : AST#type_annotation#Left AST#primary_type#Left FoldedRegionLayoutOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * The animation options of layout * * @type { ?(AnimateParam | null) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right animationOptions ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AnimateParam AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * The callback function that is triggered when the foldable screen enters or exits hover mode. * In hover mode, the upper half of the screen is used for display, and the lower half is used for operation. * * @type { ?OnHoverStatusChangeHandler } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#property_declaration#Left onHoverStatusChange ? : AST#type_annotation#Left AST#primary_type#Left OnHoverStatusChangeHandler AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export declare struct FoldSplitContainer { @BuilderParam primary: Callback<void>; @BuilderParam secondary: Callback<void>; @BuilderParam extra?: Callback<void>; @Prop expandedLayoutOptions: ExpandedRegionLayoutOptions; @Prop hoverModeLayoutOptions: HoverModeRegionLayoutOptions; @Prop foldedLayoutOptions: FoldedRegionLayoutOptions; @Prop animationOptions?: AnimateParam | null; onHoverStatusChange?: OnHoverStatusChangeHandler; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FoldSplitContainer.d.ets#L253-L335
031358294a240a5542e9efbcc249591c34af2fab
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/view/ProgressEditPanel.ets
arkts
dialogButtonStyle
Custom button style.
@Extend(Text) function dialogButtonStyle() { .fontSize($r('app.float.button_font')) .height($r('app.float.dialog_btn_height')) .width($r('app.float.dialog_btn_width')) .fontColor($r('app.color.main_blue')) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function dialogButtonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.button_font' 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.dialog_btn_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.float.dialog_btn_width' 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.main_blue' 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#extend_function_body#Right AST#decorated_function_declaration#Right
@Extend(Text) function dialogButtonStyle() { .fontSize($r('app.float.button_font')) .height($r('app.float.dialog_btn_height')) .width($r('app.float.dialog_btn_width')) .fontColor($r('app.color.main_blue')) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/ProgressEditPanel.ets#L103-L108
28aa159708b39b919deb4e9241f3d41e6b42ba16
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
生成压缩的通知图标(≤192KB) @param {Resource | image.PixelMap} src:未压缩的Resource图片或PixelMap对象 @returns {Promise<image.PixelMap>} 返回压缩后的PixelMap对象
export async function createCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> { const maxSize = 192 * 1024; return ImageUtil.createCompressedPixelMap(src, maxSize); }
AST#export_declaration#Left export AST#function_declaration#Left async function createCompressedIcon AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 PixelMap 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 maxSize = AST#expression#Left AST#binary_expression#Left AST#expression#Left 192 AST#expression#Right * AST#expression#Left 1024 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ImageUtil AST#expression#Right . createCompressedPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left src AST#expression#Right , AST#expression#Left maxSize 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#function_declaration#Right AST#export_declaration#Right
export async function createCompressedIcon(src: Resource | image.PixelMap): Promise<PixelMap> { const maxSize = 192 * 1024; return ImageUtil.createCompressedPixelMap(src, maxSize); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L431-L434
fda8ffb85ad84e867da7049628f5c5b3ad851da8
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets
arkts
isEmptyArr
Check array is empty. @param {Array}arr @return {boolean} true(empty)
isEmptyArr(arr: Array<string>) { return arr.length === 0; }
AST#method_declaration#Left isEmptyArr 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 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#parameter#Right ) AST#parameter_list#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 arr 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
isEmptyArr(arr: Array<string>) { return arr.length === 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/common/utils/CheckEmptyUtils.ets#L46-L48
838d56b62fb31adf6fae4dcb664c7c561b4f2d32
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets
arkts
应用约束60:使用export替代module.exports
export default ReactionCollector;
AST#export_declaration#Left export default AST#expression#Left ReactionCollector AST#expression#Right ; AST#export_declaration#Right
export default ReactionCollector;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets#L58-L58
3d61b17b60039bb37deb3b3bfd06dd9012b2f3c0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/setting/SettingManager.ets
arkts
SettingManager
============================================================ MARK: - SettingManager - 设置管理器(单例) ============================================================
@ObservedV2 export class SettingManager { // MARK: - 单例 private static instance : SettingManager; public static get shared(): SettingManager { if (!SettingManager.instance) { SettingManager.instance = new SettingManager(); } return SettingManager.instance; } // MARK: - Preferences public preferences : preferences.Preferences | null = null; // MARK: - 基础设置 @Trace public hideTranslation : boolean = false; @Trace public autoPlaySound : boolean = false; @Trace public autoPlaySoundEx : boolean = false; @Trace public autoPlayInterval : number = 5000; @Trace public rollRepeat : boolean = false; // MARK: - 发音相关 @Trace public pronSpeed : number = 1; // NORMAL @Trace public pronTimes : number = 1; @Trace public pronGap : number = 0; // SHORT // MARK: - 学习策略 @Trace public detailStyle : number = 0; @Trace public planQuickLearn : boolean = false; @Trace public enableCurve : boolean = true; // MARK: - 显示 & 其他 @Trace public soundEffect : boolean = true; // @Trace public fontSize : number = 18; @Trace public puzzleSpeed : number = 0; @Trace public autoUpdate : boolean = true; // MARK: - 构造 private constructor() { this.initPreferences(getAppContext()); } // MARK: - 初始化 Preferences private initPreferences(context: common.Context): void { try { this.preferences = preferences.getPreferencesSync(context, { name: Pref.PREF_NAME }); this.loadPreference(); } catch (err) { console.error('初始化 Preferences 失败:', (err as BusinessError).message); } } // MARK: - 加载设置 private loadPreference(): void { if (!this.preferences) return; try { this.hideTranslation = this.preferences.getSync(Pref.KEY_SETTING_HIDETRANSLATION , false) as boolean; this.autoPlaySound = this.preferences.getSync(Pref.KEY_SETTING_AUTOPRONOUNCE , false) as boolean; this.autoPlaySoundEx = this.preferences.getSync(Pref.KEY_SETTING_AUTOPRONOUNCEEX , false) as boolean; this.autoPlayInterval = this.preferences.getSync(Pref.KEY_SETTING_AUTOPLAYINTERVAL, 5000 ) as number; this.rollRepeat = this.preferences.getSync(Pref.KEY_SETTING_ROLLREPEAT , false) as boolean; this.pronSpeed = this.preferences.getSync(Pref.KEY_SETTING_PRONSPEED , 1 ) as number; this.pronTimes = this.preferences.getSync(Pref.KEY_SETTING_PRONTIMES , 1 ) as number; this.pronGap = this.preferences.getSync(Pref.KEY_SETTING_PRONGAP , 0 ) as number; this.detailStyle = this.preferences.getSync(Pref.KEY_SETTING_DETAILSTYLE , 0 ) as number; this.planQuickLearn = this.preferences.getSync(Pref.KEY_SETTING_PLANQUICKLEARN , false ) as boolean; this.enableCurve = this.preferences.getSync(Pref.KEY_SETTING_ENABLECURVE , true ) as boolean; this.soundEffect = this.preferences.getSync(Pref.KEY_SETTING_SOUNDEFFECT , true ) as boolean; // this.fontSize = this.preferences.getSync(Pref.KEY_SETTING_FONTSIZE , 18 ) as number; this.puzzleSpeed = this.preferences.getSync(Pref.KEY_SETTING_PUZZELSPEED , 0 ) as number; this.autoUpdate = this.preferences.getSync(Pref.KEY_SETTING_AUTOUPDATE , true ) as boolean; } catch (err) { console.error('加载设置失败:', (err as BusinessError).message); } } // MARK: - 保存设置 public async save(): Promise<void> { if (!this.preferences) return; try { await this.preferences.put(Pref.KEY_SETTING_HIDETRANSLATION , this.hideTranslation); await this.preferences.put(Pref.KEY_SETTING_AUTOPRONOUNCE , this.autoPlaySound); await this.preferences.put(Pref.KEY_SETTING_AUTOPRONOUNCEEX, this.autoPlaySoundEx); await this.preferences.put(Pref.KEY_SETTING_AUTOPLAYINTERVAL, this.autoPlayInterval); await this.preferences.put(Pref.KEY_SETTING_ROLLREPEAT , this.rollRepeat); await this.preferences.put(Pref.KEY_SETTING_PRONSPEED , this.pronSpeed); await this.preferences.put(Pref.KEY_SETTING_PRONTIMES , this.pronTimes); await this.preferences.put(Pref.KEY_SETTING_PRONGAP , this.pronGap); await this.preferences.put(Pref.KEY_SETTING_DETAILSTYLE , this.detailStyle); await this.preferences.put(Pref.KEY_SETTING_PLANQUICKLEARN , this.planQuickLearn); await this.preferences.put(Pref.KEY_SETTING_ENABLECURVE , this.enableCurve); await this.preferences.put(Pref.KEY_SETTING_SOUNDEFFECT , this.soundEffect); // await this.preferences.put(Pref.KEY_SETTING_FONTSIZE , this.fontSize); await this.preferences.put(Pref.KEY_SETTING_PUZZELSPEED , this.puzzleSpeed); await this.preferences.put(Pref.KEY_SETTING_AUTOUPDATE , this.autoUpdate); await this.preferences.flush(); } catch (err) { console.error('保存设置失败:', (err as BusinessError).message); } } // MARK: - 恢复默认设置 async restoreDefaultSettings(): Promise<void> { this.hideTranslation = false; this.autoPlaySound = false; this.autoPlaySoundEx = false; this.autoPlayInterval = 5000; this.rollRepeat = false; this.pronSpeed = 1; this.pronTimes = 1; this.pronGap = 0; this.detailStyle = 0; this.planQuickLearn = false; this.enableCurve = true; this.soundEffect = true; // this.fontSize = 18; this.puzzleSpeed = 0; this.autoUpdate = true; await this.save(); } // MARK: - 会员 -> 非会员 async restoreSettingsForNonMember(): Promise<void> { this.autoPlaySound = false; this.autoPlaySoundEx = false; this.hideTranslation = false; await this.save(); } async clearCache(){ // 获取清理前的可用空间 (单位为字节) const before: number = DiskStatus.getAvailableBytesForDataDirectorySync(getContext()); ///清空缓存的CSounds await CSoundManager.shared.removeAllCachedSounds() //清理缓存的mp3 await AudioTool.removeTempAudioFiles() //清空cos sounds缓存 CosDownloader.clearTempFolder() ///清空Online await WordUserDbAccess.shared.resetWordTables() WordUserDbAccess.shared.refreshDb() ///重新加载数据 await SearchManager.shared.refreshData() // 获取清理后的可用空间 const after: number = DiskStatus.getAvailableBytesForDataDirectorySync(getContext()); // 计算释放的空间大小 (确保非负) const freedBytes: number = Math.max(before - after, 0); const bytes: string = FileSizeUtils.formatBytes(freedBytes) const extra = freedBytes > 0 ? `[${bytes}]` : '' Toast.showMessage(getStringF($r('app.string.set_msg_clear_done')) + extra)//[%s] } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class SettingManager AST#class_body#Left { // MARK: - 单例 AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left SettingManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SettingManager 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 AST#unary_expression#Left ! AST#expression#Left SettingManager AST#expression#Right AST#unary_expression#Right AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left SettingManager AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SettingManager 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#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SettingManager AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // MARK: - Preferences AST#property_declaration#Left public preferences : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // MARK: - 基础设置 AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public hideTranslation : 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 @ Trace AST#decorator#Right public autoPlaySound : 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 @ Trace AST#decorator#Right public autoPlaySoundEx : 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 @ Trace AST#decorator#Right public autoPlayInterval : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5000 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public rollRepeat : 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 // MARK: - 发音相关 AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public pronSpeed : 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 // NORMAL AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public pronTimes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public pronGap : 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 // SHORT // MARK: - 学习策略 AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public detailStyle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public planQuickLearn : 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 @ Trace AST#decorator#Right public enableCurve : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // MARK: - 显示 & 其他 AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public soundEffect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // @Trace public fontSize : number = 18; AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public puzzleSpeed : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right public autoUpdate : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // MARK: - 构造 AST#constructor_declaration#Left private 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . initPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getAppContext 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#block_statement#Right AST#constructor_declaration#Right // MARK: - 初始化 Preferences AST#method_declaration#Left private initPreferences AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context 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 void 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left preferences AST#expression#Right . getPreferencesSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , 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 Pref AST#expression#Right . PREF_NAME 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadPreference 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 ( 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 '初始化 Preferences 失败:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 加载设置 AST#method_declaration#Left private loadPreference 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 . preferences AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideTranslation AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_HIDETRANSLATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . autoPlaySound AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOPRONOUNCE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . autoPlaySoundEx AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOPRONOUNCEEX AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . autoPlayInterval AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOPLAYINTERVAL AST#member_expression#Right AST#expression#Right , AST#expression#Left 5000 AST#expression#Right ) AST#argument_list#Right AST#call_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#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 . rollRepeat AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_ROLLREPEAT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . pronSpeed AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PRONSPEED AST#member_expression#Right AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_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#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 . pronTimes AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PRONTIMES AST#member_expression#Right AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_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#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 . pronGap AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PRONGAP AST#member_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_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#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 . detailStyle AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_DETAILSTYLE AST#member_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_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#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 . planQuickLearn AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PLANQUICKLEARN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . enableCurve AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_ENABLECURVE AST#member_expression#Right 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 as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . soundEffect AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_SOUNDEFFECT AST#member_expression#Right 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 as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // this.fontSize = this.preferences.getSync(Pref.KEY_SETTING_FONTSIZE , 18 ) as number; 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 . puzzleSpeed AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PUZZELSPEED AST#member_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_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#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 . autoUpdate AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . getSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOUPDATE AST#member_expression#Right 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 as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 保存设置 AST#method_declaration#Left public async save AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . preferences AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_HIDETRANSLATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideTranslation AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOPRONOUNCE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlaySound AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOPRONOUNCEEX AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlaySoundEx AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOPLAYINTERVAL AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlayInterval AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_ROLLREPEAT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rollRepeat AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PRONSPEED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pronSpeed AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PRONTIMES AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pronTimes AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PRONGAP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pronGap AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_DETAILSTYLE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . detailStyle AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PLANQUICKLEARN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . planQuickLearn AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_ENABLECURVE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . enableCurve AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_SOUNDEFFECT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . soundEffect 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 // await this.preferences.put(Pref.KEY_SETTING_FONTSIZE , this.fontSize); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_PUZZELSPEED AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . puzzleSpeed AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Pref AST#expression#Right . KEY_SETTING_AUTOUPDATE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoUpdate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . flush 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 ( 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 AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // MARK: - 恢复默认设置 AST#method_declaration#Left async restoreDefaultSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideTranslation AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlaySound AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlaySoundEx AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlayInterval AST#member_expression#Right = AST#expression#Left 5000 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rollRepeat AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pronSpeed AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pronTimes AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pronGap AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . detailStyle AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . planQuickLearn AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . enableCurve AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . soundEffect 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 // this.fontSize = 18; AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . puzzleSpeed AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoUpdate AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . save 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 // MARK: - 会员 -> 非会员 AST#method_declaration#Left async restoreSettingsForNonMember AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlaySound AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . autoPlaySoundEx AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideTranslation AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#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 . save 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 AST#method_declaration#Left async clearCache AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取清理前的可用空间 (单位为字节) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left before : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DiskStatus AST#expression#Right . getAvailableBytesForDataDirectorySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#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 ///清空缓存的CSounds AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left CSoundManager AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . removeAllCachedSounds 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 //清理缓存的mp3 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 AudioTool AST#expression#Right AST#await_expression#Right AST#expression#Right . removeTempAudioFiles 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 //清空cos sounds缓存 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CosDownloader AST#expression#Right . clearTempFolder 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 ///清空Online AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left WordUserDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . resetWordTables AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WordUserDbAccess AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . refreshDb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right ///重新加载数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left SearchManager AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . refreshData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 获取清理后的可用空间 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left after : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DiskStatus AST#expression#Right . getAvailableBytesForDataDirectorySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#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 const AST#variable_declarator#Left freedBytes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left before AST#expression#Right - AST#expression#Left after AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 0 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 bytes : 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 FileSizeUtils AST#expression#Right . formatBytes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left freedBytes 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 extra = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left freedBytes AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` [ AST#template_substitution#Left $ { AST#expression#Left bytes AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#ERROR#Left To AST#ERROR#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . showMessage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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 getStringF AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.set_msg_clear_done' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left extra AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right //[%s] AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@ObservedV2 export class SettingManager { private static instance : SettingManager; public static get shared(): SettingManager { if (!SettingManager.instance) { SettingManager.instance = new SettingManager(); } return SettingManager.instance; } public preferences : preferences.Preferences | null = null; @Trace public hideTranslation : boolean = false; @Trace public autoPlaySound : boolean = false; @Trace public autoPlaySoundEx : boolean = false; @Trace public autoPlayInterval : number = 5000; @Trace public rollRepeat : boolean = false; @Trace public pronSpeed : number = 1; @Trace public pronTimes : number = 1; @Trace public pronGap : number = 0; @Trace public detailStyle : number = 0; @Trace public planQuickLearn : boolean = false; @Trace public enableCurve : boolean = true; @Trace public soundEffect : boolean = true; @Trace public puzzleSpeed : number = 0; @Trace public autoUpdate : boolean = true; private constructor() { this.initPreferences(getAppContext()); } private initPreferences(context: common.Context): void { try { this.preferences = preferences.getPreferencesSync(context, { name: Pref.PREF_NAME }); this.loadPreference(); } catch (err) { console.error('初始化 Preferences 失败:', (err as BusinessError).message); } } private loadPreference(): void { if (!this.preferences) return; try { this.hideTranslation = this.preferences.getSync(Pref.KEY_SETTING_HIDETRANSLATION , false) as boolean; this.autoPlaySound = this.preferences.getSync(Pref.KEY_SETTING_AUTOPRONOUNCE , false) as boolean; this.autoPlaySoundEx = this.preferences.getSync(Pref.KEY_SETTING_AUTOPRONOUNCEEX , false) as boolean; this.autoPlayInterval = this.preferences.getSync(Pref.KEY_SETTING_AUTOPLAYINTERVAL, 5000 ) as number; this.rollRepeat = this.preferences.getSync(Pref.KEY_SETTING_ROLLREPEAT , false) as boolean; this.pronSpeed = this.preferences.getSync(Pref.KEY_SETTING_PRONSPEED , 1 ) as number; this.pronTimes = this.preferences.getSync(Pref.KEY_SETTING_PRONTIMES , 1 ) as number; this.pronGap = this.preferences.getSync(Pref.KEY_SETTING_PRONGAP , 0 ) as number; this.detailStyle = this.preferences.getSync(Pref.KEY_SETTING_DETAILSTYLE , 0 ) as number; this.planQuickLearn = this.preferences.getSync(Pref.KEY_SETTING_PLANQUICKLEARN , false ) as boolean; this.enableCurve = this.preferences.getSync(Pref.KEY_SETTING_ENABLECURVE , true ) as boolean; this.soundEffect = this.preferences.getSync(Pref.KEY_SETTING_SOUNDEFFECT , true ) as boolean; this.puzzleSpeed = this.preferences.getSync(Pref.KEY_SETTING_PUZZELSPEED , 0 ) as number; this.autoUpdate = this.preferences.getSync(Pref.KEY_SETTING_AUTOUPDATE , true ) as boolean; } catch (err) { console.error('加载设置失败:', (err as BusinessError).message); } } public async save(): Promise<void> { if (!this.preferences) return; try { await this.preferences.put(Pref.KEY_SETTING_HIDETRANSLATION , this.hideTranslation); await this.preferences.put(Pref.KEY_SETTING_AUTOPRONOUNCE , this.autoPlaySound); await this.preferences.put(Pref.KEY_SETTING_AUTOPRONOUNCEEX, this.autoPlaySoundEx); await this.preferences.put(Pref.KEY_SETTING_AUTOPLAYINTERVAL, this.autoPlayInterval); await this.preferences.put(Pref.KEY_SETTING_ROLLREPEAT , this.rollRepeat); await this.preferences.put(Pref.KEY_SETTING_PRONSPEED , this.pronSpeed); await this.preferences.put(Pref.KEY_SETTING_PRONTIMES , this.pronTimes); await this.preferences.put(Pref.KEY_SETTING_PRONGAP , this.pronGap); await this.preferences.put(Pref.KEY_SETTING_DETAILSTYLE , this.detailStyle); await this.preferences.put(Pref.KEY_SETTING_PLANQUICKLEARN , this.planQuickLearn); await this.preferences.put(Pref.KEY_SETTING_ENABLECURVE , this.enableCurve); await this.preferences.put(Pref.KEY_SETTING_SOUNDEFFECT , this.soundEffect); await this.preferences.put(Pref.KEY_SETTING_PUZZELSPEED , this.puzzleSpeed); await this.preferences.put(Pref.KEY_SETTING_AUTOUPDATE , this.autoUpdate); await this.preferences.flush(); } catch (err) { console.error('保存设置失败:', (err as BusinessError).message); } } async restoreDefaultSettings(): Promise<void> { this.hideTranslation = false; this.autoPlaySound = false; this.autoPlaySoundEx = false; this.autoPlayInterval = 5000; this.rollRepeat = false; this.pronSpeed = 1; this.pronTimes = 1; this.pronGap = 0; this.detailStyle = 0; this.planQuickLearn = false; this.enableCurve = true; this.soundEffect = true; this.puzzleSpeed = 0; this.autoUpdate = true; await this.save(); } async restoreSettingsForNonMember(): Promise<void> { this.autoPlaySound = false; this.autoPlaySoundEx = false; this.hideTranslation = false; await this.save(); } async clearCache(){ const before: number = DiskStatus.getAvailableBytesForDataDirectorySync(getContext()); await CSoundManager.shared.removeAllCachedSounds() await AudioTool.removeTempAudioFiles() CosDownloader.clearTempFolder() await WordUserDbAccess.shared.resetWordTables() WordUserDbAccess.shared.refreshDb() await SearchManager.shared.refreshData() const after: number = DiskStatus.getAvailableBytesForDataDirectorySync(getContext()); const freedBytes: number = Math.max(before - after, 0); const bytes: string = FileSizeUtils.formatBytes(freedBytes) const extra = freedBytes > 0 ? `[${bytes}]` : '' Toast.showMessage(getStringF($r('app.string.set_msg_clear_done')) + extra) } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/setting/SettingManager.ets#L45-L222
d7d759fb919dd02be41e4e22f251309ad86cb0a2
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
redirectForResult
@deprecated @see {redirectForResult2} @param name @param param @param callback
public static redirectForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) { ZRouter.getRouterMgr().redirectForResult(name, param, callback) }
AST#method_declaration#Left public static redirectForResult AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left ObjectOrNull AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left OnPopCallback 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 ZRouter AST#expression#Right . getRouterMgr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . redirectForResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right , AST#expression#Left param 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
public static redirectForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) { ZRouter.getRouterMgr().redirectForResult(name, param, callback) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L596-L598
0e4d1c000f9353372fbde6c9ee01b72d64c9373b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets
arkts
getChamfer
获取 tabs 尺寸信息
getChamfer() { let onLayoutComplete: () => void = (): void => { let modePosition = componentUtils.getRectangleById(this.tabsId) if (modePosition.size) { this.chamfer = new ChamferInfo(modePosition, this.tabsMenu.length) this.tabsListener?.off('draw') } } let FuncDraw = onLayoutComplete; this.tabsListener?.on('draw', FuncDraw) }
AST#method_declaration#Left getChamfer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left onLayoutComplete : 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#expression#Left AST#arrow_function#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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left modePosition = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left componentUtils AST#expression#Right . getRectangleById 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 . tabsId 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left modePosition AST#expression#Right . size 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 . chamfer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ChamferInfo AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left modePosition AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tabsMenu AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . tabsListener AST#member_expression#Right AST#expression#Right ?. off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'draw' 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left FuncDraw = AST#expression#Left onLayoutComplete 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 . tabsListener AST#member_expression#Right AST#expression#Right ?. on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'draw' AST#expression#Right , AST#expression#Left FuncDraw 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
getChamfer() { let onLayoutComplete: () => void = (): void => { let modePosition = componentUtils.getRectangleById(this.tabsId) if (modePosition.size) { this.chamfer = new ChamferInfo(modePosition, this.tabsMenu.length) this.tabsListener?.off('draw') } } let FuncDraw = onLayoutComplete; this.tabsListener?.on('draw', FuncDraw) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets#L86-L96
1cbde21a08f56c2558fff964982b7d432065ec78
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/exception_throw/exception_catch_001_T.ets
arkts
Introduction 异常抛出-catch块
export function exception_catch_001_T(taint_src : string) { try { throw new Error(); } catch (e) { taint.Sink(taint_src); } }
AST#export_declaration#Left export AST#function_declaration#Left function exception_catch_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error 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#throw_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 taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src 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#function_declaration#Right AST#export_declaration#Right
export function exception_catch_001_T(taint_src : string) { try { throw new Error(); } catch (e) { taint.Sink(taint_src); } }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/exception_throw/exception_catch_001_T.ets#L6-L12
982ee8234b92937621b56264162233df96240903
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/common/RatingBar.ets
arkts
RatingBar
星级评分组件 显示 0-5 分的星级评分
@Component export struct RatingBar { @Prop rating: number; // 评分值 (0-5) private starSize: number = 14; // 星星大小 build() { Row() { ForEach([1, 2, 3, 4, 5], (index: number) => { Text() { if (this.rating >= index) { // 满星 Span('★') .fontSize(this.starSize) .fontColor($r('app.color.rating_star')) } else if (this.rating >= index - 0.5) { // 半星(使用满星代替,简化实现) Span('★') .fontSize(this.starSize) .fontColor($r('app.color.rating_star')) } else { // 空星 Span('☆') .fontSize(this.starSize) .fontColor($r('app.color.rating_star_empty')) } } }, (index: number) => index.toString()) } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RatingBar AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right rating : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 评分值 (0-5) AST#property_declaration#Left private starSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 14 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#ui_component#Right AST#ERROR#Left { ForEach ( AST#ERROR#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#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#array_literal#Right AST#expression#Right AST#ERROR#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 => { Text ( AST#ERROR#Left ) AST#ERROR#Right { AST#property_name#Left if AST#property_name#Right ( this AST#ERROR#Right . rating AST#member_expression#Right AST#expression#Right >= AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ERROR#Right { // 满星 AST#property_name#Left Span AST#property_name#Right AST#parameter_list#Left ( AST#ERROR#Left '★' AST#ERROR#Right ) AST#parameter_list#Right AST#ERROR#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . starSize 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.rating_star' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left else AST#ERROR#Left if AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . rat in g >= in dex - 0.5 AST#ERROR#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 Span ( 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 this AST#expression#Right . starSize 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.rating_star' 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#builder_function_body#Right AST#method_declaration#Right else AST#ERROR#Right AST#component_body#Left { // 空星 AST#ERROR#Left Span AST#ERROR#Left AST#parameter_list#Left ( AST#ERROR#Left '☆' AST#ERROR#Right ) AST#parameter_list#Right . fontSize AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . starSize AST#ERROR#Right ) AST#parameter_list#Right . fontColor AST#parameter_list#Left ( AST#parameter#Left $r AST#parameter#Right AST#ERROR#Left ( 'app.color.rating_star_empty' AST#ERROR#Right ) AST#parameter_list#Right ) } } } , 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 => in dex . toStr in g AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ) } } AST#ERROR#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct RatingBar { @Prop rating: number; private starSize: number = 14; build() { Row() { ForEach([1, 2, 3, 4, 5], (index: number) => { Text() { if (this.rating >= index) { Span('★') .fontSize(this.starSize) .fontColor($r('app.color.rating_star')) } else if (this.rating >= index - 0.5) { Span('★') .fontSize(this.starSize) .fontColor($r('app.color.rating_star')) } else { Span('☆') .fontSize(this.starSize) .fontColor($r('app.color.rating_star_empty')) } } }, (index: number) => index.toString()) } } }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/common/RatingBar.ets#L6-L35
bb7c6284b9aee1807ddde4e34a51ca8b1b4d0531
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets
arkts
bottomPenShape
底部画笔编辑模块,用于切换涂鸦和橡皮擦选中状态,设置线宽
@Builder bottomPenShape() { Row() { // 涂鸦按钮 Column() { Image($r('app.media.eraser_screenshot_penshape')) .fillColor(this.isClear ? $r('app.color.eraser_unselected_color') : $r('app.color.eraser_selected_color')) .width($r('app.integer.eraser_pen_shape_icon_size')) .height($r('app.integer.eraser_pen_shape_icon_size')) Text($r('app.string.eraser_pen_shape_text')) .fontSize($r('app.integer.eraser_font_size')) .fontColor($r('app.color.eraser_selected_color')) .margin({ top: $r('app.integer.eraser_pen_shape_text_margin_top') }) .fontColor(this.isClear ? $r('app.color.eraser_unselected_color') : $r('app.color.eraser_selected_color')) } .margin({ right: $r('app.integer.eraser_bottom_pen_shape_margin_right') }) .onClick(() => { this.isClear = false; }) // 橡皮擦按钮 Column() { Image($r('app.media.eraser_screenshot_eraser')) .fillColor(this.isClear ? $r('app.color.eraser_selected_color') : $r('app.color.eraser_unselected_color')) .width($r('app.integer.eraser_pen_shape_icon_size')) .height($r('app.integer.eraser_pen_shape_icon_size')) Text($r('app.string.eraser_eraser_text')) .fontSize($r('app.integer.eraser_font_size')) .fontColor($r('app.color.eraser_selected_color')) .margin({ top: $r('app.integer.eraser_pen_shape_text_margin_top') }) .fontColor(this.isClear ? $r('app.color.eraser_selected_color') : $r('app.color.eraser_unselected_color')) } .onClick(() => { this.isClear = true; }) Divider() .vertical(true) .strokeWidth(Constants.DIVIDER_STROKE_WIDTH) .color($r('app.color.eraser_divider_color')) .margin({ left: $r('app.integer.eraser_divider_margin'), right: $r('app.integer.eraser_divider_margin') }) // 可选的线宽列表 Row() { // TODO:性能知识点:此处列表项确定且数量较少,使用了ForEach,在列表项多的情况下,推荐使用LazyForeEach ForEach(this.lineStrokeWidths, (strokeWidth: number) => { Circle({ width: px2vp(strokeWidth), height: px2vp(strokeWidth) }) .fill(strokeWidth === this.currentLineStrokeWidth ? $r('app.color.eraser_selected_color') : $r('app.color.eraser_unselected_color'))// 为了避免线宽较小时无法点击,扩大触摸热区 .responseRegion(this.getResponRegion(px2vp(strokeWidth), Constants.THRESHOLD)) .onClick(() => { // 点击切换选中的线宽 this.currentLineStrokeWidth = strokeWidth; }) }) } .layoutWeight(Constants.LAYOUT_WEIGHT) .justifyContent(FlexAlign.SpaceAround) } .width($r('app.string.eraser_full_size')) .height($r('app.integer.eraser_bottom_line_height')) .padding($r('app.integer.eraser_padding')) .backgroundColor($r('app.color.eraser_top_and_bottom_line_background_color')) .alignRules({ bottom: { anchor: Constants.CONTAINER_ID, align: VerticalAlign.Bottom }, left: { anchor: Constants.CONTAINER_ID, align: HorizontalAlign.Start } }) .alignItems(VerticalAlign.Center) .id(Constants.BOTTOM_PEN_SHAPE_ID) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomPenShape 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 Column ( ) 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.eraser_screenshot_penshape' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClear AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_unselected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_selected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_pen_shape_icon_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_pen_shape_icon_size' 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#resource_expression#Left $r ( AST#expression#Left 'app.string.eraser_pen_shape_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.eraser_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_selected_color' 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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_pen_shape_text_margin_top' 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 . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClear AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_unselected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_selected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_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 . 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.eraser_bottom_pen_shape_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#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 . isClear AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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#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.eraser_screenshot_eraser' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClear AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_selected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_unselected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_pen_shape_icon_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_pen_shape_icon_size' 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#resource_expression#Left $r ( AST#expression#Left 'app.string.eraser_eraser_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.eraser_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_selected_color' 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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_pen_shape_text_margin_top' 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 . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClear AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_selected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_unselected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_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 . 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 . isClear AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DIVIDER_STROKE_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_divider_color' 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.eraser_divider_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_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#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 Row ( ) AST#container_content_body#Left { // TODO:性能知识点:此处列表项确定且数量较少,使用了ForEach,在列表项多的情况下,推荐使用LazyForeEach 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 . lineStrokeWidths AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left strokeWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left strokeWidth AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left strokeWidth AST#expression#Right ) 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 . fill ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left strokeWidth AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentLineStrokeWidth AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_selected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.eraser_unselected_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) // 为了避免线宽较小时无法点击,扩大触摸热区 AST#modifier_chain_expression#Left . responseRegion ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getResponRegion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left strokeWidth AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . THRESHOLD AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_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 . currentLineStrokeWidth AST#member_expression#Right = AST#expression#Left strokeWidth 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#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 . layoutWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . LAYOUT_WEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.eraser_full_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_bottom_line_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.eraser_padding' 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.eraser_top_and_bottom_line_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . CONTAINER_ID AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . CONTAINER_ID AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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#Left . id ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BOTTOM_PEN_SHAPE_ID AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder bottomPenShape() { Row() { Column() { Image($r('app.media.eraser_screenshot_penshape')) .fillColor(this.isClear ? $r('app.color.eraser_unselected_color') : $r('app.color.eraser_selected_color')) .width($r('app.integer.eraser_pen_shape_icon_size')) .height($r('app.integer.eraser_pen_shape_icon_size')) Text($r('app.string.eraser_pen_shape_text')) .fontSize($r('app.integer.eraser_font_size')) .fontColor($r('app.color.eraser_selected_color')) .margin({ top: $r('app.integer.eraser_pen_shape_text_margin_top') }) .fontColor(this.isClear ? $r('app.color.eraser_unselected_color') : $r('app.color.eraser_selected_color')) } .margin({ right: $r('app.integer.eraser_bottom_pen_shape_margin_right') }) .onClick(() => { this.isClear = false; }) Column() { Image($r('app.media.eraser_screenshot_eraser')) .fillColor(this.isClear ? $r('app.color.eraser_selected_color') : $r('app.color.eraser_unselected_color')) .width($r('app.integer.eraser_pen_shape_icon_size')) .height($r('app.integer.eraser_pen_shape_icon_size')) Text($r('app.string.eraser_eraser_text')) .fontSize($r('app.integer.eraser_font_size')) .fontColor($r('app.color.eraser_selected_color')) .margin({ top: $r('app.integer.eraser_pen_shape_text_margin_top') }) .fontColor(this.isClear ? $r('app.color.eraser_selected_color') : $r('app.color.eraser_unselected_color')) } .onClick(() => { this.isClear = true; }) Divider() .vertical(true) .strokeWidth(Constants.DIVIDER_STROKE_WIDTH) .color($r('app.color.eraser_divider_color')) .margin({ left: $r('app.integer.eraser_divider_margin'), right: $r('app.integer.eraser_divider_margin') }) Row() { ForEach(this.lineStrokeWidths, (strokeWidth: number) => { Circle({ width: px2vp(strokeWidth), height: px2vp(strokeWidth) }) .fill(strokeWidth === this.currentLineStrokeWidth ? $r('app.color.eraser_selected_color') : $r('app.color.eraser_unselected_color')) .responseRegion(this.getResponRegion(px2vp(strokeWidth), Constants.THRESHOLD)) .onClick(() => { this.currentLineStrokeWidth = strokeWidth; }) }) } .layoutWeight(Constants.LAYOUT_WEIGHT) .justifyContent(FlexAlign.SpaceAround) } .width($r('app.string.eraser_full_size')) .height($r('app.integer.eraser_bottom_line_height')) .padding($r('app.integer.eraser_padding')) .backgroundColor($r('app.color.eraser_top_and_bottom_line_background_color')) .alignRules({ bottom: { anchor: Constants.CONTAINER_ID, align: VerticalAlign.Bottom }, left: { anchor: Constants.CONTAINER_ID, align: HorizontalAlign.Start } }) .alignItems(VerticalAlign.Center) .id(Constants.BOTTOM_PEN_SHAPE_ID) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Graphics/Graphics2d/Eraser/casesfeature/erasercomponent/src/main/ets/pages/EraserMainPage.ets#L93-L161
85eefd9ad7f5bf6d71b70eaf63c73fc3506021ce
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserSettingsUpdate.ets
arkts
Emitted when the client user's settings update. @event Client#clientUserSettingsUpdate @param {ClientUserSettings} clientUserSettings The new client user settings
export default UserSettingsUpdateHandler;
AST#export_declaration#Left export default AST#expression#Left UserSettingsUpdateHandler AST#expression#Right ; AST#export_declaration#Right
export default UserSettingsUpdateHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/UserSettingsUpdate.ets#L28-L28
e3d742454a4e8c55ea687160aa3db0fd06cb9263
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
init
============================================================ MARK: - 初始化
private init(): void { /// 使用异步获取,以防首次初始化未成功,这样只影响后台线程 setTimeout(() => { /// 从服务器加载 policies this.loadNonMemberPolicyIfNeeds() }, 0) }
AST#method_declaration#Left private init 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left setTimeout ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { /// 从服务器加载 policies 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 . loadNonMemberPolicyIfNeeds 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#expression#Left 0 AST#expression#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
private init(): void { setTimeout(() => { this.loadNonMemberPolicyIfNeeds() }, 0) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L86-L92
bae4d968e88ec05fbbb5223393a948e1de8c0af4
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
envProps
Called when multiple property values are checked. @since 10
static envProps(props: EnvPropsOptions[]): void { for (const prop of props) Environment.envProp(prop.key, prop.defaultValue) }
AST#method_declaration#Left static envProps AST#parameter_list#Left ( AST#parameter#Left props : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EnvPropsOptions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const prop of AST#expression#Left props AST#expression#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 Environment AST#expression#Right . envProp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left prop AST#expression#Right . key AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left prop AST#expression#Right . defaultValue 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#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static envProps(props: EnvPropsOptions[]): void { for (const prop of props) Environment.envProp(prop.key, prop.defaultValue) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L313-L315
9d1d190102e15517c35a9d006bdf5e575aba2e37
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语模板接口
export interface GreetingTemplate { id: string; name: string; content: string; style: GreetingStyle; occasion: GreetingOccasion; variables: GreetingVariable[]; isSystem: boolean; usage: number; rating: number; tags: string[]; language?: GreetingLanguage; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingTemplate AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left style : AST#type_annotation#Left AST#primary_type#Left GreetingStyle AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left occasion : AST#type_annotation#Left AST#primary_type#Left GreetingOccasion AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left variables : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GreetingVariable [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isSystem : 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 usage : 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 rating : 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 tags : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left language ? : AST#type_annotation#Left AST#primary_type#Left GreetingLanguage 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 GreetingTemplate { id: string; name: string; content: string; style: GreetingStyle; occasion: GreetingOccasion; variables: GreetingVariable[]; isSystem: boolean; usage: number; rating: number; tags: string[]; language?: GreetingLanguage; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L336-L348
000f94b4c08091b21ce619565401e260f02199fd
github
ChangweiZhang/chardet-arkts.git
3a214882ec6a2753c0fed84162952aa659341c19
src/main/ets/components/encoding/mbcs.ets
arkts
binarySearch
Binary search implementation (recursive)
function binarySearch(arr: number[], searchValue: number) { const find = ( arr: number[], searchValue: number, left: number, right: number ): number => { if (right < left) return -1; /* int mid = mid = (left + right) / 2; There is a bug in the above line; Joshua Bloch suggests the following replacement: */ const mid = Math.floor((left + right) >>> 1); if (searchValue > arr[mid]) return find(arr, searchValue, mid + 1, right); if (searchValue < arr[mid]) return find(arr, searchValue, left, mid - 1); return mid; }; return find(arr, searchValue, 0, arr.length - 1); }
AST#function_declaration#Left function binarySearch AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left searchValue : 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#variable_declaration#Left const AST#variable_declarator#Left find = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left searchValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left right : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left right AST#expression#Right < AST#expression#Left left AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right /* int mid = mid = (left + right) / 2; There is a bug in the above line; Joshua Bloch suggests the following replacement: */ AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mid = 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#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left left AST#expression#Right + AST#expression#Left right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right >>> AST#expression#Left 1 AST#expression#Right AST#binary_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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left searchValue AST#expression#Right > AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left mid AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left find AST#expression#Right AST#argument_list#Left ( AST#expression#Left arr AST#expression#Right , AST#expression#Left searchValue AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left mid AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left searchValue AST#expression#Right < AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left mid AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left find AST#expression#Right AST#argument_list#Left ( AST#expression#Left arr AST#expression#Right , AST#expression#Left searchValue AST#expression#Right , AST#expression#Left left AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left mid AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left mid AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#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 find AST#expression#Right AST#argument_list#Left ( AST#expression#Left arr AST#expression#Right , AST#expression#Left searchValue AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left arr 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function binarySearch(arr: number[], searchValue: number) { const find = ( arr: number[], searchValue: number, left: number, right: number ): number => { if (right < left) return -1; const mid = Math.floor((left + right) >>> 1); if (searchValue > arr[mid]) return find(arr, searchValue, mid + 1, right); if (searchValue < arr[mid]) return find(arr, searchValue, left, mid - 1); return mid; }; return find(arr, searchValue, 0, arr.length - 1); }
https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/encoding/mbcs.ets#L6-L29
b49737bb746cc6f2fa3e2a9f5d5e4c0a24748bc8
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AdaptiveCapabilities/entry/src/main/ets/pages/atomicLayoutCapability/proportionCapability/ProportionCapability.ets
arkts
slider
Bottom slider - adjust container size through slider drag interaction.
@Builder slider() { Slider({ value: 100, min: 25, max: 50 }) .blockColor(Color.White) .width('60%') .height(50) .onChange((value: number) => { this.rate = value / 100; }) .position({ x: '20%', y: '80%' }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right slider 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 Slider ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left 100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left min : AST#expression#Left 25 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left max : AST#expression#Left 50 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . blockColor ( 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 . width ( AST#expression#Left '60%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left 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 . rate AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right / AST#expression#Left 100 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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '20%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left '80%' 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 slider() { Slider({ value: 100, min: 25, max: 50 }) .blockColor(Color.White) .width('60%') .height(50) .onChange((value: number) => { this.rate = value / 100; }) .position({ x: '20%', y: '80%' }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/pages/atomicLayoutCapability/proportionCapability/ProportionCapability.ets#L23-L33
365b4ebe6d3784b4ab1dea2febc0c748106ec6b7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
pushCreateRoom
跳转至CreateRoom页面
pushCreateRoom(): void { router.pushUrl({ url: 'pages/CreateRoom', params: { 'userId': this.userId, 'socketType': this.socketType[this.selectAgreementIndex] } }); }
AST#method_declaration#Left pushCreateRoom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 'pages/CreateRoom' 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 'userId' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'socketType' AST#property_name#Right : AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . socketType AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectAgreementIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_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#builder_function_body#Right AST#method_declaration#Right
pushCreateRoom(): void { router.pushUrl({ url: 'pages/CreateRoom', params: { 'userId': this.userId, 'socketType': this.socketType[this.selectAgreementIndex] } }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L179-L187
678108e04acf2006be3527727c2e984ace0671fe
gitee
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/itemview/ShortCutSelectItem.ets
arkts
@Local selectStatus: boolean = false
build() { RelativeContainer() { Text(this.itemData.cardBean.name) .fontSize(30) .fontColor('#ffffff') .margin({ left: 15, top: 15 }) Image(this.itemData.cardBean.imageSrc) .width(140) .height(140) .alignRules({ center: { anchor: "__container__", align: VerticalAlign.Center }, right: { anchor: "__container__", align: HorizontalAlign.End }, }) Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .width(40) .height(40) .select(this.itemData.isSelect) .selectedColor(0x2495FF) .shape(CheckBoxShape.CIRCLE) .onChange((value: boolean) => { console.info('Checkbox1 change is' + value) }) .margin({ left: 20, bottom: 20 }) .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start }, bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, }) } .onClick(() => { this.changeIsSelect(!this.itemData.isSelect) // this.itemData.isSelect = !this.itemData.isSelect }) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . cardBean 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 30 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' 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 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . cardBean AST#member_expression#Right AST#expression#Right . imageSrc AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 140 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 140 AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left center AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center 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 right AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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 Checkbox ( AST#component_parameters#Left { AST#component_parameter#Left name : AST#expression#Left 'checkbox1' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left group : AST#expression#Left 'checkboxGroup' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . select ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . isSelect AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left 0x2495FF AST#expression#Right ) AST#modifier_chain_expression#Left . shape ( AST#expression#Left AST#member_expression#Left AST#expression#Left CheckBoxShape AST#expression#Right . CIRCLE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : 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#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#binary_expression#Left AST#expression#Left 'Checkbox1 change is' AST#expression#Right + AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start 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 bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__container__" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changeIsSelect 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 AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . itemData AST#member_expression#Right AST#expression#Right . isSelect 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 // this.itemData.isSelect = !this.itemData.isSelect } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { RelativeContainer() { Text(this.itemData.cardBean.name) .fontSize(30) .fontColor('#ffffff') .margin({ left: 15, top: 15 }) Image(this.itemData.cardBean.imageSrc) .width(140) .height(140) .alignRules({ center: { anchor: "__container__", align: VerticalAlign.Center }, right: { anchor: "__container__", align: HorizontalAlign.End }, }) Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .width(40) .height(40) .select(this.itemData.isSelect) .selectedColor(0x2495FF) .shape(CheckBoxShape.CIRCLE) .onChange((value: boolean) => { console.info('Checkbox1 change is' + value) }) .margin({ left: 20, bottom: 20 }) .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start }, bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, }) } .onClick(() => { this.changeIsSelect(!this.itemData.isSelect) }) }
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/itemview/ShortCutSelectItem.ets#L12-L46
c99022ca5e6d9eaa75c49b4ed10f6672c20615f3
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/component/FlipCard.ets
arkts
flipCard
翻转卡片
private flipCard(): void { this.isFlipped = !this.isFlipped; animateTo({ duration: 600, curve: Curve.EaseInOut }, () => { this.rotateAngle = this.isFlipped ? 180 : 0; }); }
AST#method_declaration#Left private flipCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipped AST#member_expression#Right = 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 . isFlipped AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 600 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rotateAngle AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipped AST#member_expression#Right AST#expression#Right ? AST#expression#Left 180 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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
private flipCard(): void { this.isFlipped = !this.isFlipped; animateTo({ duration: 600, curve: Curve.EaseInOut }, () => { this.rotateAngle = this.isFlipped ? 180 : 0; }); }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/component/FlipCard.ets#L10-L18
fe06f76a1bffc2b3a0dae0012860be87b3a46bc5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/DeviceDataModel.ets
arkts
Copyright (c) 2020-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 DeviceDataModel { deviceId: string deviceName: string deviceType: string checked: boolean networkId: string range: number constructor
AST#export_declaration#Left export AST#ERROR#Left class DeviceDataModel { deviceId : AST#ERROR#Left string deviceName : string device Type : string checked : boolean networkId : string range : AST#ERROR#Right number 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 DeviceDataModel { deviceId: string deviceName: string deviceType: string checked: boolean networkId: string range: number constructor
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/DeviceDataModel.ets#L16-L24
a989afa44051421b37c8a3e6e18febe6ec775ae9
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/model/Message.ets
arkts
createChatMsgEntity_INCOME_TEXT
构建一条收到的消息对象。 @param senderId 发送者uid @param nickName 发送者昵称 @param message 消息内容 @param time 消息时间戳,0表示使用当前系统时间戳 @returns 新的消息对象
static createChatMsgEntity_INCOME_TEXT(senderId: string, nickName: string, message: string, time: number): Message { return new Message(senderId, nickName, time, message, MsgType.TYPE_TEXT); }
AST#method_declaration#Left static createChatMsgEntity_INCOME_TEXT AST#parameter_list#Left ( AST#parameter#Left senderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left nickName : 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 time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Message 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#new_expression#Left new AST#expression#Left Message AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left senderId AST#expression#Right , AST#expression#Left nickName AST#expression#Right , AST#expression#Left time AST#expression#Right , AST#expression#Left message AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left MsgType AST#expression#Right . TYPE_TEXT 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#method_declaration#Right
static createChatMsgEntity_INCOME_TEXT(senderId: string, nickName: string, message: string, time: number): Message { return new Message(senderId, nickName, time, message, MsgType.TYPE_TEXT); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/Message.ets#L88-L90
c372d35b698a3b97f2db255697fca045700fc49a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
arkts
setSuccessState
设置成功状态 @returns {void} 无返回值
protected setSuccessState(): void { this.uiState = BaseNetWorkUiState.SUCCESS; }
AST#method_declaration#Left protected setSuccessState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . SUCCESS AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
protected setSuccessState(): void { this.uiState = BaseNetWorkUiState.SUCCESS; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L103-L105
7c8fa9f6956c82cffd34435ffcc1ff72a2bcb263
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets
arkts
[End streams_Read_Write_File] 查看文件列表
export function getListFile(): string { let str = ''; let listFileOption: ListFileOptions = { recursion: false, listNum: 0, // 0 表示不限制文件数量 filter: { suffix: ['.png', '.jpg', '.txt', '.jpeg', '.json'], displayName: ['*'], fileSizeOver: 0, // 0 表示列出所有文件,不限制文件大小 lastModifiedAfter: new Date(0).getTime() // 返回的时间戳是0 } }; let files = fs.listFileSync(filesDir, listFileOption); for (let i = 0; i < files.length; i++) { Logger.info(`The name of file: ${files[i]}`); str += files[i] + '\n'; } return str; }
AST#export_declaration#Left export AST#function_declaration#Left function getListFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left str = 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 listFileOption : AST#type_annotation#Left AST#primary_type#Left ListFileOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left recursion 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 listNum AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 0 表示不限制文件数量 AST#property_assignment#Left AST#property_name#Left filter AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left suffix AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '.png' AST#expression#Right , AST#expression#Left '.jpg' AST#expression#Right , AST#expression#Left '.txt' AST#expression#Right , AST#expression#Left '.jpeg' AST#expression#Right , AST#expression#Left '.json' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left displayName AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '*' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileSizeOver AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 0 表示列出所有文件,不限制文件大小 AST#property_assignment#Left AST#property_name#Left lastModifiedAfter AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right // 返回的时间戳是0 } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left files = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . listFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filesDir AST#expression#Right , AST#expression#Left listFileOption 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 ( 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 files 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` The name of file: AST#template_substitution#Left $ { AST#expression#Left AST#subscript_expression#Left AST#expression#Left files 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left str += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left files AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left '\n' 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#return_statement#Left return AST#expression#Left str AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getListFile(): string { let str = ''; let listFileOption: ListFileOptions = { recursion: false, listNum: 0, filter: { suffix: ['.png', '.jpg', '.txt', '.jpeg', '.json'], displayName: ['*'], fileSizeOver: 0, lastModifiedAfter: new Date(0).getTime() } }; let files = fs.listFileSync(filesDir, listFileOption); for (let i = 0; i < files.length; i++) { Logger.info(`The name of file: ${files[i]}`); str += files[i] + '\n'; } return str; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets#L122-L140
6875932bd193e84ab82b89ef2f96a28c4667d9f6
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/harB/Index.ets
arkts
[Start har_init]
export function harInit(builderName: string): void { // 根据routerModule中路由表的key值动态加载要跳转的页面的相对路径 switch (builderName) { case BuilderNameConstants.HARB_B1: import("./src/main/ets/components/mainpage/B1"); break; case BuilderNameConstants.HARB_B2: import("./src/main/ets/components/mainpage/B2"); break; case BuilderNameConstants.HARB_B3: import("./src/main/ets/components/mainpage/B3"); break; default: break; } }
AST#export_declaration#Left export AST#function_declaration#Left function harInit 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_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 根据routerModule中路由表的key值动态加载要跳转的页面的相对路径 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 builderName 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#ERROR#Left AST#property_name#Left case AST#property_name#Right Builder NameConstants . HARB_B AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left 1 AST#property_name#Right : AST#expression#Left AST#import_expression#Left import ( AST#expression#Left "./src/main/ets/components/mainpage/B1" AST#expression#Right ) AST#import_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 AST#member_expression#Left AST#expression#Left BuilderNameConstants AST#expression#Right . HARB_B2 AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#import_expression#Left import ( AST#expression#Left "./src/main/ets/components/mainpage/B2" AST#expression#Right ) AST#import_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#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 AST#member_expression#Left AST#expression#Left BuilderNameConstants AST#expression#Right . HARB_B3 AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#import_expression#Left import ( AST#expression#Left "./src/main/ets/components/mainpage/B3" AST#expression#Right ) AST#import_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#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left break AST#primary_type#Right AST#type_annotation#Right ; } AST#ERROR#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function harInit(builderName: string): void { switch (builderName) { case BuilderNameConstants.HARB_B1: import("./src/main/ets/components/mainpage/B1"); break; case BuilderNameConstants.HARB_B2: import("./src/main/ets/components/mainpage/B2"); break; case BuilderNameConstants.HARB_B3: import("./src/main/ets/components/mainpage/B3"); break; default: break; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/harB/Index.ets#L18-L33
64cd56af442e95a8ac151abffe49c2b703d7007f
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhAlert.ets
arkts
showTextPicker
中间弹框,文本选择器 @param options
public static showTextPicker(options: JhTextPickerOptions) { DialogUtil.showTextPicker({ range: options.data, value: options.value, selected: options.selected, canLoop: false, onAccept: (value: TextPickerResult) => { options.onConfirm?.(value) }, onCancel: () => { options.onCancel?.() } }) }
AST#method_declaration#Left public static showTextPicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhTextPickerOptions 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 DialogUtil AST#expression#Right . showTextPicker 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 range AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . value AST#member_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#member_expression#Left AST#expression#Left options AST#expression#Right . selected AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left canLoop 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 TextPickerResult 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 options AST#expression#Right . onConfirm AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left value 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 onCancel AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . onCancel AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#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 showTextPicker(options: JhTextPickerOptions) { DialogUtil.showTextPicker({ range: options.data, value: options.value, selected: options.selected, canLoop: false, onAccept: (value: TextPickerResult) => { options.onConfirm?.(value) }, onCancel: () => { options.onCancel?.() } }) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhAlert.ets#L202-L215
556f61a32a3287566f7bea891c4c81a676290f0c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets
arkts
OnChangeSelectDate
日期选择监听
OnChangeSelectDate() { const PARTS: string[] = this.currentSelectDate.split('-'); this.currentSelectDay.year = Number(PARTS[0]); this.currentSelectDay.month = Number(PARTS[1]); this.currentSelectDay.date = Number(PARTS[2]); }
AST#method_declaration#Left OnChangeSelectDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left PARTS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDate AST#member_expression#Right AST#expression#Right . split 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left PARTS AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left PARTS AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSelectDay AST#member_expression#Right AST#expression#Right . date AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left PARTS AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_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#block_statement#Right AST#method_declaration#Right
OnChangeSelectDate() { const PARTS: string[] = this.currentSelectDate.split('-'); this.currentSelectDay.year = Number(PARTS[0]); this.currentSelectDay.month = Number(PARTS[1]); this.currentSelectDay.date = Number(PARTS[2]); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets#L49-L54
58b8d88dca14220ab8a3165d10f20a0696fdd62c
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets
arkts
getBgColorByIsCorrect
答题卡-显示对、错和未答题的背景色 @param isCorrect @returns
getBgColorByIsCorrect(isCorrect: boolean | undefined): string { if (isCorrect === undefined) { return '#F1F3F5'; } return isCorrect ? '#64BB5C' : ' #E84026'; }
AST#method_declaration#Left getBgColorByIsCorrect AST#parameter_list#Left ( AST#parameter#Left isCorrect : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left undefined 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left isCorrect 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#return_statement#Left return AST#expression#Left '#F1F3F5' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left isCorrect AST#expression#Right ? AST#expression#Left '#64BB5C' AST#expression#Right : AST#expression#Left ' #E84026' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getBgColorByIsCorrect(isCorrect: boolean | undefined): string { if (isCorrect === undefined) { return '#F1F3F5'; } return isCorrect ? '#64BB5C' : ' #E84026'; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/Exam.ets#L394-L399
bc1242a60e730b22941a592ac874f0c447457353
github
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/viewmodel/ShotCutCardData.ets
arkts
HomeCardItemEntity
首页Banner的Item数据结构
@ObservedV2 export class HomeCardItemEntity { type: string='' name: string='' itemId: string='' imageSrc: ResourceStr='' urlpath: string='' // constructor( // type: string, // name: string, // itemId: string, // imageSrc: ResourceStr, // urlpath: string) { // this.type = type // this.name = name // this.itemId = itemId // this.imageSrc = imageSrc // this.urlpath = urlpath // } setData( type: string, name: string, itemId: string, imageSrc: ResourceStr, urlpath: string) { this.type = type this.name = name this.itemId = itemId this.imageSrc = imageSrc this.urlpath = urlpath } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class HomeCardItemEntity AST#class_body#Left { AST#ERROR#Left type AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right name : string = '' itemId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right urlpath AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right // constructor( // type: string, // name: string, // itemId: string, // imageSrc: ResourceStr, // urlpath: string) { // this.type = type // this.name = name // this.itemId = itemId // this.imageSrc = imageSrc // this.urlpath = urlpath // } AST#ERROR#Left setData AST#ERROR#Right ( AST#expression#Left type AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#expression#Left name AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#expression#Left itemId AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#expression#Left imageSrc AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#ERROR#Left urlpath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ) AST#ERROR#Right AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . type AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left type AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . name AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left name AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . itemId AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left itemId AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . imageSrc AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left imageSrc AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . urlpath AST#member_expression#Right = AST#expression#Left urlpath AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right } AST#ERROR#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@ObservedV2 export class HomeCardItemEntity { type: string='' name: string='' itemId: string='' imageSrc: ResourceStr='' urlpath: string='' setData( type: string, name: string, itemId: string, imageSrc: ResourceStr, urlpath: string) { this.type = type this.name = name this.itemId = itemId this.imageSrc = imageSrc this.urlpath = urlpath } }
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/ShotCutCardData.ets#L5-L37
31bd2c56545043dc2137a1a880621dd737af15c7
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
hasNetVPN
判断当前网络是否是VPN网络。
static hasNetVPN(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_VPN); }
AST#method_declaration#Left static hasNetVPN AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NetworkUtil AST#expression#Right . hasNetBearType 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 connection AST#expression#Right . NetBearType AST#member_expression#Right AST#expression#Right . BEARER_VPN 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#method_declaration#Right
static hasNetVPN(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_VPN); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L153-L155
12e6718b020798852c1c8347ae7e125e75458bfd
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildHomeContent
构建首页内容 基于设计规范的现代卡片布局
@Builder buildHomeContent() { Column({ space: 16 }) { // 欢迎横幅 - 渐变背景卡片 this.buildWelcomeBanner() // 数据概览卡片 this.buildStatsOverview() // 今日生日卡片 this.buildTodayBirthdays() // 即将到来的生日 this.buildUpcomingBirthdays() // 快捷操作 this.buildQuickActions() } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHomeContent 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildWelcomeBanner 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatsOverview 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildTodayBirthdays 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildUpcomingBirthdays 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQuickActions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildHomeContent() { Column({ space: 16 }) { this.buildWelcomeBanner() this.buildStatsOverview() this.buildTodayBirthdays() this.buildUpcomingBirthdays() this.buildQuickActions() } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1268-L1286
c55d727ce58d6625d2e1f351e65d90fcb263e50b
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets
arkts
@file 用户信息相关数据源接口 @author Joker.X
export interface UserInfoNetworkDataSource { /** * 获取用户个人信息 * @returns 用户信息响应 */ getPersonInfo(): Promise<NetworkResponse<User>>; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserInfoNetworkDataSource AST#object_type#Left { /** * 获取用户个人信息 * @returns 用户信息响应 */ AST#type_member#Left getPersonInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface UserInfoNetworkDataSource { getPersonInfo(): Promise<NetworkResponse<User>>; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSource.ets#L7-L13
2b8011b9894da225c6da1fd71cadd3248f9152e2
github
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
commonModule/src/main/ets/components/LoginComp.ets
arkts
customStyle
拓展TextInput的属性,实现共用
@Extend(TextInput) function customStyle() { .height(dp(44)) .borderRadius(dp(2)) .backgroundColor('#ffffff') .border({ width: { bottom: 0.5 }, color: '#e4e4e4' }) .padding({ left: 0 }) .placeholderColor('#C3C3C5') .caretColor('#fa711d') }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextInput AST#expression#Right ) AST#decorator#Right function customStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 44 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' 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 0.5 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 '#e4e4e4' 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 left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderColor ( AST#expression#Left '#C3C3C5' AST#expression#Right ) AST#modifier_chain_expression#Left . caretColor ( AST#expression#Left '#fa711d' 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#extend_function_body#Right AST#decorated_function_declaration#Right
@Extend(TextInput) function customStyle() { .height(dp(44)) .borderRadius(dp(2)) .backgroundColor('#ffffff') .border({ width: { bottom: 0.5 }, color: '#e4e4e4' }) .padding({ left: 0 }) .placeholderColor('#C3C3C5') .caretColor('#fa711d') }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/commonModule/src/main/ets/components/LoginComp.ets#L180-L188
331735a2dcdd6ab2b8f5671b9569f116107f6224
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/YAxisRendererHorizontalBarChart.ets
arkts
renderAxisLabels
draws the y-axis labels to the screen
public renderAxisLabels(c: CanvasRenderingContext2D): void { if (!this.mYAxis || !this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled() || !this.mViewPortHandler) { return; } let positions: number[] = this.getTransformedPositions(); this.mAxisLabelPaint.setFontFamily(this.mYAxis.getTypeface()); this.mAxisLabelPaint.setTextSize(this.mYAxis.getTextSize()); this.mAxisLabelPaint.setColor(this.mYAxis.getTextColor()); this.mAxisLabelPaint.setTextAlign("center"); let baseYOffset = Utils.handleDataValues(2.5); let textHeight = Utils.getLabelTextSize(this.mAxisLabelPaint, "Q", this.textSizeCache).height; let dependency: AxisDependency = this.mYAxis.getAxisDependency(); let labelPosition: YAxisLabelPosition = this.mYAxis.getLabelPosition(); let yPos: number = 0; if (dependency == AxisDependency.LEFT) { if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) { yPos = this.mViewPortHandler.contentTop() - baseYOffset; } else { yPos = this.mViewPortHandler.contentTop() - baseYOffset; } } else { if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) { yPos = this.mViewPortHandler.contentBottom() + textHeight + baseYOffset; } else { yPos = this.mViewPortHandler.contentBottom() + textHeight + baseYOffset; } } this.drawYLabels(c, yPos, positions, this.mYAxis.getYOffset()); }
AST#method_declaration#Left public renderAxisLabels AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_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 . mYAxis AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mYAxis AST#member_expression#Right AST#expression#Right . isEnabled 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mYAxis AST#member_expression#Right AST#expression#Right . isDrawLabelsEnabled 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left positions : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getTransformedPositions 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#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLabelPaint AST#member_expression#Right AST#expression#Right . setFontFamily 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 . mYAxis AST#member_expression#Right AST#expression#Right . getTypeface 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLabelPaint AST#member_expression#Right AST#expression#Right . setTextSize 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 . mYAxis AST#member_expression#Right AST#expression#Right . getTextSize 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLabelPaint AST#member_expression#Right AST#expression#Right . setColor 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 . mYAxis AST#member_expression#Right AST#expression#Right . getTextColor 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisLabelPaint AST#member_expression#Right AST#expression#Right . setTextAlign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "center" 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 baseYOffset = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . handleDataValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2.5 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 textHeight = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . getLabelTextSize 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 . mAxisLabelPaint AST#member_expression#Right AST#expression#Right , AST#expression#Left "Q" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSizeCache AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_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#variable_declaration#Left let AST#variable_declarator#Left dependency : AST#type_annotation#Left AST#primary_type#Left AxisDependency 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 . mYAxis AST#member_expression#Right AST#expression#Right . getAxisDependency AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left labelPosition : AST#type_annotation#Left AST#primary_type#Left YAxisLabelPosition 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 . mYAxis AST#member_expression#Right AST#expression#Right . getLabelPosition AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left yPos : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left dependency AST#expression#Right == AST#expression#Left AxisDependency AST#expression#Right AST#binary_expression#Right AST#expression#Right . LEFT AST#member_expression#Right 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 labelPosition AST#expression#Right == AST#expression#Left YAxisLabelPosition AST#expression#Right AST#binary_expression#Right AST#expression#Right . OUTSIDE_CHART 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 yPos = 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#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentTop 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 baseYOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left yPos = 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#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentTop 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 baseYOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else 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 labelPosition AST#expression#Right == AST#expression#Left YAxisLabelPosition AST#expression#Right AST#binary_expression#Right AST#expression#Right . OUTSIDE_CHART 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 yPos = 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#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentBottom 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 textHeight AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left baseYOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left yPos = 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#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler AST#member_expression#Right AST#expression#Right . contentBottom 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 textHeight AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left baseYOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 . drawYLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left c AST#expression#Right , AST#expression#Left yPos AST#expression#Right , AST#expression#Left positions AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mYAxis AST#member_expression#Right AST#expression#Right . getYOffset 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#block_statement#Right AST#method_declaration#Right
public renderAxisLabels(c: CanvasRenderingContext2D): void { if (!this.mYAxis || !this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled() || !this.mViewPortHandler) { return; } let positions: number[] = this.getTransformedPositions(); this.mAxisLabelPaint.setFontFamily(this.mYAxis.getTypeface()); this.mAxisLabelPaint.setTextSize(this.mYAxis.getTextSize()); this.mAxisLabelPaint.setColor(this.mYAxis.getTextColor()); this.mAxisLabelPaint.setTextAlign("center"); let baseYOffset = Utils.handleDataValues(2.5); let textHeight = Utils.getLabelTextSize(this.mAxisLabelPaint, "Q", this.textSizeCache).height; let dependency: AxisDependency = this.mYAxis.getAxisDependency(); let labelPosition: YAxisLabelPosition = this.mYAxis.getLabelPosition(); let yPos: number = 0; if (dependency == AxisDependency.LEFT) { if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) { yPos = this.mViewPortHandler.contentTop() - baseYOffset; } else { yPos = this.mViewPortHandler.contentTop() - baseYOffset; } } else { if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) { yPos = this.mViewPortHandler.contentBottom() + textHeight + baseYOffset; } else { yPos = this.mViewPortHandler.contentBottom() + textHeight + baseYOffset; } } this.drawYLabels(c, yPos, positions, this.mYAxis.getYOffset()); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/YAxisRendererHorizontalBarChart.ets#L77-L116
f96c2f23a3cb2b12ec4fc2545cb713585cc0b10c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
publishPicture
发布带有图片的通知 @param options 通知实体 @returns
static async publishPicture(options: NotificationPictureOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。 const pictureContent: notificationManager.NotificationPictureContent = { title: options.title, text: options.text, briefText: options.briefText, expandedTitle: options.expandedTitle, picture: options.picture } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { pictureContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { pictureContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE, picture: pictureContent } //通知Request对象 const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); //发送通知 return notificationId; }
AST#method_declaration#Left static async publishPicture AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationPictureOptions 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 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . generateNotificationId 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 //通知ID。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pictureContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationPictureContent 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 AST#member_expression#Left AST#expression#Left options AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . text AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left briefText AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . briefText AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expandedTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . expandedTitle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left picture AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . picture 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#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 options AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText 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 pictureContent AST#expression#Right . additionalText AST#member_expression#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 options AST#expression#Right . additionalText AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . additionalText 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . lockscreenPicture AST#member_expression#Right AST#expression#Right || AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture 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 pictureContent AST#expression#Right . lockscreenPicture AST#member_expression#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 options AST#expression#Right . lockscreenPicture AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NotificationUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultConfig AST#member_expression#Right AST#expression#Right . lockscreenPicture 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#variable_declaration#Left let AST#variable_declarator#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent 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 notificationContentType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . ContentType AST#member_expression#Right AST#expression#Right . NOTIFICATION_CONTENT_PICTURE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left picture AST#property_name#Right : AST#expression#Left pictureContent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right //通知Request对象 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notificationRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationUtil AST#expression#Right . getNotificationRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationId AST#expression#Right , AST#expression#Left options AST#expression#Right , AST#expression#Left notificationContent 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left notificationRequest 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 notificationId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async publishPicture(options: NotificationPictureOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); const pictureContent: notificationManager.NotificationPictureContent = { title: options.title, text: options.text, briefText: options.briefText, expandedTitle: options.expandedTitle, picture: options.picture } if (options.additionalText || NotificationUtil.defaultConfig.additionalText) { pictureContent.additionalText = options.additionalText ?? NotificationUtil.defaultConfig.additionalText; } if (options.lockscreenPicture || NotificationUtil.defaultConfig.lockscreenPicture) { pictureContent.lockscreenPicture = options.lockscreenPicture ?? NotificationUtil.defaultConfig.lockscreenPicture; } let notificationContent: notificationManager.NotificationContent = { notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE, picture: pictureContent } const notificationRequest = NotificationUtil.getNotificationRequest(notificationId, options, notificationContent); await notificationManager.publish(notificationRequest); return notificationId; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L232-L255
d515cac8286c3dcb013c3afc3cb9675a610fbfd8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
saveConfig
保存配置
private async saveConfig(): Promise<void> { if (!this.apiKey.trim()) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'API key is required'); return; } try { this.loading = true; const config: LLMConfig = { provider: this.selectedProvider, apiKey: this.apiKey.trim(), baseUrl: this.baseUrl.trim() || undefined, model: this.model.trim(), maxTokens: this.maxTokens, temperature: this.temperature }; this.llmService.configure(config); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'LLM configuration saved successfully'); // 返回设置页面 appRouter.back(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to save LLM config: ${error}`); } finally { this.loading = false; } }
AST#method_declaration#Left private async saveConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . apiKey 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#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 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 'API key is required' 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loading 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left config : AST#type_annotation#Left AST#primary_type#Left LLMConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left provider AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedProvider AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiKey AST#property_name#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 . apiKey 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left baseUrl AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . baseUrl 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#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left model AST#property_name#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 . model 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxTokens AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxTokens AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left temperature AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . temperature 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#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 . llmService AST#member_expression#Right AST#expression#Right . configure AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left config 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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 'LLM configuration saved successfully' 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 appRouter 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#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 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 save LLM config: AST#template_substitution#Left $ { AST#expression#Left error 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#finally_clause#Left finally 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 . loading 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#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async saveConfig(): Promise<void> { if (!this.apiKey.trim()) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'API key is required'); return; } try { this.loading = true; const config: LLMConfig = { provider: this.selectedProvider, apiKey: this.apiKey.trim(), baseUrl: this.baseUrl.trim() || undefined, model: this.model.trim(), maxTokens: this.maxTokens, temperature: this.temperature }; this.llmService.configure(config); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'LLM configuration saved successfully'); appRouter.back(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to save LLM config: ${error}`); } finally { this.loading = false; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L140-L169
2c5ed075039ec4b2caf5968598e89da1ff5054b9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
totalCount
获取数组长度。 @returns {number} 返回数组长度。
public totalCount(): double { return this.dataArray.length; }
AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left double AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public totalCount(): double { return this.dataArray.length; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L159-L161
8ff61875828308bb067fcfec8e95a9b4adbcb81c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
arkts
addLastItem
Add last item to the list.
public addLastItem() { let mediaItem: MediaItem = this.createMediaItem(this.dataArray.length); this.dataArray.splice(this.dataArray.length, 0, mediaItem); this.notifyDataAdd(this.dataArray.length - 1); }
AST#method_declaration#Left public addLastItem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mediaItem : AST#type_annotation#Left AST#primary_type#Left MediaItem 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 . createMediaItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left mediaItem 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 . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#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 . dataArray AST#member_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#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
public addLastItem() { let mediaItem: MediaItem = this.createMediaItem(this.dataArray.length); this.dataArray.splice(this.dataArray.length, 0, mediaItem); this.notifyDataAdd(this.dataArray.length - 1); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L91-L95
9eaad9d8e3276ab8bb245c5a3709f5db6a205335
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets
arkts
pictures of recently play.
export const PICTURE_RECENTLY: PictureItem[] = [ { id: '1', name: '背影', description: '感人的亲情之歌', image: $r("app.media.ic_recently1") }, { id: '2', name: '废墟之上', description: '勇闯无人之境', image: $r("app.media.ic_recently2") }, { id: '3', name: '无根之人', description: '悬疑国产力作', image: $r("app.media.ic_recently3") }, { id: '4', name: '摩天轮', description: '每个人心中都有一个童话', image: $r("app.media.ic_recently4") } ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PICTURE_RECENTLY : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PictureItem [ ] 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 id AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '背影' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left '感人的亲情之歌' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left image AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_recently1" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '2' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '废墟之上' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left '勇闯无人之境' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left image AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_recently2" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '3' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '无根之人' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left '悬疑国产力作' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left image AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_recently3" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '4' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '摩天轮' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left '每个人心中都有一个童话' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left image AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_recently4" AST#expression#Right ) AST#resource_expression#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#export_declaration#Right
export const PICTURE_RECENTLY: PictureItem[] = [ { id: '1', name: '背影', description: '感人的亲情之歌', image: $r("app.media.ic_recently1") }, { id: '2', name: '废墟之上', description: '勇闯无人之境', image: $r("app.media.ic_recently2") }, { id: '3', name: '无根之人', description: '悬疑国产力作', image: $r("app.media.ic_recently3") }, { id: '4', name: '摩天轮', description: '每个人心中都有一个童话', image: $r("app.media.ic_recently4") } ];
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/PictureConstants.ets#L30-L35
1015b8158e0d36f9ab212fcd00276bc57bf36a1b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets
arkts
decodeByFormat
设置期望的format直接解码resources下的图片资源 @returns 位图操作对象。
public async decodeByFormat(): Promise<image.PixelMap> { Logger.info('getPixelMap DecodeByFormat Start'); // [Start pixelmap_decode_using_RGBA_8888_format] let img = await getContext(this).resourceManager.getMediaContent($r('app.media.image')); let imageSource: image.ImageSource = image.createImageSource(img.buffer.slice(0)); let decodingOptions: image.DecodingOptions = { editable: true, desiredPixelFormat: 3, // 以RGBA_8888格式进行解码 } return new Promise((resolve, reject) => { // 创建pixelMap imageSource.createPixelMap(decodingOptions).then((pixelMap: image.PixelMap) => { Logger.info('decodeByFormat: ', 'Succeeded in creating PixelMap'); resolve(pixelMap); }).catch((err: BusinessError) => { Logger.error('decodeByFormat: ', 'Failed to create PixelMap'); reject(err); }); // [Start pixelmap_release_image_source] imageSource.release(); // [End pixelmap_release_image_source] }); // [End pixelmap_decode_using_RGBA_8888_format] }
AST#method_declaration#Left public async decodeByFormat AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getPixelMap DecodeByFormat Start' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [Start pixelmap_decode_using_RGBA_8888_format] AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left img = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getContext AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.image' AST#expression#Right ) AST#resource_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 imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left img AST#expression#Right . buffer 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#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 decodingOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions 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 editable AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left desiredPixelFormat AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , // 以RGBA_8888格式进行解码 } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#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#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 创建pixelMap 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 imageSource AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left decodingOptions 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 pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'decodeByFormat: ' AST#expression#Right , AST#expression#Left 'Succeeded in creating PixelMap' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'decodeByFormat: ' AST#expression#Right , AST#expression#Left 'Failed to create PixelMap' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject 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_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 // [Start pixelmap_release_image_source] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageSource AST#expression#Right . release 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 // [End pixelmap_release_image_source] } 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 // [End pixelmap_decode_using_RGBA_8888_format] } AST#block_statement#Right AST#method_declaration#Right
public async decodeByFormat(): Promise<image.PixelMap> { Logger.info('getPixelMap DecodeByFormat Start'); let img = await getContext(this).resourceManager.getMediaContent($r('app.media.image')); let imageSource: image.ImageSource = image.createImageSource(img.buffer.slice(0)); let decodingOptions: image.DecodingOptions = { editable: true, desiredPixelFormat: 3, } return new Promise((resolve, reject) => { imageSource.createPixelMap(decodingOptions).then((pixelMap: image.PixelMap) => { Logger.info('decodeByFormat: ', 'Succeeded in creating PixelMap'); resolve(pixelMap); }).catch((err: BusinessError) => { Logger.error('decodeByFormat: ', 'Failed to create PixelMap'); reject(err); }); imageSource.release(); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L193-L216
89ebdfab61dbecf87a7bde172c52ca6334c40d25
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets
arkts
handleDreamSelection
梦想选择按钮点击事件
handleDreamSelection(): void { // 显示梦想选择对话框 if (this.dreams.length > 0) { // 创建结构化的按钮数组 const dreamButtons: promptAction.Button[] = this.dreams.map((dream: Dream) => { const button: promptAction.Button = { text: dream.title, color: $r('app.color.text_primary') }; return button; }); // 添加取消按钮 const buttonCancel: promptAction.Button = { text: '取消', color: $r('app.color.text_secondary') }; // 所有按钮,包括梦想和取消 const allButtons: promptAction.Button[] = [...dreamButtons, buttonCancel]; const dialogOptions: promptAction.ShowDialogOptions = { title: '请选择关联的梦想目标', message: '选择一个梦想关联到此任务', buttons: allButtons }; prompt.showDialog(dialogOptions) .then((result: DialogResultType) => { if (result.index < this.dreams.length) { // 用户选择了某个梦想 const selectedDream = this.dreams[result.index]; if (selectedDream && selectedDream.id !== undefined && selectedDream.id > 0) { this.task.dreamId = selectedDream.id; this.selectedDream = selectedDream; } } else { // 用户选择了取消 console.info('取消选择梦想'); } }) .catch((err: Error) => { console.error(`对话框错误: ${err}`); }); } else { const toastOptions: promptAction.ShowToastOptions = { message: '暂无可选梦想,请先创建梦想', duration: 2000 }; prompt.showToast(toastOptions); } }
AST#method_declaration#Left handleDreamSelection 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dreams 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#block_statement#Left { // 创建结构化的按钮数组 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dreamButtons : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left promptAction AST#ERROR#Left . Button AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dreams AST#member_expression#Right AST#expression#Right . map 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 dream : AST#type_annotation#Left AST#primary_type#Left Dream 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 const AST#variable_declarator#Left button : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . Button 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 text AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left dream AST#expression#Right . title 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#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left button 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#variable_declaration#Left const AST#variable_declarator#Left buttonCancel : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . Button 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 text AST#property_name#Right : AST#expression#Left '取消' 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.text_secondary' AST#expression#Right ) AST#resource_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 const AST#variable_declarator#Left allButtons : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left promptAction AST#ERROR#Left . Button 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 dreamButtons AST#expression#Right , AST#expression#Left buttonCancel 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 dialogOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowDialogOptions 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 '请选择关联的梦想目标' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '选择一个梦想关联到此任务' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left buttons AST#property_name#Right : AST#expression#Left allButtons 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#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 prompt AST#expression#Right . showDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dialogOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left DialogResultType 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#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 . index AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . dreams AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 用户选择了某个梦想 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left selectedDream = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dreams AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . index AST#member_expression#Right AST#expression#Right ] AST#subscript_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 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 selectedDream AST#expression#Right && AST#expression#Left selectedDream AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left selectedDream AST#expression#Right AST#binary_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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . task AST#member_expression#Right AST#expression#Right . dreamId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left selectedDream AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedDream AST#member_expression#Right = AST#expression#Left selectedDream 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 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 '取消选择梦想' 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 . 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 Error 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 . 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 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#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 else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toastOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions 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 message AST#property_name#Right : AST#expression#Left '暂无可选梦想,请先创建梦想' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#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 prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions 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#method_declaration#Right
handleDreamSelection(): void { if (this.dreams.length > 0) { const dreamButtons: promptAction.Button[] = this.dreams.map((dream: Dream) => { const button: promptAction.Button = { text: dream.title, color: $r('app.color.text_primary') }; return button; }); const buttonCancel: promptAction.Button = { text: '取消', color: $r('app.color.text_secondary') }; const allButtons: promptAction.Button[] = [...dreamButtons, buttonCancel]; const dialogOptions: promptAction.ShowDialogOptions = { title: '请选择关联的梦想目标', message: '选择一个梦想关联到此任务', buttons: allButtons }; prompt.showDialog(dialogOptions) .then((result: DialogResultType) => { if (result.index < this.dreams.length) { const selectedDream = this.dreams[result.index]; if (selectedDream && selectedDream.id !== undefined && selectedDream.id > 0) { this.task.dreamId = selectedDream.id; this.selectedDream = selectedDream; } } else { console.info('取消选择梦想'); } }) .catch((err: Error) => { console.error(`对话框错误: ${err}`); }); } else { const toastOptions: promptAction.ShowToastOptions = { message: '暂无可选梦想,请先创建梦想', duration: 2000 }; prompt.showToast(toastOptions); } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L1116-L1167
9880cd1a0c68e706e07e993a2c4871c5fd20d034
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringEncrypt.ets
arkts
addedSalt
给字符串添加随机盐值 @param str 要加盐的字符串 @returns 加盐后的字符串或null
static addedSalt(str: string | null): string | null { return SaltUtil.addSalt(str); }
AST#method_declaration#Left static addedSalt AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { 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 SaltUtil AST#expression#Right . addSalt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str 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 addedSalt(str: string | null): string | null { return SaltUtil.addSalt(str); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L33-L35
cfd3ed0588e85be6b696c1873f1dccf71c886e6c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
分页信息接口
export interface PaginationInfo { current: number; pageSize: number; total: number; totalPages: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface PaginationInfo AST#object_type#Left { AST#type_member#Left current : 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 pageSize : 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 total : 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 totalPages : 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 PaginationInfo { current: number; pageSize: number; total: number; totalPages: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L23-L28
1aeba35a89e1ebe351cda1618a05bcb0d9968500
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/KvUtil.ets
arkts
put
存储数据 @param key 存入的key @param value 存入的数据 @returns 存储结果
async put(key: string, value: boolean | string | number | Uint8Array): Promise<string> { let isAuth = await this.getAuth(); if (isAuth) { await this.kvStore?.put(key, value); return "存入数据:" + key + "成功~"; } return "用户禁止授权,存储失败~"; }
AST#method_declaration#Left async put 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 value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number 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#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 isAuth = 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 . getAuth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isAuth AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . kvStore AST#member_expression#Right AST#expression#Right ?. put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left value 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "存入数据:" AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_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#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#method_declaration#Right
async put(key: string, value: boolean | string | number | Uint8Array): Promise<string> { let isAuth = await this.getAuth(); if (isAuth) { await this.kvStore?.put(key, value); return "存入数据:" + key + "成功~"; } return "用户禁止授权,存储失败~"; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L104-L111
4c3566e27edf061cd0a927192af4707ade81a4e0
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/pages/Index.ets
arkts
scan
扫描wifi
async scan() { // 获取有关Wi-Fi连接的信息,存入linkedInfo await this.getLinkedInfo(); // 不停地扫描wifi let result: Array<WifiType> = await this.wifiModel.getScanInfos(); if (this.isSwitchOn) { AppStorage.SetOrCreate('wifiList', result); setTimeout(async () => { await this.scan(); }, 3000) } }
AST#method_declaration#Left async scan AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取有关Wi-Fi连接的信息,存入linkedInfo AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getLinkedInfo 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 // 不停地扫描wifi AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : 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 WifiType 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#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 . wifiModel AST#member_expression#Right AST#expression#Right . getScanInfos AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSwitchOn 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 AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'wifiList' AST#expression#Right , AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . scan 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#expression#Left 3000 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#method_declaration#Right
async scan() { await this.getLinkedInfo(); let result: Array<WifiType> = await this.wifiModel.getScanInfos(); if (this.isSwitchOn) { AppStorage.SetOrCreate('wifiList', result); setTimeout(async () => { await this.scan(); }, 3000) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/pages/Index.ets#L33-L44
482702bf53af245b5b582be9e9a4576bf62c3431
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clockin/Index.ets
arkts
ClockInComponent
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 { ClockInComponent } from './src/main/ets/components/ClockInComponent';
AST#export_declaration#Left export { ClockInComponent } from './src/main/ets/components/ClockInComponent' ; AST#export_declaration#Right
export { ClockInComponent } from './src/main/ets/components/ClockInComponent';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clockin/Index.ets#L16-L16
d6a3afdd5ff9929eb72262a23fb168144860c90a
gitee
openharmony/communication_wifi
387ba7fa8f98578629a6148635a4d630b2b99aa1
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/index.ets
arkts
onDevicesChange
获取p2p设备列表
private onDevicesChange() { logUtil.log("onDevicesChange"); this.p2pDeviceList = [] wifiModel.getP2pDevicesCallBack().then((list) => { logUtil.log('----------------------------- ' + JSON.stringify(list)) for (let i = 0;i < JSON.parse(JSON.stringify(list)) .length; i++) { if (this.checkDouble(list[i].macAddress)) { continue } this.p2pDeviceList.push(new WifiEntity(i, list[i].ssid, list[i].macAddress, list[i].status)) } logUtil.log('this.p2pDeviceList ... ' + JSON.stringify(this.p2pDeviceList)) }); }
AST#method_declaration#Left private onDevicesChange 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 logUtil AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "onDevicesChange" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . p2pDeviceList 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 wifiModel AST#expression#Right . getP2pDevicesCallBack AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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 list 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 . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '----------------------------- ' AST#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 list 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . parse 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 JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left list 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 . 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . checkDouble AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left list AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . macAddress AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left continue AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . p2pDeviceList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left WifiEntity AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left list AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . ssid AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left list AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . macAddress AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left list AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . status 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#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 . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'this.p2pDeviceList ... ' 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . p2pDeviceList 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#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
private onDevicesChange() { logUtil.log("onDevicesChange"); this.p2pDeviceList = [] wifiModel.getP2pDevicesCallBack().then((list) => { logUtil.log('----------------------------- ' + JSON.stringify(list)) for (let i = 0;i < JSON.parse(JSON.stringify(list)) .length; i++) { if (this.checkDouble(list[i].macAddress)) { continue } this.p2pDeviceList.push(new WifiEntity(i, list[i].ssid, list[i].macAddress, list[i].status)) } logUtil.log('this.p2pDeviceList ... ' + JSON.stringify(this.p2pDeviceList)) }); }
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/pages/index.ets#L324-L338
95a75a995a4a3679051db4375fc1e6d1a6bbfca9
gitee
Huarrrr/MiShop_HarmonyOS.git
a94d941f50550522c8324416afe4551ed4a2df93
entry/src/main/ets/net/cookie/CookieUtils.ets
arkts
parseHttpRequestCookies
httpRequest 返回的 cookie 格式: ``` #HttpOnly_www.wanandroid.com FALSE / TRUE 0 JSESSIONID 564CB756D6C2F19456141DA377A0D692 www.wanandroid.com FALSE / FALSE 1705495544 loginUserName chaywong www.wanandroid.com FALSE / FALSE 1705495544 token_pass d4fb1b1219a552003c5ec2e93221b0b0 .wanandroid.com TRUE / FALSE 1705495544 loginUserName_wanandroid_com chaywong .wanandroid.com TRUE / FALSE 1705495544 token_pass_wanandroid_com d4fb1b1219a552003c5ec2e93221b0b0 ```
static parseHttpRequestCookies(cookieString: string): Array<Cookie> { if (!cookieString) return []; let cookies: Array<Cookie> = []; let lines = cookieString.split("\r\n"); lines.forEach((line) => { let attrs = line.split("\t"); if (attrs.length !== 7 || !attrs[0]) return; let cookie = new Cookie(); let domain = attrs[0]; if (domain.startsWith("#HttpOnly_")) { domain = domain.substring("#HttpOnly_".length); cookie.httpOnly = true; } cookie.domain = domain; cookie.path = attrs[2]; cookie.expiresAt = parseInt(attrs[4]); cookie.name = attrs[5]; cookie.value = attrs[6]; cookies.push(cookie); }) return cookies; }
AST#method_declaration#Left static parseHttpRequestCookies AST#parameter_list#Left ( AST#parameter#Left cookieString : 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Cookie 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 cookieString AST#expression#Right AST#unary_expression#Right AST#expression#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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cookies : 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 Cookie 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#variable_declaration#Left let AST#variable_declarator#Left lines = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cookieString AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "\r\n" 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 lines 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 line AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left attrs = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left line AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "\t" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left attrs AST#expression#Right . length AST#member_expression#Right AST#expression#Right !== AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left attrs AST#expression#Right AST#unary_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cookie = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Cookie 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#variable_declaration#Left let AST#variable_declarator#Left domain = AST#expression#Left AST#subscript_expression#Left AST#expression#Left attrs AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left domain AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "#HttpOnly_" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left domain = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left domain AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left "#HttpOnly_" AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cookie AST#expression#Right . httpOnly 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left cookie AST#expression#Right . domain AST#member_expression#Right = AST#expression#Left domain 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 cookie AST#expression#Right . path AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left attrs AST#expression#Right [ AST#expression#Left 2 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left cookie AST#expression#Right . expiresAt AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left attrs AST#expression#Right [ AST#expression#Left 4 AST#expression#Right ] AST#subscript_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 cookie AST#expression#Right . name AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left attrs AST#expression#Right [ AST#expression#Left 5 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left cookie AST#expression#Right . value AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left attrs AST#expression#Right [ AST#expression#Left 6 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 cookies AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cookie 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#return_statement#Left return AST#expression#Left cookies AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static parseHttpRequestCookies(cookieString: string): Array<Cookie> { if (!cookieString) return []; let cookies: Array<Cookie> = []; let lines = cookieString.split("\r\n"); lines.forEach((line) => { let attrs = line.split("\t"); if (attrs.length !== 7 || !attrs[0]) return; let cookie = new Cookie(); let domain = attrs[0]; if (domain.startsWith("#HttpOnly_")) { domain = domain.substring("#HttpOnly_".length); cookie.httpOnly = true; } cookie.domain = domain; cookie.path = attrs[2]; cookie.expiresAt = parseInt(attrs[4]); cookie.name = attrs[5]; cookie.value = attrs[6]; cookies.push(cookie); }) return cookies; }
https://github.com/Huarrrr/MiShop_HarmonyOS.git/blob/a94d941f50550522c8324416afe4551ed4a2df93/entry/src/main/ets/net/cookie/CookieUtils.ets#L15-L36
c184fa092da7407b192fad4c1cc970b307e6c312
github
openharmony/graphic_graphic_2d
46a11e91c9709942196ad2a7afea2e0fcd1349f3
frameworks/text/interface/export/ani/@ohos.graphics.text.ets
arkts
Builds a Paragraph containing text with the given styling information. @syscap SystemCapability.Graphics.Drawing @since 12
export class ParagraphBuilder { static { loadLibraryWithPermissionCheck('text_engine_ani.z', "@ohos.graphics.text") }
AST#export_declaration#Left export AST#class_declaration#Left class ParagraphBuilder AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left 'text_engine_ani.z' , "@ohos.graphics.text" 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 ParagraphBuilder { static { loadLibraryWithPermissionCheck('text_engine_ani.z', "@ohos.graphics.text") }
https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/frameworks/text/interface/export/ani/@ohos.graphics.text.ets#L123-L124
f845ac8dbdc88349e745397b1106a372e003ad2e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fadingedge/src/main/ets/mainpage/MainPage.ets
arkts
FadingEdgeComponent
功能描述:本案例介绍组件内容边缘渐变的实现,通常用于提示长列表滑动到边缘的场景。 推荐场景:电商、邮箱、资讯、门户等需要降低视觉噪音的场景 核心组件: 1.FadingEdgeComponent 实现思路: 1. 创建可滚动的主页面。 2. 利用颜色渐变通用属性,创建两端渐隐的自定义组件。 3. 通过overlay通用属性,设置子组件为遮罩层。
@Component export struct FadingEdgeComponent { private textArray: number[] = []; // 渐变起始和终止颜色 @State linearGradientBeginColor: string = Const.BEGIN_COLOR; @State linearGradientEndColor: string = Const.END_COLOR; private scroller: Scroller = new Scroller(); aboutToAppear(): void { for (let i = 0; i < Const.ITEM_COUNT; i++) { this.textArray.push(i); } } build() { Scroll(){ Column({ space: Const.ROOT_GAP }) { Row({ space: Const.MENU_ITEM_SPACE }) { this.controlBarItem($r("app.media.fadingedge_order"), $r('app.string.fadingedge_order')); this.controlBarItem($r("app.media.fadingedge_coupon"), $r('app.string.fadingedge_coupon')); this.controlBarItem($r("app.media.fadingedge_footprint"), $r('app.string.fadingedge_footprint')); this.controlBarItem($r("app.media.fadingedge_tip"), $r('app.string.fadingedge_tip')); this.controlBarItem($r("app.media.fadingedge_wallet"), $r('app.string.fadingedge_wallet')); } .width($r('app.string.fadingedge_fill_size')) .justifyContent(FlexAlign.SpaceAround) .backgroundColor($r('app.color.fadingedge_menu_background_color')) .padding($r('app.integer.fadingedge_menu_padding')) .borderRadius($r('app.integer.fadingedge_menu_border_radius')) .onClick(() => { this.promptToast(); }) // 广告图片banner Image($r("app.media.fadingedge_example3")) .width($r('app.string.fadingedge_fill_size')) .borderRadius($r('app.integer.fadingedge_banner_border_radius')) .backgroundColor($r('app.color.fadingedge_banner_background_color')) .padding($r('app.integer.fadingedge_banner_padding')) .onClick(() => { this.promptToast(); }) // 主体 List({ space: Const.EXAMPLE_IMAGE_GAP, scroller: this.scroller }) { ForEach(this.textArray, () => { ListItem() { Image($r("app.media.fadingedge_example1")) .width($r('app.integer.fadingedge_example_image_width')) .height($r('app.integer.fadingedge_example_image_height')) .borderRadius($r('app.integer.fadingedge_example_image_border_radius')) } }, (item: number) => item.toString()) } .listDirection(Axis.Horizontal) .width($r('app.string.fadingedge_fill_size')) .height($r('app.integer.fadingedge_list_height')) .overlay(this.fadingOverlay()) .edgeEffect(EdgeEffect.None) .scrollBar(BarState.Off) .onReachStart(() => { this.linearGradientBeginColor = Const.BEGIN_COLOR; this.linearGradientEndColor = Const.END_COLOR; }) .onReachEnd(() => { this.linearGradientBeginColor = Const.END_COLOR; this.linearGradientEndColor = Const.BEGIN_COLOR; }) .onDidScroll((scrollOffset: number, scrollState: ScrollState)=>{ // 列表滑动到于中间位置时,两侧都有边缘渐变效果 if(this.scroller.currentOffset().xOffset !== 0 && !this.scroller.isAtEnd()){ this.linearGradientBeginColor = Const.END_COLOR; this.linearGradientEndColor = Const.END_COLOR; } }) // 其余填充 Image($r("app.media.fadingedge_example2")) .objectFit(ImageFit.Contain) .borderRadius($r('app.integer.fadingedge_other_border_radius')) .width($r('app.string.fadingedge_fill_size')) .backgroundColor($r('app.color.fadingedge_others_background_color')) .borderRadius($r('app.integer.fadingedge_other_border_radius')) .onClick(() => { this.promptToast(); }) } .width($r('app.string.fadingedge_fill_size')) .padding($r('app.integer.fadingedge_root_padding')) } .width($r('app.string.fadingedge_fill_size')) .height($r('app.string.fadingedge_fill_size')) .scrollBar(BarState.Off) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } /** * 菜单栏组件。 * @param image * @param text */ @Builder controlBarItem(image: ResourceStr, text: ResourceStr) { Column({ space: Const.MENU_ITEM_COL_SPACE }) { Image(image) .width($r('app.integer.fadingedge_menu_item_image_width')) .height($r('app.integer.fadingedge_menu_item_image_height')) Text(text) } .padding($r('app.integer.fadingedge_menu_item_padding')) } /** * 浮层组件。 */ @Builder fadingOverlay() { Column() .width($r('app.string.fadingedge_fill_size')) .height($r('app.integer.fadingedge_list_height'))// TODO: 知识点: linearGradient 可以设置指定范围内的颜色渐变效果 .linearGradient({ angle: Const.OVERLAY_LINEAR_GRADIENT_ANGLE, colors: [ [this.linearGradientBeginColor, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[0]], [Const.BEGIN_COLOR, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[1]], [Const.BEGIN_COLOR, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[2]], [this.linearGradientEndColor, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[3]], ] }) .animation({ curve: Curve.Ease, duration: Const.DURATION }) .hitTestBehavior(HitTestMode.Transparent) } /** * 示例提示toast窗口 */ promptToast() { promptAction.showToast({ message: $r('app.string.fadingedge_prompt_message'), duration: Const.PROMPT_TOAST_DURATION }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FadingEdgeComponent AST#component_body#Left { AST#property_declaration#Left private textArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 渐变起始和终止颜色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right linearGradientBeginColor : 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 Const AST#expression#Right . BEGIN_COLOR AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right linearGradientEndColor : 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 Const AST#expression#Right . END_COLOR AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller 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 Scroller 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_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . ITEM_COUNT 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#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 . textArray AST#member_expression#Right AST#expression#Right . push 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ROOT_GAP 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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . MENU_ITEM_SPACE AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controlBarItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.fadingedge_order" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_order' AST#expression#Right ) AST#resource_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 . controlBarItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.fadingedge_coupon" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_coupon' AST#expression#Right ) AST#resource_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 . controlBarItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.fadingedge_footprint" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_footprint' AST#expression#Right ) AST#resource_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 . controlBarItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.fadingedge_tip" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_tip' AST#expression#Right ) AST#resource_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 . controlBarItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.fadingedge_wallet" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_wallet' AST#expression#Right ) AST#resource_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 AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_fill_size' 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 . SpaceAround 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.fadingedge_menu_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.fadingedge_menu_padding' 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.integer.fadingedge_menu_border_radius' 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 this AST#expression#Right . promptToast 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#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 // 广告图片banner 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.fadingedge_example3" 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.string.fadingedge_fill_size' 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.integer.fadingedge_banner_border_radius' 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.fadingedge_banner_background_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.fadingedge_banner_padding' 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 this AST#expression#Right . promptToast 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#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 List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . EXAMPLE_IMAGE_GAP AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textArray AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( ) 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.fadingedge_example1" 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.fadingedge_example_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.fadingedge_example_image_height' 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.integer.fadingedge_example_image_border_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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item 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#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 . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_fill_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.fadingedge_list_height' 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 this AST#expression#Right . fadingOverlay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onReachStart ( 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 . linearGradientBeginColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . BEGIN_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . linearGradientEndColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . END_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onReachEnd ( 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 . linearGradientBeginColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . END_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . linearGradientEndColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . BEGIN_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDidScroll ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left scrollOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left scrollState : AST#type_annotation#Left AST#primary_type#Left ScrollState 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#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#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . currentOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . xOffset 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . isAtEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . linearGradientBeginColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . END_COLOR AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . linearGradientEndColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . END_COLOR 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 其余填充 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.fadingedge_example2" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#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 . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.fadingedge_other_border_radius' 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.fadingedge_fill_size' 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.fadingedge_others_background_color' 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.integer.fadingedge_other_border_radius' 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 this AST#expression#Right . promptToast 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_fill_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.fadingedge_root_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_fill_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_fill_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /** * 菜单栏组件。 * @param image * @param text */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right controlBarItem AST#parameter_list#Left ( AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : 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#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 Const AST#expression#Right . MENU_ITEM_COL_SPACE 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 image 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.fadingedge_menu_item_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.fadingedge_menu_item_image_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left text AST#expression#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 . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.fadingedge_menu_item_padding' 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#builder_function_body#Right AST#method_declaration#Right /** * 浮层组件。 */ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right fadingOverlay AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_fill_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.fadingedge_list_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) // TODO: 知识点: linearGradient 可以设置指定范围内的颜色渐变效果 AST#modifier_chain_expression#Left . linearGradient ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OVERLAY_LINEAR_GRADIENT_ANGLE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left colors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . linearGradientBeginColor AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OVERLAY_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . BEGIN_COLOR AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OVERLAY_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . BEGIN_COLOR AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OVERLAY_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . linearGradientEndColor AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OVERLAY_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . animation ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Ease AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . hitTestBehavior ( AST#expression#Left AST#member_expression#Left AST#expression#Left HitTestMode AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 示例提示toast窗口 */ AST#method_declaration#Left promptToast 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.fadingedge_prompt_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . PROMPT_TOAST_DURATION 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct FadingEdgeComponent { private textArray: number[] = []; @State linearGradientBeginColor: string = Const.BEGIN_COLOR; @State linearGradientEndColor: string = Const.END_COLOR; private scroller: Scroller = new Scroller(); aboutToAppear(): void { for (let i = 0; i < Const.ITEM_COUNT; i++) { this.textArray.push(i); } } build() { Scroll(){ Column({ space: Const.ROOT_GAP }) { Row({ space: Const.MENU_ITEM_SPACE }) { this.controlBarItem($r("app.media.fadingedge_order"), $r('app.string.fadingedge_order')); this.controlBarItem($r("app.media.fadingedge_coupon"), $r('app.string.fadingedge_coupon')); this.controlBarItem($r("app.media.fadingedge_footprint"), $r('app.string.fadingedge_footprint')); this.controlBarItem($r("app.media.fadingedge_tip"), $r('app.string.fadingedge_tip')); this.controlBarItem($r("app.media.fadingedge_wallet"), $r('app.string.fadingedge_wallet')); } .width($r('app.string.fadingedge_fill_size')) .justifyContent(FlexAlign.SpaceAround) .backgroundColor($r('app.color.fadingedge_menu_background_color')) .padding($r('app.integer.fadingedge_menu_padding')) .borderRadius($r('app.integer.fadingedge_menu_border_radius')) .onClick(() => { this.promptToast(); }) Image($r("app.media.fadingedge_example3")) .width($r('app.string.fadingedge_fill_size')) .borderRadius($r('app.integer.fadingedge_banner_border_radius')) .backgroundColor($r('app.color.fadingedge_banner_background_color')) .padding($r('app.integer.fadingedge_banner_padding')) .onClick(() => { this.promptToast(); }) List({ space: Const.EXAMPLE_IMAGE_GAP, scroller: this.scroller }) { ForEach(this.textArray, () => { ListItem() { Image($r("app.media.fadingedge_example1")) .width($r('app.integer.fadingedge_example_image_width')) .height($r('app.integer.fadingedge_example_image_height')) .borderRadius($r('app.integer.fadingedge_example_image_border_radius')) } }, (item: number) => item.toString()) } .listDirection(Axis.Horizontal) .width($r('app.string.fadingedge_fill_size')) .height($r('app.integer.fadingedge_list_height')) .overlay(this.fadingOverlay()) .edgeEffect(EdgeEffect.None) .scrollBar(BarState.Off) .onReachStart(() => { this.linearGradientBeginColor = Const.BEGIN_COLOR; this.linearGradientEndColor = Const.END_COLOR; }) .onReachEnd(() => { this.linearGradientBeginColor = Const.END_COLOR; this.linearGradientEndColor = Const.BEGIN_COLOR; }) .onDidScroll((scrollOffset: number, scrollState: ScrollState)=>{ if(this.scroller.currentOffset().xOffset !== 0 && !this.scroller.isAtEnd()){ this.linearGradientBeginColor = Const.END_COLOR; this.linearGradientEndColor = Const.END_COLOR; } }) Image($r("app.media.fadingedge_example2")) .objectFit(ImageFit.Contain) .borderRadius($r('app.integer.fadingedge_other_border_radius')) .width($r('app.string.fadingedge_fill_size')) .backgroundColor($r('app.color.fadingedge_others_background_color')) .borderRadius($r('app.integer.fadingedge_other_border_radius')) .onClick(() => { this.promptToast(); }) } .width($r('app.string.fadingedge_fill_size')) .padding($r('app.integer.fadingedge_root_padding')) } .width($r('app.string.fadingedge_fill_size')) .height($r('app.string.fadingedge_fill_size')) .scrollBar(BarState.Off) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) } @Builder controlBarItem(image: ResourceStr, text: ResourceStr) { Column({ space: Const.MENU_ITEM_COL_SPACE }) { Image(image) .width($r('app.integer.fadingedge_menu_item_image_width')) .height($r('app.integer.fadingedge_menu_item_image_height')) Text(text) } .padding($r('app.integer.fadingedge_menu_item_padding')) } @Builder fadingOverlay() { Column() .width($r('app.string.fadingedge_fill_size')) .height($r('app.integer.fadingedge_list_height')) .linearGradient({ angle: Const.OVERLAY_LINEAR_GRADIENT_ANGLE, colors: [ [this.linearGradientBeginColor, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[0]], [Const.BEGIN_COLOR, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[1]], [Const.BEGIN_COLOR, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[2]], [this.linearGradientEndColor, Const.OVERLAY_LINEAR_GRADIENT_COLOR_POS[3]], ] }) .animation({ curve: Curve.Ease, duration: Const.DURATION }) .hitTestBehavior(HitTestMode.Transparent) } promptToast() { promptAction.showToast({ message: $r('app.string.fadingedge_prompt_message'), duration: Const.PROMPT_TOAST_DURATION }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fadingedge/src/main/ets/mainpage/MainPage.ets#L33-L178
66d34d6fb8a4aecb73884e9d26613db87dda6c7d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DisplayUtils.ets
arkts
getDensityDPI
其他原有方法保持不变...
public static getDensityDPI(): number { return DisplayUtils._defaultDisplay.densityDPI; }
AST#method_declaration#Left public static getDensityDPI AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DisplayUtils AST#expression#Right . _defaultDisplay AST#member_expression#Right AST#expression#Right . densityDPI AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static getDensityDPI(): number { return DisplayUtils._defaultDisplay.densityDPI; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DisplayUtils.ets#L54-L56
133aa30c316fb083f38c3b0cec824430eb765f04
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_settings.ets
arkts
reset
Resets a setting to default value. @param key A string, the key of the setting.
static reset(key: string) { let index = bunch_of_settings.settings_defaults_key.indexOf(key) let def_value = bunch_of_settings.settings_defaults_value[index] let type = bunch_of_settings.settings_defaults_type[index]; if (index >= 0) { if (type == 'string') { bunch_of_settings.set(key, def_value); } else if (type == 'boolean') { bunch_of_settings.set(key, string_to_boolean(def_value)); } else { // is number bunch_of_settings.set(key, Number.parseFloat(def_value)); } } }
AST#method_declaration#Left static reset 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . settings_defaults_key AST#member_expression#Right AST#expression#Right . indexOf 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left def_value = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . settings_defaults_value AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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 type = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . settings_defaults_type AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_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 index 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left 'string' 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 bunch_of_settings AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left def_value 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left 'boolean' 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 bunch_of_settings AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left string_to_boolean AST#expression#Right AST#argument_list#Left ( AST#expression#Left def_value 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 else AST#block_statement#Left { // is number AST#statement#Left 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 key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . parseFloat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left def_value 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#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static reset(key: string) { let index = bunch_of_settings.settings_defaults_key.indexOf(key) let def_value = bunch_of_settings.settings_defaults_value[index] let type = bunch_of_settings.settings_defaults_type[index]; if (index >= 0) { if (type == 'string') { bunch_of_settings.set(key, def_value); } else if (type == 'boolean') { bunch_of_settings.set(key, string_to_boolean(def_value)); } else { bunch_of_settings.set(key, Number.parseFloat(def_value)); } } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L169-L183
0fda9c4b805b1f8114841940b912c22b5102c9ae
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets
arkts
bind2LocalAddress
绑定本地地址
async bind2LocalAddress() { //本地地址 let localAddress = { address: "0.0.0.0", family: 1 } await tlsSocket.bind(localAddress) .then(() => { this.msgHistory += 'bind success' + "\r\n"; }) .catch((e) => { this.msgHistory += 'bind fail ' + e.message + "\r\n"; }) //收到消息时的处理 tlsSocket.on("message", async (value) => { let msg = buf2String(value.message) let time = await getCurrentTimeString() this.msgHistory += "服务端:" + msg + time + "\r\n" this.scroller.scrollEdge(Edge.Bottom) }) }
AST#method_declaration#Left async bind2LocalAddress AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //本地地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left localAddress = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left "0.0.0.0" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left family AST#property_name#Right : AST#expression#Left 1 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#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#await_expression#Left await AST#expression#Left tlsSocket AST#expression#Right AST#await_expression#Right AST#expression#Right . bind AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left localAddress AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left 'bind success' AST#expression#Right + AST#expression#Left "\r\n" 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#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 e 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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'bind fail ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right + AST#expression#Left "\r\n" 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tlsSocket AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "message" AST#expression#Right , AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left msg = AST#expression#Left AST#call_expression#Left AST#expression#Left buf2String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . message 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#variable_declaration#Left let AST#variable_declarator#Left time = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left getCurrentTimeString AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "服务端:" AST#expression#Right + AST#expression#Left msg AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left time AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "\r\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . scroller AST#member_expression#Right AST#expression#Right . scrollEdge AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Edge AST#expression#Right . Bottom 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#variable_declarator#Right AST#variable_declaration#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 bind2LocalAddress() { let localAddress = { address: "0.0.0.0", family: 1 } await tlsSocket.bind(localAddress) .then(() => { this.msgHistory += 'bind success' + "\r\n"; }) .catch((e) => { this.msgHistory += 'bind fail ' + e.message + "\r\n"; }) tlsSocket.on("message", async (value) => { let msg = buf2String(value.message) let time = await getCurrentTimeString() this.msgHistory += "服务端:" + msg + time + "\r\n" this.scroller.scrollEdge(Edge.Bottom) }) }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L245-L264
b15931c00eced664410de4626948aeb38f3fce87
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/advice/CosDownloaderAdviceData.ets
arkts
uploadUserData
MARK: - 文件上传方法 上传用户数据到腾讯云COS @param filePath 本地文件路径 @param toName 上传后的文件名(例如:101.png) @param proccessing 上传进度回调(0-100) @param finished 完成回调(是否成功、文件路径、错误信息)
public uploadUserData( filePath: string, toName: string, proccessing: (progress: number) => void, finished: (success: boolean, filePath?: string, error?: string) => void ) { // 存储桶名称,由 bucketname-appid 组成,appid 必须填入,可以在 COS 控制台查看存储桶名称。 https://console.cloud.tencent.com/cos5/bucket let bucket = CurrentBucket //对象在存储桶中的位置标识符,即称对象键 let cosPath = `${CosConfig.UserDataPrefix}${toName}` //本地文件路径 let srcPath = filePath let request = new PutObjectRequest(bucket, cosPath, srcPath); request.credential = CosService.shared.getCredential() const task: UploadTask = CosXmlBaseService.default().upload(request); // 6. 设置进度监听 task.onProgress = (progress: HttpProgress) => { // 计算上传百分比(0-100) const percent = Math.floor((progress.complete / progress.target) * 100); proccessing(percent); }; // 7. 设置任务结果回调 task.onResult = { // 上传成功处理 onSuccess: (request, result: CosXmlUploadTaskResult) => { DebugLog.i(`Upload succeeded at: ${result.accessUrl}`); finished(true, `https://zhikabucket-1256782283.cos.ap-shanghai.myqcloud.com/${CosConfig.UserDataPrefix}${toName}`); }, // 上传失败处理 onFail: (request, error: CosError) => { DebugLog.e(`Upload failed: ${error.message}`); finished(false, undefined, error.message ?? "Upload error"); } }; //开始上传 task.start(); //暂停任务 // task.pause(); //恢复任务 // task.resume(); //取消任务 // task.cancel(); }
AST#method_declaration#Left public uploadUserData AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left proccessing : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left progress : 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#Left finished : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filePath ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left error ? : 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#block_statement#Left { // 存储桶名称,由 bucketname-appid 组成,appid 必须填入,可以在 COS 控制台查看存储桶名称。 https://console.cloud.tencent.com/cos5/bucket AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bucket = AST#expression#Left CurrentBucket 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 cosPath = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CosConfig AST#expression#Right . UserDataPrefix AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left toName 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#variable_declaration#Left let AST#variable_declarator#Left srcPath = AST#expression#Left filePath 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 request = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PutObjectRequest AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bucket AST#expression#Right , AST#expression#Left cosPath AST#expression#Right , AST#expression#Left srcPath 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 request AST#expression#Right . credential AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CosService AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . getCredential 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left task : AST#type_annotation#Left AST#primary_type#Left UploadTask 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 CosXmlBaseService AST#expression#Right . default AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . upload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left request 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 // 6. 设置进度监听 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . onProgress AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left HttpProgress AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 计算上传百分比(0-100) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left percent = 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#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left progress AST#expression#Right . complete AST#member_expression#Right AST#expression#Right / AST#expression#Left progress AST#expression#Right AST#binary_expression#Right AST#expression#Right . target AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 100 AST#expression#Right AST#binary_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 proccessing AST#expression#Right AST#argument_list#Left ( AST#expression#Left percent 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 7. 设置任务结果回调 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . onResult AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { // 上传成功处理 AST#property_assignment#Left AST#property_name#Left onSuccess AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left request AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left CosXmlUploadTaskResult 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 DebugLog AST#expression#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Upload succeeded at: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . accessUrl 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 finished AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` https://zhikabucket-1256782283.cos.ap-shanghai.myqcloud.com/ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CosConfig AST#expression#Right . UserDataPrefix AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left toName 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#property_assignment#Right , // 上传失败处理 AST#property_assignment#Left AST#property_name#Left onFail AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left request AST#parameter#Right , AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left CosError 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 DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Upload failed: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left finished AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left undefined AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "Upload error" 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#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //开始上传 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task 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 //暂停任务 // task.pause(); //恢复任务 // task.resume(); //取消任务 // task.cancel(); } AST#block_statement#Right AST#method_declaration#Right
public uploadUserData( filePath: string, toName: string, proccessing: (progress: number) => void, finished: (success: boolean, filePath?: string, error?: string) => void ) { let bucket = CurrentBucket let cosPath = `${CosConfig.UserDataPrefix}${toName}` let srcPath = filePath let request = new PutObjectRequest(bucket, cosPath, srcPath); request.credential = CosService.shared.getCredential() const task: UploadTask = CosXmlBaseService.default().upload(request); task.onProgress = (progress: HttpProgress) => { const percent = Math.floor((progress.complete / progress.target) * 100); proccessing(percent); }; task.onResult = { onSuccess: (request, result: CosXmlUploadTaskResult) => { DebugLog.i(`Upload succeeded at: ${result.accessUrl}`); finished(true, `https://zhikabucket-1256782283.cos.ap-shanghai.myqcloud.com/${CosConfig.UserDataPrefix}${toName}`); }, onFail: (request, error: CosError) => { DebugLog.e(`Upload failed: ${error.message}`); finished(false, undefined, error.message ?? "Upload error"); } }; task.start(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/advice/CosDownloaderAdviceData.ets#L36-L86
9fc7adffc0c7a98c026cd5c5e4f71a83a834531d
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/cross_file/cross_file_003_T/cross_file_003_T_a.ets
arkts
Introduction export-default/import
export default function cross_file_003_T_a(taint_src : string) { return taint_src; }
AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function cross_file_003_T_a 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#return_statement#Left return AST#expression#Left taint_src AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_expression#Right AST#expression#Right AST#export_declaration#Right
export default function cross_file_003_T_a(taint_src : string) { return taint_src; }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_003_T/cross_file_003_T_a.ets#L6-L8
1183c1238b80171442d21beb3a6f38ce324f5160
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets
arkts
mockItem
mock一下桌面静态图的信息
private mockItem(): GridLayoutItemInfo { let mockTemp = new GridLayoutItemInfo(); mockTemp.typeId = CommonConstants.TYPE_IMAGE; mockTemp.page = this.layoutInfo.length; mockTemp.bundleName = SHOPPING_BUNDLE + '1'; mockTemp.row = 0; mockTemp.column = 0; mockTemp.area = CommonConstants.DEFAULT_IMAGE_AREA; return mockTemp; }
AST#method_declaration#Left private mockItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GridLayoutItemInfo AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mockTemp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridLayoutItemInfo 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 mockTemp AST#expression#Right . typeId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TYPE_IMAGE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left mockTemp AST#expression#Right . page AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . layoutInfo AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left mockTemp AST#expression#Right . bundleName AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left SHOPPING_BUNDLE AST#expression#Right + AST#expression#Left '1' 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left mockTemp AST#expression#Right . row AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left mockTemp AST#expression#Right . column AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left mockTemp AST#expression#Right . area AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_IMAGE_AREA AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left mockTemp AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private mockItem(): GridLayoutItemInfo { let mockTemp = new GridLayoutItemInfo(); mockTemp.typeId = CommonConstants.TYPE_IMAGE; mockTemp.page = this.layoutInfo.length; mockTemp.bundleName = SHOPPING_BUNDLE + '1'; mockTemp.row = 0; mockTemp.column = 0; mockTemp.area = CommonConstants.DEFAULT_IMAGE_AREA; return mockTemp; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L282-L291
00b875a7a3c76a17ecfa0baae4fb5cfc711ed345
gitee