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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | generateSymKey | 生成对称密钥-指定密钥生成格式(默认base64)
@param symAlgName 秘钥规格
@param resultCoding 生成对称秘钥的编码方式(hex/base64)
@returns 指定秘钥规格的对称密钥 | static generateSymKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<string> {
// 创建对称密钥生成器
let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName);
// 通过非对称密钥生成器,随机生成非对称密钥
let promiseSymKey = symKeyGenerator.generateSymKeySync();
//转换成可以读懂的字符串
let key = StrAndUintUtil.u... | AST#method_declaration#Left static generateSymKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qu... | static generateSymKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<string> {
let symKeyGenerator = crypto.createSymKeyGenerator(symAlgName);
let promiseSymKey = symKeyGenerator.generateSymKeySync();
let key = StrAndUintUtil.unitArray2StrCoding(promiseSymKey.getEncoded().da... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L120-L129 | b5b86c3f4c5590d08fcd64f600fe0e1f6e52c155 | gitee |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets | arkts | confirmPayment | 确认支付 | confirmPayment(): void {
const selectedItems = this.datas.filter((item: Type1): boolean => item.selected);
const totalPrice = this.calculateTotalPrice();
// 这里可以添加实际的支付逻辑
console.log('确认支付,总价:', totalPrice);
console.log('选中商品:', selectedItems);
promptAction.showToast({ message: `支付成功!总价:${tota... | AST#method_declaration#Left confirmPayment 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#variable_declaration#Left const AST#variable_declarator#Left selectedIt... | confirmPayment(): void {
const selectedItems = this.datas.filter((item: Type1): boolean => item.selected);
const totalPrice = this.calculateTotalPrice();
console.log('确认支付,总价:', totalPrice);
console.log('选中商品:', selectedItems);
promptAction.showToast({ message: `支付成功!总价:${totalPrice}`, durati... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L265-L279 | 32bd64b82135a307dfdb6f564afaaa3a41d0ebe6 | github |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/mine/ServiceList.ets | arkts | handleMenuClick | 处理菜单项点击 | private handleMenuClick(title: string): void {
hilog.info(DOMAIN, TAG, 'Menu item clicked: %{public}s', title);
switch (title) {
case '深色模式':
this.toggleDarkMode();
break;
case '足迹':
this.navigateToFootprint(); | AST#method_declaration#Left private handleMenuClick AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left v... | private handleMenuClick(title: string): void {
hilog.info(DOMAIN, TAG, 'Menu item clicked: %{public}s', title);
switch (title) {
case '深色模式':
this.toggleDarkMode();
break;
case '足迹':
this.navigateToFootprint(); | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/mine/ServiceList.ets#L71-L79 | 7a2697ff82f2f54c8282efcaef012db7483439da | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | the divide of single and double | export const COMMON_NUM_DOUBLE: number = 10; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMON_NUM_DOUBLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const COMMON_NUM_DOUBLE: number = 10; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L69-L69 | cde707d3eb261b46ebe9a702b70017f48a28df30 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ApiUsingStandards/entry/src/main/ets/pages/AVImageGenerator.ets | arkts | fetchFrame | [Start av_image_generator_class] | async fetchFrame(): Promise<void> {
await this.fetchMeta();
if (canIUse("SystemCapability.Multimedia.Media.AVImageGenerator")) {
this.pixelMap = new Array;
let avImageGenerator: media.AVImageGenerator = await media.createAVImageGenerator();
// raw fd
avImageGenerator.fdSrc = fs.openSync(... | AST#method_declaration#Left async fetchFrame AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async fetchFrame(): Promise<void> {
await this.fetchMeta();
if (canIUse("SystemCapability.Multimedia.Media.AVImageGenerator")) {
this.pixelMap = new Array;
let avImageGenerator: media.AVImageGenerator = await media.createAVImageGenerator();
avImageGenerator.fdSrc = fs.openSync(this.root... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ApiUsingStandards/entry/src/main/ets/pages/AVImageGenerator.ets#L35-L57 | 3cdf2b9e221236223f1b7ae372fc22c8ff656c4b | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets | arkts | Declare type OperationOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare type OperationOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class OperationOption {
/**
* The content of text or the address of icon.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* The content of text or the address of icon.
* @type { ResourceStr }.
* @syscap SystemCapabili... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class OperationOption AST#class_body#Left { /**
* The content of text or the address of icon.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* The c... | export declare class OperationOption {
value: ResourceStr;
action?: () => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets#L94-L123 | 8b31f3eb9e52b2783e59602bec076140d3b0e841 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets | arkts | qualityPriorityCompress | 优先压缩图片质量
@param sourcePixelMap 原始待压缩图片的PixelMap
@param maxCompressedImageSize 指定图片的压缩目标大小 | async qualityPriorityCompress(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number) {
// TODO 知识点:自动模式(指定压缩目标大小)优先压缩图片质量。先判断设置图片质量参数为0时,packing能压缩到的图片最小字节大小compressedImageData.byteLength是否满足指定的图片压缩大小。如果满足,则使用packing方式二分查找最接近指定图片压缩目标大小的quality来压缩图片。如果不满足,则图片质量按最低0进行设置,并调用scalePriorityCompress进行scale尺寸压缩。
... | AST#method_declaration#Left async qualityPriorityCompress AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le... | async qualityPriorityCompress(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number) {
let compressedImageData: ArrayBuffer =
await this.packing(sourcePixelMap, IMAGE_QUALITY_ZERO, this.afterCompressFmt);
if (compressedImageData.byteLength <= maxCompressedImageSize * BYTE_CONVERSION) {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L251-L265 | e34019d7f85da8feb7e4b9e4c1d031e701a6c69a | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/log/Logger.ets | arkts | debug | Debug 日志 | debug(tag: string, message: string, ...args: string[]): void {
this.log(LogLevel.DEBUG, tag, message, args);
} | AST#method_declaration#Left debug 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 message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#... | debug(tag: string, message: string, ...args: string[]): void {
this.log(LogLevel.DEBUG, tag, message, args);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/log/Logger.ets#L59-L61 | 7dcab899e434f6bb036ffda01c302b78b3021429 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/AnnouncementBuilder.ets | arkts | VHAnnouncementPopup | 公告栏 | @Component
export struct VHAnnouncementPopup {
@State Animator: boolean = true;
@Prop Announcement: string = ''
@Consume announcementValue: string
aboutToAppear(): void {
this.AnnouncementText()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VHAnnouncementPopup AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right Animator : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annot... | @Component
export struct VHAnnouncementPopup {
@State Animator: boolean = true;
@Prop Announcement: string = ''
@Consume announcementValue: string
aboutToAppear(): void {
this.AnnouncementText()
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/AnnouncementBuilder.ets#L122-L130 | a09f37d30fe4fcf283c71dd2d188704ddb9edefa | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets | arkts | getTypeface | returns the Typeface used for the labels, returns null if none is set
@return | public getTypeface(): FontWeight /*Typeface*/ {
return this.mTypeface;
} | AST#method_declaration#Left public getTypeface AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FontWeight AST#primary_type#Right AST#type_annotation#Right /*Typeface*/ AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left... | public getTypeface(): FontWeight {
return this.mTypeface;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L100-L102 | cd217ea643ab99a99726ee84f1a598081dad49f4 | gitee |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets | arkts | aboutToAppear | 页面加载时获取签到数据 | aboutToAppear() {
this.fetchCheckInData();
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fetchCheckInData AST#m... | aboutToAppear() {
this.fetchCheckInData();
} | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/SignIn.ets#L32-L34 | a2abd1bf664f313d1abd7095dea2ec43aeedbd3f | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderCommentPage.ets | arkts | 构建订单评论页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.order_comment"),
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: {
backgroundColor: $r("app.color.bg_white")
},
paddingValue: {
top: this.windowSafeAreaState.topInset,
lef... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.order_co... | build() {
AppNavDestination({
title: $r("app.string.order_comment"),
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: {
backgroundColor: $r("app.color.bg_white")
},
paddingValue: {
top: this.windowSafeAreaState.topInset,
lef... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderCommentPage.ets#L42-L58 | 9d2ac863256c3a961b08d1286851efc675077b24 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppSettings.ets | arkts | AppSettings.ets | export namespace AppSettings {
export class App {
static readonly projectName = "WordTree" // 用于标识 project
static readonly appName = "WordTree" // 用于标识 app
static readonly appDisplayName = getString($r('app.string.app_name'))
static readonly deviceType = "Harmony"
static re... | AST#export_declaration#Left export AST#ERROR#Left namespace AppSett in gs { export AST#ERROR#Right AST#class_declaration#Left class App AST#class_body#Left { AST#property_declaration#Left static readonly projectName = AST#expression#Left "WordTree" AST#expression#Right // 用于标识 project AST#property_declaration#Right AS... | export namespace AppSettings {
export class App {
static readonly projectName = "WordTree"
static readonly appName = "WordTree"
static readonly appDisplayName = getString($r('app.string.app_name'))
static readonly deviceType = "Harmony"
static readonly minDisk = 1... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppSettings.ets#L5-L14 | 542dc69710b961f20b820981564f305ad8b3472f | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/UserFile/SelectingUserFiles/entry/src/main/ets/pages/Index.ets | arkts | selectAudioFile | [Start audio_view_picker] | async selectAudioFile() {
// [Start audio_select_option]
const audioSelectOptions = new picker.AudioSelectOptions();
// [End audio_select_option]
const audioViewPicker = new picker.AudioViewPicker(context);
try {
const audioSelectResult: string[] = await audioViewPicker.select(audioSelectOptio... | AST#method_declaration#Left async selectAudioFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // [Start audio_select_option] AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left audioSelectOptions = AST#expression#Left AST#call_expression#Left AST#expre... | async selectAudioFile() {
const audioSelectOptions = new picker.AudioSelectOptions();
const audioViewPicker = new picker.AudioViewPicker(context);
try {
const audioSelectResult: string[] = await audioViewPicker.select(audioSelectOptions);
this.audioUris = audioSelectResult[0];
Lo... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/SelectingUserFiles/entry/src/main/ets/pages/Index.ets#L167-L184 | 0510e0038c138bda8772a92f9c1822302a9156c5 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeCouponSection.ets | arkts | HomeCouponSection | @file 首页优惠券区域组件
@author Joker.X | @ComponentV2
export struct HomeCouponSection {
/**
* 优惠券列表
*/
@Param
coupons: Coupon[] = [];
/**
* 构建优惠券区域
* @returns {void} 无返回值
*/
build(): void {
Card({ paddingValue: $r("app.float.space_vertical_medium") }) {
Row() {
Swiper() {
ForEach(this.coupons, (coupon: Cou... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HomeCouponSection AST#component_body#Left { /**
* 优惠券列表
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right coupons : AST#type_annotation#Left AST#primary_type#Left AST#array_type#L... | @ComponentV2
export struct HomeCouponSection {
@Param
coupons: Coupon[] = [];
build(): void {
Card({ paddingValue: $r("app.float.space_vertical_medium") }) {
Row() {
Swiper() {
ForEach(this.coupons, (coupon: Coupon): void => {
this.couponCard(coupon);
}, (c... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCouponSection.ets#L9-L76 | 5bfdf7eee02ea9f0f03375f287ae842fae496c30 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets | arkts | loadCA | 从文件加载内容 | loadCA() {
this.loadFile(caFileUri, (content: string) => {
this.ca = content;
})
} | AST#method_declaration#Left loadCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadFile AST#member_expressio... | loadCA() {
this.loadFile(caFileUri, (content: string) => {
this.ca = content;
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L289-L293 | ea115426f788fca6ba36e562f87ce5bffe0a6f0e | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | finishWithResult | @deprecated
@see {ZRouter.getInstance().finishWithResult}
@param result
@param animated | public static finishWithResult<T>(result: T, animated: boolean = true) {
return ZRouter.getRouterMgr().finishWithResult<T>(result, animated)
} | AST#method_declaration#Left public static finishWithResult AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST... | public static finishWithResult<T>(result: T, animated: boolean = true) {
return ZRouter.getRouterMgr().finishWithResult<T>(result, animated)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L488-L490 | 7cee1692d32f8482e1b216fcf87fc03d88b44e08 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets | arkts | readC2 | 读取C2部分
@param sm2_sequence sm2序列工具
@param data 待读取的数据
@returns C2部分 | private readC2(sm2_sequence: SM2Sequence, data: string): string {
if (data.startsWith(ASN1Util.OCTEN_STRING)) {
data = data.slice(ASN1Util.OCTEN_STRING.length, data.length);
let C2_lenHex = this.getLenHex(data);
data = data.slice(C2_lenHex.length, data.length);
if (this.lenHex2number(C2_lenH... | AST#method_declaration#Left private readC2 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | private readC2(sm2_sequence: SM2Sequence, data: string): string {
if (data.startsWith(ASN1Util.OCTEN_STRING)) {
data = data.slice(ASN1Util.OCTEN_STRING.length, data.length);
let C2_lenHex = this.getLenHex(data);
data = data.slice(C2_lenHex.length, data.length);
if (this.lenHex2number(C2_lenH... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L232-L245 | 25c6d75a6a893cb892f2c66c9253b4efa015786b | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/pages/SettingsPage.ets | arkts | clearApiKey | 清除API密钥 | private async clearApiKey(): Promise<void> {
try {
await this.configService.clearApiConfig();
this.apiKeyMasked = '';
this.apiKeyInput = '';
} catch (error) {
console.error('[SettingsPage] 清除API密钥失败');
}
} | AST#method_declaration#Left private async clearApiKey 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#t... | private async clearApiKey(): Promise<void> {
try {
await this.configService.clearApiConfig();
this.apiKeyMasked = '';
this.apiKeyInput = '';
} catch (error) {
console.error('[SettingsPage] 清除API密钥失败');
}
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/pages/SettingsPage.ets#L92-L100 | 37cae573a7d82b2994e940a3df8cce21c865581b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customstepper/Index.ets | arkts | CustomStepperViewComponent | 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 { CustomStepperViewComponent } from './src/main/ets/view/CustomStepperView'; | AST#export_declaration#Left export { CustomStepperViewComponent } from './src/main/ets/view/CustomStepperView' ; AST#export_declaration#Right | export { CustomStepperViewComponent } from './src/main/ets/view/CustomStepperView'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/Index.ets#L15-L15 | 6c7993ab8157151fe946529834810d34112ac701 | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | Get epoch milliseconds at today's 00:00:00.
@returns Epoch ms of the start of today. | export function getTodayStartMs(): number {
return dayjs().startOf('day').valueOf();
} | AST#export_declaration#Left export AST#function_declaration#Left function getTodayStartMs 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 ... | export function getTodayStartMs(): number {
return dayjs().startOf('day').valueOf();
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L45-L47 | 5073fb20777ab79a3f9d0b5cb7b78d2f720600cf | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets | arkts | scalingComponents | 缩放组件 | @Builder
scalingComponents() {
Scroll(this.scrollerForScaling) {
Column() {
Grid() {
LazyForEach(this.dataSource, (item: string) => {
GridItem() {
this.scalingContentComponent(item)
}
}, (item: string) => item)
}
.backgroundCo... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right scalingComponents 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 Scroll ( AST#expression#Left AST#member_expression#Left ... | @Builder
scalingComponents() {
Scroll(this.scrollerForScaling) {
Column() {
Grid() {
LazyForEach(this.dataSource, (item: string) => {
GridItem() {
this.scalingContentComponent(item)
}
}, (item: string) => item)
}
.backgroundCo... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets#L116-L139 | e822bdd2d8690a3ca4725650c595bd893ff3271e | gitee |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | getDataSource | 获取数据源 | getDataSource(): Array<T> {
return this.dataSource;
} | AST#method_declaration#Left getDataSource AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Rig... | getDataSource(): Array<T> {
return this.dataSource;
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L109-L111 | a76162ff538ad08bfa2504227cb72a2cf82af908 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/goods/GoodsNavigator.ets | arkts | toCategory | 跳转到商品分类
@param {GoodsCategoryParam} [params] - 商品分类参数
@returns {void} 无返回值 | static toCategory(params?: GoodsCategoryParam): void {
if (params) {
navigateTo(GoodsRoutes.Category, params);
return;
}
navigateTo(GoodsRoutes.Category);
} | AST#method_declaration#Left static toCategory AST#parameter_list#Left ( AST#parameter#Left params ? : AST#type_annotation#Left AST#primary_type#Left GoodsCategoryParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS... | static toCategory(params?: GoodsCategoryParam): void {
if (params) {
navigateTo(GoodsRoutes.Category, params);
return;
}
navigateTo(GoodsRoutes.Category);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/goods/GoodsNavigator.ets#L44-L50 | 5d3118b2a58e15dc6df18c2eaa87fdb391cf9b06 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/main/sub/report/RadarView.ets | arkts | drawGuideLinesSquare | ========== 绘制引导线 ========== ========== 绘制引导线(改为直线连接) ========== | private drawGuideLinesSquare(centerX: number, centerY: number, radius: number): void {
this.ctx.strokeStyle = this.GUIDE_LINE_COLOR;
this.ctx.lineWidth = 1;
//this.ctx.setLineDash([5, 3]); // 虚线
const count = this.parts.length;
if (count === 0) return;
const angleStep = (2 * Math.PI) / count;
... | AST#method_declaration#Left private drawGuideLinesSquare AST#parameter_list#Left ( AST#parameter#Left centerX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left centerY : AST#type_annotation#Left AST#primary_type#Left number ... | private drawGuideLinesSquare(centerX: number, centerY: number, radius: number): void {
this.ctx.strokeStyle = this.GUIDE_LINE_COLOR;
this.ctx.lineWidth = 1;
const count = this.parts.length;
if (count === 0) return;
const angleStep = (2 * Math.PI) / count;
for (let i = 1; i <= this.g... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L150-L205 | a115b7040111c919e0cdc232780bb421744c9d8e | github |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/home/RefreshImage.ets | arkts | this | 设置属性 | this.refreshConfigurator
.setHasRefresh(true) // 是否具有下拉刷新功能
.setHasLoadMore(true) // 是否具有上拉加载功能
.setMaxTranslate(150) // 可下拉上拉的最大距离
.setSensitivity(12) // 下拉上拉灵敏度
.setListIsPlacement(false) // 滑动结束后列表是否归位
.setAnimDuration(300) // 滑动结束后,回弹动画执行时间
.setRefreshHeight(80) // 下拉动画高度
... | AST#method_declaration#Left this AST#ERROR#Left . refreshConfigurator . setH as Refresh AST#parameter_list#Left ( AST#parameter#Left true AST#parameter#Right ) AST#parameter_list#Right // 是否具有下拉刷新功能 . setH as LoadMore AST#parameter_list#Left ( AST#parameter#Left true AST#parameter#Right ) AST#parameter_list#Right // 是否... | this.refreshConfigurator
.setHasRefresh(true)
.setHasLoadMore(true)
.setMaxTranslate(150)
.setSensitivity(12)
.setListIsPlacement(false)
.setAnimDuration(300)
.setRefreshHeight(80)
.setRefreshColor('#ff0000')
.setRefreshAnimDuration(1000... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/home/RefreshImage.ets#L45-L64 | 9af4aa2fdfb77aadecb456a6d7638c551320bf90 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/image/ImageUtil.ets | arkts | createCompressedPixelMap | 生成压缩图片
@param {Resource | image.PixelMap} src 未压缩的Resource图片或PixelMap对象
@param {number} maxSize 图像大小限制,默认不超过2MB
@returns {Promise<image.PixelMap>} 返回压缩后的PixelMap对象 | static async createCompressedPixelMap(src: Resource | image.PixelMap, maxSize: number = 2 * 1024 * 1024): Promise<image.PixelMap> {
if (typeof (src as Resource).id == 'number') {
src = await ImageUtil.getPixelMapFromResource((src as Resource));
}
const pixelMap = src as image.PixelMap;
let pixelBy... | AST#method_declaration#Left static async createCompressedPixelMap AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_ty... | static async createCompressedPixelMap(src: Resource | image.PixelMap, maxSize: number = 2 * 1024 * 1024): Promise<image.PixelMap> {
if (typeof (src as Resource).id == 'number') {
src = await ImageUtil.getPixelMapFromResource((src as Resource));
}
const pixelMap = src as image.PixelMap;
let pixelBy... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/image/ImageUtil.ets#L98-L109 | 1c92375030d09b27b3f05edb405d847d03430f3d | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets | arkts | query | query taskInfo
@param date
@param callback | query(date: string, isOpen: boolean = true, callback: Function): void {
let tableName = Const.TASK_INFO.tableName;
if (!tableName) {
return;
}
let predicates = new dataRdb.RdbPredicates(tableName);
predicates.equalTo('date', date);
if (isOpen) {
predicates.equalTo('isOpen', true);
... | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isOpen : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST... | query(date: string, isOpen: boolean = true, callback: Function): void {
let tableName = Const.TASK_INFO.tableName;
if (!tableName) {
return;
}
let predicates = new dataRdb.RdbPredicates(tableName);
predicates.equalTo('date', date);
if (isOpen) {
predicates.equalTo('isOpen', true);
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets#L82-L121 | 3706bd44ecced7fa44e3dc7ae981740a1e78e1b1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets | arkts | 列表内容 | constructor(id: Resource, title: Resource, content: Resource | string) {
this.id = id;
this.title = title;
this.content = content;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_typ... | constructor(id: Resource, title: Resource, content: Resource | string) {
this.id = id;
this.title = title;
this.content = content;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets#L34-L38 | 6fd3220166482ed98fffa93cabff09d9ee238d4b | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/ValidationUtils.ets | arkts | isValidIdCard | 验证身份证(18位) | static isValidIdCard(idCard: string): boolean {
const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
return idCardRegex.test(idCard);
} | AST#method_declaration#Left static isValidIdCard AST#parameter_list#Left ( AST#parameter#Left idCard : 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 boolean AST#primar... | static isValidIdCard(idCard: string): boolean {
const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/;
return idCardRegex.test(idCard);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ValidationUtils.ets#L25-L28 | baf13f7f2baa1e150f525fe79b9cca5aac8c12f8 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | isWeekend | 判断指定的日期在日历中是否为周末
@param date
@returns | static isWeekend(date?: number | string | Date) {
const day = DateUtils.getFormatDate(date).getDay(); //getDay() 方法返回值:0(周日) 到 6(周六)
return day === 0 || day === 6; //周六(6)或周日(0)都视为周末
} | AST#method_declaration#Left static isWeekend AST#parameter_list#Left ( AST#parameter#Left date ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Rig... | static isWeekend(date?: number | string | Date) {
const day = DateUtils.getFormatDate(date).getDay();
return day === 0 || day === 6;
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L232-L235 | c2fa5f3faad0a91be9236ae3111aaa7d338a7478 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/view/CategoryPage.ets | arkts | buildCategoryGrid | 构建分类网格
@param {CategoryTree[]} children - 子分类列表
@returns {void} 无返回值 | @Builder
private buildCategoryGrid(children: CategoryTree[]): void {
Grid() {
ForEach(children, (item: CategoryTree): void => {
GridItem() {
this.buildCategoryItem(item);
};
}, (item: CategoryTree): string => `${item.id}-${item.name}`);
}
.columnsTemplate(this.getCate... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildCategoryGrid AST#parameter_list#Left ( AST#parameter#Left children : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CategoryTree [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#par... | @Builder
private buildCategoryGrid(children: CategoryTree[]): void {
Grid() {
ForEach(children, (item: CategoryTree): void => {
GridItem() {
this.buildCategoryItem(item);
};
}, (item: CategoryTree): string => `${item.id}-${item.name}`);
}
.columnsTemplate(this.getCate... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L149-L162 | 9b8af4b63d9e87c8ea8adedf3af6df2e7befa70d | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | File filter type
@interface Filter
@syscap SystemCapability.FileManagement.File.FileIO
@since 20 | export interface Filter {
/**
* The suffix of the file.
*
* @type { ?Array<string> }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/
suffix?: Array<string>;
/**
* The display name of the file.
*
* @type { ?Array<string> }
* @syscap SystemCapability.FileManage... | AST#export_declaration#Left export AST#interface_declaration#Left interface Filter AST#object_type#Left { /**
* The suffix of the file.
*
* @type { ?Array<string> }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/ AST#type_member#Left suffix ? : AST#type_annotation#Left AST#primar... | export interface Filter {
suffix?: Array<string>;
displayName?: Array<string>;
mimeType?: Array<string>;
fileSizeOver?: number;
lastModifiedAfter?: number;
excludeMedia?: boolean;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4242-L4297 | 6cebbc58fba8afab404b8a9719ded70dacc012a4 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/TimedReminderService.ets | arkts | 提醒配置接口 | export interface ReminderConfig {
id: string;
type: ReminderType;
title: string;
content: string;
triggerTime: Date;
repeatType?: reminderAgentManager.ReminderType;
contactId?: string;
metadata?: Record<string, string>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ReminderConfig 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 type : AST#type_annotation#Left ... | export interface ReminderConfig {
id: string;
type: ReminderType;
title: string;
content: string;
triggerTime: Date;
repeatType?: reminderAgentManager.ReminderType;
contactId?: string;
metadata?: Record<string, string>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L20-L29 | 99536b75edc35d24b2dba1dc4f1c25501846ac10 | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets | arkts | 滑动系数 | build() {
Column() {
Stack() {
Image(this.resource.getImg())
.width('100%')
.height('100%')
.borderRadius(20)
.shadow({
radius: 20,
color: $r('app.color.btn_border_color')
})
}
.width('100%')
.height('100%')
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_u... | build() {
Column() {
Stack() {
Image(this.resource.getImg())
.width('100%')
.height('100%')
.borderRadius(20)
.shadow({
radius: 20,
color: $r('app.color.btn_border_color')
})
}
.width('100%')
.height('100%')
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets#L31-L94 | 2f9cba1a6fde6360bf1b368cd59f6436515a638e | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | getSlot | 获取一个指定类型的通知渠道。
@param type 要创建的通知渠道的类型 | static async getSlot(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> {
return notificationManager.getSlot(type);
} | AST#method_declaration#Left static async getSlot AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | static async getSlot(type: notificationManager.SlotType): Promise<notificationManager.NotificationSlot> {
return notificationManager.getSlot(type);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L370-L372 | 0a9543c8af88aaa93908d619090e649f7e2a2d46 | gitee |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/pages/Index.ets | arkts | changeTab | 切换到指定标签页(供子组件调用) | private changeTab(index: number): void {
hilog.info(DOMAIN, TAG, 'Changing tab to: %{public}d', index);
this.tabsController.changeIndex(index);
this.currentTabIndex = index;
} | AST#method_declaration#Left private changeTab AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | private changeTab(index: number): void {
hilog.info(DOMAIN, TAG, 'Changing tab to: %{public}d', index);
this.tabsController.changeIndex(index);
this.currentTabIndex = index;
} | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/Index.ets#L39-L43 | b75d64e6f0b523c81071543558f219f39dc983ab | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets | arkts | setSourceInfo | 视频信息上报函数 | async setSourceInfo(): Promise<void> {
this.isLoadingVideo = false; // 视频未加载完成
this.isLoading = true; // 加载动画继续加载
// 时间上报函数
this.avPlayer.on('timeUpdate', (time: number) => {
this.callbackTimeUpdate(time);
});
// 音量变化回调函数
this.avPlayer.on('volumeChange', (vol: number) => {
logger... | AST#method_declaration#Left async setSourceInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async setSourceInfo(): Promise<void> {
this.isLoadingVideo = false;
this.isLoading = true;
this.avPlayer.on('timeUpdate', (time: number) => {
this.callbackTimeUpdate(time);
});
this.avPlayer.on('volumeChange', (vol: number) => {
logger.info('volumeChange success,and new volum... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L152-L210 | 1063dfe76759d10f7a7e77bed0623be50ab9c3d6 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets | arkts | blurFirstAnim | 向外翻转90°同时 | blurFirstAnim() {
Logger.info(TAG, 'blurFirstAnim E');
// 初始化动效参数
this.shotImgBlur = 0; //无模糊
this.shotImgOpacity = 1; //不透明
this.shotImgScale = { x: 1, y: 1 };
animateToImmediately(
{
duration: BlurAnimateUtil.ROTATION_DURATION,
curve: Curve.Sharp,
onFinish: () => ... | AST#method_declaration#Left blurFirstAnim AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AS... | blurFirstAnim() {
Logger.info(TAG, 'blurFirstAnim E');
this.shotImgBlur = 0;
this.shotImgOpacity = 1;
this.shotImgScale = { x: 1, y: 1 };
animateToImmediately(
{
duration: BlurAnimateUtil.ROTATION_DURATION,
curve: Curve.Sharp,
onFinish: () => {
Logger.i... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets#L239-L261 | b1fae99c7f513422e3b5b5816915d9b41e59a78b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/LinkDataModel.ets | arkts | initial data model. | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SecondLevelLinkage/entry/src/main/ets/viewmodel/LinkDataModel.ets#L19-L19 | 317bbe676a9f46470233f6206311d5d065aeadcc | gitee | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | getJobTypeText | 获取工作类型显示文本 | getJobTypeText(): string {
switch (this.jobType) {
case JobType.FULL_TIME:
return '全职';
case JobType.PART_TIME:
return '兼职';
case JobType.INTERN:
return '实习';
case JobType.CONTRACT:
return '合同工';
default:
return '未知';
}
} | AST#method_declaration#Left getJobTypeText 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left swi... | getJobTypeText(): string {
switch (this.jobType) {
case JobType.FULL_TIME:
return '全职';
case JobType.PART_TIME:
return '兼职';
case JobType.INTERN:
return '实习';
case JobType.CONTRACT:
return '合同工';
default:
return '未知';
}
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L108-L121 | d8328a5fd740782cdc459e8c6bc890940cf51a45 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 使用行为事件
事件数据接口 | export interface AppLaunchEventData {
sessionId: string;
timestamp: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AppLaunchEventData AST#object_type#Left { AST#type_member#Left sessionId : 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 timestamp : AST#type_... | export interface AppLaunchEventData {
sessionId: string;
timestamp: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L241-L244 | c6b500f51e151775e1362c2c50e037f16e28327f | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/mainpage/DragToSwitchPictures.ets | arkts | DragToSwitchPicturesComponent | 功能描述: 本示例使用滑动手势监听,实时调整左右两侧内容显示区域大小和效果。通过绑定gesture事件中的PanGesture平移手势,实时获取拖动距离。当拖动时,实时地调节左右两个Image组件的宽度,从而成功实现左右拖动切换图片效果的功能
推荐场景: 调整左右两侧内容显示区域大小和效果
核心组件:
1. onActionUpdate
实现步骤:
1.创建三个Stack组件,用来展示装修前后对比图,第一个和第三个Stack分别存放装修前的图片和装修后的图片,zIndex设置为1。第二个Stack存放按钮的图片,zIndex设置为2,这样按钮的图片就会覆盖在两张装修图片之上。
2.将Image组件放在Row容器里,将Row容器... | @Component
export struct DragToSwitchPicturesComponent {
build() {
Scroll() {
Column() {
// AI设计视图
DesignCattleView();
// 瀑布流视图
TabsWaterFlowView();
}
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.dragtoswitchpictures_home_page_backgroundc... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DragToSwitchPicturesComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container... | @Component
export struct DragToSwitchPicturesComponent {
build() {
Scroll() {
Column() {
DesignCattleView();
TabsWaterFlowView();
}
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.dragtoswitchpictures_home_page_backgroundcolor'))
}
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/mainpage/DragToSwitchPictures.ets#L34-L54 | 5df4c476b8359db9774af6de4970e51367d2e375 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets | arkts | encodeECB | 加密-ECB模式
@param str 待加密的字符串
@param sm4Key SM4密钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns | static encodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static encodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.encodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, keyCoding, resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L45-L48 | b10d686b3587a3873eead58425575bc1413ff06e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/view/VideoMask.ets | arkts | 是否展示全局弹窗 | build() {
// 展示视频信息
Stack({ alignContent: Alignment.BottomStart }) {
// 视频播放组件
Stack({ alignContent: Alignment.TopEnd }) {
// 展示视频播放界面右侧用户头像、视频评论数量、收藏数量、分享数量等信息
Side({
head: this.videoData.videoMask.head,
likeCount: this.videoData.videoMask.likeCount,
co... | 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#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expressi... | build() {
Stack({ alignContent: Alignment.BottomStart }) {
Stack({ alignContent: Alignment.TopEnd }) {
Side({
head: this.videoData.videoMask.head,
likeCount: this.videoData.videoMask.likeCount,
commentCount: this.videoData.videoMask.commentCount,
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/VideoMask.ets#L27-L111 | aca8808eaf24918da948c50abf8165ae096656ff | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | convertPriKeyFromStr | 将非对称加密字符串priKey转换为symKey对象
@param privateKey字符串key
@param symAlgName 秘钥规格
@param keyName 密钥长度
@param keyCoding 私钥的编码方式(utf8/hex/base64)
@returns | static convertPriKeyFromStr(privateKey: string, symAlgName: string, keyName: number,
keyCoding: buffer.BufferEncoding) {
let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(privateKey, keyName, keyCoding) };
let aesGenerator = crypto.createAsyKeyGenerator(symAlgName);
let symKey =... | AST#method_declaration#Left static 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#Left st... | static convertPriKeyFromStr(privateKey: string, symAlgName: string, keyName: number,
keyCoding: buffer.BufferEncoding) {
let symKeyBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(privateKey, keyName, keyCoding) };
let aesGenerator = crypto.createAsyKeyGenerator(symAlgName);
let symKey =... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L64-L70 | 4f0f82af980ce7cceace8261cfe8ec09afcd6ea8 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | get_type | gets the type of this object
@returns "bookmark" | get_type() {
return this.is_folder ? "folder" : "bookmark";
} | AST#method_declaration#Left get_type AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . is_f... | get_type() {
return this.is_folder ? "folder" : "bookmark";
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L745-L747 | 0778614af7138e84f8366e2f56528e5ca10d77f1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | clearBadge | 清空桌面角标,在应用的桌面图标上呈现。 | static async clearBadge(): Promise<void> {
return notificationManager.setBadgeNumber(0);
} | AST#method_declaration#Left static async clearBadge 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#typ... | static async clearBadge(): Promise<void> {
return notificationManager.setBadgeNumber(0);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L328-L330 | 6591852257cf07bc0e19caa6742f9892c6f11a99 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleDataSet.ets | arkts | setBarSpace | Sets the space that is left out on the left and right side of each
candle, default 0.1f (10%), max 0.45f, min 0f
@param space | public setBarSpace(space: number): void {
if (space < 0) {
space = 0;
}
if (space > 0.45) {
space = 0.45;
}
this.mBarSpace = space;
} | AST#method_declaration#Left public setBarSpace AST#parameter_list#Left ( AST#parameter#Left space : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type... | public setBarSpace(space: number): void {
if (space < 0) {
space = 0;
}
if (space > 0.45) {
space = 0.45;
}
this.mBarSpace = space;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleDataSet.ets#L149-L158 | 31df813702b170825e72d7838ea7f428a5e84fb0 | gitee |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | 2000ms | export const DURATION_1000: number = 1000; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DURATION_1000 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1000 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat... | export const DURATION_1000: number = 1000; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L99-L99 | 41d4caf063a516bfb6f4f16625d5d42d87357af4 | github | |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/api/auth.ets | arkts | login | 登录用户 | static login<T = null, D = Recorder>(data?: D): ApiResult<T> {
return request<T>({
url: '/auth/login',
method: 'post',
data: data,
cache: true,
retry: 2,
})
} | AST#method_declaration#Left static login AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right , AST#type_parameter#Left D = AST#type_annotation#Left AST#primary_type#Left Recorder AST#primary_... | static login<T = null, D = Recorder>(data?: D): ApiResult<T> {
return request<T>({
url: '/auth/login',
method: 'post',
data: data,
cache: true,
retry: 2,
})
} | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/api/auth.ets#L7-L15 | 418eb25ecdbf83bb70b52794319d120cdfef3dfc | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/model/NavgationModel.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 class CommentDataSource implements IDataSource {
private elements: number[] = [];
private listeners: Set<DataChangeListener>;
constructor(elements: number[]) {
this.elements = elements;
this.listeners = new Set();
}
totalCount(): number {
return this.elements.length;
}
getData(index:... | AST#export_declaration#Left export AST#class_declaration#Left class CommentDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private elements : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#arr... | export class CommentDataSource implements IDataSource {
private elements: number[] = [];
private listeners: Set<DataChangeListener>;
constructor(elements: number[]) {
this.elements = elements;
this.listeners = new Set();
}
totalCount(): number {
return this.elements.length;
}
getData(index:... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navdestinationdialog/src/main/ets/model/NavgationModel.ets#L16-L47 | 1dd5b2fa536acc4cfdbaa801c854090216948ec8 | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets | arkts | sign | 对数据进行签名,异步
@param dataBlob 待签名数据
@param priKey 私钥
@returns | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.sign(dataBlob,priKey,'ECC256|SHA256')
} | AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : 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 priKe... | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.sign(dataBlob,priKey,'ECC256|SHA256')
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets#L34-L36 | d49f9b7afbf1a1effcc110febf6874c1f0fc1622 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519Sync.ets | arkts | @Author csx
@DateTime 2024/3/20 21:29
@TODO X25519Sync | export class X25519Sync {
/**
* X25519动态协商密钥,要求密钥长度为256位的非对称密钥
* @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
* @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
* @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @return... | AST#export_declaration#Left export AST#class_declaration#Left class X25519Sync AST#class_body#Left { /**
* X25519动态协商密钥,要求密钥长度为256位的非对称密钥
* @param pubKey 符合非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
* @param priKey 符合非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
* @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
... | export class X25519Sync {
static x25519(pubKey: string | Uint8Array, priKey: string | Uint8Array, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.dynamicKey(pubKey, priKey, 'X25519', 256, keyCoding, resultCoding);
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/X25519Sync.ets#L26-L39 | 0db2776b8c1708dc02c988a5b8b9f6318b288a67 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SHASync.ets | arkts | digest | SHA256摘要
@param str 带摘要的字符串
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 摘要后的字符串 | static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SHA256', resultCoding);
} | AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Le... | static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SHA256', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHASync.ets#L55-L57 | d1e316ba95c89bc4047e6dbc8485972330fe5854 | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/utils/HttpUtil.ets | arkts | get | GET请求 | static get<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const getConfig: RequestConfig = {
method: http.RequestMethod.GET,
headers: config.headers,
timeout: config.timeout,
data: config.data
};
return HttpUtil.request<T>(url, getConfig);
} | AST#method_declaration#Left static get AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation... | static get<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const getConfig: RequestConfig = {
method: http.RequestMethod.GET,
headers: config.headers,
timeout: config.timeout,
data: config.data
};
return HttpUtil.request<T>(url, getConfig);
} | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L129-L137 | a2a2c4cf61b94217a7de4df3da9f228ef8e2c77f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/textInput/KeyboardAvoidance.ets | arkts | KeyboardAvoidance | [Start keyboard_avoid] | @Entry
@Component
export struct KeyboardAvoidance {
placeHolderArr: string[] = ['1', '2', '3', '4', '5', '6', '7'];
build() {
// [StartExclude keyboard_avoid]
NavDestination() {
Column({ space: 12 }) {
ComponentCard({ title: $r('app.string.KeyboardAvoidance_title') }) {
Column({ spa... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct KeyboardAvoidance AST#component_body#Left { AST#property_declaration#Left placeHolderArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] A... | @Entry
@Component
export struct KeyboardAvoidance {
placeHolderArr: string[] = ['1', '2', '3', '4', '5', '6', '7'];
build() {
NavDestination() {
Column({ space: 12 }) {
ComponentCard({ title: $r('app.string.KeyboardAvoidance_title') }) {
Column({ space: 12 }) {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/textInput/KeyboardAvoidance.ets#L19-L52 | 1f9480f1575f86cf4ec5718f7645c441c5cca9e3 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets | arkts | loadUrl | 此函数为自定义函数,可作为初始化函数使用 | loadUrl(url: string) {
if (this.rootWebviewController !== null) {
// 复用预创建组件,重新加载url
this.rootWebviewController.loadUrl(url);
}
} | AST#method_declaration#Left loadUrl AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left ... | loadUrl(url: string) {
if (this.rootWebviewController !== null) {
this.rootWebviewController.loadUrl(url);
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WebDevelopOptimizationRender/entry/src/main/ets/pages/common.ets#L90-L95 | 5f8cc25e71bb5fe900f070bae1fe5ffd804738e2 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/bluetoothSample/entry/src/main/ets/common/ScanDialog.ets | arkts | ScanDialog | 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... | @CustomDialog
@Component
export struct ScanDialog {
@Link textValueOfInterval: string;
@Link inputValueOfInterval: string;
@Link textValueOfManufactureId: string;
@Link inputValueOfManufactureId: string;
@Link textValueOfDeviceName: string;
@Link inputValueOfDeviceName: string;
@Link textValueOfDeviceId: ... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ScanDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textValueOfInterval : AST#type_annotation#Left AST... | @CustomDialog
@Component
export struct ScanDialog {
@Link textValueOfInterval: string;
@Link inputValueOfInterval: string;
@Link textValueOfManufactureId: string;
@Link inputValueOfManufactureId: string;
@Link textValueOfDeviceName: string;
@Link inputValueOfDeviceName: string;
@Link textValueOfDeviceId: ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/common/ScanDialog.ets#L16-L120 | 459e115e439056323bada6313673b2f5e9cf935f | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/ActionSheetDialogView.ets | arkts | headBuilder | 标题 | @Builder
headBuilder() {
Column() {
Text(this.options.title)
.fontSize(this.options.style?.titleFontSize ?? 16)
.fontColor(this.options.style?.titleFontColor ?? $r('app.color.harmony_dialog_title_color'))
.align(Alignment.Center)
.textAlign(TextAlign.Center)
.padding(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right headBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_elem... | @Builder
headBuilder() {
Column() {
Text(this.options.title)
.fontSize(this.options.style?.titleFontSize ?? 16)
.fontColor(this.options.style?.titleFontColor ?? $r('app.color.harmony_dialog_title_color'))
.align(Alignment.Center)
.textAlign(TextAlign.Center)
.padding(... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/ActionSheetDialogView.ets#L97-L123 | 160ea6c8623269bfb016ac939710fc33e91ca74b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/view/ShortVideo.ets | arkts | aboutToAppear | 视频数据初始化 | async aboutToAppear() {
// 进入沉浸式
this.windowClass = await window.getLastWindow(getContext(this));
let sysBarProps: window.SystemBarProperties = {
statusBarContentColor: '#FFFFFF'
};
this.windowClass?.setWindowSystemBarProperties(sysBarProps);
this.statusHeight = this.windowClass.getWindowA... | AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 进入沉浸式 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowCl... | async aboutToAppear() {
this.windowClass = await window.getLastWindow(getContext(this));
let sysBarProps: window.SystemBarProperties = {
statusBarContentColor: '#FFFFFF'
};
this.windowClass?.setWindowSystemBarProperties(sysBarProps);
this.statusHeight = this.windowClass.getWindowAvoidArea... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/ShortVideo.ets#L102-L131 | 6830c5dafc281ee85bea0715562c80fcb149806b | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionUpdate | Callback when the Pinch gesture is moving.
@param { Callback<GestureEvent> } event
@returns { PinchGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionUpdate(event: Callback<GestureEvent>): PinchGesture; | AST#method_declaration#Left onActionUpdate 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 GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_... | onActionUpdate(event: Callback<GestureEvent>): PinchGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L615-L615 | 7c2f9a0eb4008af66fb1d39d1b31572469702ec1 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineRadarDataSet.ets | arkts | Base dataset for line and radar DataSets. | export default abstract class LineRadarDataSet<T extends EntryOhos> extends LineScatterCandleRadarDataSet<T> implements ILineRadarDataSet<T> {
/**
* the color that is used for filling the line surface
*/
// private mFillColor: number = Color.rgb(140, 234, 255);
private mFillColor: number = ChartColor.rgb(... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class LineRadarDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Righ... | export default abstract class LineRadarDataSet<T extends EntryOhos> extends LineScatterCandleRadarDataSet<T> implements ILineRadarDataSet<T> {
private mFillColor: number = ChartColor.rgb(140, 234, 255);
private mLinearGradientColors: JArrayList<ChartColorStop> | null = null;
protected mFillDrawable: Ch... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineRadarDataSet.ets#L27-L155 | 47794a08f717fa9d6faea2402be0e07a45d0a3fc | gitee | |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | downloadHls | HLS 流下载 | public static downloadHls(hlsUrl: string, output: string): string[] {
return ['ffmpeg', '-i', hlsUrl, '-c:v', 'copy', '-c:a', 'copy', '-y', output];
} | AST#method_declaration#Left public static downloadHls AST#parameter_list#Left ( AST#parameter#Left hlsUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left output : AST#type_annotation#Left AST#primary_type#Left string AST#p... | public static downloadHls(hlsUrl: string, output: string): string[] {
return ['ffmpeg', '-i', hlsUrl, '-c:v', 'copy', '-c:a', 'copy', '-y', output];
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L214-L216 | b9937b5f264e433ce5f9110023d45bcad0c7d55d | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/PieChartRenderer.ets | arkts | getSliceSpace | Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace.
@param dataSet
@return | protected getSliceSpace(dataSet: IPieDataSet): number {
let chartData = this.mChart.getData();
if (!chartData || !this.mViewPortHandler) {
return -1;
}
if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled())
return dataSet.getSliceSpace();
let spaceSizeRatio: number = dataSet.getSl... | AST#method_declaration#Left protected getSliceSpace AST#parameter_list#Left ( AST#parameter#Left dataSet : AST#type_annotation#Left AST#primary_type#Left IPieDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AS... | protected getSliceSpace(dataSet: IPieDataSet): number {
let chartData = this.mChart.getData();
if (!chartData || !this.mViewPortHandler) {
return -1;
}
if (!dataSet.isAutomaticallyDisableSliceSpacingEnabled())
return dataSet.getSliceSpace();
let spaceSizeRatio: number = dataSet.getSl... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/PieChartRenderer.ets#L185-L202 | 7ca57dd94d7ba4a82f5efffb78989d03a3dddacf | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/ChatTools.ets | arkts | setKeyboardAvoidModeToRESIZE | 设置输入法软键盘避让模式为RESIZE(表示当输入显示时,压缩窗体高度,而不是使用默认的OFFSET模式将窗体整体上推)。
详见官方资料:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-keyboard-layout-adapt-V5#section08221814182316
@param toRESIZE true表示设置为KeyboardAvoidMode.RESIZE模式,否则还原为系统默认的 KeyboardAvoidMode.OFFSET模式 | static setKeyboardAvoidModeToRESIZE(context: UIContext, toRESIZE: boolean) {
context.setKeyboardAvoidMode(toRESIZE ? KeyboardAvoidMode.RESIZE : KeyboardAvoidMode.OFFSET);
} | AST#method_declaration#Left static setKeyboardAvoidModeToRESIZE AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toRESIZE : AST#type_annotation#Left AST#primary_type#L... | static setKeyboardAvoidModeToRESIZE(context: UIContext, toRESIZE: boolean) {
context.setKeyboardAvoidMode(toRESIZE ? KeyboardAvoidMode.RESIZE : KeyboardAvoidMode.OFFSET);
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L64-L66 | 74fcda3f349d5b290880e63de9c59fa3f439f46a | gitee |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets | arkts | Provides the definition of the point in 3D.
@typedef Point3d
@extends Point
@syscap SystemCapability.Graphics.Drawing
@since 12 | export interface Point3d extends Point {
/**
* Z-axis coordinate.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/
z: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Point3d AST#extends_clause#Left extends Point AST#extends_clause#Right AST#object_type#Left { /**
* Z-axis coordinate.
* @type { number }
* @syscap SystemCapability.Graphics.Drawing
* @since 12
*/ AST#type_member#Left z... | export interface Point3d extends Point {
z: number;
} | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.common2D.ets#L134-L142 | 1b39a6189ed80180b8ac05c96feb28d2e80b254f | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSA.ets | arkts | sign2048PKCS1 | 2048位签名-PKCS1
@param str 需要签名的字符串
@param priKey 2048位私钥
@returns string> 签名对象 | static async sign2048PKCS1(str: string, priKey: string): Promise<string> {
return CryptoUtil.sign(str, priKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048);
} | AST#method_declaration#Left static async sign2048PKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | static async sign2048PKCS1(str: string, priKey: string): Promise<string> {
return CryptoUtil.sign(str, priKey, 'RSA2048', 'RSA2048|PKCS1|SHA256', 2048);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L134-L136 | 2094251910e3baf7fedeed781b19091bccb4fd26 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | getSignalType | 查询当前网络是3G/4G/5G
SignalInformation.signalType表示蜂窝网络的类型
未知(值为0)
2G:GSM(值为1)、CDMA(值为2)
3G:WCDMA(值为3)、TDSCDMA(值为4)
4G:LTE(值为5)
5G:NR(值为6)
@returns 指定SIM卡槽对应的注册网络信号强度信息列表 | async getSignalType(): Promise<radio.SignalInformation[]> {
let slotId: number = await radio.getPrimarySlotId();
let data: Array<radio.SignalInformation> = radio.getSignalInformationSync(slotId);
// signalType代表网络类型NetworkType
let signalType = data[0].signalType;
logger.info("getSignalType:" + JSON.... | AST#method_declaration#Left async getSignalType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left radio . SignalInformation AST#qualified_typ... | async getSignalType(): Promise<radio.SignalInformation[]> {
let slotId: number = await radio.getPrimarySlotId();
let data: Array<radio.SignalInformation> = radio.getSignalInformationSync(slotId);
let signalType = data[0].signalType;
logger.info("getSignalType:" + JSON.stringify(data));
return d... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L208-L215 | ff124b064e13645874b364363b11d6d95fcd4970 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets | arkts | getChatInfo | 获取提交给AI的问题 | getChatInfo() {
let newMessage = new Message("user", this.question)
this.chatHistory.add(newMessage)
let chatInfo: ChatInfo = new ChatInfo(this.modelName, this.chatHistory.convertToArray())
return chatInfo
} | AST#method_declaration#Left getChatInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left newMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressio... | getChatInfo() {
let newMessage = new Message("user", this.question)
this.chatHistory.add(newMessage)
let chatInfo: ChatInfo = new ChatInfo(this.modelName, this.chatHistory.convertToArray())
return chatInfo
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets#L156-L161 | 9290ccf6f93ff0fe27733715b9a877065feb2bd2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/slidetohideanddisplace/Index.ets | arkts | SlideToHideAndDisplaceComponent | 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 { SlideToHideAndDisplaceComponent } from './src/main/ets/view/SlideToHideAndDisplace'; | AST#export_declaration#Left export { SlideToHideAndDisplaceComponent } from './src/main/ets/view/SlideToHideAndDisplace' ; AST#export_declaration#Right | export { SlideToHideAndDisplaceComponent } from './src/main/ets/view/SlideToHideAndDisplace'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/Index.ets#L15-L15 | 78efd089cc055f5030a0e218f98ea281f31449f8 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/model/MainTabItem.ets | arkts | @file 主页面底部 Tab 配置项
@author Joker.X | export interface MainTabItem {
/**
* 文本标题
*/
title: Resource;
/**
* 图标资源
*/
icon: Resource;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MainTabItem AST#object_type#Left { /**
* 文本标题
*/ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 图标资源
*/ AST#type_me... | export interface MainTabItem {
title: Resource;
icon: Resource;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/model/MainTabItem.ets#L5-L15 | ebbdea1202371e9cbcc393fff6fcf52f932ea650 | github | |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/utils/PreferenceModel.ets | arkts | setToken | 写入 token | async setToken(token: string) {
await this.putPreference('token', token);
} | AST#method_declaration#Left async setToken AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#express... | async setToken(token: string) {
await this.putPreference('token', token);
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L90-L92 | 935b8c48111fb51240bfd6f29cc7ce096685bd68 | github |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Main.ets | arkts | calculateDayStats | 计算某一天的支出和收入 | calculateDayStats(bills: BillItem[]): DayStats {
let expense = 0;
let income = 0;
bills.forEach(bill => {
if (bill.type === 0) {
expense += parseFloat(bill.amount) || 0;
} else {
income += parseFloat(bill.amount) || 0;
}
});
const result: DayStats = {
expense:... | AST#method_declaration#Left calculateDayStats AST#parameter_list#Left ( AST#parameter#Left bills : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left BillItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le... | calculateDayStats(bills: BillItem[]): DayStats {
let expense = 0;
let income = 0;
bills.forEach(bill => {
if (bill.type === 0) {
expense += parseFloat(bill.amount) || 0;
} else {
income += parseFloat(bill.amount) || 0;
}
});
const result: DayStats = {
expense:... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Main.ets#L193-L208 | 56ab83f0c53e2f1346d348c5af560332651333b6 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/ScanUtils.ets | arkts | onPickerScanForResult | 通过picker拉起图库并选择图片,并调用图片识码
@param options
@returns | static async onPickerScanForResult(options?: scanBarcode.ScanOptions): Promise<Array<scanBarcode.ScanResult>> {
try {
let photoOption = new picker.PhotoSelectOptions()
photoOption.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE
photoOption.maxSelectNumber = 1
let photoPicker = new picker.Pho... | AST#method_declaration#Left static async onPickerScanForResult AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left scanBarcode . ScanOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#par... | static async onPickerScanForResult(options?: scanBarcode.ScanOptions): Promise<Array<scanBarcode.ScanResult>> {
try {
let photoOption = new picker.PhotoSelectOptions()
photoOption.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE
photoOption.maxSelectNumber = 1
let photoPicker = new picker.Pho... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ScanUtils.ets#L87-L100 | 2ff32212f93bb99cf68e2e35941df6707d00333c | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildStyleOption | 构建样式选项 | @Builder
buildStyleOption(label: string, style: GreetingStyle, description: string) {
Row({ space: 12 }) {
Radio({ value: style.toString(), group: 'style' })
.checked(this.selectedStyle === style)
.onChange((isChecked: boolean) => {
if (isChecked) {
this.selectedStyle =... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStyleOption AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left style : AST#type_annotation#L... | @Builder
buildStyleOption(label: string, style: GreetingStyle, description: string) {
Row({ space: 12 }) {
Radio({ value: style.toString(), group: 'style' })
.checked(this.selectedStyle === style)
.onChange((isChecked: boolean) => {
if (isChecked) {
this.selectedStyle =... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L656-L688 | d13928f6c2e375b468fa37fac31120186cb650a1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/Index.ets | arkts | buildSettingsContent | 构建设置内容占位符 | @Builder
buildSettingsContent() {
Text('设置页面')
.fontSize(18)
.fontColor('#333333')
.textAlign(TextAlign.Center)
.width('100%')
.height('100%')
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingsContent 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 Text ( AST#expression#Left '设置页面' AST#expression#Righ... | @Builder
buildSettingsContent() {
Text('设置页面')
.fontSize(18)
.fontColor('#333333')
.textAlign(TextAlign.Center)
.width('100%')
.height('100%')
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L446-L454 | eb1345363fe5e82ba29480a114ecbcaf04f8a883 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinF.ets | arkts | SpinF | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinF {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 0;
@Local scale2: number = 1;
@Local angle1: number = 0;
build() {
RelativeContainer() {
Canvas()
.alignRules({
top: { anchor: '__container__', ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinF AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinF {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 0;
@Local scale2: number = 1;
@Local angle1: number = 0;
build() {
RelativeContainer() {
Canvas()
.alignRules({
top: { anchor: '__container__', ... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinF.ets#L26-L95 | f769254d3209229fd7ca4056ba34e0651fb16325 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinV.ets | arkts | SpinV | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit
github: https://github.com/787107497
gitee: https://gitee.com/tongyuyan/spinkit
QQ交流群: 569512366 | @ComponentV2
export struct SpinV {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local angle1: number = 0;
@Local scale2: number = 0.5;
build() {
Stack() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.border({
width: this.sp... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinV AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinV {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local angle1: number = 0;
@Local scale2: number = 0.5;
build() {
Stack() {
Canvas()
.width(this.spinSize)
.height(this.spinSize)
.border({
width: this.sp... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinV.ets#L26-L87 | 91e040dc94407e3a0c37e636d6b17dad200951dd | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_EventHub.ets | arkts | 页面展示 | build() {
Column() {
Row() {
Flex({ justifyContent: FlexAlign.Start, alignContent: FlexAlign.Center }) {
Text($r('app.string.DataSynchronization'))
.fontSize(24)
.fontWeight(700)
.textAlign(TextAlign.Start)
.margin({ top: 12 , bottom: 11 , righ... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row() {
Flex({ justifyContent: FlexAlign.Start, alignContent: FlexAlign.Center }) {
Text($r('app.string.DataSynchronization'))
.fontSize(24)
.fontWeight(700)
.textAlign(TextAlign.Start)
.margin({ top: 12 , bottom: 11 , righ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_EventHub.ets#L44-L126 | 4c2cb59ade7354951d71b57eb2dc5b6b1d9fbe3a | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/FileUtil.ets | arkts | getCacheDirPath | 获取缓存目录下的文件夹路径或文件路径。
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns | static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir; //根目录
if (StrUtil.isNotEmpty(dirPath)) {
if (FileUtil.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。
filePath... | AST#method_declaration#Left static getCacheDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_anno... | static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir;
if (StrUtil.isNotEmpty(dirPath)) {
if (FileUtil.hasDirPath(dirPath)) {
filePath = dirPath;
} el... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FileUtil.ets#L63-L79 | 3d37f2f1f614590af547f48d603d3ec962d42add | gitee |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/model/userModel.ets | arkts | confirmUser | 确认用户是否存在 | confirmUser(username: string, password: string): boolean {
const user = this.getUser(username);
if(user){
console.info(user.username);
}else {
console.info("666");
return false;
}
if (user && user.password === password) {
return true;
}
return false;
} | AST#method_declaration#Left confirmUser AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ... | confirmUser(username: string, password: string): boolean {
const user = this.getUser(username);
if(user){
console.info(user.username);
}else {
console.info("666");
return false;
}
if (user && user.password === password) {
return true;
}
return false;
} | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L85-L97 | 0e9661c14e75582d1c4b4beca26b5d75820c5587 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/data_operation_tools.ets | arkts | Converts a boolean to string.
@param str A string form of the boolean: 'true' | 'false'.
@returns A boolean, true if the str is exactly 'true'.
@returns A boolean, false if otherwise. | export function string_to_boolean(str: string) {
return (str == 'true') ? true : false;
} | AST#export_declaration#Left export AST#function_declaration#Left function string_to_boolean AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ... | export function string_to_boolean(str: string) {
return (str == 'true') ? true : false;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/data_operation_tools.ets#L244-L246 | d6dfc0a829e2488e484e37aa79335447b4acd516 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/want_tools.ets | arkts | Wants
Respond to want.
@param uri the want uri
@param action the want action
@param type the want type
@returns True if a want is detected and processed. | export function check_want(uri: string, action: string, type: string, storage: LocalStorage) {
if (uri.length == 0) {
console.log('[Meow][init] Didn\'t load want for an empty want.');
return false;
}
console.log('[Meow][want] Load want with uri: ' + uri + ', action: ' + action + ', type: ' + type + ', sto... | AST#export_declaration#Left export AST#function_declaration#Left function check_want 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#Left action : AST#type_annotation#Left AST#pr... | export function check_want(uri: string, action: string, type: string, storage: LocalStorage) {
if (uri.length == 0) {
console.log('[Meow][init] Didn\'t load want for an empty want.');
return false;
}
console.log('[Meow][want] Load want with uri: ' + uri + ', action: ' + action + ', type: ' + type + ', sto... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/want_tools.ets#L10-L27 | 3288d8d8b9ee4adf7ec1df1eed288e4e270d5675 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets | arkts | SwiperMainPage | 功能说明: 通过Stack组件堆叠图片,实现多层级效果,配合手势滑动和显式动画实现切换的动画效果。同时通过改变数据中间值currentIndex来改变组件zIndex层级和高度来实现切换的效果。
推荐场景: 购物类、资讯类应用的首页轮播
核心组件:
1. SwiperSection: 自定义轮播图
实现步骤:
1. 数据准备。设置SwiperItemViewType(轮播图属性配置)以及初始化轮播图数据。其中SwiperItemViewType包含SwiperData(轮播项数据类)以及
contentBuilder(轮播项视图)两个属性。
@example
class SwiperItemViewType {
data:... | @Component
export struct SwiperMainPage {
// 轮播模块列表
swiperListView: SwiperItemViewType[] = [];
dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{};
// 当前索引
@State currentIndex: number = 0;
aboutToAppear(): void {
let swiperData: SwiperData[] = [
new SwiperData... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperMainPage AST#component_body#Left { // 轮播模块列表 AST#property_declaration#Left swiperListView : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SwiperItemViewType [ ] AST#array_type#Right AST#prim... | @Component
export struct SwiperMainPage {
swiperListView: SwiperItemViewType[] = [];
dynamicsRouterPush:(swiperItemData:SwiperData) => void = (swiperItemData:SwiperData)=>{};
@State currentIndex: number = 0;
aboutToAppear(): void {
let swiperData: SwiperData[] = [
new SwiperData($r('app.media.s... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/mainpage/SwiperMainPage.ets#L83-L147 | b29ec2e7319889fffccf4d8631669c5d85f538cf | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/im/IMManager.ets | arkts | connect | 连接IM服务(WebSocket) | async connect(): Promise<boolean> {
try {
Logger.info('IMManager', 'Connecting to IM service');
// 实际实现需要建立WebSocket连接
EventBus.emit('IM_CONNECTED');
return true;
} catch (error) {
Logger.error('IMManager', `Failed to connect: ${String(error)}`);
return false;
}
} | AST#method_declaration#Left async connect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async connect(): Promise<boolean> {
try {
Logger.info('IMManager', 'Connecting to IM service');
EventBus.emit('IM_CONNECTED');
return true;
} catch (error) {
Logger.error('IMManager', `Failed to connect: ${String(error)}`);
return false;
}
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L179-L189 | f731818ce7dc1555c2377a53f585e96ca2c5c599 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets | arkts | queryAllAudios | 获取所有音频文件
@returns | async queryAllAudios(): Promise<Array<Record>> {
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
predicates.greaterThan('duration', 0)
let fetchOptions: userFileManager.FetchOptions = {
fetchColumns: ['duration', 'date_added'],
predicates... | AST#method_declaration#Left async queryAllAudios AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_ann... | async queryAllAudios(): Promise<Array<Record>> {
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
predicates.greaterThan('duration', 0)
let fetchOptions: userFileManager.FetchOptions = {
fetchColumns: ['duration', 'date_added'],
predicates... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets#L68-L88 | ed0037819f6c1334de67ae96fedb4520697dbbec | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | buildCalendarDay | 构建日历天数 | @Builder
buildCalendarDay(day: CalendarDay) {
Stack() {
Column({ space: 2 }) {
// 日期数字
Text(day.day.toString())
.fontSize(16)
.fontColor(day.isCurrentMonth ?
(day.isToday ? '#ffffff' : '#333333') :
'#cccccc')
.fontWeight(day.isToday ? F... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCalendarDay AST#parameter_list#Left ( AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left CalendarDay AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function... | @Builder
buildCalendarDay(day: CalendarDay) {
Stack() {
Column({ space: 2 }) {
Text(day.day.toString())
.fontSize(16)
.fontColor(day.isCurrentMonth ?
(day.isToday ? '#ffffff' : '#333333') :
'#cccccc')
.fontWeight(day.isToday ? FontWeig... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L318-L374 | fe5eb8cca2b5bd912efb80724c3369f9c19f82cc | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebHelper.ets | arkts | isThirdPartyCookieAllowed | 获取WebCookieManager实例是否拥有发送和接收第三方cookie的权限。
@returns | static isThirdPartyCookieAllowed(): boolean {
return webview.WebCookieManager.isThirdPartyCookieAllowed();
} | AST#method_declaration#Left static isThirdPartyCookieAllowed AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left A... | static isThirdPartyCookieAllowed(): boolean {
return webview.WebCookieManager.isThirdPartyCookieAllowed();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L179-L181 | 01d6eac704d3116a7f95a3f8e3329148e88ec178 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/Tools.ets | arkts | toNotificationSetting | 跳转通知设置页面 | static toNotificationSetting(): Promise<void> {
const parameters: Record<string, Record<string, string>> = {
'pushParams': {
'bundleName': ArkWebHelper.getContext().abilityInfo.bundleName // 应用包名
}
};
const URI_NOTIFICATION: string = "systemui_notification_settings"; //通知设置页面
return ... | AST#method_declaration#Left static toNotificationSetting 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 > AS... | static toNotificationSetting(): Promise<void> {
const parameters: Record<string, Record<string, string>> = {
'pushParams': {
'bundleName': ArkWebHelper.getContext().abilityInfo.bundleName
}
};
const URI_NOTIFICATION: string = "systemui_notification_settings";
return Tools.toSetting... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L64-L72 | 117672621eff301b4329221a9d8fc5ae2581a3e1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/Base64Util.ets | arkts | TODO Base64工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class Base64Util {
/**
* 编码,通过输入参数编码后输出Uint8Array对象。
* @param array
* @returns
*/
static encode(array: Uint8Array): Promise<Uint8Array> {
const base64 = new util.Base64Helper();
return base64.encode(array);
}
/**
* 编码,通过输入参数编码后输出Uint8Array对象。
* @param array
* @returns
*... | AST#export_declaration#Left export AST#class_declaration#Left class Base64Util AST#class_body#Left { /**
* 编码,通过输入参数编码后输出Uint8Array对象。
* @param array
* @returns
*/ AST#method_declaration#Left static encode AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Ui... | export class Base64Util {
static encode(array: Uint8Array): Promise<Uint8Array> {
const base64 = new util.Base64Helper();
return base64.encode(array);
}
static encodeSync(array: Uint8Array): Uint8Array {
const base64 = new util.Base64Helper();
const result = base64.encodeSync(array);
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/Base64Util.ets#L23-L92 | 7e252eb6ae37579fd8048f2531e048a3a7085480 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/model/src/main/ets/common/Ids.ets | arkts | ID数组
@author Joker.X | export class Ids {
/**
* 地址ID数组
*/
ids: number[];
constructor(ids: number[]) {
this.ids = ids;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Ids AST#class_body#Left { /**
* 地址ID数组
*/ AST#property_declaration#Left ids : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_decla... | export class Ids {
ids: number[];
constructor(ids: number[]) {
this.ids = ids;
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/common/Ids.ets#L5-L14 | 96384bd12a0cbd610ca85d9180c7a870d0b27777 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NavigationRouter/harB/src/main/ets/components/mainpage/B4.ets | arkts | harBuilder | [Start function_har_builder] | @Builder
export function harBuilder(value: object) {
NavDestination() {
Column() {
// [StartExclude function_har_builder]
Button($r("app.string.to_harb_pageB3"), { stateEffect: true, type: ButtonType.Capsule })
.width('80%')
.height(40)
.margin(20)
.onClick(() => {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function harBuilder AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST... | @Builder
export function harBuilder(value: object) {
NavDestination() {
Column() {
Button($r("app.string.to_harb_pageB3"), { stateEffect: true, type: ButtonType.Capsule })
.width('80%')
.height(40)
.margin(20)
.onClick(() => {
buildRouterModel(RouterNameCons... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/harB/src/main/ets/components/mainpage/B4.ets#L18-L62 | 20d461ea7b31cade18329175e9bdc4191cb6c9d5 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ChipGroup.d.ets | arkts | Defines suffix icon options.
@interface SuffixImageIconOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 14 | export interface SuffixImageIconOptions extends IconOptions {
/**
* Called when the suffix image icon is clicked.
*
* @type { ?VoidCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
action?: VoidCallback;
/**
... | AST#export_declaration#Left export AST#interface_declaration#Left interface SuffixImageIconOptions AST#extends_clause#Left extends IconOptions AST#extends_clause#Right AST#object_type#Left { /**
* Called when the suffix image icon is clicked.
*
* @type { ?VoidCallback }
* @syscap SystemCapability.Ar... | export interface SuffixImageIconOptions extends IconOptions {
action?: VoidCallback;
accessibilityText?: ResourceStr;
accessibilityDescription?: ResourceStr;
accessibilityLevel?: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L68-L113 | 87cd328ef56d2e7e6e2e71439fcb74eebd44bca2 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Learn.ets | arkts | compareTo | MARK: - Comparable | compareTo(other: Learn): number {
if (this.planId === other.planId) {
return (this.bookId ?? 0) - (other.bookId ?? 0);
} else if (this.bookId === other.bookId) {
return (this.num ?? 0) - (other.num ?? 0);
} else if (this.num === other.num) {
return (this.distance ?? 0) - (other.distance ??... | AST#method_declaration#Left compareTo AST#parameter_list#Left ( AST#parameter#Left other : AST#type_annotation#Left AST#primary_type#Left Learn AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | compareTo(other: Learn): number {
if (this.planId === other.planId) {
return (this.bookId ?? 0) - (other.bookId ?? 0);
} else if (this.bookId === other.bookId) {
return (this.num ?? 0) - (other.num ?? 0);
} else if (this.num === other.num) {
return (this.distance ?? 0) - (other.distance ??... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Learn.ets#L45-L59 | fdec641a091b7d36eb2e1aecdc8f4d235034a188 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | disableLoading | 全局加载框
@returns | disableLoading(status: boolean = false): EfRcp {
efRcpConfig.loading.enable = status;
return this;
} | AST#method_declaration#Left disableLoading AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right... | disableLoading(status: boolean = false): EfRcp {
efRcpConfig.loading.enable = status;
return this;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L389-L392 | 7201050470209b3b5e1849baa021623d9f25cf97 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets | arkts | AVSession管理模块,负责以下业务功能:
1. 创建/销毁AVSession实例
2. 注册AVSession实例业务回调功能
3. 启动/关闭于AVSession共同使用的音频后台任务 | export class AVSessionModel {
private bindContext?: Context;
private session?: AVSessionManager.AVSession;
private avSessionTag: string = 'MUSIC_PLAYER';
private avSessionType: AVSessionManager.AVSessionType = 'audio';
private curState: AVSessionManager.AVPlaybackState = {
state: AVSessionManager.Playback... | AST#export_declaration#Left export AST#class_declaration#Left class AVSessionModel AST#class_body#Left { AST#property_declaration#Left private bindContext ? : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration... | export class AVSessionModel {
private bindContext?: Context;
private session?: AVSessionManager.AVSession;
private avSessionTag: string = 'MUSIC_PLAYER';
private avSessionType: AVSessionManager.AVSessionType = 'audio';
private curState: AVSessionManager.AVPlaybackState = {
state: AVSessionManager.Playback... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets#L33-L334 | 68f44625286e5d59e7e62fcdf9f1ae46c4812d7e | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | initCircleRadius | 设置悬浮球直径 | initCircleRadius(): void {
this.circleDiameter = this.getMinWidth();
// 获取半径
this.circleRadius = this.circleDiameter / 2;
this.circleOffsetX = this.circleRadius;
// 悬浮球 y 轴偏移直径的 三分之一
this.circleOffsetY = this.circleDiameter / 3;
} | AST#method_declaration#Left initCircleRadius AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m... | initCircleRadius(): void {
this.circleDiameter = this.getMinWidth();
this.circleRadius = this.circleDiameter / 2;
this.circleOffsetX = this.circleRadius;
this.circleOffsetY = this.circleDiameter / 3;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L190-L198 | 29b9021561b98ee0d2080a3c35fc2ae313a69503 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/StepsCardJS/entry/src/main/ets/common/database/SensorData.ets | arkts | Database sensor steps entity class. | export default class SensorData {
/**
* Time of walking steps.
*/
date: string = '';
/**
* Value of steps.
*/
stepsValue: number = 0;
/**
* Gets the number of steps to insert a form.
*
* @return Return steps.
*/
toValuesBucket(): relationalStore.ValuesBucket {
return {
'da... | AST#export_declaration#Left export default AST#class_declaration#Left class SensorData AST#class_body#Left { /**
* Time of walking steps.
*/ AST#property_declaration#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expr... | export default class SensorData {
date: string = '';
stepsValue: number = 0;
toValuesBucket(): relationalStore.ValuesBucket {
return {
'date': this.date,
'stepsValue': this.stepsValue
};
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/database/SensorData.ets#L21-L42 | e3b146e989ed56c7273d77c828ec0a0c9420e3d5 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | navigateToAddressSelection | 跳转到地址选择页面
@returns {void} 无返回值 | navigateToAddressSelection(): void {
UserNavigator.toAddressList(true)
.then((result?: UserSelectAddressResult): void => {
if (result?.address) {
this.updateSelectedAddress(result.address);
}
});
} | AST#method_declaration#Left navigateToAddressSelection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left A... | navigateToAddressSelection(): void {
UserNavigator.toAddressList(true)
.then((result?: UserSelectAddressResult): void => {
if (result?.address) {
this.updateSelectedAddress(result.address);
}
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L273-L280 | 69b3e50297f197169f0d8ad46770a6903fc0b275 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.