nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/data/FestivalData.ets | arkts | isLegalHoliday | 判断指定日期是否为法定节假日
优化版本:使用缓存提升查询性能 | public static isLegalHoliday(year: number, month: number, day: number): boolean {
const cacheKey = `legal-${year}-${month}-${day}`;
// 检查缓存
if (FestivalData.legalHolidayCache.has(cacheKey)) {
return FestivalData.legalHolidayCache.get(cacheKey)!;
}
// 计算是否为法定节假日
const festivals = ... | AST#method_declaration#Left public static isLegalHoliday AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#p... | public static isLegalHoliday(year: number, month: number, day: number): boolean {
const cacheKey = `legal-${year}-${month}-${day}`;
if (FestivalData.legalHolidayCache.has(cacheKey)) {
return FestivalData.legalHolidayCache.get(cacheKey)!;
}
const festivals = FestivalData.getFest... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData.ets#L276-L297 | 2daacb22bd3dc862d336fd757ffcb57dcfddc2c4 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsInfoCard.ets | arkts | CouponTag | 优惠券标签
@param {Coupon} coupon - 优惠券信息
@returns {void} 无返回值 | @Builder
private CouponTag(coupon: Coupon): void {
Row() {
CommonIcon({
icon: $r("app.media.ic_coupon"),
iconSize: 14,
tintColor: $r("app.color.danger")
});
SpaceHorizontalXSmall();
Text($r(
"app.string.coupon_text",
coupon.condition?.fullAmount ??... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CouponTag AST#parameter_list#Left ( AST#parameter#Left coupon : AST#type_annotation#Left AST#primary_type#Left Coupon AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation... | @Builder
private CouponTag(coupon: Coupon): void {
Row() {
CommonIcon({
icon: $r("app.media.ic_coupon"),
iconSize: 14,
tintColor: $r("app.color.danger")
});
SpaceHorizontalXSmall();
Text($r(
"app.string.coupon_text",
coupon.condition?.fullAmount ??... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsInfoCard.ets#L132-L169 | ae182e1c1c88e8a9c0cc6e9e250c8e4784e9dc32 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdialog/src/main/ets/view/CustomDialog.ets | arkts | aboutToAppear | 初始化SubWindowApi对象 | aboutToAppear() {
if (this.windowStage) {
this.SubWindowApi = new api.SubWindowApi();
}
showApiSubWindow(this.SubWindowApi, this.windowStage);
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowStage AST#member_expression#Right AS... | aboutToAppear() {
if (this.windowStage) {
this.SubWindowApi = new api.SubWindowApi();
}
showApiSubWindow(this.SubWindowApi, this.windowStage);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/view/CustomDialog.ets#L31-L36 | 5966a663f5603300d9756eafb182a6757d8a24e3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/sharebutton/Index.ets | arkts | ShareButton | 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 { ShareButton } from './src/main/ets/components/ShareButton'; | AST#export_declaration#Left export { ShareButton } from './src/main/ets/components/ShareButton' ; AST#export_declaration#Right | export { ShareButton } from './src/main/ets/components/ShareButton'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/Index.ets#L15-L15 | bda70906397d48d6ac96fdcc9bcb61cd94e3a870 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/loading/PageLoading.ets | arkts | PageLoading | @file 页面级 Loading 组件
@author Joker.X | @ComponentV2
export struct PageLoading {
/**
* 加载提示文案
*/
@Param
text: string = "加载中...";
/**
* 构建页面级 Loading 视图
* @returns {void} 无返回值
*/
build(): void {
Column() {
Loading();
SpaceVerticalMedium();
Text(this.text);
}
.width(P100)
.height(P100)
.justifyCon... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct PageLoading AST#component_body#Left { /**
* 加载提示文案
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | @ComponentV2
export struct PageLoading {
@Param
text: string = "加载中...";
build(): void {
Column() {
Loading();
SpaceVerticalMedium();
Text(this.text);
}
.width(P100)
.height(P100)
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center);
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/loading/PageLoading.ets#L9-L32 | aeeeaea7d12e6232e310f357657d7d2cceb31733 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | SimpleTimerCountDown.ets | export class SimpleTimerCountDown {
private refreshFrequency: number = 100; // 刷新频率100ms
private totalMs: number = 0; // 总时长(毫秒)
private remainMs: number = 0; // 剩余时间(毫秒)
private active: boolean = false; // 是否活跃
private paused: boolean = false; //... | AST#export_declaration#Left export AST#class_declaration#Left class SimpleTimerCountDown AST#class_body#Left { AST#property_declaration#Left private refreshFrequency : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; ... | export class SimpleTimerCountDown {
private refreshFrequency: number = 100;
private totalMs: number = 0;
private remainMs: number = 0;
private active: boolean = false;
private paused: boolean = false;
private callback: ((remainMs: number) =... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L2-L142 | 5caf17c2aedefc594752d8232313c23f00f7c42a | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | getString | 获取指定资源对应的字符串
@param res | static getString(res: Resource): string {
return Helper.getResourceManager().getStringSync(res);
} | AST#method_declaration#Left static getString AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static getString(res: Resource): string {
return Helper.getResourceManager().getStringSync(res);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L123-L125 | 875c7de157eadad16763fe0386c9a90e3e9b947f | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/datastore/src/main/ets/datasource/account/AccountStoreDataSourceImpl.ets | arkts | setAccount | 保存账号
@param {string} account 用户账号
@returns {Promise<void>} Promise<void> | async setAccount(account: string): Promise<void> {
await this.prefs.set(AccountStoreDataSourceImpl.KEY_ACCOUNT, account);
} | AST#method_declaration#Left async setAccount AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left... | async setAccount(account: string): Promise<void> {
await this.prefs.set(AccountStoreDataSourceImpl.KEY_ACCOUNT, account);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/datastore/src/main/ets/datasource/account/AccountStoreDataSourceImpl.ets#L42-L44 | cd805bc111175e4b6cf8759af96f809c33556643 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/highlight/Highlight.ets | arkts | setDraw | Sets the x- and y-position (pixels) where this highlight was last drawn.
@param x
@param y | public setDraw(x: number, y: number): void {
this.mDrawX = x;
this.mDrawY = y;
} | AST#method_declaration#Left public setDraw AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST... | public setDraw(x: number, y: number): void {
this.mDrawX = x;
this.mDrawY = y;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/Highlight.ets#L166-L169 | 1127bf25aeb6a7f9d029d7538a80f13d206ec163 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | Created by philipp on 12/06/15. | export default abstract class ChartTouchListener<T extends Chart<ChartData<IDataSet<EntryOhos>>>> {
/**
* the last touch gesture that has been performed
**/
public mLastGesture: ChartGesture = ChartGesture.NONE;
// states
protected static NONE: number = 0;
protected static DRAG: number = 1;
protected ... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class ChartTouchListener AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Chart AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#gen... | export default abstract class ChartTouchListener<T extends Chart<ChartData<IDataSet<EntryOhos>>>> {
public mLastGesture: ChartGesture = ChartGesture.NONE;
protected static NONE: number = 0;
protected static DRAG: number = 1;
protected static X_ZOOM: number = 2;
protected static Y_ZOOM: number = 3;
pro... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/ChartTouchListener.ets#L32-L181 | 50139600cd2c9a4d70188751641abdb02441b81b | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeCouponSection.ets | arkts | couponCard | 构建优惠券卡片内容
@param {Coupon} coupon - 优惠券信息
@returns {void} 无返回值 | @Builder
private couponCard(coupon: Coupon): void {
RowStartCenter({ widthValue: P100 }) {
Row() {
Image($r("app.media.ic_coupon"))
.fillColor($r("app.color.text_primary"))
.attributeModifier(size(18));
}
.padding($r("app.float.space_padding_small_x"))
.backgrou... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private couponCard AST#parameter_list#Left ( AST#parameter#Left coupon : AST#type_annotation#Left AST#primary_type#Left Coupon AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotatio... | @Builder
private couponCard(coupon: Coupon): void {
RowStartCenter({ widthValue: P100 }) {
Row() {
Image($r("app.media.ic_coupon"))
.fillColor($r("app.color.text_primary"))
.attributeModifier(size(18));
}
.padding($r("app.float.space_padding_small_x"))
.backgrou... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCouponSection.ets#L55-L75 | 635aca11a11f4ad0ca1d05634fc38fb7cfa260e3 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/SingleTitle.ets | arkts | SingleTitle | Single line title, fixed content | @Component
export struct SingleTitle {
private TAG: string = 'SingleTitle';
@Link actionBarProp: ActionBarProp;
private onBuildDone(): void {
Log.info(this.TAG, 'onBuildDone, title: ' + this.actionBarProp.getTitle());
}
build() {
Row() {
Text(this.actionBarProp.getTitle() as string)
.f... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SingleTitle AST#component_body#Left { AST#property_declaration#Left private TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'SingleTit... | @Component
export struct SingleTitle {
private TAG: string = 'SingleTitle';
@Link actionBarProp: ActionBarProp;
private onBuildDone(): void {
Log.info(this.TAG, 'onBuildDone, title: ' + this.actionBarProp.getTitle());
}
build() {
Row() {
Text(this.actionBarProp.getTitle() as string)
.f... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/SingleTitle.ets#L21-L48 | 2f04e92a3c5da1a718a5a089084dac36bad46f7e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets | arkts | aboutToAppear | 列表当前索引值 | async aboutToAppear() {
// 视频列表数据初始化
NEWS_LIST_DATA.forEach((news: NewsItem) => {
this.newsList.pushData(news);
})
// 获取列表的长度
this.arrayLength = this.newsList.totalCount();
// 设置播放状态
this.setCompleteCallback(() => {
logger.info('completed state called')
this.isPlaying = !t... | AST#method_declaration#Left async aboutToAppear 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 NEWS_LIST_DATA AST#expression#R... | async aboutToAppear() {
NEWS_LIST_DATA.forEach((news: NewsItem) => {
this.newsList.pushData(news);
})
this.arrayLength = this.newsList.totalCount();
this.setCompleteCallback(() => {
logger.info('completed state called')
this.isPlaying = !this.isPlaying
});
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L58-L75 | 4b6614a61887bc4f356e40dddc7859a8bcac96d2 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Alarm/AlarmManager.ets | arkts | getSavedReminderId | 获取保存的提醒ID | private async getSavedReminderId(): Promise<number | null> {
if (!this.prefs) throw new Error('Preferences未初始化');
const id = await this.prefs.get('reminderId', null);
return typeof id === 'number' ? id : null;
}
// 设置系统提醒(核心方法)
async setReminder(date: Date): Promise<void> {
try {
if (!this.... | AST#method_declaration#Left private async getSavedReminderId 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#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AS... | private async getSavedReminderId(): Promise<number | null> {
if (!this.prefs) throw new Error('Preferences未初始化');
const id = await this.prefs.get('reminderId', null);
return typeof id === 'number' ? id : null;
}
async setReminder(date: Date): Promise<void> {
try {
if (!this.isReminderEnabl... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/AlarmManager.ets#L59-L71 | 7b376e75c29329835f87ee538cb68061b4561f85 | github |
hackeris/HiSH | 6485c7b24ee47727fe464dc3a69484f44689e85b | entry/src/main/ets/lib/QemuAgent.ets | arkts | 具体业务接口定义 | export interface QGANetworkAddress {
'ip-address': string
'ip-address-type': string
prefix: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface QGANetworkAddress AST#object_type#Left { AST#ERROR#Left 'ip-address' : string 'ip-address-type' : string prefix : number AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right | export interface QGANetworkAddress {
'ip-address': string
'ip-address-type': string
prefix: number
} | https://github.com/hackeris/HiSH/blob/6485c7b24ee47727fe464dc3a69484f44689e85b/entry/src/main/ets/lib/QemuAgent.ets#L42-L46 | c1d55fe9b5e9bcccabb0589c23b0a6ce654cb4cf | gitee | |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Service/DMPWorkerWrapper.ets | arkts | sendRequestToWorker | 发送请求的通用函数 | sendRequestToWorker(command: string, payload: Payload) {
return new Promise<CallerReturnType>((resolve, reject) => {
let message: WorkerRequest = new WorkerRequest(command, payload);
this.pendingRequests.set('', { resolve, reject });
this.w.postMessageWithSharedSendable(message);
});
} | AST#method_declaration#Left sendRequestToWorker AST#parameter_list#Left ( AST#parameter#Left command : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left payload : AST#type_annotation#Left AST#primary_type#Left Payload AST#prim... | sendRequestToWorker(command: string, payload: Payload) {
return new Promise<CallerReturnType>((resolve, reject) => {
let message: WorkerRequest = new WorkerRequest(command, payload);
this.pendingRequests.set('', { resolve, reject });
this.w.postMessageWithSharedSendable(message);
});
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Service/DMPWorkerWrapper.ets#L57-L63 | 2f90cf1d8b77fc679baf46f3bffcf9e9cb43c034 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/template/ZLifecycleObserver.ets | arkts | onPageShow | @Entry页面的生命周期函数 | onPageShow(): void {
} | AST#method_declaration#Left onPageShow 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#builder_function_body#Right AST#method_declaration#Right | onPageShow(): void {
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/template/ZLifecycleObserver.ets#L23-L24 | c273aad399737ccea0c1e5de98135c8817e885ad | gitee |
yinxing2008/news.git | a2f418bd3c24c73a09f30b9343f1a58434c125c6 | news_client/news_hongmeng_ArkTS/entry/src/main/ets/data/Note.ets | arkts | 厦门大学计算机专业 | 前华为工程师
专注《零基础学编程系列》 http://lblbc.cn/blog
包含:Java | 安卓 | 前端 | Flutter | iOS | 小程序 | 鸿蒙
公众号:蓝不蓝编程 | export class Note {
private id: string;
private name: string = '';
public getId() {
return this.id
}
public setId(id: string) {
this.id = id
}
public getName() {
return this.name
}
public setName(name: string) {
this.name = name
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Note AST#class_body#Left { AST#property_declaration#Left private id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private name : A... | export class Note {
private id: string;
private name: string = '';
public getId() {
return this.id
}
public setId(id: string) {
this.id = id
}
public getName() {
return this.name
}
public setName(name: string) {
this.name = name
}
} | https://github.com/yinxing2008/news.git/blob/a2f418bd3c24c73a09f30b9343f1a58434c125c6/news_client/news_hongmeng_ArkTS/entry/src/main/ets/data/Note.ets#L7-L26 | 1998525263a4a17b307232a3a643ff8fedf7fd99 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets | arkts | getSound | 获取声音,如果不存在会自动启动下载流程
@param text 文本内容
@param downloadIfNotExists 如果不存在是否下载
@param alsoGenerate 如果下载失败是否生成
@returns 返回声音数据或null | async getSound(text: string, downloadIfNotExists: boolean = true, alsoGenerate: boolean = true): Promise<CDBSound | null> {
// 先从数据库查询
const sound = await CSoundDbAccessor.shared.getByLangAndText(lang_en_us, text)
if (sound) {
DebugLog.d(`getSound: ${text} from db`);
return sound;
}
if ... | AST#method_declaration#Left async getSound 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 downloadIfNotExists : AST#type_annotation#Left AST#primary_type#Left boolean AST#... | async getSound(text: string, downloadIfNotExists: boolean = true, alsoGenerate: boolean = true): Promise<CDBSound | null> {
const sound = await CSoundDbAccessor.shared.getByLangAndText(lang_en_us, text)
if (sound) {
DebugLog.d(`getSound: ${text} from db`);
return sound;
}
if (downloadI... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundManager.ets#L65-L87 | f202c197e7b4cd9411c6ba735c97b1f42ad9d6cc | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/empty/Empty.ets | arkts | buildImage | 构建占位图
@returns {void} 无返回值 | @Builder
private buildImage(): void {
Image(this.imageRes)
.fillColor($r("app.color.empty_tint"))
.height(140);
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildImage 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_el... | @Builder
private buildImage(): void {
Image(this.imageRes)
.fillColor($r("app.color.empty_tint"))
.height(140);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/empty/Empty.ets#L80-L85 | 514d3b1641cd877a39aeb52b8bc791e193879f9d | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DeviceUtils.ets | arkts | isStandby | 检测当前设备是否进入待机低功耗续航模式。
@returns | static isStandby(): boolean {
return power.isStandby();
} | AST#method_declaration#Left static isStandby AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressi... | static isStandby(): boolean {
return power.isStandby();
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L233-L235 | bf58c36840359710c7cdd5bc4b98b4ecb4f75bb7 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets | arkts | 已加密 ko_app | export const appId : string = "ST1256782283"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left appId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "ST1256782283" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const appId : string = "ST1256782283"; | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L13-L13 | dc396fccb126292d690c160013498391ddaef90a | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ThemeManager.ets | arkts | 单例模式 | export const themeManager = new ThemeManager() | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left themeManager = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ThemeManager AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument... | export const themeManager = new ThemeManager() | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/ThemeManager.ets#L55-L55 | e55110a4c26f6b66c60fd05910de5bf53afe5c7f | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets | arkts | loadInitializationDataSource | 读取historyDownloadResourceData.json中的数据源 | loadInitializationDataSource() {
const context: Context = getContext(this);
// 读取historyDownloadResourceData.json中的数据
let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('historyDownloadResourceData.json');
// 将数据解码,转成字符串
let stringData: string = util.TextDecoder.create('utf-8')... | AST#method_declaration#Left loadInitializationDataSource AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_an... | loadInitializationDataSource() {
const context: Context = getContext(this);
let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('historyDownloadResourceData.json');
let stringData: string = util.TextDecoder.create('utf-8').decodeToString(jsonData);
let data: [] = JSON.pars... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets#L126-L140 | 83c11599b4bda416679e2707df4942b36ef0a154 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
ColumnSpaceEvenlyEnd() { Text("A"); Text("B"); Text("C"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | 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 ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L1404-L1419 | 8477bbca9585c060a93120b69f76c54783b58a3d | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/LunarUtils.ets | arkts | 农历工具类
提供农历与公历转换、农历日期格式化等功能
支持1900-2100年的农历公历转换 | export class LunarUtils {
// 农历数据表(1900-2100年)
// 每个数值的低12位表示12个月的大小月,最高4位表示闰月月份,0表示无闰月
private static readonly LUNAR_INFO: number[] = [
0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x09... | AST#export_declaration#Left export AST#class_declaration#Left class LunarUtils AST#class_body#Left { // 农历数据表(1900-2100年) // 每个数值的低12位表示12个月的大小月,最高4位表示闰月月份,0表示无闰月 AST#property_declaration#Left private static readonly LUNAR_INFO : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_ty... | export class LunarUtils {
private static readonly LUNAR_INFO: number[] = [
0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d4... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/LunarUtils.ets#L7-L64 | 7a3588505117538a80678b1147d60991b102b602 | github | |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | frameworks/text/interface/export/ani/@ohos.graphics.text.ets | arkts | Enumerates decoration line for text.
@enum { number }
@syscap SystemCapability.Graphics.Drawing
@since 12 | export enum TextDecorationType {
/**
* There are no text decoration.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
NONE = 0x0,
/**
* There is a decoration line below the text.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
UNDERLINE = 0x1... | AST#export_declaration#Left export AST#enum_declaration#Left enum TextDecorationType AST#enum_body#Left { /**
* There are no text decoration.
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/ AST#enum_member#Left NONE = AST#expression#Left 0x0 AST#expression#Right AST#enum_member#Right , /*... | export enum TextDecorationType {
NONE = 0x0,
UNDERLINE = 0x1,
OVERLINE = 0x2,
LINE_THROUGH = 0x4,
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/frameworks/text/interface/export/ani/@ohos.graphics.text.ets#L1281-L1309 | 53d29e42522120e2d96a3514af9855cf223d8850 | gitee | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/ClockArea.ets | arkts | drawClockArea | 开始绘制时钟区域。 | private drawClockArea(): void {
this.renderContext.clearRect(
-this.canvasSize,
-this.canvasSize / 2,
this.canvasSize * 2,
this.canvasSize);
let date = new Date();
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
let milliseco... | AST#method_declaration#Left private drawClockArea AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expressio... | private drawClockArea(): void {
this.renderContext.clearRect(
-this.canvasSize,
-this.canvasSize / 2,
this.canvasSize * 2,
this.canvasSize);
let date = new Date();
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
let milliseco... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ClockArea.ets#L88-L114 | ba7c35b38e0548ff788b63f1eb14c7412fbadcd1 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets | arkts | appendMemBoxes | 从内存中添加多个boxes
@param boxes - 要添加的boxes数组 | appendMemBoxes(boxes: Box[]): void {
this._boxes.push(...boxes);
} | AST#method_declaration#Left appendMemBoxes AST#parameter_list#Left ( AST#parameter#Left boxes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#p... | appendMemBoxes(boxes: Box[]): void {
this._boxes.push(...boxes);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/DayOf.ets#L75-L77 | af9d141aa022344419df1f8f868ce7eabe6e665c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/VirtualEconomyService.ets | arkts | 每日奖励接口 | export interface DailyReward {
day: number;
currencyType: CurrencyType;
amount: number;
bonusMultiplier?: number;
isClaimed: boolean;
claimedAt?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DailyReward AST#object_type#Left { AST#type_member#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left currencyType : AST#type_annotation... | export interface DailyReward {
day: number;
currencyType: CurrencyType;
amount: number;
bonusMultiplier?: number;
isClaimed: boolean;
claimedAt?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L177-L184 | 95edd7ad9ae6716d0067361fda0ae79e7c0d2517 | github | |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/EditSchedule.ets | arkts | FoldersMenu | 更改日程文件夹相关组件绑定的菜单栏。 | @Builder
private FoldersMenu(): void {
List() {
if (this.schedule.folderName.length > 0) {
ListItem() {
Row() {
Text('全部日程')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.font_black'))
.onClick(() =... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private FoldersMenu 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 FoldersMenu(): void {
List() {
if (this.schedule.folderName.length > 0) {
ListItem() {
Row() {
Text('全部日程')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.font_black'))
.onClick(() =... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/EditSchedule.ets#L869-L910 | 90ba75cbec2e72969659ec603aa0739f3f9c6eb8 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | unregisterDataChangeListener | 注销消息监听函数 | public unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
console.info('remove listener');
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left public unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary... | public unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
console.info('remove listener');
this.listeners.splice(pos, 1);
}
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L76-L82 | 4f7d54cac60a253bc63913710e89d5fff678ddea | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | getCompletedTasks | 获取已完成任务 | getCompletedTasks(): TaskItem[] {
return this.tasks.filter(task => task.completed);
} | AST#method_declaration#Left getCompletedTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Le... | getCompletedTasks(): TaskItem[] {
return this.tasks.filter(task => task.completed);
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L456-L458 | addf9c6ae2ce1243507cc9bbe9b8376ba4e13fd9 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/chat/PrivateChatComponent.ets | arkts | addLikeIcon | 添加新的点赞图标 | addLikeIcon(baseX: number, baseY: number) {
const radius = 80 + Math.random() * 20
const emoji = this.getRandomEmoji()
// 添加随机位置偏移(±15px范围内)
const offsetX = Math.random() * 30 - 15
const offsetY = Math.random() * 30 - 15
this.likeIcons.push(this.createIcon(baseX + offsetX, baseY + offsetY, radiu... | AST#method_declaration#Left addLikeIcon AST#parameter_list#Left ( AST#parameter#Left baseX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left baseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ... | addLikeIcon(baseX: number, baseY: number) {
const radius = 80 + Math.random() * 20
const emoji = this.getRandomEmoji()
const offsetX = Math.random() * 30 - 15
const offsetY = Math.random() * 30 - 15
this.likeIcons.push(this.createIcon(baseX + offsetX, baseY + offsetY, radius, emoji))
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L241-L248 | 78c13afa3cd80f5e0e099d5e5bde5f88b3638394 | gitee |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/home/HomeTabContent.ets | arkts | loadMerchantList | 加载商家列表
@param page 页码
@param append 是否追加到现有列表(true: 追加,false: 替换) | private async loadMerchantList(page: number, append: boolean) {
try {
hilog.info(DOMAIN, TAG, 'Loading merchant list: page=%{public}d, append=%{public}s', page, append);
let merchants: MerchantModel[] = [];
// 如果选中了分类,则按分类筛选
if (this.selectedCategory) {
merchants = awai... | AST#method_declaration#Left private async loadMerchantList AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left append : AST#type_annotation#Left AST#primary_type#Left boolean A... | private async loadMerchantList(page: number, append: boolean) {
try {
hilog.info(DOMAIN, TAG, 'Loading merchant list: page=%{public}d, append=%{public}s', page, append);
let merchants: MerchantModel[] = [];
if (this.selectedCategory) {
merchants = await this.homeViewMo... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/home/HomeTabContent.ets#L92-L131 | 672c1d4798a662b89df6ec2e335e218bdefd2a6d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listexchange/src/main/ets/model/ListExchangeCtrl.ets | arkts | onLongPress | ListItem长按函数
@param item | onLongPress(item: T): void {
const index: number = this.deductionData.indexOf(item);
this.dragRefOffset = 0;
// TODO:知识点:长按当前列表项透明度和放大动画
animateTo({ curve: Curve.Friction, duration: commonConstants.ANIMATE_DURATION }, () => {
this.state = OperationStatus.PRESSING;
this.modifier[index].hasSha... | AST#method_declaration#Left onLongPress AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#ty... | onLongPress(item: T): void {
const index: number = this.deductionData.indexOf(item);
this.dragRefOffset = 0;
animateTo({ curve: Curve.Friction, duration: commonConstants.ANIMATE_DURATION }, () => {
this.state = OperationStatus.PRESSING;
this.modifier[index].hasShadow = true;
this.modi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/model/ListExchangeCtrl.ets#L64-L73 | f031c50956aa8577f47be4cd3ff764d85696b445 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/demo/DemoNavigator.ets | arkts | toScreenAdaptDemo | 跳转到屏幕适配示例页
@returns {void} 无返回值 | static toScreenAdaptDemo(): void {
navigateTo(DemoRoutes.ScreenAdaptDemo);
} | AST#method_declaration#Left static toScreenAdaptDemo 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_custom_component_statement#Left navigateTo ( AST#expression#Left AST#me... | static toScreenAdaptDemo(): void {
navigateTo(DemoRoutes.ScreenAdaptDemo);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L90-L92 | 25ec090f0535eaef927d80f54e551990e56136b2 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/field_sensitive/container/array_002_F.ets | arkts | Introduction 数组索引 | export function array_002_F(taint_src : string) {
let arr = [taint_src, "b", "c"]
taint.Sink(arr[1]);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ... | export function array_002_F(taint_src : string) {
let arr = [taint_src, "b", "c"]
taint.Sink(arr[1]);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/array_002_F.ets#L6-L9 | e05624d1035ac3758c909f298fd665d55109f3e0 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/PlayerSettingBuilder.ets | arkts | createActionItem | 创建一条操作栏目的视图
@param title
@param onClick
@param subTitle | @Builder
createActionItem(actionItem: ActionItem,
onClickItem?: (id: string) => void) {
Row() {
Image(actionItem.subTitle)
.margin({
left: 12
})
.width(20)
.height(20)
Text(actionItem.title)
.fontSize(14)
.margin({left:6})
.fontCol... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createActionItem AST#parameter_list#Left ( AST#parameter#Left actionItem : AST#type_annotation#Left AST#primary_type#Left ActionItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onClickItem ? : AST#... | @Builder
createActionItem(actionItem: ActionItem,
onClickItem?: (id: string) => void) {
Row() {
Image(actionItem.subTitle)
.margin({
left: 12
})
.width(20)
.height(20)
Text(actionItem.title)
.fontSize(14)
.margin({left:6})
.fontCol... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/PlayerSettingBuilder.ets#L47-L104 | 8128f686790b03d18debcf133c3c9b0122de8673 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Save a text file or ArrayBuffer to sandbox storage, overwrites whatever that was at that place.
@param file_name A string, setting the file's name.
@param content A string or an ArrayBuffer, fills the file's content. | export function sandbox_save(file_name: string, content: string | ArrayBuffer, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
let full_file_directory = filesDir + '/' + file_name;
if (fs.accessSync(full_file_directory)) {
fs.unlinkSync(full_file_directory);
}... | AST#export_declaration#Left export AST#function_declaration#Left function sandbox_save AST#parameter_list#Left ( AST#parameter#Left file_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Le... | export function sandbox_save(file_name: string, content: string | ArrayBuffer, context_filesDir?: string) {
let filesDir: string = context_filesDir || meowContext().filesDir;
let full_file_directory = filesDir + '/' + file_name;
if (fs.accessSync(full_file_directory)) {
fs.unlinkSync(full_file_directory);
}... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L324-L334 | 45ed817f77607edc7395f8a57c453fe975c96c21 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | deleteSelected | 删除选中的商品
@returns {Promise<void>} Promise<void> | async deleteSelected(): Promise<void> {
const selectedKeys = Array.from(this.selectedSpecIds);
for (const key of selectedKeys) {
const parts = key.split('_');
const goodsId = parseInt(parts[0]);
const specId = parseInt(parts[1]);
await this.cartRepository.removeSpecFromCart(goodsId, spec... | AST#method_declaration#Left async deleteSelected 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_a... | async deleteSelected(): Promise<void> {
const selectedKeys = Array.from(this.selectedSpecIds);
for (const key of selectedKeys) {
const parts = key.split('_');
const goodsId = parseInt(parts[0]);
const specId = parseInt(parts[1]);
await this.cartRepository.removeSpecFromCart(goodsId, spec... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L218-L244 | 1ed0870e167ef0cbb5b06163092403491ad551ec | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/ContactService_backup.ets | arkts | deleteContact | 删除联系人
@param contactId 联系人ID
@returns 是否成功 | async deleteContact(contactId: string): Promise<boolean> {
try {
// 获取联系人数据用于日志记录
const existingContact = await this.getContactById(contactId);
if (!existingContact) {
throw new Error('联系人不存在');
}
await this.databaseService.executeTransaction(async () => {
// 删除相关的祝福历史... | AST#method_declaration#Left async deleteContact AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type... | async deleteContact(contactId: string): Promise<boolean> {
try {
const existingContact = await this.getContactById(contactId);
if (!existingContact) {
throw new Error('联系人不存在');
}
await this.databaseService.executeTransaction(async () => {
await this.database... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService_backup.ets#L214-L257 | d28a714b03dd7353f94828a782e0a73c9ee58359 | github |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets | arkts | Defines the editor event info.
@interface EditorEventInfo
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Defines the editor event info.
@interface EditorEventInfo
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface EditorEventInfo {
/**
* Edit information.
*
* @type { ?RichEditorSelection }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Edit information.
*
* @type { ?RichEditorSelection }
* @syscap SystemCapability.ArkUI... | AST#export_declaration#Left export AST#interface_declaration#Left interface EditorEventInfo AST#object_type#Left { /**
* Edit information.
*
* @type { ?RichEditorSelection }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* Edit information.
*
... | export interface EditorEventInfo {
content?: RichEditorSelection;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets#L144-L163 | 939303d54f306d8b660c64b7b9fd78c72b714711 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/CertVerify/entry/src/main/ets/pages/Index.ets | arkts | verifyCert | 使用CA证书验证用户证书 | async verifyCert(caFilePath: string, certFilePath: string) {
//获取CA证书
let caCert = await this.getCertFromFile(caFilePath)
if (caCert == undefined) {
this.msgHistory += "错误的证书文件格式:" + caFilePath + "\r\n";
return
}
//获取用户证书
let userCert = await this.getCertFromFile(certFilePath)
i... | AST#method_declaration#Left async verifyCert AST#parameter_list#Left ( AST#parameter#Left caFilePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left certFilePath : AST#type_annotation#Left AST#primary_type#Left string AST#... | async verifyCert(caFilePath: string, certFilePath: string) {
let caCert = await this.getCertFromFile(caFilePath)
if (caCert == undefined) {
this.msgHistory += "错误的证书文件格式:" + caFilePath + "\r\n";
return
}
let userCert = await this.getCertFromFile(certFilePath)
if (userCert == u... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/CertVerify/entry/src/main/ets/pages/Index.ets#L172-L193 | 024870572b23aa1c4bf33d3157e4777f7c83c61f | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/StringUtils.ets | arkts | startsWith | 检查字符串是否以给定的字符串开头
@param string 要检索的字符串
@param target 要检索字符
@param position 检索的位置
@returns 如果字符串以字符串开头,那么返回 true,否则返回 false | static startsWith(string: string = '', target: string, position: number = 0): boolean {
return string.startsWith(target, position);
} | AST#method_declaration#Left static startsWith AST#parameter_list#Left ( AST#parameter#Left string : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation#L... | static startsWith(string: string = '', target: string, position: number = 0): boolean {
return string.startsWith(target, position);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L115-L117 | 20198663259612ce208379353e5bcbde6e57646a | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets | arkts | getTime | 时分秒 | getTime(): string {
const DATETIME = new Date();
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds());
} | AST#method_declaration#Left getTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left DATETIME = AST#... | getTime(): string {
const DATETIME = new Date();
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds());
} | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets#L24-L27 | 210c42c93a1b6023e329e1fdcc7243825aa7a567 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets | arkts | initRdbStore | 初始化数据库
@param context 上下文 | public async initRdbStore(context: common.Context): Promise<void> {
logger.info(TAG, 'init rdbStore begin');
if (!context) {
logger.error(TAG, 'initRdbStore context is invalid');
return;
}
if (this.rdbStore) {
logger.info(TAG, 'rdbStore is exist');
return;
}
try {
... | AST#method_declaration#Left public async initRdbStore AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | public async initRdbStore(context: common.Context): Promise<void> {
logger.info(TAG, 'init rdbStore begin');
if (!context) {
logger.error(TAG, 'initRdbStore context is invalid');
return;
}
if (this.rdbStore) {
logger.info(TAG, 'rdbStore is exist');
return;
}
try {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L52-L72 | edd9f3d213c4e0516ef1f186252e7be5aeeb0548 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/common/startup/BarTask.ets | arkts | @author open_9527
@date 2025/5/23
@desc 描述信息 | @Sendable
export default class BarTask extends StartupTask {
constructor() {
super();
}
async init(context: common.AbilityStageContext): Promise<TaskResult> {
LogUtils.debug('AppStartupConfigEntry', `BarTask init`)
let time = systemDateTime.getTime(false)
LogUtils.debug('AppStartupConfigEntry', `... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export default AST#class_declaration#Left class BarTask extends AST#type_annotation#Left AST#primary_type#Left StartupTask AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left const... | @Sendable
export default class BarTask extends StartupTask {
constructor() {
super();
}
async init(context: common.AbilityStageContext): Promise<TaskResult> {
LogUtils.debug('AppStartupConfigEntry', `BarTask init`)
let time = systemDateTime.getTime(false)
LogUtils.debug('AppStartupConfigEntry', `... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/common/startup/BarTask.ets#L12-L28 | 7d5726cbb8ed2766335eb78f63f71cb3809e5194 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets | arkts | getLearns | 获取转换后的 Learns | async getLearns(): Promise<Learn[]> {
// var learns = [Learn]()
const learns = new Set<Learn>(); // 用Set更快
// 等待异步获取 dbLearns
const dbLearnsArray: DBLearn[] = await this.dbLearns();
for (let i = 0; i < dbLearnsArray.length; i++) {
const dbLearn = dbLearnsArray[i];
if (dbLearn.planId !... | AST#method_declaration#Left async getLearns AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Learn [ ] AST#array_type#Right AST#primary_type#Rig... | async getLearns(): Promise<Learn[]> {
const learns = new Set<Learn>();
const dbLearnsArray: DBLearn[] = await this.dbLearns();
for (let i = 0; i < dbLearnsArray.length; i++) {
const dbLearn = dbLearnsArray[i];
if (dbLearn.planId != null &&
dbLearn.bookId != null &&
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets#L100-L134 | de98880c05e60e5b38be63bbc0f214e9f231e86e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toNfcSetting | 跳转NFC设置页面 | static toNfcSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_NFC);
} | AST#method_declaration#Left static toNfcSetting 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... | static toNfcSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_NFC);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L155-L157 | c35181fc85b1b503519070d6bed8dc16dcde471b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | 游戏统计接口 | export interface GameStatistics {
totalActions: Map<GameAction, number>;
dailyActivity: Map<string, number>;
weeklyActivity: Map<string, number>;
monthlyActivity: Map<string, number>;
favoriteActions: GameAction[];
averageDailyPoints: number;
longestStreak: number;
totalAchievements: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GameStatistics AST#object_type#Left { AST#type_member#Left totalActions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GameAction AST#primary_t... | export interface GameStatistics {
totalActions: Map<GameAction, number>;
dailyActivity: Map<string, number>;
weeklyActivity: Map<string, number>;
monthlyActivity: Map<string, number>;
favoriteActions: GameAction[];
averageDailyPoints: number;
longestStreak: number;
totalAchievements: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L201-L210 | 872b402912cf7dba52dd9d9409952e5ce82b1b4b | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/SpeechRecognizerHelper.ets | arkts | generateSessionId | 生成会话ID
@returns | static generateSessionId(): string {
return `speech_${Helper.getTodayStr('yyyyMMddHHmmssfff')}`;
} | AST#method_declaration#Left static generateSessionId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#templa... | static generateSessionId(): string {
return `speech_${Helper.getTodayStr('yyyyMMddHHmmssfff')}`;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/SpeechRecognizerHelper.ets#L144-L146 | 044f5d680d09f78364f3b5849c10c68df54476c8 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setDrawEntryLabels | Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).
@param enabled | public setDrawEntryLabels(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
} | AST#method_declaration#Left public setDrawEntryLabels AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr... | public setDrawEntryLabels(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L701-L703 | 12ca619ed334132188b3b9da494739dd7485601a | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/XAxisRendererRadarChart.ets | arkts | renderLimitLines | XAxis LimitLines on RadarChart not yet supported.
@param c | public renderLimitLines(c: CanvasRenderingContext2D) {
// this space intentionally left blank
} | AST#method_declaration#Left public renderLimitLines AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // this space inte... | public renderLimitLines(c: CanvasRenderingContext2D) {
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/XAxisRendererRadarChart.ets#L84-L86 | 861defa1c6e9e3c1b3b65be8d885f42227f89d0b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets | arkts | 默认手机窗口尺寸 | export const DEFAULT_WINDOW_SIZE: window.Size = { width: 1280, height: 2580 }; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEFAULT_WINDOW_SIZE : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Size AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_litera... | export const DEFAULT_WINDOW_SIZE: window.Size = { width: 1280, height: 2580 }; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets#L37-L37 | 241115f37d8b5273608dd12547b4f8faff1a6672 | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/LoadingProgressBuilderProxy.ets | arkts | progress | 进度初始值
@default 默认 0
@param progress 默认 0
@returns | progress(progress: number) {
this.builderOptions.progress = progress;
return this;
} | AST#method_declaration#Left progress AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left A... | progress(progress: number) {
this.builderOptions.progress = progress;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/LoadingProgressBuilderProxy.ets#L16-L19 | 19933d84d3de2021ca30ccf7247b6d27b3252a9f | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/loaderStrategy/HttpLoaderStrategy.ets | arkts | HTTP加载策略 | export class HttpLoaderStrategy implements IImageLoaderStrategy {
async loadImage(
request: RequestJobRequest,
requestList: List<ImageKnifeRequestWithSource> | undefined,
fileKey: string,
callBackData: ImageKnifeData,
callBackTimeInfo: TimeInfo
): Promise<void> {
let resBuf: ArrayBuffer | un... | AST#export_declaration#Left export AST#class_declaration#Left class HttpLoaderStrategy AST#implements_clause#Left implements IImageLoaderStrategy AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left async loadImage AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left ... | export class HttpLoaderStrategy implements IImageLoaderStrategy {
async loadImage(
request: RequestJobRequest,
requestList: List<ImageKnifeRequestWithSource> | undefined,
fileKey: string,
callBackData: ImageKnifeData,
callBackTimeInfo: TimeInfo
): Promise<void> {
let resBuf: ArrayBuffer | un... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/loaderStrategy/HttpLoaderStrategy.ets#L38-L136 | b2b84a4ac0b85fb048a6fde0b71427d73367fb38 | gitee | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/constant/TimerConstants.ets | arkts | 计时器常量类。 | export class TimerConstants {
/**
* 计时器格式。
*/
static readonly TIMER_FORMAT: string = 'HH:mm:ss';
/**
* 计时器字符串。
*/
static readonly TIMER: string = '计时器';
} | AST#export_declaration#Left export AST#class_declaration#Left class TimerConstants AST#class_body#Left { /**
* 计时器格式。
*/ AST#property_declaration#Left static readonly TIMER_FORMAT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'HH:mm:... | export class TimerConstants {
static readonly TIMER_FORMAT: string = 'HH:mm:ss';
static readonly TIMER: string = '计时器';
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/TimerConstants.ets#L4-L13 | 20a2620744ffbfbbbcc08684ffb76e92479ad6c3 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets | arkts | encodeECB | 加密-ECB模式
@param str 待加密的字符串
@param sm4Key SM4密钥
@returns | static async encodeECB(str: string, sm4Key: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128);
} | AST#method_declaration#Left static async encodeECB 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeECB(str: string, sm4Key: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7',128);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4.ets#L41-L43 | 125e4b7a71728b9dd33c3a294b6398dd09a00988 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | getFilePath | 通过URI或路径,获取文件路径
@param uriOrPath URI或路径
@returns | static getFilePath(uriOrPath: string): string {
return FileUtil.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 FileUtil.getFileUri(uriOrPath).path;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L206-L208 | 7c18128f55aa8ff0f709826730b33ce5e9bf503e | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/bottombar/AppBottomButton.ets | arkts | 构建底部操作按钮
@returns {void} 无返回值 | build(): void {
Column() {
IBestButton({
text: this.text,
type: "primary",
round: true,
loading: this.loading,
disabled: this.loading,
btnWidth: P100,
onBtnClick: (): void => {
this.onTap();
}
});
if (this.safeAreaEnabled &&... | 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#L... | build(): void {
Column() {
IBestButton({
text: this.text,
type: "primary",
round: true,
loading: this.loading,
disabled: this.loading,
btnWidth: P100,
onBtnClick: (): void => {
this.onTap();
}
});
if (this.safeAreaEnabled &&... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/bottombar/AppBottomButton.ets#L47-L74 | 6991ce7fd00bb5746804eaf9c4a5bbc5cd0db0d3 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | enum that indicates the position of the LimitLine label | export enum LimitLabelPosition {
LEFT_TOP,
LEFT_BOTTOM,
RIGHT_TOP,
RIGHT_BOTTOM,
} | AST#export_declaration#Left export AST#enum_declaration#Left enum LimitLabelPosition AST#enum_body#Left { AST#enum_member#Left LEFT_TOP AST#enum_member#Right , AST#enum_member#Left LEFT_BOTTOM AST#enum_member#Right , AST#enum_member#Left RIGHT_TOP AST#enum_member#Right , AST#enum_member#Left RIGHT_BOTTOM AST#enum_membe... | export enum LimitLabelPosition {
LEFT_TOP,
LEFT_BOTTOM,
RIGHT_TOP,
RIGHT_BOTTOM,
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L203-L208 | 4660407efe23deb9dbdd3c93646d06395c75eebd | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AvoidTimeComsume/entry/src/main/ets/views/UseTaskPool.ets | arkts | taskPoolExecute | [Start task_pool_execute] The following methods are defined outside of the component | async function taskPoolExecute(UIContext: UIContext): Promise<Item[]> {
let task: taskpool.Task = new taskpool.Task(mockRequestData, UIContext);
let result: Item[] = [];
try {
result = await taskpool.execute(task) as Item[]
} catch (error) {
hilog.error(0x0000,'',`execute failed. code=${error.code}, mes... | AST#function_declaration#Left async function taskPoolExecute AST#parameter_list#Left ( AST#parameter#Left UIContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ... | async function taskPoolExecute(UIContext: UIContext): Promise<Item[]> {
let task: taskpool.Task = new taskpool.Task(mockRequestData, UIContext);
let result: Item[] = [];
try {
result = await taskpool.execute(task) as Item[]
} catch (error) {
hilog.error(0x0000,'',`execute failed. code=${error.code}, mes... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/UseTaskPool.ets#L126-L135 | e411c7c117ee4f015dc97e516774b46372897ac9 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TempUtil.ets | arkts | K2C | 开尔文转摄氏度
@param k 开尔文温度值
@returns 摄氏度温度值 | static K2C(k: number): number {
return k - 273.15;
} | AST#method_declaration#Left static K2C AST#parameter_list#Left ( AST#parameter#Left k : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST... | static K2C(k: number): number {
return k - 273.15;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TempUtil.ets#L58-L60 | a5fc53c804c7bd6a57fbf5042e0db75f53990403 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LLMConfigPage.ets | arkts | buildAdvancedConfigSection | 构建高级配置区域 | @Builder
buildAdvancedConfigSection() {
Column({ space: 16 }) {
Row() {
Text('高级配置')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
Button(this.showAdvanced ? '收起' : '展开')
.type(ButtonType.Normal)... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAdvancedConfigSection 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#co... | @Builder
buildAdvancedConfigSection() {
Column({ space: 16 }) {
Row() {
Text('高级配置')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
Button(this.showAdvanced ? '收起' : '展开')
.type(ButtonType.Normal)... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L357-L453 | 93c721894e39c38c3668dd5f884732cdc6f58626 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement5.ets | arkts | concurrentTask | [EndExclude quick_start] | @Concurrent
function concurrentTask(num: number): number {
hilog.info(0x0000, 'TAG', '%{public}s', 'Add the task that needs to be executed with delay');
return num;
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function concurrentTask AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A... | @Concurrent
function concurrentTask(num: number): number {
hilog.info(0x0000, 'TAG', '%{public}s', 'Add the task that needs to be executed with delay');
return num;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement5.ets#L29-L33 | c788af801a7249f64aaf5cb68623a2e66e6dcaef | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | getExpense | 获取支出 | public getExpense(): string {
return this.customDayInfo.expense.toString();
} | AST#method_declaration#Left public getExpense AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressi... | public getExpense(): string {
return this.customDayInfo.expense.toString();
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L514-L516 | 8c47c2349a6c40b9b846938dc1fb417aada98cbb | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/OrderConfirm.ets | arkts | @file 确认订单页面数据
@author Joker.X | export class ConfirmOrder {
/**
* 默认收货地址
*/
defaultAddress?: Address | null = null;
/**
* 用户拥有的优惠券
*/
userCoupon?: Coupon[] | null = null;
constructor(init?: Partial<ConfirmOrder>) {
if (!init) {
return;
}
this.defaultAddress = init.defaultAddress ? new Address(init.defaultAddre... | AST#export_declaration#Left export AST#class_declaration#Left class ConfirmOrder AST#class_body#Left { /**
* 默认收货地址
*/ AST#property_declaration#Left defaultAddress ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Address AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Ri... | export class ConfirmOrder {
defaultAddress?: Address | null = null;
userCoupon?: Coupon[] | null = null;
constructor(init?: Partial<ConfirmOrder>) {
if (!init) {
return;
}
this.defaultAddress = init.defaultAddress ? new Address(init.defaultAddress) : this.defaultAddress;
this.userCoup... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/OrderConfirm.ets#L8-L25 | d2e7495d65b75015a3c8211e475651f856cb4132 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets | arkts | sign2048PKCS1 | 2048位签名-PKCS1
@param str 需要签名的字符串
@param priKey 2048位私钥
@returns OutDTO<string> 签名对象 | static async sign2048PKCS1(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.sign(str, priKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048);
} | AST#method_declaration#Left static async sign2048PKCS1 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 priKey : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | static async sign2048PKCS1(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.sign(str, priKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L134-L136 | bb9578f2a2747c07d79f84e80c057a68b547417e | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets | arkts | cancelReminder | cancelReminder | function cancelReminder(reminderId: number, context: Context) {
if (!reminderId) {
Logger.error(Const.REMINDER_AGENT_TAG, 'cancelReminder reminderId is empty');
return;
}
let reminder: string = reminderId.toString();
hasPreferencesValue(context, reminder, (preferences: preferences.Preferences, hasValue:... | AST#function_declaration#Left function cancelReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context... | function cancelReminder(reminderId: number, context: Context) {
if (!reminderId) {
Logger.error(Const.REMINDER_AGENT_TAG, 'cancelReminder reminderId is empty');
return;
}
let reminder: string = reminderId.toString();
hasPreferencesValue(context, reminder, (preferences: preferences.Preferences, hasValue:... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/service/ReminderAgent.ets#L54-L67 | 7dc7591c4f41ae0631be8f14a6512099d8ae9403 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/NotificationTypes.ets | arkts | 通知过滤器 | export interface NotificationFilter {
types?: NotificationType[];
priorities?: NotificationPriority[];
status?: NotificationStatus[];
dateRange?: DateRange;
keyword?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationFilter AST#object_type#Left { AST#type_member#Left types ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NotificationType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_memb... | export interface NotificationFilter {
types?: NotificationType[];
priorities?: NotificationPriority[];
status?: NotificationStatus[];
dateRange?: DateRange;
keyword?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/NotificationTypes.ets#L109-L115 | 20e3778027c3b216a9257eb7911d3e310f1ac642 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/StatusBarUtils.ets | arkts | setStatusBarContentColor | 设置状态栏的内容颜色(文字和图标的颜色)
类似于SwiftUI中修改UIApplication.shared.statusBarStyle
@param color 颜色字符串,例如 '#000000' (黑色) 或 '#FFFFFF' (白色)
@param context 上下文对象 | static async setStatusBarContentColor(color: string): Promise<void> {
try {
const context = getContext(StatusBarUtil)
// 使用正确的API获取窗口实例[5,6](@ref)
const currentWindow = await window.getLastWindow(context);
// 设置状态栏属性[3](@ref)
await currentWindow.setWindowSystemBarProperties({
s... | AST#method_declaration#Left static async setStatusBarContentColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | static async setStatusBarContentColor(color: string): Promise<void> {
try {
const context = getContext(StatusBarUtil)
const currentWindow = await window.getLastWindow(context);
await currentWindow.setWindowSystemBarProperties({
statusBarContentColor: color
});
con... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/StatusBarUtils.ets#L16-L30 | 2ad3a67436beacfedf47e28d6d72979de4d229aa | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/Index.ets | arkts | tabBuilder | Tab菜单 | @Builder
tabBuilder(index: number, icon: string | Resource, text: string | Resource) {
TabItemView({ text: text, icon: icon, check: index === this.index })
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : AST#type_annotation#Left AST... | @Builder
tabBuilder(index: number, icon: string | Resource, text: string | Resource) {
TabItemView({ text: text, icon: icon, check: index === this.index })
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/Index.ets#L59-L62 | d065e5561454083aaba97bf182d894b79e0cebaa | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+NavigateToMiniProgram.ets | arkts | navigateToMiniProgram | 打开微信小程序,等待微信SDK接入 | navigateToMiniProgram(data: DMPMap, callback: DMPBridgeCallback) {
promptAction.showToast({
message: '暂不支持微信跳转',
alignment: Alignment.Center
})
} | AST#method_declaration#Left navigateToMiniProgram AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left DMPMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left DMPBridgeCallbac... | navigateToMiniProgram(data: DMPMap, callback: DMPBridgeCallback) {
promptAction.showToast({
message: '暂不支持微信跳转',
alignment: Alignment.Center
})
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+NavigateToMiniProgram.ets#L13-L18 | 469c413e6a33e1e66cb4d4a65c93288236fd8f0c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/AnimationInfo.ets | arkts | 全屏播放页透明度 | constructor(
isExpand: boolean = false,
isAnimating: boolean = false,
topUnsafeHeight: number = 0,
bottomUnsafeHeight: number = 0,
detailsPageImgPositionY: number = 0,
miniImgPositionY: number = 0,
screenHeight: number = 0,
screenWidth: number = 0,
miniDistanceToTop: number = 0,
... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left isExpand : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#R... | constructor(
isExpand: boolean = false,
isAnimating: boolean = false,
topUnsafeHeight: number = 0,
bottomUnsafeHeight: number = 0,
detailsPageImgPositionY: number = 0,
miniImgPositionY: number = 0,
screenHeight: number = 0,
screenWidth: number = 0,
miniDistanceToTop: number = 0,
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/AnimationInfo.ets#L44-L90 | f14ed8103fb61136696e62ca97253695b6302d0c | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Load.ets | arkts | Load | 负载页面 | @Component
export struct Load {
@State private gpData: TIndexInfo[] = []
public atWidth: number = 350; //表的宽度
public atHeight: number = 300; //表的高度
public minOffset: number = 15; //X轴线偏移量
//cpuLoad0 cpuLoad1 cpuLoad2 cpuLoad3
public topAxis: XAxis = new XAxis(); //顶部X轴
public bottomAxis: XAxis = new XAxi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Load AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private gpData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TIndexInfo [ ] AST#array_... | @Component
export struct Load {
@State private gpData: TIndexInfo[] = []
public atWidth: number = 350;
public atHeight: number = 300;
public minOffset: number = 15;
public topAxis: XAxis = new XAxis();
public bottomAxis: XAxis = new XAxis();
public leftAxis: YAxis = null;
public rightAxis: YAxi... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Load.ets#L32-L1090 | c436c3484a5eb162b2332d523ea8f608d78217ed | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets | arkts | backAnimatorCreate | 扫描动画 | async backAnimatorCreate(): Promise<void> {
if (this.backAnimator) {
this.backAnimator.onRepeat = () => {
this.reverse = !this.reverse;
if (this.reverse) {
this.allAngle = 0;
} else {
this.allAngle = 180;
}
}
this.backAnimator.onCancel = () => {
... | AST#method_declaration#Left async backAnimatorCreate 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#ty... | async backAnimatorCreate(): Promise<void> {
if (this.backAnimator) {
this.backAnimator.onRepeat = () => {
this.reverse = !this.reverse;
if (this.reverse) {
this.allAngle = 0;
} else {
this.allAngle = 180;
}
}
this.backAnimator.onCancel = () => {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets#L100-L128 | 3eb88e8e944857ad9406606b8c7212a7a4716c17 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressListViewModel.ets | arkts | shouldShowBottomButton | 是否显示底部操作按钮
@returns {boolean} 是否显示 | shouldShowBottomButton(): boolean {
return this.uiState !== BaseNetWorkListUiState.LOADING
&& this.uiState !== BaseNetWorkListUiState.ERROR;
} | AST#method_declaration#Left shouldShowBottomButton AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_... | shouldShowBottomButton(): boolean {
return this.uiState !== BaseNetWorkListUiState.LOADING
&& this.uiState !== BaseNetWorkListUiState.ERROR;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressListViewModel.ets#L145-L148 | 5a7efbf95b83c4cdac39f05e619d5a4150c82b1c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets | arkts | TODO ActionBaseCore,弹框、半模态、土司,核心类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/01 | export class ActionBaseCore {
private static instance: ActionBaseCore;
private caches: Array<ActionCoreArg> = new Array<ActionCoreArg>();
private constructor() {
}
static getInstance(): ActionBaseCore {
if (!ActionBaseCore.instance) {
ActionBaseCore.instance = new ActionBaseCore();
Action... | AST#export_declaration#Left export AST#class_declaration#Left class ActionBaseCore AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left ActionBaseCore AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_de... | export class ActionBaseCore {
private static instance: ActionBaseCore;
private caches: Array<ActionCoreArg> = new Array<ActionCoreArg>();
private constructor() {
}
static getInstance(): ActionBaseCore {
if (!ActionBaseCore.instance) {
ActionBaseCore.instance = new ActionBaseCore();
Action... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L32-L352 | d553f1a9bf7941eb23b91ddc1e8af16e801199e3 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets | arkts | isDlpFileFunc | 是否为dlp文件 | async isDlpFileFunc(fd: number): Promise<boolean> {
try {
this.isDLPFile = await dlpPermission.isDLPFile(fd); // 是否加密DLP文件
Logger.info(TAG, 'isDlpFile:' + this.isDLPFile);
this.inSandbox = await dlpPermission.isInSandbox();
let msg = 'isDlpFile:' + true + ';inSandbox:' + this.inSandbox;
... | AST#method_declaration#Left async isDlpFileFunc AST#parameter_list#Left ( AST#parameter#Left fd : 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 P... | async isDlpFileFunc(fd: number): Promise<boolean> {
try {
this.isDLPFile = await dlpPermission.isDLPFile(fd);
Logger.info(TAG, 'isDlpFile:' + this.isDLPFile);
this.inSandbox = await dlpPermission.isInSandbox();
let msg = 'isDlpFile:' + true + ';inSandbox:' + this.inSandbox;
dlpPermiss... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L96-L115 | 39506bb1e2613051e0fb913f5947cc2b54253154 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isInt8Array | Check whether the entered value is of int8array array type.
@param { Object } value - A Int8Array value
@returns { boolean } Returns true if the value is a built-in Int8Array instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isInt8Array(value: Object): boolean; | AST#method_declaration#Left isInt8Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig... | isInt8Array(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1235-L1235 | f52b7253db3b553faca28c71fb175ae285748160 | gitee |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/common/utils/GlobalDataManager.ets | arkts | getEnvironmentData | 获取环境数据 | getEnvironmentData(): EnvironmentDataItem[] {
return this.environmentData;
} | AST#method_declaration#Left getEnvironmentData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EnvironmentDataItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_... | getEnvironmentData(): EnvironmentDataItem[] {
return this.environmentData;
} | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L127-L129 | f7ea2853639ee3d153d2bbe636e134282df207fc | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/VideoPlayListener.ets | arkts | 视频播放回调接口 | export interface VideoPlayListener {
// 准备完毕
onPrepared: (duration :number) => void;
// 播放状态
onPlayStatus: (isPlay : boolean) => void;
// 播放至结尾状态回调
onComplete: () => void;
// 时间上报函数回调
onTimeUpdate: (time: number) => void;
// 比特率更新回调
onBitrateUpdate: (bitrateList: number[]) => void;
// 错误状态回调
... | AST#export_declaration#Left export AST#interface_declaration#Left interface VideoPlayListener AST#object_type#Left { // 准备完毕 AST#type_member#Left onPrepared : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST... | export interface VideoPlayListener {
onPrepared: (duration :number) => void;
onPlayStatus: (isPlay : boolean) => void;
onComplete: () => void;
onTimeUpdate: (time: number) => void;
onBitrateUpdate: (bitrateList: number[]) => void;
onErrorUpdate: (error: string) => void;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/VideoPlayListener.ets#L19-L36 | 0e7b44a19783306573b2316eb67901f798f5b963 | gitee | |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/DataManager.ets | arkts | getEventsByDate | 获取指定日期的事件 | async getEventsByDate(date: string): Promise<EventModel[]> {
const events = await this.loadEvents()
return events.filter(e => e.date === date)
} | AST#method_declaration#Left async getEventsByDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | async getEventsByDate(date: string): Promise<EventModel[]> {
const events = await this.loadEvents()
return events.filter(e => e.date === date)
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/DataManager.ets#L115-L118 | bd085825e4b2a8705cf50d9c22672dda02d3a2e1 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets | arkts | updateAddBookIds | 更新分组的bookIds | async updateAddBookIds(newGroupId:number,bookId:number|number[]){
//循环更新
let book:number[] = toolsUtils.numberArrays(bookId)
if(newGroupId && bookId){
BookGroupsDao.updateAddBookIds(newGroupId, book.map(val => val.toString()))
}
} | AST#method_declaration#Left async updateAddBookIds AST#parameter_list#Left ( AST#parameter#Left newGroupId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left bookId : AST#type_annotation#Left AST#union_type#Left AST#primary_t... | async updateAddBookIds(newGroupId:number,bookId:number|number[]){
let book:number[] = toolsUtils.numberArrays(bookId)
if(newGroupId && bookId){
BookGroupsDao.updateAddBookIds(newGroupId, book.map(val => val.toString()))
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L83-L90 | 5886ac3f40f958a078ca3f89872e1f7bac0adce4 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | getLabelPosition | returns the position of the y-labels | public getLabelPosition(): YAxisLabelPosition {
return this.mPosition;
} | AST#method_declaration#Left public getLabelPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left YAxisLabelPosition AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left... | public getLabelPosition(): YAxisLabelPosition {
return this.mPosition;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L174-L176 | e9dd019f361486ce5ce9354e93289227e264c189 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getAppName | 获取应用名称
@returns | static getAppName(): string {
let appRes = AppUtils.getAppInfoSync().label.split(':')[1];
try {
return AppUtils.getContext().resourceManager.getStringByNameSync(appRes)
} catch (error) {
return ''
}
} | AST#method_declaration#Left static getAppName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left appRes ... | static getAppName(): string {
let appRes = AppUtils.getAppInfoSync().label.split(':')[1];
try {
return AppUtils.getContext().resourceManager.getStringByNameSync(appRes)
} catch (error) {
return ''
}
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L182-L189 | ada12779867b25661cc5ccff086148d12e8093e2 | gitee |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/detail/show/ShowComponent.ets | arkts | ShowNextUp | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/23 12:12
@Version V1.0
@Description | @Component
export struct ShowNextUp {
@Require nextDto?: FinItem
build() {
Column({space: CommonConstants.SPACE_12}) {
Text("接下来")
.fontSize($r('sys.float.Title_S'))
Image(this.nextDto?.image?.primary)
.alt($r('app.media.alt'))
.autoResize(true)
.objectFit(ImageFit.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ShowNextUp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right nextDto ? : AST#type_annotation#Left AST#primary_type#Left FinItem AST#primary_type#Right AST#type_an... | @Component
export struct ShowNextUp {
@Require nextDto?: FinItem
build() {
Column({space: CommonConstants.SPACE_12}) {
Text("接下来")
.fontSize($r('sys.float.Title_S'))
Image(this.nextDto?.image?.primary)
.alt($r('app.media.alt'))
.autoResize(true)
.objectFit(ImageFit.... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/detail/show/ShowComponent.ets#L15-L44 | db0da8e8902e90fad34ee3f11ea0771443a567d6 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/components/ControlPanel.ets | arkts | ControlPanel | 视频亮度、音量控制器
功能描述:
1.构建视频亮度、音量控制器
2.手指在视频左右两侧滑动可控制视频页面的亮度以及视频的声音。
实现原理:
1.通过this.fingerPosition和this.videoAreaWidth / PARTITION比较来判断需要显示亮度控制器还是声音控制器
2.使用Progress来显示进度条,同时value值为this.bright、this.volume亮度、声音大小
@param {number} volume - 音量大小(必需)
@param {number} bright - 亮度大小(必需)
@param {number} fingerPosition - 手指定位位置(必需)... | @Component
export struct ControlPanel {
@Link volume: number; // 音量大小
@Link bright: number; // 亮度大小
@Link fingerPosition: number; // 手指定位位置
@Link videoAreaWidth: number; // 视频播放区域宽度
@Link videoAreaHeight: number; // 视频播放区域高度
@Link controlShow: boolean; // 控制器是否显示
@Link maxVolume: number; // 媒体最大音量
buil... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ControlPanel AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right volume : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotat... | @Component
export struct ControlPanel {
@Link volume: number;
@Link bright: number;
@Link fingerPosition: number;
@Link videoAreaWidth: number;
@Link videoAreaHeight: number;
@Link controlShow: boolean;
@Link maxVolume: number;
build() {
Stack() {
Image($r('app.media.pip_window_... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/ControlPanel.ets#L37-L90 | c9c6eede8ed865fb7bd7fe3f29f0c1442e50eb12 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/JsonParser.ets | arkts | parseJsonContent | 解析JSON内容为联系人导入数据
@param jsonContent JSON文件内容
@returns 解析结果 | static parseJsonContent(jsonContent: string): JsonParseResult {
const result: JsonParseResult = {
success: false,
data: [],
errors: [],
warnings: [],
totalRecords: 0,
validRecords: 0
};
try {
if (!jsonContent || jsonContent.trim().length === 0) {
result.err... | AST#method_declaration#Left static parseJsonContent AST#parameter_list#Left ( AST#parameter#Left jsonContent : 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 JsonParseR... | static parseJsonContent(jsonContent: string): JsonParseResult {
const result: JsonParseResult = {
success: false,
data: [],
errors: [],
warnings: [],
totalRecords: 0,
validRecords: 0
};
try {
if (!jsonContent || jsonContent.trim().length === 0) {
result.err... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/JsonParser.ets#L69-L127 | 6b4cc0c70d96407141e076fd1f121a96a21ef5e9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 性能配置接口 | export interface PerformanceConfig {
enableCache: boolean;
cacheSize: number; // MB
lazyLoading: boolean;
animationOptimization: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PerformanceConfig AST#object_type#Left { AST#type_member#Left enableCache : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left cacheSize : AST#typ... | export interface PerformanceConfig {
enableCache: boolean;
cacheSize: number;
lazyLoading: boolean;
animationOptimization: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L137-L142 | f669355c563ffdf5da1a1e0f7b4122ae59981ef5 | github | |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/utils/MoodDB.ets | arkts | parseResultSet | 辅助方法:解析数据 (这个必须在 class 内部) | private static parseResultSet(resultSet: relationalStore.ResultSet): MoodData {
// 注意:这里需要根据新的表结构取值
return new MoodData(
resultSet.getLong(resultSet.getColumnIndex('id')),
resultSet.getLong(resultSet.getColumnIndex('userId')), // 取出 userId
resultSet.getLong(resultSet.getColumnIndex('date')),
... | AST#method_declaration#Left private static parseResultSet AST#parameter_list#Left ( AST#parameter#Left resultSet : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parame... | private static parseResultSet(resultSet: relationalStore.ResultSet): MoodData {
return new MoodData(
resultSet.getLong(resultSet.getColumnIndex('id')),
resultSet.getLong(resultSet.getColumnIndex('userId')),
resultSet.getLong(resultSet.getColumnIndex('date')),
resultSet.getLong(resultSe... | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/utils/MoodDB.ets#L185-L197 | b86e2053ba65da947f0d7c7d5f2ff20cae71b0bf | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | publishLongText | 发布长文本通知
@param options 通知实体
@returns | static async publishLongText(options: NotificationLongTextOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtil.generateNotificationId(); //通知ID。
const longTextContent: notificationManager.NotificationLongTextContent = {
title: options.title,
text: options.text,
... | AST#method_declaration#Left static async publishLongText AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationLongTextOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primar... | static async publishLongText(options: NotificationLongTextOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtil.generateNotificationId();
const longTextContent: notificationManager.NotificationLongTextContent = {
title: options.title,
text: options.text,
br... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L170-L193 | 726594da5d055949b7974fb1f0657024fb77734a | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | offDataChange | 取消精确订阅数据变更。
@param keys 需要订阅的key集合。
@param callback 需要取消的回调函数,若callback不填写,表示所有的callback都需要处理;若callback填写,表示只处理该callback。
@param preferenceName 实例的名称。 | static offDataChange(keys: string | Array<string>, callback: Callback<Record<string, preferences.ValueType>>,
preferenceName: string = PreferencesUtil.defaultPreferenceName) {
let preferences = PreferencesUtil.getPreferencesSync(preferenceName); //获取实例
if (typeof keys == 'string') {
keys = [keys];
... | AST#method_declaration#Left static offDataChange AST#parameter_list#Left ( AST#parameter#Left keys : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Le... | static offDataChange(keys: string | Array<string>, callback: Callback<Record<string, preferences.ValueType>>,
preferenceName: string = PreferencesUtil.defaultPreferenceName) {
let preferences = PreferencesUtil.getPreferencesSync(preferenceName);
if (typeof keys == 'string') {
keys = [keys];
}
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L314-L325 | a9a435068afb3abd3fbc744ef7156c3778be70c8 | gitee |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets | arkts | deleteCartItem | 删除购物车商品 | async deleteCartItem(imageKey: string): Promise<void> {
try {
const httpRequest = http.createHttp();
const response = await httpRequest.request(
'http://192.168.32.1:8080/api/cart/delete',
{
method: http.RequestMethod.DELETE,
header: {
'Content-Type': 'app... | AST#method_declaration#Left async deleteCartItem AST#parameter_list#Left ( AST#parameter#Left imageKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type... | async deleteCartItem(imageKey: string): Promise<void> {
try {
const httpRequest = http.createHttp();
const response = await httpRequest.request(
'http://192.168.32.1:8080/api/cart/delete',
{
method: http.RequestMethod.DELETE,
header: {
'Content-Type': 'app... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L186-L220 | 9acc9f30fbae8ea60b2003727804102dd86bb905 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Box.ets | arkts | equals | 比较两个Box对象是否相等
@param lhs - 左侧Box对象
@param rhs - 右侧Box对象 | static equals(lhs: Box, rhs: Box): boolean {
return lhs.equals(rhs);
} | AST#method_declaration#Left static equals AST#parameter_list#Left ( AST#parameter#Left lhs : AST#type_annotation#Left AST#primary_type#Left Box AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rhs : AST#type_annotation#Left AST#primary_type#Left Box AST#primary_type#Right AST#ty... | static equals(lhs: Box, rhs: Box): boolean {
return lhs.equals(rhs);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Box.ets#L128-L130 | 14da0dd89ef94596a58f7fbfd47bce93f799d1b7 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/ImageUtil.ets | arkts | pack2FileFromPixelMap | 将PixelMap图片写入文件
@param source PixelMap图片
@param fd 文件描述符
@param format 目标格式。只支持jpeg、webp、png
@returns | static async pack2FileFromPixelMap(source: image.PixelMap, fd: number,
format: string = 'image/png'): Promise<OutDTO<string>> {
//创建图像编码ImagePacker对象
const imagePacker: image.ImagePacker = image.createImagePacker();
//打包参数
let packOpts: image.PackingOption = { format: format, quality: 98 };
//打包... | AST#method_declaration#Left static async pack2FileFromPixelMap AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ... | static async pack2FileFromPixelMap(source: image.PixelMap, fd: number,
format: string = 'image/png'): Promise<OutDTO<string>> {
const imagePacker: image.ImagePacker = image.createImagePacker();
let packOpts: image.PackingOption = { format: format, quality: 98 };
await imagePacker.packToFi... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L262-L274 | afd0d2f9a1c3dbe72dc95fd7717f9e293b287fb4 | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | saveToFile | 导出功能 保存到文件 | public async saveToFile(json: string, context: common.UIAbilityContext): Promise<boolean> {
let jsonFilename = `ASFShortcut-backup-${this.getDate()}.json`;
const documentSaveOptions = new picker.DocumentSaveOptions();
documentSaveOptions.newFileNames = [jsonFilename];
documentSaveOption... | AST#method_declaration#Left public async saveToFile AST#parameter_list#Left ( AST#parameter#Left json : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t... | public async saveToFile(json: string, context: common.UIAbilityContext): Promise<boolean> {
let jsonFilename = `ASFShortcut-backup-${this.getDate()}.json`;
const documentSaveOptions = new picker.DocumentSaveOptions();
documentSaveOptions.newFileNames = [jsonFilename];
documentSaveOption... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/CommonUtils.ets#L91-L122 | 5aa887e15b79f42a22910e868f1f1d2f1843f2de | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | pickLocalImage | 从本地选择图片 | async pickLocalImage(): Promise<void> {
try {
// 创建图片选择器实例
let photoPicker = new picker.PhotoViewPicker();
// 设置选择参数
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = ... | AST#method_declaration#Left async pickLocalImage 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_a... | async pickLocalImage(): Promise<void> {
try {
let photoPicker = new picker.PhotoViewPicker();
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
try {... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L634-L670 | bdcd4e35224be70fcd0eb69724bad35c6257ee2f | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | imageConvert | 图片格式转换
@param input 输入图片路径
@param output 输出图片路径
@param quality 质量 1-31(数字越小质量越高),默认 2 | public static imageConvert(input: string, output: string, quality: number = 2): string[] {
return [
'ffmpeg',
'-i', input,
'-q:v', quality.toString(),
'-y', output
];
} | AST#method_declaration#Left public static imageConvert AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#p... | public static imageConvert(input: string, output: string, quality: number = 2): string[] {
return [
'ffmpeg',
'-i', input,
'-q:v', quality.toString(),
'-y', output
];
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L311-L318 | 04b4644b25a1cea30609d859bff8d496a815ae0b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.