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/services/analytics/AnalyticsService.ets | arkts | getBirthdayStats | 获取生日统计 | async getBirthdayStats(): Promise<BirthdayStats> {
const contactSearchParams: ContactSearchParams = { pageSize: 10000 };
const contacts = await this.contactService.searchContacts(contactSearchParams);
const validContacts = contacts.filter(c => c.birthday.date);
// 月份分布
const monthlyDistribution = t... | AST#method_declaration#Left async getBirthdayStats 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 BirthdayStats AST#primary_type#Right AST#type_annotation#Right >... | async getBirthdayStats(): Promise<BirthdayStats> {
const contactSearchParams: ContactSearchParams = { pageSize: 10000 };
const contacts = await this.contactService.searchContacts(contactSearchParams);
const validContacts = contacts.filter(c => c.birthday.date);
const monthlyDistribution = this.cal... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L428-L459 | 6e119df0827692060b57f5718d58cb5d60a74d97 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/Detail/DetailTypeDialog.ets | arkts | checkValid | 检查返回数据的合规性 | private checkValid(): Boolean {
if (this.startTime && this.endTime) {
if (this.startTime < this.endTime) {
return true;
}
}
else if (this.endTime) {
this.startTime = new Date().setDate(1);
if (this.startTime < this.endTime) {
return true;
}
}
else {
... | AST#method_declaration#Left private checkValid AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression... | private checkValid(): Boolean {
if (this.startTime && this.endTime) {
if (this.startTime < this.endTime) {
return true;
}
}
else if (this.endTime) {
this.startTime = new Date().setDate(1);
if (this.startTime < this.endTime) {
return true;
}
}
else {
... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Detail/DetailTypeDialog.ets#L279-L322 | 5d923af11d6e10cbbe1e59abd50123191fcdf0be | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/SearchSchedule.ets | arkts | ItemSwipeRight | ListItem 左滑显示的组件。将对应日程删除。
@param schedule 组件对应的日程记录 | @Builder
private ItemSwipeRight(schedule: Schedule): void {
Row() {
Image($r('app.media.ic_contacts_delete'))
.size({ width: 24, height: 24 })
.fillColor($r('app.color.pure_white'));
}
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.red'))
.size({ width: '100... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ItemSwipeRight AST#parameter_list#Left ( AST#parameter#Left schedule : AST#type_annotation#Left AST#primary_type#Left Schedule AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a... | @Builder
private ItemSwipeRight(schedule: Schedule): void {
Row() {
Image($r('app.media.ic_contacts_delete'))
.size({ width: 24, height: 24 })
.fillColor($r('app.color.pure_white'));
}
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.red'))
.size({ width: '100... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/SearchSchedule.ets#L399-L433 | 5188b642b8233dde7a8bb222003463eb76647996 | github |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/pages/EnvironmentInfoPage.ets | arkts | getTextColor | 获取文字颜色 | private getTextColor(status: number): Color {
switch (status) {
case 0:
return Color.Green; // 安全-深绿色
case 1:
return Color.Orange; // 警告-深橙色
case 2:
return Color.Red; // 危险-深红色
default:
return Color.Gray; // 未知-深灰色
} | AST#method_declaration#Left private getTextColor AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_... | private getTextColor(status: number): Color {
switch (status) {
case 0:
return Color.Green;
case 1:
return Color.Orange;
case 2:
return Color.Red;
default:
return Color.Gray;
} | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/EnvironmentInfoPage.ets#L250-L260 | 3fb176b4fd02d9c285f346850ba43a964fd4e9cc | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/InteractiveGameService.ets | arkts | endGame | 结束游戏 | async endGame(sessionId: string): Promise<GameResult> {
try {
const session = this.activeSessions.get(sessionId);
if (!session) {
throw new Error(`Game session not found: ${sessionId}`);
}
session.state = GameState.COMPLETED;
session.endTime = new Date().toISOString();
s... | AST#method_declaration#Left async endGame AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async endGame(sessionId: string): Promise<GameResult> {
try {
const session = this.activeSessions.get(sessionId);
if (!session) {
throw new Error(`Game session not found: ${sessionId}`);
}
session.state = GameState.COMPLETED;
session.endTime = new Date().toISOString();
s... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L267-L311 | 784b266247bb73c26fedd43ccdd54fd9e3c61d79 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets | arkts | 一级列表可视区域的起始索引和终点索引。
@interface
@property {number} start - 可视区域起点索引。
@property {number} end - 可视区域终点索引。 | export interface ListIndexPosition {
start: number,
end: number,
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ListIndexPosition AST#object_type#Left { AST#type_member#Left start : 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 end : AST#type_annotation#... | export interface ListIndexPosition {
start: number,
end: number,
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets#L35-L38 | 24bae5a8ed4b0615c8ace1030874a4ea3f118647 | gitee | |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/components/SwipeCardStack.ets | arkts | performSwipeOut | 执行滑出动画 | private performSwipeOut(deltaX: number, deltaY: number, data: object, dataIndex: number): void {
this.cardState = CardState.SWIPING;
// 判断滑动方向
const direction: SwipeDirection = Math.abs(deltaX) > Math.abs(deltaY)
? (deltaX > 0 ? SwipeDirection.RIGHT : SwipeDirection.LEFT)
: (deltaY > 0 ? SwipeD... | AST#method_declaration#Left private performSwipeOut AST#parameter_list#Left ( AST#parameter#Left deltaX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left deltaY : AST#type_annotation#Left AST#primary_type#Left number AST#pri... | private performSwipeOut(deltaX: number, deltaY: number, data: object, dataIndex: number): void {
this.cardState = CardState.SWIPING;
const direction: SwipeDirection = Math.abs(deltaX) > Math.abs(deltaY)
? (deltaX > 0 ? SwipeDirection.RIGHT : SwipeDirection.LEFT)
: (deltaY > 0 ? SwipeDirection.... | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/components/SwipeCardStack.ets#L382-L415 | e2ed934aee3e308777f405d169d26a926922483b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildContactsStats | 联系人统计信息 | @Builder
buildContactsStats() {
Column({ space: 12 }) {
// 第一行统计
Row({ space: 12 }) {
// 总联系人数
Column({ space: 4 }) {
Text(this.allContacts.length.toString())
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.primary)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactsStats AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_... | @Builder
buildContactsStats() {
Column({ space: 12 }) {
Row({ space: 12 }) {
Column({ space: 4 }) {
Text(this.allContacts.length.toString())
.fontSize(24)
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.primary)
Text('总联系人'... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1933-L1993 | bb57d44249bd3afabdbd7e7bd118c004dc551d8c | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | setBaseURL | 设置全局请求路径前缀
@param baseURL 请求路径前缀
@returns | setBaseURL(baseURL: string): EfRcp {
//【注】在beta5之前版本中,给config设置baseAddress不生效,无法跟url拼接,故采用了efRcpConfig.baseURL设置
// 在beta5版本中生效了 故优化为正确方式
this.cfg.baseAddress = baseURL;
return this;
} | AST#method_declaration#Left setBaseURL AST#parameter_list#Left ( AST#parameter#Left baseURL : 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 EfRcp AST#primary_type#Righ... | setBaseURL(baseURL: string): EfRcp {
this.cfg.baseAddress = baseURL;
return this;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L448-L453 | 71d5e5b49720923c09caa577d4f26fa4bef649ab | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/RequestUtils.ets | arkts | 请求方法枚举 | export enum RequestMethod {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum RequestMethod AST#enum_body#Left { AST#enum_member#Left GET = AST#expression#Left 'GET' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left POST = AST#expression#Left 'POST' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ... | export enum RequestMethod {
GET = 'GET',
POST = 'POST',
PUT = 'PUT',
DELETE = 'DELETE'
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/RequestUtils.ets#L5-L10 | ff043ff736c7e254ed3339d880503f40ddadb2dc | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | convertPriKeyFromStr | 将非对称加密字符串priKey转换为symKey对象
@param privateKey字符串key
@param symAlgName 秘钥规格
@returns | static async convertPriKeyFromStr(privateKey: string, symAlgName: string, keyName: number) {
let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.stringToByteArray(privateKey, keyName) };
let aesGenerator = crypto.createAsyKeyGenerator(symAlgName);
let symKey = await aesGenerator.convertKey(null, symKey... | AST#method_declaration#Left static async convertPriKeyFromStr AST#parameter_list#Left ( AST#parameter#Left privateKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#L... | static async convertPriKeyFromStr(privateKey: string, symAlgName: string, keyName: number) {
let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.stringToByteArray(privateKey, keyName) };
let aesGenerator = crypto.createAsyKeyGenerator(symAlgName);
let symKey = await aesGenerator.convertKey(null, symKey... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L49-L54 | b17018439a6f6e0ca05c1992e8079d8336a2f356 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | encryptSync | 加密,同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
@returns | static encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, symKey, params, transformation);
} | AST#method_declaration#Left static encryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey :... | static encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, symKey, params, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L227-L230 | d78d7d1dcb6585223f2a5405ab636b2a7ca57c81 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/LoadingProgressView.ets | arkts | LoadingProgressView | 带进度条 - 加载中loading | @ComponentV2
export struct LoadingProgressView {
@Require @Param options: ILoadingProgressOptions;
// @Require @Param observedData: LoadingProgressObserved
@Local progressLocal: LoadingProgressObserved = new LoadingProgressObserved();
aboutToAppear(): void {
this.progressLocal = this.options?.observedData ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LoadingProgressView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#prim... | @ComponentV2
export struct LoadingProgressView {
@Require @Param options: ILoadingProgressOptions;
@Local progressLocal: LoadingProgressObserved = new LoadingProgressObserved();
aboutToAppear(): void {
this.progressLocal = this.options?.observedData as LoadingProgressObserved
}
@Computed
private ge... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/LoadingProgressView.ets#L7-L64 | af42b2bb6b19883aee01e96801ec1da7ceda6887 | github |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleF/entry/src/main/ets/model/CameraModel.ets | arkts | scanCode | 扫描二维码
@param w,h | async scanCode(w: number, h: number) {
try {
let qrCode: QRCode = new QRCode();
let wh: ImageWH = {
width: w,
height: h
}
let text: string = await qrCode.decode(this.pixelMap as image.PixelMap, wh);
Logger.info(TAG, 'text==JSON.stringify===' + JSON.stringify(text))
... | AST#method_declaration#Left async scanCode AST#parameter_list#Left ( AST#parameter#Left w : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left h : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST... | async scanCode(w: number, h: number) {
try {
let qrCode: QRCode = new QRCode();
let wh: ImageWH = {
width: w,
height: h
}
let text: string = await qrCode.decode(this.pixelMap as image.PixelMap, wh);
Logger.info(TAG, 'text==JSON.stringify===' + JSON.stringify(text))
... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleF/entry/src/main/ets/model/CameraModel.ets#L100-L126 | 19d9837f973f6095cb3465f4a110aa008ad084ce | gitee |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/utils/crypto.ets | arkts | encode | @throws | static encode(msg: string, key: string) {
const ivByte = cryptoFramework.createRandom().generateRandomSync(16)
const ivSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivByte }
const symKeyBlob: cryptoFramework.DataBlob = { data: new Uint8Array(buffer.from(key, 'utf-8').buffer) }
cons... | AST#method_declaration#Left static encode AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right ... | static encode(msg: string, key: string) {
const ivByte = cryptoFramework.createRandom().generateRandomSync(16)
const ivSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivByte }
const symKeyBlob: cryptoFramework.DataBlob = { data: new Uint8Array(buffer.from(key, 'utf-8').buffer) }
cons... | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/utils/crypto.ets#L8-L28 | 8dd9f6a4d49f5fe595fa3fbc2ba18cb0d475601d | github |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/addDevice/models/TLVModel.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export default class TLV {
tag: number
length: number
value: string
TLVLength: number
constructor | AST#export_declaration#Left export AST#ERROR#Left default class TLV { tag : AST#ERROR#Left number length : number value : string TLVLength : AST#ERROR#Right number AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#ex... | export default class TLV {
tag: number
length: number
value: string
TLVLength: number
constructor | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/addDevice/models/TLVModel.ets#L16-L22 | efe62c5fd51354328377a8f843e893d63a4a15ac | gitee | |
yongoe1024/RdbPlus.git | 4a3fc04ba5903bc1c1b194efbc557017976909dc | rdbplus/src/main/ets/core/MyWrapper.ets | arkts | getOrder | 得到排序sql | getOrder(): string {
if (this.orderList.length == 0) {
return ''
} else {
return 'order by ' + this.orderList.join(',')
}
} | AST#method_declaration#Left getOrder 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#e... | getOrder(): string {
if (this.orderList.length == 0) {
return ''
} else {
return 'order by ' + this.orderList.join(',')
}
} | https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/MyWrapper.ets#L48-L54 | a7ccfd1f577458b31eb675bc4cb71ceecbb6a661 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/healthchart/src/main/ets/model/BasicDataSource.ets | arkts | 图表的Marker(标志气泡)组件 | export class CustomUiInfo {
type: string;
width: number;
height: number;
showUi: boolean;
x: number;
y: number;
offsetLeft: number;
offsetRight: number;
data: EntryOhos | null;
isInbounds: boolean;
constructor(
type: string,
width: number,
height: number,
showUi: boolean = false,
... | AST#export_declaration#Left export AST#class_declaration#Left class CustomUiInfo AST#class_body#Left { AST#property_declaration#Left type : 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 width : AST#ty... | export class CustomUiInfo {
type: string;
width: number;
height: number;
showUi: boolean;
x: number;
y: number;
offsetLeft: number;
offsetRight: number;
data: EntryOhos | null;
isInbounds: boolean;
constructor(
type: string,
width: number,
height: number,
showUi: boolean = false,
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/healthchart/src/main/ets/model/BasicDataSource.ets#L19-L60 | d8ac37ceeb3933839848672fd962592698c19ba4 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreviewUtil.ets | arkts | canPreview | 根据文件的uri判断文件是否可预览
@param uri 文件的uri
@returns | static canPreview(uri: string): Promise<boolean> {
return filePreview.canPreview(AppUtil.getContext(), uri);
} | AST#method_declaration#Left static canPreview AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr... | static canPreview(uri: string): Promise<boolean> {
return filePreview.canPreview(AppUtil.getContext(), uri);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L55-L57 | 9cdb063092fd8512d7c63c3108f01f04616b7194 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/Horspool.ets | arkts | findFirstMatch | 查找模式串在文本中的第一个出现位置
@param text 文本字符串
@param pattern 模式串
@returns 第一个匹配位置,如果未找到则返回 -1 | static findFirstMatch(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return -1;
}
const badCharTable = this.buildBadCharTable(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
while (i <= n - m) {
let j = m - 1;
... | AST#method_declaration#Left static findFirstMatch AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findFirstMatch(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return -1;
}
const badCharTable = this.buildBadCharTable(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
while (i <= n - m) {
let j = m - 1;
... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/Horspool.ets#L82-L107 | 26c0bbe3afd260629cf082fe600aa415c9dd0a28 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets | arkts | setBottomSafeHeight | 存储底部安全区域高度 | private setBottomSafeHeight(bottomSafeHeight: number) {
this.bottomSafeHeight = bottomSafeHeight;
} | AST#method_declaration#Left private setBottomSafeHeight AST#parameter_list#Left ( AST#parameter#Left bottomSafeHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_st... | private setBottomSafeHeight(bottomSafeHeight: number) {
this.bottomSafeHeight = bottomSafeHeight;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets#L72-L74 | 0737ba0384b1e64f70209432ab1669df629d063e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/PreferencesService.ets | arkts | putObject | 存储对象值(转换为JSON字符串)
@param key 键
@param value 对象值 | async putObject<T>(key: string, value: T): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.putString(key, jsonString);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to put object: ${businessError... | AST#method_declaration#Left async putObject AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri... | async putObject<T>(key: string, value: T): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.putString(key, jsonString);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to put object: ${businessError... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L201-L210 | 271217df18ea90c7991291d2528199454dac1fac | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/MyDay.ets | arkts | ItemSwipeRight | ListItem 左滑显示的组件。将对应日程删除。
@param schedule 组件对应的日程记录 | @Builder
private ItemSwipeRight(schedule: Schedule): void {
Row() {
Image($r('app.media.ic_contacts_delete'))
.size({ width: 24, height: 24 })
.fillColor($r('app.color.pure_white'));
}
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.red'))
.size({ width: '100... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ItemSwipeRight AST#parameter_list#Left ( AST#parameter#Left schedule : AST#type_annotation#Left AST#primary_type#Left Schedule AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a... | @Builder
private ItemSwipeRight(schedule: Schedule): void {
Row() {
Image($r('app.media.ic_contacts_delete'))
.size({ width: 24, height: 24 })
.fillColor($r('app.color.pure_white'));
}
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.red'))
.size({ width: '100... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L902-L939 | ee45ed6551c619396470870d3a5b324f34c1922f | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/NotificationUtils.ets | arkts | publishLongText | 发布长文本通知
@param options 通知实体
@returns | static async publishLongText(options: NotificationLongTextOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtils.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 ?? NotificationUtils.generateNotificationId();
const longTextContent: notificationManager.NotificationLongTextContent = {
title: options.title,
text: options.text,
b... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L165-L188 | 33c0194f04571d3a825929b24f335c8dcf202238 | gitee |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets | arkts | 综合类下的视频信息 | export class VideoDetailInfo{
public videoDetailId: number; // 视频ID
public videoDetailAuthorName: string; // 视频作者名称
public videoDetailAuthorIcon: Resource; // 视频作者头像
public videoDetailTime: string; // 视频发布时间
public videoDetailTitle: string; // 视频标题
public videoDetailLabel: string; // 视频标签
public videoDeta... | AST#export_declaration#Left export AST#class_declaration#Left class VideoDetailInfo AST#class_body#Left { AST#property_declaration#Left public videoDetailId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 视频ID AST#property_decl... | export class VideoDetailInfo{
public videoDetailId: number;
public videoDetailAuthorName: string;
public videoDetailAuthorIcon: Resource;
public videoDetailTime: string;
public videoDetailTitle: string;
public videoDetailLabel: string;
public videoDetailLike: string;
public videoDetailComment: st... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets#L42-L78 | 3a91c248fe5a2dac65cbd450c76fba9c42182981 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets | arkts | reqCurGrantStatus | 检测权限状态
@param {Permissions} permission 检测授权的权限名
@returns {Promise<abilityAccessCtrl.GrantStatus>} 权限状态 | async reqCurGrantStatus(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
// 获取应用程序的accessTokenID
let to... | AST#method_declaration#Left async reqCurGrantStatus AST#parameter_list#Left ( AST#parameter#Left permission : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge... | async reqCurGrantStatus(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
let tokenId: number = 0;
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets#L66-L91 | 22398a69744f852e58d422c16a1c7df031fb4676 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets | arkts | InnerIndex.ets (two level) | export * from './ThirdIndex' | AST#export_declaration#Left export * from './ThirdIndex' AST#export_declaration#Right | export * from './ThirdIndex' | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets#L16-L16 | cdd003719d6d27d9492b826af1114289148fc120 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | createIndexes | 创建索引 | private async createIndexes(): Promise<void> {
try {
const indexes = [
`CREATE INDEX IF NOT EXISTS idx_contacts_name ON ${StorageConstants.TABLE_CONTACTS} (name)`,
`CREATE INDEX IF NOT EXISTS idx_contacts_relation ON ${StorageConstants.TABLE_CONTACTS} (relation)`,
`CREATE INDEX IF NOT ... | AST#method_declaration#Left private async createIndexes 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... | private async createIndexes(): Promise<void> {
try {
const indexes = [
`CREATE INDEX IF NOT EXISTS idx_contacts_name ON ${StorageConstants.TABLE_CONTACTS} (name)`,
`CREATE INDEX IF NOT EXISTS idx_contacts_relation ON ${StorageConstants.TABLE_CONTACTS} (relation)`,
`CREATE INDEX IF NOT ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L171-L193 | 952c8098e43957e994f516cda2cfb33f0f49256f | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppTheme.ets | arkts | ========================== 颜色调色板接口 ========================== | export interface ColorPalette {
primary : ResourceColor // 导航
secondary : ResourceColor // 主色接近的区别色
accent : ResourceColor // 强调色,如:突出按钮
accent2 : ResourceColor
obscure : ResourceColor // 不显眼的颜色,如灰色按钮、线框
background : ResourceColor // 页面背景
light : ResourceColor // 白色(导航按钮 tin... | AST#export_declaration#Left export AST#interface_declaration#Left interface ColorPalette AST#object_type#Left { AST#type_member#Left primary : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 导航 AST#type_member#Left secondary : AST#ty... | export interface ColorPalette {
primary : ResourceColor
secondary : ResourceColor
accent : ResourceColor
accent2 : ResourceColor
obscure : ResourceColor
background : ResourceColor
light : ResourceColor
clear : ResourceColor
link : ResourceColor
l... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppTheme.ets#L15-L30 | e86260364d87abec1cff5241656dde00a4863e9e | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets | arkts | 多行文本框(TextArea)代理 | export class TextAreaBuilderProxy extends BaseInputBuilderProxy<ITextAreaOptions, TextAreaDialog> implements IBuilderProxy {
create(options: ITextAreaOptions) {
return new TextAreaDialog(options);
}
/**
* 文本框类型
* @default TextAreaType.Normal
*/
inputType(inputType: TextAreaType) {
this.builder... | AST#export_declaration#Left export AST#class_declaration#Left class TextAreaBuilderProxy extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseInputBuilderProxy AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ITextAreaOptions AST#primary_type#Right AST#type_annotation... | export class TextAreaBuilderProxy extends BaseInputBuilderProxy<ITextAreaOptions, TextAreaDialog> implements IBuilderProxy {
create(options: ITextAreaOptions) {
return new TextAreaDialog(options);
}
inputType(inputType: TextAreaType) {
this.builderOptions.inputType = inputType;
return this
}
... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextAreaBuilderProxy.ets#L10-L53 | 94174a5e9c95a03079300170491c78f6f07d5090 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | isLeapYear | 判断是否是闰年 | static isLeapYear(year: number): boolean {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
} | AST#method_declaration#Left static isLeapYear 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_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | static isLeapYear(year: number): boolean {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L31-L33 | e88647cb52f5b77292a265615c07a898371a852a | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/ECDSASync.ets | arkts | sign | 签名
@param str 需要签名的字符串
@param priKey 私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64) - 不传默认为base64
@returns OutDTO<string> 签名对象 | static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.sign(str, priKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, resultCoding,false);
} | AST#method_declaration#Left static sign 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#primary_type#Right... | static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.sign(str, priKey, 'ECC256', 'ECC256|SHA256', 256, keyCoding, resultCoding,false);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/ECDSASync.ets#L45-L48 | 7b12f15a0793c1dac9d854cf7504c31caf31e8c2 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | HDRVivid/AVCodecVideo/entry/src/main/ets/pages/Recorder.ets | arkts | setColorSpaceBeforeCommitConfig | Set the color space | function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: boolean): void {
let colorSpace: colorSpaceManager.ColorSpace =
isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT;
let colorSpaces: Array<colorSpaceManager.ColorSpace> = getSupportedColor... | AST#function_declaration#Left function setColorSpaceBeforeCommitConfig AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . VideoSession AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p... | function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: boolean): void {
let colorSpace: colorSpaceManager.ColorSpace =
isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT;
let colorSpaces: Array<colorSpaceManager.ColorSpace> = getSupportedColor... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVCodecVideo/entry/src/main/ets/pages/Recorder.ets#L145-L163 | db4ca3676478ee1927583f5dab32861270f2ca68 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets | arkts | getValueFormatter | Returns the formatter used for formatting the axis labels.
@return | public getValueFormatter(): IAxisValueFormatter {
if (
!this.mAxisValueFormatter ||
this.mAxisValueFormatter == null ||
(this.mAxisValueFormatter instanceof DefaultAxisValueFormatter &&
(this.mAxisValueFormatter as DefaultAxisValueFormatter).getDecimalDigits() != this.mDecimals)
) {
this.m... | AST#method_declaration#Left public getValueFormatter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IAxisValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expr... | public getValueFormatter(): IAxisValueFormatter {
if (
!this.mAxisValueFormatter ||
this.mAxisValueFormatter == null ||
(this.mAxisValueFormatter instanceof DefaultAxisValueFormatter &&
(this.mAxisValueFormatter as DefaultAxisValueFormatter).getDecimalDigits() != this.mDecimals)
) {
this.m... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L542-L553 | 731ff362fbfa3a1d7541579bde33f30d9d421657 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | decodeAsymSegment | 非对称分段解密
@param decodeStr 待解密的字符串
@param priKey 给定秘钥规格私钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格 | static async decodeAsymSegment(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
//将私钥转换
let priPair = await CryptoUtil.convertPriKeyFromStr(priKey, symAlgName, keyName);
//生成解密器
let encoder = crypto.createCipher(symEncryptName);
//定... | AST#method_declaration#Left static async decodeAsymSegment 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... | static async decodeAsymSegment(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
let priPair = await CryptoUtil.convertPriKeyFromStr(priKey, symAlgName, keyName);
let encoder = crypto.createCipher(symEncryptName);
let strSplit... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L290-L316 | 1bda4746873c02ee0764061c4f6cc143abd07264 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ScreenFlickerSolution/entry/src/main/ets/pages/ClickError.ets | arkts | Control zoom | build() {
Stack() {
Stack() {
Text('click')
.fontSize(45)
.fontColor(Color.White)
}
.borderRadius(50)
.width(100)
.height(100)
.backgroundColor('#e6cfe6')
.scale({ x: this.scaleValue, y: this.scaleValue })
.onClick(() => {
// When t... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui... | build() {
Stack() {
Stack() {
Text('click')
.fontSize(45)
.fontColor(Color.White)
}
.borderRadius(50)
.width(100)
.height(100)
.backgroundColor('#e6cfe6')
.scale({ x: this.scaleValue, y: this.scaleValue })
.onClick(() => {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ScreenFlickerSolution/entry/src/main/ets/pages/ClickError.ets#L23-L59 | cdf7ea653837d5726c5fe18846a66139fdac3bbe | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionCancel | The Rotation gesture is successfully recognized and a callback is triggered when the touch cancel event
is received.
@param { Callback<void> } event
@returns { RotationGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionCancel(event: Callback<void>): RotationGesture; | AST#method_declaration#Left onActionCancel AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | onActionCancel(event: Callback<void>): RotationGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L714-L714 | c8a9fef9b0f4b999ee121faf79fa520f989c166f | gitee |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/pages/DustMonitoringPage.ets | arkts | getWarningAreaCount | 获取警告区域数量 | private getWarningAreaCount(): number {
return this.dustList.filter(item => item.status === 1).length;
} | AST#method_declaration#Left private getWarningAreaCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#mem... | private getWarningAreaCount(): number {
return this.dustList.filter(item => item.status === 1).length;
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/DustMonitoringPage.ets#L189-L191 | acfc42239129152225cce078d7524b3f05264f01 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets | arkts | showFatal | Outputs fatal-level logs.
@param tag Identifies the log tag.
@param format Indicates the log format string.
@param args Indicates the log parameters.
@since 7 | static showFatal(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.FATAL)) {
hilog.fatal(DOMAIN, tag, format, args);
}
} | AST#method_declaration#Left static showFatal AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static showFatal(tag: string, format: string, ...args: string[]): void {
if (Log.isLoggable(tag, hilog.LogLevel.FATAL)) {
hilog.fatal(DOMAIN, tag, format, args);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/Log.ets#L87-L91 | c14b4e6f3886985366dde6455639b076d6f734c0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets | arkts | searchViewBuilder | 展开和收起的动效视图 | @Builder
searchViewBuilder() {
Row() {
// 爱心图标
Image($r("app.media.status_bar_animation_favor"))
.width($r('app.integer.status_bar_animation_favor_width'))
.aspectRatio(Constants.ASPECT_RATIO_ONE)
.visibility(this.isFlow ? Visibility.Visible : Visibility.Hidden)
.positi... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right searchViewBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 爱心图标 AST#ar... | @Builder
searchViewBuilder() {
Row() {
Image($r("app.media.status_bar_animation_favor"))
.width($r('app.integer.status_bar_animation_favor_width'))
.aspectRatio(Constants.ASPECT_RATIO_ONE)
.visibility(this.isFlow ? Visibility.Visible : Visibility.Hidden)
.position({
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets#L178-L288 | 4eda3eafd65be05736e084b5e48e4f2ad9104540 | gitee |
xixi-cquer/ShouZhiJiZhang.git | aafb992b704f758715c5ee21e6cb636b467be7de | entry/src/main/ets/viewmodel/AccountData.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export default class AccountData {
id: number = -1;
accountType: number = 0;
typeText: string = '';
amount: number = 0;
year: string ='';
month: string = '';
date: string = '';
reminder: string = '';
} | AST#export_declaration#Left export default AST#class_declaration#Left class AccountData AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 ... | export default class AccountData {
id: number = -1;
accountType: number = 0;
typeText: string = '';
amount: number = 0;
year: string ='';
month: string = '';
date: string = '';
reminder: string = '';
} | https://github.com/xixi-cquer/ShouZhiJiZhang.git/blob/aafb992b704f758715c5ee21e6cb636b467be7de/entry/src/main/ets/viewmodel/AccountData.ets#L16-L25 | 3c8775adca055831bd0b79e1b141e9777982ccf7 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.mediaquery.d.ets | arkts | Defines the MediaQuery event.
@interface MediaQueryEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 3
Defines the MediaQuery event.
@interface MediaQueryEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export interface MediaQueryEvent {
/**
* The result of match result.
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 3
*/
/**
* The result of match result.
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
... | AST#export_declaration#Left export AST#interface_declaration#Left interface MediaQueryEvent AST#object_type#Left { /**
* The result of match result.
*
* @type { boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 3
*/ /**
* The result of match result.
*
* @type { boolean }
* @sy... | export interface MediaQueryEvent {
matches: boolean;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.mediaquery.d.ets#L36-L53 | cf124886d19c9adf0dbbbd2223d669e01fec952f | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | StabilityCodingSpecification/DevEcoStaticCheck/src/main/ets/pages/Index2.ets | arkts | bar | Here is an example of a naming style error, where foo is the incorrect class name used, and the correct class name should be Foo | bar() {} | AST#method_declaration#Left bar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right | bar() {} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/StabilityCodingSpecification/DevEcoStaticCheck/src/main/ets/pages/Index2.ets#L22-L22 | ac989f8005bd250e52dbcd810b6706ea06dd1742 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | calculateDistanceEasy | 根据指定的两个经纬度坐标点,计算这两个点间的直线距离,单位为米。
@returns | static calculateDistanceEasy(fromLat: number, fromLng: number, toLat: number, toLng: number): number {
let fromLatLng: mapCommon.LatLng = { latitude: fromLat, longitude: fromLng };
let toLatLng: mapCommon.LatLng = { latitude: toLat, longitude: toLng };
return map.calculateDistance(fromLatLng, toLatLng);
} | AST#method_declaration#Left static calculateDistanceEasy AST#parameter_list#Left ( AST#parameter#Left fromLat : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromLng : AST#type_annotation#Left AST#primary_type#Left number ... | static calculateDistanceEasy(fromLat: number, fromLng: number, toLat: number, toLng: number): number {
let fromLatLng: mapCommon.LatLng = { latitude: fromLat, longitude: fromLng };
let toLatLng: mapCommon.LatLng = { latitude: toLat, longitude: toLng };
return map.calculateDistance(fromLatLng, toLatLng);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L299-L303 | 985e4eff228038e3e21e8ffec077f96cc9de41c0 | gitee |
batiluoxuanwan/MomentFlow.git | e57aa461223abca74f48893afc2ccf7c2d73e9b8 | frontend/entry/src/main/ets/api/DiaryApi.ets | arkts | update | 更新日记 | static async update(id: number, diary: DiaryDto): Promise<Diary | null> {
return request<Diary>(`${BASE_URL}/${id}`, {
method: http.RequestMethod.PUT,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify(diary)
})
} | AST#method_declaration#Left static async update AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left diary : AST#type_annotation#Left AST#primary_type#Left DiaryDto AST#primary_ty... | static async update(id: number, diary: DiaryDto): Promise<Diary | null> {
return request<Diary>(`${BASE_URL}/${id}`, {
method: http.RequestMethod.PUT,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify(diary)
})
} | https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/DiaryApi.ets#L77-L83 | 582f785b706679722bb7530acd0513cfd0316e67 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | SelectMode. include SINGLE_SELECT and MULTI_SELECT
@enum { number } SelectMode
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum SelectMode {
/**
* SINGLE_SELECT. single select
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
SINGLE_SELECT = 0,
/**
* MULTI_SELECT. multi select
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum SelectMode AST#enum_body#Left { /**
* SINGLE_SELECT. single select
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#enum_member#Left SINGLE_SEL... | export declare enum SelectMode {
SINGLE_SELECT = 0,
MULTI_SELECT = 1
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L973-L991 | ce01637137ebcd751e198f9a27156550924bf489 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/image/Avatar.ets | arkts | 构建头像组件
@returns {void} 无返回值 | build(): void {
IBestAvatar({
src: this.src,
shape: "circle",
avatarSize: this.avatarSize,
onAvatarClick: (): void => this.handleAvatarTap()
});
} | 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 IBestAvatar ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#member_expression#L... | build(): void {
IBestAvatar({
src: this.src,
shape: "circle",
avatarSize: this.avatarSize,
onAvatarClick: (): void => this.handleAvatarTap()
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/Avatar.ets#L29-L36 | 46ad5223b0ace43d9d618e6ce9f4bda3076a3223 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_user_agents.ets | arkts | del_user_agent | Remove a user agent from the current user agent list.
@param index A number, the index of the user agent to be removed in the list. | static del_user_agent(index: number) {
bunch_of_user_agents.list_of_user_agents.splice(index, 1);
bunch_of_user_agents.update_last_accessed();
} | AST#method_declaration#Left static del_user_agent AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#... | static del_user_agent(index: number) {
bunch_of_user_agents.list_of_user_agents.splice(index, 1);
bunch_of_user_agents.update_last_accessed();
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_user_agents.ets#L47-L50 | fd0438dfd7d29c00403782122360793554c5878c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets | arkts | paintPin | 绘制表针 | private paintPin(degree: number, pinImgRes: image.PixelMap | null) {
// TODO:知识点:先将当前绘制上下文保存再旋转画布,先保存旋转前的状态,避免状态混乱。
this.renderContext.save();
const angleToRadian = Math.PI / 180;
let theta = degree * angleToRadian;
this.renderContext.rotate(theta);
this.renderContext.beginPath();
if (pinIm... | AST#method_declaration#Left private paintPin AST#parameter_list#Left ( AST#parameter#Left degree : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pinImgRes : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Lef... | private paintPin(degree: number, pinImgRes: image.PixelMap | null) {
this.renderContext.save();
const angleToRadian = Math.PI / 180;
let theta = degree * angleToRadian;
this.renderContext.rotate(theta);
this.renderContext.beginPath();
if (pinImgRes) {
this.renderContext.drawImage(
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets#L208-L227 | 5c6471a8f900e88e8e9c8c702deeb264814d04ad | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTSUtilsDocModule/entry/src/main/ets/managers/async-concurrency-overview.ets | arkts | 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 async function asyncConcurrencyTest(): Promise<string> {
const result: string = await new Promise((resolve: Function) => {
setTimeout(() => {
resolve('Hello, world!');
}, 3000);
});
console.info(result); // 输出: Hello, world!
if (result == 'Hello, world!') {
return 'AsyncConcurrencyTest ... | AST#export_declaration#Left export AST#function_declaration#Left async function asyncConcurrencyTest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#pri... | export async function asyncConcurrencyTest(): Promise<string> {
const result: string = await new Promise((resolve: Function) => {
setTimeout(() => {
resolve('Hello, world!');
}, 3000);
});
console.info(result);
if (result == 'Hello, world!') {
return 'AsyncConcurrencyTest Succeed';
} else {... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTSUtilsDocModule/entry/src/main/ets/managers/async-concurrency-overview.ets#L16-L28 | 911acaf412316019dc4f4ef157ecaea49e67e07d | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets | arkts | title | 标题行 | @Builder
title(){
Row() {
Image($r('app.media.news_batman'))
.height(CommonConstants.ICON_WIDTH)
.width(CommonConstants.ICON_HEIGHT)
.borderRadius(CommonConstants.BORDER_RADIUS_TWO)
.id('pic')
.autoResize(true)
.onClick(()=>{
this.showToast();
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right title AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left ... | @Builder
title(){
Row() {
Image($r('app.media.news_batman'))
.height(CommonConstants.ICON_WIDTH)
.width(CommonConstants.ICON_HEIGHT)
.borderRadius(CommonConstants.BORDER_RADIUS_TWO)
.id('pic')
.autoResize(true)
.onClick(()=>{
this.showToast();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L358-L442 | 1d812152b438417d27d6ee786ab1f1ab58f12450 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets | arkts | listen | TODO 知识点:订阅输入法代插入、向左删除事件,从而获得键盘输入内容 | listen() {
if (this.isListen) {
return;
}
this.inputController.on("insertText", (text: string) => {
if (this.codeText.length >= this.verifyCodeLength || isNaN(Number(text)) || text === ' ') {
return;
}
this.codeText += text;
if (this.codeText.length === this.verifyCodeL... | AST#method_declaration#Left listen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isListen AST#member_expression#Right AST#expression#Right ) AST#... | listen() {
if (this.isListen) {
return;
}
this.inputController.on("insertText", (text: string) => {
if (this.codeText.length >= this.verifyCodeLength || isNaN(Number(text)) || text === ' ') {
return;
}
this.codeText += text;
if (this.codeText.length === this.verifyCodeL... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets#L117-L138 | 3c1ea4d28787ef29ea833e16262d51384bc087bc | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/view/InterceptorPage.ets | arkts | 子模块实现拦截接口,做具体的拦截实现 | export class MyPageInterceptorExecute implements InterceptorExecute {
executeFunction(appUri: string, param?: string): boolean {
// 通过routerInfo判断目的地为"我的页面"时判断登录状态是"未登录",此时执行跳转到登录页并返回true给拦截容器list(告知需拦截),已登录返回false,放行。
if (appUri !== undefined && appUri === "navigationinterceptor/InterceptorPage") {
// ... | AST#export_declaration#Left export AST#class_declaration#Left class MyPageInterceptorExecute AST#implements_clause#Left implements InterceptorExecute AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left executeFunction AST#parameter_list#Left ( AST#parameter#Left appUri : AST#type_annotation#Le... | export class MyPageInterceptorExecute implements InterceptorExecute {
executeFunction(appUri: string, param?: string): boolean {
if (appUri !== undefined && appUri === "navigationinterceptor/InterceptorPage") {
if (!AppStorage.get("login")) {
DynamicsRouter.pushUri("multimodaltr... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/view/InterceptorPage.ets#L296-L315 | 47ddfc60202df8a06d5c26ee602ac8ba545b54a9 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_axios/src/main/ets/axios/AxiosUtil.ets | arkts | 抛出封装后的axios | export const efAxios = new AxiosUtil().efAxios; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left efAxios = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AxiosUtil AST#expression#Right AST#new_expression#... | export const efAxios = new AxiosUtil().efAxios; | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/AxiosUtil.ets#L380-L380 | 80efa7d78661ab39d42728f024f6620e3d7df414 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ContactsPage.ets | arkts | buildContactsList | 构建联系人列表 | @Builder
buildContactsList() {
if (this.filteredContacts.length === 0) {
if (this.searchKeyword.trim()) {
SearchEmptyView({ searchKeyword: this.searchKeyword })
} else {
ContactsEmptyView({
onAddContact: () => {
appRouter.goContactEdit();
}
})
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactsList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expres... | @Builder
buildContactsList() {
if (this.filteredContacts.length === 0) {
if (this.searchKeyword.trim()) {
SearchEmptyView({ searchKeyword: this.searchKeyword })
} else {
ContactsEmptyView({
onAddContact: () => {
appRouter.goContactEdit();
}
})
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L306-L343 | aa02560e14dc821e818e13ca925841f410e0b82e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets | arkts | rsaUsePubKeySpecGetCallback | 根据RSA公钥规格生成RSA公钥,获取密钥规格,并与预期值进行比较 | function rsaUsePubKeySpecGetCallback() {
let rsaPubKeySpec = genRsa2048PubKeySpec();
let rsaGeneratorSpec = cryptoFramework.createAsyKeyGeneratorBySpec(rsaPubKeySpec);
rsaGeneratorSpec.generatePubKey((error, key) => {
if (error) {
console.error('generate pubKey error' + 'error code: ' + error.code + 'er... | AST#function_declaration#Left function rsaUsePubKeySpecGetCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rsaPubKeySpec = AST#expression#Left AST#call_expression#Left AST#expression#Left genRsa2048... | function rsaUsePubKeySpecGetCallback() {
let rsaPubKeySpec = genRsa2048PubKeySpec();
let rsaGeneratorSpec = cryptoFramework.createAsyKeyGeneratorBySpec(rsaPubKeySpec);
rsaGeneratorSpec.generatePubKey((error, key) => {
if (error) {
console.error('generate pubKey error' + 'error code: ' + error.code + 'er... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets#L68-L84 | 6b7981134eed1acb7e7a6a1547382d020aa9a2c2 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index.ets | arkts | index_from_index_file | Index from built index file.
@param path the path of index file, for example, 'history-index/index_2002_12.txt'.
@param context_filesDir getContext().filesDir. | static index_from_index_file(path: string, context_filesDir: string) {
// Open the file
let imp = sandbox_read_text_sync(path, context_filesDir);
let import_list: string[] = imp.split("\n");
// traverse each key - values
for (let index = 0; index < import_list.length - 1; index += 2) {
const ... | AST#method_declaration#Left static index_from_index_file AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir : AST#type_annotation#Left AST#primary_type#Left s... | static index_from_index_file(path: string, context_filesDir: string) {
let imp = sandbox_read_text_sync(path, context_filesDir);
let import_list: string[] = imp.split("\n");
for (let index = 0; index < import_list.length - 1; index += 2) {
const key = import_list[index];
const values ... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index.ets#L83-L98 | 83095e58230f1e918c80f4708d5c7d0545ecc0e4 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets | arkts | HSV type. | export enum HSVIndex {
HUE,
SATURATION,
VALUE
} | AST#export_declaration#Left export AST#enum_declaration#Left enum HSVIndex AST#enum_body#Left { AST#enum_member#Left HUE AST#enum_member#Right , AST#enum_member#Left SATURATION AST#enum_member#Right , AST#enum_member#Left VALUE AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaratio... | export enum HSVIndex {
HUE,
SATURATION,
VALUE
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets#L189-L193 | a22d13e6250cca9c20b0194bd22d20e1d12757be | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets | arkts | LeftCategoryList | 左侧分类列表 | @Builder
LeftCategoryList() {
List() {
ForEach(this.categoryTrees, (category: CategoryTree, index: number) => {
ListItem() {
this.LeftCategoryItem(category.name, index)
}
})
}
.width(100)
.height('100%')
.backgroundColor(AppColors.background)
.scrollBar(Ba... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right LeftCategoryList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control... | @Builder
LeftCategoryList() {
List() {
ForEach(this.categoryTrees, (category: CategoryTree, index: number) => {
ListItem() {
this.LeftCategoryItem(category.name, index)
}
})
}
.width(100)
.height('100%')
.backgroundColor(AppColors.background)
.scrollBar(Ba... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets#L38-L51 | e757b7049101daa707125f2faa134cfd8b0cf82e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/MediaManager.ets | arkts | 媒体文件信息接口 | export interface MediaFileInfo {
id: string;
name: string;
path: string;
type: MediaType;
size: number;
mimeType: string;
duration?: number; // 音频/视频时长(秒)
width?: number; // 图片/视频宽度
height?: number; // 图片/视频高度
createdAt: string;
modifiedAt: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MediaFileInfo AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left A... | export interface MediaFileInfo {
id: string;
name: string;
path: string;
type: MediaType;
size: number;
mimeType: string;
duration?: number;
width?: number;
height?: number;
createdAt: string;
modifiedAt: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L44-L56 | cc6fa9839c978154cd6a9c6ba7518d41eb5e116d | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuRightClick.ets | arkts | BindContextMenuRightClickBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function BindContextMenuRightClickBuilder(name: string, param: Object) {
DirectiveMenuExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindContextMenuRightClickBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | @Builder
export function BindContextMenuRightClickBuilder(name: string, param: Object) {
DirectiveMenuExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuRightClick.ets#L16-L19 | a0c7c51931890d7058795909115365a14045e768 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isNaN | Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value.
@returns { boolean } If both the denominator and numerator are 0, true is returned. Otherwise, false is returned.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isNaN(): boolean; | AST#method_declaration#Left isNaN 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#method_declaration#Right | isNaN(): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1014-L1014 | 4329dcbfd932d23c540ea26190694f9763490744 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/PixelMapUtils.ets | arkts | PixelMap工具类
提供从文件、资源、内存等多种源创建和管理PixelMap的功能
@author HarmonyOS Developer
@since 2024 | export class PixelMapUtil {
private constructor() {}
/**
* 从文件路径创建PixelMap
*/
static createPixelMapFromFileSync(
filePath: string,
options?: image.DecodingOptions
): image.PixelMap | null {
try {
const imageSource : image.ImageSource = image.createImageSource(filePath);
const deco... | AST#export_declaration#Left export AST#class_declaration#Left class PixelMapUtil AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right /**
* 从文件路径创建PixelM... | export class PixelMapUtil {
private constructor() {}
static createPixelMapFromFileSync(
filePath: string,
options?: image.DecodingOptions
): image.PixelMap | null {
try {
const imageSource : image.ImageSource = image.createImageSource(filePath);
const decodingOptions: image.DecodingOpt... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PixelMapUtils.ets#L12-L124 | 74af6f62a95c6906d3554e16da67a2fb2e4c0379 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets | arkts | encodeCBC | 加密-CBC模式
@param str 待加密的字符串
@param aesKey AES密钥
@param iv iv偏移量字符串
@returns | static async encodeCBC(str: string, aesKey: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256);
} | AST#method_declaration#Left static async encodeCBC 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async encodeCBC(str: string, aesKey: string, iv: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L117-L119 | 4c93cae3b9691bdd25a32f17ef4a80462e107fff | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/TimerUtil.ets | arkts | 一个线程启动多个setInterval可能会发生一些问题 | export default class TimerUtil {
// 创建单例模式
private static mInstance: TimerUtil | null = null;
public static getInstance(): TimerUtil {
if (TimerUtil.mInstance == null) {
TimerUtil.mInstance = new TimerUtil();
}
return TimerUtil.mInstance;
}
private constructor() {
// 私有化构造函数
}
pri... | AST#export_declaration#Left export default AST#class_declaration#Left class TimerUtil AST#class_body#Left { // 创建单例模式 AST#property_declaration#Left private static mInstance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left TimerUtil AST#primary_type#Right | AST#primary_type#Left null AST#primary_type... | export default class TimerUtil {
private static mInstance: TimerUtil | null = null;
public static getInstance(): TimerUtil {
if (TimerUtil.mInstance == null) {
TimerUtil.mInstance = new TimerUtil();
}
return TimerUtil.mInstance;
}
private constructor() {
}
private observers: Obs... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/utils/TimerUtil.ets#L28-L125 | 28ccfcbf951ff3c257f772ec744593bf3c7f42e5 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.collections.d.ets | arkts | getBitCountByRange | Counts the number of times a certain bit element occurs within a range of bits in a bit vector.
@param { number } element - Element to be counted (0 means 0, else means 1).
@param { number } fromIndex - The starting position of the index, containing the value at that index position.
@param { number } toIndex - The end... | getBitCountByRange(element: number, fromIndex: number, toIndex: number): number; | AST#method_declaration#Left getBitCountByRange AST#parameter_list#Left ( AST#parameter#Left element : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | getBitCountByRange(element: number, fromIndex: number, toIndex: number): number; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12356-L12356 | 550586d8d80f7d50dfd8340b8a16f16d3160c90f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/model/DialogOptions.ets | arkts | TODO 自定义内容区弹出框,参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export class BaseContentOptions extends OptionDialogOptions {
primaryTitle?: ResourceStr; //弹出框标题。
secondaryTitle?: ResourceStr; //弹出框辅助文本。
localizedContentAreaPadding?: LocalizedPadding; //弹出框内容区内边距。
contentAreaPadding?: Padding; //弹出框内容区内边距。设置了localizedContentAreaPadding属性时该属性不生效。
onAction?: ActionCallBac... | AST#export_declaration#Left export AST#class_declaration#Left class BaseContentOptions extends AST#type_annotation#Left AST#primary_type#Left OptionDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left primaryTitle ? : AST#type_annotation#Left AST#primary_typ... | export class BaseContentOptions extends OptionDialogOptions {
primaryTitle?: ResourceStr;
secondaryTitle?: ResourceStr;
localizedContentAreaPadding?: LocalizedPadding;
contentAreaPadding?: Padding; 设置了localizedContentAreaPadding属性时该属性不生效。
onAction?: ActionCallBack;
contentBuilder?: () => void;
butt... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/model/DialogOptions.ets#L98-L108 | b036d9d3393b1b4ae0d1492dfad209d2e923583f | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets | arkts | initWeb | This function is a user-defined function and can be used as an initialization function. Initialize builderNode through UIContext, and then initialize the contents in @Builder through the Build interface in BuilderNode. | initWeb(url:string, uiContext:UIContext, control:WebviewController): void {
if(this.rootNode != null)
{
return;
}
// Creating a node requires uiContext.
this.rootNode = new BuilderNode(uiContext)
// Create dynamic Web components
this.rootNode.build(wrapBuilder<Data[]>(WebBuilder), { ur... | AST#method_declaration#Left initWeb AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Rig... | initWeb(url:string, uiContext:UIContext, control:WebviewController): void {
if(this.rootNode != null)
{
return;
}
this.rootNode = new BuilderNode(uiContext)
this.rootNode.build(wrapBuilder<Data[]>(WebBuilder), { url:url, controller:control })
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets#L85-L94 | 57ce2fffefac61adbc4357954d981516a60ba160 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | verify | 验签
@param signStr 已签名的字符串
@param verifyStr 需要验签的字符串
@param pubKey 给定秘钥规格公钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@returns 验签结果OutDTO对象,其中Msg为验签结果 | static async verify(signStr: string, verifyStr: string, pubKey: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
//将公钥转换
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
//验签器
let verifyer = crypto.createVerify(symEncryptName);
... | AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left signStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left verifyStr : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | static async verify(signStr: string, verifyStr: string, pubKey: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
let verifyer = crypto.createVerify(symEncryptName);
awa... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L366-L385 | dda602b572fb09add6496ca245c0cc999b979af7 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets | arkts | @file 用户信息相关数据源实现类
@author Joker.X | export class UserInfoNetworkDataSourceImpl implements UserInfoNetworkDataSource {
/**
* 更新个人信息
* @param {Record<string, unknown>} params - 更新参数
* @returns {Promise<NetworkResponse<Unknown>>} 更新结果
*/
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
const re... | AST#export_declaration#Left export AST#class_declaration#Left class UserInfoNetworkDataSourceImpl AST#implements_clause#Left implements UserInfoNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 更新个人信息
* @param {Record<string, unknown>} params - 更新参数
* @returns {Promise<NetworkResponse<U... | export class UserInfoNetworkDataSourceImpl implements UserInfoNetworkDataSource {
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("user/info/updatePerson", params);
return ... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets#L10-L64 | fe3f2f1ddfc50f7c1c96a0d6b4c56867e1e90313 | github | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/param/shared/components/SharedCardContainer.ets | arkts | SharedCardContainer | @author: HHBin
@date: 2025/4/28
@desc: | @Component
export struct SharedCardContainer {
@State properties: CardSharedAnimationProperties | undefined = undefined;
@Prop bgColor: ResourceColor = Color.White
@BuilderParam content: () => void = this.builder
aboutToAppear(): void {
this.properties = ZRouter.animateMgr().getSharedCardAnimationPropertie... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SharedCardContainer AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right properties : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CardSharedAnim... | @Component
export struct SharedCardContainer {
@State properties: CardSharedAnimationProperties | undefined = undefined;
@Prop bgColor: ResourceColor = Color.White
@BuilderParam content: () => void = this.builder
aboutToAppear(): void {
this.properties = ZRouter.animateMgr().getSharedCardAnimationPropertie... | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/shared/components/SharedCardContainer.ets#L9-L17 | 54e87cb93e719b32708c8af394705bcb5d9a815a | gitee |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/pages/DeviceMonitoringPage.ets | arkts | DeviceMonitoringPage | --- 主页面 --- | @Entry
@Component
export struct DeviceMonitoringPage {
@State deviceList: DeviceItem[] = [];
@State isLoading: boolean = false;
dialogController: CustomDialogController | null = null;
aboutToAppear() {
this.fetchData();
}
// 拉取数据
async fetchData() {
this.isLoading = true;
try {
// Serv... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct DeviceMonitoringPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right deviceList : AST#type_annotation#Left AST#prim... | @Entry
@Component
export struct DeviceMonitoringPage {
@State deviceList: DeviceItem[] = [];
@State isLoading: boolean = false;
dialogController: CustomDialogController | null = null;
aboutToAppear() {
this.fetchData();
}
async fetchData() {
this.isLoading = true;
try {
this.de... | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/DeviceMonitoringPage.ets#L73-L219 | 582931be228ecde4e67d0a6556fc39aa56c171f0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | getDefaultWantAgent | 创建一个可拉起Ability的Want
@returns | static async getDefaultWantAgent(uri: string = ''): Promise<WantAgent> {
const context = AppUtil.getContext(); //获取当前上下文对象
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
deviceId: '',
bundleName: context.abilityInfo.bundleName,
moduleName: context.ability... | AST#method_declaration#Left static async getDefaultWantAgent AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a... | static async getDefaultWantAgent(uri: string = ''): Promise<WantAgent> {
const context = AppUtil.getContext();
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
deviceId: '',
bundleName: context.abilityInfo.bundleName,
moduleName: context.abilityInfo.module... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L454-L473 | 096aaeb830ac96eef5af59fad4150a35f0ec2172 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/InteractMyAwardListBuilder.ets | arkts | WatchGiftView | 常用设置底部弹窗视图 | @Component
export struct WatchGiftView {
@State gift:VHInteractMyAward = new VHInteractMyAward();
@State imagHeight:number = 200;
@State imagHeightBackGround:number = 190;
@State timeClose:string = ''
@State timeCount:number = 0;
@State url:string = ""
@State scaleValue: number = 1; // 初始缩放比例
@State ima... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WatchGiftView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right gift : AST#type_annotation#Left AST#primary_type#Left VHInteractMyAward AST#primary_type#Right AST#t... | @Component
export struct WatchGiftView {
@State gift:VHInteractMyAward = new VHInteractMyAward();
@State imagHeight:number = 200;
@State imagHeightBackGround:number = 190;
@State timeClose:string = ''
@State timeCount:number = 0;
@State url:string = ""
@State scaleValue: number = 1;
@State imageSize:nu... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/InteractMyAwardListBuilder.ets#L76-L214 | e47f1148c83c2da7b35d28ff8e8a6f13725b94cc | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/TipsOptions.ets | arkts | TODO 提示弹出框,即为带图形确认框,参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export interface TipsOptions extends HmDialogOptions {
imageRes?: ResourceStr | PixelMap; //展示的图片。
imageSize?: SizeOptions; //自定义图片尺寸。默认值:64*64vp
checkTips?: ResourceStr; //checkbox的提示内容。
isChecked?: boolean; //@Prop-value为true时,表示checkbox已选中,value为false时,表示未选中。默认值:false
onCheckedChange?: Callback<boolean>; ... | AST#export_declaration#Left export AST#interface_declaration#Left interface TipsOptions AST#extends_clause#Left extends HmDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left imageRes ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right ... | export interface TipsOptions extends HmDialogOptions {
imageRes?: ResourceStr | PixelMap;
imageSize?: SizeOptions;
checkTips?: ResourceStr;
isChecked?: boolean;
onCheckedChange?: Callback<boolean>;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/TipsOptions.ets#L23-L31 | 28811471345f2928e0e1ce39948e3f2b6de62035 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets | arkts | deletePreferences | 5-删除Preferences实例及其持久化文件 | deletePreferences(context: Context) {
let promise = preferences.deletePreferences(context, CommonConstants.PREFERENCES_NAME);
promise.then(() => {
this.showToastMessage($r('app.string.preferences_delete_msg'));
//调用deletePreferences接口后,不建议再使用旧的Preferences实例进行数据操作,否则会出现数
//据一致性问题;
// 应将Pr... | AST#method_declaration#Left deletePreferences AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarati... | deletePreferences(context: Context) {
let promise = preferences.deletePreferences(context, CommonConstants.PREFERENCES_NAME);
promise.then(() => {
this.showToastMessage($r('app.string.preferences_delete_msg'));
dataPreferences = preferenceTemp
}).catch((err: BusinessError) =... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets#L92-L103 | 17d6ae522ae057285f6aaf5795f7d4911d50c025 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/AtbashCipher.ets | arkts | decrypt | 解密文本(Atbash密码是对称的,所以解密方法就是再次加密)
@param text 要解密的文本
@returns 解密后的文本 | public static decrypt(text: string): string {
return AtbashCipher.encrypt(text);
} | AST#method_declaration#Left public static decrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | public static decrypt(text: string): string {
return AtbashCipher.encrypt(text);
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/AtbashCipher.ets#L37-L39 | 4643a4da01713bd18ab7f8e6673c2da8bcd4585c | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/model/UserModel.ets | arkts | toCloudObject | 转换为CloudDB对象格式 | toCloudObject(): CloudDBZoneObject {
const cloudObject: CloudDBZoneObject = {
id: this.id,
userId: this.userId,
songId: this.songId,
songTitle: this.songTitle,
songArtist: this.songArtist,
playedTime: this.playedTime
};
return cloudObject;
} | AST#method_declaration#Left toCloudObject AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CloudDBZoneObject AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Lef... | toCloudObject(): CloudDBZoneObject {
const cloudObject: CloudDBZoneObject = {
id: this.id,
userId: this.userId,
songId: this.songId,
songTitle: this.songTitle,
songArtist: this.songArtist,
playedTime: this.playedTime
};
return cloudObject;
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L117-L127 | 80bd507d547d3921c61c6af9ab4fa938a08bbac8 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | getHighlightForX | Returns the corresponding Highlight for a given xVal and x- and y-touch position in pixels.
@param xVal
@param x
@param y
@return | protected getHighlightForX(xVal: number, x: number, y: number): Highlight | null {
let closestValues: JArrayList<Highlight> | null = this.getHighlightsAtXValue(xVal, x, y);
if (!closestValues || closestValues.isEmpty()) {
return null;
}
let leftAxisMinDist: number = this.getMinimumDistance(clos... | AST#method_declaration#Left protected getHighlightForX AST#parameter_list#Left ( AST#parameter#Left xVal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | protected getHighlightForX(xVal: number, x: number, y: number): Highlight | null {
let closestValues: JArrayList<Highlight> | null = this.getHighlightsAtXValue(xVal, x, y);
if (!closestValues || closestValues.isEmpty()) {
return null;
}
let leftAxisMinDist: number = this.getMinimumDistance(clos... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/ChartHighlighter.ets#L81-L105 | 3139101aa3faece0f7c2b2ebf638222c87344d43 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/agent-assignment/99.0.0/package/index.ets | arkts | 应用约束60:改用ES6模块导出语法,替换module.exports | export default HelloWorldNPM; | AST#export_declaration#Left export default AST#expression#Left HelloWorldNPM AST#expression#Right ; AST#export_declaration#Right | export default HelloWorldNPM; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/agent-assignment/99.0.0/package/index.ets#L12-L12 | 90eda6277db434733b05c4d2081b7b3dd606a827 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SegmentButtonV2.d.ets | arkts | Defines the options of the segmented button item.
@interface SegmentButtonV2ItemOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export interface SegmentButtonV2ItemOptions {
/**
* Sets the text of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 18
*/
text?: ResourceStr;
/**
* Sets the image icon... | AST#export_declaration#Left export AST#interface_declaration#Left interface SegmentButtonV2ItemOptions AST#object_type#Left { /**
* Sets the text of the segmented button item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @... | export interface SegmentButtonV2ItemOptions {
text?: ResourceStr;
icon?: ResourceStr;
symbol?: Resource;
enabled?: boolean;
textModifier?: TextModifier;
iconModifier?: ImageModifier;
symbolModifier?: SymbolGlyphModifier;
accessibilityText?: ... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SegmentButtonV2.d.ets#L34-L145 | ec8f7baf0894de61f9ce4130b3a4fbcd50511e79 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Events.ets | arkts | 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 function checkEvents() {
customEventsChecker()
} | AST#export_declaration#Left export AST#function_declaration#Left function checkEvents AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left customEventsChecker AST#expression#Right... | export function checkEvents() {
customEventsChecker()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Events.ets#L16-L18 | e939e3dd4e690a80b6acf5cd4ae2f12646282ee0 | gitee | |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/ImageEditInterface.ets | arkts | 编辑功能项选项 | export interface ImageEditFunctionItemOption {
/**
* 功能类型
*/
type: ImageEditFunctionType
/**
* 功能标题,不配置则根据类型使用默认值
*/
title?: ImageEditTextOption
/**
* 功能按钮图标资源名称,不配置或无效则根据类型使用默认值,单值配置支持:
* 1、IconFontName定义的string资源图标(TODO 解耦后待实现支持此能力)
* 2、svg格式resource资源(已支持)
* 3、ImageEditIconOption提供选... | AST#export_declaration#Left export AST#interface_declaration#Left interface ImageEditFunctionItemOption AST#object_type#Left { /**
* 功能类型
*/ AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left ImageEditFunctionType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
... | export interface ImageEditFunctionItemOption {
type: ImageEditFunctionType
title?: ImageEditTextOption
iconRes?: ResourceStr | ImageEditIconOption
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L169-L185 | 2fc2bc6db503c92f9a241cdfc6b458f61bf9685b | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/components/listAndGrid/waterFlowSample/WaterFlowSample.ets | arkts | getItemSizeArray | 保存flow item宽/高 | getItemSizeArray() {
for (let i = 0; i < 100; i++) {
if (i % 4 == 0) {
this.itemHeightArray.push(102);
} else if (i % 4 == 1) {
this.itemHeightArray.push(136);
} else if (i % 4 == 2) {
this.itemHeightArray.push(136);
} else if (i % 4 == 3) {
this.it... | AST#method_declaration#Left getItemSizeArray AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#v... | getItemSizeArray() {
for (let i = 0; i < 100; i++) {
if (i % 4 == 0) {
this.itemHeightArray.push(102);
} else if (i % 4 == 1) {
this.itemHeightArray.push(136);
} else if (i % 4 == 2) {
this.itemHeightArray.push(136);
} else if (i % 4 == 3) {
this.it... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/components/listAndGrid/waterFlowSample/WaterFlowSample.ets#L89-L101 | 78ac7a9ad93dc1df1f40c5b2e5a1df001a3d5765 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/pages/FullCustomTransition.ets | arkts | pageTransition | Page transition parameters are configured using the global pageTransition method.
Enter: During the entry process, the onEnter callback is triggered frame by frame.
The input parameter is the normalization progress of the dynamic effect (0–1).
Exit: The onExit callback is triggered frame by frame during entry.
The inp... | pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.onEnter((type?: RouteType, progress?: number) => {
if (!progress) {
return;
}
this.animValue = progress;
});
PageTransitionExit({ duration: TRANSITION_ANIMATION... | AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression... | pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.onEnter((type?: RouteType, progress?: number) => {
if (!progress) {
return;
}
this.animValue = progress;
});
PageTransitionExit({ duration: TRANSITION_ANIMATION... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/pages/FullCustomTransition.ets#L49-L64 | 7b9cfc6fc5ffe36429594b3ba0f5e4e4294b29dd | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | interfaces/ets/ani/focuscontroller/ets/arkui.component.focus.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export enum KeyProcessingMode {
FOCUS_NAVIGATION = 0,
ANCESTOR_EVENT = 1
} | AST#export_declaration#Left export AST#enum_declaration#Left enum KeyProcessingMode AST#enum_body#Left { AST#enum_member#Left FOCUS_NAVIGATION = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ANCESTOR_EVENT = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right } AST... | export enum KeyProcessingMode {
FOCUS_NAVIGATION = 0,
ANCESTOR_EVENT = 1
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/interfaces/ets/ani/focuscontroller/ets/arkui.component.focus.ets#L17-L20 | 580499a3aaf335fe391c5c350fecb067348d739f | gitee | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/PlayConstants.ets | arkts | Play constants for all features. | export class PlayConstants {
/**
* Playback page constant.
*/
static readonly PLAY_PAGE = {
PLAY_SPEED: 1,
VOLUME: 0.5,
VOLUME_SHOW: false,
BRIGHT: 0.5,
BRIGHT_SHOW: false,
POSITION_X: 0,
POSITION_Y: 0,
HEIGHT: '7.2%',
PLAY_PLAYER_HEIGHT: '25.6%',
PLAY_PLAYER_HEIGHT_FUL... | AST#export_declaration#Left export AST#class_declaration#Left class PlayConstants AST#class_body#Left { /**
* Playback page constant.
*/ AST#property_declaration#Left static readonly PLAY_PAGE = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left PLAY_SPEED AST#proper... | export class PlayConstants {
static readonly PLAY_PAGE = {
PLAY_SPEED: 1,
VOLUME: 0.5,
VOLUME_SHOW: false,
BRIGHT: 0.5,
BRIGHT_SHOW: false,
POSITION_X: 0,
POSITION_Y: 0,
HEIGHT: '7.2%',
PLAY_PLAYER_HEIGHT: '25.6%',
PLAY_PLAYER_HEIGHT_FULL: '75.4%',
PLAY_PROGRESS_HEIGHT: ... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/PlayConstants.ets#L5-L111 | 3a17d9fe009fc4a54d79ec2e2e3b7a6193727331 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_settings.ets | arkts | get_settings_string | THIS IS LEGACY CODE FOR MIGRATION ONLY
Gets the string value of a setting.
@param key A string, the key of the setting.
@param default_404_fall_back A string, who will be returned if this key is not found in KvStore.
@returns A string, the value of this key.
@returns A string, default_404_fall_back, if the key is not ... | private static async get_settings_string(key: string, default_404_fall_back: string) {
let value = await kv_store_get(key);
if (value == ('undefined')) {
value = default_404_fall_back;
}
console.log('[bunch_of_settings][Uni] Got settings for ' + key + ':\n\t' + value.replaceAll('\n', '\n\t'));
... | AST#method_declaration#Left private static async get_settings_string AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left default_404_fall_back : AST#type_annotation#Left AST#pri... | private static async get_settings_string(key: string, default_404_fall_back: string) {
let value = await kv_store_get(key);
if (value == ('undefined')) {
value = default_404_fall_back;
}
console.log('[bunch_of_settings][Uni] Got settings for ' + key + ':\n\t' + value.replaceAll('\n', '\n\t'));
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L373-L380 | 89a8abd707faa921e7748778ac98d5686787bf6f | gitee |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/PreferencesUtil.ets | arkts | putBoolean | 存储布尔值数据
@param context 应用上下文
@param key 键
@param value 值 | static async putBoolean(context: common.UIAbilityContext, key: string, value: boolean): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Pref... | AST#method_declaration#Left static async putBoolean AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left k... | static async putBoolean(context: common.UIAbilityContext, key: string, value: boolean): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Pref... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/PreferencesUtil.ets#L106-L114 | 5a66c989e335143f43c7756671327a3754f088ad | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | getAddressFromLocationName | 地理编码,将地理描述转换为具体坐标(无需申请定位权限)
@param locationName 地理位置中文描述
@returns 编码后location对象 | static async getAddressFromLocationName(locationName: string): Promise<geoLocationManager.GeoAddress> {
let geoAddress = await LocationUtil.getGeoAddressFromLocationName(locationName, 1);
if (geoAddress != null && geoAddress.length >= 1) {
return geoAddress[0];
}
return {};
} | AST#method_declaration#Left static async getAddressFromLocationName AST#parameter_list#Left ( AST#parameter#Left locationName : 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_typ... | static async getAddressFromLocationName(locationName: string): Promise<geoLocationManager.GeoAddress> {
let geoAddress = await LocationUtil.getGeoAddressFromLocationName(locationName, 1);
if (geoAddress != null && geoAddress.length >= 1) {
return geoAddress[0];
}
return {};
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L227-L233 | cf794b70b86cda30724b7b409ff8b40d1789695b | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/AESSync.ets | arkts | encodeECB | 加密-ECB模式
@param str 待加密的字符串
@param aesKey AES密钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64
@returns | static encodeECB(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256, keyCoding, resultCoding);
} | AST#method_declaration#Left static 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static encodeECB(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L164-L167 | 5fb47188a8f96a1af6448a84e27a6eb882d650e2 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/DiscoverPage.ets | arkts | DiscoverPage | 自动分配剩余空间 | @Component
export struct DiscoverPage {
private settingViewData: Array< Array<SettingViewData>> = [
[new SettingViewData($r('app.media.icon_de_scan'), $r('app.string.scan')),
new SettingViewData($r('app.media.icon_de_shake'), $r('app.string.shake'))],
[new SettingViewData($r('app.media.searchOne'), $r... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DiscoverPage AST#component_body#Left { AST#property_declaration#Left private settingViewData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#L... | @Component
export struct DiscoverPage {
private settingViewData: Array< Array<SettingViewData>> = [
[new SettingViewData($r('app.media.icon_de_scan'), $r('app.string.scan')),
new SettingViewData($r('app.media.icon_de_shake'), $r('app.string.shake'))],
[new SettingViewData($r('app.media.searchOne'), $r... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/DiscoverPage.ets#L36-L115 | 1016f1ed9f3a8f4efe65c11451d2c8f160987711 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | generateMockResponse | 模拟AI响应(实际应该解析真实API响应) | private generateMockResponse(message: string): string {
const responses: string[] = [
`关于"${message}",我建议您可以尝试以下方法:\n\n1. 分解任务:将大任务拆分为小的可执行步骤\n2. 设定优先级:使用四象限法来确定任务重要性\n3. 时间规划:为每个任务分配合理的时间\n\n这样可以帮您更有效地管理时间和提升效率。`,
`针对您提到的"${message}",从效能管理角度来看:\n\n📋 建议采用番茄工作法:\n• 专注工作25分钟\n• 短暂休息5分钟\n• 每4个番茄钟后长休息15分钟... | AST#method_declaration#Left private generateMockResponse AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AS... | private generateMockResponse(message: string): string {
const responses: string[] = [
`关于"${message}",我建议您可以尝试以下方法:\n\n1. 分解任务:将大任务拆分为小的可执行步骤\n2. 设定优先级:使用四象限法来确定任务重要性\n3. 时间规划:为每个任务分配合理的时间\n\n这样可以帮您更有效地管理时间和提升效率。`,
`针对您提到的"${message}",从效能管理角度来看:\n\n📋 建议采用番茄工作法:\n• 专注工作25分钟\n• 短暂休息5分钟\n• 每4个番茄钟后长休息15分钟... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L652-L665 | d73bc8c75db4697d6f0a81954c4754bfb09e3e43 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets | arkts | print | 打印JSON对象和JSON字符串
@param obj | static print(obj: object | string) {
try {
if (typeof obj === 'object') {
let str = JSON.stringify(obj, null, 2)
let arr: string[] = str.split('\n')
for (let index = 0; index < arr.length; index++) {
console.debug(arr[index])
}
} else {
obj = JSON.parse(... | AST#method_declaration#Left static print AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left object AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para... | static print(obj: object | string) {
try {
if (typeof obj === 'object') {
let str = JSON.stringify(obj, null, 2)
let arr: string[] = str.split('\n')
for (let index = 0; index < arr.length; index++) {
console.debug(arr[index])
}
} else {
obj = JSON.parse(... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L105-L125 | 8ad7d5bc43fc31518d541a982aeddbd6632163ff | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ImageEditTaskPool/entry/src/main/ets/utils/CropUtil.ets | arkts | Common crop function.
@param pixelMap.
@param cropWidth.
@param cropHeight.
@param cropPosition. | export async function cropCommon(pixelMap: PixelMap, cropWidth: number, cropHeight: number,
cropPosition: RegionItem): Promise<void> {
await pixelMap.crop({
size: {
width: cropWidth,
height: cropHeight
},
x: cropPosition.x,
y: cropPosition.y
});
} | AST#export_declaration#Left export AST#function_declaration#Left async function cropCommon AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cropWidth : AST#type_annota... | export async function cropCommon(pixelMap: PixelMap, cropWidth: number, cropHeight: number,
cropPosition: RegionItem): Promise<void> {
await pixelMap.crop({
size: {
width: cropWidth,
height: cropHeight
},
x: cropPosition.x,
y: cropPosition.y
});
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/utils/CropUtil.ets#L55-L65 | 1206e404136aa3b5e5561ebc04f49b66c5c5c89d | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/ButtonOptions.ets | arkts | TODO Dialog按钮参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export class ButtonOptions {
value: ResourceStr = ''; //按钮的内容。
fontColor?: ResourceColor; //按钮的字体颜色。
action?: VoidCallback; //按钮的点击事件,大多数按钮不需要实现这个点击事件
background?: ResourceColor; //按钮的背景。
buttonStyle?: ButtonStyleMode; //按钮的样式。默认值:2in1设备为ButtonStyleMode.NORMAL,其他设备为ButtonStyleMode.TEXTUAL。
role?: ButtonRole... | AST#export_declaration#Left export AST#class_declaration#Left class ButtonOptions AST#class_body#Left { AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declarati... | export class ButtonOptions {
value: ResourceStr = '';
fontColor?: ResourceColor;
action?: VoidCallback;
background?: ResourceColor;
buttonStyle?: ButtonStyleMode;
role?: ButtonRole;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/ButtonOptions.ets#L22-L29 | 59ae792b039870dcdfb6c22b02ad0cf2ccba1160 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets | arkts | buildHeaders | 构建请求的header
@param headers 传入的自定义header
@returns 拼接完公共系列全部完整header | private static buildHeaders(headers?: Record<string, string>): rcp.RequestHeaders {
//需要添加的header对象
let addHead: rcp.RequestHeaders = {};
//是否需要拼接token
if (efRcpConfig.token.tokenValue) {
if (efRcpConfig.token.tokenName && efRcpConfig.token.tokenName != 'authorization') {
addHead[efRcpConf... | AST#method_declaration#Left private static buildHeaders AST#parameter_list#Left ( AST#parameter#Left headers ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , ... | private static buildHeaders(headers?: Record<string, string>): rcp.RequestHeaders {
let addHead: rcp.RequestHeaders = {};
if (efRcpConfig.token.tokenValue) {
if (efRcpConfig.token.tokenName && efRcpConfig.token.tokenName != 'authorization') {
addHead[efRcpConfig.token.tokenName] = efRcpC... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L45-L74 | 090d383bd7bc54d87f4f26c7de9c51bdc2199dc1 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets | arkts | initAvSession | [Start init_session] | public initAvSession(): void {
this.context = AppStorage.get('context');
// [StartExclude init_session]
if (!this.context) {
Logger.info(TAG, `session create failed : context is undefined`);
return;
}
// [EndExclude init_session]
try {
avSession.createAVSession(this.context, "S... | AST#method_declaration#Left public initAvSession AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expr... | public initAvSession(): void {
this.context = AppStorage.get('context');
if (!this.context) {
Logger.info(TAG, `session create failed : context is undefined`);
return;
}
try {
avSession.createAVSession(this.context, "SHORT_AUDIO_SESSION", 'video').then(async (avSession) => {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets#L45-L69 | a4d013c2b1af820e6f68dae228ff1d314dd70d73 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageloading/src/main/ets/view/PageLoading.ets | arkts | PageLoadingComponent | 毫秒数 | @Component
export struct PageLoadingComponent {
@State isLoading: Boolean = true;
@State nowProgress: number = 0;
aboutToAppear(): void {
// 模拟网络请求操作,请求网络3秒后得到数据,通知组件,变更列表数据
setTimeout(() => {
this.isLoading = false;
}, MILLISECONDS);
//模拟进度,开发者可在实际业务中与服务端协调当前进度,自行实现
setInterval(()=>{
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageLoadingComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left Boolean AST#primary_type#Right AST... | @Component
export struct PageLoadingComponent {
@State isLoading: Boolean = true;
@State nowProgress: number = 0;
aboutToAppear(): void {
setTimeout(() => {
this.isLoading = false;
}, MILLISECONDS);
setInterval(()=>{
this.nowProgress += 10
},MILLISECONDS / 10)
}
build()... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageloading/src/main/ets/view/PageLoading.ets#L34-L65 | d1ae1cbab4053116b00179f75090e03aedac7bce | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/data_operation_tools.ets | arkts | Search a key in label_link_array.
@param label_link_array The label-link array. Each string[] is ['label', 'link'].
@param key The keyword.
@param match_coefficient The match coefficient, the minimum proportion of the key's components that should appear in a label-link pair.
@param max_result_number The maximum size of... | export function search_label_link(label_link_array: string[][], key: string, match_coefficient: number, max_result_number?: number) {
// Early Exit
if (key.length == 0) {
return [];
}
// Get first filtered related items
let result: string[][] = [];
// Default fall back
if (max_result_number == unde... | AST#export_declaration#Left export AST#function_declaration#Left function search_label_link AST#parameter_list#Left ( AST#parameter#Left label_link_array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramete... | export function search_label_link(label_link_array: string[][], key: string, match_coefficient: number, max_result_number?: number) {
if (key.length == 0) {
return [];
}
let result: string[][] = [];
if (max_result_number == undefined) {
max_result_number = 5;
}
key = key.toUpperCase(... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L58-L94 | bd34a81642425705f8088fe446e1c740d6c28996 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.