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
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
enum for the position of the x-labels relative to the chart
export enum XAxisPosition { TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE }
AST#export_declaration#Left export AST#enum_declaration#Left enum XAxisPosition AST#enum_body#Left { AST#enum_member#Left TOP AST#enum_member#Right , AST#enum_member#Left BOTTOM AST#enum_member#Right , AST#enum_member#Left BOTH_SIDED AST#enum_member#Right , AST#enum_member#Left TOP_INSIDE AST#enum_member#Right , AST#enum_member#Left BOTTOM_INSIDE AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum XAxisPosition { TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L220-L222
682f7c8818b09cc07f28923d37cb0ea9c1e05a7d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
pause
暂停播放 @returns {void}
pause(): void { this.avplayerModel.pause(); }
AST#method_declaration#Left pause AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avplayerModel AST#member_expression#Right AST#expression#Right . pause 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
pause(): void { this.avplayerModel.pause(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L221-L223
4465692af4d658ccf3b4ccc907c69f60624c8a83
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/utils/Utils.ets
arkts
isVideo
大概判断是否是视频片选择 @param types .ogm,.ogv,.mpg,.mp4,.mpeg,.m4v,.webm
static isVideo(types: string[]) { return ArrayUtil.contain(types, ".mp4") && ArrayUtil.contain(types, ".m4v"); }
AST#method_declaration#Left static isVideo AST#parameter_list#Left ( AST#parameter#Left types : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArrayUtil AST#expression#Right . contain AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left types AST#expression#Right , AST#expression#Left ".mp4" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left ArrayUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . contain AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left types AST#expression#Right , AST#expression#Left ".m4v" 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 isVideo(types: string[]) { return ArrayUtil.contain(types, ".mp4") && ArrayUtil.contain(types, ".m4v"); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/utils/Utils.ets#L132-L134
9c4e9452971f9692ced8bbcb57c747a7d42d185d
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
getStartOfDay
==================== UTILITY METHODS ==================== Get start of today (00:00:00) as timestamp
private getStartOfDay(): number { const now = new Date(); now.setHours(0, 0, 0, 0); return now.getTime(); }
AST#method_declaration#Left private getStartOfDay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 now AST#expression#Right . setHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getStartOfDay(): number { const now = new Date(); now.setHours(0, 0, 0, 0); return now.getTime(); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L609-L613
f8246128c0366fa91989528fddf80510313572d5
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBus.ets
arkts
once
注册单次事件监听 @param eventName 事件名 @param handler 监听回调 @param isSticky 是否粘性
static once(eventName: string, handler: Function, isSticky = false): void { EventBusCore.getInstance().once(eventName, handler, isSticky); }
AST#method_declaration#Left static once AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isSticky = 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 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 EventBusCore 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 . once AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left eventName AST#expression#Right , AST#expression#Left handler AST#expression#Right , AST#expression#Left isSticky AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static once(eventName: string, handler: Function, isSticky = false): void { EventBusCore.getInstance().once(eventName, handler, isSticky); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBus.ets#L24-L26
a383ff5ef015cdb85ce8143a44e9628b98d38459
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/ImageEditInterface.ets
arkts
图片编辑报错
export class ImageEditError extends Error { code: number = -1 errMsg: string constructor
AST#export_declaration#Left export AST#ERROR#Left class ImageEditError extends AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right { code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right errMsg : string 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 ImageEditError extends Error { code: number = -1 errMsg: string constructor
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L84-L88
4db9a2ad0f6f884890d2ec5800cd9fdfa232e957
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
buildHeader
构建页面头部
@Builder buildHeader() { AppHeader({ title: this.isSelectionMode ? `已选择 ${this.selectedGreetings.size} 条` : '祝福语库', showBack: !this.isSelectionMode, showAction: true, actionText: this.isSelectionMode ? '取消' : '选择', onAction: () => { if (this.isSelectionMode) { this.exitSelectionMode(); } else { this.enterSelectionMode(); } } }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppHeader ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectionMode AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#template_literal#Left ` 已选择 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedGreetings AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right 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#component_parameter#Right , AST#component_parameter#Left showBack : 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 . isSelectionMode AST#member_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#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectionMode AST#member_expression#Right AST#expression#Right ? AST#expression#Left '取消' AST#expression#Right : AST#expression#Left '选择' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onAction : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectionMode AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . exitSelectionMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . enterSelectionMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildHeader() { AppHeader({ title: this.isSelectionMode ? `已选择 ${this.selectedGreetings.size} 条` : '祝福语库', showBack: !this.isSelectionMode, showAction: true, actionText: this.isSelectionMode ? '取消' : '选择', onAction: () => { if (this.isSelectionMode) { this.exitSelectionMode(); } else { this.enterSelectionMode(); } } }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L190-L205
8fa57e528d9fbdca4f09575caf2d24bf6322473e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
@description Get all task status @return object[] Database query results
export const getAllTask = () => { return new Promise<TaskInfo[]>((resolve) => { TaskInfoApi.query(Const.GLOBAL_KEY, true, (res: TaskInfo[]) => { if (res?.length === 0) { Logger.warn('queryTaskList', 'has no data!!'); resolve(res ?? []); } resolve(res); }) }); } /** * @description Call notification capability * @param params { * hour: Hour * minute: Minute * daysOfWeek: Frequency of a week * title: Notice Title * content: Contents of notice * notificationId: Notification ID */
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left getAllTask = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TaskInfoApi AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . GLOBAL_KEY AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right ?. length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'queryTaskList' AST#expression#Right , AST#expression#Left 'has no data!!' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left res AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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 resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#variable_declarator#Right /** * @description Call notification capability * @param params { * hour: Hour * minute: Minute * daysOfWeek: Frequency of a week * title: Notice Title * content: Contents of notice * notificationId: Notification ID */ AST#variable_declaration#Right AST#export_declaration#Right
export const getAllTask = () => { return new Promise<TaskInfo[]>((resolve) => { TaskInfoApi.query(Const.GLOBAL_KEY, true, (res: TaskInfo[]) => { if (res?.length === 0) { Logger.warn('queryTaskList', 'has no data!!'); resolve(res ?? []); } resolve(res); }) }); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets#L34-L55
f8bdd3a36c01190ac98e92acc8e414c7c2e133bd
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets
arkts
theme
设置主题【【仅系统弹窗支持】】 @param theme @returns
theme(theme?: Theme | CustomTheme) { this.builderOptions.theme = theme; return this; }
AST#method_declaration#Left theme AST#parameter_list#Left ( AST#parameter#Left theme ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Theme AST#primary_type#Right | AST#primary_type#Left CustomTheme AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . theme AST#member_expression#Right = AST#expression#Left theme AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
theme(theme?: Theme | CustomTheme) { this.builderOptions.theme = theme; return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets#L51-L54
68d93f93648459e57c06e6d164a8df07cfcc4e24
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderRepository.ets
arkts
getOrderLogistics
查询订单物流信息 @param orderId 订单 ID @returns 物流详情
async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { return this.networkDataSource.getOrderLogistics(orderId); }
AST#method_declaration#Left async getOrderLogistics AST#parameter_list#Left ( AST#parameter#Left orderId : 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 AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Logistics AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . getOrderLogistics AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left orderId 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 getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { return this.networkDataSource.getOrderLogistics(orderId); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L100-L102
dd568bf670736f236badd3627cb8648c3b3ff88c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CustomerServiceRepository.ets
arkts
构造函数 @param networkDataSource 客服网络数据源
constructor(networkDataSource?: CustomerServiceNetworkDataSource) { this.networkDataSource = networkDataSource ?? new CustomerServiceNetworkDataSourceImpl(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left CustomerServiceNetworkDataSource 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 . networkDataSource AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left networkDataSource AST#expression#Right ?? AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomerServiceNetworkDataSourceImpl AST#expression#Right AST#new_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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor(networkDataSource?: CustomerServiceNetworkDataSource) { this.networkDataSource = networkDataSource ?? new CustomerServiceNetworkDataSourceImpl(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CustomerServiceRepository.ets#L18-L20
08aeb2ee9d6dae776e13952bb07776595ca5383a
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
@Author csx @DateTime 2024/3/18 10:39:03 @TODO ASN1Util SM2ASN.1工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class ASN1Util { static readonly BOOLEAN: string = "01"; static readonly INTEGER: string = "02"; static readonly BIT_STRING: string = "03"; static readonly OCTEN_STRING: string = "04"; static readonly NULL: string = "05"; static readonly REAL: string = "09"; static readonly ENUMERATED: string = "0a"; static readonly SEQUENCE: string = "30"; static readonly SET: string = "31"; }
AST#export_declaration#Left export AST#class_declaration#Left class ASN1Util AST#class_body#Left { AST#property_declaration#Left static readonly BOOLEAN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "01" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly INTEGER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "02" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BIT_STRING : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "03" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly OCTEN_STRING : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "04" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly NULL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "05" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly REAL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "09" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ENUMERATED : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "0a" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SEQUENCE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "30" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SET : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "31" AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ASN1Util { static readonly BOOLEAN: string = "01"; static readonly INTEGER: string = "02"; static readonly BIT_STRING: string = "03"; static readonly OCTEN_STRING: string = "04"; static readonly NULL: string = "05"; static readonly REAL: string = "09"; static readonly ENUMERATED: string = "0a"; static readonly SEQUENCE: string = "30"; static readonly SET: string = "31"; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L26-L36
e6cd55e439a645e76bb1214f995c226801d6609e
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets
arkts
error
打印ERROR级别日志 @param args
static error(...args: string[]): void { if (LogUtil.showLog) { hilog.error(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args) } }
AST#method_declaration#Left static error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . showLog AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 LogUtil AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . tag AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . format AST#member_expression#Right AST#expression#Right . repeat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left args AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left args AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
static error(...args: string[]): void { if (LogUtil.showLog) { hilog.error(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args) } }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L84-L88
dcd161b799ed9d2deec376b10181f4b889c7a76f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Spacer.ets
arkts
SpaceVerticalXXLarge
@file 通用间距组件 @author Joker.X 创建一个超大垂直间距(32vp) @returns {void} 无返回值
@Builder export function SpaceVerticalXXLarge(): void { Blank().height($r("app.float.space_vertical_large_xx")); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalXXLarge 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 Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_vertical_large_xx" 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#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function SpaceVerticalXXLarge(): void { Blank().height($r("app.float.space_vertical_large_xx")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L10-L13
3de6363db13a2587b211268fd6bd3836eac67f87
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
总览统计
export interface OverviewStats { totalContacts: number; totalGreetings: number; upcomingBirthdays: number; thisMonthBirthdays: number; thisWeekBirthdays: number; todayBirthdays: number; averageAge: number; oldestPerson: string; youngestPerson: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface OverviewStats AST#object_type#Left { AST#type_member#Left totalContacts : 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 totalGreetings : 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 upcomingBirthdays : 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 thisMonthBirthdays : 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 thisWeekBirthdays : 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 todayBirthdays : 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 averageAge : 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 oldestPerson : 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 youngestPerson : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface OverviewStats { totalContacts: number; totalGreetings: number; upcomingBirthdays: number; thisMonthBirthdays: number; thisWeekBirthdays: number; todayBirthdays: number; averageAge: number; oldestPerson: string; youngestPerson: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L130-L140
74fee2248be0996a0d6aced6ba9cbf88bc210e39
github
de8gemaker/AccountApp.git
b5156cd90ac02239b39fd0f91d32851acad8ba42
entry/src/main/ets/views/stats.ets
arkts
statsMonthData
按日期统计月账单数据
async statsMonthData() { const res = await AccountService.getAccountByMonth(this.time); const { expenses, income, data } = this.categoryType === CategoryType.DATE ? AccountService.statsConsumeByDate(res) : AccountService.statsConsumeByType(res); this.expenses = expenses; this.income = income; this.statsData = data; }
AST#method_declaration#Left async statsMonthData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left res = 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 AccountService AST#expression#Right AST#await_expression#Right AST#expression#Right . getAccountByMonth 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 . time 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 const 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#conditional_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#object_literal#Left { AST#property_assignment#Left expenses AST#property_assignment#Right , AST#property_assignment#Left income AST#property_assignment#Right , AST#property_assignment#Left data AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . categoryType AST#member_expression#Right AST#expression#Right === AST#expression#Left CategoryType AST#expression#Right AST#binary_expression#Right AST#expression#Right . DATE AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AccountService AST#expression#Right . statsConsumeByDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AccountService AST#expression#Right AST#conditional_expression#Right AST#expression#Right . statsConsumeByType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . expenses AST#member_expression#Right = AST#expression#Left expenses 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 . income AST#member_expression#Right = AST#expression#Left income 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 . statsData AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async statsMonthData() { const res = await AccountService.getAccountByMonth(this.time); const { expenses, income, data } = this.categoryType === CategoryType.DATE ? AccountService.statsConsumeByDate(res) : AccountService.statsConsumeByType(res); this.expenses = expenses; this.income = income; this.statsData = data; }
https://github.com/de8gemaker/AccountApp.git/blob/b5156cd90ac02239b39fd0f91d32851acad8ba42/entry/src/main/ets/views/stats.ets#L30-L39
28af573b1908f3f5ce4f66448740cc97ae47d022
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerInfoComp.ets
arkts
MusicPlayerInfoComp
播放器歌曲信息组件,包括歌名、歌手、歌曲封面、歌词 实现步骤: 1.组件创建时,根据当前折叠屏状态和横竖屏状态初始化组件树上各组件属性 2.通过父组件监听屏幕折叠态变更事件,同时通过单项绑定通知到此组件的状态变量,修改组件树上各组件属性 3.通过媒体查询监听横竖屏变更,修改组件树上各组件属性 4.通过配置属性动画,动态变更各组件样式
@Component export struct MusicPlayerInfoComp { // 父组件单向绑定的屏幕状态 @Prop @Watch('updateWithFoldStatus') curFoldStatus: display.FoldStatus; // 当前页面的vm实例 @Consume('musicPlayerViewModel') @Watch('onViewModelChanged') viewModel: MusicPlayerViewModel; // list控制器 private lyricsScrollerCtrl: Scroller = new Scroller(); // 歌词展示索引 @State lyricsCurIndex: number = 0; // 当前是否横屏状态 private isLandscape: boolean = false; // TODO:知识点:通过媒体查询监听显示屏幕横竖屏方向状态变更 private landscapeListener: mediaquery.MediaQueryListener = mediaquery.matchMediaSync('(orientation: landscape)'); // 属性动画配置 private attrAniCfg: AnimateParam = { duration: 2000, curve: Curve.EaseOut, iterations: 1, playMode: PlayMode.Normal } // 歌曲信息组件整体高度百分比 @State totalHeightPer: string = CommonConstants.MUSIC_INFO_COMP_HEIGHT_COMMON; // 歌词子组件高度百分比 @State lyricsHeightPer: string = CommonConstants.MUSIC_LYRICS_COMP_HEIGHT_EXPANDED; // 歌词子组件外边距 @State lyricsMargin: Margin = { top: CommonConstants.MUSIC_LYRICS_COMP_MARGIN_TOP_COMMON }; // 歌曲封面图片尺寸 @State curImgSize: number = CommonConstants.MUSIC_COVER_SIZE_COMMON; // 歌曲信息组件Flex布局方向 @State curFlexDirection: FlexDirection = FlexDirection.Row; private callBack = async (curFoldStatus: display.FoldStatus) => { // 同一个状态重复触发不做处理 if (this.curFoldStatus === curFoldStatus) { return; } // 缓存当前折叠状态 this.curFoldStatus = curFoldStatus; } aboutToAppear(): void { // 初始化各组件样式 this.updateWithFoldStatus(); if (display.isFoldable()) { this.regDisplayListener(); } // 监听媒体查询横屏切换 this.landscapeListener.on('change', (mediaQueryResult: mediaquery.MediaQueryResult) => { this.updateWithOrientation(mediaQueryResult); }); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MusicPlayerInfoComp AST#component_body#Left { // 父组件单向绑定的屏幕状态 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateWithFoldStatus' AST#expression#Right ) AST#decorator#Right curFoldStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 当前页面的vm实例 AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'musicPlayerViewModel' AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onViewModelChanged' AST#expression#Right ) AST#decorator#Right viewModel : AST#type_annotation#Left AST#primary_type#Left MusicPlayerViewModel AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // list控制器 AST#property_declaration#Left private lyricsScrollerCtrl : 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 AST#decorator#Left @ State AST#decorator#Right lyricsCurIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 当前是否横屏状态 AST#property_declaration#Left private isLandscape : 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 // TODO:知识点:通过媒体查询监听显示屏幕横竖屏方向状态变更 AST#property_declaration#Left private landscapeListener : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mediaquery . MediaQueryListener 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 mediaquery AST#expression#Right . matchMediaSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '(orientation: landscape)' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 属性动画配置 AST#property_declaration#Left private attrAniCfg : AST#type_annotation#Left AST#primary_type#Left AnimateParam AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left playMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PlayMode AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right // 歌曲信息组件整体高度百分比 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right totalHeightPer : 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 CommonConstants AST#expression#Right . MUSIC_INFO_COMP_HEIGHT_COMMON AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 歌词子组件高度百分比 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right lyricsHeightPer : 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 CommonConstants AST#expression#Right . MUSIC_LYRICS_COMP_HEIGHT_EXPANDED AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 歌词子组件外边距 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right lyricsMargin : AST#type_annotation#Left AST#primary_type#Left Margin AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MUSIC_LYRICS_COMP_MARGIN_TOP_COMMON AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right // 歌曲封面图片尺寸 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right curImgSize : 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 CommonConstants AST#expression#Right . MUSIC_COVER_SIZE_COMMON AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 歌曲信息组件Flex布局方向 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right curFlexDirection : AST#type_annotation#Left AST#primary_type#Left FlexDirection AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Row AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private callBack = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left curFoldStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus 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#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 . curFoldStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left curFoldStatus AST#expression#Right AST#binary_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curFoldStatus AST#member_expression#Right = AST#expression#Left curFoldStatus 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#ERROR#Left aboutToAppear AST#ERROR#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#unary_expression#Left void AST#expression#Left AST#object_literal#Left { // 初始化各组件样式 AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . updateWithFoldStatus AST#member_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 if AST#ERROR#Left ( display . isFoldable AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left ) AST#ERROR#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 . regDisplayListener 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 this AST#ERROR#Left . landscape List ener . on ( 'change' , AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left mediaQueryResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mediaquery . MediaQueryResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => AST#ERROR#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 . updateWithOrientation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mediaQueryResult 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#ERROR#Left ) ; AST#ERROR#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct MusicPlayerInfoComp { @Prop @Watch('updateWithFoldStatus') curFoldStatus: display.FoldStatus; @Consume('musicPlayerViewModel') @Watch('onViewModelChanged') viewModel: MusicPlayerViewModel; private lyricsScrollerCtrl: Scroller = new Scroller(); @State lyricsCurIndex: number = 0; private isLandscape: boolean = false; private landscapeListener: mediaquery.MediaQueryListener = mediaquery.matchMediaSync('(orientation: landscape)'); private attrAniCfg: AnimateParam = { duration: 2000, curve: Curve.EaseOut, iterations: 1, playMode: PlayMode.Normal } @State totalHeightPer: string = CommonConstants.MUSIC_INFO_COMP_HEIGHT_COMMON; @State lyricsHeightPer: string = CommonConstants.MUSIC_LYRICS_COMP_HEIGHT_EXPANDED; @State lyricsMargin: Margin = { top: CommonConstants.MUSIC_LYRICS_COMP_MARGIN_TOP_COMMON }; @State curImgSize: number = CommonConstants.MUSIC_COVER_SIZE_COMMON; @State curFlexDirection: FlexDirection = FlexDirection.Row; private callBack = async (curFoldStatus: display.FoldStatus) => { if (this.curFoldStatus === curFoldStatus) { return; } this.curFoldStatus = curFoldStatus; } aboutToAppear(): void { this.updateWithFoldStatus(); if (display.isFoldable()) { this.regDisplayListener(); } this.landscapeListener.on('change', (mediaQueryResult: mediaquery.MediaQueryResult) => { this.updateWithOrientation(mediaQueryResult); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerInfoComp.ets#L30-L81
1b4d30fd0530f4529ff341a5154440d370b4d2b8
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
china_area/src/main/ets/AreaHelper.ets
arkts
getAreaSync
获取省市县的数据
static getAreaSync(): Array<AreaEntity> { if (AreaHelper.areaList == null || AreaHelper.areaList.length == 0) { let jsonStr = AreaHelper.getAreaStrSync(); AreaHelper.areaList = JSON.parse(jsonStr) as Array<AreaEntity>; } return AreaHelper.areaList; }
AST#method_declaration#Left static getAreaSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AreaEntity 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AreaHelper AST#expression#Right . areaList 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#expression#Left AreaHelper AST#expression#Right AST#binary_expression#Right AST#expression#Right . areaList 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 let AST#variable_declarator#Left jsonStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AreaHelper AST#expression#Right . getAreaStrSync 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AreaHelper AST#expression#Right . areaList 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 JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left jsonStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as 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 AreaEntity 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#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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AreaHelper AST#expression#Right . areaList AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getAreaSync(): Array<AreaEntity> { if (AreaHelper.areaList == null || AreaHelper.areaList.length == 0) { let jsonStr = AreaHelper.getAreaStrSync(); AreaHelper.areaList = JSON.parse(jsonStr) as Array<AreaEntity>; } return AreaHelper.areaList; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L53-L59
b24229f1f5573d2243b400ca9b0b8f5443cfd107
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
buildGreetingCard
构建祝福语卡片
@Builder buildGreetingCard(greeting: GreetingItem) { Column({ space: 8 }) { Row() { Text(greeting.category) .fontSize(10) .fontColor('#4ECDC4') .backgroundColor('#f0f9ff') .padding({ left: 8, right: 8, top: 4, bottom: 4 }) .borderRadius(12) if (greeting.hot) { Text('🔥 热门') .fontSize(10) .fontColor('#ff6b6b') .backgroundColor('#fff0f0') .padding({ left: 8, right: 8, top: 4, bottom: 4 }) .borderRadius(12) } Blank() Button('复制') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#f0f0f0') .fontColor('#666666') .width(40) .height(24) .onClick(() => { promptAction.showToast({ message: '祝福语已复制到剪贴板', duration: 1500 }); }) } .width('100%') .alignItems(VerticalAlign.Center) Text(greeting.text) .fontSize(14) .fontColor('#333333') .lineHeight(20) .width('100%') Row({ space: 12 }) { Button('使用模板') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#4ECDC4') .fontColor('#FFFFFF') .flexGrow(1) .height(28) .onClick(() => { promptAction.showToast({ message: '模板已应用到编辑区域', duration: 1500 }); }) Button('收藏') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#95E1A3') .fontColor('#FFFFFF') .width(50) .height(28) .onClick(() => { promptAction.showToast({ message: '已收藏祝福语', duration: 1000 }); }) Button('分享') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#FFD93D') .fontColor('#333333') .width(50) .height(28) .onClick(() => { promptAction.showToast({ message: '祝福语分享功能', duration: 1000 }); }) } .width('100%') } .width('100%') .padding(16) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 4, color: 'rgba(0,0,0,0.05)', offsetX: 0, offsetY: 2 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingCard AST#parameter_list#Left ( AST#parameter#Left greeting : AST#type_annotation#Left AST#primary_type#Left GreetingItem 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 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left greeting AST#expression#Right . category AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#4ECDC4' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f0f9ff' 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 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left greeting AST#expression#Right . hot AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '🔥 热门' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ff6b6b' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#fff0f0' 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 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) 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 . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f0f0f0' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 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 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#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1500 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 greeting AST#expression#Right . text AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 20 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#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 . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#4ECDC4' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . flexGrow ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 28 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 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#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1500 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#95E1A3' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 28 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 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#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFD93D' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 28 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 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#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.05)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildGreetingCard(greeting: GreetingItem) { Column({ space: 8 }) { Row() { Text(greeting.category) .fontSize(10) .fontColor('#4ECDC4') .backgroundColor('#f0f9ff') .padding({ left: 8, right: 8, top: 4, bottom: 4 }) .borderRadius(12) if (greeting.hot) { Text('🔥 热门') .fontSize(10) .fontColor('#ff6b6b') .backgroundColor('#fff0f0') .padding({ left: 8, right: 8, top: 4, bottom: 4 }) .borderRadius(12) } Blank() Button('复制') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#f0f0f0') .fontColor('#666666') .width(40) .height(24) .onClick(() => { promptAction.showToast({ message: '祝福语已复制到剪贴板', duration: 1500 }); }) } .width('100%') .alignItems(VerticalAlign.Center) Text(greeting.text) .fontSize(14) .fontColor('#333333') .lineHeight(20) .width('100%') Row({ space: 12 }) { Button('使用模板') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#4ECDC4') .fontColor('#FFFFFF') .flexGrow(1) .height(28) .onClick(() => { promptAction.showToast({ message: '模板已应用到编辑区域', duration: 1500 }); }) Button('收藏') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#95E1A3') .fontColor('#FFFFFF') .width(50) .height(28) .onClick(() => { promptAction.showToast({ message: '已收藏祝福语', duration: 1000 }); }) Button('分享') .type(ButtonType.Capsule) .fontSize(10) .backgroundColor('#FFD93D') .fontColor('#333333') .width(50) .height(28) .onClick(() => { promptAction.showToast({ message: '祝福语分享功能', duration: 1000 }); }) } .width('100%') } .width('100%') .padding(16) .backgroundColor('#ffffff') .borderRadius(12) .shadow({ radius: 4, color: 'rgba(0,0,0,0.05)', offsetX: 0, offsetY: 2 }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1431-L1531
48f42101c365a8e50962f1ad7923f9edfdd15a3a
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
daysTo
计算从指定日期到另一个日期的天数差(可以是负数,表示先后顺序) @param from 起始日期 @param to 结束日期 @returns 天数差(整数,可能为负数)
static daysTo(from: Date, to: Date): number { // 只保留年月日 const start = new Date(from.getFullYear(), from.getMonth(), from.getDate()); const end = new Date(to.getFullYear(), to.getMonth(), to.getDate()); const msPerDay = 24 * 60 * 60 * 1000; return Math.floor((end.getTime() - start.getTime()) / msPerDay); }
AST#method_declaration#Left static daysTo AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 只保留年月日 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left start = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left from AST#expression#Right . getFullYear 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left from AST#expression#Right . getMonth 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left from AST#expression#Right . getDate 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#variable_declaration#Left const AST#variable_declarator#Left end = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left to AST#expression#Right . getFullYear 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left to AST#expression#Right . getMonth 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left to AST#expression#Right . getDate 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#variable_declaration#Left const AST#variable_declarator#Left msPerDay = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 24 AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 1000 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 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left end 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#expression#Left start AST#expression#Right AST#binary_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#parenthesized_expression#Right AST#expression#Right / AST#expression#Left msPerDay 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#method_declaration#Right
static daysTo(from: Date, to: Date): number { const start = new Date(from.getFullYear(), from.getMonth(), from.getDate()); const end = new Date(to.getFullYear(), to.getMonth(), to.getDate()); const msPerDay = 24 * 60 * 60 * 1000; return Math.floor((end.getTime() - start.getTime()) / msPerDay); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L12-L19
30c568cf9f47f3d2c5372e4b1665877fcf179e34
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
formatLunarDate
格式化农历日期 @param year 农历年份 @param month 农历月份 @param day 农历日期 @param isLeapMonth 是否闰月 @param format 格式(short | long) @returns 格式化后的农历日期字符串
formatLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false, format: 'short' | 'long' = 'short'): string { return LunarUtils.formatLunarDate({ year, month, day, leapMonth: isLeapMonth } as LunarDate, format); }
AST#method_declaration#Left formatLunarDate 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#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : 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#Left format AST#ERROR#Left : 'short' | 'long' AST#ERROR#Right = AST#expression#Left 'short' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtils AST#expression#Right . formatLunarDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left year AST#property_assignment#Right , AST#property_assignment#Left month AST#property_assignment#Right , AST#property_assignment#Left day AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left leapMonth AST#property_name#Right : AST#expression#Left isLeapMonth AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left LunarDate AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left format 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
formatLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false, format: 'short' | 'long' = 'short'): string { return LunarUtils.formatLunarDate({ year, month, day, leapMonth: isLeapMonth } as LunarDate, format); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L551-L558
56ce8f7628c6a29053d20af87d7241fceb338122
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/NotificationManager.ets
arkts
requestPermission
请求通知权限
async requestPermission(): Promise<boolean> { try { console.info('🔔 Requesting notification permission...') await notificationManager.requestEnableNotification() console.info('✅ Notification permission granted!') return true } catch (err) { const error = err as BusinessError console.error('❌ Failed to request notification permission:', error.message, 'Code:', error.code) return false } }
AST#method_declaration#Left async requestPermission AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '🔔 Requesting notification permission...' 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestEnableNotification 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '✅ Notification permission granted!' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left error = AST#expression#Left AST#call_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 AST#qualified_type#Left BusinessError AST#ERROR#Left console AST#ERROR#Right . error 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 '❌ Failed to request notification permission:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right , AST#expression#Left 'Code:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code 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#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async requestPermission(): Promise<boolean> { try { console.info('🔔 Requesting notification permission...') await notificationManager.requestEnableNotification() console.info('✅ Notification permission granted!') return true } catch (err) { const error = err as BusinessError console.error('❌ Failed to request notification permission:', error.message, 'Code:', error.code) return false } }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L22-L33
d8baa8ce7db4177b77ccc792a5e099c8d852a523
github
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
registWithLogin
注册并登录 @param username wanandroid账号 @param password 密码 @param repassword 二次密码
async registWithLogin(username: string, password: string, repassword: string) { try { const result = await WanHttpClient.regist(username, password, repassword); if (result.response.errorCode === 0) { await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password); EventBus.getInstance().post(WanEventId.EVENT_LOGIN, new LoginRegistEvent(true)); await this.fetchUserInfo(); } else { EventBus.getInstance() .post(WanEventId.EVENT_LOGIN, new LoginRegistEvent(false, '注册失败:' + result.response.errorMsg)); } } catch (err) { await this.loginOut(); EventBus.getInstance().post(WanEventId.EVENT_LOGIN, new LoginRegistEvent(false, '注册失败,请检查网络:' + err)); } }
AST#method_declaration#Left async registWithLogin AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left repassword : 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#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left WanHttpClient AST#expression#Right AST#await_expression#Right AST#expression#Right . regist AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left username AST#expression#Right , AST#expression#Left password AST#expression#Right , AST#expression#Left repassword 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . response AST#member_expression#Right AST#expression#Right . errorCode AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . updateLoginInfo 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 result AST#expression#Right . response AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . cookies AST#member_expression#Right AST#expression#Right . join 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#Left password 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 EventBus 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 . post AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left WanEventId AST#expression#Right . EVENT_LOGIN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LoginRegistEvent AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchUserInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBus 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 . post AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left WanEventId AST#expression#Right . EVENT_LOGIN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LoginRegistEvent AST#expression#Right AST#new_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#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '注册失败:' AST#expression#Right + AST#expression#Left result AST#expression#Right AST#binary_expression#Right AST#expression#Right . response AST#member_expression#Right AST#expression#Right . errorMsg 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#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . loginOut 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBus 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 . post AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left WanEventId AST#expression#Right . EVENT_LOGIN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LoginRegistEvent AST#expression#Right AST#new_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#expression#Left AST#binary_expression#Left AST#expression#Left '注册失败,请检查网络:' AST#expression#Right + AST#expression#Left err AST#expression#Right AST#binary_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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async registWithLogin(username: string, password: string, repassword: string) { try { const result = await WanHttpClient.regist(username, password, repassword); if (result.response.errorCode === 0) { await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password); EventBus.getInstance().post(WanEventId.EVENT_LOGIN, new LoginRegistEvent(true)); await this.fetchUserInfo(); } else { EventBus.getInstance() .post(WanEventId.EVENT_LOGIN, new LoginRegistEvent(false, '注册失败:' + result.response.errorMsg)); } } catch (err) { await this.loginOut(); EventBus.getInstance().post(WanEventId.EVENT_LOGIN, new LoginRegistEvent(false, '注册失败,请检查网络:' + err)); } }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L124-L139
8e0270531cdbd561c160c664e970661a8a294bb6
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/PodcastService.ets
arkts
httpRequest
发送HTTP请求
private async httpRequest(url: string): Promise<string> { return new Promise((resolve, reject) => { const httpRequest = http.createHttp(); httpRequest.request(url, { method: http.RequestMethod.GET, connectTimeout: Constants.HTTP_TIMEOUT, readTimeout: Constants.HTTP_TIMEOUT }, (err, data) => { if (!err) { resolve(data.result as string); } else { reject(err); } httpRequest.destroy(); }); }); }
AST#method_declaration#Left private async httpRequest AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp 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 httpRequest AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . HTTP_TIMEOUT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . HTTP_TIMEOUT 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#Left err AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left err 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 resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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#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 httpRequest AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async httpRequest(url: string): Promise<string> { return new Promise((resolve, reject) => { const httpRequest = http.createHttp(); httpRequest.request(url, { method: http.RequestMethod.GET, connectTimeout: Constants.HTTP_TIMEOUT, readTimeout: Constants.HTTP_TIMEOUT }, (err, data) => { if (!err) { resolve(data.result as string); } else { reject(err); } httpRequest.destroy(); }); }); }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L183-L200
af42080a2973daa32fe81e3ef97ec97dd524f8e5
github
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/pages/CategoryDetailPage.ets
arkts
dispatchScrollOffset
处理滚动事件
private dispatchScrollOffset() { const opacity = this.scrollOffset / 200; // 注意这里的边界场景 this.alpha = opacity > 1 ? 1 : opacity < 0 ? 0 : opacity; }
AST#method_declaration#Left private dispatchScrollOffset AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left opacity = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scrollOffset AST#member_expression#Right AST#expression#Right / AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 注意这里的边界场景 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . alpha AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left opacity AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left opacity AST#expression#Right AST#conditional_expression#Right AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left opacity 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#method_declaration#Right
private dispatchScrollOffset() { const opacity = this.scrollOffset / 200; this.alpha = opacity > 1 ? 1 : opacity < 0 ? 0 : opacity; }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/pages/CategoryDetailPage.ets#L213-L217
e95c7fa1d04be13f79a1829984305113e01a0635
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/Comment.ets
arkts
@file 商品评价 @author Joker.X
export class Comment { /** * ID */ id: number = 0; /** * 用户ID */ userId: number = 0; /** * 商品ID */ goodsId: number = 0; /** * 订单ID */ orderId: number = 0; /** * 内容 */ content: string = ""; /** * 星数 */ starCount: number = 5; /** * 图片 */ pics?: string[] | null = null; /** * 用户昵称 */ nickName?: string | null = null; /** * 用户头像 */ avatarUrl?: string | null = null; /** * 创建时间 */ createTime?: string | null = null; /** * 更新时间 */ updateTime?: string | null = null; constructor(init?: Partial<Comment>) { if (!init) { return; } this.id = init.id ?? this.id; this.userId = init.userId ?? this.userId; this.goodsId = init.goodsId ?? this.goodsId; this.orderId = init.orderId ?? this.orderId; this.content = init.content ?? this.content; this.starCount = init.starCount ?? this.starCount; this.pics = init.pics ?? this.pics; this.nickName = init.nickName ?? this.nickName; this.avatarUrl = init.avatarUrl ?? this.avatarUrl; this.createTime = init.createTime ?? this.createTime; this.updateTime = init.updateTime ?? this.updateTime; } }
AST#export_declaration#Left export AST#class_declaration#Left class Comment AST#class_body#Left { /** * ID */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /** * 用户ID */ AST#property_declaration#Left userId : 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 /** * 商品ID */ AST#property_declaration#Left goodsId : 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 /** * 订单ID */ AST#property_declaration#Left orderId : 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 content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right /** * 星数 */ AST#property_declaration#Left starCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right /** * 图片 */ AST#property_declaration#Left pics ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] 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#property_declaration#Right /** * 用户昵称 */ AST#property_declaration#Left nickName ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 用户头像 */ AST#property_declaration#Left avatarUrl ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 创建时间 */ AST#property_declaration#Left createTime ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 更新时间 */ AST#property_declaration#Left updateTime ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Comment 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left init AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right 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 . userId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . userId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . userId 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 . goodsId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsId 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 . orderId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . orderId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . orderId 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 . content AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . content AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . content 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 . starCount AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . starCount AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . starCount 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 . pics AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . pics AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . pics 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 . nickName AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . nickName AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . nickName 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 . avatarUrl AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . avatarUrl AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . avatarUrl 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 . createTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . createTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . createTime 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 . updateTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . updateTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . updateTime 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#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Comment { id: number = 0; userId: number = 0; goodsId: number = 0; orderId: number = 0; content: string = ""; starCount: number = 5; pics?: string[] | null = null; nickName?: string | null = null; avatarUrl?: string | null = null; createTime?: string | null = null; updateTime?: string | null = null; constructor(init?: Partial<Comment>) { if (!init) { return; } this.id = init.id ?? this.id; this.userId = init.userId ?? this.userId; this.goodsId = init.goodsId ?? this.goodsId; this.orderId = init.orderId ?? this.orderId; this.content = init.content ?? this.content; this.starCount = init.starCount ?? this.starCount; this.pics = init.pics ?? this.pics; this.nickName = init.nickName ?? this.nickName; this.avatarUrl = init.avatarUrl ?? this.avatarUrl; this.createTime = init.createTime ?? this.createTime; this.updateTime = init.updateTime ?? this.updateTime; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Comment.ets#L5-L67
8c1ab60918922f631560485d31493782a9c1cfe9
github
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
entry/src/main/ets/common/widget/VideoPlaySlider.ets
arkts
iconOnclick
icon onclick callback
iconOnclick() { if (this.isPlay === true) { this.controller.pause() this.isPlay = false; this.isOpacity = false; return; } if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; } else { this.isLoading = true; // The video loading is not complete. The loading action is displayed. let intervalLoading = setInterval(() => { if (this.progressVal >= 100) { this.progressVal = 0; } else { this.progressVal += 10; } }, 100) // The scheduled task determines whether the video loading is complete. let intervalFlag = setInterval(() => { if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; this.isLoading = false; clearInterval(intervalFlag); clearInterval(intervalLoading); } }, 100); } }
AST#method_declaration#Left iconOnclick 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . pause 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay 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 . isOpacity 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#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flag AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay 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 . isOpacity 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 } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // The video loading is not complete. The loading action is displayed. AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intervalLoading = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval 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#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 . progressVal AST#member_expression#Right AST#expression#Right >= AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . progressVal 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 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 . progressVal AST#member_expression#Right += AST#expression#Left 10 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#expression#Left 100 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 // The scheduled task determines whether the video loading is complete. AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left intervalFlag = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval 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#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 . flag AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#boolean_literal#Left true AST#boolean_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPlay 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOpacity 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left intervalFlag 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 clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left intervalLoading 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#expression#Left 100 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
iconOnclick() { if (this.isPlay === true) { this.controller.pause() this.isPlay = false; this.isOpacity = false; return; } if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; } else { this.isLoading = true; let intervalLoading = setInterval(() => { if (this.progressVal >= 100) { this.progressVal = 0; } else { this.progressVal += 10; } }, 100) let intervalFlag = setInterval(() => { if (this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; this.isLoading = false; clearInterval(intervalFlag); clearInterval(intervalLoading); } }, 100); } }
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/widget/VideoPlaySlider.ets#L63-L96
d27f7cfee6818ce5bc3812a063d9fb43e7f4d79a
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q2/DxinTranslate/entry/src/main/ets/model/Data.ets
arkts
语种选择的类型
export class Language { lang: string chinese: string // 构造函数 constructor
AST#export_declaration#Left export AST#ERROR#Left class Language { lang : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ch in ese AST#ERROR#Right : string 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 Language { lang: string chinese: string constructor
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q2/DxinTranslate/entry/src/main/ets/model/Data.ets#L2-L6
3e4fa82e15740e074af91f35f46b085317649e5d
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/transform/GrayScaleTransformation.ets
arkts
GrayScaleTransformation
图片变换:灰化效果
@Sendable export class GrayScaleTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let headFilter = effectKit.createEffect(toTransform); if (headFilter != null) { return await headFilter.grayscale().getEffectPixelMap(); } return toTransform; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class GrayScaleTransformation 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 headFilter = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left effectKit AST#expression#Right . createEffect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toTransform 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 headFilter 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left headFilter AST#expression#Right AST#await_expression#Right AST#expression#Right . grayscale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getEffectPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_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 GrayScaleTransformation extends PixelMapTransformation { constructor() { super(); } async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> { let headFilter = effectKit.createEffect(toTransform); if (headFilter != null) { return await headFilter.grayscale().getEffectPixelMap(); } return toTransform; } }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/GrayScaleTransformation.ets#L21-L34
e5fe36d21d491e681628735742c0c1fc9e8d3bbc
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/model/Const.ets
arkts
@author: HZWei @date: 2024/9/22 @desc:
export enum ErrorCode { PARAMETER_ERROR = 401, INTERNAL_ERROR = 100001, NOT_REGISTERED = 100005, NOT_FOUND = 100006, INTERCEPTED = 301 }
AST#export_declaration#Left export AST#enum_declaration#Left enum ErrorCode AST#enum_body#Left { AST#enum_member#Left PARAMETER_ERROR = AST#expression#Left 401 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left INTERNAL_ERROR = AST#expression#Left 100001 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NOT_REGISTERED = AST#expression#Left 100005 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NOT_FOUND = AST#expression#Left 100006 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left INTERCEPTED = AST#expression#Left 301 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum ErrorCode { PARAMETER_ERROR = 401, INTERNAL_ERROR = 100001, NOT_REGISTERED = 100005, NOT_FOUND = 100006, INTERCEPTED = 301 }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/model/Const.ets#L7-L13
f7594240126b803798cb2f4eb2225fb0c2b01b7b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
compressedImage
图片压缩 @param sourcePixelMap:原始待压缩图片的PixelMap对象 @param maxCompressedImageSize:指定图片的压缩目标大小,单位kb
async compressedImage(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number): Promise<void> { // 判断是优先压缩质量还是优先压缩尺寸 if (this.isQualityPriority) { // 优先压缩质量 await this.qualityPriorityCompress(sourcePixelMap, maxCompressedImageSize); } else { // 优先压缩尺寸 await this.scalePriorityCompress(sourcePixelMap, maxCompressedImageSize, this.minQuality); } }
AST#method_declaration#Left async compressedImage AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxCompressedImageSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 判断是优先压缩质量还是优先压缩尺寸 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isQualityPriority AST#member_expression#Right AST#expression#Right ) { // 优先压缩质量 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . qualityPriorityCompress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourcePixelMap AST#expression#Right , AST#expression#Left maxCompressedImageSize AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { // 优先压缩尺寸 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . scalePriorityCompress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sourcePixelMap AST#expression#Right , AST#expression#Left maxCompressedImageSize AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . minQuality AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
async compressedImage(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number): Promise<void> { if (this.isQualityPriority) { await this.qualityPriorityCompress(sourcePixelMap, maxCompressedImageSize); } else { await this.scalePriorityCompress(sourcePixelMap, maxCompressedImageSize, this.minQuality); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L235-L244
43570315b73630c0782de3db81038742a5953a78
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets
arkts
emit
触发事件 @param event 事件名称 @param data 事件数据(泛型T,默认为void)
static emit<T = void>(event: string, data?: T): void { // 处理常规监听器 const handlers = SimpleEventBus.listeners.get(event); handlers?.forEach(handler => { try { handler(data); } catch (err) { console.error(`[事件处理错误] ${event}:`, err); } }); // 处理一次性监听器(执行后自动移除) const onceHandlers = SimpleEventBus.onceListeners.get(event); if (onceHandlers) { onceHandlers.forEach(handler => { try { handler(data); } catch (err) { console.error(`[一次性事件处理错误] ${event}:`, err); } }); SimpleEventBus.onceListeners.delete(event); // 执行后清除 } // 无订阅者警告 if (!handlers && !onceHandlers) { console.warn(`[无订阅者] 事件 "${event}" 未被监听`); } }
AST#method_declaration#Left static emit AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 处理常规监听器 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left handlers = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SimpleEventBus AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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 handlers AST#expression#Right ?. forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left handler => 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 handler AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [事件处理错误] AST#template_substitution#Left $ { AST#expression#Left event AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right AST#expression#Right , AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 onceHandlers = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SimpleEventBus AST#expression#Right . onceListeners AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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 onceHandlers 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 onceHandlers AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left handler => 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 handler AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [一次性事件处理错误] AST#template_substitution#Left $ { AST#expression#Left event AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right AST#expression#Right , AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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 SimpleEventBus AST#expression#Right . onceListeners AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left handlers AST#expression#Right AST#unary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left onceHandlers AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [无订阅者] 事件 " AST#template_substitution#Left $ { AST#expression#Left event 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static emit<T = void>(event: string, data?: T): void { const handlers = SimpleEventBus.listeners.get(event); handlers?.forEach(handler => { try { handler(data); } catch (err) { console.error(`[事件处理错误] ${event}:`, err); } }); const onceHandlers = SimpleEventBus.onceListeners.get(event); if (onceHandlers) { onceHandlers.forEach(handler => { try { handler(data); } catch (err) { console.error(`[一次性事件处理错误] ${event}:`, err); } }); SimpleEventBus.onceListeners.delete(event); } if (!handlers && !onceHandlers) { console.warn(`[无订阅者] 事件 "${event}" 未被监听`); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets#L16-L44
c0c73f735d4f2acbdb13a3e8fe7099f6c73d3dd1
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
isNRSupported
判断当前设备是否支持NR(New Radio)。也就是5G。 @param slotId 卡槽ID,不传默认主卡。
static isNRSupported(slotId?: number): boolean { if (slotId) { return radio.isNRSupported(slotId); } return radio.isNRSupported(); }
AST#method_declaration#Left static isNRSupported AST#parameter_list#Left ( AST#parameter#Left slotId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left slotId AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left radio AST#expression#Right . isNRSupported AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left slotId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left radio AST#expression#Right . isNRSupported AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isNRSupported(slotId?: number): boolean { if (slotId) { return radio.isNRSupported(slotId); } return radio.isNRSupported(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L309-L314
433da3919618e213bdf8a69e57728635962c8cac
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/StorageManager.ets
arkts
getSecureItem
获取安全存储的敏感数据 @param key 键 @param defaultValue 默认值 @returns 操作结果
static async getSecureItem<T>(key: string, defaultValue?: T): Promise<StorageResult<T>> { return this.getItem(key, defaultValue, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true }); }
AST#method_declaration#Left static async getSecureItem AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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 T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left StorageResult AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . getItem 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#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 AppConstants AST#expression#Right . SECURE_STORAGE_NAME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left encrypted AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async getSecureItem<T>(key: string, defaultValue?: T): Promise<StorageResult<T>> { return this.getItem(key, defaultValue, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L273-L275
f0df46815d125a883508bfed453003602fb13d9b
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/entryability/EntryAbility.ets
arkts
onDestroy
Ability销毁时的回调
onDestroy(): void { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onDestroy'); // 清理资源 this.cleanupServices(); }
AST#method_declaration#Left onDestroy 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 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 '%{public}s' AST#expression#Right , AST#expression#Left 'Ability onDestroy' 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 . cleanupServices 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
onDestroy(): void { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onDestroy'); this.cleanupServices(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L33-L38
52fa0fe7b30b05fc28d05277082a8d0fbbabf3ae
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
startAlipayPayment
发起支付宝支付 @returns {void} 无返回值
startAlipayPayment(): void { if (!this.orderId) { return; } const params: AlipayPayParams = { orderId: this.orderId }; RequestHelper.repository<string>(this.orderRepository.alipayAppPay(params)) .execute() .then((payInfo: string): void => { this.startAlipaySdk(payInfo); }); }
AST#method_declaration#Left startAlipayPayment 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 . orderId 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 const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left AlipayPayParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left orderId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderId 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#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 string 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderRepository AST#member_expression#Right AST#expression#Right . alipayAppPay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params 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 . 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 payInfo : 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 { 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 . startAlipaySdk AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left payInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
startAlipayPayment(): void { if (!this.orderId) { return; } const params: AlipayPayParams = { orderId: this.orderId }; RequestHelper.repository<string>(this.orderRepository.alipayAppPay(params)) .execute() .then((payInfo: string): void => { this.startAlipaySdk(payInfo); }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets#L59-L69
ee2368a55fe6e7ac387c985157da25200a67f05b
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets
arkts
clear
Clears the chart from all data (sets it to null) and refreshes it (by calling invalidate()).
public clear() { this.mData = null; this.mOffsetsCalculated = false; this.mIndicesToHighlight = null; this.mChartTouchListener.setLastHighlighted(null); this.invalidate(); }
AST#method_declaration#Left public clear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData 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 . mOffsetsCalculated 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 . mIndicesToHighlight 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mChartTouchListener AST#member_expression#Right AST#expression#Right . setLastHighlighted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#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 . invalidate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public clear() { this.mData = null; this.mOffsetsCalculated = false; this.mIndicesToHighlight = null; this.mChartTouchListener.setLastHighlighted(null); this.invalidate(); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L240-L246
97a5e72f56daffe045cc0a3e055b2d71f1c7b19f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
getMainUIContext
获取MainWindow的UIContext @returns
static getMainUIContext(): UIContext | undefined { if (DialogHelper.mainUIContext) { return DialogHelper.mainUIContext; } try { const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext(); if (uiContext) { DialogHelper.mainUIContext = uiContext; } } catch (e) { //在 onWindowStageCreate 的 windowStage.loadContent(),之前调用,有可能会获取不到UIContext。 } return DialogHelper.mainUIContext; }
AST#method_declaration#Left static getMainUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UIContext AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . mainUIContext AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . mainUIContext AST#member_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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uiContext = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . getUIAbilityContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . windowStage AST#member_expression#Right AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getUIContext 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 uiContext 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 DialogHelper AST#expression#Right . mainUIContext AST#member_expression#Right = AST#expression#Left uiContext 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#catch_clause#Left catch ( e ) AST#block_statement#Left { //在 onWindowStageCreate 的 windowStage.loadContent(),之前调用,有可能会获取不到UIContext。 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . mainUIContext AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getMainUIContext(): UIContext | undefined { if (DialogHelper.mainUIContext) { return DialogHelper.mainUIContext; } try { const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext(); if (uiContext) { DialogHelper.mainUIContext = uiContext; } } catch (e) { } return DialogHelper.mainUIContext; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L91-L104
a6cea2cd83c0f70658aced7e21f7cc30627243a7
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/network/BaseNetWorkView.ets
arkts
渲染网络请求状态视图 @returns {void} 无返回值
build() { Stack() { Column() { if (this.loadingBuilder) { this.loadingBuilder(); } else { this.buildDefaultLoading(); } } .opacity(this.uiState === BaseNetWorkUiState.LOADING ? 1 : 0) .animation({ duration: 200, curve: Curve.EaseInOut }); Column() { if (this.errorBuilder) { this.errorBuilder(); } else { this.buildDefaultError(); } } .opacity(this.uiState === BaseNetWorkUiState.ERROR ? 1 : 0) .animation({ duration: 200, curve: Curve.EaseInOut }); Column() { if (this.content) { this.content(); } } .opacity(this.uiState === BaseNetWorkUiState.LOADING || this.uiState === BaseNetWorkUiState.ERROR ? 0 : 1) .animation({ duration: 200, curve: Curve.EaseInOut }); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadingBuilder AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadingBuilder 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 } else { 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 . buildDefaultLoading AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#conditional_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 . uiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#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 duration AST#property_name#Right : AST#expression#Left 200 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . errorBuilder AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . errorBuilder 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 } else { 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 . buildDefaultError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#conditional_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 . uiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . ERROR AST#member_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#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 duration AST#property_name#Right : AST#expression#Left 200 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#conditional_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#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 . uiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . uiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . ERROR AST#member_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . animation ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 200 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Stack() { Column() { if (this.loadingBuilder) { this.loadingBuilder(); } else { this.buildDefaultLoading(); } } .opacity(this.uiState === BaseNetWorkUiState.LOADING ? 1 : 0) .animation({ duration: 200, curve: Curve.EaseInOut }); Column() { if (this.errorBuilder) { this.errorBuilder(); } else { this.buildDefaultError(); } } .opacity(this.uiState === BaseNetWorkUiState.ERROR ? 1 : 0) .animation({ duration: 200, curve: Curve.EaseInOut }); Column() { if (this.content) { this.content(); } } .opacity(this.uiState === BaseNetWorkUiState.LOADING || this.uiState === BaseNetWorkUiState.ERROR ? 0 : 1) .animation({ duration: 200, curve: Curve.EaseInOut }); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/network/BaseNetWorkView.ets#L62-L92
6abb22b39a6e7fa9b3b81f64015498694886c230
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/Helper.ets
arkts
getCacheDirPath
获取缓存目录下的文件夹路径或文件路径。 @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns
static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir; //根目录 if (Helper.isNotEmpty(dirPath)) { if (Helper.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。 filePath = dirPath; } else { //路径中不包含根目录,拼接成完整路径。 filePath = filePath + Helper.separator + dirPath; } if (!Helper.accessSync(filePath)) { Helper.mkdirSync(filePath) //如果文件夹不存在就创建 } } if (Helper.isNotEmpty(fileName)) { filePath = filePath + Helper.separator + fileName; } return filePath; }
AST#method_declaration#Left static getCacheDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left blHap : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePath = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left blHap AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . cacheDir AST#member_expression#Right AST#expression#Right : AST#expression#Left getContext AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getApplicationContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . cacheDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //根目录 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . hasDirPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dirPath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { //路径中包含根目录,是完整路径。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left dirPath AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { //路径中不包含根目录,拼接成完整路径。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filePath AST#expression#Right + AST#expression#Left Helper AST#expression#Right AST#binary_expression#Right AST#expression#Right . separator AST#member_expression#Right AST#expression#Right + AST#expression#Left dirPath AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left Helper AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . mkdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //如果文件夹不存在就创建 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Helper AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filePath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filePath AST#expression#Right + AST#expression#Left Helper AST#expression#Right AST#binary_expression#Right AST#expression#Right . separator AST#member_expression#Right AST#expression#Right + AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left filePath AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir; if (Helper.isNotEmpty(dirPath)) { if (Helper.hasDirPath(dirPath)) { filePath = dirPath; } else { filePath = filePath + Helper.separator + dirPath; } if (!Helper.accessSync(filePath)) { Helper.mkdirSync(filePath) } } if (Helper.isNotEmpty(fileName)) { filePath = filePath + Helper.separator + fileName; } return filePath; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L193-L209
26935a0793cc75260d89482f2f642a227f98306c
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/BusinessSample/entry/src/main/ets/common/bean/TabItemData.ets
arkts
Tab item data entity.
export class TabItemData { /** * Tab index. */ index: number; /** * Tab original icon. */ imageOriginal: Resource; /** * Tab activated icon. */ imageActivated: Resource; /** * Tab title. */ title: Resource; }
AST#export_declaration#Left export AST#class_declaration#Left class TabItemData AST#class_body#Left { /** * Tab index. */ AST#property_declaration#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Tab original icon. */ AST#property_declaration#Left imageOriginal : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Tab activated icon. */ AST#property_declaration#Left imageActivated : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Tab title. */ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class TabItemData { index: number; imageOriginal: Resource; imageActivated: Resource; title: Resource; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/common/bean/TabItemData.ets#L4-L24
c58ff7a0430aacff8bc3ac1981f7f86d42c89098
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/pages/WeeklyTaskPage.ets
arkts
buildEmptyState
构建空状态
@Builder buildEmptyState() { Column() { Image($r('app.media.ic_empty_tasks')) .width(120) .height(120) .margin({ bottom: 16 }) Text('暂无任务安排') .fontSize(18) .fontColor('#999999') .margin({ bottom: 8 }) Text('点击上方"添加任务"按钮开始安排您的周任务') .fontSize(14) .fontColor('#999999') .textAlign(TextAlign.Center) } .width('100%') .height(300) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyState AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_empty_tasks' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 120 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 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '暂无任务安排' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' 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 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 buildEmptyState() { Column() { Image($r('app.media.ic_empty_tasks')) .width(120) .height(120) .margin({ bottom: 16 }) Text('暂无任务安排') .fontSize(18) .fontColor('#999999') .margin({ bottom: 8 }) Text('点击上方"添加任务"按钮开始安排您的周任务') .fontSize(14) .fontColor('#999999') .textAlign(TextAlign.Center) } .width('100%') .height(300) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L101-L123
4ac6881b4ef6d640891b90febb3ead681762aa5b
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
获取动态评论 @param id 动态ID @param page 页码 @param size 每页大小 @returns 评论列表
export function getPostComments(id: number, page: number, size: number): Promise<Comment[]> { try { console.info(`获取动态评论, id: ${id}, page: ${page}, size: ${size}`); const params: RequestData = { page, size }; // 确保路径以"/"开头,修复URL结构 return request<ApiResponse<Comment[]>>(RequestMethod.GET, `/posts/${id}/comments`, params as QueryParams) .then((response: ApiResponse<Comment[]>) => { // 正确解析ApiResponse结构 if (response && response.data) { return response.data || []; } return []; }) .catch((error: Error) => { // 如果API返回404或其他错误,记录日志但返回空数组,避免前端崩溃 console.warn(`评论API错误: ${error.message}, 返回空列表`); return [] as Comment[]; }); } catch (error) { // 捕获其他可能的错误,仍然返回空数组 console.error(`获取动态评论失败: ${error instanceof Error ? error.message : String(error)}`); return Promise.resolve([] as Comment[]); } }
AST#export_declaration#Left export AST#function_declaration#Left function getPostComments AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 获取动态评论, id: AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right , page: AST#template_substitution#Left $ { AST#expression#Left page AST#expression#Right } AST#template_substitution#Right , size: AST#template_substitution#Left $ { AST#expression#Left size AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left RequestData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left page AST#property_assignment#Right , AST#property_assignment#Left size AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 确保路径以"/"开头,修复URL结构 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ApiResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /posts/ AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right /comments ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left params AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left QueryParams AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 response : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ApiResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_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 { // 正确解析ApiResponse结构 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 response AST#expression#Right && AST#expression#Left response AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right 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#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 如果API返回404或其他错误,记录日志但返回空数组,避免前端崩溃 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 评论API错误: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , 返回空列表 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { // 捕获其他可能的错误,仍然返回空数组 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Promise AST#expression#Right . resolve AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getPostComments(id: number, page: number, size: number): Promise<Comment[]> { try { console.info(`获取动态评论, id: ${id}, page: ${page}, size: ${size}`); const params: RequestData = { page, size }; return request<ApiResponse<Comment[]>>(RequestMethod.GET, `/posts/${id}/comments`, params as QueryParams) .then((response: ApiResponse<Comment[]>) => { if (response && response.data) { return response.data || []; } return []; }) .catch((error: Error) => { console.warn(`评论API错误: ${error.message}, 返回空列表`); return [] as Comment[]; }); } catch (error) { console.error(`获取动态评论失败: ${error instanceof Error ? error.message : String(error)}`); return Promise.resolve([] as Comment[]); } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L906-L934
d14ffb0928fc8a776a0d682ced7b76749bd4f3d0
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets
arkts
SetCodeCallBack
设置有序公共事件的结果代码回调
function SetCodeCallBack() { }
AST#function_declaration#Left function SetCodeCallBack AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#function_declaration#Right
function SetCodeCallBack() { }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L356-L357
54589185007d2ce6e021a61866e2f68695d37514
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
setDrawValueAboveBar
If set to true, all values are drawn above their bars, instead of below their top. @param enabled
public setDrawValueAboveBar(enabled: boolean): void { this.mDrawValueAboveBar = enabled; }
AST#method_declaration#Left public setDrawValueAboveBar AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#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 . mDrawValueAboveBar AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setDrawValueAboveBar(enabled: boolean): void { this.mDrawValueAboveBar = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L203-L205
1dbeba12c63db2be7910bd6825c3f8bf30da1c08
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets
arkts
exchangeIcon
点击即可交换的图标
@Builder exchangeIcon() { Image($r('app.media.address_exchange_airplane')) .size({ height: $r('app.integer.address_exchange_airplane_size'), width: $r('app.integer.address_exchange_airplane_size') }) Image($r('app.media.address_exchange_recycle')) .id('translate_image') .size({ height: $r('app.integer.address_exchange_recycle_size'), width: $r('app.integer.address_exchange_recycle_size') }) .rotate({ angle: this.rotateAngle }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right exchangeIcon 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.address_exchange_airplane' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.address_exchange_airplane_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.address_exchange_airplane_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.address_exchange_recycle' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'translate_image' AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.address_exchange_recycle_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.address_exchange_recycle_size' 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 . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rotateAngle AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder exchangeIcon() { Image($r('app.media.address_exchange_airplane')) .size({ height: $r('app.integer.address_exchange_airplane_size'), width: $r('app.integer.address_exchange_airplane_size') }) Image($r('app.media.address_exchange_recycle')) .id('translate_image') .size({ height: $r('app.integer.address_exchange_recycle_size'), width: $r('app.integer.address_exchange_recycle_size') }) .rotate({ angle: this.rotateAngle }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets#L171-L185
762feaa0b80ce6a6aa31cbb40124ac317120d388
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets
arkts
toolTouch
悬浮球样式 @param {ToolTouchInterface} $$ - 悬浮球入参
@Builder toolTouch($$: ToolTouchInterface) { Button() { Button() .height(CommonConstants.EIGHTY_PERCENT) .width(CommonConstants.EIGHTY_PERCENT) .backgroundColor($$.isDisable ? Color.Red : Color.Gray) .opacity(0.5) } .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .backgroundColor($$.isDisable ? 0xFFA28F : 0xD3D3D3) .opacity(0.5) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right toolTouch AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left ToolTouchInterface 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 Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . EIGHTY_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . EIGHTY_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left $$ AST#expression#Right . isDisable AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left $$ AST#expression#Right . isDisable AST#member_expression#Right AST#expression#Right ? AST#expression#Left 0xFFA28F AST#expression#Right : AST#expression#Left 0xD3D3D3 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder toolTouch($$: ToolTouchInterface) { Button() { Button() .height(CommonConstants.EIGHTY_PERCENT) .width(CommonConstants.EIGHTY_PERCENT) .backgroundColor($$.isDisable ? Color.Red : Color.Gray) .opacity(0.5) } .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .backgroundColor($$.isDisable ? 0xFFA28F : 0xD3D3D3) .opacity(0.5) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets#L222-L235
8ef997f839c36740c271c0fd2504c5832052d9f5
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets
arkts
getLabelRotationAngle
returns the angle for drawing the X axis labels (in degrees)
public getLabelRotationAngle(): number { return this.mLabelRotationAngle; }
AST#method_declaration#Left public getLabelRotationAngle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLabelRotationAngle AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getLabelRotationAngle(): number { return this.mLabelRotationAngle; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L93-L95
af06720d194da0893de9a8f29e72b0bc95db9725
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets
arkts
notifyDataReload
通知LazyForEach组件需要重载所有子组件
notifyDataReload(): void { Logger.debug('notifyDataReload'); this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'notifyDataReload' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataReloaded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
notifyDataReload(): void { Logger.debug('notifyDataReload'); this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets#L229-L234
a196ebfdf4e7158b816fbd708f92ab8e7015e326
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
buildUsageTab
构建使用情况标签页
@Builder buildUsageTab(usage: UsageStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { // 使用时长统计 this.buildStatsCard('使用时长', [ { label: '今日使用', value: this.formatDuration(usage.dailyActiveTime), icon: $r('app.media.ic_today') }, { label: '本周使用', value: this.formatDuration(usage.weeklyActiveTime), icon: $r('app.media.ic_week') }, { label: '本月使用', value: this.formatDuration(usage.monthlyActiveTime), icon: $r('app.media.ic_month') } ]) // 使用次数统计 this.buildStatsCard('使用次数', [ { label: '总启动次数', value: usage.totalLaunches.toString(), icon: $r('app.media.ic_launch') }, { label: '连续使用', value: `${usage.streakDays}天`, icon: $r('app.media.ic_streak') }, { label: '平均会话', value: this.formatDuration(usage.averageSessionDuration), icon: $r('app.media.ic_session') } ]) // 功能使用分布 if (usage.featureUsage.length > 0) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('功能使用分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) ForEach(usage.featureUsage, (item) => { Row() { Text(item.feature) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .layoutWeight(1) Progress({ value: item.percentage, total: 100, type: ProgressType.Linear }) .width('100vp') .height('6vp') .color($r('app.color.secondary')) .backgroundColor($r('app.color.divider')) Text(`${item.percentage}%`) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_secondary')) .width('40vp') .textAlign(TextAlign.End) } .width('100%') .alignItems(VerticalAlign.Center) .padding(UIConstants.SMALL_PADDING) }) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } } } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } .width('100%') .height('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUsageTab AST#parameter_list#Left ( AST#parameter#Left usage : AST#type_annotation#Left AST#primary_type#Left UsageStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 使用时长统计 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildStatsCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '使用时长' AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left label AST#property_name#Right : AST#expression#Left '今日使用' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatDuration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left usage AST#expression#Right . dailyActiveTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_today' 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 label AST#property_name#Right : AST#expression#Left '本周使用' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatDuration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left usage AST#expression#Right . weeklyActiveTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_week' 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 label AST#property_name#Right : AST#expression#Left '本月使用' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatDuration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left usage AST#expression#Right . monthlyActiveTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_month' 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#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 . buildStatsCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '使用次数' AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left label AST#property_name#Right : AST#expression#Left '总启动次数' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value 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 usage AST#expression#Right . totalLaunches AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_launch' 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 label AST#property_name#Right : AST#expression#Left '连续使用' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left usage AST#expression#Right . streakDays AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 天 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_streak' 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 label AST#property_name#Right : AST#expression#Left '平均会话' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formatDuration AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left usage AST#expression#Right . averageSessionDuration AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left icon AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_session' 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 功能使用分布 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left usage AST#expression#Right . featureUsage AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '功能使用分布' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_HEADING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left usage AST#expression#Right . featureUsage AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . feature AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . percentage AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left 100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ProgressType AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '6vp' AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.divider' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . percentage AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right % ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '40vp' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . SMALL_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . DEFAULT_PADDING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildUsageTab(usage: UsageStats) { Scroll() { Column({ space: UIConstants.DEFAULT_PADDING }) { this.buildStatsCard('使用时长', [ { label: '今日使用', value: this.formatDuration(usage.dailyActiveTime), icon: $r('app.media.ic_today') }, { label: '本周使用', value: this.formatDuration(usage.weeklyActiveTime), icon: $r('app.media.ic_week') }, { label: '本月使用', value: this.formatDuration(usage.monthlyActiveTime), icon: $r('app.media.ic_month') } ]) this.buildStatsCard('使用次数', [ { label: '总启动次数', value: usage.totalLaunches.toString(), icon: $r('app.media.ic_launch') }, { label: '连续使用', value: `${usage.streakDays}天`, icon: $r('app.media.ic_streak') }, { label: '平均会话', value: this.formatDuration(usage.averageSessionDuration), icon: $r('app.media.ic_session') } ]) if (usage.featureUsage.length > 0) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text('功能使用分布') .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.text_primary')) ForEach(usage.featureUsage, (item) => { Row() { Text(item.feature) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_primary')) .layoutWeight(1) Progress({ value: item.percentage, total: 100, type: ProgressType.Linear }) .width('100vp') .height('6vp') .color($r('app.color.secondary')) .backgroundColor($r('app.color.divider')) Text(`${item.percentage}%`) .fontSize(UIConstants.FONT_SIZE_BODY) .fontColor($r('app.color.text_secondary')) .width('40vp') .textAlign(TextAlign.End) } .width('100%') .alignItems(VerticalAlign.Center) .padding(UIConstants.SMALL_PADDING) }) } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } } } .width('100%') .padding(UIConstants.DEFAULT_PADDING) } .width('100%') .height('100%') }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L507-L572
342e4e73a8a81eb2ffe4c5bb083c9294a74d7060
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/ImageKnife.ets
arkts
preload
预加载 @param loadSrc 图片地址url @returns 图片请求request
preload(loadSrc:string | ImageKnifeOption):ImageKnifeRequest{ let imageKnifeOption = new ImageKnifeOption() if (typeof loadSrc == 'string') { imageKnifeOption.loadSrc = loadSrc } else { imageKnifeOption = loadSrc; } let request = new ImageKnifeRequest( imageKnifeOption, imageKnifeOption.context !== undefined ? imageKnifeOption.context : getContext(this) as common.UIAbilityContext, 0, 0, 0, { showPixelMap(version: number, pixelMap: PixelMap | string) { } } ) this.execute(request) return request }
AST#method_declaration#Left preload AST#parameter_list#Left ( AST#parameter#Left loadSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ImageKnifeOption 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 ImageKnifeRequest AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageKnifeOption = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImageKnifeOption 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left loadSrc AST#expression#Right AST#unary_expression#Right AST#expression#Right == AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left imageKnifeOption AST#expression#Right . loadSrc AST#member_expression#Right = AST#expression#Left loadSrc 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 imageKnifeOption = AST#expression#Left loadSrc 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 request = 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 ImageKnifeRequest AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageKnifeOption AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageKnifeOption AST#expression#Right . context AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left imageKnifeOption AST#expression#Right . context AST#member_expression#Right AST#expression#Right : AST#expression#Left getContext AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left showPixelMap AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left version : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pixelMap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . execute 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 AST#statement#Left AST#return_statement#Left return AST#expression#Left request AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
preload(loadSrc:string | ImageKnifeOption):ImageKnifeRequest{ let imageKnifeOption = new ImageKnifeOption() if (typeof loadSrc == 'string') { imageKnifeOption.loadSrc = loadSrc } else { imageKnifeOption = loadSrc; } let request = new ImageKnifeRequest( imageKnifeOption, imageKnifeOption.context !== undefined ? imageKnifeOption.context : getContext(this) as common.UIAbilityContext, 0, 0, 0, { showPixelMap(version: number, pixelMap: PixelMap | string) { } } ) this.execute(request) return request }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L154-L174
3b5edf637222e50f302cacd19c7cf7de70497749
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosConfig.ets
arkts
Transforming the Auth into a Sendable interface
export interface IAuth extends lang.ISendable { username: string; password: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface IAuth AST#extends_clause#Left extends AST#extends_clause#Right AST#ERROR#Left AST#qualified_type#Left lang . ISendable AST#qualified_type#Right AST#ERROR#Right AST#object_type#Left { AST#type_member#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface IAuth extends lang.ISendable { username: string; password: string; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosConfig.ets#L35-L38
fb9c888ec64d53d05d3c00a17342bd6045806e9a
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/LogService.ets
arkts
initialize
初始化日志服务
async initialize(context: common.UIAbilityContext): Promise<void> { if (this.isInitialized) { console.info('[LogService] 已经初始化,跳过'); return; } console.info('[LogService] ========== 开始初始化日志服务 =========='); try { // 获取应用文件目录 const filesDir = context.filesDir; this.logDir = `${filesDir}/logs`; console.info(`[LogService] 应用文件目录: ${filesDir}`); console.info(`[LogService] 日志目录将创建在: ${this.logDir}`); // 创建日志目录 try { await fileIo.mkdir(this.logDir); console.info(`[LogService] ✅ 日志目录创建成功: ${this.logDir}`); } catch (e) { // 目录可能已存在 console.info(`[LogService] ℹ️ 日志目录可能已存在: ${this.logDir}`); // 验证目录是否真的存在 try { const stat = await fileIo.stat(this.logDir); if (stat.isDirectory()) { console.info(`[LogService] ✅ 验证通过:日志目录存在且可访问`); } } catch (statError) { console.error(`[LogService] ❌ 日志目录不存在且无法创建: ${JSON.stringify(statError)}`); throw new Error(`无法创建日志目录: ${JSON.stringify(statError)}`); } } // 创建当天的日志文件 const today = new Date(); const dateStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`; this.currentLogFile = `${this.logDir}/lumos_${dateStr}.log`; console.info(`[LogService] 日志文件路径: ${this.currentLogFile}`); // 写入启动日志 console.info(`[LogService] 准备写入启动日志...`); await this.writeToFile(`\n${'='.repeat(60)}\n`); await this.writeToFile(`[${this.getTimestamp()}] === Lumos Agent 启动 ===\n`); await this.writeToFile(`日志文件: ${this.currentLogFile}\n`); await this.writeToFile(`${'='.repeat(60)}\n\n`); console.info(`[LogService] ✅ 启动日志写入成功`); // 启动定时刷新(每2秒将缓冲区写入文件) this.flushTimer = setInterval(() => { this.flush(); }, 2000); this.isInitialized = true; console.info(`[LogService] ========== ✅ 日志服务初始化完成 ==========`); console.info(`[LogService] 日志目录: ${this.logDir}`); console.info(`[LogService] 当前日志文件: ${this.currentLogFile}`); } catch (error) { console.error(`[LogService] ========== ❌ 初始化失败 ==========`); console.error(`[LogService] 错误详情: ${JSON.stringify(error)}`); console.error(`[LogService] 错误堆栈: ${error}`); // 即使初始化失败,也标记为已初始化,以便后续日志能输出到控制台 this.isInitialized = true; } }
AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[LogService] 已经初始化,跳过' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[LogService] ========== 开始初始化日志服务 ==========' 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#try_statement#Left try AST#block_statement#Left { // 获取应用文件目录 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filesDir = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logDir AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left filesDir AST#expression#Right } AST#template_substitution#Right /logs ` AST#template_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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] 应用文件目录: AST#template_substitution#Left $ { AST#expression#Left filesDir AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] 日志目录将创建在: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logDir 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#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#await_expression#Left await AST#expression#Left fileIo AST#expression#Right AST#await_expression#Right AST#expression#Right . mkdir 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 . logDir AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] ✅ 日志目录创建成功: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] ℹ️ 日志目录可能已存在: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logDir 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left stat = 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 fileIo AST#expression#Right AST#await_expression#Right AST#expression#Right . stat 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 . logDir 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left stat AST#expression#Right . isDirectory 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] ✅ 验证通过:日志目录存在且可访问 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( statError ) 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 ` [LogService] ❌ 日志目录不存在且无法创建: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left statError AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#expression#Left AST#template_literal#Left ` 无法创建日志目录: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left statError AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_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#catch_clause#Right AST#try_statement#Right AST#statement#Right // 创建当天的日志文件 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left today = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left dateStr = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#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 String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today AST#expression#Right . getMonth 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 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left today AST#expression#Right . getDate 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 . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentLogFile AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /lumos_ AST#template_substitution#Left $ { AST#expression#Left dateStr AST#expression#Right } AST#template_substitution#Right .log ` AST#template_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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] 日志文件路径: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentLogFile AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 写入启动日志 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] 准备写入启动日志... ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . writeToFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` \n AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left '=' AST#expression#Right . repeat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 60 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right \n ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . writeToFile 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getTimestamp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ] === Lumos Agent 启动 === \n ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . writeToFile 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentLogFile AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \n ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . writeToFile 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left '=' AST#expression#Right . repeat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 60 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right \n \n ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] ✅ 启动日志写入成功 ` 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 // 启动定时刷新(每2秒将缓冲区写入文件) 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 . flushTimer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval 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 . 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#arrow_function#Right AST#expression#Right , AST#expression#Left 2000 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 this AST#expression#Right . isInitialized 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] ========== ✅ 日志服务初始化完成 ========== ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] 日志目录: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] 当前日志文件: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentLogFile AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] ========== ❌ 初始化失败 ========== ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [LogService] 错误详情: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 ` [LogService] 错误堆栈: 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async initialize(context: common.UIAbilityContext): Promise<void> { if (this.isInitialized) { console.info('[LogService] 已经初始化,跳过'); return; } console.info('[LogService] ========== 开始初始化日志服务 =========='); try { const filesDir = context.filesDir; this.logDir = `${filesDir}/logs`; console.info(`[LogService] 应用文件目录: ${filesDir}`); console.info(`[LogService] 日志目录将创建在: ${this.logDir}`); try { await fileIo.mkdir(this.logDir); console.info(`[LogService] ✅ 日志目录创建成功: ${this.logDir}`); } catch (e) { console.info(`[LogService] ℹ️ 日志目录可能已存在: ${this.logDir}`); try { const stat = await fileIo.stat(this.logDir); if (stat.isDirectory()) { console.info(`[LogService] ✅ 验证通过:日志目录存在且可访问`); } } catch (statError) { console.error(`[LogService] ❌ 日志目录不存在且无法创建: ${JSON.stringify(statError)}`); throw new Error(`无法创建日志目录: ${JSON.stringify(statError)}`); } } const today = new Date(); const dateStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`; this.currentLogFile = `${this.logDir}/lumos_${dateStr}.log`; console.info(`[LogService] 日志文件路径: ${this.currentLogFile}`); console.info(`[LogService] 准备写入启动日志...`); await this.writeToFile(`\n${'='.repeat(60)}\n`); await this.writeToFile(`[${this.getTimestamp()}] === Lumos Agent 启动 ===\n`); await this.writeToFile(`日志文件: ${this.currentLogFile}\n`); await this.writeToFile(`${'='.repeat(60)}\n\n`); console.info(`[LogService] ✅ 启动日志写入成功`); this.flushTimer = setInterval(() => { this.flush(); }, 2000); this.isInitialized = true; console.info(`[LogService] ========== ✅ 日志服务初始化完成 ==========`); console.info(`[LogService] 日志目录: ${this.logDir}`); console.info(`[LogService] 当前日志文件: ${this.currentLogFile}`); } catch (error) { console.error(`[LogService] ========== ❌ 初始化失败 ==========`); console.error(`[LogService] 错误详情: ${JSON.stringify(error)}`); console.error(`[LogService] 错误堆栈: ${error}`); this.isInitialized = true; } }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/LogService.ets#L48-L112
475b9c5786d8e61878ff59343797c9aab9efdd30
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets
arkts
notifyDataChange
通知控制器数据变化 @param index 数组索引
notifyDataChange(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataChange(index); }) }
AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
notifyDataChange(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataChange(index); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L105-L109
baec4dc77de26a148f2dfad7a0f77520b2d8f949
gitee
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/components/MusicMyComponent.ets
arkts
useAddDirectory
@description: 跳转到歌单列表页 @date: 2024-07-16 22:37 @author wuwenqiang
useAddDirectory(){ this.favoriteDialogController = new CustomDialogController({ customStyle: true, builder: BottomDialogComponent({ dialogHeight: '80%', builder: this.favoriteBuilder.bind(this) }), alignment: DialogAlignment.Bottom, }) this.favoriteDialogController.open() }
AST#method_declaration#Left useAddDirectory AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . favoriteDialogController AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomDialogController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left customStyle 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 builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left BottomDialogComponent AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dialogHeight AST#property_name#Right : AST#expression#Left '80%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left builder 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 . favoriteBuilder AST#member_expression#Right AST#expression#Right . bind AST#member_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 AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom 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#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 . favoriteDialogController AST#member_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
useAddDirectory(){ this.favoriteDialogController = new CustomDialogController({ customStyle: true, builder: BottomDialogComponent({ dialogHeight: '80%', builder: this.favoriteBuilder.bind(this) }), alignment: DialogAlignment.Bottom, }) this.favoriteDialogController.open() }
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicMyComponent.ets#L63-L73
eb65b24c0164c86d3d4a9a7184a445936b63f9fd
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets
arkts
getAppListAsync
Get the list of apps displayed on the desktop (private function). @return {array} bundleInfoList, excluding system applications
async getAppListAsync(): Promise<AppItemInfo[]> { let allAbilityList: AppItemInfo[] | undefined = await this.mLauncherAbilityManager?.getLauncherAbilityList(); Logger.info(TAG, `getAppListAsync allAbilityList length: ${allAbilityList?.length}`); let launcherAbilityList: AppItemInfo[] = []; for (let i = 0; i < allAbilityList!.length; i++) { if (this.mSystemApplicationName.indexOf(allAbilityList![i].bundleName) === CommonConstants.INVALID_VALUE) { launcherAbilityList.push(allAbilityList![i]); FormModel.updateAppItemFormInfo(allAbilityList![i].bundleName); } } Logger.debug(TAG, `getAppListAsync launcherAbiltyList length: ${launcherAbilityList.length}`); return launcherAbilityList; }
AST#method_declaration#Left async getAppListAsync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AppItemInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left allAbilityList : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left AppItemInfo [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#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 . mLauncherAbilityManager AST#member_expression#Right AST#expression#Right ?. getLauncherAbilityList 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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getAppListAsync allAbilityList length: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left allAbilityList AST#expression#Right ?. length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left launcherAbilityList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AppItemInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left allAbilityList AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 this AST#expression#Right . mSystemApplicationName AST#member_expression#Right AST#expression#Right . indexOf 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 AST#non_null_assertion_expression#Left AST#expression#Left allAbilityList AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . INVALID_VALUE 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 launcherAbilityList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left allAbilityList AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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 FormModel AST#expression#Right . updateAppItemFormInfo 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 AST#non_null_assertion_expression#Left AST#expression#Left allAbilityList AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getAppListAsync launcherAbiltyList length: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left launcherAbilityList AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left launcherAbilityList AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getAppListAsync(): Promise<AppItemInfo[]> { let allAbilityList: AppItemInfo[] | undefined = await this.mLauncherAbilityManager?.getLauncherAbilityList(); Logger.info(TAG, `getAppListAsync allAbilityList length: ${allAbilityList?.length}`); let launcherAbilityList: AppItemInfo[] = []; for (let i = 0; i < allAbilityList!.length; i++) { if (this.mSystemApplicationName.indexOf(allAbilityList![i].bundleName) === CommonConstants.INVALID_VALUE) { launcherAbilityList.push(allAbilityList![i]); FormModel.updateAppItemFormInfo(allAbilityList![i].bundleName); } } Logger.debug(TAG, `getAppListAsync launcherAbiltyList length: ${launcherAbilityList.length}`); return launcherAbilityList; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L213-L225
17b1b1bc66a8e43f1c58db924dde36cf215616a0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/refreshtimeline/src/main/ets/view/RefreshTimeLine.ets
arkts
getTimeLineMode
时间轴模块
@Builder getTimeLineMode(time: string, text: string) { Row() { Column() { // 时间轴 Column() .width($r('app.integer.refreshtimeline_width_and_height_zero')) .height($r('app.integer.refreshtimeline_width_and_height_one_hundred_and_forty')) .border({ width: { left: $r('app.string.refreshtimeline_time_line_width') }, color: { left: $r('app.color.refreshtimeline_time_line_color') }, style: { left: BorderStyle.Dotted } }) // 时间轴节点 Column() .width($r('app.integer.refreshtimeline_width_and_height_ten')) .height($r('app.integer.refreshtimeline_width_and_height_ten')) .backgroundColor($r('app.color.refreshtimeline_time_node_color')) .borderRadius($r('app.integer.refreshtimeline_borderRadius_fifty')) .position({ x: $r('app.integer.refreshtimeline_position_X'), y: $r('app.integer.refreshtimeline_position_Y') }) } .margin({ left: $r('app.integer.refreshtimeline_margin_left_twenty') }) // 内容区域 Column() { Text(time) .fontSize($r('app.integer.refreshtimeline_font_size_fourteen')) .width($r('app.string.refreshtimeline_one_hundred_percent')) .height($r('app.integer.refreshtimeline_width_and_height_twenty')) .margin({ left: $r('app.integer.refreshtimeline_margin_left_ten'), top: $r('app.integer.refreshtimeline_margin_top_five'), bottom: $r('app.integer.refreshtimeline_margin_bottom_five') }) Text(text) .width($r('app.string.refreshtimeline_one_hundred_percent')) .margin({ left: $r('app.integer.refreshtimeline_margin_left_ten'), top: $r('app.integer.refreshtimeline_margin_top_five') }) .fontSize($r('app.integer.refreshtimeline_font_size_sixteen')) } .width($r('app.string.refreshtimeline_eighty_four_percent')) .height($r('app.integer.refreshtimeline_width_and_height_one_hundred_and_twenty')) .borderRadius($r('app.integer.refreshtimeline_borderRadius_ten')) .margin({ left: $r('app.integer.refreshtimeline_margin_left_twelve'), top: $r('app.integer.refreshtimeline_margin_top_fifteen'), bottom: $r('app.integer.refreshtimeline_margin_bottom_five') }) .backgroundColor(Color.White) } .width($r('app.string.refreshtimeline_one_hundred_percent')) .backgroundColor($r('app.color.refreshtimeline_time_line_mode_back_color')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getTimeLineMode AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_width_and_height_zero' 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.refreshtimeline_width_and_height_one_hundred_and_forty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.refreshtimeline_time_line_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.refreshtimeline_time_line_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dotted 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 Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_width_and_height_ten' 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.refreshtimeline_width_and_height_ten' 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.refreshtimeline_time_node_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.refreshtimeline_borderRadius_fifty' AST#expression#Right ) AST#resource_expression#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 AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_position_X' AST#expression#Right ) AST#resource_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#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_position_Y' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_margin_left_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 内容区域 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 time 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.refreshtimeline_font_size_fourteen' 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.refreshtimeline_one_hundred_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_width_and_height_twenty' 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.refreshtimeline_margin_left_ten' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.refreshtimeline_margin_top_five' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_margin_bottom_five' 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 Text ( AST#expression#Left text 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.refreshtimeline_one_hundred_percent' 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.refreshtimeline_margin_left_ten' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.refreshtimeline_margin_top_five' 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 . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_font_size_sixteen' 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#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.refreshtimeline_eighty_four_percent' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_width_and_height_one_hundred_and_twenty' 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.refreshtimeline_borderRadius_ten' 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.refreshtimeline_margin_left_twelve' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.refreshtimeline_margin_top_fifteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.refreshtimeline_margin_bottom_five' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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.refreshtimeline_one_hundred_percent' 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.refreshtimeline_time_line_mode_back_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder getTimeLineMode(time: string, text: string) { Row() { Column() { Column() .width($r('app.integer.refreshtimeline_width_and_height_zero')) .height($r('app.integer.refreshtimeline_width_and_height_one_hundred_and_forty')) .border({ width: { left: $r('app.string.refreshtimeline_time_line_width') }, color: { left: $r('app.color.refreshtimeline_time_line_color') }, style: { left: BorderStyle.Dotted } }) 节点 Column() .width($r('app.integer.refreshtimeline_width_and_height_ten')) .height($r('app.integer.refreshtimeline_width_and_height_ten')) .backgroundColor($r('app.color.refreshtimeline_time_node_color')) .borderRadius($r('app.integer.refreshtimeline_borderRadius_fifty')) .position({ x: $r('app.integer.refreshtimeline_position_X'), y: $r('app.integer.refreshtimeline_position_Y') }) } .margin({ left: $r('app.integer.refreshtimeline_margin_left_twenty') }) Column() { Text(time) .fontSize($r('app.integer.refreshtimeline_font_size_fourteen')) .width($r('app.string.refreshtimeline_one_hundred_percent')) .height($r('app.integer.refreshtimeline_width_and_height_twenty')) .margin({ left: $r('app.integer.refreshtimeline_margin_left_ten'), top: $r('app.integer.refreshtimeline_margin_top_five'), bottom: $r('app.integer.refreshtimeline_margin_bottom_five') }) Text(text) .width($r('app.string.refreshtimeline_one_hundred_percent')) .margin({ left: $r('app.integer.refreshtimeline_margin_left_ten'), top: $r('app.integer.refreshtimeline_margin_top_five') }) .fontSize($r('app.integer.refreshtimeline_font_size_sixteen')) } .width($r('app.string.refreshtimeline_eighty_four_percent')) .height($r('app.integer.refreshtimeline_width_and_height_one_hundred_and_twenty')) .borderRadius($r('app.integer.refreshtimeline_borderRadius_ten')) .margin({ left: $r('app.integer.refreshtimeline_margin_left_twelve'), top: $r('app.integer.refreshtimeline_margin_top_fifteen'), bottom: $r('app.integer.refreshtimeline_margin_bottom_five') }) .backgroundColor(Color.White) } .width($r('app.string.refreshtimeline_one_hundred_percent')) .backgroundColor($r('app.color.refreshtimeline_time_line_mode_back_color')) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/refreshtimeline/src/main/ets/view/RefreshTimeLine.ets#L73-L132
c11ababbbd3a4eebd7d66ca8daaa61a06ad0c104
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/empty/EmptyData.ets
arkts
构建数据缺省页视图 @returns {void} 无返回值
build(): void { Empty({ description: $r("app.string.empty_data"), imageRes: $r("app.media.ic_empty_data") }); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Empty ( AST#component_parameters#Left { AST#component_parameter#Left description : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.empty_data" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left imageRes : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_empty_data" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right
build(): void { Empty({ description: $r("app.string.empty_data"), imageRes: $r("app.media.ic_empty_data") }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/empty/EmptyData.ets#L13-L18
e6af8d25882bec01ef0dd0ecb1a2f17f16e362d6
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/Preferences/entry/src/main/ets/view/TextItemComponent.ets
arkts
TextItemComponent
Text item component.
@Component export default struct TextItemComponent { private textResource: Resource = $r('app.string.empty'); private placeholderResource: Resource = $r('app.string.empty'); private marginBottom: string = ''; private marginTop: string = ''; private textInputType: InputType = InputType.Normal; private textFlag: number = 0; @Link fruit: Fruit; private textInputCallBack = (value: string) => {}; aboutToAppear() { if (this.textFlag === CommonConstants.FRUIT_FLAG) { // Fruit name text input. this.marginTop = StyleConstants.MARGIN_TOP; this.marginBottom = StyleConstants.MARGIN_BOTTOM_SMALL; this.textInputType = InputType.Normal; } else { // Fruit number text input. this.marginBottom = StyleConstants.MARGIN_BOTTOM_BIG; this.textInputType = InputType.Number; } } build() { Column() { Text(this.textResource) .fontSize(StyleConstants.TEXT_FONT_SIZE) .height(StyleConstants.TEXT_HEIGHT) .width(StyleConstants.FULL_PERCENT) .fontColor($r('app.color.text_font_color')) .letterSpacing(StyleConstants.LETTER_SPACING) .fontWeight(StyleConstants.FONT_WEIGHT) .margin({ bottom: StyleConstants.TEXT_MARGIN_BOTTOM, left: StyleConstants.TEXT_MARGIN_LEFT, top: this.marginTop }) TextInput({ placeholder: this.placeholderResource, text: this.textFlag === 0 ? (this.fruit.fruitName) : (this.fruit.fruitNum) }) .placeholderFont({ size: StyleConstants.FONT_SIZE, weight: StyleConstants.FONT_WEIGHT }) .placeholderColor($r('app.color.placeholder_color')) .caretColor(Color.Blue) .type(this.textInputType) .height(StyleConstants.TEXT_INPUT_HEIGHT) .width(StyleConstants.TEXT_INPUT_WIDTH) .margin({ bottom: this.marginBottom }) .fontSize(StyleConstants.FONT_SIZE) .fontColor($r('app.color.text_font_color')) .fontWeight(StyleConstants.FONT_WEIGHT) .backgroundColor($r('app.color.white')) .onChange((value: string) => { this.textInputCallBack(value); }) } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct TextItemComponent AST#component_body#Left { AST#property_declaration#Left private textResource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private placeholderResource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.empty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private marginBottom : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private marginTop : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private textInputType : AST#type_annotation#Left AST#primary_type#Left InputType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private textFlag : 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 @ Link AST#decorator#Right fruit : AST#type_annotation#Left AST#primary_type#Left Fruit AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private textInputCallBack = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear 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 this AST#expression#Right . textFlag AST#member_expression#Right AST#expression#Right === AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . FRUIT_FLAG AST#member_expression#Right AST#expression#Right ) { // Fruit name text input. AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginTop AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . MARGIN_TOP 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 . marginBottom AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . MARGIN_BOTTOM_SMALL 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 . textInputType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { // Fruit number text input. AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginBottom AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . MARGIN_BOTTOM_BIG 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 . textInputType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . Number AST#member_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#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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textResource AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_FONT_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . letterSpacing ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . LETTER_SPACING AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FONT_WEIGHT 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 bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_MARGIN_BOTTOM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_MARGIN_LEFT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginTop AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#member_expression#Left AST#expression#Left this AST#expression#Right . placeholderResource AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textFlag 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#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fruit AST#member_expression#Right AST#expression#Right . fruitName AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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 this AST#expression#Right . fruit AST#member_expression#Right AST#expression#Right . fruitNum AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FONT_SIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FONT_WEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.placeholder_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . caretColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInputType AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_INPUT_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . TEXT_INPUT_WIDTH 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 bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginBottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FONT_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FONT_WEIGHT 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.white' AST#expression#Right ) AST#resource_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 string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInputCallBack 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#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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export default struct TextItemComponent { private textResource: Resource = $r('app.string.empty'); private placeholderResource: Resource = $r('app.string.empty'); private marginBottom: string = ''; private marginTop: string = ''; private textInputType: InputType = InputType.Normal; private textFlag: number = 0; @Link fruit: Fruit; private textInputCallBack = (value: string) => {}; aboutToAppear() { if (this.textFlag === CommonConstants.FRUIT_FLAG) { this.marginTop = StyleConstants.MARGIN_TOP; this.marginBottom = StyleConstants.MARGIN_BOTTOM_SMALL; this.textInputType = InputType.Normal; } else { this.marginBottom = StyleConstants.MARGIN_BOTTOM_BIG; this.textInputType = InputType.Number; } } build() { Column() { Text(this.textResource) .fontSize(StyleConstants.TEXT_FONT_SIZE) .height(StyleConstants.TEXT_HEIGHT) .width(StyleConstants.FULL_PERCENT) .fontColor($r('app.color.text_font_color')) .letterSpacing(StyleConstants.LETTER_SPACING) .fontWeight(StyleConstants.FONT_WEIGHT) .margin({ bottom: StyleConstants.TEXT_MARGIN_BOTTOM, left: StyleConstants.TEXT_MARGIN_LEFT, top: this.marginTop }) TextInput({ placeholder: this.placeholderResource, text: this.textFlag === 0 ? (this.fruit.fruitName) : (this.fruit.fruitNum) }) .placeholderFont({ size: StyleConstants.FONT_SIZE, weight: StyleConstants.FONT_WEIGHT }) .placeholderColor($r('app.color.placeholder_color')) .caretColor(Color.Blue) .type(this.textInputType) .height(StyleConstants.TEXT_INPUT_HEIGHT) .width(StyleConstants.TEXT_INPUT_WIDTH) .margin({ bottom: this.marginBottom }) .fontSize(StyleConstants.FONT_SIZE) .fontColor($r('app.color.text_font_color')) .fontWeight(StyleConstants.FONT_WEIGHT) .backgroundColor($r('app.color.white')) .onChange((value: string) => { this.textInputCallBack(value); }) } } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/view/TextItemComponent.ets#L23-L82
c6e1d2a316f0609a9f6c918f1c4f6b460546b10b
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
getDatePicker
日期选择 弹窗 @returns
static getDatePicker(uiContext?: UIContext): DatePickerBuilderProxy { return new DatePickerBuilderProxy(uiContext) }
AST#method_declaration#Left static getDatePicker AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatePickerBuilderProxy 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 DatePickerBuilderProxy AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext 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 getDatePicker(uiContext?: UIContext): DatePickerBuilderProxy { return new DatePickerBuilderProxy(uiContext) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L157-L159
de35e6779d91c01562315e03af110e72cc42307d
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
View that represents a pie chart. Draws cake like slices.
@ObservedV2 export default class PieChartModel extends PieRadarChartBase<PieData> { /** * rect object that represents the bounds of the piechart, needed for * drawing the circle */ private mCircleBox: MyRect = new MyRect(); /** * flag indicating if entry labels should be drawn or not */ private mDrawEntryLabels: boolean = true; /** * array that holds the width of each pie-slice in degrees */ private mDrawAngles: number[] = new Array<number>(1); /** * array that holds the absolute angle in degrees of each slice */ private mAbsoluteAngles: number[] = new Array<number>(1); /** * if true, the white hole inside the chart will be drawn */ private mDrawHole: boolean = true; /** * if true, the hole will see-through to the inner tips of the slices */ private mDrawSlicesUnderHole: boolean = false; /** * if true, the values inside the piechart are drawn as percent values */ private mUsePercentValues: boolean = false; /** * if true, the slices of the piechart are rounded */ private mDrawRoundedSlices: boolean = false; /** * variable for the text that is drawn in the center of the pie-chart */ private mCenterText: string /*CharSequence*/ = ""; private mCenterTextOffset: MPPointF = MPPointF.getInstance(0, 0); /** * indicates the size of the hole in the center of the piechart, default: * radius / 2 */ private mHoleRadiusPercent: number = 50; /** * the radius of the transparent circle next to the chart-hole in the center */ protected mTransparentCircleRadiusPercent: number = 55; /** * if enabled, centertext is drawn */ private mDrawCenterText: boolean = true; private mCenterTextRadiusPercent: number = 100.0; protected mMaxAngle: number = 360; /** * Minimum angle to draw slices, this only works if there is enough room for all slices to have * the minimum angle, default 0f. */ private mMinAngleForSlices: number = 0; public context2d: CanvasRenderingContext2D | null = null; constructor() { super(); this.init(); } public invalidate() { if (this.context2d) { this.onDraw(this.context2d); } } public invalidateHighlight() { this.invalidate(); } public setContext2D(context2d: CanvasRenderingContext2D) { this.context2d = context2d } public onChartSizeChanged(newWidth: number, newHeight: number, oldWidth: number, oldHeight: number) { super.onSizeChanged(newWidth, newHeight, oldWidth, oldHeight); } // @Override protected init(): void { super.init(); if (this.mAnimator) { this.mRenderer = new PieChartRenderer(this, this.mAnimator, this.mViewPortHandler); } this.mXAxis = null; this.mHighlighter = new PieHighlighter(this); } // @Override public onDraw(canvas: CanvasRenderingContext2D): void { super.onDraw(canvas); if (this.mData == null) return; this.mRenderer?.drawData(canvas); if (this.valuesToHighlight() && this.mIndicesToHighlight) { this.mRenderer?.drawHighlighted(canvas, this.mIndicesToHighlight); } this.mRenderer?.drawExtras(canvas); this.mRenderer?.drawValues(canvas); this.mLegendRenderer?.renderLegend(canvas); this.drawDescription(canvas); this.drawMarkers(canvas); } public calculateOffsets(): void { super.calculateOffsets(); // prevent nullpointer when no data set if (this.mData == null) return; let diameter: number = this.getDiameter(); let radius: number = diameter / 2; let c: MPPointF | null = this.getCenterOffsets(); if (!c) { return; } let shift: number = this.mData.getDataSet().getSelectionShift(); // create the circle box that will contain the pie-chart (the bounds of // the pie-chart) this.mCircleBox.set(c.x - radius + shift, c.y - radius + shift, c.x + radius - shift, c.y + radius - shift); MPPointF.recycleInstance(c); } // @Override protected calcMinMax(): void { this.calcAngles(); } // @Override protected getMarkerPosition(highlight: Highlight): number[] { let center: MPPointF = this.getCenterCircleBox(); let r: number = this.getRadius(); let off: number = r / 10 * 3.6; if (this.isDrawHoleEnabled()) { off = (r - (r / 100 * this.getHoleRadius())) / 2; } r -= off; // offset to keep things inside the chart let rotationAngle: number = this.getRotationAngle(); let entryIndex: number = /*(int)*/ Math.round(highlight.getX()); // offset needed to center the drawn text in the slice let offset: number = this.mDrawAngles[entryIndex] / 2; if (!this.mAnimator) { return []; } // calculate the text position let x: number = /*(float)*/ (r * Math.cos(MyMath.toRadians((rotationAngle + this.mAbsoluteAngles[entryIndex] - offset) * this.mAnimator.getPhaseY())) + center.x); let y: number = /* (float)*/ (r * Math.sin(MyMath.toRadians((rotationAngle + this.mAbsoluteAngles[entryIndex] - offset) * this.mAnimator.getPhaseY())) + center.y); MPPointF.recycleInstance(center); return [x, y] /*new float[]{x, y}*/ ; } /** * calculates the needed angles for the chart slices */ private calcAngles(): void { if (!this.mData) { return; } let entryCount: number = this.mData.getEntryCount(); if (this.mDrawAngles.length != entryCount) { this.mDrawAngles = new Array<number>(entryCount) //new float[entryCount]; } else { for (let i: number = 0; i < entryCount; i++) { this.mDrawAngles[i] = 0; } } if (this.mAbsoluteAngles.length != entryCount) { this.mAbsoluteAngles = new Array<number>(entryCount) //new float[entryCount]; } else { for (let i: number = 0; i < entryCount; i++) { this.mAbsoluteAngles[i] = 0; } } let yValueSum: number = this.mData.getYValueSum(); let dataSets: JArrayList<IPieDataSet> = this.mData.getDataSets(); let hasMinAngle: boolean = this.mMinAngleForSlices != 0 && entryCount * this.mMinAngleForSlices <= this.mMaxAngle; let minAngles: number[] = new Array<number>(entryCount) //new float[entryCount]; let cnt: number = 0; let offset: number = 0; let diff: number = 0; for (let i: number = 0; i < this.mData.getDataSetCount(); i++) { let set: IPieDataSet = dataSets.get(i); for (let j: number = 0; j < set.getEntryCount(); j++) { let drawAngle: number = this.calcAngle(Math.abs(set.getEntryForIndex(j).getY()), yValueSum); if (hasMinAngle) { let temp: number = drawAngle - this.mMinAngleForSlices; if (temp <= 0) { minAngles[cnt] = this.mMinAngleForSlices; offset += -temp; } else { minAngles[cnt] = drawAngle; diff += temp; } } this.mDrawAngles[cnt] = drawAngle; if (cnt == 0) { this.mAbsoluteAngles[cnt] = this.mDrawAngles[cnt]; } else { this.mAbsoluteAngles[cnt] = this.mAbsoluteAngles[cnt - 1] + this.mDrawAngles[cnt]; } cnt++; } } if (hasMinAngle) { // Correct bigger slices by relatively reducing their angles based on the total angle needed to subtract // This requires that `entryCount * mMinAngleForSlices <= mMaxAngle` be true to properly work! for (let i: number = 0; i < entryCount; i++) { minAngles[i] -= (minAngles[i] - this.mMinAngleForSlices) / diff * offset; if (i == 0) { this.mAbsoluteAngles[0] = minAngles[0]; } else { this.mAbsoluteAngles[i] = this.mAbsoluteAngles[i - 1] + minAngles[i]; } } this.mDrawAngles = minAngles; } } /** * Checks if the given index is set to be highlighted. * * @param index * @return */ public needsHighlight(index: number): boolean { // no highlight if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { // check if the xvalue for the given dataset needs highlight if ( /*(int)*/ Math.round(this.mIndicesToHighlight[i].getX()) == index) return true; } } return false; } /** * calculates the needed angle for a given value * * @param value * @return */ private calcAngleSum(value: number): number { if (!this.mData) { return -1; } return this.calcAngle(value, this.mData.getYValueSum()); } /** * calculates the needed angle for a given value * * @param value * @param yValueSum * @return */ private calcAngle(value: number, yValueSum: number): number { return value / yValueSum * this.mMaxAngle; } /** * This will throw an exception, PieChart has no XAxis object. * * @return */ // @Deprecated // @Override public getXAxis(): XAxis { throw new Error("PieChart has no XAxis"); } // @Override public getIndexForAngle(angle: number): number { // take the current angle of the chart into consideration let a: number = Utils.getNormalizedAngle(angle - this.getRotationAngle()); for (let i: number = 0; i < this.mAbsoluteAngles.length; i++) { if (this.mAbsoluteAngles[i] > a) return i; } return -1; // return -1 if no index found } /** * Returns the index of the DataSet this x-index belongs to. * * @param xIndex * @return */ public getDataSetIndexForIndex(xIndex: number): number { if (!this.mData) { return -1; } let dataSets: JArrayList<IPieDataSet> = this.mData.getDataSets(); for (let i: number = 0; i < dataSets.size(); i++) { if (dataSets.get(i).getEntryForXValue(xIndex, Number.NaN) != null) return i; } return -1; } /** * returns an integer array of all the different angles the chart slices * have the angles in the returned array determine how much space (of 360°) * each slice takes * * @return */ public getDrawAngles(): number[] { return this.mDrawAngles; } /** * returns the absolute angles of the different chart slices (where the * slices end) * * @return */ public getAbsoluteAngles(): number[] { return this.mAbsoluteAngles; } /** * Sets the color for the hole that is drawn in the center of the PieChart * (if enabled). * * @param color */ public setHoleColor(color: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color); } /** * Enable or disable the visibility of the inner tips of the slices behind the hole */ public setDrawSlicesUnderHole(enable: boolean): void { this.mDrawSlicesUnderHole = enable; } /** * Returns true if the inner tips of the slices are visible behind the hole, * false if not. * * @return true if slices are visible behind the hole. */ public isDrawSlicesUnderHoleEnabled(): boolean { return this.mDrawSlicesUnderHole; } /** * set this to true to draw the pie center empty * * @param enabled */ public setDrawHoleEnabled(enabled: boolean): void { this.mDrawHole = enabled; } /** * returns true if the hole in the center of the pie-chart is set to be * visible, false if not * * @return */ public isDrawHoleEnabled(): boolean { return this.mDrawHole; } /** * Sets the text String that is displayed in the center of the PieChart. * * @param text */ public setCenterText(text: string /*CharSequence*/ ): void { if (text == null) this.mCenterText = ""; else { this.mCenterText = text; } } /** * returns the text that is drawn in the center of the pie-chart * * @return */ public getCenterText(): string /*CharSequence*/ { return this.mCenterText; } /** * set this to true to draw the text that is displayed in the center of the * pie chart * * @param enabled */ public setDrawCenterText(enabled: boolean): void { this.mDrawCenterText = enabled; } /** * returns true if drawing the center text is enabled * * @return */ public isDrawCenterTextEnabled(): boolean { return this.mDrawCenterText; } // @Override protected getRequiredLegendOffset(): number { if (this.mLegendRenderer) { return this.mLegendRenderer.getLabelPaint().getTextSize() * 2.; } return 0; } // @Override protected getRequiredBaseOffset(): number { return 0; } // @Override public getRadius(): number { if (this.mCircleBox == null) return 0; else { return Math.min(this.mCircleBox.width() / 2, this.mCircleBox.height() / 2); } } /** * returns the circlebox, the boundingbox of the pie-chart slices * * @return */ public getCircleBox(): MyRect { return this.mCircleBox; } /** * returns the center of the circlebox * * @return */ public getCenterCircleBox(): MPPointF { return MPPointF.getInstance(this.mCircleBox.centerX(), this.mCircleBox.centerY()); } /** * sets the typeface for the center-text paint * * @param t */ public setCenterTextTypeface(t: FontFamily): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t); } /** * Sets the size of the center text of the PieChart in vp. * * @param sizeDp */ public setCenterTextSize(sizeDp: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintCenterText().setTextSize( Utils.handleDataValues(sizeDp)); } /** * Sets the size of the center text of the PieChart in pixels. * * @param sizePixels */ public setCenterTextSizePixels(sizePixels: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintCenterText().setTextSize(sizePixels); } /** * Sets the offset the center text should have from it's original position in vp. Default x = 0, y = 0 * * @param x * @param y */ public setCenterTextOffset(x: number, y: number): void { this.mCenterTextOffset.x = Utils.handleDataValues(x); this.mCenterTextOffset.y = Utils.handleDataValues(y); } /** * Returns the offset on the x- and y-axis the center text has in vp. * * @return */ public getCenterTextOffset(): MPPointF { return MPPointF.getInstance(this.mCenterTextOffset.x, this.mCenterTextOffset.y); } /** * Sets the color of the center text of the PieChart. * * @param color */ public setCenterTextColor(color: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintCenterText().setColor(color); } /** * sets the radius of the hole in the center of the piechart in percent of * the maximum radius (max = the radius of the whole chart), default 50% * * @param percent */ public setHoleRadius(percent: number): void { this.mHoleRadiusPercent = percent; } /** * Returns the size of the hole radius in percent of the total radius. * * @return */ public getHoleRadius(): number { return this.mHoleRadiusPercent; } /** * Sets the color the transparent-circle should have. * * @param color */ public setTransparentCircleColor(color: number): void { if (!this.mRenderer) { return; } let p: Paint = ( /*(PieChartRenderer) */ this.mRenderer as PieChartRenderer).getPaintTransparentCircle(); let alpha: number | undefined = p.getGlobalAlpha(); p.setColor(color); if (alpha) { p.setGlobalAlpha(alpha); } } /** * sets the radius of the transparent circle that is drawn next to the hole * in the piechart in percent of the maximum radius (max = the radius of the * whole chart), default 55% -> means 5% larger than the center-hole by * default * * @param percent */ public setTransparentCircleRadius(percent: number): void { this.mTransparentCircleRadiusPercent = percent; } public getTransparentCircleRadius(): number { return this.mTransparentCircleRadiusPercent; } /** * Sets the amount of transparency the transparent circle should have 0 = fully transparent, * 255 = fully opaque. * Default value is 100. * * @param alpha 0-255 */ public setTransparentCircleAlpha(alpha: number): void { if (!this.mRenderer) { return; } ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintTransparentCircle().setGlobalAlpha(alpha / 255); } /** * Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). * Deprecated -> use setDrawEntryLabels(...) instead. * * @param enabled */ // @Deprecated public setDrawSliceText(enabled: boolean): void { this.mDrawEntryLabels = enabled; } /** * Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). * * @param enabled */ public setDrawEntryLabels(enabled: boolean): void { this.mDrawEntryLabels = enabled; } /** * Returns true if drawing the entry labels is enabled, false if not. * * @return */ public isDrawEntryLabelsEnabled(): boolean { return this.mDrawEntryLabels; } /** * Sets the color the entry labels are drawn with. * * @param color */ public setEntryLabelColor(color: number): void { ( /*(PieChartRenderer) */ this.mRenderer as PieChartRenderer).getPaintEntryLabels().setColor(color); } /** * Sets a custom Typeface for the drawing of the entry labels. * * @param tf */ public setEntryLabelTypeface(tf: FontFamily): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintEntryLabels().setFontFamily(tf); } /** * Sets the size of the entry labels in vp. Default: 14vp * * @param size */ public setEntryLabelTextSize(size: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintEntryLabels() .setTextSize(Utils.handleDataValues(size)); } /** * Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabled * and if the slices are not drawn under the hole. * * @param enabled draw curved ends of slices */ public setDrawRoundedSlices(enabled: boolean): void { this.mDrawRoundedSlices = enabled; } /** * Returns true if the chart is set to draw each end of a pie-slice * "rounded". * * @return */ public isDrawRoundedSlicesEnabled(): boolean { return this.mDrawRoundedSlices; } /** * If this is enabled, values inside the PieChart are drawn in percent and * not with their original value. Values provided for the IValueFormatter to * format are then provided in percent. * * @param enabled */ public setUsePercentValues(enabled: boolean): void { this.mUsePercentValues = enabled; } /** * Returns true if using percentage values is enabled for the chart. * * @return */ public isUsePercentValuesEnabled(): boolean { return this.mUsePercentValues; } /** * the rectangular radius of the bounding box for the center text, as a percentage of the pie * hole * default 1.f (100%) */ public setCenterTextRadiusPercent(percent: number): void { this.mCenterTextRadiusPercent = percent; } /** * the rectangular radius of the bounding box for the center text, as a percentage of the pie * hole * default 1.f (100%) */ public getCenterTextRadiusPercent(): number { return this.mCenterTextRadiusPercent; } public getMaxAngle(): number { return this.mMaxAngle; } /** * Sets the max angle that is used for calculating the pie-circle. 360f means * it's a full PieChart, 180f results in a half-pie-chart. Default: 360f * * @param maxangle min 90, max 360 */ public setMaxAngle(maxangle: number): void { if (maxangle > 360) maxangle = 360; if (maxangle < 90) maxangle = 90; this.mMaxAngle = maxangle; } /** * The minimum angle slices on the chart are rendered with, default is 0f. * * @return minimum angle for slices */ public getMinAngleForSlices(): number { return this.mMinAngleForSlices; } /** * Set the angle to set minimum size for slices, you must call {@link #notifyDataSetChanged()} * and {@link #invalidate()} when changing this, only works if there is enough room for all * slices to have the minimum angle. * * @param minAngle minimum 0, maximum is half of {@link #setMaxAngle(float)} */ public setMinAngleForSlices(minAngle: number): void { if (minAngle > (this.mMaxAngle / 2)) minAngle = this.mMaxAngle / 2; else if (minAngle < 0) minAngle = 0; this.mMinAngleForSlices = minAngle; } // @Override protected onDetachedFromWindow(): void { // releases the bitmap in the renderer to avoid oom error if (this.mRenderer != null && this.mRenderer instanceof PieChartRenderer) { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).releaseBitmap(); } // super.onDetachedFromWindow(); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class PieChartModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left PieRadarChartBase AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left PieData AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * rect object that represents the bounds of the piechart, needed for * drawing the circle */ AST#property_declaration#Left private mCircleBox : AST#type_annotation#Left AST#primary_type#Left MyRect AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left MyRect 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 /** * flag indicating if entry labels should be drawn or not */ AST#property_declaration#Left private mDrawEntryLabels : 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 /** * array that holds the width of each pie-slice in degrees */ AST#property_declaration#Left private mDrawAngles : 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#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * array that holds the absolute angle in degrees of each slice */ AST#property_declaration#Left private mAbsoluteAngles : 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#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * if true, the white hole inside the chart will be drawn */ AST#property_declaration#Left private mDrawHole : 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 /** * if true, the hole will see-through to the inner tips of the slices */ AST#property_declaration#Left private mDrawSlicesUnderHole : 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 /** * if true, the values inside the piechart are drawn as percent values */ AST#property_declaration#Left private mUsePercentValues : 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 /** * if true, the slices of the piechart are rounded */ AST#property_declaration#Left private mDrawRoundedSlices : 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 /** * variable for the text that is drawn in the center of the pie-chart */ AST#property_declaration#Left private mCenterText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right /*CharSequence*/ = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mCenterTextOffset : AST#type_annotation#Left AST#primary_type#Left MPPointF 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 MPPointF AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * indicates the size of the hole in the center of the piechart, default: * radius / 2 */ AST#property_declaration#Left private mHoleRadiusPercent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 50 AST#expression#Right ; AST#property_declaration#Right /** * the radius of the transparent circle next to the chart-hole in the center */ AST#property_declaration#Left protected mTransparentCircleRadiusPercent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 55 AST#expression#Right ; AST#property_declaration#Right /** * if enabled, centertext is drawn */ AST#property_declaration#Left private mDrawCenterText : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private mCenterTextRadiusPercent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100.0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left protected mMaxAngle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 360 AST#expression#Right ; AST#property_declaration#Right /** * Minimum angle to draw slices, this only works if there is enough room for all slices to have * the minimum angle, default 0f. */ AST#property_declaration#Left private mMinAngleForSlices : 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 public context2d : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . init 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#constructor_declaration#Right AST#method_declaration#Left public invalidate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context2d AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onDraw 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 . context2d AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public invalidateHighlight 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 . invalidate 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 public setContext2D AST#parameter_list#Left ( AST#parameter#Left context2d : 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#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 . context2d AST#member_expression#Right = AST#expression#Left context2d AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public onChartSizeChanged AST#parameter_list#Left ( AST#parameter#Left newWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oldWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left oldHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . onSizeChanged AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newWidth AST#expression#Right , AST#expression#Left newHeight AST#expression#Right , AST#expression#Left oldWidth AST#expression#Right , AST#expression#Left oldHeight 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 // @Override AST#method_declaration#Left protected 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAnimator 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 this AST#expression#Right . mRenderer AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PieChartRenderer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mViewPortHandler 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#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXAxis 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 . mHighlighter AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PieHighlighter AST#expression#Right AST#new_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 AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // @Override AST#method_declaration#Left public onDraw AST#parameter_list#Left ( AST#parameter#Left canvas : 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . onDraw AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData 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#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#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 . mRenderer AST#member_expression#Right AST#expression#Right ?. drawData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuesToHighlight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mIndicesToHighlight 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right ?. drawHighlighted AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIndicesToHighlight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#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 . mRenderer AST#member_expression#Right AST#expression#Right ?. drawExtras AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . mRenderer AST#member_expression#Right AST#expression#Right ?. drawValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . mLegendRenderer AST#member_expression#Right AST#expression#Right ?. renderLegend AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . drawDescription AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas 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 . drawMarkers AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left canvas AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public calculateOffsets 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left super AST#expression#Right . calculateOffsets 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 // prevent nullpointer when no data set 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 . mData 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#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 diameter : 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 this AST#expression#Right . getDiameter 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 radius : 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 diameter AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left c : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left MPPointF 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCenterOffsets 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#unary_expression#Left ! AST#expression#Left c AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left shift : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getDataSet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getSelectionShift 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 // create the circle box that will contain the pie-chart (the bounds of // the pie-chart) 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 . mCircleBox AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left c AST#expression#Right . x AST#member_expression#Right AST#expression#Right - AST#expression#Left radius AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left shift AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left c AST#expression#Right . y AST#member_expression#Right AST#expression#Right - AST#expression#Left radius AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left shift AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left c AST#expression#Right . x AST#member_expression#Right AST#expression#Right + AST#expression#Left radius AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left shift AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left c AST#expression#Right . y AST#member_expression#Right AST#expression#Right + AST#expression#Left radius AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left shift AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MPPointF AST#expression#Right . recycleInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left c 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 // @Override AST#method_declaration#Left protected calcMinMax 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 this AST#expression#Right . calcAngles 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 // @Override AST#method_declaration#Left protected getMarkerPosition AST#parameter_list#Left ( AST#parameter#Left highlight : AST#type_annotation#Left AST#primary_type#Left Highlight 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 let AST#variable_declarator#Left center : AST#type_annotation#Left AST#primary_type#Left MPPointF 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 . getCenterCircleBox 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 r : 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 this AST#expression#Right . getRadius 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 off : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right / AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 3.6 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#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 . isDrawHoleEnabled 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 off = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getHoleRadius AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 r -= AST#expression#Left off AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // offset to keep things inside the chart AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rotationAngle : 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 this AST#expression#Right . getRotationAngle 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 entryIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = /*(int)*/ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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 highlight AST#expression#Right . getX 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 // offset needed to center the drawn text in the slice AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left entryIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 . mAnimator AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // calculate the text position AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = /*(float)*/ AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . cos AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MyMath AST#expression#Right . toRadians 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 AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left rotationAngle AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left entryIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left offset AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right . getPhaseY 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#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left center AST#expression#Right AST#binary_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right ) AST#parenthesized_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 y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = /* (float)*/ AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right * AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . sin AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MyMath AST#expression#Right . toRadians 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 AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left rotationAngle AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left entryIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left offset AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAnimator AST#member_expression#Right AST#expression#Right . getPhaseY 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#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left center AST#expression#Right AST#binary_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right ) AST#parenthesized_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 MPPointF AST#expression#Right . recycleInstance 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#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ] AST#array_literal#Right AST#expression#Right /*new float[]{x, y}*/ ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * calculates the needed angles for the chart slices */ AST#method_declaration#Left private calcAngles 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 . mData 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 entryCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getEntryCount 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawAngles AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left entryCount AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawAngles AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left entryCount 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 //new float[entryCount]; } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : 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#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left entryCount 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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 0 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#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 . mAbsoluteAngles AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left entryCount AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left entryCount 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 //new float[entryCount]; } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : 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#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left entryCount 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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 0 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 let AST#variable_declarator#Left yValueSum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getYValueSum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataSets : 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 IPieDataSet 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 this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getDataSets 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 hasMinAngle : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMinAngleForSlices 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#binary_expression#Left AST#expression#Left entryCount AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . mMinAngleForSlices AST#member_expression#Right AST#expression#Right <= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mMaxAngle 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 minAngles : 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#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left entryCount AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right //new float[entryCount]; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cnt : 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#variable_declaration#Left let AST#variable_declarator#Left offset : 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#variable_declaration#Left let AST#variable_declarator#Left diff : 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : 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#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 . mData AST#member_expression#Right AST#expression#Right . getDataSetCount 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#variable_declaration#Left let AST#variable_declarator#Left set : AST#type_annotation#Left AST#primary_type#Left IPieDataSet 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 dataSets 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 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 j : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left set AST#expression#Right AST#binary_expression#Right AST#expression#Right . getEntryCount 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 j AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left drawAngle : 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 this AST#expression#Right . calcAngle 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 Math AST#expression#Right . abs 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 set AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left j AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getY 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#Left yValueSum 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 hasMinAngle AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left temp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left drawAngle AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mMinAngleForSlices AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left temp 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#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left minAngles AST#expression#Right [ AST#expression#Left cnt AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . mMinAngleForSlices AST#member_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 offset += AST#expression#Left AST#unary_expression#Left - AST#expression#Left temp AST#expression#Right AST#unary_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#subscript_expression#Left AST#expression#Left minAngles AST#expression#Right [ AST#expression#Left cnt AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = drawAngle AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left diff += AST#expression#Left temp 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left cnt AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = drawAngle AST#ERROR#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 cnt 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left cnt AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . mDrawAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left cnt 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left cnt AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left cnt AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mDrawAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left cnt 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left cnt AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left hasMinAngle AST#expression#Right ) AST#block_statement#Left { // Correct bigger slices by relatively reducing their angles based on the total angle needed to subtract // This requires that `entryCount * mMinAngleForSlices <= mMaxAngle` be true to properly work! AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : 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#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left entryCount 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#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left minAngles AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#ERROR#Left = AST#ERROR#Right AST#expression#Left AST#binary_expression#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#subscript_expression#Left AST#expression#Left minAngles AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mMinAngleForSlices AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left diff AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left offset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = m AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left inAngles AST#expression#Right [ AST#expression#Left 0 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#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left minAngles AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawAngles AST#member_expression#Right = AST#expression#Left minAngles 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#method_declaration#Right /** * Checks if the given index is set to be highlighted. * * @param index * @return */ AST#method_declaration#Left public needsHighlight AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // no highlight AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . valuesToHighlight AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#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#member_expression#Left AST#expression#Left this AST#expression#Right . mIndicesToHighlight AST#member_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#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#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 . mIndicesToHighlight AST#member_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 { // check if the xvalue for the given dataset needs highlight AST#statement#Left AST#if_statement#Left if ( /*(int)*/ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mIndicesToHighlight AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . getX 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#Left index AST#expression#Right AST#binary_expression#Right AST#expression#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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * calculates the needed angle for a given value * * @param value * @return */ AST#method_declaration#Left private calcAngleSum 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#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 . calcAngle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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 . mData AST#member_expression#Right AST#expression#Right . getYValueSum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 /** * calculates the needed angle for a given value * * @param value * @param yValueSum * @return */ AST#method_declaration#Left private calcAngle 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#Left yValueSum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right / AST#expression#Left yValueSum AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mMaxAngle AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * This will throw an exception, PieChart has no XAxis object. * * @return */ // @Deprecated // @Override AST#method_declaration#Left public getXAxis AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left XAxis AST#primary_type#Right AST#type_annotation#Right 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#expression#Left "PieChart has no XAxis" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // @Override AST#method_declaration#Left public getIndexForAngle AST#parameter_list#Left ( AST#parameter#Left angle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // take the current angle of the chart into consideration AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left a : 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 Utils AST#expression#Right . getNormalizedAngle 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 angle AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getRotationAngle 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : 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#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 . mAbsoluteAngles AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right > AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left i AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // return -1 if no index found } AST#block_statement#Right AST#method_declaration#Right /** * Returns the index of the DataSet this x-index belongs to. * * @param xIndex * @return */ AST#method_declaration#Left public getDataSetIndexForIndex AST#parameter_list#Left ( AST#parameter#Left xIndex : 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dataSets : 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 IPieDataSet 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 this AST#expression#Right . mData AST#member_expression#Right AST#expression#Right . getDataSets 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i : 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#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 dataSets AST#expression#Right AST#binary_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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dataSets 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 . getEntryForXValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left xIndex AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Number AST#expression#Right . NaN AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_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#statement#Left AST#return_statement#Left return AST#expression#Left i AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * returns an integer array of all the different angles the chart slices * have the angles in the returned array determine how much space (of 360°) * each slice takes * * @return */ AST#method_declaration#Left public getDrawAngles AST#parameter_list#Left ( ) 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#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawAngles AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * returns the absolute angles of the different chart slices (where the * slices end) * * @return */ AST#method_declaration#Left public getAbsoluteAngles AST#parameter_list#Left ( ) 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#member_expression#Left AST#expression#Left this AST#expression#Right . mAbsoluteAngles AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the color for the hole that is drawn in the center of the PieChart * (if enabled). * * @param color */ AST#method_declaration#Left public setHoleColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#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#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ?. getPaintHole AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color 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 /** * Enable or disable the visibility of the inner tips of the slices behind the hole */ AST#method_declaration#Left public setDrawSlicesUnderHole AST#parameter_list#Left ( AST#parameter#Left enable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawSlicesUnderHole AST#member_expression#Right = AST#expression#Left enable AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Returns true if the inner tips of the slices are visible behind the hole, * false if not. * * @return true if slices are visible behind the hole. */ AST#method_declaration#Left public isDrawSlicesUnderHoleEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawSlicesUnderHole AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * set this to true to draw the pie center empty * * @param enabled */ AST#method_declaration#Left public setDrawHoleEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#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 . mDrawHole AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * returns true if the hole in the center of the pie-chart is set to be * visible, false if not * * @return */ AST#method_declaration#Left public isDrawHoleEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawHole AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the text String that is displayed in the center of the PieChart. * * @param text */ AST#method_declaration#Left public setCenterText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right /*CharSequence*/ ) 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 text 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCenterText AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . mCenterText AST#member_expression#Right = AST#expression#Left text 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#method_declaration#Right /** * returns the text that is drawn in the center of the pie-chart * * @return */ AST#method_declaration#Left public getCenterText 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 /*CharSequence*/ 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 . mCenterText AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * set this to true to draw the text that is displayed in the center of the * pie chart * * @param enabled */ AST#method_declaration#Left public setDrawCenterText AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#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 . mDrawCenterText AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * returns true if drawing the center text is enabled * * @return */ AST#method_declaration#Left public isDrawCenterTextEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawCenterText AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // @Override AST#method_declaration#Left protected getRequiredLegendOffset 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegendRenderer AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mLegendRenderer AST#member_expression#Right AST#expression#Right . getLabelPaint AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right . AST#member_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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // @Override AST#method_declaration#Left protected getRequiredBaseOffset 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // @Override AST#method_declaration#Left public getRadius 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#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 . mCircleBox 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#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right else 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 Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCircleBox AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCircleBox AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 /** * returns the circlebox, the boundingbox of the pie-chart slices * * @return */ AST#method_declaration#Left public getCircleBox AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MyRect 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 . mCircleBox AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * returns the center of the circlebox * * @return */ AST#method_declaration#Left public getCenterCircleBox AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MPPointF 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 MPPointF AST#expression#Right . getInstance 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 . mCircleBox AST#member_expression#Right AST#expression#Right . centerX 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCircleBox AST#member_expression#Right AST#expression#Right . centerY 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * sets the typeface for the center-text paint * * @param t */ AST#method_declaration#Left public setCenterTextTypeface AST#parameter_list#Left ( AST#parameter#Left t : AST#type_annotation#Left AST#primary_type#Left FontFamily 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintCenterText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setFontFamily 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Sets the size of the center text of the PieChart in vp. * * @param sizeDp */ AST#method_declaration#Left public setCenterTextSize AST#parameter_list#Left ( AST#parameter#Left sizeDp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintCenterText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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 Utils AST#expression#Right . handleDataValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sizeDp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Sets the size of the center text of the PieChart in pixels. * * @param sizePixels */ AST#method_declaration#Left public setCenterTextSizePixels AST#parameter_list#Left ( AST#parameter#Left sizePixels : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintCenterText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setTextSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sizePixels 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 /** * Sets the offset the center text should have from it's original position in vp. Default x = 0, y = 0 * * @param x * @param y */ AST#method_declaration#Left public setCenterTextOffset AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCenterTextOffset AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right = 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 x 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#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 . mCenterTextOffset AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right = 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 y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Returns the offset on the x- and y-axis the center text has in vp. * * @return */ AST#method_declaration#Left public getCenterTextOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MPPointF 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 MPPointF AST#expression#Right . getInstance 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 . mCenterTextOffset AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCenterTextOffset AST#member_expression#Right AST#expression#Right . y 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 /** * Sets the color of the center text of the PieChart. * * @param color */ AST#method_declaration#Left public setCenterTextColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#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#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintCenterText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color 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 /** * sets the radius of the hole in the center of the piechart in percent of * the maximum radius (max = the radius of the whole chart), default 50% * * @param percent */ AST#method_declaration#Left public setHoleRadius AST#parameter_list#Left ( AST#parameter#Left percent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mHoleRadiusPercent AST#member_expression#Right = AST#expression#Left percent AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Returns the size of the hole radius in percent of the total radius. * * @return */ AST#method_declaration#Left public getHoleRadius AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mHoleRadiusPercent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the color the transparent-circle should have. * * @param color */ AST#method_declaration#Left public setTransparentCircleColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#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 . mRenderer 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 p : AST#type_annotation#Left AST#primary_type#Left Paint 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#parenthesized_expression#Left ( /*(PieChartRenderer) */ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintTransparentCircle 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 alpha : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left p AST#expression#Right . getGlobalAlpha 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 p AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color 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 alpha 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 p AST#expression#Right . setGlobalAlpha AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left alpha 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 /** * sets the radius of the transparent circle that is drawn next to the hole * in the piechart in percent of the maximum radius (max = the radius of the * whole chart), default 55% -> means 5% larger than the center-hole by * default * * @param percent */ AST#method_declaration#Left public setTransparentCircleRadius AST#parameter_list#Left ( AST#parameter#Left percent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTransparentCircleRadiusPercent AST#member_expression#Right = AST#expression#Left percent AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left public getTransparentCircleRadius AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTransparentCircleRadiusPercent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the amount of transparency the transparent circle should have 0 = fully transparent, * 255 = fully opaque. * Default value is 100. * * @param alpha 0-255 */ AST#method_declaration#Left public setTransparentCircleAlpha AST#parameter_list#Left ( AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#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 . mRenderer 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#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#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintTransparentCircle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setGlobalAlpha AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left alpha AST#expression#Right / AST#expression#Left 255 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 /** * Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). * Deprecated -> use setDrawEntryLabels(...) instead. * * @param enabled */ // @Deprecated AST#method_declaration#Left public setDrawSliceText AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#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 . mDrawEntryLabels AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). * * @param enabled */ AST#method_declaration#Left public setDrawEntryLabels AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#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 . mDrawEntryLabels AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Returns true if drawing the entry labels is enabled, false if not. * * @return */ AST#method_declaration#Left public isDrawEntryLabelsEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawEntryLabels AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the color the entry labels are drawn with. * * @param color */ AST#method_declaration#Left public setEntryLabelColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#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#parenthesized_expression#Left ( /*(PieChartRenderer) */ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintEntryLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color 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 /** * Sets a custom Typeface for the drawing of the entry labels. * * @param tf */ AST#method_declaration#Left public setEntryLabelTypeface AST#parameter_list#Left ( AST#parameter#Left tf : AST#type_annotation#Left AST#primary_type#Left FontFamily 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintEntryLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setFontFamily AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tf 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 /** * Sets the size of the entry labels in vp. Default: 14vp * * @param size */ AST#method_declaration#Left public setEntryLabelTextSize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintEntryLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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 Utils AST#expression#Right . handleDataValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left size AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabled * and if the slices are not drawn under the hole. * * @param enabled draw curved ends of slices */ AST#method_declaration#Left public setDrawRoundedSlices AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#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 . mDrawRoundedSlices AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Returns true if the chart is set to draw each end of a pie-slice * "rounded". * * @return */ AST#method_declaration#Left public isDrawRoundedSlicesEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawRoundedSlices AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * If this is enabled, values inside the PieChart are drawn in percent and * not with their original value. Values provided for the IValueFormatter to * format are then provided in percent. * * @param enabled */ AST#method_declaration#Left public setUsePercentValues AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#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 . mUsePercentValues AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * Returns true if using percentage values is enabled for the chart. * * @return */ AST#method_declaration#Left public isUsePercentValuesEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mUsePercentValues AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * the rectangular radius of the bounding box for the center text, as a percentage of the pie * hole * default 1.f (100%) */ AST#method_declaration#Left public setCenterTextRadiusPercent AST#parameter_list#Left ( AST#parameter#Left percent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCenterTextRadiusPercent AST#member_expression#Right = AST#expression#Left percent AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * the rectangular radius of the bounding box for the center text, as a percentage of the pie * hole * default 1.f (100%) */ AST#method_declaration#Left public getCenterTextRadiusPercent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCenterTextRadiusPercent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left public getMaxAngle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMaxAngle AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Sets the max angle that is used for calculating the pie-circle. 360f means * it's a full PieChart, 180f results in a half-pie-chart. Default: 360f * * @param maxangle min 90, max 360 */ AST#method_declaration#Left public setMaxAngle AST#parameter_list#Left ( AST#parameter#Left maxangle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left maxangle AST#expression#Right > AST#expression#Left 360 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left maxangle = AST#expression#Left 360 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left maxangle AST#expression#Right < AST#expression#Left 90 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left maxangle = AST#expression#Left 90 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMaxAngle AST#member_expression#Right = AST#expression#Left maxangle 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 /** * The minimum angle slices on the chart are rendered with, default is 0f. * * @return minimum angle for slices */ AST#method_declaration#Left public getMinAngleForSlices AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMinAngleForSlices AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Set the angle to set minimum size for slices, you must call {@link #notifyDataSetChanged()} * and {@link #invalidate()} when changing this, only works if there is enough room for all * slices to have the minimum angle. * * @param minAngle minimum 0, maximum is half of {@link #setMaxAngle(float)} */ AST#method_declaration#Left public setMinAngleForSlices AST#parameter_list#Left ( AST#parameter#Left minAngle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left minAngle AST#expression#Right > AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMaxAngle AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left minAngle = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMaxAngle AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left minAngle AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left minAngle = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mMinAngleForSlices AST#member_expression#Right = AST#expression#Left minAngle 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 // @Override AST#method_declaration#Left protected onDetachedFromWindow 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 { // releases the bitmap in the renderer to avoid oom error AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer 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#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right instanceof AST#expression#Left PieChartRenderer AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . releaseBitmap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // super.onDetachedFromWindow(); } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#decorated_export_declaration#Right
@ObservedV2 export default class PieChartModel extends PieRadarChartBase<PieData> { private mCircleBox: MyRect = new MyRect(); private mDrawEntryLabels: boolean = true; private mDrawAngles: number[] = new Array<number>(1); private mAbsoluteAngles: number[] = new Array<number>(1); private mDrawHole: boolean = true; private mDrawSlicesUnderHole: boolean = false; private mUsePercentValues: boolean = false; private mDrawRoundedSlices: boolean = false; private mCenterText: string = ""; private mCenterTextOffset: MPPointF = MPPointF.getInstance(0, 0); private mHoleRadiusPercent: number = 50; protected mTransparentCircleRadiusPercent: number = 55; private mDrawCenterText: boolean = true; private mCenterTextRadiusPercent: number = 100.0; protected mMaxAngle: number = 360; private mMinAngleForSlices: number = 0; public context2d: CanvasRenderingContext2D | null = null; constructor() { super(); this.init(); } public invalidate() { if (this.context2d) { this.onDraw(this.context2d); } } public invalidateHighlight() { this.invalidate(); } public setContext2D(context2d: CanvasRenderingContext2D) { this.context2d = context2d } public onChartSizeChanged(newWidth: number, newHeight: number, oldWidth: number, oldHeight: number) { super.onSizeChanged(newWidth, newHeight, oldWidth, oldHeight); } protected init(): void { super.init(); if (this.mAnimator) { this.mRenderer = new PieChartRenderer(this, this.mAnimator, this.mViewPortHandler); } this.mXAxis = null; this.mHighlighter = new PieHighlighter(this); } public onDraw(canvas: CanvasRenderingContext2D): void { super.onDraw(canvas); if (this.mData == null) return; this.mRenderer?.drawData(canvas); if (this.valuesToHighlight() && this.mIndicesToHighlight) { this.mRenderer?.drawHighlighted(canvas, this.mIndicesToHighlight); } this.mRenderer?.drawExtras(canvas); this.mRenderer?.drawValues(canvas); this.mLegendRenderer?.renderLegend(canvas); this.drawDescription(canvas); this.drawMarkers(canvas); } public calculateOffsets(): void { super.calculateOffsets(); if (this.mData == null) return; let diameter: number = this.getDiameter(); let radius: number = diameter / 2; let c: MPPointF | null = this.getCenterOffsets(); if (!c) { return; } let shift: number = this.mData.getDataSet().getSelectionShift(); this.mCircleBox.set(c.x - radius + shift, c.y - radius + shift, c.x + radius - shift, c.y + radius - shift); MPPointF.recycleInstance(c); } protected calcMinMax(): void { this.calcAngles(); } protected getMarkerPosition(highlight: Highlight): number[] { let center: MPPointF = this.getCenterCircleBox(); let r: number = this.getRadius(); let off: number = r / 10 * 3.6; if (this.isDrawHoleEnabled()) { off = (r - (r / 100 * this.getHoleRadius())) / 2; } r -= off; let rotationAngle: number = this.getRotationAngle(); let entryIndex: number = Math.round(highlight.getX()); let offset: number = this.mDrawAngles[entryIndex] / 2; if (!this.mAnimator) { return []; } let x: number = (r * Math.cos(MyMath.toRadians((rotationAngle + this.mAbsoluteAngles[entryIndex] - offset) * this.mAnimator.getPhaseY())) + center.x); let y: number = (r * Math.sin(MyMath.toRadians((rotationAngle + this.mAbsoluteAngles[entryIndex] - offset) * this.mAnimator.getPhaseY())) + center.y); MPPointF.recycleInstance(center); return [x, y] ; } private calcAngles(): void { if (!this.mData) { return; } let entryCount: number = this.mData.getEntryCount(); if (this.mDrawAngles.length != entryCount) { this.mDrawAngles = new Array<number>(entryCount) } else { for (let i: number = 0; i < entryCount; i++) { this.mDrawAngles[i] = 0; } } if (this.mAbsoluteAngles.length != entryCount) { this.mAbsoluteAngles = new Array<number>(entryCount) } else { for (let i: number = 0; i < entryCount; i++) { this.mAbsoluteAngles[i] = 0; } } let yValueSum: number = this.mData.getYValueSum(); let dataSets: JArrayList<IPieDataSet> = this.mData.getDataSets(); let hasMinAngle: boolean = this.mMinAngleForSlices != 0 && entryCount * this.mMinAngleForSlices <= this.mMaxAngle; let minAngles: number[] = new Array<number>(entryCount) let cnt: number = 0; let offset: number = 0; let diff: number = 0; for (let i: number = 0; i < this.mData.getDataSetCount(); i++) { let set: IPieDataSet = dataSets.get(i); for (let j: number = 0; j < set.getEntryCount(); j++) { let drawAngle: number = this.calcAngle(Math.abs(set.getEntryForIndex(j).getY()), yValueSum); if (hasMinAngle) { let temp: number = drawAngle - this.mMinAngleForSlices; if (temp <= 0) { minAngles[cnt] = this.mMinAngleForSlices; offset += -temp; } else { minAngles[cnt] = drawAngle; diff += temp; } } this.mDrawAngles[cnt] = drawAngle; if (cnt == 0) { this.mAbsoluteAngles[cnt] = this.mDrawAngles[cnt]; } else { this.mAbsoluteAngles[cnt] = this.mAbsoluteAngles[cnt - 1] + this.mDrawAngles[cnt]; } cnt++; } } if (hasMinAngle) { for (let i: number = 0; i < entryCount; i++) { minAngles[i] -= (minAngles[i] - this.mMinAngleForSlices) / diff * offset; if (i == 0) { this.mAbsoluteAngles[0] = minAngles[0]; } else { this.mAbsoluteAngles[i] = this.mAbsoluteAngles[i - 1] + minAngles[i]; } } this.mDrawAngles = minAngles; } } public needsHighlight(index: number): boolean { if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { if ( Math.round(this.mIndicesToHighlight[i].getX()) == index) return true; } } return false; } private calcAngleSum(value: number): number { if (!this.mData) { return -1; } return this.calcAngle(value, this.mData.getYValueSum()); } private calcAngle(value: number, yValueSum: number): number { return value / yValueSum * this.mMaxAngle; } public getXAxis(): XAxis { throw new Error("PieChart has no XAxis"); } public getIndexForAngle(angle: number): number { let a: number = Utils.getNormalizedAngle(angle - this.getRotationAngle()); for (let i: number = 0; i < this.mAbsoluteAngles.length; i++) { if (this.mAbsoluteAngles[i] > a) return i; } return -1; } public getDataSetIndexForIndex(xIndex: number): number { if (!this.mData) { return -1; } let dataSets: JArrayList<IPieDataSet> = this.mData.getDataSets(); for (let i: number = 0; i < dataSets.size(); i++) { if (dataSets.get(i).getEntryForXValue(xIndex, Number.NaN) != null) return i; } return -1; } public getDrawAngles(): number[] { return this.mDrawAngles; } public getAbsoluteAngles(): number[] { return this.mAbsoluteAngles; } public setHoleColor(color: number): void { ( this.mRenderer as PieChartRenderer)?.getPaintHole().setColor(color); } public setDrawSlicesUnderHole(enable: boolean): void { this.mDrawSlicesUnderHole = enable; } public isDrawSlicesUnderHoleEnabled(): boolean { return this.mDrawSlicesUnderHole; } public setDrawHoleEnabled(enabled: boolean): void { this.mDrawHole = enabled; } public isDrawHoleEnabled(): boolean { return this.mDrawHole; } public setCenterText(text: string ): void { if (text == null) this.mCenterText = ""; else { this.mCenterText = text; } } public getCenterText(): string { return this.mCenterText; } public setDrawCenterText(enabled: boolean): void { this.mDrawCenterText = enabled; } public isDrawCenterTextEnabled(): boolean { return this.mDrawCenterText; } protected getRequiredLegendOffset(): number { if (this.mLegendRenderer) { return this.mLegendRenderer.getLabelPaint().getTextSize() * 2.; } return 0; } protected getRequiredBaseOffset(): number { return 0; } public getRadius(): number { if (this.mCircleBox == null) return 0; else { return Math.min(this.mCircleBox.width() / 2, this.mCircleBox.height() / 2); } } public getCircleBox(): MyRect { return this.mCircleBox; } public getCenterCircleBox(): MPPointF { return MPPointF.getInstance(this.mCircleBox.centerX(), this.mCircleBox.centerY()); } public setCenterTextTypeface(t: FontFamily): void { ( this.mRenderer as PieChartRenderer).getPaintCenterText().setFontFamily(t); } public setCenterTextSize(sizeDp: number): void { ( this.mRenderer as PieChartRenderer).getPaintCenterText().setTextSize( Utils.handleDataValues(sizeDp)); } public setCenterTextSizePixels(sizePixels: number): void { ( this.mRenderer as PieChartRenderer).getPaintCenterText().setTextSize(sizePixels); } public setCenterTextOffset(x: number, y: number): void { this.mCenterTextOffset.x = Utils.handleDataValues(x); this.mCenterTextOffset.y = Utils.handleDataValues(y); } public getCenterTextOffset(): MPPointF { return MPPointF.getInstance(this.mCenterTextOffset.x, this.mCenterTextOffset.y); } public setCenterTextColor(color: number): void { ( this.mRenderer as PieChartRenderer).getPaintCenterText().setColor(color); } public setHoleRadius(percent: number): void { this.mHoleRadiusPercent = percent; } public getHoleRadius(): number { return this.mHoleRadiusPercent; } public setTransparentCircleColor(color: number): void { if (!this.mRenderer) { return; } let p: Paint = ( this.mRenderer as PieChartRenderer).getPaintTransparentCircle(); let alpha: number | undefined = p.getGlobalAlpha(); p.setColor(color); if (alpha) { p.setGlobalAlpha(alpha); } } public setTransparentCircleRadius(percent: number): void { this.mTransparentCircleRadiusPercent = percent; } public getTransparentCircleRadius(): number { return this.mTransparentCircleRadiusPercent; } public setTransparentCircleAlpha(alpha: number): void { if (!this.mRenderer) { return; } ( this.mRenderer as PieChartRenderer).getPaintTransparentCircle().setGlobalAlpha(alpha / 255); } public setDrawSliceText(enabled: boolean): void { this.mDrawEntryLabels = enabled; } public setDrawEntryLabels(enabled: boolean): void { this.mDrawEntryLabels = enabled; } public isDrawEntryLabelsEnabled(): boolean { return this.mDrawEntryLabels; } public setEntryLabelColor(color: number): void { ( this.mRenderer as PieChartRenderer).getPaintEntryLabels().setColor(color); } public setEntryLabelTypeface(tf: FontFamily): void { ( this.mRenderer as PieChartRenderer).getPaintEntryLabels().setFontFamily(tf); } public setEntryLabelTextSize(size: number): void { ( this.mRenderer as PieChartRenderer).getPaintEntryLabels() .setTextSize(Utils.handleDataValues(size)); } public setDrawRoundedSlices(enabled: boolean): void { this.mDrawRoundedSlices = enabled; } public isDrawRoundedSlicesEnabled(): boolean { return this.mDrawRoundedSlices; } public setUsePercentValues(enabled: boolean): void { this.mUsePercentValues = enabled; } public isUsePercentValuesEnabled(): boolean { return this.mUsePercentValues; } public setCenterTextRadiusPercent(percent: number): void { this.mCenterTextRadiusPercent = percent; } public getCenterTextRadiusPercent(): number { return this.mCenterTextRadiusPercent; } public getMaxAngle(): number { return this.mMaxAngle; } public setMaxAngle(maxangle: number): void { if (maxangle > 360) maxangle = 360; if (maxangle < 90) maxangle = 90; this.mMaxAngle = maxangle; } public getMinAngleForSlices(): number { return this.mMinAngleForSlices; } public setMinAngleForSlices(minAngle: number): void { if (minAngle > (this.mMaxAngle / 2)) minAngle = this.mMaxAngle / 2; else if (minAngle < 0) minAngle = 0; this.mMinAngleForSlices = minAngle; } protected onDetachedFromWindow(): void { if (this.mRenderer != null && this.mRenderer instanceof PieChartRenderer) { ( this.mRenderer as PieChartRenderer).releaseBitmap(); } } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L35-L859
6ae7955989d6b837f8f266d1f1166a9988425692
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getDaysDiff
计算两个日期之间的天数差 @param date1 日期1 @param date2 日期2 @returns 天数差
static getDaysDiff(date1: Date, date2: Date): number { const timeDiff = Math.abs(date2.getTime() - date1.getTime()); return Math.ceil(timeDiff / (1000 * 3600 * 24)); }
AST#method_declaration#Left static getDaysDiff AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left timeDiff = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date2 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#expression#Left date1 AST#expression#Right AST#binary_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#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 Math AST#expression#Right . ceil AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left timeDiff AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 1000 AST#expression#Right * AST#expression#Left 3600 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getDaysDiff(date1: Date, date2: Date): number { const timeDiff = Math.abs(date2.getTime() - date1.getTime()); return Math.ceil(timeDiff / (1000 * 3600 * 24)); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L67-L70
5d4ab953fdf83d4a79d771b3c7e654c0f34d7dfa
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets
arkts
HalfModalWindowComponent
场景描述: 登录方式有两种,验证码登录和账户,需要在一个全屏模态窗口CaptureLogin中切换,使用if进行条件渲染 1、通过配置NavDestinationMode类型为DIALOG,实现半模态的背景为透明 2、通过bindSheet属性为主页无样式的Text绑定半模态页面,再通过bindContentCover属性为主页无样式的Text绑定全屏模态页面 3、在半模态页面中的验证码登录按钮点击时打开全屏模态转场,并将对应的组件入场动效置为空,此时进场只保留全屏模态入场动效 4、通过点击第二步中的按钮跳转到全屏模态组件(CaptureLogin),并通过通过isDefaultLogin控制两种登录组件的条件渲染:true(手机验证码登录),false(二维码登录) 控制两种登录方式的条件渲染,同时通过TransitionEffect.move()实现组件间转场。 子组件中被@Link装饰的变量与其父组件中@State装饰的对应数据源建立双向数据绑定,详见: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-link-0000001820999565 半模态转场详见: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-modal-transition-0000001774120166#ZH-CN_TOPIC_0000001811157734 NavDestinationMode配置: https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-navdestination-0000001815767788 组件内转场transition: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-enter-exit-transition-0000001820879809
@Component export struct HalfModalWindowComponent { // 是否显示半屏模态页面 @State isPresent: boolean = false; // 半模态高度 @State sheetHeight: number = 500; // 是否显示控制条 @State showDragBar: boolean = true; // 判断是否同意协议 @State isConfirmed: boolean = false; // 控制全模态的展示 @State isPresentInLoginView: boolean = false; // 发送验证码按钮的透明度 @State op: number = 0.5; // 用于标识转场类型,从半模态跳转至手机验证码组件时为false,从账号密码组件跳转至手机验证码组件时为true @State isShowTransition: boolean = false; @State isCenter: boolean = true; @State screenW: number = px2vp(display.getDefaultDisplaySync().width); private deviceSize: number = 600; // 依据Navigation的mode属性说明,如使用Auto,窗口宽度>=600vp时,采用Split模式显示;窗口宽度<600vp时,采用Stack模式显示。 // 当前屏幕折叠态(仅折叠屏设备下有效) curFoldStatus: display.FoldStatus = display.FoldStatus.FOLD_STATUS_UNKNOWN; aboutToAppear(): void { this.isPresent = true; // 当isPresent为true时显示半模态页面,反之不显示 if (display.isFoldable()) { this.regDisplayListener(); } else { if (this.screenW >= this.deviceSize) { this.isCenter = true; } else { this.isCenter = false; } } } /** * 注册屏幕状态监听 * @returns {void} */ regDisplayListener(): void { this.changePreferType(display.getFoldStatus()); display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => { // 同一个状态重复触发不做处理 if (this.curFoldStatus === curFoldStatus) { return; } // 缓存当前折叠状态 this.curFoldStatus = curFoldStatus; this.changePreferType(this.curFoldStatus); }) } // 更改PreferType changePreferType(status: number): void { if (status === display.FoldStatus.FOLD_STATUS_FOLDED) { this.isCenter = false; } else { this.isCenter = true; } } @Builder defaultLogin() { Column() { // 在登录页中控制,半模态、全模态和半模态的确认的checkBox CaptchaLogin({ isPresent: $isPresent, isPresentInLoginView: $isPresentInLoginView, isShowTransition: $isShowTransition }) } } @Builder halfModalLogin() { // 半模态窗口页面 Column() { Text($r('app.string.multimodaltransion_after_login_more_service')) .fontColor(Color.Black) .fontSize(18) .padding({ top: 60 }) .id('bindSheetExist') Text($r('app.string.multimodaltransion_user_phone_number')) .fontColor(Color.Black) .fontSize(30) .fontWeight(50) .padding({ top: 30, bottom: 10 }) Text($r('app.string.multimodaltransion_get_service')) .fontColor($r('app.color.multimodaltransion_grey_9')) .fontSize(15) .padding({ bottom: 50 }) Button($r('app.string.multimodaltransion_phone_start_login')) .fontColor(Color.White) .type(ButtonType.Normal) .backgroundColor($r('app.color.multimodaltransion_red')) .onClick(() => { if (this.isConfirmed) { // 调用Toast显示登录成功提示 promptAction.showToast({ message: $r('app.string.multimodaltransion_login_success') }); AppStorage.set("login", true); // 登录状态置为已登录 DynamicsRouter.popAppRouter(); DynamicsRouter.pushUri("navigationinterceptor/InterceptorPage"); // 路由跳转 } else { // 调用Toast显示请先阅读并同意协议提示 promptAction.showToast({ message: $r('app.string.multimodaltransion_please_read_and_agree') }); } }) .width("90%") .height($r('app.integer.multimodaltransion_height_fifty')) .margin({ left: 12, right: 12, bottom: 10 }) .id('phoneNumberLogin') Button($r('app.string.multimodaltransion_captcha_login_text')) .fontColor(Color.Black) .borderRadius($r('app.integer.multimodaltransion_border_radius')) .type(ButtonType.Normal) .backgroundColor($r('app.color.multimodaltransion_btn_bgc')) .border({ color: $r('app.color.multimodaltransion_half_modal_btn_bgc'), width: 1 }) .onClick(() => { if (this.isConfirmed) { // 半模态页面中调出全模态登录页 this.isPresentInLoginView = true; this.isConfirmed = false; this.isShowTransition = false; } else { // 调用Toast显示请先阅读并同意协议提示 promptAction.showToast({ message: $r('app.string.multimodaltransion_please_read_and_agree') }); } }) .width("90%") .height($r('app.integer.multimodaltransion_height_fifty')) .margin({ bottom: 30 }) .id('verificationLogin') Blank() // 在容器主轴方向上自动填充容器空余部分 Row({ space: SPACE_THIRTY }) { Image($r("app.media.multimodaltransion_app_logo1")) .width($r('app.integer.multimodaltransion_other_ways_icon_height')) .borderRadius($r('app.integer.multimodaltransion_other_ways_border_radius')) .onClick(() => { // 调用Toast显示提示:此样式仅为案例展示 promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) Image($r("app.media.multimodaltransion_app_logo2")) .width($r('app.integer.multimodaltransion_other_ways_icon_height')) .borderRadius($r('app.integer.multimodaltransion_other_ways_border_radius')) .onClick(() => { // 调用Toast显示提示:此样式仅为案例展示 promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) Image($r("app.media.multimodaltransion_app_logo3")) .width($r('app.integer.multimodaltransion_other_ways_icon_height')) .borderRadius($r('app.integer.multimodaltransion_other_ways_border_radius')) .onClick(() => { // 调用Toast显示提示:此样式仅为案例展示 promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) }.margin({ bottom: 20 }) Row() { Checkbox({ name: 'checkbox' }) .select(this.isConfirmed) .width(14) .onChange((value: boolean) => { this.isConfirmed = value; }) .id('isChecked') Text() { Span($r('app.string.multimodaltransion_read_and_agree')) .fontColor($r('app.color.multimodaltransion_grey_9')) Span($r('app.string.multimodaltransion_server_proxy_rule_detail')) .fontColor($r('app.color.multimodaltransion_note_color')) .onClick(() => { // 调用Toast显示提示:此样式仅为案例展示 promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) }.fontSize(14) } .margin({ left: 32 }) .width($r('app.string.multimodaltransion_size_full')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HalfModalWindowComponent AST#ERROR#Left { // 是否显示半屏模态页面 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isPresent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 半模态高度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right sheetHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right // 是否显示控制条 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right showDragBar : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 判断是否同意协议 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isConfirmed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 控制全模态的展示 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isPresentInLoginView : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 发送验证码按钮的透明度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right op : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.5 AST#expression#Right ; AST#property_declaration#Right // 用于标识转场类型,从半模态跳转至手机验证码组件时为false,从账号密码组件跳转至手机验证码组件时为true AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShowTransition : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isCenter : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right screenW : 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 px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private deviceSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 600 AST#expression#Right ; AST#property_declaration#Right // 依据Navigation的mode属性说明,如使用Auto,窗口宽度>=600vp时,采用Split模式显示;窗口宽度<600vp时,采用Stack模式显示。 // 当前屏幕折叠态(仅折叠屏设备下有效) AST#property_declaration#Left curFoldStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_UNKNOWN AST#member_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#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 . isPresent 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 // 当isPresent为true时显示半模态页面,反之不显示 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . isFoldable 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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . regDisplayListener 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 } else { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenW AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . deviceSize 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 this AST#expression#Right . isCenter 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 } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCenter 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 注册屏幕状态监听 * @returns {void} */ AST#method_declaration#Left regDisplayListener 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 this AST#expression#Right . changePreferType 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 display AST#expression#Right . getFoldStatus 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'foldStatusChange' AST#expression#Right , AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left curFoldStatus : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . FoldStatus 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#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 . curFoldStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left curFoldStatus AST#expression#Right AST#binary_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curFoldStatus AST#member_expression#Right = AST#expression#Left curFoldStatus 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 . changePreferType 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 . curFoldStatus AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 更改PreferType AST#method_declaration#Left changePreferType AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left status AST#expression#Right === AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_FOLDED 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 this AST#expression#Right . isCenter 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 } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCenter 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right defaultLogin AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 在登录页中控制,半模态、全模态和半模态的确认的checkBox AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CaptchaLogin ( AST#component_parameters#Left { AST#component_parameter#Left isPresent : AST#expression#Left $isPresent AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isPresentInLoginView : AST#expression#Left $isPresentInLoginView AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isShowTransition : AST#expression#Left $isShowTransition AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right halfModalLogin AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 半模态窗口页面 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_after_login_more_service' AST#expression#Right ) AST#resource_expression#Right 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 . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 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 60 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'bindSheetExist' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_user_phone_number' AST#expression#Right ) AST#resource_expression#Right 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 . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 50 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 30 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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.multimodaltransion_get_service' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multimodaltransion_grey_9' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 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 50 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_phone_start_login' AST#expression#Right ) AST#resource_expression#Right 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 . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal 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.multimodaltransion_red' 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isConfirmed AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 调用Toast显示登录成功提示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_login_success' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "login" AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 登录状态置为已登录 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DynamicsRouter AST#expression#Right . popAppRouter 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 DynamicsRouter AST#expression#Right . pushUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "navigationinterceptor/InterceptorPage" 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 { // 调用Toast显示请先阅读并同意协议提示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_please_read_and_agree' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left "90%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multimodaltransion_height_fifty' 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 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'phoneNumberLogin' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_captcha_login_text' AST#expression#Right ) AST#resource_expression#Right 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 . Black 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.multimodaltransion_border_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal 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.multimodaltransion_btn_bgc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multimodaltransion_half_modal_btn_bgc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 1 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isConfirmed 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 . isPresentInLoginView 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isConfirmed AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowTransition 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 else AST#block_statement#Left { // 调用Toast显示请先阅读并同意协议提示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_please_read_and_agree' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left "90%" AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multimodaltransion_height_fifty' 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 bottom AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'verificationLogin' 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 在容器主轴方向上自动填充容器空余部分 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left SPACE_THIRTY AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.multimodaltransion_app_logo1" 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.multimodaltransion_other_ways_icon_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.multimodaltransion_other_ways_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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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.multimodaltransion_app_logo2" 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.multimodaltransion_other_ways_icon_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.multimodaltransion_other_ways_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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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.multimodaltransion_app_logo3" 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.multimodaltransion_other_ways_icon_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.multimodaltransion_other_ways_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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#ui_component#Right AST#ERROR#Left { 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 'checkbox' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . select ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isConfirmed AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 14 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isConfirmed AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'isChecked' 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 Text ( AST#ERROR#Left ) AST#ERROR#Right { AST#property_name#Left Span AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left $r AST#parameter#Right AST#ERROR#Left ( 'app.string.multimodaltransion_read_and_agree' AST#ERROR#Right ) AST#parameter_list#Right ) AST#ERROR#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multimodaltransion_grey_9' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Span ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_server_proxy_rule_detail' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multimodaltransion_note_color' 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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multimodaltransion_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 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 . marg in ( AST#ERROR#Right AST#component_body#Left { AST#ERROR#Left left : AST#ERROR#Left 32 } ) . width AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left $r AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'app.string.multimodaltransion_size_full' AST#ERROR#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ) } AST#ERROR#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct HalfModalWindowComponent { @State isPresent: boolean = false; @State sheetHeight: number = 500; @State showDragBar: boolean = true; @State isConfirmed: boolean = false; @State isPresentInLoginView: boolean = false; @State op: number = 0.5; @State isShowTransition: boolean = false; @State isCenter: boolean = true; @State screenW: number = px2vp(display.getDefaultDisplaySync().width); private deviceSize: number = 600; curFoldStatus: display.FoldStatus = display.FoldStatus.FOLD_STATUS_UNKNOWN; aboutToAppear(): void { this.isPresent = true; if (display.isFoldable()) { this.regDisplayListener(); } else { if (this.screenW >= this.deviceSize) { this.isCenter = true; } else { this.isCenter = false; } } } regDisplayListener(): void { this.changePreferType(display.getFoldStatus()); display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => { if (this.curFoldStatus === curFoldStatus) { return; } this.curFoldStatus = curFoldStatus; this.changePreferType(this.curFoldStatus); }) } changePreferType(status: number): void { if (status === display.FoldStatus.FOLD_STATUS_FOLDED) { this.isCenter = false; } else { this.isCenter = true; } } @Builder defaultLogin() { Column() { CaptchaLogin({ isPresent: $isPresent, isPresentInLoginView: $isPresentInLoginView, isShowTransition: $isShowTransition }) } } @Builder halfModalLogin() { Column() { Text($r('app.string.multimodaltransion_after_login_more_service')) .fontColor(Color.Black) .fontSize(18) .padding({ top: 60 }) .id('bindSheetExist') Text($r('app.string.multimodaltransion_user_phone_number')) .fontColor(Color.Black) .fontSize(30) .fontWeight(50) .padding({ top: 30, bottom: 10 }) Text($r('app.string.multimodaltransion_get_service')) .fontColor($r('app.color.multimodaltransion_grey_9')) .fontSize(15) .padding({ bottom: 50 }) Button($r('app.string.multimodaltransion_phone_start_login')) .fontColor(Color.White) .type(ButtonType.Normal) .backgroundColor($r('app.color.multimodaltransion_red')) .onClick(() => { if (this.isConfirmed) { promptAction.showToast({ message: $r('app.string.multimodaltransion_login_success') }); AppStorage.set("login", true); DynamicsRouter.popAppRouter(); DynamicsRouter.pushUri("navigationinterceptor/InterceptorPage"); } else { promptAction.showToast({ message: $r('app.string.multimodaltransion_please_read_and_agree') }); } }) .width("90%") .height($r('app.integer.multimodaltransion_height_fifty')) .margin({ left: 12, right: 12, bottom: 10 }) .id('phoneNumberLogin') Button($r('app.string.multimodaltransion_captcha_login_text')) .fontColor(Color.Black) .borderRadius($r('app.integer.multimodaltransion_border_radius')) .type(ButtonType.Normal) .backgroundColor($r('app.color.multimodaltransion_btn_bgc')) .border({ color: $r('app.color.multimodaltransion_half_modal_btn_bgc'), width: 1 }) .onClick(() => { if (this.isConfirmed) { this.isPresentInLoginView = true; this.isConfirmed = false; this.isShowTransition = false; } else { promptAction.showToast({ message: $r('app.string.multimodaltransion_please_read_and_agree') }); } }) .width("90%") .height($r('app.integer.multimodaltransion_height_fifty')) .margin({ bottom: 30 }) .id('verificationLogin') Blank() Row({ space: SPACE_THIRTY }) { Image($r("app.media.multimodaltransion_app_logo1")) .width($r('app.integer.multimodaltransion_other_ways_icon_height')) .borderRadius($r('app.integer.multimodaltransion_other_ways_border_radius')) .onClick(() => { promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) Image($r("app.media.multimodaltransion_app_logo2")) .width($r('app.integer.multimodaltransion_other_ways_icon_height')) .borderRadius($r('app.integer.multimodaltransion_other_ways_border_radius')) .onClick(() => { promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) Image($r("app.media.multimodaltransion_app_logo3")) .width($r('app.integer.multimodaltransion_other_ways_icon_height')) .borderRadius($r('app.integer.multimodaltransion_other_ways_border_radius')) .onClick(() => { promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) }.margin({ bottom: 20 }) Row() { Checkbox({ name: 'checkbox' }) .select(this.isConfirmed) .width(14) .onChange((value: boolean) => { this.isConfirmed = value; }) .id('isChecked') Text() { Span($r('app.string.multimodaltransion_read_and_agree')) .fontColor($r('app.color.multimodaltransion_grey_9')) Span($r('app.string.multimodaltransion_server_proxy_rule_detail')) .fontColor($r('app.color.multimodaltransion_note_color')) .onClick(() => { promptAction.showToast({ message: $r('app.string.multimodaltransion_only_show_ui') }); }) }.fontSize(14) } .margin({ left: 32 }) .width($r('app.string.multimodaltransion_size_full')) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets#L41-L226
c12c49cc489d5b808f0cba32bd319a0c12553c98
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
setAVPlaybackState
设置AVSession实例状态 @returns {void}
setAVPlaybackState(): void { logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState)); // TODO:知识点:设置AVSession当前状态 this.session?.setAVPlaybackState(this.curState, (err) => { if (err) { console.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`); } else { console.info(`SetAVPlaybackState successfully`); } }); }
AST#method_declaration#Left setAVPlaybackState AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'avsession setAVPlaybackState' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // TODO:知识点:设置AVSession当前状态 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . session AST#member_expression#Right AST#expression#Right ?. setAVPlaybackState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curState AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set AVPlaybackState. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` SetAVPlaybackState successfully ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
setAVPlaybackState(): void { logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState)); this.session?.setAVPlaybackState(this.curState, (err) => { if (err) { console.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`); } else { console.info(`SetAVPlaybackState successfully`); } }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L263-L273
353745c55d471a3b728888310291c65ea6ba02b5
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/search/InterpolationSearch.ets
arkts
searchOptimized
优化的插值查找,添加边界检查 @param arr 已排序的数组 @param target 目标值 @returns 目标值在数组中的索引,如果不存在则返回-1
public static searchOptimized(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } let left = 0; let right = arr.length - 1; // 快速检查边界情况 if (target < arr[left] || target > arr[right]) { return -1; } while (left <= right) { // 防止除零错误 if (arr[right] === arr[left]) { if (arr[left] === target) { return left; } return -1; } // 计算插值位置 const pos = left + Math.floor(((right - left) * (target - arr[left])) / (arr[right] - arr[left])); // 确保位置在有效范围内 if (pos < left || pos > right) { return -1; } if (arr[pos] === target) { return pos; } if (arr[pos] < target) { left = pos + 1; } else { right = pos - 1; } } return -1; }
AST#method_declaration#Left public static searchOptimized 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 target : 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left arr AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left arr AST#expression#Right AST#binary_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#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left left = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left 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#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 target AST#expression#Right < AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left left AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right > AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left right AST#expression#Right ] AST#subscript_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#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( 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#block_statement#Left { // 防止除零错误 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left left AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left left AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left target 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 left 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#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 计算插值位置 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pos = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left left AST#expression#Right + AST#expression#Left Math AST#expression#Right AST#binary_expression#Right 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 AST#parenthesized_expression#Left ( 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#parenthesized_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right - AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left left AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right - AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left left AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 pos AST#expression#Right < AST#expression#Left left AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left pos AST#expression#Right > AST#expression#Left 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#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left pos AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left target 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 pos AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left arr AST#expression#Right [ AST#expression#Left pos AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right < AST#expression#Left target 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 left = AST#expression#Left AST#binary_expression#Left AST#expression#Left pos 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#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left right = AST#expression#Left AST#binary_expression#Left AST#expression#Left pos 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#block_statement#Right AST#if_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 AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static searchOptimized(arr: number[], target: number): number { if (!arr || arr.length === 0) { return -1; } let left = 0; let right = arr.length - 1; if (target < arr[left] || target > arr[right]) { return -1; } while (left <= right) { if (arr[right] === arr[left]) { if (arr[left] === target) { return left; } return -1; } const pos = left + Math.floor(((right - left) * (target - arr[left])) / (arr[right] - arr[left])); if (pos < left || pos > right) { return -1; } if (arr[pos] === target) { return pos; } if (arr[pos] < target) { left = pos + 1; } else { right = pos - 1; } } return -1; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/InterpolationSearch.ets#L51-L93
f2c410db6f594744b175af6cdf199c69bc78e7b9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/ScatterDataSet.ets
arkts
setScatterShape
Sets the ScatterShape this DataSet should be drawn with. This will search for an available IShapeRenderer and set this renderer for the DataSet. @param shape
public setScatterShape(shape: ChartShape): void { this.mShapeRenderer = ScatterDataSet.getRendererForShape(shape) !; }
AST#method_declaration#Left public setScatterShape AST#parameter_list#Left ( AST#parameter#Left shape : AST#type_annotation#Left AST#primary_type#Left ChartShape AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mShapeRenderer AST#member_expression#Right = AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ScatterDataSet AST#expression#Right . getRendererForShape AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left shape AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_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
public setScatterShape(shape: ChartShape): void { this.mShapeRenderer = ScatterDataSet.getRendererForShape(shape) !; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L100-L102
004cadd912e1ff576363704923423aad1d6bb0b7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets
arkts
getImageSourceByFilePath
通过沙箱路径直接获取文件资源实例 @param fileName - 文件名称。 @returns 图片资源实例。
public getImageSourceByFilePath(fileName: string): image.ImageSource { // [Start pixelmap_get_image_by_filepath] const context: Context = getContext(this); // fileName可使用'/test.jpg',也可以根据实际环境传入其他图片名 const filePath: string = context.cacheDir + fileName; // [End pixelmap_get_image_by_filepath] // path为已获得的沙箱路径 // [Start pixelmap_create_image_source_by_file_path] const imageSource: image.ImageSource = image.createImageSource(filePath); // [End pixelmap_create_image_source_by_file_path] return imageSource; }
AST#method_declaration#Left public getImageSourceByFilePath AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // [Start pixelmap_get_image_by_filepath] AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // fileName可使用'/test.jpg',也可以根据实际环境传入其他图片名 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . cacheDir AST#member_expression#Right AST#expression#Right + AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // [End pixelmap_get_image_by_filepath] // path为已获得的沙箱路径 // [Start pixelmap_create_image_source_by_file_path] AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath 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 // [End pixelmap_create_image_source_by_file_path] AST#statement#Left AST#return_statement#Left return AST#expression#Left imageSource AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getImageSourceByFilePath(fileName: string): image.ImageSource { const context: Context = getContext(this); const filePath: string = context.cacheDir + fileName; const imageSource: image.ImageSource = image.createImageSource(filePath); return imageSource; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L44-L55
771bbcb0bf9c5d3924ba0bb6d799e668f0e4c862
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/utils/RecordUtil.ets
arkts
根据偏移计算模式:0=语音录制,1=转文字,2=取消 @param offsetX @param offsetY @returns
export function getMode(offsetX: number, offsetY: number): number { if (offsetX < 0) { return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.CANCEL : VerifyModeEnum.VOICE; } else { return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.TEXT : VerifyModeEnum.VOICE; } }
AST#export_declaration#Left export AST#function_declaration#Left function getMode AST#parameter_list#Left ( AST#parameter#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offsetY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 offsetX AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left offsetY AST#expression#Right <= AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . GESTURE_DISTANCE AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left VerifyModeEnum AST#expression#Right . CANCEL AST#member_expression#Right AST#expression#Right : AST#expression#Left VerifyModeEnum AST#expression#Right AST#conditional_expression#Right AST#expression#Right . VOICE AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left offsetY AST#expression#Right <= AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . GESTURE_DISTANCE AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left VerifyModeEnum AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right : AST#expression#Left VerifyModeEnum AST#expression#Right AST#conditional_expression#Right AST#expression#Right . VOICE AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getMode(offsetX: number, offsetY: number): number { if (offsetX < 0) { return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.CANCEL : VerifyModeEnum.VOICE; } else { return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.TEXT : VerifyModeEnum.VOICE; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/utils/RecordUtil.ets#L46-L52
6c00c6b263947115b8056f894bb8fa1d0d804684
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieData.ets
arkts
getDataSet
Returns the DataSet this PieData object represents. A PieData object can only contain one DataSet. @return
public getDataSet(): IPieDataSet { return this.mDataSets.get(0); }
AST#method_declaration#Left public getDataSet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IPieDataSet AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDataSets AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getDataSet(): IPieDataSet { return this.mDataSets.get(0); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieData.ets#L63-L65
cdec89b9b4f548f56c74d3a0c1ea77e2f09b0068
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment2.ets
arkts
Example
[Start Counter_example1]
@Component export struct Example { build() { Column() { // Custom Components FlowListStruct( // Custom Component Passing Parameters // ... ).backgroundColor('#FFFFFF') } .width('100%') .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Example AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // Custom Components AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left FlowListStruct ( // Custom Component Passing Parameters // ... ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct Example { build() { Column() { FlowListStruct( ).backgroundColor('#FFFFFF') } .width('100%') .height('100%') } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment2.ets#L8-L21
ac8bb2e86e686ef3f1fa4cf29d06f3d960d2ac92
gitee
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/pages/RecommendPage.ets
arkts
getAspectRatio
计算图片的宽高比 @param imageWidth 图片宽度(px) @param imageHeight 图片高度(px) @returns 宽高比(width / height),如果无法计算则返回默认值
private getAspectRatio(imageWidth: number, imageHeight: number): number { // 如果宽高都有效且大于0,直接计算宽高比 if (imageWidth > 0 && imageHeight > 0) { return imageWidth / imageHeight; } // 如果宽高无效或为0,返回默认宽高比 // 可以根据业务需求选择:1.0(正方形)或 16/9(常见视频比例) // 这里使用 16/9,因为推荐页通常包含视频内容 return DEFAULT_ASPECT_RATIO; }
AST#method_declaration#Left private getAspectRatio AST#parameter_list#Left ( AST#parameter#Left imageWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageHeight : 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 { // 如果宽高都有效且大于0,直接计算宽高比 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 imageWidth AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left imageHeight AST#expression#Right > AST#expression#Left 0 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#binary_expression#Left AST#expression#Left imageWidth AST#expression#Right / AST#expression#Left imageHeight 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 // 如果宽高无效或为0,返回默认宽高比 // 可以根据业务需求选择:1.0(正方形)或 16/9(常见视频比例) // 这里使用 16/9,因为推荐页通常包含视频内容 AST#statement#Left AST#return_statement#Left return AST#expression#Left DEFAULT_ASPECT_RATIO AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getAspectRatio(imageWidth: number, imageHeight: number): number { if (imageWidth > 0 && imageHeight > 0) { return imageWidth / imageHeight; } return DEFAULT_ASPECT_RATIO; }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/pages/RecommendPage.ets#L194-L204
532c002b508c71bda10815809067d0301c87f5ce
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Address.ets
arkts
Address
地址类
@Observed export class Address { name?: string; phone?: string; address?: string; tag?: string; defaultFlag: boolean = false; constructor(name: string, phone: string, address: string, tag: string, defaultFlag: boolean) { this.name = name; this.phone = phone; this.address = address; this.tag = tag; this.defaultFlag = defaultFlag; } isNull(): boolean { if(this.name === "" && this.phone === "" && this.address === ""){ return true; } return false; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Address AST#class_body#Left { AST#property_declaration#Left name ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left phone ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left address ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left tag ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left defaultFlag : 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#constructor_declaration#Left constructor 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 phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultFlag : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right = AST#expression#Left name 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 . phone AST#member_expression#Right = AST#expression#Left phone 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 . address AST#member_expression#Right = AST#expression#Left address 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 . tag AST#member_expression#Right = AST#expression#Left tag 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 . defaultFlag AST#member_expression#Right = AST#expression#Left defaultFlag AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left isNull AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . name AST#member_expression#Right AST#expression#Right === AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right === AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . address AST#member_expression#Right AST#expression#Right === AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@Observed export class Address { name?: string; phone?: string; address?: string; tag?: string; defaultFlag: boolean = false; constructor(name: string, phone: string, address: string, tag: string, defaultFlag: boolean) { this.name = name; this.phone = phone; this.address = address; this.tag = tag; this.defaultFlag = defaultFlag; } isNull(): boolean { if(this.name === "" && this.phone === "" && this.address === ""){ return true; } return false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Address.ets#L19-L42
38c70ab531592bed7a21b61c58333dfeeec7f48e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
setGestureBackEnabled
设置当前窗口是否禁用返回手势功能,仅主窗全屏模式下生效,2in1设备下不生效。<API13+> @param enabled true时开启返回手势功能,false时禁用返回手势功能。 @param windowClass 不传该值,默认主窗口。 @returns
static async setGestureBackEnabled(enabled: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { if (AppUtil.isApiSupported(13)) { return windowClass.setGestureBackEnabled(enabled); } }
AST#method_declaration#Left static async setGestureBackEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getMainWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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 AppUtil AST#expression#Right . isApiSupported AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 13 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . setGestureBackEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left enabled AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async setGestureBackEnabled(enabled: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { if (AppUtil.isApiSupported(13)) { return windowClass.setGestureBackEnabled(enabled); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L398-L403
e8b2d9967def4cfcbf188f2d430f149b491ff8c6
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
getMonth
获取月份(1-12)
getMonth(): number { return this.date.month; }
AST#method_declaration#Left getMonth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getMonth(): number { return this.date.month; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L170-L172
b917b3bc0762603deceac9da56011c0bbaf4272c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/EncourageManager.ets
arkts
getPrefs
============================================================ 内部工具方法 ============================================================ 获取Preferences实例(类似Swift的UserDefaults)
private getPrefs(): preferences.Preferences { const context = getAppContext(); return preferences.getPreferencesSync(context, { name: Pref.Name }); }
AST#method_declaration#Left private getPrefs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_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 context = 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#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 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 . 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getPrefs(): preferences.Preferences { const context = getAppContext(); return preferences.getPreferencesSync(context, { name: Pref.Name }); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L114-L117
37e772cf6d821397c9abff54515b551a75895a34
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets
arkts
genKeyMaterialBlob
Data of the DataBlob type is generated based on the data group. @param data Data to be encapsulated. @returns DataBlob data
genKeyMaterialBlob(data: Array<number>): cryptoFramework.DataBlob { let keyMaterial = new Uint8Array(data); return { data: keyMaterial }; }
AST#method_declaration#Left genKeyMaterialBlob AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyMaterial = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left keyMaterial AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
genKeyMaterialBlob(data: Array<number>): cryptoFramework.DataBlob { let keyMaterial = new Uint8Array(data); return { data: keyMaterial }; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets#L56-L59
655fa855b17743a25e0285a7f92d46ac2fe9d0aa
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets
arkts
getAllData
获取所有数据 @returns
public getAllData(): T[] { return this.originDataArray; }
AST#method_declaration#Left public getAllData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] 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#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getAllData(): T[] { return this.originDataArray; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L45-L47
f3c0a7e0d61370a38f952b0e1b5e0d9f016d920e
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/Index.ets
arkts
RouteBuild
@file navigation 模块统一导出 @author Joker.X
export { RouteBuild } from "./src/main/ets/RouteBuild";
AST#export_declaration#Left export { RouteBuild } from "./src/main/ets/RouteBuild" ; AST#export_declaration#Right
export { RouteBuild } from "./src/main/ets/RouteBuild";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/Index.ets#L6-L6
f9e38a676538403e3a9a8c0ce9b5b99f7caeb138
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/AES.ets
arkts
decryptCBC
解密(CBC模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。 @returns
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> { return AES.decrypt(data, symKey, ivParams, transformation); }
AST#method_declaration#Left static async decryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ivParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . IvParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transformation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'AES256|CBC|PKCS7' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AES AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left ivParams AST#expression#Right , AST#expression#Left transformation 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 decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> { return AES.decrypt(data, symKey, ivParams, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L137-L140
2f7df1459d53dfc53cedc756975fe4147ec6fe6f
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowScratchingBoard.ets
arkts
default_action
Actions The default actions for link, text and image when clicked.
default_action() { if (this.type == 'url') { this.open_url(this.text); } if (this.type == 'text') { this.copy_text(this.text); } if (this.type == 'image') { preview_image(this.text, this.storage); } }
AST#method_declaration#Left default_action AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#member_expression#Right AST#expression#Right == AST#expression#Left 'url' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . open_url 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 . text AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#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 . type AST#member_expression#Right AST#expression#Right == AST#expression#Left 'text' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . copy_text 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 . text AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#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 . type AST#member_expression#Right AST#expression#Right == AST#expression#Left 'image' 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 preview_image AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . text AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . storage AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
default_action() { if (this.type == 'url') { this.open_url(this.text); } if (this.type == 'text') { this.copy_text(this.text); } if (this.type == 'image') { preview_image(this.text, this.storage); } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowScratchingBoard.ets#L364-L374
453ce62381352adc385c10a6da31ceb4fcfea6ea
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets
arkts
@Author csx @DateTime 2024/3/18 10:37:03 @TODO SM3Sync SM3同步工具类
export class SM3Sync { /** * SM3摘要 * @param str 带摘要的字符串 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns 摘要后的字符串 */ static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.digest(str, 'SM3', resultCoding); } /** * 消息认证码计算 * @param str 计算字符串 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns */ static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return DynamicSyncUtil.hmac(str, 'SM3', resultCoding); } }
AST#export_declaration#Left export AST#class_declaration#Left class SM3Sync AST#class_body#Left { /** * SM3摘要 * @param str 带摘要的字符串 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns 摘要后的字符串 */ AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . digest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 'SM3' AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 消息认证码计算 * @param str 计算字符串 * @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 * @returns */ AST#method_declaration#Left static hmac AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DynamicSyncUtil AST#expression#Right . hmac AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 'SM3' AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class SM3Sync { static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.digest(str, 'SM3', resultCoding); } static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return DynamicSyncUtil.hmac(str, 'SM3', resultCoding); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets#L27-L47
75aa1bd082dd31b0e95eff71f7976f9bc398b553
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/PrefetchResource.ets
arkts
onCreate
EntryAbility.ets
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('EntryAbility onCreate.'); webview.WebviewController.initializeWebEngine(); // When pre-acquiring, 'https://www.example1.com/POST? E=f&g=h' is replaced by the actual website address to be visited. webview.WebviewController.prefetchResource( { url: 'https://www.example.com/POST?e=f&g=h', method: 'POST', formData: 'a=x&b=y' }, [{ headerKey: 'c', headerValue: 'z' }], 'KeyX', 500 ); AppStorage.setOrCreate('abilityWant', want); console.log('EntryAbility onCreate done.'); }
AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConstant . LaunchParam 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#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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'EntryAbility onCreate.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . initializeWebEngine 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 // When pre-acquiring, 'https://www.example1.com/POST? E=f&g=h' is replaced by the actual website address to be visited. 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 webview AST#expression#Right . WebviewController AST#member_expression#Right AST#expression#Right . prefetchResource 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 'https://www.example.com/POST?e=f&g=h' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left 'POST' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left formData AST#property_name#Right : AST#expression#Left 'a=x&b=y' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left headerKey AST#property_name#Right : AST#expression#Left 'c' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headerValue AST#property_name#Right : AST#expression#Left 'z' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left 'KeyX' AST#expression#Right , AST#expression#Left 500 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 AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'abilityWant' AST#expression#Right , AST#expression#Left want 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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'EntryAbility onCreate done.' 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
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('EntryAbility onCreate.'); webview.WebviewController.initializeWebEngine(); webview.WebviewController.prefetchResource( { url: 'https://www.example.com/POST?e=f&g=h', method: 'POST', formData: 'a=x&b=y' }, [{ headerKey: 'c', headerValue: 'z' }], 'KeyX', 500 ); AppStorage.setOrCreate('abilityWant', want); console.log('EntryAbility onCreate done.'); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/PrefetchResource.ets#L7-L25
e38f770658cdbc7b53dc10827ece844463f887a9
gitee
conrad_sheeran/TickAuth
8ef852e12999d15cf70394cdab82d08ac5843143
features/settings/src/main/ets/model/SettingsItemModel.ets
arkts
Copyright (c) 2024 Yang He TickAuth is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
export class SettingsItemClass { symbol: string = "" title: string = ""; content: string = ""; constructor(symbol: string, title: string, content: string) { this.symbol = symbol; this.title = title; this.content = content; } }
AST#export_declaration#Left export AST#class_declaration#Left class SettingsItemClass AST#class_body#Left { AST#property_declaration#Left symbol : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#ERROR#Left title : string = "" AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left symbol : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . symbol AST#member_expression#Right = AST#expression#Left symbol AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class SettingsItemClass { symbol: string = "" title: string = ""; content: string = ""; constructor(symbol: string, title: string, content: string) { this.symbol = symbol; this.title = title; this.content = content; } }
https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/settings/src/main/ets/model/SettingsItemModel.ets#L18-L28
cefc641119a39bbdc0db876469fb685fac628c66
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppContext.ets
arkts
initUIContext
初始化 UI 上下文。 通常在页面或组件的 aboutToAppear() 生命周期中调用。
static initUIContext(context: UIContext): void { AppContext._uiContext = context }
AST#method_declaration#Left static initUIContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 AppContext AST#expression#Right . _uiContext AST#member_expression#Right = AST#expression#Left context AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static initUIContext(context: UIContext): void { AppContext._uiContext = context }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppContext.ets#L41-L43
f7c68dc50f554daea1310abae3ae34ea5d892c54
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSWantOpenManageApplications/entry/src/main/ets/pages/Index.ets
arkts
implicitStartAbility
隐示启动Ability
async implicitStartAbility() { try { let want = { // 调用应用管理 "action": "ohos.settings.manage.applications" } let context = getContext(this) as common.UIAbilityContext; await context.startAbility(want) console.info(`implicit start ability succeed`) } catch (error) { console.info(`implicit start ability failed with ${error.code}`) } }
AST#method_declaration#Left async implicitStartAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left want = AST#expression#Left AST#object_literal#Left { // 调用应用管理 AST#property_assignment#Left AST#property_name#Left "action" AST#property_name#Right : AST#expression#Left "ohos.settings.manage.applications" 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 context = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#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 context AST#expression#Right AST#await_expression#Right AST#expression#Right . startAbility AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left want AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` implicit start ability succeed ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` implicit start ability failed with AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async implicitStartAbility() { try { let want = { "action": "ohos.settings.manage.applications" } let context = getContext(this) as common.UIAbilityContext; await context.startAbility(want) console.info(`implicit start ability succeed`) } catch (error) { console.info(`implicit start ability failed with ${error.code}`) } }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSWantOpenManageApplications/entry/src/main/ets/pages/Index.ets#L21-L33
13221db4abc3eb5347e6ab47642ad9d0b17432e1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/StatusBarUtils.ets
arkts
状态栏工具类
export class StatusBarUtil { // 使用静态属性存储状态栏高度,便于全局访问 private static readonly STATUS_BAR_HEIGHT_KEY: string = 'statusBarHeight'; /** * 设置状态栏的内容颜色(文字和图标的颜色) * 类似于SwiftUI中修改UIApplication.shared.statusBarStyle * @param color 颜色字符串,例如 '#000000' (黑色) 或 '#FFFFFF' (白色) * @param context 上下文对象 */ static async setStatusBarContentColor(color: string): Promise<void> { try { const context = getContext(StatusBarUtil) // 使用正确的API获取窗口实例[5,6](@ref) const currentWindow = await window.getLastWindow(context); // 设置状态栏属性[3](@ref) await currentWindow.setWindowSystemBarProperties({ statusBarContentColor: color }); console.info('StatusBar content color set to: ' + color); } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to set status bar content color. Code: ${err.code}, message: ${err.message}`); } } /** * 设置状态栏的背景颜色 * @param color 颜色字符串,支持透明度 * @param context 上下文对象 */ static async setStatusBarBackgroundColor(color: string): Promise<void> { try { const currentWindow = await window.getLastWindow(getContext(StatusBarUtil)); await currentWindow.setWindowSystemBarProperties({ statusBarColor: color }); console.info('StatusBar background color set to: ' + color); } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to set status bar background color. Code: ${err.code}, message: ${err.message}`); } } /** * 获取状态栏高度(单位:px) * 类似于iOS中的safeAreaInsets.top[5,8](@ref) * @param context 上下文对象 * @returns 状态栏高度的Promise */ static async getStatusBarHeight(): Promise<number> { try { const currentWindow = await window.getLastWindow(getContext(StatusBarUtil)); // 获取系统避免区域[5,8](@ref) const avoidArea = currentWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); const statusBarHeightPx = avoidArea.topRect.height; AppStorage.setOrCreate(StatusBarUtil.STATUS_BAR_HEIGHT_KEY, statusBarHeightPx); return statusBarHeightPx; } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to get status bar height. Code: ${err.code}, message: ${err.message}`); return 0; } } /** * 设置沉浸式状态栏[3,4](@ref) * @param context 上下文对象 */ static async setImmersiveStatusBar(): Promise<void> { try { const context = getContext(StatusBarUtil) const currentWindow = await window.getLastWindow(context) // 设置窗口布局为全屏[3,4](@ref) await currentWindow.setWindowLayoutFullScreen(true); await currentWindow.setWindowSystemBarEnable(['status']); await currentWindow.setWindowSystemBarProperties({ statusBarColor: '#00000000' }); await StatusBarUtil.getStatusBarHeight(); } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to set immersive status bar. Code: ${err.code}, message: ${err.message}`); } } // 便捷方法 static async setDarkContent(): Promise<void> { await StatusBarUtil.setStatusBarContentColor('#000000'); } static async setLightContent(): Promise<void> { await StatusBarUtil.setStatusBarContentColor('#FFFFFF'); } }
AST#export_declaration#Left export AST#class_declaration#Left class StatusBarUtil AST#class_body#Left { // 使用静态属性存储状态栏高度,便于全局访问 AST#property_declaration#Left private static readonly STATUS_BAR_HEIGHT_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'statusBarHeight' AST#expression#Right ; AST#property_declaration#Right /** * 设置状态栏的内容颜色(文字和图标的颜色) * 类似于SwiftUI中修改UIApplication.shared.statusBarStyle * @param color 颜色字符串,例如 '#000000' (黑色) 或 '#FFFFFF' (白色) * @param context 上下文对象 */ AST#method_declaration#Left static async setStatusBarContentColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left StatusBarUtil AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 使用正确的API获取窗口实例[5,6](@ref) AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentWindow = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left window AST#expression#Right AST#await_expression#Right AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 设置状态栏属性[3](@ref) 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 currentWindow AST#expression#Right AST#await_expression#Right AST#expression#Right . setWindowSystemBarProperties 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 statusBarContentColor AST#property_name#Right : AST#expression#Left color AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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 'StatusBar content color set to: ' AST#expression#Right + AST#expression#Left color 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#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set status bar content color. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 设置状态栏的背景颜色 * @param color 颜色字符串,支持透明度 * @param context 上下文对象 */ AST#method_declaration#Left static async setStatusBarBackgroundColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentWindow = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left window AST#expression#Right AST#await_expression#Right AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left StatusBarUtil 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#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 currentWindow AST#expression#Right AST#await_expression#Right AST#expression#Right . setWindowSystemBarProperties 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 statusBarColor AST#property_name#Right : AST#expression#Left color AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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 'StatusBar background color set to: ' AST#expression#Right + AST#expression#Left color 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#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set status bar background color. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取状态栏高度(单位:px) * 类似于iOS中的safeAreaInsets.top[5,8](@ref) * @param context 上下文对象 * @returns 状态栏高度的Promise */ AST#method_declaration#Left static async getStatusBarHeight 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 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentWindow = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left window AST#expression#Right AST#await_expression#Right AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left StatusBarUtil 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 // 获取系统避免区域[5,8](@ref) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left avoidArea = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentWindow AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_SYSTEM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left statusBarHeightPx = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avoidArea AST#expression#Right . topRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 AST#member_expression#Left AST#expression#Left StatusBarUtil AST#expression#Right . STATUS_BAR_HEIGHT_KEY AST#member_expression#Right AST#expression#Right , AST#expression#Left statusBarHeightPx 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 statusBarHeightPx AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to get status bar height. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 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 /** * 设置沉浸式状态栏[3,4](@ref) * @param context 上下文对象 */ AST#method_declaration#Left static async setImmersiveStatusBar AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left StatusBarUtil 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 currentWindow = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left window AST#expression#Right AST#await_expression#Right AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right // 设置窗口布局为全屏[3,4](@ref) 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 currentWindow AST#expression#Right AST#await_expression#Right AST#expression#Right . setWindowLayoutFullScreen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 currentWindow AST#expression#Right AST#await_expression#Right AST#expression#Right . setWindowSystemBarEnable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'status' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 currentWindow AST#expression#Right AST#await_expression#Right AST#expression#Right . setWindowSystemBarProperties 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 statusBarColor AST#property_name#Right : AST#expression#Left '#00000000' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left StatusBarUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getStatusBarHeight 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#variable_declaration#Left const AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set immersive status bar. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 便捷方法 AST#method_declaration#Left static async setDarkContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left StatusBarUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . setStatusBarContentColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#000000' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left static async setLightContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left StatusBarUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . setStatusBarContentColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class StatusBarUtil { private static readonly STATUS_BAR_HEIGHT_KEY: string = 'statusBarHeight'; static async setStatusBarContentColor(color: string): Promise<void> { try { const context = getContext(StatusBarUtil) const currentWindow = await window.getLastWindow(context); await currentWindow.setWindowSystemBarProperties({ statusBarContentColor: color }); console.info('StatusBar content color set to: ' + color); } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to set status bar content color. Code: ${err.code}, message: ${err.message}`); } } static async setStatusBarBackgroundColor(color: string): Promise<void> { try { const currentWindow = await window.getLastWindow(getContext(StatusBarUtil)); await currentWindow.setWindowSystemBarProperties({ statusBarColor: color }); console.info('StatusBar background color set to: ' + color); } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to set status bar background color. Code: ${err.code}, message: ${err.message}`); } } static async getStatusBarHeight(): Promise<number> { try { const currentWindow = await window.getLastWindow(getContext(StatusBarUtil)); const avoidArea = currentWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); const statusBarHeightPx = avoidArea.topRect.height; AppStorage.setOrCreate(StatusBarUtil.STATUS_BAR_HEIGHT_KEY, statusBarHeightPx); return statusBarHeightPx; } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to get status bar height. Code: ${err.code}, message: ${err.message}`); return 0; } } static async setImmersiveStatusBar(): Promise<void> { try { const context = getContext(StatusBarUtil) const currentWindow = await window.getLastWindow(context) await currentWindow.setWindowLayoutFullScreen(true); await currentWindow.setWindowSystemBarEnable(['status']); await currentWindow.setWindowSystemBarProperties({ statusBarColor: '#00000000' }); await StatusBarUtil.getStatusBarHeight(); } catch (error) { const err: BusinessError = error as BusinessError; console.error(`Failed to set immersive status bar. Code: ${err.code}, message: ${err.message}`); } } static async setDarkContent(): Promise<void> { await StatusBarUtil.setStatusBarContentColor('#000000'); } static async setLightContent(): Promise<void> { await StatusBarUtil.setStatusBarContentColor('#FFFFFF'); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/StatusBarUtils.ets#L6-L101
fac39b8478e193e6380abad956202c87b4e2e0bc
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/pages/MerchantDetailPage.ets
arkts
toggleFavorite
切换收藏状态
private async toggleFavorite(): Promise<void> { if (!this.merchant) { return; } try { await this.favoriteManager.toggleFavorite(this.merchant.id); const isFavorited = this.favoriteIds.includes(this.merchant.id); promptAction.showToast({ message: isFavorited ? '已添加到收藏' : '已取消收藏', duration: 2000 }); } catch (err) { hilog.error(DOMAIN, TAG, 'Failed to toggle favorite: %{public}s', JSON.stringify(err)); promptAction.showToast({ message: '操作失败,请重试', duration: 2000 }); } }
AST#method_declaration#Left private async toggleFavorite 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 . merchant 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#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 . favoriteManager AST#member_expression#Right AST#expression#Right . toggleFavorite 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 . merchant AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isFavorited = 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 . favoriteIds AST#member_expression#Right AST#expression#Right . includes 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 . merchant AST#member_expression#Right AST#expression#Right . id 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 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#conditional_expression#Left AST#expression#Left isFavorited AST#expression#Right ? AST#expression#Left '已添加到收藏' AST#expression#Right : AST#expression#Left '已取消收藏' AST#expression#Right AST#conditional_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 2000 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#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 hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Failed to toggle favorite: %{public}s' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async toggleFavorite(): Promise<void> { if (!this.merchant) { return; } try { await this.favoriteManager.toggleFavorite(this.merchant.id); const isFavorited = this.favoriteIds.includes(this.merchant.id); promptAction.showToast({ message: isFavorited ? '已添加到收藏' : '已取消收藏', duration: 2000 }); } catch (err) { hilog.error(DOMAIN, TAG, 'Failed to toggle favorite: %{public}s', JSON.stringify(err)); promptAction.showToast({ message: '操作失败,请重试', duration: 2000 }); } }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/MerchantDetailPage.ets#L108-L128
1f35546214830be17c2eb9c9525f227b84fc8f9e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CrashUtil.ets
arkts
delete
删除日志文件 @returns
static delete() { if (CrashUtil.access()) { const path = CrashUtil.getFilePath(); FileUtil.unlinkSync(path); } }
AST#method_declaration#Left static delete AST#parameter_list#Left ( ) 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 CrashUtil AST#expression#Right . access 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#variable_declaration#Left const AST#variable_declarator#Left path = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CrashUtil AST#expression#Right . getFilePath 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 FileUtil AST#expression#Right . unlinkSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static delete() { if (CrashUtil.access()) { const path = CrashUtil.getFilePath(); FileUtil.unlinkSync(path); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L120-L125
66a60c1ee27e53f61ab9ed5928980d54a6b9bef3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets
arkts
appItemWithNameView
应用类别里每一个应用和位移动画过程中的展示样式 @param data app信息和首页应用里的appName
@Builder appItemWithNameView(data: AddedIconWithNameViewMode) { Stack({ alignContent: Alignment.TopEnd }) { Image(data.app.icon) .width($r('app.string.grid_exchange_icon_size')) .height($r('app.string.grid_exchange_icon_size')) .interpolation(ImageInterpolation.High) .syncLoad(true) .draggable(false) // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false // 不在首页应用里的app才会展示添加标识 if (this.isEdit && !data.homeAppNames.includes(JSON.stringify(data.app.name))) { Image($r('app.media.ic_public_list_add_light')) .width($r('app.string.grid_exchange_remove_icon_size')) .height($r('app.string.grid_exchange_remove_icon_size')) .markAnchor({ x: $r('app.string.grid_exchange_add_sign_x_size'), y: $r('app.string.grid_exchange_add_sign_y_size') }) .id('add_button') } } Text(data.app.name) .width($r('app.string.grid_exchange_app_name_width')) .fontSize($r('app.string.grid_exchange_app_name_font_size')) .maxLines(1) .fontColor(Color.Black) .textAlign(TextAlign.Center) .margin({ top: $r('app.string.grid_exchange_app_name_margin_top_size') }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right appItemWithNameView AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AddedIconWithNameViewMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopEnd AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . app AST#member_expression#Right AST#expression#Right . icon AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.grid_exchange_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.string.grid_exchange_icon_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . interpolation ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageInterpolation AST#expression#Right . High AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . syncLoad ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . draggable ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_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 // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false // 不在首页应用里的app才会展示添加标识 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEdit AST#member_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left data AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . homeAppNames AST#member_expression#Right AST#expression#Right . includes 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . app AST#member_expression#Right AST#expression#Right . name 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_public_list_add_light' 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.grid_exchange_remove_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.string.grid_exchange_remove_icon_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . markAnchor ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.grid_exchange_add_sign_x_size' AST#expression#Right ) AST#resource_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#resource_expression#Left $r ( AST#expression#Left 'app.string.grid_exchange_add_sign_y_size' 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 . id ( AST#expression#Left 'add_button' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 data AST#expression#Right . app AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.grid_exchange_app_name_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.grid_exchange_app_name_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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.string.grid_exchange_app_name_margin_top_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 appItemWithNameView(data: AddedIconWithNameViewMode) { Stack({ alignContent: Alignment.TopEnd }) { Image(data.app.icon) .width($r('app.string.grid_exchange_icon_size')) .height($r('app.string.grid_exchange_icon_size')) .interpolation(ImageInterpolation.High) .syncLoad(true) .draggable(false) if (this.isEdit && !data.homeAppNames.includes(JSON.stringify(data.app.name))) { Image($r('app.media.ic_public_list_add_light')) .width($r('app.string.grid_exchange_remove_icon_size')) .height($r('app.string.grid_exchange_remove_icon_size')) .markAnchor({ x: $r('app.string.grid_exchange_add_sign_x_size'), y: $r('app.string.grid_exchange_add_sign_y_size') }) .id('add_button') } } Text(data.app.name) .width($r('app.string.grid_exchange_app_name_width')) .fontSize($r('app.string.grid_exchange_app_name_font_size')) .maxLines(1) .fontColor(Color.Black) .textAlign(TextAlign.Center) .margin({ top: $r('app.string.grid_exchange_app_name_margin_top_size') }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L83-L112
491aece9d105104a4db96f41d2ea7b90d78762f5
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
getCurrentStackName
获取当前路由栈名称 @returns
public static getCurrentStackName(): string { return ZRouter.getRouterMgr().currentStackName }
AST#method_declaration#Left public static getCurrentStackName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . currentStackName AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static getCurrentStackName(): string { return ZRouter.getRouterMgr().currentStackName }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L347-L349
0436a27789048962622baebaa0193c4dab61b4fc
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/TodoTypes.ets
arkts
变更值接口
export interface ChangeValue { old: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined; new: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ChangeValue AST#object_type#Left { AST#type_member#Left old : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left TodoPriority AST#primary_type#Right | AST#primary_type#Left TodoStatus AST#primary_type#Right | AST#primary_type#Left TodoType AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left new : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left TodoPriority AST#primary_type#Right | AST#primary_type#Left TodoStatus AST#primary_type#Right | AST#primary_type#Left TodoType AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ChangeValue { old: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined; new: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L176-L179
6534b5f32e71ab83a49d902ac2bd85dd07b773f6
github
queueit/harmony-sdk.git
ba7b4b38c03730bfbe305789acba6db0012d5f5c
queueit_sdk/src/main/ets/Index.ets
arkts
QueueItEngine
src/main/ets/index.ets This file defines the public API of the Queue-it ArkTS SDK. Application developers will import SDK components from here. --- Core Engine & Listener ---
export { QueueItEngine } from './main/QueueItEngine';
AST#export_declaration#Left export { QueueItEngine } from './main/QueueItEngine' ; AST#export_declaration#Right
export { QueueItEngine } from './main/QueueItEngine';
https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/Index.ets#L6-L6
5e0252630db06c35f4453619d1dd2ed9076db9c8
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
isWeakMap
Check whether the entered value is of type weakmap. @param { Object } value - A WeakMap value @returns { boolean } Returns true if the value is a built-in WeakMap instance. @syscap SystemCapability.Utils.Lang @crossplatform @atomicservice @since 20
isWeakMap(value: Object): boolean;
AST#method_declaration#Left isWeakMap AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
isWeakMap(value: Object): boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1400-L1400
03c5c448293f05566ac44989485fa91b1d173bee
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets
arkts
GestureGroupExample
功能描述: 本示例使用AVrecord录制音频和AVrecord的getAudioCapturerMaxAmplitude接口获取振幅实现UI动效;使用AVplayer播放音频 推荐场景: 语音录制场景 核心组件: 1. AudioRecorder 实现步骤: 1. 利用AVrecord录制音频病获取音频振幅 2. 利用振幅的变化,换算出column的height并加上动画效果 3. 使用AVplayer播放录制的音频文件
@Component export struct GestureGroupExample { @State bottomHeight: number = 0; // 底部系统导航栏高度 @State messages: Array<Message> = messageList; @State columnX: number = Const.COLUMN_WIDTH; // Column宽度 @State yMax: number = Const.OPACITY_FALSE; // Column高度最大值 @State yMin: number = Const.OPACITY_FALSE; // Column高度最小值 @State isListening: boolean = false; @State count: number = Const.OPACITY_FALSE; @State flagUpOpacity: number = Const.OPACITY_FALSE; // 上划取消字样透明度 @State flagInfoOpacity: number = Const.OPACITY_FALSE; // 消息条透明度 @State maxNumber: number = Const.OPACITY_FALSE; // Column最大高度 @State minNumber: number = Const.OPACITY_FALSE; // Column最小高度 @State timeStart: number = Const.OPACITY_FALSE; // 初始时间戳 @State timeEnd: number = Const.OPACITY_FALSE; // 结束时间戳 @State timeAv: number = Const.OPACITY_FALSE; // 手势持续时间 @State waterRipplesBg: Resource = $r("app.string.voice_record_water_ripples_bg"); // 取消识别背景色 @State backgroundCancel: Color = Color.Gray; // 取消识别字体颜色 @State fontColorCancel: Color = Color.White; // 识别文字背景色 @State backgroundWord: Color = Color.Gray; // 识别文字字体颜色 @State fontColorWord: Color = Color.White; // 松开发送背景色 @State backgroundVoice: Color = Color.White; // 松开发送字体颜色 @State fontColorVoice: Color = Color.Black; textSize: Resource = $r("app.integer.voice_record_verify_text_font_size"); // 当前模式 @State mode: number = VerifyModeEnum.VOICE; avoidAreaType: number = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; // 创建音频录制与播放实例 AVRecord = new AudioRecorder(); AVPlayer = new AVPlayer(); @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; private scroller: ListScroller = new ListScroller(); aboutToAppear() { const context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; reqPermissionsFromUser(permissions, context); window.getLastWindow(getContext(this)).then((window) => { const avoidArea = window.getWindowAvoidArea(this.avoidAreaType); this.bottomHeight = px2vp(avoidArea.bottomRect.height); }); } //重置状态 resetState(): void { this.backgroundCancel = Color.Gray; this.fontColorCancel = Color.White; this.backgroundWord = Color.Gray; this.fontColorWord = Color.White; this.backgroundVoice = Color.White; this.fontColorVoice = Color.Black; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg"); this.timeStart = Const.OPACITY_FALSE; // 初始时间戳 this.timeEnd = Const.OPACITY_FALSE; } //根据识别模式设置不同样式 updateStateByMode(): void { if (this.mode === VerifyModeEnum.VOICE) { // 语音识别 this.backgroundVoice = Color.White; this.fontColorVoice = Color.Black; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg"); this.fontColorCancel = Color.White; this.backgroundCancel = Color.Gray; this.fontColorWord = Color.White; this.backgroundWord = Color.Gray; } else if (this.mode === VerifyModeEnum.TEXT) { // 转文字 this.fontColorWord = Color.Black; this.backgroundWord = Color.White; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg"); this.fontColorCancel = Color.White; this.backgroundCancel = Color.Gray; this.backgroundVoice = Color.Gray; this.fontColorVoice = Color.White; } else if (this.mode === VerifyModeEnum.CANCEL) { // 取消 this.fontColorCancel = Color.Black; this.backgroundCancel = Color.White; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg_over"); this.fontColorWord = Color.White; this.backgroundWord = Color.Gray; this.backgroundVoice = Color.Gray; this.fontColorVoice = Color.White; } } //手势结束业务 doGestureEndBusiness(): void { // 发送语音,计算时间 if (this.mode === VerifyModeEnum.VOICE) { this.timeEnd = Math.floor(new Date().getTime() / Const.ANIMATION_DURATION); this.timeAv = this.timeEnd - this.timeStart; let messageId: String = new String(this.messages.length + 1); this.messages.push({ id: messageId.toString(), sender: Const.SENDER, avatar: "app.media.voice_record_dynamic_effect_avatar_own", type: 1, content: new String(this.timeAv).toString() }) } else if (this.mode === VerifyModeEnum.TEXT) { let messageId: String = new String(this.messages.length + 1); this.messages.push({ id: messageId.toString(), sender: Const.SENDER, avatar: "app.media.voice_record_dynamic_effect_avatar_own", type: 0, content: Const.VERIFY_TEXT }) } this.resetState(); clearInterval(this.count); this.isListening = false; animateTo({ duration: Const.OPACITY_FALSE }, () => { this.yMax = Const.OPACITY_FALSE; this.yMin = Const.OPACITY_FALSE; }) this.flagUpOpacity = Const.OPACITY_FALSE; if (this.mode === VerifyModeEnum.VOICE) { this.flagInfoOpacity = Const.OPACITY_TRUE; } this.AVRecord.stopRecordingProcess(); // 手势业务结束消息列表滚动到底部 this.scroller.scrollEdge(Edge.Bottom); } @Builder buildMessage(message: Message) { Row({ space: Const.BLANK_row }) { if (message.sender === Const.SENDER) { if (message.type === MessageType.TEXT) { //文本消息 Text(message.content) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .textAlign(TextAlign.Center) .margin($r("app.integer.voice_record_message_margin")) .backgroundColor($r("app.color.voice_record_dynamic_effect_color_message")) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin"), top: $r("app.integer.voice_record_dynamic_effect_margin"), bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) .borderRadius(Const.COLUMN_WIDTH) } else { //语音消息 Row() { Image($r("app.media.voice_record_dynamic_effect_volume")) .id('voice_add_image') .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Text(message.content) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .margin($r("app.integer.voice_record_message_margin")) } .borderRadius(Const.COLUMN_WIDTH) .justifyContent(FlexAlign.End) .width(Number(message.content) * Const.COLUMN_WIDTH + Const.HEIGHT_MIN) .backgroundColor($r("app.color.voice_record_dynamic_effect_color_message")) .margin({ top: $r('app.integer.voice_record_dynamic_effect_margin_top') }) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin") }) .onClick(() => { this.AVPlayer.avPlayerUrlDemo(); }) } //头像 Image($r("app.media.voice_record_dynamic_effect_avatar_own")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) } else { //头像 Image($r("app.media.voice_record_dynamic_effect_avatar_friend")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) //文本消息 Text(message.content) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .textAlign(TextAlign.Center) .margin($r("app.integer.voice_record_message_margin")) .backgroundColor(Color.White) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin"), top: $r("app.integer.voice_record_dynamic_effect_margin"), bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) .borderRadius(Const.COLUMN_WIDTH) } } .justifyContent(message.sender === Const.SENDER ? FlexAlign.End : FlexAlign.Start) .width($r('app.string.voice_record_dynamic_effect_width_full')) .margin({ top: $r('app.integer.voice_record_dynamic_effect_margin_top') }) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin") }) } build() { Stack() { Column() { Row() { Image($r("app.media.voice_record_dynamic_effect_left")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Text($r("app.string.voice_record_dynamic_effect_friend")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .textAlign(TextAlign.Center) Image($r("app.media.voice_record_dynamic_effect_qmz0nuwq")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) } .backgroundColor($r("app.color.voice_record_dynamic_effect_color_all")) .justifyContent(FlexAlign.SpaceBetween) .width($r('app.string.voice_record_dynamic_effect_width_full')) .padding($r("app.integer.voice_record_dynamic_effect_padding_row")) Column() { List({ scroller: this.scroller }) { ForEach(this.messages, (item: Message) => { ListItem() { this.buildMessage(item) } }, (item: Message) => item.id) } .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r('app.string.voice_record_dynamic_effect_width_full')) } .backgroundColor($r("app.color.voice_record_dynamic_effect_color_all")) .justifyContent(FlexAlign.Start) .width($r('app.string.voice_record_dynamic_effect_width_full')) .layoutWeight(1) //底部按钮行 Row() { Image($r("app.media.voice_record_dynamic_effect_icon")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Button($r("app.string.voice_record_dynamic_effect_button")) .type(ButtonType.Normal) .borderRadius($r("app.integer.voice_record_border_radio")) .backgroundColor(Color.White) .width($r("app.integer.voice_record_dynamic_effect_width_button")) .height($r("app.integer.voice_record_dynamic_effect_height_button")) .fontColor(Color.Black) .gesture( GestureGroup(GestureMode.Sequence, LongPressGesture() .onAction(() => { this.mode = VerifyModeEnum.VOICE; // 获取时间戳 this.timeStart = Math.floor(new Date().getTime() / Const.ANIMATION_DURATION); this.flagInfoOpacity = Const.OPACITY_FALSE; this.isListening = !this.isListening; this.flagUpOpacity = Const.OPACITY_TRUE; this.AVRecord.startRecordingProcess(); // 每隔100ms获取一次振幅 this.count = setInterval(() => { if (this.AVRecord.maxAmplitude > Const.MIN_AMPLITUDE) { this.maxNumber = (this.AVRecord.maxAmplitude) / Const.MAX_AMPLITUDE * Const.COLUMN_HEIGHT; this.maxNumber = this.maxNumber >= 60 ? 60 : this.maxNumber; this.minNumber = this.maxNumber - Const.HEIGHT_MIN; } else { this.maxNumber = Const.OPACITY_FALSE; this.minNumber = Const.OPACITY_FALSE; } if (this.isListening) { animateTo({ duration: Const.ANIMATION_DURATION, curve: Curve.EaseInOut }, () => { this.yMax = Math.round(Math.random() * 60); this.yMin = Math.round(Math.random() * 20); }) } }, Const.SET_INTERVAL_TIME); }) .onActionEnd(() => { clearInterval(this.count); this.flagInfoOpacity = Const.OPACITY_TRUE; this.yMax = Const.OPACITY_FALSE; this.yMin = Const.OPACITY_FALSE; this.AVRecord.stopRecordingProcess(); }), // 上划左边取消,右边转文字 PanGesture({ direction: PanDirection.Left | PanDirection.Right | PanDirection.Up, distance: 50 }) .onActionStart((event: GestureEvent) => { const offsetX = event.offsetX; const offsetY = event.offsetY; // 0=语音录制,1=转文字,2=取消 this.mode = getMode(offsetX, offsetY); this.updateStateByMode(); }) .onActionUpdate((event: GestureEvent) => { const offsetX = event.offsetX; const offsetY = event.offsetY; // 0=语音录制,1=转文字,2=取消 this.mode = getMode(offsetX, offsetY); this.updateStateByMode(); }) .onActionEnd(() => { this.doGestureEndBusiness(); }) ) .onCancel(() => { if (this.timeStart === Const.OPACITY_FALSE) { promptAction.showToast({ message: $r("app.string.voice_record_verify_too_short"), duration: 1000 }) return; } this.doGestureEndBusiness(); }) ) Image($r("app.media.voice_record_dynamic_effect_emoji")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Image($r("app.media.voice_record_dynamic_effect_add")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) } .justifyContent(FlexAlign.SpaceAround) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.integer.voice_record_dynamic_effect_height_row")) .backgroundColor($r("app.color.voice_record_dynamic_effect_color_row")) } .backgroundColor($r("app.color.voice_record_dynamic_effect_color_row")) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.string.voice_record_dynamic_effect_height_full")) if (this.flagUpOpacity === 1) { Column() { Row() { ButtonWithWaterRipples({ columnX: this.columnX, yMax: this.yMax, yMin: this.yMin, waterRipplesBg: this.waterRipplesBg, mode: this.mode }); } .justifyContent(FlexAlign.Center) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r('app.string.voice_record_water_height')) .margin({ bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) Row() { Column() { if (this.mode === VerifyModeEnum.CANCEL) { Text($r("app.string.voice_record_cancel_send")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .fontColor(Color.White) .textAlign(TextAlign.Center) .margin({ bottom: $r("app.integer.voice_record_message_margin") }) } Text('X') .fontSize($r("app.integer.voice_record_font_size_mode")) .fontColor(this.fontColorCancel) .textAlign(TextAlign.Center) .height(this.textSize) .width(this.textSize) .backgroundColor(this.backgroundCancel) .borderRadius($r("app.string.voice_record_border_radius_percent")) }.width($r('app.string.voice_record_height_mode')).justifyContent(FlexAlign.Center) Column() { if (this.mode === VerifyModeEnum.TEXT) { Text($r("app.string.voice_record_translate_word")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .fontColor(Color.White) .textAlign(TextAlign.Center) .margin({ bottom: $r("app.integer.voice_record_message_margin") }) } Text($r("app.string.voice_record_word")) .fontSize($r("app.integer.voice_record_font_size_mode")) .fontColor(this.fontColorWord) .textAlign(TextAlign.Center) .height(this.textSize) .width(this.textSize) .backgroundColor(this.backgroundWord) .borderRadius($r("app.string.voice_record_border_radius_percent")) }.width($r('app.string.voice_record_height_mode')).justifyContent(FlexAlign.Center) } .justifyContent(FlexAlign.SpaceAround) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r('app.string.voice_record_mode_height')) .margin({ bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) Row() { Text($r("app.string.voice_record_dynamic_effect_send_message")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .fontColor(this.fontColorVoice) } .justifyContent(FlexAlign.Center) .height(Const.HEIGHT_ST) .width($r('app.string.voice_record_dynamic_effect_width_full')) .borderRadius($r("app.integer.voice_record_dynamic_effect_radius_row")) .backgroundColor(this.backgroundVoice) } .justifyContent(FlexAlign.End) .backgroundColor($r("app.string.voice_record_dynamic_effect_color_stack")) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.string.voice_record_dynamic_effect_height_full")) } } .alignContent(Alignment.Bottom) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.string.voice_record_dynamic_effect_height_full")) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GestureGroupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bottomHeight : 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 @ State AST#decorator#Right messages : 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 Message 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 messageList AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right columnX : 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 Const AST#expression#Right . COLUMN_WIDTH AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // Column宽度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right yMax : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // Column高度最大值 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right yMin : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // Column高度最小值 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isListening : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right count : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right flagUpOpacity : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 上划取消字样透明度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right flagInfoOpacity : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 消息条透明度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right maxNumber : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // Column最大高度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right minNumber : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // Column最小高度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeStart : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 初始时间戳 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeEnd : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 结束时间戳 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right timeAv : 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 Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 手势持续时间 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right waterRipplesBg : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_water_ripples_bg" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right // 取消识别背景色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right backgroundCancel : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 取消识别字体颜色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fontColorCancel : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 识别文字背景色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right backgroundWord : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 识别文字字体颜色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fontColorWord : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 松开发送背景色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right backgroundVoice : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 松开发送字体颜色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fontColorVoice : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left textSize : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_verify_text_font_size" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right // 当前模式 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right mode : 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 VerifyModeEnum AST#expression#Right . VOICE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left avoidAreaType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 创建音频录制与播放实例 AST#property_declaration#Left AVRecord = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AudioRecorder 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 AVPlayer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AVPlayer 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 @ StorageLink ( AST#expression#Left 'avoidAreaBottomToModule' AST#expression#Right ) AST#decorator#Right avoidAreaBottomToModule : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left ListScroller 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 ListScroller 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#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 reqPermissionsFromUser AST#expression#Right AST#argument_list#Left ( AST#expression#Left permissions AST#expression#Right , AST#expression#Left context 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 window AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 window AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left avoidArea = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avoidAreaType 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomHeight 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avoidArea AST#expression#Right . bottomRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right //重置状态 AST#method_declaration#Left resetState 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 . backgroundCancel AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 . fontColorCancel 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundWord AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 . fontColorWord 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundVoice 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fontColorVoice AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#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 . waterRipplesBg AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_water_ripples_bg" AST#expression#Right ) AST#resource_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 . timeStart AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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 . timeEnd AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right //根据识别模式设置不同样式 AST#method_declaration#Left updateStateByMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . VOICE 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 this AST#expression#Right . backgroundVoice 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fontColorVoice AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#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 . waterRipplesBg AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_water_ripples_bg" AST#expression#Right ) AST#resource_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 . fontColorCancel 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundCancel AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 . fontColorWord 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundWord AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXT 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 this AST#expression#Right . fontColorWord AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#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 . backgroundWord 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . waterRipplesBg AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_water_ripples_bg" AST#expression#Right ) AST#resource_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 . fontColorCancel 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundCancel AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 . backgroundVoice AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 . fontColorVoice 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 } else AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . CANCEL 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 this AST#expression#Right . fontColorCancel AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#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 . backgroundCancel 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . waterRipplesBg AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_water_ripples_bg_over" AST#expression#Right ) AST#resource_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 . fontColorWord 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundWord AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 . backgroundVoice AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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 . fontColorVoice 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#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right //手势结束业务 AST#method_declaration#Left doGestureEndBusiness 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . VOICE 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 . timeEnd AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_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#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . ANIMATION_DURATION 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 this AST#expression#Right . timeAv AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeEnd AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . timeStart 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#variable_declaration#Left let AST#variable_declarator#Left messageId : 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#new_expression#Left new AST#expression#Left String AST#expression#Right AST#new_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 . messages 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#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 . messages AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageId 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sender AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . SENDER AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left avatar AST#property_name#Right : AST#expression#Left "app.media.voice_record_dynamic_effect_avatar_own" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content 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 String AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeAv AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left messageId : 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#new_expression#Left new AST#expression#Left String AST#expression#Right AST#new_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 . messages 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#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 . messages AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageId 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sender AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . SENDER AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left avatar AST#property_name#Right : AST#expression#Left "app.media.voice_record_dynamic_effect_avatar_own" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left 0 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 Const AST#expression#Right . VERIFY_TEXT 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#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetState 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 clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isListening AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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 . yMax AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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 . yMin AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right 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 . flagUpOpacity AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . VOICE 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 . flagInfoOpacity AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_TRUE 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#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 . AVRecord AST#member_expression#Right AST#expression#Right . stopRecordingProcess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 手势业务结束消息列表滚动到底部 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . BLANK_row 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#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . sender AST#member_expression#Right AST#expression#Right === AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . SENDER AST#member_expression#Right AST#expression#Right ) { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left MessageType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right ) { //文本消息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_font_size_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_message_margin" 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.voice_record_dynamic_effect_color_message" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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.voice_record_dynamic_effect_margin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.voice_record_dynamic_effect_margin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . COLUMN_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { //语音消息 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.voice_record_dynamic_effect_volume" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'voice_add_image' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" 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#member_expression#Left AST#expression#Left message AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_font_size_text" 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.integer.voice_record_message_margin" 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 . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . COLUMN_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( 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#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . COLUMN_WIDTH AST#member_expression#Right AST#expression#Right + AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . HEIGHT_MIN 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.voice_record_dynamic_effect_color_message" 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.voice_record_dynamic_effect_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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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.voice_record_dynamic_effect_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#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . AVPlayer AST#member_expression#Right AST#expression#Right . avPlayerUrlDemo 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right //头像 AST#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.voice_record_dynamic_effect_avatar_own" 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.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" 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 } else { //头像 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.voice_record_dynamic_effect_avatar_friend" 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.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //文本消息 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_font_size_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_message_margin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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.voice_record_dynamic_effect_margin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , 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.voice_record_dynamic_effect_margin" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . COLUMN_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_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 message AST#expression#Right . sender AST#member_expression#Right AST#expression#Right === AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . SENDER AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right : AST#expression#Left FlexAlign AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Start 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.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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.voice_record_dynamic_effect_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#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 Stack ( ) 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.voice_record_dynamic_effect_left" 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.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_dynamic_effect_friend" 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.voice_record_dynamic_effect_font_size_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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.voice_record_dynamic_effect_qmz0nuwq" 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.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" 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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.voice_record_dynamic_effect_color_all" 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 . SpaceBetween 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.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_padding_row" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_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 . messages AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_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 . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_width_full' 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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.voice_record_dynamic_effect_color_all" 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 . Start 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.voice_record_dynamic_effect_width_full' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //底部按钮行 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.voice_record_dynamic_effect_icon" 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.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" 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 Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_dynamic_effect_button" AST#expression#Right ) AST#resource_expression#Right 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 . Normal 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.voice_record_border_radio" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White 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.integer.voice_record_dynamic_effect_width_button" 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.voice_record_dynamic_effect_height_button" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . gesture ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left GestureGroup AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GestureMode AST#expression#Right . Sequence AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left LongPressGesture AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onAction 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 . mode AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left VerifyModeEnum AST#expression#Right . VOICE 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 . timeStart AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_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#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . ANIMATION_DURATION 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 this AST#expression#Right . flagInfoOpacity AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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 . isListening 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 . isListening 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 . flagUpOpacity AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_TRUE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . AVRecord AST#member_expression#Right AST#expression#Right . startRecordingProcess 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 // 每隔100ms获取一次振幅 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 . count AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval 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#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#member_expression#Left AST#expression#Left this AST#expression#Right . AVRecord AST#member_expression#Right AST#expression#Right . maxAmplitude AST#member_expression#Right AST#expression#Right > AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIN_AMPLITUDE 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 . maxNumber AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . AVRecord AST#member_expression#Right AST#expression#Right . maxAmplitude AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . MAX_AMPLITUDE AST#member_expression#Right AST#expression#Right * AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . COLUMN_HEIGHT AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxNumber AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxNumber AST#member_expression#Right AST#expression#Right >= AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 60 AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . maxNumber 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 . minNumber AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxNumber AST#member_expression#Right AST#expression#Right - AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . HEIGHT_MIN 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 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 . maxNumber AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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 . minNumber AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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 this AST#expression#Right . isListening 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 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 AST#member_expression#Left AST#expression#Left Const AST#expression#Right . ANIMATION_DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . 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 . yMax AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random 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 60 AST#expression#Right AST#binary_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 this AST#expression#Right . yMin AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random 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 20 AST#expression#Right AST#binary_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#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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . SET_INTERVAL_TIME 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#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flagInfoOpacity AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_TRUE 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 . yMax AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE 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 . yMin AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . OPACITY_FALSE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . AVRecord AST#member_expression#Right AST#expression#Right . stopRecordingProcess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , // 上划左边取消,右边转文字 AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left PanGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left direction AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PanDirection AST#expression#Right . Left AST#member_expression#Right AST#expression#Right | AST#expression#Left PanDirection AST#expression#Right AST#binary_expression#Right AST#expression#Right . Right AST#member_expression#Right AST#expression#Right | AST#expression#Left PanDirection AST#expression#Right AST#binary_expression#Right AST#expression#Right . Up AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left distance AST#property_name#Right : AST#expression#Left 50 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 . onActionStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left offsetX = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left offsetY = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 0=语音录制,1=转文字,2=取消 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 . mode AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getMode AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetX AST#expression#Right , AST#expression#Left offsetY 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 . updateStateByMode 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 . onActionUpdate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left offsetX = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left offsetY = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 0=语音录制,1=转文字,2=取消 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 . mode AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getMode AST#expression#Right AST#argument_list#Left ( AST#expression#Left offsetX AST#expression#Right , AST#expression#Left offsetY 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 . updateStateByMode 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 . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . doGestureEndBusiness 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#argument_list#Right AST#call_expression#Right AST#expression#Right . onCancel 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timeStart AST#member_expression#Right AST#expression#Right === AST#expression#Left Const AST#expression#Right AST#binary_expression#Right AST#expression#Right . OPACITY_FALSE 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 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.voice_record_verify_too_short" 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 1000 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . doGestureEndBusiness 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#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.voice_record_dynamic_effect_emoji" 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.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" 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.voice_record_dynamic_effect_add" 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.voice_record_dynamic_effect_width_image" 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.voice_record_dynamic_effect_height_image" 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 . 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 . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_height_row" 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.voice_record_dynamic_effect_color_row" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.voice_record_dynamic_effect_color_row" 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.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_height_full" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flagUpOpacity AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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#ui_custom_component_statement#Left ButtonWithWaterRipples ( AST#component_parameters#Left { AST#component_parameter#Left columnX : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . columnX AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left yMax : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . yMax AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left yMin : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . yMin AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left waterRipplesBg : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . waterRipplesBg AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left mode : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.voice_record_dynamic_effect_width_full' 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.voice_record_water_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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 { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . CANCEL AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_cancel_send" 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.voice_record_dynamic_effect_font_size_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_message_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#ui_if_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'X' 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.voice_record_font_size_mode" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fontColorCancel AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundCancel AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_border_radius_percent" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.voice_record_height_mode' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mode AST#member_expression#Right AST#expression#Right === AST#expression#Left VerifyModeEnum AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_translate_word" 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.voice_record_dynamic_effect_font_size_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_message_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#ui_if_statement#Right AST#ui_control_flow#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.voice_record_word" 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.voice_record_font_size_mode" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fontColorWord AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundWord AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.voice_record_border_radius_percent" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.voice_record_height_mode' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround 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.voice_record_dynamic_effect_width_full' 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.voice_record_mode_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.voice_record_dynamic_effect_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 { 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.voice_record_dynamic_effect_send_message" 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.voice_record_dynamic_effect_font_size_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fontColorVoice 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 . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . HEIGHT_ST 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.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_radius_row" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundVoice 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . End 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.string.voice_record_dynamic_effect_color_stack" 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.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_height_full" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Bottom 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.voice_record_dynamic_effect_width_full' 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.voice_record_dynamic_effect_height_full" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct GestureGroupExample { @State bottomHeight: number = 0; @State messages: Array<Message> = messageList; @State columnX: number = Const.COLUMN_WIDTH; @State yMax: number = Const.OPACITY_FALSE; @State yMin: number = Const.OPACITY_FALSE; @State isListening: boolean = false; @State count: number = Const.OPACITY_FALSE; @State flagUpOpacity: number = Const.OPACITY_FALSE; @State flagInfoOpacity: number = Const.OPACITY_FALSE; @State maxNumber: number = Const.OPACITY_FALSE; @State minNumber: number = Const.OPACITY_FALSE; @State timeStart: number = Const.OPACITY_FALSE; @State timeEnd: number = Const.OPACITY_FALSE; @State timeAv: number = Const.OPACITY_FALSE; @State waterRipplesBg: Resource = $r("app.string.voice_record_water_ripples_bg"); @State backgroundCancel: Color = Color.Gray; @State fontColorCancel: Color = Color.White; @State backgroundWord: Color = Color.Gray; @State fontColorWord: Color = Color.White; @State backgroundVoice: Color = Color.White; @State fontColorVoice: Color = Color.Black; textSize: Resource = $r("app.integer.voice_record_verify_text_font_size"); @State mode: number = VerifyModeEnum.VOICE; avoidAreaType: number = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; AVRecord = new AudioRecorder(); AVPlayer = new AVPlayer(); @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; private scroller: ListScroller = new ListScroller(); aboutToAppear() { const context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; reqPermissionsFromUser(permissions, context); window.getLastWindow(getContext(this)).then((window) => { const avoidArea = window.getWindowAvoidArea(this.avoidAreaType); this.bottomHeight = px2vp(avoidArea.bottomRect.height); }); } resetState(): void { this.backgroundCancel = Color.Gray; this.fontColorCancel = Color.White; this.backgroundWord = Color.Gray; this.fontColorWord = Color.White; this.backgroundVoice = Color.White; this.fontColorVoice = Color.Black; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg"); this.timeStart = Const.OPACITY_FALSE; this.timeEnd = Const.OPACITY_FALSE; } updateStateByMode(): void { if (this.mode === VerifyModeEnum.VOICE) { this.backgroundVoice = Color.White; this.fontColorVoice = Color.Black; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg"); this.fontColorCancel = Color.White; this.backgroundCancel = Color.Gray; this.fontColorWord = Color.White; this.backgroundWord = Color.Gray; } else if (this.mode === VerifyModeEnum.TEXT) { this.fontColorWord = Color.Black; this.backgroundWord = Color.White; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg"); this.fontColorCancel = Color.White; this.backgroundCancel = Color.Gray; this.backgroundVoice = Color.Gray; this.fontColorVoice = Color.White; } else if (this.mode === VerifyModeEnum.CANCEL) { this.fontColorCancel = Color.Black; this.backgroundCancel = Color.White; this.waterRipplesBg = $r("app.string.voice_record_water_ripples_bg_over"); this.fontColorWord = Color.White; this.backgroundWord = Color.Gray; this.backgroundVoice = Color.Gray; this.fontColorVoice = Color.White; } } doGestureEndBusiness(): void { if (this.mode === VerifyModeEnum.VOICE) { this.timeEnd = Math.floor(new Date().getTime() / Const.ANIMATION_DURATION); this.timeAv = this.timeEnd - this.timeStart; let messageId: String = new String(this.messages.length + 1); this.messages.push({ id: messageId.toString(), sender: Const.SENDER, avatar: "app.media.voice_record_dynamic_effect_avatar_own", type: 1, content: new String(this.timeAv).toString() }) } else if (this.mode === VerifyModeEnum.TEXT) { let messageId: String = new String(this.messages.length + 1); this.messages.push({ id: messageId.toString(), sender: Const.SENDER, avatar: "app.media.voice_record_dynamic_effect_avatar_own", type: 0, content: Const.VERIFY_TEXT }) } this.resetState(); clearInterval(this.count); this.isListening = false; animateTo({ duration: Const.OPACITY_FALSE }, () => { this.yMax = Const.OPACITY_FALSE; this.yMin = Const.OPACITY_FALSE; }) this.flagUpOpacity = Const.OPACITY_FALSE; if (this.mode === VerifyModeEnum.VOICE) { this.flagInfoOpacity = Const.OPACITY_TRUE; } this.AVRecord.stopRecordingProcess(); this.scroller.scrollEdge(Edge.Bottom); } @Builder buildMessage(message: Message) { Row({ space: Const.BLANK_row }) { if (message.sender === Const.SENDER) { if (message.type === MessageType.TEXT) { Text(message.content) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .textAlign(TextAlign.Center) .margin($r("app.integer.voice_record_message_margin")) .backgroundColor($r("app.color.voice_record_dynamic_effect_color_message")) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin"), top: $r("app.integer.voice_record_dynamic_effect_margin"), bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) .borderRadius(Const.COLUMN_WIDTH) } else { Row() { Image($r("app.media.voice_record_dynamic_effect_volume")) .id('voice_add_image') .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Text(message.content) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .margin($r("app.integer.voice_record_message_margin")) } .borderRadius(Const.COLUMN_WIDTH) .justifyContent(FlexAlign.End) .width(Number(message.content) * Const.COLUMN_WIDTH + Const.HEIGHT_MIN) .backgroundColor($r("app.color.voice_record_dynamic_effect_color_message")) .margin({ top: $r('app.integer.voice_record_dynamic_effect_margin_top') }) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin") }) .onClick(() => { this.AVPlayer.avPlayerUrlDemo(); }) } Image($r("app.media.voice_record_dynamic_effect_avatar_own")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) } else { Image($r("app.media.voice_record_dynamic_effect_avatar_friend")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Text(message.content) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .textAlign(TextAlign.Center) .margin($r("app.integer.voice_record_message_margin")) .backgroundColor(Color.White) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin"), top: $r("app.integer.voice_record_dynamic_effect_margin"), bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) .borderRadius(Const.COLUMN_WIDTH) } } .justifyContent(message.sender === Const.SENDER ? FlexAlign.End : FlexAlign.Start) .width($r('app.string.voice_record_dynamic_effect_width_full')) .margin({ top: $r('app.integer.voice_record_dynamic_effect_margin_top') }) .padding({ left: $r("app.integer.voice_record_dynamic_effect_margin"), right: $r("app.integer.voice_record_dynamic_effect_margin") }) } build() { Stack() { Column() { Row() { Image($r("app.media.voice_record_dynamic_effect_left")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Text($r("app.string.voice_record_dynamic_effect_friend")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .textAlign(TextAlign.Center) Image($r("app.media.voice_record_dynamic_effect_qmz0nuwq")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) } .backgroundColor($r("app.color.voice_record_dynamic_effect_color_all")) .justifyContent(FlexAlign.SpaceBetween) .width($r('app.string.voice_record_dynamic_effect_width_full')) .padding($r("app.integer.voice_record_dynamic_effect_padding_row")) Column() { List({ scroller: this.scroller }) { ForEach(this.messages, (item: Message) => { ListItem() { this.buildMessage(item) } }, (item: Message) => item.id) } .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r('app.string.voice_record_dynamic_effect_width_full')) } .backgroundColor($r("app.color.voice_record_dynamic_effect_color_all")) .justifyContent(FlexAlign.Start) .width($r('app.string.voice_record_dynamic_effect_width_full')) .layoutWeight(1) Row() { Image($r("app.media.voice_record_dynamic_effect_icon")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Button($r("app.string.voice_record_dynamic_effect_button")) .type(ButtonType.Normal) .borderRadius($r("app.integer.voice_record_border_radio")) .backgroundColor(Color.White) .width($r("app.integer.voice_record_dynamic_effect_width_button")) .height($r("app.integer.voice_record_dynamic_effect_height_button")) .fontColor(Color.Black) .gesture( GestureGroup(GestureMode.Sequence, LongPressGesture() .onAction(() => { this.mode = VerifyModeEnum.VOICE; this.timeStart = Math.floor(new Date().getTime() / Const.ANIMATION_DURATION); this.flagInfoOpacity = Const.OPACITY_FALSE; this.isListening = !this.isListening; this.flagUpOpacity = Const.OPACITY_TRUE; this.AVRecord.startRecordingProcess(); this.count = setInterval(() => { if (this.AVRecord.maxAmplitude > Const.MIN_AMPLITUDE) { this.maxNumber = (this.AVRecord.maxAmplitude) / Const.MAX_AMPLITUDE * Const.COLUMN_HEIGHT; this.maxNumber = this.maxNumber >= 60 ? 60 : this.maxNumber; this.minNumber = this.maxNumber - Const.HEIGHT_MIN; } else { this.maxNumber = Const.OPACITY_FALSE; this.minNumber = Const.OPACITY_FALSE; } if (this.isListening) { animateTo({ duration: Const.ANIMATION_DURATION, curve: Curve.EaseInOut }, () => { this.yMax = Math.round(Math.random() * 60); this.yMin = Math.round(Math.random() * 20); }) } }, Const.SET_INTERVAL_TIME); }) .onActionEnd(() => { clearInterval(this.count); this.flagInfoOpacity = Const.OPACITY_TRUE; this.yMax = Const.OPACITY_FALSE; this.yMin = Const.OPACITY_FALSE; this.AVRecord.stopRecordingProcess(); }), PanGesture({ direction: PanDirection.Left | PanDirection.Right | PanDirection.Up, distance: 50 }) .onActionStart((event: GestureEvent) => { const offsetX = event.offsetX; const offsetY = event.offsetY; this.mode = getMode(offsetX, offsetY); this.updateStateByMode(); }) .onActionUpdate((event: GestureEvent) => { const offsetX = event.offsetX; const offsetY = event.offsetY; this.mode = getMode(offsetX, offsetY); this.updateStateByMode(); }) .onActionEnd(() => { this.doGestureEndBusiness(); }) ) .onCancel(() => { if (this.timeStart === Const.OPACITY_FALSE) { promptAction.showToast({ message: $r("app.string.voice_record_verify_too_short"), duration: 1000 }) return; } this.doGestureEndBusiness(); }) ) Image($r("app.media.voice_record_dynamic_effect_emoji")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) Image($r("app.media.voice_record_dynamic_effect_add")) .width($r("app.integer.voice_record_dynamic_effect_width_image")) .height($r("app.integer.voice_record_dynamic_effect_height_image")) } .justifyContent(FlexAlign.SpaceAround) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.integer.voice_record_dynamic_effect_height_row")) .backgroundColor($r("app.color.voice_record_dynamic_effect_color_row")) } .backgroundColor($r("app.color.voice_record_dynamic_effect_color_row")) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.string.voice_record_dynamic_effect_height_full")) if (this.flagUpOpacity === 1) { Column() { Row() { ButtonWithWaterRipples({ columnX: this.columnX, yMax: this.yMax, yMin: this.yMin, waterRipplesBg: this.waterRipplesBg, mode: this.mode }); } .justifyContent(FlexAlign.Center) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r('app.string.voice_record_water_height')) .margin({ bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) Row() { Column() { if (this.mode === VerifyModeEnum.CANCEL) { Text($r("app.string.voice_record_cancel_send")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .fontColor(Color.White) .textAlign(TextAlign.Center) .margin({ bottom: $r("app.integer.voice_record_message_margin") }) } Text('X') .fontSize($r("app.integer.voice_record_font_size_mode")) .fontColor(this.fontColorCancel) .textAlign(TextAlign.Center) .height(this.textSize) .width(this.textSize) .backgroundColor(this.backgroundCancel) .borderRadius($r("app.string.voice_record_border_radius_percent")) }.width($r('app.string.voice_record_height_mode')).justifyContent(FlexAlign.Center) Column() { if (this.mode === VerifyModeEnum.TEXT) { Text($r("app.string.voice_record_translate_word")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .fontColor(Color.White) .textAlign(TextAlign.Center) .margin({ bottom: $r("app.integer.voice_record_message_margin") }) } Text($r("app.string.voice_record_word")) .fontSize($r("app.integer.voice_record_font_size_mode")) .fontColor(this.fontColorWord) .textAlign(TextAlign.Center) .height(this.textSize) .width(this.textSize) .backgroundColor(this.backgroundWord) .borderRadius($r("app.string.voice_record_border_radius_percent")) }.width($r('app.string.voice_record_height_mode')).justifyContent(FlexAlign.Center) } .justifyContent(FlexAlign.SpaceAround) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r('app.string.voice_record_mode_height')) .margin({ bottom: $r("app.integer.voice_record_dynamic_effect_margin") }) Row() { Text($r("app.string.voice_record_dynamic_effect_send_message")) .fontSize($r("app.integer.voice_record_dynamic_effect_font_size_text")) .fontColor(this.fontColorVoice) } .justifyContent(FlexAlign.Center) .height(Const.HEIGHT_ST) .width($r('app.string.voice_record_dynamic_effect_width_full')) .borderRadius($r("app.integer.voice_record_dynamic_effect_radius_row")) .backgroundColor(this.backgroundVoice) } .justifyContent(FlexAlign.End) .backgroundColor($r("app.string.voice_record_dynamic_effect_color_stack")) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.string.voice_record_dynamic_effect_height_full")) } } .alignContent(Alignment.Bottom) .width($r('app.string.voice_record_dynamic_effect_width_full')) .height($r("app.string.voice_record_dynamic_effect_height_full")) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets#L43-L460
4c1ddfbb0a70376ee183a2d9a1672acf81a3f298
gitee
WinWang/HarmoneyOpenEye.git
57f0542795336009aa0d46fd9fa5b07facc2ae87
entry/src/main/ets/utils/DialogUtils.ets
arkts
展示loading @param tips
export function showLoadingDialog(tips: string = "加载中") { emitter.emit(loadingEvent, LoadingDialogEvent(true, tips)) }
AST#export_declaration#Left export AST#function_declaration#Left function showLoadingDialog AST#parameter_list#Left ( AST#parameter#Left tips : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "加载中" AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#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 emitter AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left loadingEvent AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left LoadingDialogEvent 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 tips 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#function_declaration#Right AST#export_declaration#Right
export function showLoadingDialog(tips: string = "加载中") { emitter.emit(loadingEvent, LoadingDialogEvent(true, tips)) }
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/utils/DialogUtils.ets#L9-L11
df0bc07394f800059637d8764bc77eb2f55536b3
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/viewmodel/SongData.ets
arkts
Music information entity class.
export class SongItem { /** * Primary key ID. */ id: number = 0; /** * Music name. */ title: string = ''; /** * Music author name. */ singer: string = ''; /** * Music logo information. */ mark: Resource = $r('app.string.page_show'); /** * Music avatar information. */ label: Resource = $r('app.string.page_show'); /** * Music file path information. */ src: string = ''; /** * Index of the current music list. */ index: number = 0; /** * Lyric file path information. */ lyric: string = ''; }
AST#export_declaration#Left export AST#class_declaration#Left class SongItem AST#class_body#Left { /** * Primary key ID. */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /** * Music name. */ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right /** * Music author name. */ AST#property_declaration#Left singer : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right /** * Music logo information. */ AST#property_declaration#Left mark : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.page_show' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * Music avatar information. */ AST#property_declaration#Left label : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.page_show' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * Music file path information. */ AST#property_declaration#Left src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right /** * Index of the current music list. */ AST#property_declaration#Left index : 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 /** * Lyric file path information. */ AST#property_declaration#Left lyric : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class SongItem { id: number = 0; title: string = ''; singer: string = ''; mark: Resource = $r('app.string.page_show'); label: Resource = $r('app.string.page_show'); src: string = ''; index: number = 0; lyric: string = ''; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/viewmodel/SongData.ets#L19-L59
8570f5592be13ad32377dbb7138aa00e1d1e688b
github
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/views/dialog/BuiCustomDialog.ets
arkts
empty
作为全局弹窗组件封装 内容完全由外部slot定义
@Builder function empty(){}
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function empty AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#decorated_function_declaration#Right
@Builder function empty(){}
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/views/dialog/BuiCustomDialog.ets#L5-L5
cedb5f71812ce3d99eb91e42f78ff8f49977e6d0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/DatabaseService.ets
arkts
createTables
创建数据表
private async createTables(): Promise<void> { try { // 创建联系人表 const createContactsTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_CONTACTS} ( id TEXT PRIMARY KEY, name TEXT NOT NULL, avatar TEXT, phone TEXT, email TEXT, relation TEXT NOT NULL, gender TEXT, tags TEXT, notes TEXT, birthday_date TEXT NOT NULL, birthday_is_lunar INTEGER NOT NULL DEFAULT 0, birthday_lunar_date TEXT, birthday_year INTEGER, birthday_month INTEGER, birthday_day INTEGER, birthday_age INTEGER, birthday_next_birthday TEXT, birthday_days_until_birthday INTEGER, intimacy_level INTEGER DEFAULT 3, is_favorite INTEGER DEFAULT 0, last_contact_date TEXT, interests TEXT, dislikes TEXT, favorite_foods TEXT, taboos TEXT, occupation TEXT, company TEXT, department TEXT, position TEXT, address TEXT, social_media TEXT, custom_attributes TEXT, created_at TEXT NOT NULL, updated_at TEXT NOT NULL ) `; // 创建祝福语表 const createGreetingsTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_GREETINGS} ( id TEXT PRIMARY KEY, content TEXT NOT NULL, style TEXT NOT NULL, occasion TEXT NOT NULL, language TEXT DEFAULT 'zh_CN', tags TEXT, is_custom INTEGER DEFAULT 0, usage_count INTEGER DEFAULT 0, rating REAL DEFAULT 0, created_at TEXT NOT NULL, updated_at TEXT ) `; // 创建祝福语历史表 const createGreetingHistoryTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_GREETING_HISTORY} ( id TEXT PRIMARY KEY, contact_id TEXT NOT NULL, greeting_id TEXT, content TEXT NOT NULL, occasion TEXT NOT NULL, style TEXT NOT NULL, method TEXT NOT NULL, status TEXT DEFAULT 'draft', sent_at TEXT, metadata TEXT, created_at TEXT NOT NULL, FOREIGN KEY (contact_id) REFERENCES ${StorageConstants.TABLE_CONTACTS} (id) ON DELETE CASCADE ) `; // 创建操作日志表 const createOperationLogsTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_OPERATION_LOGS} ( id TEXT PRIMARY KEY, type TEXT NOT NULL, contact_id TEXT, contact_ids TEXT, old_data TEXT, new_data TEXT, timestamp TEXT NOT NULL, operator TEXT, description TEXT ) `; await this.store!.executeSql(createContactsTableSql); await this.store!.executeSql(createGreetingsTableSql); await this.store!.executeSql(createGreetingHistoryTableSql); await this.store!.executeSql(createOperationLogsTableSql); // 创建索引 await this.createIndexes(); hilog.info(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, 'Database tables created successfully'); } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, `Failed to create tables: ${businessError.message}`); throw new Error(businessError.message); } }
AST#method_declaration#Left private async createTables AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 创建联系人表 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left createContactsTableSql = AST#expression#Left AST#template_literal#Left ` CREATE TABLE IF NOT EXISTS AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_CONTACTS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( id TEXT PRIMARY KEY, name TEXT NOT NULL, avatar TEXT, phone TEXT, email TEXT, relation TEXT NOT NULL, gender TEXT, tags TEXT, notes TEXT, birthday_date TEXT NOT NULL, birthday_is_lunar INTEGER NOT NULL DEFAULT 0, birthday_lunar_date TEXT, birthday_year INTEGER, birthday_month INTEGER, birthday_day INTEGER, birthday_age INTEGER, birthday_next_birthday TEXT, birthday_days_until_birthday INTEGER, intimacy_level INTEGER DEFAULT 3, is_favorite INTEGER DEFAULT 0, last_contact_date TEXT, interests TEXT, dislikes TEXT, favorite_foods TEXT, taboos TEXT, occupation TEXT, company TEXT, department TEXT, position TEXT, address TEXT, social_media TEXT, custom_attributes TEXT, created_at TEXT NOT NULL, updated_at TEXT NOT NULL ) ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 创建祝福语表 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left createGreetingsTableSql = AST#expression#Left AST#template_literal#Left ` CREATE TABLE IF NOT EXISTS AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_GREETINGS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( id TEXT PRIMARY KEY, content TEXT NOT NULL, style TEXT NOT NULL, occasion TEXT NOT NULL, language TEXT DEFAULT 'zh_CN', tags TEXT, is_custom INTEGER DEFAULT 0, usage_count INTEGER DEFAULT 0, rating REAL DEFAULT 0, created_at TEXT NOT NULL, updated_at TEXT ) ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 创建祝福语历史表 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left createGreetingHistoryTableSql = AST#expression#Left AST#template_literal#Left ` CREATE TABLE IF NOT EXISTS AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_GREETING_HISTORY AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( id TEXT PRIMARY KEY, contact_id TEXT NOT NULL, greeting_id TEXT, content TEXT NOT NULL, occasion TEXT NOT NULL, style TEXT NOT NULL, method TEXT NOT NULL, status TEXT DEFAULT 'draft', sent_at TEXT, metadata TEXT, created_at TEXT NOT NULL, FOREIGN KEY (contact_id) REFERENCES AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_CONTACTS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right (id) ON DELETE CASCADE ) ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 创建操作日志表 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left createOperationLogsTableSql = AST#expression#Left AST#template_literal#Left ` CREATE TABLE IF NOT EXISTS AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left StorageConstants AST#expression#Right . TABLE_OPERATION_LOGS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( id TEXT PRIMARY KEY, type TEXT NOT NULL, contact_id TEXT, contact_ids TEXT, old_data TEXT, new_data TEXT, timestamp TEXT NOT NULL, operator TEXT, description TEXT ) ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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 . store AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left createContactsTableSql 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#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 . store AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left createGreetingsTableSql 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#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 . store AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left createGreetingHistoryTableSql 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#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 . store AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . executeSql AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left createOperationLogsTableSql 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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . createIndexes 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 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_DATABASE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_DATABASE AST#member_expression#Right AST#expression#Right , AST#expression#Left 'Database tables created successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( 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_DATABASE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_DATABASE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to create tables: 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#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#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) 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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async createTables(): Promise<void> { try { const createContactsTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_CONTACTS} ( id TEXT PRIMARY KEY, name TEXT NOT NULL, avatar TEXT, phone TEXT, email TEXT, relation TEXT NOT NULL, gender TEXT, tags TEXT, notes TEXT, birthday_date TEXT NOT NULL, birthday_is_lunar INTEGER NOT NULL DEFAULT 0, birthday_lunar_date TEXT, birthday_year INTEGER, birthday_month INTEGER, birthday_day INTEGER, birthday_age INTEGER, birthday_next_birthday TEXT, birthday_days_until_birthday INTEGER, intimacy_level INTEGER DEFAULT 3, is_favorite INTEGER DEFAULT 0, last_contact_date TEXT, interests TEXT, dislikes TEXT, favorite_foods TEXT, taboos TEXT, occupation TEXT, company TEXT, department TEXT, position TEXT, address TEXT, social_media TEXT, custom_attributes TEXT, created_at TEXT NOT NULL, updated_at TEXT NOT NULL ) `; const createGreetingsTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_GREETINGS} ( id TEXT PRIMARY KEY, content TEXT NOT NULL, style TEXT NOT NULL, occasion TEXT NOT NULL, language TEXT DEFAULT 'zh_CN', tags TEXT, is_custom INTEGER DEFAULT 0, usage_count INTEGER DEFAULT 0, rating REAL DEFAULT 0, created_at TEXT NOT NULL, updated_at TEXT ) `; const createGreetingHistoryTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_GREETING_HISTORY} ( id TEXT PRIMARY KEY, contact_id TEXT NOT NULL, greeting_id TEXT, content TEXT NOT NULL, occasion TEXT NOT NULL, style TEXT NOT NULL, method TEXT NOT NULL, status TEXT DEFAULT 'draft', sent_at TEXT, metadata TEXT, created_at TEXT NOT NULL, FOREIGN KEY (contact_id) REFERENCES ${StorageConstants.TABLE_CONTACTS} (id) ON DELETE CASCADE ) `; const createOperationLogsTableSql = ` CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_OPERATION_LOGS} ( id TEXT PRIMARY KEY, type TEXT NOT NULL, contact_id TEXT, contact_ids TEXT, old_data TEXT, new_data TEXT, timestamp TEXT NOT NULL, operator TEXT, description TEXT ) `; await this.store!.executeSql(createContactsTableSql); await this.store!.executeSql(createGreetingsTableSql); await this.store!.executeSql(createGreetingHistoryTableSql); await this.store!.executeSql(createOperationLogsTableSql); await this.createIndexes(); hilog.info(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, 'Database tables created successfully'); } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_DATABASE, LogConstants.TAG_DATABASE, `Failed to create tables: ${businessError.message}`); throw new Error(businessError.message); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L60-L166
276f25b07dddb2cd734ac956c40a3040d4d38823
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppConstants.ets
arkts
应用常量配置 对应Kotlin的object AppConstants
export class AppConstants { // 应用程序文档根目录名称 private static readonly APP_DOCUMENT: string = "app_Document"; private static readonly APP_DATABASE: string = "app_Database";//必须是rdb开头的目录 //应用程序Database目录 private static readonly APP_RDB: string = "rdb";//必须是rdb开头的目录 /** * 获取应用文档根目录路径(以斜杠结尾) * 对应Kotlin的val basePath: String * @returns string 路径字符串,格式如 "/data/app/el2/100/base/com.example/app_Document/" */ static get docBasePath(): string { const context = getAppContext() // HarmonyOS的目录结构不同,使用filesDir作为基础路径 return `${context.filesDir}/${this.APP_DOCUMENT}/`; } ///返回应用的所有sqlite的主目录 ../entry/rdb/app_Database/ static get dataBasePath(): string { // HarmonyOS的目录结构不同,使用databaseDir作为基础路径 return `${this.rdbPath}${this.APP_DATABASE}/`;// } ///返回固定的rdb路径../entry/rdb/ static get rdbPath(): string { const context = getAppContext() // HarmonyOS的目录结构不同,使用databaseDir作为基础路径 return `${context.databaseDir}/${this.APP_RDB}/`; } }
AST#export_declaration#Left export AST#class_declaration#Left class AppConstants AST#class_body#Left { // 应用程序文档根目录名称 AST#property_declaration#Left private static readonly APP_DOCUMENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "app_Document" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private static readonly APP_DATABASE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "app_Database" AST#expression#Right ; AST#property_declaration#Right //必须是rdb开头的目录 //应用程序Database目录 AST#property_declaration#Left private static readonly APP_RDB : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "rdb" AST#expression#Right ; AST#property_declaration#Right //必须是rdb开头的目录 /** * 获取应用文档根目录路径(以斜杠结尾) * 对应Kotlin的val basePath: String * @returns string 路径字符串,格式如 "/data/app/el2/100/base/com.example/app_Document/" */ AST#method_declaration#Left static get AST#ERROR#Left docB as ePath 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = 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#variable_declarator#Right // HarmonyOS的目录结构不同,使用filesDir作为基础路径 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . APP_DOCUMENT AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right ///返回应用的所有sqlite的主目录 ../entry/rdb/app_Database/ AST#method_declaration#Left static get AST#ERROR#Left dataB as ePath 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#block_statement#Left { // HarmonyOS的目录结构不同,使用databaseDir作为基础路径 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbPath AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . APP_DATABASE AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // } AST#block_statement#Right AST#method_declaration#Right ///返回固定的rdb路径../entry/rdb/ AST#method_declaration#Left static get AST#ERROR#Left rdbPath 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = 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#variable_declarator#Right // HarmonyOS的目录结构不同,使用databaseDir作为基础路径 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . databaseDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . APP_RDB AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class AppConstants { private static readonly APP_DOCUMENT: string = "app_Document"; private static readonly APP_DATABASE: string = "app_Database"; private static readonly APP_RDB: string = "rdb"; static get docBasePath(): string { const context = getAppContext() return `${context.filesDir}/${this.APP_DOCUMENT}/`; } static get dataBasePath(): string { return `${this.rdbPath}${this.APP_DATABASE}/`; } /返回固定的rdb路径../entry/rdb/ static get rdbPath(): string { const context = getAppContext() return `${context.databaseDir}/${this.APP_RDB}/`; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppConstants.ets#L10-L43
43d73ff25a2c3b06da50afb754a37551d7486c53
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets
arkts
pushData
增加数据 @param data
public pushData(data: T): void { this.originDataArray.push(data); this.notifyDataAdd(this.originDataArray.length - 1); }
AST#method_declaration#Left public pushData 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#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 . originDataArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_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 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 . originDataArray 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#builder_function_body#Right AST#method_declaration#Right
public pushData(data: T): void { this.originDataArray.push(data); this.notifyDataAdd(this.originDataArray.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L71-L74
482f362e20d2948beeab559504b0bd8ea5f20c75
gitee