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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/book/CategoryManager.ets | arkts | loadCategoriesWithCallback | 向后兼容的回调方式 | loadCategoriesWithCallback(
callback?: (categories: Category[]) => void
): void {
this.loadCategories()
.then(categories => callback?.(categories))
.catch((error: Error | string) => {
console.error("加载分类数据时出错:", error);
callback?.([]);
});
} | AST#method_declaration#Left loadCategoriesWithCallback AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left categories : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right ... | loadCategoriesWithCallback(
callback?: (categories: Category[]) => void
): void {
this.loadCategories()
.then(categories => callback?.(categories))
.catch((error: Error | string) => {
console.error("加载分类数据时出错:", error);
callback?.([]);
});
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/book/CategoryManager.ets#L85-L94 | 33e378367dc458cf4119456ec8a8da0ab9288088 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | unregisterAnim | 取消注册路由转场动画
@param modifier | public unregisterAnim(component: object): void {
NavAnimationStore.getInstance().unregisterAnim(component)
} | AST#method_declaration#Left public unregisterAnim AST#parameter_list#Left ( AST#parameter#Left component : 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 void AST#prima... | public unregisterAnim(component: object): void {
NavAnimationStore.getInstance().unregisterAnim(component)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L102-L104 | 1c6f494bcf59f0f503b91f592b58b28996cd2fbd | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | getFormattedTotalCompensation | 格式化总包薪资显示 | getFormattedTotalCompensation(): string {
const total = this.getTotalCompensation();
if (total > 0) {
return `${total.toFixed(1)}万/年`;
}
return '面议';
} | AST#method_declaration#Left getFormattedTotalCompensation 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_declarato... | getFormattedTotalCompensation(): string {
const total = this.getTotalCompensation();
if (total > 0) {
return `${total.toFixed(1)}万/年`;
}
return '面议';
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L183-L189 | c10426f653b95483a6595b1cb4b0a6930af9a2f3 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/ComponentBase.ets | arkts | setTextColor | Sets the text color to use for the labels. Make sure to use
getResources().getColor(...) when using a color from the resources.
@param color | public setTextColor(color: string | number | CanvasGradient | CanvasPattern): void {
this.mTextColor = color;
} | AST#method_declaration#Left public setTextColor AST#parameter_list#Left ( AST#parameter#Left color : 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 CanvasGradient AST#primary_type#Right | AST#... | public setTextColor(color: string | number | CanvasGradient | CanvasPattern): void {
this.mTextColor = color;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L150-L152 | 5effeaa968b4068ed299e522bf36572cb06d6ec5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | detectFromPhotoPicker | 打开系统相册,选择照片进行二维码识别
@returns {string} | async detectFromPhotoPicker(): Promise<string> {
const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
const photoViewPicker = new photoAccessHelper.PhotoViewPicker();
... | AST#method_declaration#Left async detectFromPhotoPicker 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 string AST#primary_type#Right AST#type_annotation#Right > A... | async detectFromPhotoPicker(): Promise<string> {
const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
const photoViewPicker = new photoAccessHelper.PhotoViewPicker();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L430-L464 | e98e1564a8f01a649c3b74f7c2e524314aadbd35 | gitee |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets | arkts | getUsingCache | Getter and setter for usingCache | getUsingCache(): boolean | undefined {
return this.usingCache;
} | AST#method_declaration#Left getUsingCache AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#L... | getUsingCache(): boolean | undefined {
return this.usingCache;
} | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L56-L58 | e05f4f3c3779512f2ba25715f7e090cf0052b839 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | Constants
Returns the number of total buttons available in the title bar. (Excluding Extensions block)
@returns 12. | export function default_title_function_buttons_amount(): number {
return 12;
} | AST#export_declaration#Left export AST#function_declaration#Left function default_title_function_buttons_amount 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#... | export function default_title_function_buttons_amount(): number {
return 12;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L167-L169 | 4e55be609bd0620091de870754ffd431f0f36635 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/AudioPlayer/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | AVPlayer state. | export enum PlayerState {
IDLE = -1,
INITIALIZED = 1
} | AST#export_declaration#Left export AST#enum_declaration#Left enum PlayerState AST#enum_body#Left { AST#enum_member#Left IDLE = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#enum_member#Right , AST#enum_member#Left INITIALIZ... | export enum PlayerState {
IDLE = -1,
INITIALIZED = 1
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L203-L206 | f24b663930a50023c21ad5a5516eccfc574c499b | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets | arkts | getPriorityColor | 获取优先级对应的颜色 | getPriorityColor(priority: number): Resource {
switch (priority) {
case 1:
return $r('app.color.priority_highest');
case 2:
return $r('app.color.priority_high');
case 3:
return $r('app.color.priority_medium');
case 4:
return $r('app.color.priority_low');
... | AST#method_declaration#Left getPriorityColor AST#parameter_list#Left ( AST#parameter#Left priority : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary... | getPriorityColor(priority: number): Resource {
switch (priority) {
case 1:
return $r('app.color.priority_highest');
case 2:
return $r('app.color.priority_high');
case 3:
return $r('app.color.priority_medium');
case 4:
return $r('app.color.priority_low');
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskProgressPage.ets#L580-L595 | 374fb370390d135c12194ce7f220c8214499e536 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | searchTasks | 搜索任务 | searchTasks(keyword: string): TaskItem[] {
const lowerKeyword = keyword.toLowerCase();
return this.tasks.filter(task => {
return task.title.toLowerCase().includes(lowerKeyword) ||
(task.description && task.description.toLowerCase().includes(lowerKeyword));
});
} | AST#method_declaration#Left searchTasks AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskIt... | searchTasks(keyword: string): TaskItem[] {
const lowerKeyword = keyword.toLowerCase();
return this.tasks.filter(task => {
return task.title.toLowerCase().includes(lowerKeyword) ||
(task.description && task.description.toLowerCase().includes(lowerKeyword));
});
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L480-L486 | fd4985b8527e25908e17b07e9dc3e913e12881d5 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | init | initialize all paints and stuff | protected init() {
// initialize the utils
this.mAnimator = new ChartAnimator(this);
Utils.init();
this.mMaxHighlightDistance = Utils.handleDataValues(500);
this.mDescription = new Description();
this.mLegend = new Legend();
this.mLegendRenderer = new LegendRenderer(this.mViewPortHandler, t... | AST#method_declaration#Left protected init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // initialize the utils 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 ... | protected init() {
this.mAnimator = new ChartAnimator(this);
Utils.init();
this.mMaxHighlightDistance = Utils.handleDataValues(500);
this.mDescription = new Description();
this.mLegend = new Legend();
this.mLegendRenderer = new LegendRenderer(this.mViewPortHandler, this.mLegend);
this.... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L186-L204 | a9411012d09d56fb68cbe47a54c824893b64eda3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets | arkts | getData | 获取指定数据项 | public getData(index: number): string {
return this.originDataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | public getData(index: number): string {
return this.originDataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets#L31-L33 | e7436cdf4ea02962e6def71d6327b2426b8920b2 | gitee |
Zairgs/ArKTSMovie.git | 1586c977f12722333eee7d74a71f006ba0606ade | ets/pages/FontSizePage.ets | arkts | getPreviewFontSize | 根据当前选择返回预览字体大小 | private getPreviewFontSize(): number {
switch (this.currentSize) {
case 0: return 14 // 小
case 1: return 16 // 标准
case 2: return 18 // 大
case 3: return 20 // 特大
default: return 16
}
} | AST#method_declaration#Left private getPreviewFontSize 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_compon... | private getPreviewFontSize(): number {
switch (this.currentSize) {
case 0: return 14
case 1: return 16
case 2: return 18
case 3: return 20
default: return 16
}
} | https://github.com/Zairgs/ArKTSMovie.git/blob/1586c977f12722333eee7d74a71f006ba0606ade/ets/pages/FontSizePage.ets#L92-L100 | 89955e61845a9b5840b34e552c5cfd03a893865f | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | PhotoBrowserUIElement. include CHECKBOX and BACK_BUTTON
@enum { number } PhotoBrowserUIElement
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 13 | export declare enum PhotoBrowserUIElement {
/**
* CHECKBOX. checkbox
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/
CHECKBOX = 0,
/**
* BACK_BUTTON. back button
*
* @syscap SystemCapability.FileManagement.PhotoA... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PhotoBrowserUIElement AST#enum_body#Left { /**
* CHECKBOX. checkbox
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 13
*/ AST#enum_member#Le... | export declare enum PhotoBrowserUIElement {
CHECKBOX = 0,
BACK_BUTTON = 1
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L765-L782 | f992fb366fc90b473840dcc4c1d0b984f0ec78e2 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshRight.ets | arkts | getListView | [Start get_list_view_right] | @Builder
private getListView() {
List({
space: 12,
scroller: this.scroller
}) {
// Render data using lazy loading components
ForEach(this.newsData, (item: NewsData) => {
ListItem() {
newsItem({
newsTitle: item.newsTitle,
newsContent: item.newsC... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private getListView 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 List ( AST#component_parameters#Left { AST#component_p... | @Builder
private getListView() {
List({
space: 12,
scroller: this.scroller
}) {
ForEach(this.newsData, (item: NewsData) => {
ListItem() {
newsItem({
newsTitle: item.newsTitle,
newsContent: item.newsContent,
newsTime: item.newsTime,... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshRight.ets#L215-L244 | a5b32844094b2cafa59e80d86172c612f054a99b | gitee |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/utils/PreferenceModel.ets | arkts | setTenantId | 写入密码 | async setTenantId(userId:string,tenantId:string,) {
await this.putPreference(`${userId}:tenantId`,tenantId);
} | AST#method_declaration#Left async setTenantId AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tenantId : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | async setTenantId(userId:string,tenantId:string,) {
await this.putPreference(`${userId}:tenantId`,tenantId);
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L110-L112 | 6721ddbb05909e479c9ab916d611a636eaa08c2f | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/MovieCard/entry/src/main/ets/viewmodel/FormDataBean.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/viewmodel/FormDataBean.ets#L16-L16 | b74d147afaf1b0aab395c6bbf901d8d599bfe1cc | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/CountDownTimer.ets | arkts | cancel | 取消倒计时 | cancel(): void {
if (this.timerId) {
clearInterval(this.timerId);
this.timerId = null;
}
this.isPaused = false;
} | AST#method_declaration#Left cancel 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... | cancel(): void {
if (this.timerId) {
clearInterval(this.timerId);
this.timerId = null;
}
this.isPaused = false;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/CountDownTimer.ets#L109-L115 | fbefacd69786eb77d35629688b0180724bb8956a | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets | arkts | aesDecrypt | AES decryption. | aesDecrypt() {
AesUtil.decrypt(this.userList[0]?.password, this.userList[0]?.authTag).then((data) => {
this.decryptPassword = data;
this.login();
}).catch((err: Error) => {
Logger.error(`AesDecrypt err cause ${JSON.stringify(err)}`);
PromptUtil.promptMessage($r('app.string.message_sys_er... | AST#method_declaration#Left aesDecrypt AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#memb... | aesDecrypt() {
AesUtil.decrypt(this.userList[0]?.password, this.userList[0]?.authTag).then((data) => {
this.decryptPassword = data;
this.login();
}).catch((err: Error) => {
Logger.error(`AesDecrypt err cause ${JSON.stringify(err)}`);
PromptUtil.promptMessage($r('app.string.message_sys_er... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets#L184-L192 | 6b42eb95733c354ab211699980b8bd3995cc9a29 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/button/buttonStyle.ets | arkts | ButtonStyleBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function ButtonStyleBuilder(name: string, param: Object) {
ButtonStyleExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ButtonStyleBuilder 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 pa... | @Builder
export function ButtonStyleBuilder(name: string, param: Object) {
ButtonStyleExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/button/buttonStyle.ets#L16-L19 | c51cc21fca09258794e066236ea4ad601d92cf60 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | getHighlightCircleInnerRadius | @Override | public getHighlightCircleInnerRadius(): number {
return this.mHighlightCircleInnerRadius;
} | AST#method_declaration#Left public getHighlightCircleInnerRadius 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#Lef... | public getHighlightCircleInnerRadius(): number {
return this.mHighlightCircleInnerRadius;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets#L86-L88 | d43b76cfbe26a66cadfeaec058815b7c3c76dc9d | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_axios/src/main/ets/axios/AxiosUtil.ets | arkts | @Author csx
@DateTime 2024/4/10 23:27
@TODO AxiosUtil 网络工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_axios | export class AxiosUtil {
/**
* response解密所需的数组
*/
private static sm4KeyList: ArrayList<Record<string, Object>> = new ArrayList();
/**
* 获取默认的axios对象
* @returns AxiosStatic
*/
private static getAxios(): AxiosStatic {
const context = axios.create({
baseURL: efAxiosParams.baseURL,
t... | AST#export_declaration#Left export AST#class_declaration#Left class AxiosUtil AST#class_body#Left { /**
* response解密所需的数组
*/ AST#property_declaration#Left private static sm4KeyList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ArrayList AST#type_arguments#Left < AST#type_annotation#Left A... | export class AxiosUtil {
private static sm4KeyList: ArrayList<Record<string, Object>> = new ArrayList();
private static getAxios(): AxiosStatic {
const context = axios.create({
baseURL: efAxiosParams.baseURL,
timeout: 10000
});
return context as AxiosStatic;
}
efAxios = AxiosU... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/AxiosUtil.ets#L32-L78 | 7c8dc7cb83cdaf9fe8420aa76a35109e37d982ff | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/RssSourceGroup.ets | arkts | RssSourceGroup | @author 2008
@datetime 2024/12/6 23:31
@className: rssSourceGroup
订阅源分组 | @Observed
export class RssSourceGroup{
rssGroupId?:number;
//分组名称
rssGroupName:string = "";
//排序
groupSort?:number;
//是否置顶
isTop:boolean = false;
//是否允许删除
isDelete:boolean = true;
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class RssSourceGroup AST#class_body#Left { AST#property_declaration#Left rssGroupId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /... | @Observed
export class RssSourceGroup{
rssGroupId?:number;
rssGroupName:string = "";
groupSort?:number;
isTop:boolean = false;
isDelete:boolean = true;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/RssSourceGroup.ets#L7-L18 | 6ab5f6f71431c621f3d8391b3d55641a65c6cb87 | github |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/FlowLocale.ets | arkts | installedSystemLocales | Returns a list of all installed locales.
@see java.util.Locale.getAvailableLocales | public static installedSystemLocales(): FlorisLocale[] {
return Locale.getAvailableLocales().map((locale: Locale) => FlorisLocale.from(locale));
} | AST#method_declaration#Left public static installedSystemLocales AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FlorisLocale [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left ... | public static installedSystemLocales(): FlorisLocale[] {
return Locale.getAvailableLocales().map((locale: Locale) => FlorisLocale.from(locale));
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L106-L108 | 7c2387a82d34c16a5aca7a71da7de90d5a964afd | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets | arkts | onColorModeChange | @Watch回调函数,监听颜色模式刷新状态变量 | onColorModeChange(): void {
this.banner = setBanner(this.currentMode);
} | AST#method_declaration#Left onColorModeChange 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#... | onColorModeChange(): void {
this.banner = setBanner(this.currentMode);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets#L47-L49 | 849d3329764c911d65dd5fa71d9a4dc126277b68 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/model/RotateModel.ets | arkts | RotateModel | 旋转信息 | @Observed
export class RotateModel {
// 当前旋转角度
public currentRotate: number;
// 最后的角度
public lastRotate: number = 0;
// 起步触发旋转的角度
public startAngle:number = 20;
constructor(currentX: number = 0) {
this.currentRotate = currentX;
}
// 重置
reset(): void {
this.currentRotate = 0;
this.lastR... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class RotateModel AST#class_body#Left { // 当前旋转角度 AST#property_declaration#Left public currentRotate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_decl... | @Observed
export class RotateModel {
public currentRotate: number;
public lastRotate: number = 0;
public startAngle:number = 20;
constructor(currentX: number = 0) {
this.currentRotate = currentX;
}
reset(): void {
this.currentRotate = 0;
this.lastRotate = 0;
}
stash(): void... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/model/RotateModel.ets#L17-L43 | a273008638896b5eef8705df8b0ac523919569f9 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/LinearSearch.ets | arkts | findAll | 查找所有等于目标值的元素
@param arr 数组
@param target 目标值
@returns 所有等于目标值的元素索引数组 | public static findAll(arr: number[], target: number): number[] {
if (!arr || arr.length === 0) {
return [];
}
const indices: number[] = [];
for (let i = 0; i < arr.length; i++) {
if (arr[i] === target) {
indices.push(i);
}
}
return indices;
} | AST#method_declaration#Left public static findAll 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#L... | public static findAll(arr: number[], target: number): number[] {
if (!arr || arr.length === 0) {
return [];
}
const indices: number[] = [];
for (let i = 0; i < arr.length; i++) {
if (arr[i] === target) {
indices.push(i);
}
}
return indices;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/LinearSearch.ets#L31-L44 | 4cbd6ced401888b785a38301a33ab06b2ebeb9fb | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/SnapshotUtil.ets | arkts | get | 获取已加载的组件的截图,传入组件的组件id,找到对应组件进行截图。通过Promise返回结果。
@param id 目标组件的组件标识,组件的唯一标识id
@param options 截图相关的自定义参数。
@returns | static async get(id: string, options?: componentSnapshot.SnapshotOptions): Promise<image.PixelMap> {
return componentSnapshot.get(id, options);
} | AST#method_declaration#Left static async get AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Lef... | static async get(id: string, options?: componentSnapshot.SnapshotOptions): Promise<image.PixelMap> {
return componentSnapshot.get(id, options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/SnapshotUtil.ets#L34-L36 | 5db495996c143341762cf1ea0b719d16805b1d86 | gitee |
YueHua46/ArkTS_Learn.git | 5c08d3016421c69c299f7cb757df686f277889ac | entry/src/main/ets/pages/RankPage.ets | arkts | aboutToDisappear | 5.即将卸载(在这里释放不需要得资源,避免资源泄露) | aboutToDisappear() {
console.log("${TAG} aboutToDisappear");
} | AST#method_declaration#Left aboutToDisappear 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 console AST#expression#Right . log AST#member_e... | aboutToDisappear() {
console.log("${TAG} aboutToDisappear");
} | https://github.com/YueHua46/ArkTS_Learn.git/blob/5c08d3016421c69c299f7cb757df686f277889ac/entry/src/main/ets/pages/RankPage.ets#L33-L35 | 7f72b6199a2403ced8830a062f61fa833200af2f | github |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/bean/FiveDayMinuteData.ets | arkts | 五日某一个天的某一分钟线的数据 | export class FiveDayItemMinuteData {
day: Date//五日的年月日时分
open: number
high: number
low: number
close: number
volume: number
ma_price5: number
ma_volume5: number
constructor | AST#export_declaration#Left export AST#ERROR#Left class FiveDayItemMinuteData { day : AST#ERROR#Left Date //五日的年月日时分 open : number high : number low : number close : number volume : number ma_price 5 : number ma_volume 5 : AST#ERROR#Right number AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarato... | export class FiveDayItemMinuteData {
day: Date
open: number
high: number
low: number
close: number
volume: number
ma_price5: number
ma_volume5: number
constructor | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/bean/FiveDayMinuteData.ets#L2-L12 | 69b9ec15b751f736e99291d97d2c6c8b42cf8b81 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets | arkts | 移动文件的结构 | export interface FileType {
// 路径---完整路径,用于打开或者直接创建copy
filePath: string;
// 名字---拼接到目标路径下
fileName: string;
// 类型---判断是否进入递归
type: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface FileType AST#object_type#Left { // 路径---完整路径,用于打开或者直接创建copy AST#type_member#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 名字---拼接到目标路径下 AST#type... | export interface FileType {
filePath: string;
fileName: string;
type: number;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/mock/local/FileData.ets#L66-L73 | 5cc15cac80175a3e68c3ce0f70e2c2b97b9d6865 | gitee | |
buqiuz/Account.git | b843a38c24a833a9a4386f63cffec5fa5dadc674 | oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/data/CandleDataSet.ets | arkts | DataSet for the CandleStickChart. | export default class CandleDataSet extends LineScatterCandleRadarDataSet<CandleEntry> implements ICandleDataSet {
/**
* the width of the shadow of the candle
*/
private mShadowWidth: number = 3;
/**
* should the candle bars show?
* when false, only "ticks" will show
* <p/>
* - default: true
*... | AST#export_declaration#Left export default AST#class_declaration#Left class CandleDataSet extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left LineScatterCandleRadarDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CandleEntry AST#primary_type#Right AST#type_annota... | export default class CandleDataSet extends LineScatterCandleRadarDataSet<CandleEntry> implements ICandleDataSet {
private mShadowWidth: number = 3;
private mShowCandleBar: boolean = true;
private mBarSpace: number = 0.1;
private mShadowColorSameAsCandle: boolean = false;
protected mIncreasingPa... | https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/data/CandleDataSet.ets#L29-L285 | c8b997036fba8d732c78817644a7034bb01d7678 | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/StorageUtils.ets | arkts | getObject | 获取对象数据
@param key 存储键
@param defaultValue 默认值
@returns 存储的对象 | static async getObject<T>(key: string, defaultValue: T): Promise<T> {
try {
const jsonString = await StorageUtils.getString(key, '');
if (!jsonString) {
return defaultValue;
}
return JSON.parse(jsonString) as T;
} catch (error) {
console.error(`Failed to get object for key ... | AST#method_declaration#Left static async getObject 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#param... | static async getObject<T>(key: string, defaultValue: T): Promise<T> {
try {
const jsonString = await StorageUtils.getString(key, '');
if (!jsonString) {
return defaultValue;
}
return JSON.parse(jsonString) as T;
} catch (error) {
console.error(`Failed to get object for key ... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L165-L176 | cd81fb9933d34157a6015f84d436621d8ff247b1 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SHASync.ets | arkts | digestSHA1 | SHA1摘要
@param str 带摘要的字符串
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 摘要后的字符串 | static digestSHA1(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'SHA1', resultCoding);
} | AST#method_declaration#Left static digestSHA1 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_typ... | static digestSHA1(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'SHA1', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SHASync.ets#L34-L36 | 043d480d953b4be94b87df647e4ab730d6c6c29a | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/YAxisRenderer.ets | arkts | drawYLabels | draws the y-labels on the specified x-position
@param fixedPosition
@param positions | protected drawYLabels(fixedPosition: number, positions: number[], offset: number): Paint[] {
let paints = [];
const fromIndex = this.mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;
const to = this.mYAxis.isDrawTopYLabelEntryEnabled() ? this.mYAxis.mEntryCount : this.mYAxis.mEntryCount - 1;
let xOffset... | AST#method_declaration#Left protected drawYLabels AST#parameter_list#Left ( AST#parameter#Left fixedPosition : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left positions : AST#type_annotation#Left AST#primary_type#Left AST#ar... | protected drawYLabels(fixedPosition: number, positions: number[], offset: number): Paint[] {
let paints = [];
const fromIndex = this.mYAxis.isDrawBottomYLabelEntryEnabled() ? 0 : 1;
const to = this.mYAxis.isDrawTopYLabelEntryEnabled() ? this.mYAxis.mEntryCount : this.mYAxis.mEntryCount - 1;
let xOffset... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/YAxisRenderer.ets#L128-L179 | 09aab3f59544685542f1e171791c0ab86d50a3fa | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | 主题模式枚举 | export enum ThemeMode {
LIGHT = 'light',
DARK = 'dark',
AUTO = 'auto',
CUSTOM = 'custom'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ThemeMode AST#enum_body#Left { AST#enum_member#Left LIGHT = AST#expression#Left 'light' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DARK = AST#expression#Left 'dark' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ... | export enum ThemeMode {
LIGHT = 'light',
DARK = 'dark',
AUTO = 'auto',
CUSTOM = 'custom'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L13-L18 | 0133fd3177ed3d1735883ca1b361bc0f736ed67e | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TempUtil.ets | arkts | TODO 温度转换工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class TempUtil {
/**
* 摄氏度转华氏度
* @param c 摄氏度
* @return 华氏度
*/
static C2F(c: number): number {
return c * (9 / 5) + 32
}
/**
* 华氏度转摄氏度
* @param f 华氏度
* @return 摄氏度
*/
static F2C(f: number): number {
return (f - 32) * (5 / 9)
}
/**
* 摄氏度转开尔文
* @param c 摄氏度温... | AST#export_declaration#Left export AST#class_declaration#Left class TempUtil AST#class_body#Left { /**
* 摄氏度转华氏度
* @param c 摄氏度
* @return 华氏度
*/ AST#method_declaration#Left static C2F AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ... | export class TempUtil {
static C2F(c: number): number {
return c * (9 / 5) + 32
}
static F2C(f: number): number {
return (f - 32) * (5 / 9)
}
static C2K(c: number): number {
return c + 273.15;
}
static K2C(k: number): number {
return k - 273.15;
}
static F2K(f: n... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TempUtil.ets#L22-L82 | 52f3e302be6492b18141901574a62c53a9ac2d4f | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/StorageUtils.ets | arkts | getAllKeys | 获取所有存储的键(简化版本)
@returns 键数组 | static async getAllKeys(): Promise<string[]> {
// 简化版本:返回已知的键列表
// 在实际应用中,这里会使用preferences API获取所有键
return [
'notification_settings',
'offline_config',
'backup_config',
'tasks',
'task_stats'
];
} | AST#method_declaration#Left static async getAllKeys 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 string [ ] AST#array_type#Right AST#primary... | static async getAllKeys(): Promise<string[]> {
return [
'notification_settings',
'offline_config',
'backup_config',
'tasks',
'task_stats'
];
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L239-L249 | 580de8c715fa8677b9f5e47d0a0e1c4b2d818ac2 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildPreviewDialog | 构建预览对话框 | @Builder
buildPreviewDialog() {
Column() {
// 背景遮罩
Row()
.width('100%')
.layoutWeight(1)
.backgroundColor('rgba(0,0,0,0.3)')
.onClick(() => {
this.showPreview = false;
})
// 预览内容
Column({ space: 16 }) {
Row() {
Text... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildPreviewDialog 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 { // 背景遮罩 AS... | @Builder
buildPreviewDialog() {
Column() {
Row()
.width('100%')
.layoutWeight(1)
.backgroundColor('rgba(0,0,0,0.3)')
.onClick(() => {
this.showPreview = false;
})
Column({ space: 16 }) {
Row() {
Text('祝福语预览')
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L680-L792 | 6c19f7dad7fa0e5af21fdedff34526d7ef37d2a1 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets | arkts | publishFile | 初始化计数 | async function publishFile(file: backup.File): Promise<void> {
Logger.info('start publishFile');
let fileMeta: backup.FileMeta = {
bundleName: file.bundleName,
uri: ''
}
await gSessionRestore.publishFile(fileMeta);
} | AST#function_declaration#Left async function publishFile AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left backup . File AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST... | async function publishFile(file: backup.File): Promise<void> {
Logger.info('start publishFile');
let fileMeta: backup.FileMeta = {
bundleName: file.bundleName,
uri: ''
}
await gSessionRestore.publishFile(fileMeta);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets#L153-L160 | aa02908e96fbf0c9df4ff596463dde9551f8b665 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/base/StringBuilder.ets | arkts | @Author csx
@DateTime 2023/12/29 21:52
@TODO StringBuilder
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core | export class StringBuilder {
private value: (string | number | boolean | null)[];
constructor() {
this.value = [];
}
append(str: string | number | boolean | null): StringBuilder {
this.value.push(str);
return this;
}
toString(): string {
return this.value.join('');
}
} | AST#export_declaration#Left export AST#class_declaration#Left class StringBuilder AST#class_body#Left { AST#property_declaration#Left private value : AST#ERROR#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#... | export class StringBuilder {
private value: (string | number | boolean | null)[];
constructor() {
this.value = [];
}
append(str: string | number | boolean | null): StringBuilder {
this.value.push(str);
return this;
}
toString(): string {
return this.value.join('');
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/base/StringBuilder.ets#L24-L40 | f070536efdbf0e0c3d14428c572f3f756afba988 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | MaxCountType. include TOTAL_MAX_COUNT, PHOTO_MAX_COUNT and VIDEO_MAX_COUNT
@enum { number } MaxCountType
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum MaxCountType {
/**
* TOTAL_MAX_COUNT. total max count
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
TOTAL_MAX_COUNT = 0,
/**
* PHOTO_MAX_COUNT. photo max count
*
* @syscap SystemCapability.FileManagement.PhotoAcce... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum MaxCountType AST#enum_body#Left { /**
* TOTAL_MAX_COUNT. total max count
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#enum_member#Left TOTA... | export declare enum MaxCountType {
TOTAL_MAX_COUNT = 0,
PHOTO_MAX_COUNT = 1,
VIDEO_MAX_COUNT = 2
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L1075-L1102 | 911662d7b2b5553a5ee28f67f446dc104a4a7486 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets | arkts | drawTime | 绘制完整时间回显 | private drawTime(hour: number, minute: number, second: number): void{
let time = this.mainModel.fillZero(hour)
+ MainConstant.DEFAULT_STRING_COLON
+ this.mainModel.fillZero(minute)
+ MainConstant.DEFAULT_STRING_COLON
+ this.mainModel.fillZero(second);
this.renderContext.save();
this.renderCo... | AST#method_declaration#Left private drawTime AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minute : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | private drawTime(hour: number, minute: number, second: number): void{
let time = this.mainModel.fillZero(hour)
+ MainConstant.DEFAULT_STRING_COLON
+ this.mainModel.fillZero(minute)
+ MainConstant.DEFAULT_STRING_COLON
+ this.mainModel.fillZero(second);
this.renderContext.save();
this.renderCo... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets#L120-L133 | 1ab64c232ccb84d334930ee9322518e8274fb9a6 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundHelper.ets | arkts | isSoundCacheExists | 检查声音缓存是否存在
@param text 要检查的文本
@returns 是否存在缓存 | static async isSoundCacheExists(text: string): Promise<boolean> {
return await CSoundManager.shared.isCSoundExistsInCache(text)
} | AST#method_declaration#Left static async isSoundCacheExists AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener... | static async isSoundCacheExists(text: string): Promise<boolean> {
return await CSoundManager.shared.isCSoundExistsInCache(text)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundHelper.ets#L11-L13 | 6536c84ea7ff6ce7436f640f0295bdc28105ba69 | github |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/viewmodel/IndexViewModel.ets | arkts | 主页底部标签 | export class IndexTab {
title: string;
iconActive: Resource;
iconOriginal: Resource;
constructor(title: string, iconActive: Resource, iconOriginal: Resource) {
this.title = title
this.iconActive = iconActive
this.iconOriginal = iconOriginal
}
} | AST#export_declaration#Left export AST#class_declaration#Left class IndexTab AST#class_body#Left { AST#property_declaration#Left title : 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 iconActive : AST#... | export class IndexTab {
title: string;
iconActive: Resource;
iconOriginal: Resource;
constructor(title: string, iconActive: Resource, iconOriginal: Resource) {
this.title = title
this.iconActive = iconActive
this.iconOriginal = iconOriginal
}
} | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/viewmodel/IndexViewModel.ets#L22-L32 | 5b11f52c221a7b5ba21990bcbbb1143e22bea7bf | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/SoundEffect/SEManager.ets | arkts | 私有构造函数 | private constructor() {} | AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right | private constructor() {} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L27-L27 | 3f6cda8bdc4e58794b9d4778c31cda06bb124a9e | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | debug | 标识应用是否处于调试模式,取值为true表示应用处于调试模式,取值为false表示应用处于非调试模式。
@returns | static debug(): boolean {
return AppUtils.getAppInfoSync().debug
} | AST#method_declaration#Left static debug 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... | static debug(): boolean {
return AppUtils.getAppInfoSync().debug
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L174-L176 | ff67ccc8745c953970bd035fc85ba40052af3ce0 | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/viewmodel/AlarmClockViewModel.ets | arkts | getTaskTimeContent | 获取闹钟任务的时间内容。
@param hour number 小时
@param minute number 分钟
@return content string 时间内容字符串 | public getTaskTimeContent(hour: number, minute: number): string {
return (AlarmClockViewModel.fillZero(hour)
+ AlarmClockConstants.DEFAULT_STRING_COLON
+ AlarmClockViewModel.fillZero(minute));
} | AST#method_declaration#Left public getTaskTimeContent AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minute : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | public getTaskTimeContent(hour: number, minute: number): string {
return (AlarmClockViewModel.fillZero(hour)
+ AlarmClockConstants.DEFAULT_STRING_COLON
+ AlarmClockViewModel.fillZero(minute));
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/AlarmClockViewModel.ets#L111-L115 | 3864a739f24509434e4519c00e9c407ab6561321 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/SpecSelectModal.ets | arkts | ModalContent | 弹窗内容
@returns {void} 无返回值 | @Builder
private ModalContent(): void {
ColumnStart({ widthValue: P100 }) {
// 顶部商品信息
if (this.goods) {
this.SpecHeaderInfo();
}
SpaceVerticalMedium();
// 规格分类标题和切换按钮
RowSpaceBetweenCenter({ widthValue: P100 }) {
TitleWithLine({ text: $r("app.string.spec_categ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ModalContent 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_... | @Builder
private ModalContent(): void {
ColumnStart({ widthValue: P100 }) {
if (this.goods) {
this.SpecHeaderInfo();
}
SpaceVerticalMedium();
RowSpaceBetweenCenter({ widthValue: P100 }) {
TitleWithLine({ text: $r("app.string.spec_category") });
Comm... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/SpecSelectModal.ets#L131-L179 | 89e7b119dbbc7b95dd3bc9d25faf349babb5b417 | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | videoCrop | 视频裁剪(crop + 硬编码)
注意:crop 滤镜在 CPU 执行,但解码和编码使用硬件加速
@param input 输入视频路径
@param output 输出视频路径
@param width 裁剪宽度
@param height 裁剪高度
@param x 裁剪起始 X 坐标(默认 0)
@param y 裁剪起始 Y 坐标(默认 0)
@example
// 从 (100, 50) 位置裁剪 1280x720 区域
FFmpegFactory.videoCrop(input, output, 1280, 720, 100, 50);
// 居中裁剪(使用表达式)
FFmpegFactory.videoCropC... | public static videoCrop(
input: string,
output: string,
width: number,
height: number,
x: number = 0,
y: number = 0
): string[] {
return [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:${x}:${y}`,
'-c:v', FFmpegFactory.HW_CODEC,
'-c:a', 'copy',
... | AST#method_declaration#Left public static videoCrop AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | public static videoCrop(
input: string,
output: string,
width: number,
height: number,
x: number = 0,
y: number = 0
): string[] {
return [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:${x}:${y}`,
'-c:v', FFmpegFactory.HW_CODEC,
'-c:a', 'copy',
... | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L92-L108 | df8f8d732e7f69c8ab234acadff678f460200164 | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/services/UserService.ets | arkts | initialize | 初始化用户服务 | async initialize(): Promise<boolean> {
try {
// 初始化云数据库服务
await this.cloudDBService.initialize();
return true;
} catch (error) {
console.error('初始化用户服务失败:', error);
return false;
}
} | AST#method_declaration#Left async initialize 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_ar... | async initialize(): Promise<boolean> {
try {
await this.cloudDBService.initialize();
return true;
} catch (error) {
console.error('初始化用户服务失败:', error);
return false;
}
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/UserService.ets#L35-L44 | 20b47b922685eecd0f50adff8f6d61c276f00d22 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets | arkts | sendMessage | 发送消息 | sendMessage() {
if (!this.message || !this.clientIp || !this.clientPort) {
this.msgHistory += 'Some required fields are missing.\n';
Logger.error('Some required fields are missing.');
return;
}
let tcpMessage: TcpMessage = {
type: 'sendMessage',
message: this.message,
cl... | AST#method_declaration#Left sendMessage 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#expressio... | sendMessage() {
if (!this.message || !this.clientIp || !this.clientPort) {
this.msgHistory += 'Some required fields are missing.\n';
Logger.error('Some required fields are missing.');
return;
}
let tcpMessage: TcpMessage = {
type: 'sendMessage',
message: this.message,
cl... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets#L239-L263 | 3f86df7e79b1b1c690308aaa34bd6d1e64002ee1 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/objects/CatstensionBridgeObj.ets | arkts | liny_test | Test method.
@param data Anything to be logged. | liny_test(data: string) {
console.log(`[Extension][CatsBridge][arkTs] Test! data=[${data}]!`);
} | AST#method_declaration#Left liny_test AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Le... | liny_test(data: string) {
console.log(`[Extension][CatsBridge][arkTs] Test! data=[${data}]!`);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/CatstensionBridgeObj.ets#L69-L71 | 713dfb9856eb557c48aca060d73e18cedaa1796a | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | toDateFromUTC | 解析UTC格式日期字符串
@param dateStr UTC格式日期字符串
@param format UTC格式,默认为"yyyy-MM-dd'T'HH:mm:ss.000'Z'"
@returns 解析成功的Date对象,失败返回null | static toDateFromUTC(dateStr: string, format: string = "yyyy-MM-dd'T'HH:mm:ss.000'Z'"): Date | null {
return DateUtils.toDate(dateStr, format);
} | AST#method_declaration#Left static toDateFromUTC AST#parameter_list#Left ( AST#parameter#Left dateStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static toDateFromUTC(dateStr: string, format: string = "yyyy-MM-dd'T'HH:mm:ss.000'Z'"): Date | null {
return DateUtils.toDate(dateStr, format);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L208-L210 | ecbe2fa510bdf7590501f9447190346a50e78113 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPNumberUtils.ets | arkts | round2 | 保留2位小数 | public static round2(num: number): number {
return Math.round(num * 100) / 100
} | AST#method_declaration#Left public static round2 AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | public static round2(num: number): number {
return Math.round(num * 100) / 100
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPNumberUtils.ets#L13-L15 | 0e1d5551c20d53cfdece482b2d211b117cbe6b73 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/ThemeManager.ets | arkts | getAllThemes | 获取所有主题 | getAllThemes(): ThemeModel[] {
return [
{
type: 'minimal',
name: '简约主题',
description: '简洁清爽,专注内容',
colors: {
primaryColor: '#00C851',
primaryLightColor: '#4DD776',
secondaryColor: '#FFD700',
backgroundColor: '#F8F9FA',
surfaceCo... | AST#method_declaration#Left getAllThemes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ThemeModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left ... | getAllThemes(): ThemeModel[] {
return [
{
type: 'minimal',
name: '简约主题',
description: '简洁清爽,专注内容',
colors: {
primaryColor: '#00C851',
primaryLightColor: '#4DD776',
secondaryColor: '#FFD700',
backgroundColor: '#F8F9FA',
surfaceCo... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L143-L222 | e87a541f4a40b03c0d7dd4da841f5abbdf1f3a29 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets | arkts | decodingPictureJs | 多图图片解码
@param pictureStatus 图片类型(0:jpeg, 1:heif)
@param auxType 解码类型(1:Gain map)
@returns | async decodingPictureJs(pictureStatus: number, auxType: image.AuxiliaryPictureType): Promise<void> {
logger.info(TAG, `decodingPicture start`);
logger.debug(TAG, `decodingPicture Type = ${auxType}`);
if (!pictureStatus) { // jpeg
this.pixelMap = await DecodingPicture(this.jpegFileName, auxType);
}... | AST#method_declaration#Left async decodingPictureJs AST#parameter_list#Left ( AST#parameter#Left pictureStatus : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left auxType : AST#type_annotation#Left AST#primary_type#Left AST#qu... | async decodingPictureJs(pictureStatus: number, auxType: image.AuxiliaryPictureType): Promise<void> {
logger.info(TAG, `decodingPicture start`);
logger.debug(TAG, `decodingPicture Type = ${auxType}`);
if (!pictureStatus) {
this.pixelMap = await DecodingPicture(this.jpegFileName, auxType);
} else {... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets#L127-L148 | 4a0785f9bd4353d8c3901759e1e4e52529b33476 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/WinDialogUtil.ets | arkts | closeAlert | 关闭窗口
@returns | static async closeAlert(winName: string): Promise<void> {
if (WinDialogUtil.cacheWindowMap && WinDialogUtil.cacheWindowMap.hasKey(winName)) {
await WinDialogUtil.cacheWindowMap.get(winName).destroyWindow();
}
} | AST#method_declaration#Left static async closeAlert AST#parameter_list#Left ( AST#parameter#Left winName : 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_ty... | static async closeAlert(winName: string): Promise<void> {
if (WinDialogUtil.cacheWindowMap && WinDialogUtil.cacheWindowMap.hasKey(winName)) {
await WinDialogUtil.cacheWindowMap.get(winName).destroyWindow();
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/WinDialogUtil.ets#L97-L101 | 8616c97857a9d91111de108f1b698a8e488cb220 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets | arkts | @file Demo 数据源实现,基于 IBest-ORM 封装 CRUD。
@author Joker.X | export class DemoLocalDataSourceImpl implements DemoLocalDataSource {
/**
* 迁移标记,避免重复建表
*/
private static migrated: boolean = false;
/**
* ORM 实例
*/
private orm = getORM();
constructor() {
this.ensureMigrated();
}
/**
* 确保 Demo 表完成迁移
* @returns {void} 无返回
*/
private ensureMigr... | AST#export_declaration#Left export AST#class_declaration#Left class DemoLocalDataSourceImpl AST#implements_clause#Left implements DemoLocalDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 迁移标记,避免重复建表
*/ AST#property_declaration#Left private static migrated : AST#type_annotation#Left AST#primary_... | export class DemoLocalDataSourceImpl implements DemoLocalDataSource {
private static migrated: boolean = false;
private orm = getORM();
constructor() {
this.ensureMigrated();
}
private ensureMigrated(): void {
if (!DemoLocalDataSourceImpl.migrated) {
this.orm.migrate(DemoEntity);
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets#L10-L97 | b9238c57830b4216eeac44c0ea3ec418946aef49 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets | arkts | backup_set | 备份设置所有事件 | backup_set(index:number){
switch (index){
case 2:
router.pushUrl({
url:"pages/view/myCenter/diskSet"
} | AST#method_declaration#Left backup_set 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#... | backup_set(index:number){
switch (index){
case 2:
router.pushUrl({
url:"pages/view/myCenter/diskSet"
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets#L232-L237 | 3a6faf24c180d05f277880b8ffeaa2b4f70a4e34 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets | arkts | showOperationMenu | 显示帖子操作菜单 | showOperationMenu(post: Post) {
if (!this.isCurrentUser || !post || !post.id) return;
// 避免在删除操作进行时再次显示菜单
if (this.isDeleting) return;
// 使用提示对话框模拟操作菜单
// 鸿蒙OS ArkTS API 15 不支持showActionSheet,使用showDialog替代
promptAction.showDialog({
title: '帖子操作',
message: post.title || '选择... | AST#method_declaration#Left showOperationMenu AST#parameter_list#Left ( AST#parameter#Left post : AST#type_annotation#Left AST#primary_type#Left Post 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 ( A... | showOperationMenu(post: Post) {
if (!this.isCurrentUser || !post || !post.id) return;
if (this.isDeleting) return;
promptAction.showDialog({
title: '帖子操作',
message: post.title || '选择要执行的操作',
buttons: [
{
text: '编辑',
color: '#1976d2'
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets#L143-L184 | 44600e7101b856e084421c4f9af88c15be5b504f | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/multinavigation/source/multinavigation.ets | arkts | isFold | Check if is foldable
@returns true if is foldable | static isFold(): boolean {
let isFold: boolean = false;
try {
isFold = display.isFoldable();
} catch (e) {
hilog.error(0x0000, TAG, 'isFold -> isFoldable try error:', e);
}
return isFold;
} | AST#method_declaration#Left static isFold 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#variable_declaration#Left let AST#variable_declarator#Left isFold : A... | static isFold(): boolean {
let isFold: boolean = false;
try {
isFold = display.isFoldable();
} catch (e) {
hilog.error(0x0000, TAG, 'isFold -> isFoldable try error:', e);
}
return isFold;
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/multinavigation/source/multinavigation.ets#L57-L65 | 712ab77bed3109d4fb9b7149ce26649cb3d38c76 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/DictSelectModal.ets | arkts | ModalContent | 弹窗内容
@returns {void} 无返回值 | @Builder
private ModalContent(): void {
ColumnStart({ widthValue: P100 }) {
Scroll() {
IBestCheckboxGroup({ group: this.groupId, activeList: this.getActiveList() }) {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ModalContent 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_... | @Builder
private ModalContent(): void {
ColumnStart({ widthValue: P100 }) {
Scroll() {
IBestCheckboxGroup({ group: this.groupId, activeList: this.getActiveList() }) {
IBestCellGroup({
inset: true,
radius: $r("app.float.radius_medium"),
outerMargin: 0
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L109-L146 | 0751b08382479919ea244c772a2e351ce9a98c51 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/PodcastDetailPage.ets | arkts | addToQueue | 添加到待听队列 | async addToQueue(episode: Episode) {
try {
const db = DatabaseService.getInstance();
await db.addToQueue(episode.id);
console.info(`[PodcastDetailPage] Added to queue: ${episode.title}`);
UIUtils.showToast(new ToastOptions('已添加到待听队列', 2000));
} catch (error) {
console.error('[Podca... | AST#method_declaration#Left async addToQueue AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode 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 ... | async addToQueue(episode: Episode) {
try {
const db = DatabaseService.getInstance();
await db.addToQueue(episode.id);
console.info(`[PodcastDetailPage] Added to queue: ${episode.title}`);
UIUtils.showToast(new ToastOptions('已添加到待听队列', 2000));
} catch (error) {
console.error('[Podca... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/PodcastDetailPage.ets#L501-L511 | 5bfafe0ca71931ff7b6631643ddd1e6dc8be43e3 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets | arkts | 创建一个Row组件,用来显示用户信息,然后在下面创建一个Scroll组件,用来显示其他内容,
当Scroll滑动时,Row组件隐藏且里面的子组件渐隐 | build() {
Column() {
Row() {
Text($r('app.string.slidetohideanddisplace_vip'))
.onClick(() => {
promptAction.showToast({ message: $r('app.string.slidetohideanddisplace_vip') });
})
.fontWeight(FontWeight.Bolder)
.fontSize($r('app.integer.slidetohidea... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row() {
Text($r('app.string.slidetohideanddisplace_vip'))
.onClick(() => {
promptAction.showToast({ message: $r('app.string.slidetohideanddisplace_vip') });
})
.fontWeight(FontWeight.Bolder)
.fontSize($r('app.integer.slidetohidea... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets#L236-L370 | 15111246816caf200656e2bd830bfaf6ccf4d267 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getNumber | 获取指定资源对应的integer数值或者float数值
@param resId 资源ID值/资源信息
@returns | static getNumber(resId: number | Resource): number {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getNumber(resId);
} else {
return ResUtil.getResourceManager().getNumber(resId);
}
} | AST#method_declaration#Left static getNumber AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) ... | static getNumber(resId: number | Resource): number {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getNumber(resId);
} else {
return ResUtil.getResourceManager().getNumber(resId);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L67-L73 | 7c3db942ff6010f63c73514f33bcb02e7d7f436a | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/SearchPage.ets | arkts | searchGreetings | 搜索祝福语 | private async searchGreetings(keyword: string): Promise<Greeting[]> {
if (this.activeTab === 'contacts') return [];
return await this.greetingService.searchGreetings({
keyword,
pageSize: 50
});
} | AST#method_declaration#Left private async searchGreetings AST#parameter_list#Left ( AST#parameter#Left keyword : 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#gene... | private async searchGreetings(keyword: string): Promise<Greeting[]> {
if (this.activeTab === 'contacts') return [];
return await this.greetingService.searchGreetings({
keyword,
pageSize: 50
});
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L147-L154 | 7bc386ad8dfdf6d0e7aa940aec7f87452f6ea755 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ModelConfigService.ets | arkts | addCustomModel | 添加自定义模型 | public addCustomModel(customModel: CustomModelConfig): void {
this.customModels.push(customModel);
this.storeCustomModels();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[ModelConfigService] Custom model added: ${customModel.name}`);
} | AST#method_declaration#Left public addCustomModel AST#parameter_list#Left ( AST#parameter#Left customModel : AST#type_annotation#Left AST#primary_type#Left CustomModelConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v... | public addCustomModel(customModel: CustomModelConfig): void {
this.customModels.push(customModel);
this.storeCustomModels();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[ModelConfigService] Custom model added: ${customModel.name}`);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ModelConfigService.ets#L350-L355 | 9d60bfb4705651e3f9386a490ccb8eff9ebbc29c | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/Form/FormInput.ets | arkts | @author 2008
@datetime 2024/7/20 01:21
@className: FormInput
自定义Input | export enum FormItemType {
Input
} | AST#export_declaration#Left export AST#enum_declaration#Left enum FormItemType AST#enum_body#Left { AST#enum_member#Left Input AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right | export enum FormItemType {
Input
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/Form/FormInput.ets#L11-L13 | 34506a7d067463d5a6b71b205f39520ee20800d5 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | markerName | 外部产品系列 | static markerName(): string {
return deviceInfo.marketName
} | AST#method_declaration#Left static markerName 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_expres... | static markerName(): string {
return deviceInfo.marketName
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L43-L45 | fd1e1584c2302b60e358975d6360d250e5fc319a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityGroup.ets | arkts | AccessibilityGroup | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct AccessibilityGroup {
build() {
NavDestination() {
Column({ space: 10 }) {
Text('123456')
.focusable(true)
.borderRadius(5)
.accessibilityText($r('app.string.UniversalAttributesAccessibility_text1'))
.accessibilityLevel('yes')
B... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AccessibilityGroup 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 NavDestination ( ) AST#container_co... | @Component
export struct AccessibilityGroup {
build() {
NavDestination() {
Column({ space: 10 }) {
Text('123456')
.focusable(true)
.borderRadius(5)
.accessibilityText($r('app.string.UniversalAttributesAccessibility_text1'))
.accessibilityLevel('yes')
B... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/UniversalAttributesAccessibility/AccessibilityGroup.ets#L16-L40 | 596dce640d747ac33bf7ad2d6e225cd71b9f5066 | gitee |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | entry/src/main/ets/pages/View/FestivalInfo.ets | arkts | titleFontStyle | import { FunctionController,FunctionComponent } from '@kit.AgentFrameworkKit' import { common } from '@kit.AbilityKit' import { hilog } from '@kit.PerformanceAnalysisKit'; import {BusinessError} from '@kit.BasicServicesKit' | @Extend(Text) function titleFontStyle(currentBreakpoint : string){
.fontSize(currentBreakpoint == BreakpointConstant.BREAKPOINT_LG ? 25 : 20)
.fontWeight(FontWeight.Bold)
.margin({top : 10})
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function titleFontStyle AST#parameter_list#Left ( AST#parameter#Left currentBreakpoint : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat... | @Extend(Text) function titleFontStyle(currentBreakpoint : string){
.fontSize(currentBreakpoint == BreakpointConstant.BREAKPOINT_LG ? 25 : 20)
.fontWeight(FontWeight.Bold)
.margin({top : 10})
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/View/FestivalInfo.ets#L10-L14 | 2bd30a6fbfd9e1212166a4894b77e0bade527d38 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/DateHelper.ets | arkts | getRanges | 获取年月日时分秒的可选范围
@param containType 是否含有
@param type 1-年、2-月、3-日、4-时、5-分、6-秒。
@param startDate 开始日期
@param endDate 结束日期
@param selectDate 选中日期
@returns | static getRanges(containType: boolean, type: number, startDate: Date, endDate: Date, selectDate: Date): string[] {
let ranges: string[] = [];
if (containType) {
if (type == 1) { //年
let startYear = startDate.getFullYear();
let endYear = endDate.getFullYear();
for (let y = startYear... | AST#method_declaration#Left static getRanges AST#parameter_list#Left ( AST#parameter#Left containType : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | static getRanges(containType: boolean, type: number, startDate: Date, endDate: Date, selectDate: Date): string[] {
let ranges: string[] = [];
if (containType) {
if (type == 1) {
let startYear = startDate.getFullYear();
let endYear = endDate.getFullYear();
for (let y = startYear; y... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L143-L215 | 065b73370359fe61e17cf180d16dfb17e30920cc | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHA.ets | arkts | hmac | 消息认证码计算
@param str 计算字符串
@returns | static async hmac(str: string): Promise<string> {
return DynamicUtil.hmac(str, 'SHA256');
} | AST#method_declaration#Left static async 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr... | static async hmac(str: string): Promise<string> {
return DynamicUtil.hmac(str, 'SHA256');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA.ets#L77-L79 | bc8c033ff810976e7691a178f18d0ac10b381095 | gitee |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/pages/Index.ets | arkts | switchCity | 切换城市 | async switchCity(cityName: string, cityId: string) {
console.log('切换城市:', cityName, cityId);
// 更新状态
this.currentCity = cityName;
this.cityId = cityId;
// 保存到本地存储
await StorageUtil.saveSelectedCity(cityName, cityId);
// 重新加载天气数据
await this.loadWeatherData();
} | AST#method_declaration#Left async switchCity AST#parameter_list#Left ( AST#parameter#Left cityName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cityId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | async switchCity(cityName: string, cityId: string) {
console.log('切换城市:', cityName, cityId);
this.currentCity = cityName;
this.cityId = cityId;
await StorageUtil.saveSelectedCity(cityName, cityId);
await this.loadWeatherData();
} | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/pages/Index.ets#L106-L118 | 4a43ca71c9812c4e3e92fbceb8f926faca6d798b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/components/common/EmptyView.ets | arkts | BirthdaysEmptyView | 生日空状态组件 | @Component
export struct BirthdaysEmptyView {
@Prop timeRange: string = '今天';
build() {
EmptyView({
message: `${this.timeRange}没有生日`,
description: '可以去添加更多联系人,记录他们的生日',
icon: $r('app.media.ic_birthday_empty')
})
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BirthdaysEmptyView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right timeRange : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#typ... | @Component
export struct BirthdaysEmptyView {
@Prop timeRange: string = '今天';
build() {
EmptyView({
message: `${this.timeRange}没有生日`,
description: '可以去添加更多联系人,记录他们的生日',
icon: $r('app.media.ic_birthday_empty')
})
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/components/common/EmptyView.ets#L100-L111 | 77b834f00000658e46d554fadfe0eaf9902692a5 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AdaptiveCapabilities/entry/src/main/ets/common/GetValueOnBreakpoint.ets | arkts | Global breakpoint interface | export default function getValueOnBreakpoint(breakpointsLabels: string[], breakpoints: Breakpoints): string {
if (breakpointsLabels.length < 4) {
return '';
}
let windowObj: window.Window | undefined = AppStorage.get('windowObj');
if (windowObj == undefined) {
return '';
}
let newBreakpoint: string ... | AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function getValueOnBreakpoint AST#parameter_list#Left ( AST#parameter#Left breakpointsLabels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_an... | export default function getValueOnBreakpoint(breakpointsLabels: string[], breakpoints: Breakpoints): string {
if (breakpointsLabels.length < 4) {
return '';
}
let windowObj: window.Window | undefined = AppStorage.get('windowObj');
if (windowObj == undefined) {
return '';
}
let newBreakpoint: string ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AdaptiveCapabilities/entry/src/main/ets/common/GetValueOnBreakpoint.ets#L31-L57 | 0e04228edaed29485309e7d9a059df317f455d15 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/FileUtil.ets | arkts | getFileExtention | 根据文件名获取文件后缀
@param fileName 例如: test.txt test.doc
@returns | static getFileExtention(fileName: string) {
if (!StrUtil.isEmpty(fileName) && fileName.includes(".")) {
return fileName.substring(fileName.lastIndexOf(".") + 1);
}
return '';
} | AST#method_declaration#Left static getFileExtention 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#block_statement#Left { AST#statement#Left AST#if_statement... | static getFileExtention(fileName: string) {
if (!StrUtil.isEmpty(fileName) && fileName.includes(".")) {
return fileName.substring(fileName.lastIndexOf(".") + 1);
}
return '';
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L158-L163 | 1f776bec66bd7ecc6086dcc1e0a9c7991cb0c260 | gitee |
AntoSmith/PicWorld.git | b53ec0b59192b537de563f75bcc3c7664939397e | entry/src/main/ets/entryability/EntryAbility.ets | arkts | reqPermissionsFromUser | 向用户申请权限 | function reqPermissionsFromUser(permissions: Array<Permissions>, context: UIAbility): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
atManager.requestPermissionsFromUser(context.context, permissions).then((data) => {
le... | AST#function_declaration#Left function reqPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissions : 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 Permissions AST#primary_type#Right AST#type_annotat... | function reqPermissionsFromUser(permissions: Array<Permissions>, context: UIAbility): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
atManager.requestPermissionsFromUser(context.context, permissions).then((data) => {
let grantStatus: Array<number> = data.authResults;... | https://github.com/AntoSmith/PicWorld.git/blob/b53ec0b59192b537de563f75bcc3c7664939397e/entry/src/main/ets/entryability/EntryAbility.ets#L17-L35 | 1c11cf5c95142570660984c7d032d680b7c218c2 | github |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/components/msg_content_view/MsgContentView_text.ets | arkts | MsgContentView_text | 普通聊天消息内容组件(文本消息)。
@author Jack Jiang(http://www.52im.net/thread-2792-1-1.html) | @Component
export struct MsgContentView_text {
// 消息数据对象
message?: Message;
build() {
if(this.message) {
Row() {
Text(this.message.content)
.enableDataDetector(true)
.dataDetectorConfig({
types: [TextDataDetectorType.URL, TextDataDetectorType.PHONE_NUMBER, TextDa... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MsgContentView_text AST#component_body#Left { // 消息数据对象 AST#property_declaration#Left message ? : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right ; AST#property_... | @Component
export struct MsgContentView_text {
message?: Message;
build() {
if(this.message) {
Row() {
Text(this.message.content)
.enableDataDetector(true)
.dataDetectorConfig({
types: [TextDataDetectorType.URL, TextDataDetectorType.PHONE_NUMBER, TextDataDetecto... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/components/msg_content_view/MsgContentView_text.ets#L18-L43 | 35c11b0d7c443bfd49288306f526e100a1b256d0 | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/web/WebDemo/entry/src/main/ets/pages/Index.ets | arkts | loadLocalFile | 加载本地文件 | async loadLocalFile() {
let context = getContext(this)
let segments = this.loadFileUri.split('/')
//文件名称
let fileName = segments[segments.length-1] + ".html"
//计划复制到的目标路径
let realUri = context.cacheDir + "/" + fileName
//复制选择的文件到沙箱cache文件夹
try {
let file = await fs.open(this.load... | AST#method_declaration#Left async loadLocalFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST... | async loadLocalFile() {
let context = getContext(this)
let segments = this.loadFileUri.split('/')
let fileName = segments[segments.length-1] + ".html"
let realUri = context.cacheDir + "/" + fileName
try {
let file = await fs.open(this.loadFileUri);
fs.copyFileSync(file.f... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/WebDemo/entry/src/main/ets/pages/Index.ets#L159-L176 | e61de040967b5ae94c651ff743b6ddb5be4d030d | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSMultiPicture/features/pictureView/src/main/ets/viewmodel/Adaptive.ets | arkts | 尺寸适配 | export class Adaptive {
static PICTURE_HEIGHT = (currentBreakpoint: string): string => {
return new BreakpointType(
PictureViewConstants.PICTURE_HEIGHT_SM,
PictureViewConstants.PICTURE_HEIGHT_MD,
PictureViewConstants.PICTURE_HEIGHT_LG,
).GetValue(currentBreakpoint);
};
static PICTURE_WID... | AST#export_declaration#Left export AST#class_declaration#Left class Adaptive AST#class_body#Left { AST#property_declaration#Left static PICTURE_HEIGHT = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left currentBreakpoint : AST#type_annotation#Left AST#primary_type#Left string AST#... | export class Adaptive {
static PICTURE_HEIGHT = (currentBreakpoint: string): string => {
return new BreakpointType(
PictureViewConstants.PICTURE_HEIGHT_SM,
PictureViewConstants.PICTURE_HEIGHT_MD,
PictureViewConstants.PICTURE_HEIGHT_LG,
).GetValue(currentBreakpoint);
};
static PICTURE_WID... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/features/pictureView/src/main/ets/viewmodel/Adaptive.ets#L7-L22 | cfd22f756302c2062ab7ff55f5ce295b0605dd81 | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/Constraint.ets | arkts | number类型Callback | export declare type NumberCallback = (index: number, dialogId: string) => void; | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type NumberCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#... | export declare type NumberCallback = (index: number, dialogId: string) => void; | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/Constraint.ets#L2-L2 | ba16464bbcb49f412607d052ea099c0ea67123fb | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/NavigationViewModel.ets | arkts | clearResult | 清空回传结果
@returns {void} 无返回值 | private clearResult(): void {
this.resultTitle = "";
this.resultDescription = "";
this.hasResult = false;
} | AST#method_declaration#Left private clearResult 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 AS... | private clearResult(): void {
this.resultTitle = "";
this.resultDescription = "";
this.hasResult = false;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/NavigationViewModel.ets#L71-L75 | 4a1a024ea0babd024773bd6ff8ed5b18d5bf82c4 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/models/TaskModel.ets | arkts | 数据持久化管理类 | export class DataStorage {
private static prefsInstance: preferences.Preferences | null = null;
private static readonly PREFS_NAME = 'TaskManagerPrefs';
private static readonly KEY_TASKS = 'tasks';
private static readonly KEY_COMPLETED_TASKS = 'completedTasks';
// 初始化 Preferences
static async init(context:... | AST#export_declaration#Left export AST#class_declaration#Left class DataStorage AST#class_body#Left { AST#property_declaration#Left private static prefsInstance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_typ... | export class DataStorage {
private static prefsInstance: preferences.Preferences | null = null;
private static readonly PREFS_NAME = 'TaskManagerPrefs';
private static readonly KEY_TASKS = 'tasks';
private static readonly KEY_COMPLETED_TASKS = 'completedTasks';
static async init(context: Context): Promise... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L21-L115 | 6d282f99ae5339fea20eed906fa0d3e5e41e5e58 | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogHub.ets | arkts | getCustom | 显示自定义内容弹框
@returns | static getCustom(uiContext?: UIContext): CustomContentBuilderProxy {
return new CustomContentBuilderProxy(uiContext);
} | AST#method_declaration#Left static getCustom 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 CustomContentB... | static getCustom(uiContext?: UIContext): CustomContentBuilderProxy {
return new CustomContentBuilderProxy(uiContext);
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L130-L132 | e5e808870ec2c2036b73fecd7d4ab8015bccd849 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets | arkts | openCustomDialog | 创建并弹出dialogContent对应的自定义弹窗
@param contentView 自定义弹窗中显示的组件内容。
@param options 弹窗样式。 | openCustomDialog<T extends BaseDialogOptions>(contentView: WrappedBuilder<[T]>, options: T): string {
if (!options.dialogId) {
options.dialogId = this.generateDialogId();
}
if (options.uiContext) {
this.openBaseCustomDialog(options.uiContext, contentView, options);
} else {
window.getL... | AST#method_declaration#Left openCustomDialog AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left BaseDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left co... | openCustomDialog<T extends BaseDialogOptions>(contentView: WrappedBuilder<[T]>, options: T): string {
if (!options.dialogId) {
options.dialogId = this.generateDialogId();
}
if (options.uiContext) {
this.openBaseCustomDialog(options.uiContext, contentView, options);
} else {
window.getL... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L161-L173 | d7eaaf6575c6cbaf2108ba00305117dfc07f021b | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | isEmpty | Returns true if the chart is empty (meaning it's data object is either
null or contains no entries).
@return | public isEmpty(): boolean {
if (this.mData == null)
return true;
else {
if (this.mData.getEntryCount() <= 0)
return true;
else
return false;
}
} | AST#method_declaration#Left public isEmpty 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#Lef... | public isEmpty(): boolean {
if (this.mData == null)
return true;
else {
if (this.mData.getEntryCount() <= 0)
return true;
else
return false;
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L276-L287 | 19e75da667030146ab193c0d03a4aa851c2ba5be | gitee |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/components/MusicClassifyComponent.ets | arkts | useLikeEmitter | @description: 监听音乐是否收藏
@date: 2024-07-07 18:54
@author wuwenqiang | useLikeEmitter(){
emitter.on(LIKE_INNER_EVENT, (data:emitter.EventData)=>{
const musicModel:MusicInterface = data.data as MusicInterface;
const musicItem = this.musicList.find(item => musicModel.id === item.id);
musicItem && (musicItem.isLike = musicModel.isLike);
});
} | AST#method_declaration#Left useLikeEmitter 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 emitter AST#expression#Right . on AST#member_expr... | useLikeEmitter(){
emitter.on(LIKE_INNER_EVENT, (data:emitter.EventData)=>{
const musicModel:MusicInterface = data.data as MusicInterface;
const musicItem = this.musicList.find(item => musicModel.id === item.id);
musicItem && (musicItem.isLike = musicModel.isLike);
});
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicClassifyComponent.ets#L39-L45 | d431a93689195b365e824a5e415695f820e6efe4 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | get_global_default_UA | Gets the default user agent of system ArkWeb.
@returns A string, the default user agent | get_global_default_UA() {
if (this.Tabs[this.main_tab_idx].controller) {
return this.Tabs[this.main_tab_idx].controller!.getUserAgent();
} else {
return '';
}
} | AST#method_declaration#Left get_global_default_UA 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left ... | get_global_default_UA() {
if (this.Tabs[this.main_tab_idx].controller) {
return this.Tabs[this.main_tab_idx].controller!.getUserAgent();
} else {
return '';
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L190-L196 | f70d4203effd846432a39f7efd4cf5fbc06fb211 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/PathUtility.ets | arkts | getParentPathOf | 获取父目录路径(始终以斜杠结尾)
@param path 文件/目录路径
@returns 父目录路径,格式为 "parentDir/" | static getParentPathOf(path: string): string {
const lastSlashIndex = path.lastIndexOf('/');
return lastSlashIndex >= 0 ? path.substring(0, lastSlashIndex + 1) : './';
} | AST#method_declaration#Left static getParentPathOf AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static getParentPathOf(path: string): string {
const lastSlashIndex = path.lastIndexOf('/');
return lastSlashIndex >= 0 ? path.substring(0, lastSlashIndex + 1) : './';
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L67-L70 | 9a6036ff48a387af8df4b9f8a8d057b32bec9e72 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_encryption_decryption/sm4_gcm_encryption_decryption_synchronous.ets | arkts | encryptMessage | 加密消息 | function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let encryptUpdate = cipher.updateSync(plainText);
// gcm模式加密doFinal时传入空,获得ta... | AST#function_declaration#Left function encryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p... | function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let encryptUpdate = cipher.updateSync(plainText);
gcmParams.authTag = cip... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_encryption_decryption/sm4_gcm_encryption_decryption_synchronous.ets#L49-L56 | bbc307bc087ddfc3156838725cf670acb1759d6d | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | closeApplication | 关闭应用 | public closeApplication(from: string, context: common.UIAbilityContext) {
Logger.info(from, `关闭应用`);
context.terminateSelf().catch((err: BusinessError) => {
Logger.error(from, `关闭应用失败, ${err}`);
});
} | AST#method_declaration#Left public closeApplication AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t... | public closeApplication(from: string, context: common.UIAbilityContext) {
Logger.info(from, `关闭应用`);
context.terminateSelf().catch((err: BusinessError) => {
Logger.error(from, `关闭应用失败, ${err}`);
});
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/CommonUtils.ets#L186-L191 | dd9d2791be9d3a2ed78ae63b118da0097d02831c | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BaseDataSet.ets | arkts | Default constructor.
constructor(); constructor(label: string); | constructor(label?: string) {
this.mColors = new JArrayList<number>();
this.mValueColors = new JArrayList<number>();
// default color
this.mColors.add(0x8ceaff);
this.mValueColors.add(0x000000);
if (label != undefined) {
this.mLabel = label;
} else {
this.mLabel = 'DataSet';
... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left label ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement... | constructor(label?: string) {
this.mColors = new JArrayList<number>();
this.mValueColors = new JArrayList<number>();
this.mColors.add(0x8ceaff);
this.mValueColors.add(0x000000);
if (label != undefined) {
this.mLabel = label;
} else {
this.mLabel = 'DataSet';
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L94-L105 | 99109467a68130db125bb9c4a4fe39a6a5bbd4e1 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarUtils.ets | arkts | formatLunarDate | 格式化农历日期
@param lunarDate 农历日期字符串或农历日期对象
@param format 格式(简单格式化)
@returns 格式化后的农历日期字符串 | static formatLunarDate(lunarDate: string | LunarResult, format: 'short' | 'long' = 'short'): string {
let lunar: LunarResult;
if (typeof lunarDate === 'string') {
// 解析字符串格式的农历日期
const parsed = LunarUtils.parseLunarDate(lunarDate);
if (!parsed) return '';
// 获取详细信息
cons... | AST#method_declaration#Left static formatLunarDate AST#parameter_list#Left ( AST#parameter#Left lunarDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left LunarResult AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#param... | static formatLunarDate(lunarDate: string | LunarResult, format: 'short' | 'long' = 'short'): string {
let lunar: LunarResult;
if (typeof lunarDate === 'string') {
const parsed = LunarUtils.parseLunarDate(lunarDate);
if (!parsed) return '';
const solarDate = LunarUtils... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L337-L377 | f47e34cc71f01bfdad1be7cf95e1307b37b0d16b | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/Index.ets | arkts | AuthNetworkDataSource | @file network 模块统一导出
@author Joker.X | export { AuthNetworkDataSource } from './src/main/ets/datasource/auth/AuthNetworkDataSource'; | AST#export_declaration#Left export { AuthNetworkDataSource } from './src/main/ets/datasource/auth/AuthNetworkDataSource' ; AST#export_declaration#Right | export { AuthNetworkDataSource } from './src/main/ets/datasource/auth/AuthNetworkDataSource'; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/Index.ets#L6-L6 | 847c97324c2f3ba1a5ee3e1b47f060a21267fb5e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/SoundPool/SoundPoolArkTS/entry/src/main/ets/pages/Index.ets | arkts | setErrorCallback | 设置错误类型监听。 | async setErrorCallback() {
this.soundPool!.on('error', (error: BusinessError) => {
console.error('error happened,message is :' + error.code);
console.error('error happened,message is :' + error.message);
})
} | AST#method_declaration#Left async setErrorCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AS... | async setErrorCallback() {
this.soundPool!.on('error', (error: BusinessError) => {
console.error('error happened,message is :' + error.code);
console.error('error happened,message is :' + error.message);
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/SoundPool/SoundPoolArkTS/entry/src/main/ets/pages/Index.ets#L98-L103 | bbc516af2f8aac290407c3fbfca7c4fc3ae2c97c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/DistributedRdb/entry/src/main/ets/model/Contact.ets | arkts | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | @Observed
export default class Contact {
id: number;
name: string;
gender: number;
phone: string;
remark: string;
age: number;
isSelected: boolean;
type: string | undefined;
constructor(id: number, name: string, gender: number, phone: string, age: number, remark: string, type?: string) {
this.id ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export default AST#class_declaration#Left class Contact AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_d... | @Observed
export default class Contact {
id: number;
name: string;
gender: number;
phone: string;
remark: string;
age: number;
isSelected: boolean;
type: string | undefined;
constructor(id: number, name: string, gender: number, phone: string, age: number, remark: string, type?: string) {
this.id ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedRdb/entry/src/main/ets/model/Contact.ets#L16-L37 | e04c9f7a8fcabdbe8404a00eeec8325605e11789 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/networks/HttpUtils.ets | arkts | HTTP请求方法枚举 | export enum Method {
GET = "GET",
POST = "POST",
DELETE = "DELETE",
PUT = "PUT"
} | AST#export_declaration#Left export AST#enum_declaration#Left enum Method AST#enum_body#Left { AST#enum_member#Left GET = AST#expression#Left "GET" AST#expression#Right AST#enum_member#Right , AST#enum_member#Left POST = AST#expression#Left "POST" AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DELETE ... | export enum Method {
GET = "GET",
POST = "POST",
DELETE = "DELETE",
PUT = "PUT"
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/HttpUtils.ets#L28-L33 | 63bf99cd86436eba712a3f44d853ec1b7f2136bd | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/pages/IndexPage.ets | arkts | videoDes | [End device_width] | @Builder
videoDes(item: VideoData): void {
VideoDes({
item: item,
isFloatWindow: this.isFloatWindow,
onNextClick: () => {
this.swiperController.showNext();
}
})
.visibility(((this.isFullScreen || this.isFloatWindow) && !this.isFullLandscapeScreen) ? Visibility.Visible :
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right videoDes AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left VideoData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AS... | @Builder
videoDes(item: VideoData): void {
VideoDes({
item: item,
isFloatWindow: this.isFloatWindow,
onNextClick: () => {
this.swiperController.showNext();
}
})
.visibility(((this.isFullScreen || this.isFloatWindow) && !this.isFullLandscapeScreen) ? Visibility.Visible :
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/pages/IndexPage.ets#L201-L213 | 40ac876db619691521b94880c8a38a192348946c | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.