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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/utils/FileUtil.ets | arkts | *
功能:获取该目录下的文件
参数 1:文件所在目录 | export function getListFile(path: string, callback = () => {
}) {
try {
let filenames = fs.listFileSync(path);
Logger.info('[FileUtils.getListFile]', 'listFile succeed.');
for (let i = 0; i < filenames.length; i++) {
Logger.info('[FileUtils.getListFile]', filenames[i]);
}
} catch (error) {
... | AST#export_declaration#Left export AST#function_declaration#Left function getListFile 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#Left callback = AST#expression#Left AST#arr... | export function getListFile(path: string, callback = () => {
}) {
try {
let filenames = fs.listFileSync(path);
Logger.info('[FileUtils.getListFile]', 'listFile succeed.');
for (let i = 0; i < filenames.length; i++) {
Logger.info('[FileUtils.getListFile]', filenames[i]);
}
} catch (error) {
... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/FileUtil.ets#L86-L99 | 4d5a8aace41312ac9f293a98df003c042e33372b | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/GridScrollBar.ets | arkts | GridScrollBar | Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | @Component
export struct GridScrollBar {
scroller: Scroller = new Scroller();
@State isClickScrollBar: boolean = false;
@Link isHideScrollBar: boolean;
build() {
ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,
state: this.isHideScrollBar ? BarState.Off : BarState.Auto }) ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GridScrollBar AST#component_body#Left { AST#property_declaration#Left scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_... | @Component
export struct GridScrollBar {
scroller: Scroller = new Scroller();
@State isClickScrollBar: boolean = false;
@Link isHideScrollBar: boolean;
build() {
ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,
state: this.isHideScrollBar ? BarState.Off : BarState.Auto }) ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/GridScrollBar.ets#L16-L54 | b69031d36643c60fc86e62c6ca6d1f4414debe1d | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | moduleList of string | export const MODULE_LIST: string = 'moduleList'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MODULE_LIST : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'moduleList' AST#expression#Right AST#variable_declarator#Right ; AST#variable_de... | export const MODULE_LIST: string = 'moduleList'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L24-L24 | 31495d480dd632851e15184327702a25a69b3824 | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets | arkts | addNotification | 添加一条消息 | async addNotification(notification: notification.NotificationRequest) {
const typeId = notification.content.contentType;
this.typeNotifications[typeId].push(notification);
this.countsByType[typeId] += 1;
this.badgeNum += 1;
await notificationManagement.setBadgeNumber(this.badgeNum);
logger.info(... | AST#method_declaration#Left async addNotification AST#parameter_list#Left ( AST#parameter#Left notification : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para... | async addNotification(notification: notification.NotificationRequest) {
const typeId = notification.content.contentType;
this.typeNotifications[typeId].push(notification);
this.countsByType[typeId] += 1;
this.badgeNum += 1;
await notificationManagement.setBadgeNumber(this.badgeNum);
logger.info(... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/notification/src/main/ets/notification/NotificationManagementUtil.ets#L73-L80 | e9b97ee92db6d612d452a900cc370002bdb3b18c | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/KMP.ets | arkts | findAllMatches | 在文本中查找模式串的所有出现位置
@param text 文本字符串
@param pattern 模式串
@returns 所有匹配位置的数组 | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const lps = KMP.computeLPS(pattern);
const m = pattern.length;
const n = text.length;
let i = 0; // 文本索引
let j = 0; // 模式串索引
... | AST#method_declaration#Left static findAllMatches 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#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const lps = KMP.computeLPS(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
let j = 0;
while (i <... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L112-L145 | a4bc6b113356df1bed8959fb818badbbb0333672 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | stop | 停止倒计时 | stop(): void {
if (this.timerId >= 0) {
clearInterval(this.timerId); // 清除定时器[6](@ref)
this.timerId = -1;
}
this.active = false;
this.paused = false;
} | AST#method_declaration#Left stop 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#binary_expression#L... | stop(): void {
if (this.timerId >= 0) {
clearInterval(this.timerId);
this.timerId = -1;
}
this.active = false;
this.paused = false;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L62-L69 | 9fca1f03c72528149b94e87e5f4376cd6f023d03 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/Memo.ets | arkts | toRow | Convert to database row format | toRow(): MemoData {
return {
content: this.content,
created_at: this.createdAt
};
} | AST#method_declaration#Left toRow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MemoData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { A... | toRow(): MemoData {
return {
content: this.content,
created_at: this.createdAt
};
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/Memo.ets#L48-L53 | d1840df35a7c432582c5372d2e0221db53579726 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getNavigationIndicatorHeight | 获取底部导航条的高度,单位为px。
@returns | static getNavigationIndicatorHeight(): number {
try {
const windowClass = AppUtil.getMainWindow();
const avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR);
return avoidArea.bottomRect.height;
} catch (err) {
LogUtil.error(err);
return 0;
... | AST#method_declaration#Left static getNavigationIndicatorHeight 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#try_statement#Left try AST#block_statement#Left ... | static getNavigationIndicatorHeight(): number {
try {
const windowClass = AppUtil.getMainWindow();
const avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR);
return avoidArea.bottomRect.height;
} catch (err) {
LogUtil.error(err);
return 0;
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L384-L393 | 3ef75f0bf7041d2ad51456b6d036a2a915593c6f | gitee |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/lite_chart/index.ets | arkts | LiteChart | export { MainPage } from './src/main/ets/components/mainpage/MainPage' | export {LiteChart} from "./src/main/ets/components/Litechart" | AST#export_declaration#Left export { LiteChart } from "./src/main/ets/components/Litechart" AST#export_declaration#Right | export {LiteChart} from "./src/main/ets/components/Litechart" | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/lite_chart/index.ets#L3-L3 | 07d5fb894627c183dd5ca629a1b67d3b671fe4be | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Privacy/privacy/src/main/ets/pages/CheckWantTwo.ets | arkts | checkWant | Check function | function checkWant(want: Want) {
try {
if (want.parameters) {
let param = want.parameters['test'] as Want;
let str = param.uri;
hilog.info(0x0000, 'privacy', 'get uri string: ' + str);
}
} catch (e) {
return false;
}
return true;
} | AST#function_declaration#Left function checkWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left tr... | function checkWant(want: Want) {
try {
if (want.parameters) {
let param = want.parameters['test'] as Want;
let str = param.uri;
hilog.info(0x0000, 'privacy', 'get uri string: ' + str);
}
} catch (e) {
return false;
}
return true;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Privacy/privacy/src/main/ets/pages/CheckWantTwo.ets#L26-L37 | 2cae688f13b2035cf0cc2cf0dc7ff27915d3a5eb | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/system/ITipsDialogOptions.ets | arkts | 系统tips弹窗 | export interface ITipsDialogOptions extends IModalDialogOptions {
/**
* Sets the TipsDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the TipsDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCap... | AST#export_declaration#Left export AST#interface_declaration#Left interface ITipsDialogOptions AST#extends_clause#Left extends IModalDialogOptions AST#extends_clause#Right AST#object_type#Left { /**
* Sets the TipsDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Ful... | export interface ITipsDialogOptions extends IModalDialogOptions {
controller?: CustomDialogController;
imageRes: ResourceStr | PixelMap;
imageSize?: SizeOptions;
title?: ResourceStr;
content?: ResourceStr;
checkTips?: ResourceStr;
isChecked?: boolean... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/system/ITipsDialogOptions.ets#L8-L203 | d1ef79046196d15ef2aca4586e5d644d317921fc | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WaterFlowSample/entry/src/main/ets/pages/DataUpdateAndAnimationPage.ets | arkts | refresh | 5、Pull down to refresh the data update logic. | refresh(): void {
this.currentItem = -1;
setTimeout(() => {
// Add new data.
this.dataSource.dataArray = [];
let value: number = Math.floor(Math.random() * 100);
for (let i: number = 0; i < 100; i++) {
this.dataSource.dataArray.push(i + value);
this.dataSource.notifyDataA... | AST#method_declaration#Left refresh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_exp... | refresh(): void {
this.currentItem = -1;
setTimeout(() => {
this.dataSource.dataArray = [];
let value: number = Math.floor(Math.random() * 100);
for (let i: number = 0; i < 100; i++) {
this.dataSource.dataArray.push(i + value);
this.dataSource.notifyDataAdd(i);
}
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/DataUpdateAndAnimationPage.ets#L143-L165 | d201be1dcdef8962f6d2be3991b6294b62023977 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/toolbox/src/main/ets/utils/FloatingWindow.ets | arkts | tool | 工具项UI
@param {ToolInterface} $$ - 输入参数 | @Builder
function tool($$: ToolInterface) {
Image($r("app.media.AI_circle_viewfinder"))
.height(CommonConstants.TOOL_ITEM_HEIGHT)
.width(40)
.objectFit(ImageFit.Fill)
.onClick(() => {
promptAction.showToast({
message: '点击逻辑自行实现',
duration: 2000
})
})
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function tool AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left ToolInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builde... | @Builder
function tool($$: ToolInterface) {
Image($r("app.media.AI_circle_viewfinder"))
.height(CommonConstants.TOOL_ITEM_HEIGHT)
.width(40)
.objectFit(ImageFit.Fill)
.onClick(() => {
promptAction.showToast({
message: '点击逻辑自行实现',
duration: 2000
})
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/utils/FloatingWindow.ets#L392-L404 | e1f5763ccf6ff3a3b64a2658a4d5192697e115a4 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | digest | 摘要
@param str 带摘要的字符串
@param symAlgName 秘钥规格
@returns 摘要后的字符串 | static async digest(str: string, symAlgName: string): Promise<OutDTO<string>> {
//摘要对象
let md = crypto.createMd(symAlgName);
//字符串转换的字节流对象
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200; // 默认以200字节为单位进行分段update
for (let i = 0; i < messageData.length; ... | AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static async digest(str: string, symAlgName: string): Promise<OutDTO<string>> {
let md = crypto.createMd(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200;
for (let i = 0; i < messageData.length; i += updateLength) {
let updateMessag... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L403-L416 | 125395b32d16fb64f9692a3c0cee21b819d32ac9 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | getCurrentLanguageInfo | 获取当前语言信息 | private getCurrentLanguageInfo(): LanguageInfo | undefined {
return this.supportedLanguages.find(lang => lang.code === this.currentLanguage);
} | AST#method_declaration#Left private getCurrentLanguageInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LanguageInfo AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right... | private getCurrentLanguageInfo(): LanguageInfo | undefined {
return this.supportedLanguages.find(lang => lang.code === this.currentLanguage);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L632-L634 | f069d02f6d8a4e65b2eecbe2c0c05c270709f6dc | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/danmakuplayer/Index.ets | arkts | DanmakuVideoDemo | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { DanmakuVideoDemo } from './src/main/ets/view/VideoView'; | AST#export_declaration#Left export { DanmakuVideoDemo } from './src/main/ets/view/VideoView' ; AST#export_declaration#Right | export { DanmakuVideoDemo } from './src/main/ets/view/VideoView'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/danmakuplayer/Index.ets#L15-L15 | 843a56e2383dc827f4a3a9743e5a87a57a1eb09b | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/ColumnInfo.ets | arkts | 数据类型 | export enum ColumnType{
LONG,
DOUBLE,
STRING,
BLOB,
BOOLEAN
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ColumnType AST#enum_body#Left { AST#enum_member#Left LONG AST#enum_member#Right , AST#enum_member#Left DOUBLE AST#enum_member#Right , AST#enum_member#Left STRING AST#enum_member#Right , AST#enum_member#Left BLOB AST#enum_member#Right , AST#enum_member#Le... | export enum ColumnType{
LONG,
DOUBLE,
STRING,
BLOB,
BOOLEAN
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/ColumnInfo.ets#L18-L24 | d011cdd181e0777743b01ab9ebd41db251a0285d | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/ui/select/DatePickerUtil.ets | arkts | @Author csx
@DateTime 2024/3/28 20:58
@TODO DatePickerUtil 日历滑块工具类 | export class DatePickerUtil {
} | AST#export_declaration#Left export AST#class_declaration#Left class DatePickerUtil AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export class DatePickerUtil {
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/ui/select/DatePickerUtil.ets#L22-L23 | 0808676d7e50695be15a1f214fdc2a096b74954c | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 自动锁定超时验证规则接口 | export interface AutoLockTimeoutValidationRule {
allowedValues: number[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AutoLockTimeoutValidationRule AST#object_type#Left { AST#type_member#Left allowedValues : 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#ty... | export interface AutoLockTimeoutValidationRule {
allowedValues: number[];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L170-L172 | f0b666d5cc9e93886c877ba304d0828be49a6fba | github | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnife.ets | arkts | addHeader | 全局添加单个请求头header
@param key 请求头属性
@param value 请求头值 | addHeader(key: string, value: Object) {
this.headerMap.set(key, value)
} | AST#method_declaration#Left addHeader AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AS... | addHeader(key: string, value: Object) {
this.headerMap.set(key, value)
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L98-L100 | b5e3b412452e4ba37b21e6c283ea0668ecc8fb75 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets | arkts | getImageSourceByFd | 通过沙箱内文件的文件描述符获取文件资源实例
@param fileName - 文件名称。
@returns 图片资源实例。 | public getImageSourceByFd(fileName: string): image.ImageSource {
// [Start pixelmap_get_image_by_fd]
const context: Context = getContext(this);
// fileName可使用'/test.jpg',也可以根据实际环境传入其他图片名
const filePath = context.cacheDir + fileName;
const file: fs.File = fs.openSync(filePath, fs.OpenMode.READ_WRITE)... | AST#method_declaration#Left public getImageSourceByFd AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualifi... | public getImageSourceByFd(fileName: string): image.ImageSource {
const context: Context = getContext(this);
const filePath = context.cacheDir + fileName;
const file: fs.File = fs.openSync(filePath, fs.OpenMode.READ_WRITE);
const fd: number = file?.fd;
const imageSource: imag... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L63-L76 | c0ce5349dcf7412223dc846aafd32ebbcf10e2bf | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogBuilder.ets | arkts | TextInputDialogBuilder | TextInputDialog
@param options | @Builder
export function TextInputDialogBuilder(options: TextInputOptions) {
TextInputDialogView({ options: options });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TextInputDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TextInputOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#... | @Builder
export function TextInputDialogBuilder(options: TextInputOptions) {
TextInputDialogView({ options: options });
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L137-L140 | 3c28b5f8b45fc37a1f8b08772e556670828b0d0b | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 登录信息接口 | export interface LoginInfo {
email: string;
password: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LoginInfo AST#object_type#Left { AST#type_member#Left email : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left password : AST#type_annotation#Lef... | export interface LoginInfo {
email: string;
password: string;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L51-L54 | e857b8937a8d153596800dafaad77978f6a54c37 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/share/SharePage.ets | arkts | onCustomContent | 自定义分享内容 | onCustomContent() {
this.customContent = this.shareContent;
this.showCustomContentDialog = true;
} | AST#method_declaration#Left onCustomContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customContent AST#member_expressio... | onCustomContent() {
this.customContent = this.shareContent;
this.showCustomContentDialog = true;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/share/SharePage.ets#L161-L164 | 0fe79ac1b0112eda8ba1a868fb152e63f4378604 | github |
cljhwt/Gemini3_to_ArkTS.git | 11507c45be72ecccef2f757eaf024c2b8617ad34 | ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/pages/Index.ets | arkts | getImage | 初始化为空字符串 | @Builder
getImage() {
Column({ space: 12 }) {
Button($r('app.string.get_image_from_component'))
.width('100%')
.height(40)
.onClick(() => {
this.isShowPicker = true;
})
.bindSheet($$this.isShowPicker, this.photoPicker(), {
height: SheetSize.FIT_CON... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#... | @Builder
getImage() {
Column({ space: 12 }) {
Button($r('app.string.get_image_from_component'))
.width('100%')
.height(40)
.onClick(() => {
this.isShowPicker = true;
})
.bindSheet($$this.isShowPicker, this.photoPicker(), {
height: SheetSize.FIT_CON... | https://github.com/cljhwt/Gemini3_to_ArkTS.git/blob/11507c45be72ecccef2f757eaf024c2b8617ad34/ArtTs-Demo/ImageGetAndSave-master/entry/src/main/ets/pages/Index.ets#L128-L220 | 810489bd8307f6d9615e04afb48735f8bc06b609 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | updateSelectedDayInfo | 将页面数据更新为被选中的天数的数据 | public updateSelectedDayInfo(selectedDayInfo: WeekDateModel) {
// 从数据库中查找数据
if (selectedDayInfo.accountingList.length === 0) {
AccountingInfoApi.query(selectedDayInfo.dateStr, (resultSet: AccountingInfo[]) => {
let accountingListStr = JSON.stringify(resultSet);
this.accountingList = JSON.... | AST#method_declaration#Left public updateSelectedDayInfo AST#parameter_list#Left ( AST#parameter#Left selectedDayInfo : AST#type_annotation#Left AST#primary_type#Left WeekDateModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 从数据库中查找... | public updateSelectedDayInfo(selectedDayInfo: WeekDateModel) {
if (selectedDayInfo.accountingList.length === 0) {
AccountingInfoApi.query(selectedDayInfo.dateStr, (resultSet: AccountingInfo[]) => {
let accountingListStr = JSON.stringify(resultSet);
this.accountingList = JSON.parse(accoun... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L160-L201 | 0d64e50cfd5f7cda89170d609e0d149f9f1c3d79 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | updateFormData | 回填表单数据
@param {Address} address - 地址数据
@returns {void} 无返回值 | private updateFormData(address: Address): void {
this.contactName = address.contact ?? "";
this.phone = address.phone ?? "";
this.province = address.province ?? "";
this.city = address.city ?? "";
this.district = address.district ?? "";
this.detailAddress = address.address ?? "";
this.isDefa... | AST#method_declaration#Left private updateFormData AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left Address 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... | private updateFormData(address: Address): void {
this.contactName = address.contact ?? "";
this.phone = address.phone ?? "";
this.province = address.province ?? "";
this.city = address.city ?? "";
this.district = address.district ?? "";
this.detailAddress = address.address ?? "";
this.isDefa... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L304-L314 | c3d8d99cb93ccf2de3b38f4b16fa0359ddfedcab | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | removeFootprint | 根据商品ID删除足迹记录
@param {number} goodsId 商品ID
@returns {Promise<void>} Promise<void> | removeFootprint(goodsId: number): Promise<void> {
return this.dataSource.removeFootprint(goodsId);
} | AST#method_declaration#Left removeFootprint AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | removeFootprint(goodsId: number): Promise<void> {
return this.dataSource.removeFootprint(goodsId);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FootprintRepository.ets#L36-L38 | 40ba66193aaa77ae94a6e5c6ac7f6fe61be77635 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/CalendarApiService.ets | arkts | getBackupLunarInfo | 备用农历API | private async getBackupLunarInfo(date: Date): Promise<LunarDate> {
try {
const dateStr = this.formatDate(date);
const url = `${this.APIs.backup}?date=${dateStr}`;
const request = http.createHttp();
const response = await request.request(url, {
method: http.RequestMethod.GET,
... | AST#method_declaration#Left private async getBackupLunarInfo AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi... | private async getBackupLunarInfo(date: Date): Promise<LunarDate> {
try {
const dateStr = this.formatDate(date);
const url = `${this.APIs.backup}?date=${dateStr}`;
const request = http.createHttp();
const response = await request.request(url, {
method: http.RequestMethod.GET,
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/CalendarApiService.ets#L142-L170 | 0e8d1d6adc3562920d52857fb2494f24171711a0 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | @file Preferences 工具类,封装本地轻量级存储(@ohos.data.preferences)。
@author Joker.X | export class PreferencesUtil {
private prefsName: string;
private context: common.Context;
private prefsInstance?: preferences.Preferences;
/**
* 构造函数,保存上下文与文件名
* @param {common.Context} context UIAbility 上下文
* @param {string} prefsName 存储文件名(不含后缀)
*/
constructor(context: common.Context, prefsNam... | AST#export_declaration#Left export AST#class_declaration#Left class PreferencesUtil AST#class_body#Left { AST#property_declaration#Left private prefsName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Lef... | export class PreferencesUtil {
private prefsName: string;
private context: common.Context;
private prefsInstance?: preferences.Preferences;
constructor(context: common.Context, prefsName: string) {
this.context = context;
this.prefsName = prefsName;
}
private async getPrefs(): Promise<prefer... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L9-L126 | 9e64cef7fa87dcb1f5f739aa2a9dc3b5cec98509 | github | |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/media/MediaListVewModel.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/19 22:38
@Version V1.0
@Description | export class MediaListVewModel extends ListViewModel {
private readonly args: MediaListArgs
private lastPage?: FinPage
constructor | AST#export_declaration#Left export AST#ERROR#Left class MediaListVewModel extends AST#type_annotation#Left AST#primary_type#Left ListViewModel AST#primary_type#Right AST#type_annotation#Right { AST#property_declaration#Left private readonly args : AST#type_annotation#Left AST#primary_type#Left MediaListArgs AST#primary... | export class MediaListVewModel extends ListViewModel {
private readonly args: MediaListArgs
private lastPage?: FinPage
constructor | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/media/MediaListVewModel.ets#L12-L18 | 3088ec3ebf3da92f4e759a729db0d6d99ec79dd7 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ClickResponseOptimization/entry/src/main/ets/common/constants/WorldConstants.ets | arkts | SkeletonData for SkeletonView | export const SkeletonData: SkeType[] = [
{
isMine: true,
isFeed: false
},
{
isMine: true,
isFeed: true
},
{
isMine: true,
isFeed: false
},
{
isMine: true,
isFeed: true
},
{
isMine: true,
isFeed: false
},
{
isMine: true,
isFeed: true
},
] | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SkeletonData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SkeType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expre... | export const SkeletonData: SkeType[] = [
{
isMine: true,
isFeed: false
},
{
isMine: true,
isFeed: true
},
{
isMine: true,
isFeed: false
},
{
isMine: true,
isFeed: true
},
{
isMine: true,
isFeed: false
},
{
isMine: true,
isFeed: true
},
] | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/common/constants/WorldConstants.ets#L59-L84 | 555ae1d20e6471f286bb7abb3f7ff9b1fc4a69fa | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | convertError | 设置相应结果JSON异常时是提示错误还是将Response字符串返回
@param isConvert true表示返回Response字符串
@returns | convertError(isConvert: boolean): EfRcp {
efRcpConfig.isConvertError = isConvert;
return this;
} | AST#method_declaration#Left convertError AST#parameter_list#Left ( AST#parameter#Left isConvert : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EfRcp AST#primary_type... | convertError(isConvert: boolean): EfRcp {
efRcpConfig.isConvertError = isConvert;
return this;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L150-L153 | 45de362030cd99444142aeab7ef6eb0d6b7d4c65 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | 大模型配置接口 | export interface LLMConfig {
url: string;
modelName: string;
apiKey: string;
provider: string; // 'openai' | 'anthropic' | 'custom'
isDefault: boolean;
createTime: Date;
updateTime: Date;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LLMConfig AST#object_type#Left { AST#type_member#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left modelName : AST#type_annotation#Left... | export interface LLMConfig {
url: string;
modelName: string;
apiKey: string;
provider: string;
isDefault: boolean;
createTime: Date;
updateTime: Date;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L7-L15 | 9c582e99956f9032cb49f547edd4748a86e47ecc | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/navigation/CommonGraph.ets | arkts | @file 公共模块导航图
@author Joker.X | export class CommonGraph implements RouteGraph {
/**
* 注册公共模块导航路由
*/
register(): void {
RouteBuild.register(CommonRoutes.About, wrapBuilder(AboutNav));
RouteBuild.register(CommonRoutes.Web, wrapBuilder(WebNav));
RouteBuild.register(CommonRoutes.Settings, wrapBuilder(SettingsNav));
RouteBuild.r... | AST#export_declaration#Left export AST#class_declaration#Left class CommonGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册公共模块导航路由
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Lef... | export class CommonGraph implements RouteGraph {
register(): void {
RouteBuild.register(CommonRoutes.About, wrapBuilder(AboutNav));
RouteBuild.register(CommonRoutes.Web, wrapBuilder(WebNav));
RouteBuild.register(CommonRoutes.Settings, wrapBuilder(SettingsNav));
RouteBuild.register(CommonRoutes.User... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/navigation/CommonGraph.ets#L14-L26 | 3557506a8a430029e569f146bbf4920672bf36a3 | github | |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/utils/ICalUtil.ets | arkts | exportToICS | 将事件列表导出为 iCalendar 格式字符串 | static exportToICS(events: EventModel[]): string {
const lines: string[] = []
// iCalendar 文件头
lines.push('BEGIN:VCALENDAR')
lines.push('VERSION:2.0')
lines.push('PRODID:-//Calendar App//HarmonyOS//CN')
lines.push('CALSCALE:GREGORIAN')
lines.push('METHOD:PUBLISH')
// 遍历每个事件
... | AST#method_declaration#Left static exportToICS AST#parameter_list#Left ( AST#parameter#Left events : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EventModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotatio... | static exportToICS(events: EventModel[]): string {
const lines: string[] = []
lines.push('BEGIN:VCALENDAR')
lines.push('VERSION:2.0')
lines.push('PRODID:-//Calendar App//HarmonyOS//CN')
lines.push('CALSCALE:GREGORIAN')
lines.push('METHOD:PUBLISH')
events.forEach((event: E... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/ICalUtil.ets#L12-L69 | 6aa948f2f50986d0ffa1a6c1cb6fa4492e9f3aaf | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ComposeListItem.d.ets | arkts | Declare ContentItem
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare ContentItem
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
Declare ContentItem
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export declare class ContentItem {
/**
* The type of icon.
* @type { ?IconType }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* The type of icon.
* @type { ?IconType }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
/**
* The type o... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ContentItem AST#class_body#Left { /**
* The type of icon.
* @type { ?IconType }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* The type of icon.
* @type { ?IconType }
* @s... | export declare class ContentItem {
iconStyle?: IconType;
icon?: ResourceStr;
symbolStyle?: SymbolGlyphModifier;
primaryText?: ResourceStr;
secondaryText?: ResourceStr;
description?: ResourceStr;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L586-L718 | efc7670318077630a978b12e32f7eb70d9f9534d | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/AboutPage.ets | arkts | AboutHeader | 关于页面头部
@returns {void} 无返回值 | @Builder
private AboutHeader(): void {
Column() {
Image($r("app.media.ic_logo"))
.attributeModifier(size(72))
.objectFit(ImageFit.Contain);
SpaceVerticalSmall();
Text($r("app.string.app_name"))
.fontSize($r("app.float.headline_medium"))
.fontColor($r("app.color.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AboutHeader 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_e... | @Builder
private AboutHeader(): void {
Column() {
Image($r("app.media.ic_logo"))
.attributeModifier(size(72))
.objectFit(ImageFit.Contain);
SpaceVerticalSmall();
Text($r("app.string.app_name"))
.fontSize($r("app.float.headline_medium"))
.fontColor($r("app.color.... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/AboutPage.ets#L71-L97 | 8c55622dede4e60898a0d5bea850ea895b014ea1 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | isAutomaticallyDisableSliceSpacingEnabled | When enabled, slice spacing will be 0.0 when the smallest value is going to be
smaller than the slice spacing itself.
@return
@Override | public isAutomaticallyDisableSliceSpacingEnabled(): boolean {
return this.mAutomaticallyDisableSliceSpacing;
} | AST#method_declaration#Left public isAutomaticallyDisableSliceSpacingEnabled 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#e... | public isAutomaticallyDisableSliceSpacingEnabled(): boolean {
return this.mAutomaticallyDisableSliceSpacing;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L123-L125 | 25013ac9445b848914c0fd57a72740e93b38de3b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationCenterService.ets | arkts | createNotification | 创建新通知 | public createNotification(params: NotificationCreationParams): NotificationItem {
const notification: NotificationItem = {
id: this.generateId(),
type: params.type,
title: params.title,
content: params.content,
priority: params.priority || NotificationPriority.NORMAL,
status: Not... | AST#method_declaration#Left public createNotification AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left NotificationCreationParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ... | public createNotification(params: NotificationCreationParams): NotificationItem {
const notification: NotificationItem = {
id: this.generateId(),
type: params.type,
title: params.title,
content: params.content,
priority: params.priority || NotificationPriority.NORMAL,
status: Not... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L51-L75 | e0a263766549265f00ac6c02a21ba7924c0c2dbd | github |
2763981847/Klotski.git | 35bfb313c07e25ea53d2f4e66df0c441dd51675b | entry/src/main/ets/view/OriginImageDialog.ets | arkts | OriginImageDialog | 使用 @CustomDialog 注解来定义自定义对话框组件 | @CustomDialog
export default struct OriginImageDialog {
// 使用 @Link 注解将组件状态与父组件进行双向绑定
@Link selectedImage: PixelMap // 选中的图像
controller: CustomDialogController // 自定义对话框控制器
// 构建对话框组件的 UI 布局
build() {
Column() { // 创建垂直列布局
Image(this.selectedImage) // 显示选中的图像
.objectFit(ImageFit.Contain) //... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct OriginImageDialog AST#component_body#Left { // 使用 @Link 注解将组件状态与父组件进行双向绑定 AST#ERROR#Left AST#decorator#Left @ Link AST#decorator#Right selectedImage : PixelMap // 选中的图像 controller : CustomDialogController A... | @CustomDialog
export default struct OriginImageDialog {
@Link selectedImage: PixelMap
controller: CustomDialogController
build() {
Column() {
Image(this.selectedImage)
.objectFit(ImageFit.Contain)
.height('80%')
.width('80%')
Button('收起原图')
.onClick(()... | https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/view/OriginImageDialog.ets#L2-L24 | a31e34d90a6a19a3beeeeee95cbf6a6c84c0a1c5 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/objects/HistoryDataSource.ets | arkts | notifyDataReload | 通知LazyForEach组件需要重载所有子组件 | notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/HistoryDataSource.ets#L37-L41 | f39e30e202f1bb4a3ec51e932d08a1cfd8cd282c | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWarmPlayerView.ets | arkts | onStatusDidChange | 观看状态回调
@param player 播放器实例
@param state 状态类型 详见 VHPlayerStatus 的定义. | onStatusDidChange(state: VHPlayerState){
if(state == VHPlayerState.VH_PLAYER_PLAYING){
this.is_start = true;
this.is_playing = true;
this.isLoading = false;
this.isPlayError = false;
}else if(state == VHPlayerState.VH_PLAYER_PAUSE || state == VHPlayerState.VH_PLAYER_STOP || state == VHPl... | AST#method_declaration#Left onStatusDidChange AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left VHPlayerState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui... | onStatusDidChange(state: VHPlayerState){
if(state == VHPlayerState.VH_PLAYER_PLAYING){
this.is_start = true;
this.is_playing = true;
this.isLoading = false;
this.isPlayError = false;
}else if(state == VHPlayerState.VH_PLAYER_PAUSE || state == VHPlayerState.VH_PLAYER_STOP || state == VHPl... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L134-L161 | b942e9089b76fe73dd05615971fd848aeff7d4d6 | gitee |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/index.ets | arkts | util | 工具函数集合
包含 base64、zigzag、WKT JSON 转换等 | export * as util from './util' | AST#export_declaration#Left export * as util from './util' AST#export_declaration#Right | export * as util from './util' | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L99-L99 | cc1e009334683e355e03ec8ea3f1c25f6f2e72d6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x4.ets | arkts | onBirthdayItemClick | 生日项点击事件 | private onBirthdayItemClick(item: any): void {
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'viewContact',
contactId: item.id
}
});
} | AST#method_declaration#Left private onBirthdayItemClick AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary... | private onBirthdayItemClick(item: any): void {
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'viewContact',
contactId: item.id
}
});
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x4.ets#L302-L311 | f7d46b6f188cb98cf53db853ba619c5576ed688a | github |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/route/RoutePath.ets | arkts | 路由表管理 | export class RoutePath {
static readonly LoginPage = "pages/auth/LoginPage"
static readonly WebPage = "pages/WebPage"
static readonly SearchPage = "pages/search/SearchPage"
static readonly RankPage = "pages/myself/rank/RankPage"
static readonly CollectPage = "pages/myself/collect/CollectPage"
static readonl... | AST#export_declaration#Left export AST#class_declaration#Left class RoutePath AST#class_body#Left { AST#property_declaration#Left static readonly LoginPage = AST#expression#Left "pages/auth/LoginPage" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly WebPage = AST#expres... | export class RoutePath {
static readonly LoginPage = "pages/auth/LoginPage"
static readonly WebPage = "pages/WebPage"
static readonly SearchPage = "pages/search/SearchPage"
static readonly RankPage = "pages/myself/rank/RankPage"
static readonly CollectPage = "pages/myself/collect/CollectPage"
static readonl... | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/route/RoutePath.ets#L4-L14 | e7d3d18d96db8c1fc95629081d2ec996e28d0211 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/view/InterceptorPage.ets | arkts | AppCate3 | 基础数据的组件 | @Builder
AppCate3() {
GridRow({ columns: { sm: 8, md: 8, lg: 8 } }) {
/* 性能知识点:当数据量较大时,推荐使用懒加载加载数据。
* 参考使用数据懒加载文章:
* https://gitee.com/harmonyos-cases/cases/blob/master/docs/performance/arkts-performance-improvement-recommendation.md
*/
ForEach(IconList3, (item: IconListsType, ind... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AppCate3 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 GridRow ( AST#component_parameters#Left { AST#component_parameter... | @Builder
AppCate3() {
GridRow({ columns: { sm: 8, md: 8, lg: 8 } }) {
ForEach(IconList3, (item: IconListsType, index) => {
GridCol({ span: { sm: 2, md: 2, lg: 2 } }) {
Column() {
Text(item.num)
.width($r('app.integer.naviagtion_interceptor_cate_img_width'))... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/view/InterceptorPage.ets#L113-L145 | 2d09e9a424866914724cdbba87172db1091b3999 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | sendWelcomeMessage | 发送欢迎消息 | private async sendWelcomeMessage(sessionId: string): Promise<void> {
try {
const context = this.conversations.get(sessionId);
if (!context) return;
const welcomeMessage: ChatMessage = {
id: `msg_${Date.now()}_welcome`,
content: this.generateWelcomeText(context.userProfile),
... | AST#method_declaration#Left private async sendWelcomeMessage AST#parameter_list#Left ( AST#parameter#Left sessionId : 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... | private async sendWelcomeMessage(sessionId: string): Promise<void> {
try {
const context = this.conversations.get(sessionId);
if (!context) return;
const welcomeMessage: ChatMessage = {
id: `msg_${Date.now()}_welcome`,
content: this.generateWelcomeText(context.userProfile),
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L556-L574 | 06be9c707a5060e5f5cc7b546824c6cc91150ec3 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/class.ets | arkts | relaxItemUI | **********放松动作**********// | @Builder
relaxItemUI(name: string, index: number) {
Row() {
Image('/image/home/class1.png')
.width(100)
.height(100)
.margin({ right: 20, bottom: 10 })
Column() {
Text(name)
.margin({ bottom: 20 })
.width('100%')
Text(this.relaxArryCount[inde... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right relaxItemUI 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 index : AST#type_annotation#Left AS... | @Builder
relaxItemUI(name: string, index: number) {
Row() {
Image('/image/home/class1.png')
.width(100)
.height(100)
.margin({ right: 20, bottom: 10 })
Column() {
Text(name)
.margin({ bottom: 20 })
.width('100%')
Text(this.relaxArryCount[inde... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/class.ets#L397-L413 | bd8e6492985e536e925e88f7ff77f64c99b9115f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets | arkts | MoveUpAndFadeOutOptions 点击时图标向上位移淡出动画的参数。 | export class MoveUpAndFadeOutOptions {
transitionInDuration: number = 200; // 入场动画时长
transitionInScale: number = 1.3; // 入场缩放动画比例
transitionInRotateAngle: number = 30; // 入场旋转抖动角度
transitionInRotateCurve: ICurve = curves.springMotion(0.2, 0.3); // 入场旋转抖动动画曲线,使用弹性动画曲线
transitionOutDuration: number = 400; // 出场... | AST#export_declaration#Left export AST#class_declaration#Left class MoveUpAndFadeOutOptions AST#class_body#Left { AST#property_declaration#Left transitionInDuration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right ; A... | export class MoveUpAndFadeOutOptions {
transitionInDuration: number = 200;
transitionInScale: number = 1.3;
transitionInRotateAngle: number = 30;
transitionInRotateCurve: ICurve = curves.springMotion(0.2, 0.3);
transitionOutDuration: number = 400;
transitionOutTranslateY: number = -120;
transitionOu... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets#L43-L51 | 8800aa8432dfebb819b98abd0542b67e0ba97090 | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/BackgroundTaskManagement/ReminderAgentManager/entry/src/main/ets/common/Constant.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Constant {
static readonly PROMPT_DURATION: number = 300
static readonly REMINDER_DURATION: number = 30
static readonly FONT_WEIGHT: number = 400
static readonly VIBRATOR_DURATION: number = 3000
static readonly SECONDS_MILLISECONDS: number = 1000
static readonly ANGLE: number = 360
st... | AST#export_declaration#Left export default AST#class_declaration#Left class Constant AST#class_body#Left { AST#property_declaration#Left static readonly PROMPT_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right... | export default class Constant {
static readonly PROMPT_DURATION: number = 300
static readonly REMINDER_DURATION: number = 30
static readonly FONT_WEIGHT: number = 400
static readonly VIBRATOR_DURATION: number = 3000
static readonly SECONDS_MILLISECONDS: number = 1000
static readonly ANGLE: number = 360
st... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/BackgroundTaskManagement/ReminderAgentManager/entry/src/main/ets/common/Constant.ets#L16-L41 | 13a65a35532e260b7f14c8c42e387900bb90b937 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | The limit line is an additional feature for all Line-, Bar- and
ScatterCharts. It allows the displaying of an additional line in the chart
that marks a certain maximum / limit on the specified axis (x- or y-axis). | export default class LimitLine extends ComponentBase {
/** limit / maximum (the y-value or xIndex) */
private mLimit: number = 0;
/** the width of the limit line */
private mLineWidth: number = 2;
/** the color of the limit line */
private mLineColor: number | string = '#ED5B5B';
/** the style of the l... | AST#export_declaration#Left export default AST#class_declaration#Left class LimitLine extends AST#type_annotation#Left AST#primary_type#Left ComponentBase AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** limit / maximum (the y-value or xIndex) */ AST#property_declaration#Left private mLimit : ... | export default class LimitLine extends ComponentBase {
private mLimit: number = 0;
private mLineWidth: number = 2;
private mLineColor: number | string = '#ED5B5B';
private mTextStyle: Style = Style.FILL_AND_STROKE;
private mLabel: string = '';
private mDashPathEffect: DashPathEffect =... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L26-L200 | a1995f3d796808aea097b767c4e70debac12558b | gitee | |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets | arkts | cancelDialog | When click cancel dialog, this function will be called. | cancelDialog() {
Log.showInfo(TAG, 'cancel form dialog');
} | AST#method_declaration#Left cancelDialog 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 Log AST#expression#Right . showInfo AST#member_expr... | cancelDialog() {
Log.showInfo(TAG, 'cancel form dialog');
} | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets#L176-L178 | 2cf3462c59796d11f13a94fc57deab79b10f971f | gitee |
iamhyc/Aigis.git | 585de9128882d868484438d32832ca9b9b50442d | entry/src/main/ets/components/dialog.ets | arkts | TextInputDialog | Reference: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-modal-dialog-V5 | @Component
export struct TextInputDialog {
@Require @Prop title: ResourceStr
@Require @Prop placeholder: ResourceStr
@State text: string = ''
cancel?: () => void
confirm?: (text: string) => void
build() {
Column({space:10}) {
Text(this.title)
.fontWeight(Fon... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextInputDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Prop AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#... | @Component
export struct TextInputDialog {
@Require @Prop title: ResourceStr
@Require @Prop placeholder: ResourceStr
@State text: string = ''
cancel?: () => void
confirm?: (text: string) => void
build() {
Column({space:10}) {
Text(this.title)
.fontWeight(Fon... | https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/components/dialog.ets#L3-L31 | 0d5e5918b92f33eef192b34af2d8c3fc8ec0f981 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
RowSpaceBetweenCenter() { Text("A"); Text("B"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginV... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#L... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginV... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L444-L459 | 5dc7515042776bbdd23427c1ec1206e993233071 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/Toast.ets | arkts | showDebugMessage | 显示调试消息(仅调试模式)
@param msg 调试消息 | static showDebugMessage(msg: string | Resource | null | undefined): void {
if (!msg || !isDebugMode) return;
promptAction.showToast({
message: `[\uD83D\uDC1EDebugMessage\uD83D\uDC1E] ${msg}`,
duration: 4000 // 4秒
});
} | AST#method_declaration#Left static showDebugMessage AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primar... | static showDebugMessage(msg: string | Resource | null | undefined): void {
if (!msg || !isDebugMode) return;
promptAction.showToast({
message: `[\uD83D\uDC1EDebugMessage\uD83D\uDC1E] ${msg}`,
duration: 4000
});
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/Toast.ets#L29-L37 | 68ba4b777ba8e26aab7887ef90de142927549851 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseOfflineWebComp/entry1/src/main/ets/entry1ability/Entry1Ability.ets | arkts | onWindowStageDestroy | [End entry_ability_window_stage_created_after_page_loaded] | onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources AST#expression_statement... | onWindowStageDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry1/src/main/ets/entry1ability/Entry1Ability.ets#L42-L45 | bb97bec0419c46e039bea8d6806e7e36f3cec290 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/model/ConnectModel.ets | arkts | onConnectRemoteService | 连接远端Service | async onConnectRemoteService(deviceId) {
var that = this
// 连接成功的回调
async function onConnectCallback(element, remote) {
console.log('[handle]connectRemoteService onConnectCallback:' + remote)
that.mRemote = remote
}
// Service异常死亡的回调
function onDisconnectCallback(element) {
co... | AST#method_declaration#Left async onConnectRemoteService AST#parameter_list#Left ( AST#parameter#Left deviceId AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left that = AST#expression#Left AST#as_expression#Left AST... | async onConnectRemoteService(deviceId) {
var that = this
async function onConnectCallback(element, remote) {
console.log('[handle]connectRemoteService onConnectCallback:' + remote)
that.mRemote = remote
}
function onDisconnectCallback(element) {
console.log('[handle]connectR... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/model/ConnectModel.ets#L30-L65 | 6cb9817091200c8bf31baf0a905befc1d0e470ed | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GlobalTypes.ets | arkts | AI模型配置接口 | export interface AIModelConfig {
apiKey: string;
baseUrl: string;
model: string;
temperature?: number;
maxTokens?: number;
timeout?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AIModelConfig AST#object_type#Left { AST#type_member#Left apiKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left baseUrl : AST#type_annotation... | export interface AIModelConfig {
apiKey: string;
baseUrl: string;
model: string;
temperature?: number;
maxTokens?: number;
timeout?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L167-L174 | c3d7e1c12bd1d8fc5dad59831538b3e471cc92c8 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getRadius | @Override | public getRadius(): number {
if (this.mCircleBox == null)
return 0;
else {
return Math.min(this.mCircleBox.width() / 2, this.mCircleBox.height() / 2);
}
} | AST#method_declaration#Left public getRadius AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Le... | public getRadius(): number {
if (this.mCircleBox == null)
return 0;
else {
return Math.min(this.mCircleBox.width() / 2, this.mCircleBox.height() / 2);
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L530-L536 | 7af331d9d7edd844174ada2dcfae237e92f1c54e | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.prompt.d.ets | arkts | showDialog | Displays the dialog box.
@param { ShowDialogOptions } options - Options.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 3
Displays the dialog box.
@param { ShowDialogOptions } options - Options.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | static showDialog(options: ShowDialogOptions): void; | AST#method_declaration#Left static showDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ShowDialogOptions 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#... | static showDialog(options: ShowDialogOptions): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.prompt.d.ets#L424-L424 | 293fc34cd5ae97a9e925cdc2e70a3b05de7e3a59 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/ObservedArray.ets | arkts | ObservedArray | Wraps an array as an observed object
@author huawei | @Observed
export class ObservedArray<T> extends Array<T> {
constructor(args?: T[]) {
if (args instanceof Array) {
super(...args);
} else {
super();
}
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ObservedArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_argumen... | @Observed
export class ObservedArray<T> extends Array<T> {
constructor(args?: T[]) {
if (args instanceof Array) {
super(...args);
} else {
super();
}
}
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ObservedArray.ets#L6-L15 | 15435264474c1da0251a81045ee842da1b0a4d1f | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | get_all_plain_label_link | Get the plain label link array from the cached array.
@returns A string[][] array, cached_plain_bookmarks, which consists of plain label and link pairs.
@example [['bing', 'www.bing.com'], ['loading', 'www.google.com']] | get_all_plain_label_link(): collections.Array<collections.Array<string>> {
if (!this.cached_plain_bookmarks) {
this.reconstruct_cached_plain_bookmarks();
}
return this.cached_plain_bookmarks as collections.Array<collections.Array<string>>;
} | AST#method_declaration#Left get_all_plain_label_link AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left collections . Array AST#qualified_type#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left A... | get_all_plain_label_link(): collections.Array<collections.Array<string>> {
if (!this.cached_plain_bookmarks) {
this.reconstruct_cached_plain_bookmarks();
}
return this.cached_plain_bookmarks as collections.Array<collections.Array<string>>;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L488-L493 | 0eb1c04bf0d34923f84fe327c68ab0228c543488 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/ets/model/AppTime.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,... | export default class AppTime {
bundleName: string //应用的包名
prevAccessTime: number //应用上一次使用时间
totalTime: number //应用总时长
constructor | AST#export_declaration#Left export AST#ERROR#Left default class AppTime { bundleName : AST#ERROR#Left string //应用的包名 prevAccessTime : number //应用上一次使用时间 totalTime : AST#ERROR#Right number AST#ERROR#Right //应用总时长 AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#v... | export default class AppTime {
bundleName: string
prevAccessTime: number
totalTime: number
constructor | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/ets/model/AppTime.ets#L16-L21 | 6da61e4de2c78fe5aca696c2746173fa2a828603 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets | arkts | maximize | [StartExclude recover] | maximize(): void {
try {
if (this.mainWindowClass!.getWindowStatus() === window.WindowStatusType.FLOATING) {
this.mainWindowClass!.maximize()
.then(() => {
hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in maximizing the window.`);
})
.catch((err: Busine... | AST#method_declaration#Left maximize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_s... | maximize(): void {
try {
if (this.mainWindowClass!.getWindowStatus() === window.WindowStatusType.FLOATING) {
this.mainWindowClass!.maximize()
.then(() => {
hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in maximizing the window.`);
})
.catch((err: Busine... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/bptaMultiWindow/entry/src/main/ets/components/WindowUtil.ets#L31-L46 | c76c2e812a8758e0bf98e0c59d60a8b71d6c18b9 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToStream.ets | arkts | createVideoFd | [Start create_file_fd2] 获取保存文件信息并调用Native方法 | async createVideoFd(): Promise<void> {
// 拼接文件路径
this.tmpFileNameThree = systemDateTime.getTime(true) + '.mp4';
// [StartExclude create_file_fd2]
AppStorage.setOrCreate('tmpFileNameThree', this.tmpFileNameThree);
// [EndExclude create_file_fd2]
this.filepath = this.getUIContext().getHostContext(... | AST#method_declaration#Left async createVideoFd AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async createVideoFd(): Promise<void> {
this.tmpFileNameThree = systemDateTime.getTime(true) + '.mp4';
AppStorage.setOrCreate('tmpFileNameThree', this.tmpFileNameThree);
this.filepath = this.getUIContext().getHostContext()?.filesDir + '/' + this.tmpFileNameThree;
hilog.info(0xFF00, CommonC... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToStream.ets#L45-L72 | 96111bbef71fffe75bb09502a513d5850e74df58 | gitee |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/LearnClockApi.type.ets | arkts | 用户打卡记录数据 | export interface UserLearnClockData extends BaseTime {
/**
* 学习打卡id
*/
id: number
/**
* 打卡地点
*/
location: string
/**
* 打卡内容
*/
content: string
/**
* 用户昵称
*/
nickname: string
/**
* 创建时间字符串格式
*/
time: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserLearnClockData AST#extends_clause#Left extends BaseTime AST#extends_clause#Right AST#object_type#Left { /**
* 学习打卡id
*/ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_an... | export interface UserLearnClockData extends BaseTime {
id: number
location: string
content: string
nickname: string
time: string
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/LearnClockApi.type.ets#L57-L80 | cc8a03ffa44503a3bd312ddce399243ee788fa98 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/ContactsPage.ets | arkts | convertDbContactsToPageContacts | 将数据库联系人转换为页面联系人类型 | private convertDbContactsToPageContacts(dbContacts: ContactEntity[]): Contact[] {
return dbContacts.map((dbContact: ContactEntity): Contact => {
const isLunar = dbContact.is_lunar_birthday || false;
const contact: Contact = {
id: String(dbContact.id || 0),
name: dbContact.name,
p... | AST#method_declaration#Left private convertDbContactsToPageContacts AST#parameter_list#Left ( AST#parameter#Left dbContacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContactEntity [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_lis... | private convertDbContactsToPageContacts(dbContacts: ContactEntity[]): Contact[] {
return dbContacts.map((dbContact: ContactEntity): Contact => {
const isLunar = dbContact.is_lunar_birthday || false;
const contact: Contact = {
id: String(dbContact.id || 0),
name: dbContact.name,
p... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ContactsPage.ets#L84-L112 | ecc0fa48b873d59db6416d5950c446c0a53a1374 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | isNotificationEnabledSync | 查询通知是否授权 | static isNotificationEnabledSync(): boolean {
return notificationManager.isNotificationEnabledSync(); //查询通知是否授权。
} | AST#method_declaration#Left static isNotificationEnabledSync 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 A... | static isNotificationEnabledSync(): boolean {
return notificationManager.isNotificationEnabledSync();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L65-L67 | 08eea4d043d8dbb222e31750a03f30d89c172424 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/view/MustLearnPoetry.ets | arkts | MustLearnPoetry | @des 必学古诗组件
@author dxin | @Component
export default struct MustLearnPoetry {
// 数组 HotRecommend
hotRecommendArr: HotRecommend[] = hotRecommend
build() {
// 必学古诗
Column({ space: 5 }) {
Text('必学古诗')
.fontSize(20)
List({ space: 10 }) {
ForEach(this.hotRecommendArr, (item: HotRecommend) => {
Lis... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct MustLearnPoetry AST#component_body#Left { // 数组 HotRecommend AST#property_declaration#Left hotRecommendArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HotRecommend [ ] AST#array_type#... | @Component
export default struct MustLearnPoetry {
hotRecommendArr: HotRecommend[] = hotRecommend
build() {
Column({ space: 5 }) {
Text('必学古诗')
.fontSize(20)
List({ space: 10 }) {
ForEach(this.hotRecommendArr, (item: HotRecommend) => {
ListItem() {
Text... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/view/MustLearnPoetry.ets#L9-L51 | c5bf354e843c20dd282561964e4f06af422a6852 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getNetworkState | 获取网络状态
@param slotId 卡槽ID,如果不指定slotId,默认移动数据的SIM卡。
@returns | static async getNetworkState(slotId?: number): Promise<radio.NetworkState> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //获取默认移动数据的SIM卡。
return radio.getNetworkState(slotId);
} | AST#method_declaration#Left static async getNetworkState AST#parameter_list#Left ( AST#parameter#Left slotId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene... | static async getNetworkState(slotId?: number): Promise<radio.NetworkState> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId();
return radio.getNetworkState(slotId);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L354-L357 | 4f125b9324cd486e2152020d1ece3b2f2c9a948e | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/LinearSearch.ets | arkts | 线性查找算法实现 | export class LinearSearch {
/**
* 标准线性查找
* @param arr 数组
* @param target 目标值
* @returns 目标值在数组中的索引,如果不存在则返回-1
*/
public static search(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
for (let i = 0; i < arr.length; i++) {
if (arr[i] === ta... | AST#export_declaration#Left export AST#class_declaration#Left class LinearSearch AST#class_body#Left { /**
* 标准线性查找
* @param arr 数组
* @param target 目标值
* @returns 目标值在数组中的索引,如果不存在则返回-1
*/ AST#method_declaration#Left public static search AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotati... | export class LinearSearch {
public static search(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
for (let i = 0; i < arr.length; i++) {
if (arr[i] === target) {
return i;
}
}
return -1;
}
public static findAll(arr: number... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/LinearSearch.ets#L4-L125 | d189911e6b94e89bb467778cbd6ffe60373adbd9 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/booksUtils.ets | arkts | getOrder | 校验类型数据查询数组内容 | getOrder(type:string){
return BOOK_SEARCH_TYPE.indexOf(type) ?? 0;
} | AST#method_declaration#Left getOrder AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AS... | getOrder(type:string){
return BOOK_SEARCH_TYPE.indexOf(type) ?? 0;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/booksUtils.ets#L102-L104 | 053934406dfc67fd677592f7cdab22915294ca49 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/pages/home.ets | arkts | reqPermissionsFromUser | 使用UIExtensionAbility:将common.UIAbilityContext 替换为common.UIExtensionContext,进行权限申请 | reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
let g... | AST#method_declaration#Left 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_annotation#Right >... | reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
let grantStatus: Array<number> = data.authResults;
... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/home.ets#L47-L98 | b36b16f6f0cdeacef68df95b667e82415ccb5ef5 | gitee |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Main.ets | arkts | deleteBill | Delete bill method | async deleteBill(billId: string) {
const success = await BillDataManager.deleteBill(billId);
if (success) {
// Reload bill data after deletion
await this.loadBillData();
promptAction.showToast({
message: '删除成功',
duration: 2000
});
} else {
promptAction.showToast... | AST#method_declaration#Left async deleteBill AST#parameter_list#Left ( AST#parameter#Left billId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#... | async deleteBill(billId: string) {
const success = await BillDataManager.deleteBill(billId);
if (success) {
await this.loadBillData();
promptAction.showToast({
message: '删除成功',
duration: 2000
});
} else {
promptAction.showToast({
message: '删除失败,请重试',
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L1598-L1613 | 4b22fb5e193c67071e0f67709db5f2d854e98a45 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | 系统级别和业务自定义级别请求响应码对象(1.0.8+) | export class codeEvent {
/**
* 业务级别自定义错误编码/异常code字段名称
*/
businessCodeName: string = '';
/**
* 请求响应码监听-业务自行处理数据sysCode系统级别编码,busCode业务自定义编码
*/
listener: (sysCode: Object | null, busCode: Object | null) => void = () => {
};
} | AST#export_declaration#Left export AST#class_declaration#Left class codeEvent AST#class_body#Left { /**
* 业务级别自定义错误编码/异常code字段名称
*/ AST#property_declaration#Left businessCodeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' A... | export class codeEvent {
businessCodeName: string = '';
listener: (sysCode: Object | null, busCode: Object | null) => void = () => {
};
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L71-L81 | a35fa79cd9a36e72b990213d42ea8f7379155a0e | gitee | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/NotificationService.ets | arkts | buildNotificationConfig | 构建通知配置 | private buildNotificationConfig(task: Task, type: ReminderType): NotificationConfig {
const dueTime = new Date(task.dueTime);
const timeStr = dueTime.toLocaleTimeString('zh-CN', {
hour: '2-digit',
minute: '2-digit'
});
const dateStr = dueTime.toLocaleDateString('zh-CN', {
month: 'short... | AST#method_declaration#Left private buildNotificationConfig AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left ReminderType... | private buildNotificationConfig(task: Task, type: ReminderType): NotificationConfig {
const dueTime = new Date(task.dueTime);
const timeStr = dueTime.toLocaleTimeString('zh-CN', {
hour: '2-digit',
minute: '2-digit'
});
const dateStr = dueTime.toLocaleDateString('zh-CN', {
month: 'short... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L242-L280 | 9b3869baf9c7f5bf13f6fd515e3f2ebbb9a1147a | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/Utils.ets | arkts | getFilePath | 通过URI或路径,获取文件路径
@param uriOrPath URI或路径
@returns | static getFilePath(uriOrPath: string): string {
return Utils.getFileUri(uriOrPath).path;
} | AST#method_declaration#Left static getFilePath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#primar... | static getFilePath(uriOrPath: string): string {
return Utils.getFileUri(uriOrPath).path;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L70-L72 | 732253b71ddf70e78e094dfa1884d833790928cc | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBar.d.ets | arkts | ToolBarOption | Declare type ToolBarOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare type ToolBarOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
Declare type ToolBarOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | @Observed
export declare class ToolBarOption {
/**
* Define text content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Define text content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
/**
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class ToolBarOption AST#class_body#Left { /**
* Define text content.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Define text con... | @Observed
export declare class ToolBarOption {
content: ResourceStr;
action?: () => void;
icon?: Resource;
state?: ItemState;
textColor?: ResourceColor;
activatedTextColor?: ResourceColor;
iconColor?: ResourceColor;
activatedIconColor?: Resourc... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L180-L379 | 576821421a33541aaf72868c14920021065dc5fc | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ComposeTitleBar.d.ets | arkts | ComposeTitleBar | Declaration of the composable title bar.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the composable title bar.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
Declaration of the composable title bar.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@s... | @Component
export declare struct ComposeTitleBar {
/**
* Avatar resource and event callback of this title bar.
* @type { ?ComposeTitleBarMenuItem }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Avatar resource and event callback of this title bar.
* @type { ?ComposeTitleBarM... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ComposeTitleBar AST#component_body#Left { /**
* Avatar resource and event callback of this title bar.
* @type { ?ComposeTitleBarMenuItem }.
* @syscap SystemCapability.Ar... | @Component
export declare struct ComposeTitleBar {
item?: ComposeTitleBarMenuItem;
title: ResourceStr;
subtitle?: ResourceStr;
menuItems?: Array<ComposeTitleBarMenuItem>;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets#L229-L322 | 85cb6170c1b28c52239d113b15d96ccf0c6174be | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/OrderRepository.ets | arkts | refundOrder | 申请订单退款
@param params 退款请求参数
@returns 是否成功 | async refundOrder(params: RefundOrderRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.refundOrder(params);
} | AST#method_declaration#Left async refundOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left RefundOrderRequest 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... | async refundOrder(params: RefundOrderRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.refundOrder(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L56-L58 | 11e91e14ad0ff84948cc1860a3bed677888561d6 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/AgentService.ets | arkts | processUserInput | Process user input through DeepSeek API
This is the main entry point for the Agent's "thinking"
@param userInput - Natural language input from user
@returns Response message from the agent | async processUserInput(userInput: string): Promise<string> {
try {
console.info(`[AgentService] Processing user input: ${userInput}`);
// 预处理:识别助手模式关键词并增强提示
const enhancedInput = this.enhanceInputWithModeHint(userInput);
// Add user message to conversation history
const userMessage: ... | AST#method_declaration#Left async processUserInput AST#parameter_list#Left ( AST#parameter#Left userInput : 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_t... | async processUserInput(userInput: string): Promise<string> {
try {
console.info(`[AgentService] Processing user input: ${userInput}`);
const enhancedInput = this.enhanceInputWithModeHint(userInput);
const userMessage: ChatMessage = {
role: 'user',
content: enhancedI... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/AgentService.ets#L236-L261 | 9d7b9729f41147703ea36e2e633de12962a6f88b | github |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/FileManager.ets | arkts | exportFile | 导出文件
@param content 文件内容
@param fileName 文件名 | async exportFile(content: string, fileName: string): Promise<boolean> {
try {
console.info('📤 开始导出文件:', fileName)
console.info('📝 内容长度:', content.length, 'bytes')
console.info('📝 内容预览:', content.substring(0, 200))
// 创建文档保存选择器
const documentSaveOptions = new picker.DocumentSa... | AST#method_declaration#Left async exportFile AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | async exportFile(content: string, fileName: string): Promise<boolean> {
try {
console.info('📤 开始导出文件:', fileName)
console.info('📝 内容长度:', content.length, 'bytes')
console.info('📝 内容预览:', content.substring(0, 200))
const documentSaveOptions = new picker.DocumentSaveOptions()
... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/FileManager.ets#L26-L68 | 4f3f03c45afd10cb82535f51e50e5a4d61154a1c | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/NavigationService.ets | arkts | 设置全局导航栈实例(在 NavigationHost aboutToAppear 中调用)
@param {NavPathStack} stack - 导航栈实例
@returns {void} 无返回值 | export function setNavPathStack(stack: NavPathStack): void {
globalNavStack = stack;
} | AST#export_declaration#Left export AST#function_declaration#Left function setNavPathStack AST#parameter_list#Left ( AST#parameter#Left stack : AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation... | export function setNavPathStack(stack: NavPathStack): void {
globalNavStack = stack;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L28-L30 | cd0ab8ff7d80ec32e0cf77c3a3aae647b3d8808f | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/services/CartService.ets | arkts | getTotalQuantity | 获取购物车商品总数(件数) | getTotalQuantity(): number {
return this.cartItems.reduce((sum, item) => sum + item.quantity, 0);
} | AST#method_declaration#Left getTotalQuantity AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressio... | getTotalQuantity(): number {
return this.cartItems.reduce((sum, item) => sum + item.quantity, 0);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L116-L118 | fcd6a0f3275f77cff9bc47baed486eacf552427b | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | MultipleImage/entry/src/main/ets/pages/Index.ets | arkts | progressComponent | DocsCode 2 [Start progress_component] | @Builder
progressComponent() {
Row({ space: 5 }) {
ForEach(this.progressData, (item: PhotoData, index: number) => {
Stack({ alignContent: Alignment.Start }) {
Row()
.zIndex(1)
.width(this.currentIndex >= index && !this.slide ? '100%' : '0')
.height(2)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right progressComponent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_para... | @Builder
progressComponent() {
Row({ space: 5 }) {
ForEach(this.progressData, (item: PhotoData, index: number) => {
Stack({ alignContent: Alignment.Start }) {
Row()
.zIndex(1)
.width(this.currentIndex >= index && !this.slide ? '100%' : '0')
.height(2)
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/MultipleImage/entry/src/main/ets/pages/Index.ets#L60-L93 | 70d58795586901b38e269627e06c907386f05339 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringEncrypt.ets | arkts | uint8ArrayToString | Uint8Array转字符串
@param arr 要转换的Uint8Array
@returns 字符串 | private uint8ArrayToString(data: Uint8Array): string {
// let str = '';
// for (let i = 0; i < data.length; i++) {
// str += String.fromCharCode(data[i]);
// }
// return decodeURIComponent(escape(str)); // 关键转换步骤
// const decoder = util.TextDecoder.create('utf-8', {
// fatal: false,
... | AST#method_declaration#Left private uint8ArrayToString AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST... | private uint8ArrayToString(data: Uint8Array): string {
);
return buffer.from(data.buffer).toString('utf-8');
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L146-L160 | 3925e8e65b466239c9498e50278e2acabc802782 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | 网络监听emitter事件 | export enum NetworkEventName {
// 注册网络监听订阅事件
NetObserverRegister,
// 网络可用
NetAvailable,
// 网络阻塞
NetBlock,
// 网络丢失/断开
NetLost,
// 当网络能力变化时,如网络从无网络到有网络、从4G切换到5G
NetCapabilitiesChange,
// 网络不可用
NetUnavailable,
// WIFI状态改变
WifiStateChange,
// WIFI连接状态改变
WifiConnectionChange,
// 弱网
WeakNe... | AST#export_declaration#Left export AST#enum_declaration#Left enum NetworkEventName AST#enum_body#Left { // 注册网络监听订阅事件 AST#enum_member#Left NetObserverRegister AST#enum_member#Right , // 网络可用 AST#enum_member#Left NetAvailable AST#enum_member#Right , // 网络阻塞 AST#enum_member#Left NetBlock AST#enum_member#Right , // 网络丢失/断... | export enum NetworkEventName {
NetObserverRegister,
NetAvailable,
NetBlock,
NetLost,
NetCapabilitiesChange,
NetUnavailable,
WifiStateChange,
WifiConnectionChange,
WeakNet,
NetConnectionPropertiesChange
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L29-L50 | b63fb69e4811767b5cfdf435e50bbba8a4bf50de | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | pushData | 添加数据。
@param {CustomDataType} data - 需要添加的数据。 | public pushData(data: CustomDataType[]): void {
if (Array.isArray(data)) {
for (let i = 0; i < CONTENT_PER_TAG; ++i) {
this.dataArray.push(data[i]);
}
}
this.notifyDataAdd(this.dataArray.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CustomDataType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation... | public pushData(data: CustomDataType[]): void {
if (Array.isArray(data)) {
for (let i = 0; i < CONTENT_PER_TAG; ++i) {
this.dataArray.push(data[i]);
}
}
this.notifyDataAdd(this.dataArray.length - 1);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L186-L193 | d1bf5cb4a0199a10c0fa308d98995184f9bb0cbe | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Share item animation duration. | export const SHARE_ITEM_DURATION = 1000; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SHARE_ITEM_DURATION = AST#expression#Left 1000 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const SHARE_ITEM_DURATION = 1000; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L115-L115 | 72493b131a368f3bd245a819549c68baabb38773 | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/localization/I18nManager.ets | arkts | setLanguage | 设置语言 | async setLanguage(language: Language): Promise<void> {
try {
this.currentLanguage = language;
await StorageManager.setString(this.LANGUAGE_KEY, language);
EventBus.emit('LANGUAGE_CHANGED', { language });
Logger.info('I18nManager', `Language changed to: ${language}`);
} catch (error) {
... | AST#method_declaration#Left async setLanguage AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left Language 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#... | async setLanguage(language: Language): Promise<void> {
try {
this.currentLanguage = language;
await StorageManager.setString(this.LANGUAGE_KEY, language);
EventBus.emit('LANGUAGE_CHANGED', { language });
Logger.info('I18nManager', `Language changed to: ${language}`);
} catch (error) {
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/localization/I18nManager.ets#L78-L87 | 2b9bc1a990f1fdeb183d79847053c3d3e7d1f88a | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/pages/AcademyPage.ets | arkts | getMethodologiesByTab | 工具方法 | getMethodologiesByTab(tab: string): MethodologyItem[] {
switch (tab) {
case 'basic':
return this.methodologies.basic;
case 'advanced':
return this.methodologies.advanced;
case 'expert':
return this.methodologies.expert;
case 'custom':
return this.methodologies... | AST#method_declaration#Left getMethodologiesByTab AST#parameter_list#Left ( AST#parameter#Left tab : 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 ... | getMethodologiesByTab(tab: string): MethodologyItem[] {
switch (tab) {
case 'basic':
return this.methodologies.basic;
case 'advanced':
return this.methodologies.advanced;
case 'expert':
return this.methodologies.expert;
case 'custom':
return this.methodologies... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/pages/AcademyPage.ets#L978-L990 | 99baa1fa1430b781809bb7df7cec6548a5e62d15 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/BarChartRenderer.ets | arkts | private width:number = 0; private height:number = 0; private singleWidth:number = 0; private marginCount:number = 12; private marginRight:number = 0; private count :number = 0; | constructor(chart: BarDataProvider, animator: ChartAnimator, viewPortHandler: ViewPortHandler) {
super(animator, viewPortHandler);
this.mChart = chart;
this.mHighlightPaint = new Paint();
this.mHighlightPaint.setStyle(Style.FILL);
this.mHighlightPaint.setColor(Color.Black);
// set alpha after c... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left chart : AST#type_annotation#Left AST#primary_type#Left BarDataProvider AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animator : AST#type_annotation#Left AST#primary_type#Left ChartAnimat... | constructor(chart: BarDataProvider, animator: ChartAnimator, viewPortHandler: ViewPortHandler) {
super(animator, viewPortHandler);
this.mChart = chart;
this.mHighlightPaint = new Paint();
this.mHighlightPaint.setStyle(Style.FILL);
this.mHighlightPaint.setColor(Color.Black);
this.mHighlight... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BarChartRenderer.ets#L57-L72 | eb0577a12767792c31c7b119a80c3ef4d437f9b2 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/footprint/FootprintLocalDataSource.ets | arkts | @file 用户足迹本地数据源接口
@author Joker.X | export interface FootprintLocalDataSource {
/**
* 添加足迹记录
* @param {Footprint} footprint 足迹记录
* @returns {Promise<void>} Promise<void>
*/
addFootprint(footprint: Footprint): Promise<void>;
/**
* 根据商品ID删除足迹记录
* @param {number} goodsId 商品ID
* @returns {Promise<void>} Promise<void>
*/
remov... | AST#export_declaration#Left export AST#interface_declaration#Left interface FootprintLocalDataSource AST#object_type#Left { /**
* 添加足迹记录
* @param {Footprint} footprint 足迹记录
* @returns {Promise<void>} Promise<void>
*/ AST#type_member#Left addFootprint AST#parameter_list#Left ( AST#parameter#Left footprint : ... | export interface FootprintLocalDataSource {
addFootprint(footprint: Footprint): Promise<void>;
removeFootprint(goodsId: number): Promise<void>;
clearAllFootprints(): Promise<void>;
getAllFootprints(): Promise<Footprint[]>;
getFootprintCount(): Promise<number>;
getRecentFootprints(limi... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSource.ets#L7-L53 | f5d8eea87452bcf93611eac452102040b9c8bf69 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/timer/TimerComponent.ets | arkts | resumeTimer | 继续计时(从暂停状态恢复,根据当前模式决定递增或递减) | private resumeTimer() {
if (this.isRunning) {
return;
}
this.isRunning = true;
this.isPaused = false;
if (this.isIncrementing) {
this.statusPrompt = '超时,' + "开始正向计时";
this.statusPromptColor = Color.Red;
} else {
this.statusPrompt = this.getTimePrompt() + "倒计时进行中...";
... | AST#method_declaration#Left private resumeTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isRunning AST#member_expression#Right AST#expressio... | private resumeTimer() {
if (this.isRunning) {
return;
}
this.isRunning = true;
this.isPaused = false;
if (this.isIncrementing) {
this.statusPrompt = '超时,' + "开始正向计时";
this.statusPromptColor = Color.Red;
} else {
this.statusPrompt = this.getTimePrompt() + "倒计时进行中...";
... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L100-L144 | 6037423c47f841d9da8093b94a689879699e8c71 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/ImageUtil.ets | arkts | pickerSaveGallery | 保存图片到图库
@param buffer 图片buffer
@returns 保存结果 | static async pickerSaveGallery(buffer: ArrayBuffer): Promise<OutDTO<string>> {
const context = getContext();
let helper = photoAccessHelper.getPhotoAccessHelper(context);
// onClick触发后10秒内通过createAsset接口创建图片文件,10秒后createAsset权限收回。
let uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'pn... | AST#method_declaration#Left static async pickerSaveGallery AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST... | static async pickerSaveGallery(buffer: ArrayBuffer): Promise<OutDTO<string>> {
const context = getContext();
let helper = photoAccessHelper.getPhotoAccessHelper(context);
let uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'png');
let file = await fileIo.open(uri, fileIo.Open... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L76-L89 | 71e9476e3e42be145518ada83d4a6c15bda8e08a | gitee |
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git | 3b5fa45c650dcae2773a19f122161935e0c0e2bc | entry/src/main/ets/entryability/EntryAbility.ets | arkts | updateWindowSize | Visible window size listener. | private updateWindowSize(windowSize: window.Size | window.Rect): void {
try {
let appWindowSize: window.Size | undefined = AppStorage.get('windowSize');
if (!appWindowSize || appWindowSize.width !== windowSize.width || appWindowSize.height !== windowSize.height) {
AppStorage.setOrCreate('windowS... | AST#method_declaration#Left private updateWindowSize AST#parameter_list#Left ( AST#parameter#Left windowSize : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . Size AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left window .... | private updateWindowSize(windowSize: window.Size | window.Rect): void {
try {
let appWindowSize: window.Size | undefined = AppStorage.get('windowSize');
if (!appWindowSize || appWindowSize.width !== windowSize.width || appWindowSize.height !== windowSize.height) {
AppStorage.setOrCreate('windowS... | https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/entryability/EntryAbility.ets#L56-L75 | 1e54b457a827d4ddc6255e4f993bb9ae8c7d2156 | github |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | RemindContent | export const GET_UP_TASK_NAME: string = '早起'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GET_UP_TASK_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '早起' AST#expression#Right AST#variable_declarator#Right ; AST#variable_decla... | export const GET_UP_TASK_NAME: string = '早起'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L146-L146 | 4812a596fa1b8f8a02de39d9be7f15c4991f3414 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | learnedWordsWhenReview | /获取某天的已经复习words | learnedWordsWhenReview(dayOf: DayOf): WordUser[] {
let distances = dayOf.distances(true);
return this.learnedWordsFor(dayOf, distances);
} | AST#method_declaration#Left learnedWordsWhenReview AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Lef... | learnedWordsWhenReview(dayOf: DayOf): WordUser[] {
let distances = dayOf.distances(true);
return this.learnedWordsFor(dayOf, distances);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L368-L371 | db4c531b10792116258b62b2145c3207ccb43ed4 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | buildUpcomingBirthdaysList | 构建即将到来的生日列表 | @Builder
buildUpcomingBirthdaysList() {
if (this.upcomingBirthdays.length === 0) {
BirthdaysEmptyView({ timeRange: '近期' })
} else {
Scroll() {
Column({ space: 8 }) {
ForEach(this.upcomingBirthdays, (contact: Contact) => {
this.buildBirthdayCard(contact)
})
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUpcomingBirthdaysList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#memb... | @Builder
buildUpcomingBirthdaysList() {
if (this.upcomingBirthdays.length === 0) {
BirthdaysEmptyView({ timeRange: '近期' })
} else {
Scroll() {
Column({ space: 8 }) {
ForEach(this.upcomingBirthdays, (contact: Contact) => {
this.buildBirthdayCard(contact)
})
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L453-L468 | aaa366a0a6bb176840ef7a072f93336ce9473c53 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.