nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | count | 计算记录数
@param tableName 表名
@param whereClause 条件子句
@param whereArgs 条件参数
@returns 记录数 | async count(tableName: string, whereClause?: string, whereArgs?: Array<string>): Promise<number> {
try {
const result = await this.query(tableName, ['COUNT(*) as count'], whereClause, whereArgs);
return result.length > 0 ? result[0].count as number : 0;
} catch (error) {
hilog.error(LogConstan... | AST#method_declaration#Left async count AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left whereClause ? : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | async count(tableName: string, whereClause?: string, whereArgs?: Array<string>): Promise<number> {
try {
const result = await this.query(tableName, ['COUNT(*) as count'], whereClause, whereArgs);
return result.length > 0 ? result[0].count as number : 0;
} catch (error) {
hilog.error(LogConstan... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L464-L472 | 4ddd08a06963504072111f0b8f40a3cda0e04fdb | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/DemoRepository.ets | arkts | clearAll | 清空全部 Demo 记录
@returns {Promise<number>} 受影响行数 | async clearAll(): Promise<number> {
return this.demoLocalDataSource.clearAll();
} | AST#method_declaration#Left async clearAll 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async clearAll(): Promise<number> {
return this.demoLocalDataSource.clearAll();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/DemoRepository.ets#L53-L55 | 9ceaeedbc29232553499fdd76c9b17a7c22083b9 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkcompiler/esmodule/esmodule_dynamicimport/Staticlibraryhar/Index.ets | arkts | add | 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 { add, addHarDepHar, addHarDepHsp } from './src/main/ets/Calc' | AST#export_declaration#Left export { add , addHarDepHar , addHarDepHsp } from './src/main/ets/Calc' AST#export_declaration#Right | export { add, addHarDepHar, addHarDepHsp } from './src/main/ets/Calc' | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/Staticlibraryhar/Index.ets#L16-L16 | 62bcab8a2cfe8d6f81eee880241c72a6264bf429 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getLastSunday | 用于获取给定日期所在周的第一天(上周日)
@param date 给定日期
@returns 返回给定日期所在周的第一天 | static getLastSunday(date: Date): Date {
// 获取当前日期是本周的周几(0-6,其中0代表周日,1代表周一,以此类推)
const DAY_OF_WEEK = date.getDay();
// 创建一个新的Date对象,其值与传入的date相同,用于后续计算而不改变原始date对象
const LAST_SUNDAY = new Date(date);
// 这里假设周日是一周的第一天,因此直接减去dayOfWeek就能得到本周的周日
LAST_SUNDAY.setDate(LAST_SUNDAY.getDate() - DAY_OF_WEE... | AST#method_declaration#Left static getLastSunday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#... | static getLastSunday(date: Date): Date {
const DAY_OF_WEEK = date.getDay();
const LAST_SUNDAY = new Date(date);
LAST_SUNDAY.setDate(LAST_SUNDAY.getDate() - DAY_OF_WEEK);
return LAST_SUNDAY;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L209-L218 | 4b51004cfaedf856ce1776bd2fc59f60b6d723da | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/watermark/src/main/ets/view/MainView.ets | arkts | MainViewComponent | 功能说明:本案例通过Canvas组件以及OffscreenCanvas实现了页面添加水印以及保存图片时添加水印的功能。
推荐场景:图片以及视图页面添加水印
核心组件:
1. WaterMarkView:水印视图组件
2. WaterMarkModel:水印方法类
实现步骤:
本章节主要通过两种方法来实现水印的添加。
方法一
1. 组件添加水印。构建水印视图(WaterMarkView),使用overlay把水印视图作为组件的浮层形成水印的效果。
@example
@Builder
contentView() {
Stack() {
Column() {
···
}
.height(CommonConstants.COMPO... | @Component
export struct MainViewComponent {
@State imageDataSource: DataType[] = ImageData;
@State imageScale: number = 1; // 初始化放大比例
@State pixelMap: image.PixelMap | undefined = undefined; // pixelMap对象
@State source: Resource = $r('app.media.water_mark_image_1');
@State currentIndex: number = 0;
@State ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imageDataSource : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataType [ ... | @Component
export struct MainViewComponent {
@State imageDataSource: DataType[] = ImageData;
@State imageScale: number = 1;
@State pixelMap: image.PixelMap | undefined = undefined;
@State source: Resource = $r('app.media.water_mark_image_1');
@State currentIndex: number = 0;
@State isShow: boolean = false... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/view/MainView.ets#L70-L438 | 8dd980a7ca1b6fcfcd20f6a6df085a4de3279ec8 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets | arkts | beforeInit | -----------------初始化和销毁--------------------- | beforeInit(want: Want, ctx: common.UIAbilityContext): boolean {
Logger.info(TAG, `beforeInit`);
this.ctx = ctx;
let event = OptionModel.readWant(want);
if (event > 0) {
AppStorage.setOrCreate('UI_EVENT', event);
emitter.emit({
eventId: event
});
} else {
ctx.terminate... | AST#method_declaration#Left beforeInit AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . U... | beforeInit(want: Want, ctx: common.UIAbilityContext): boolean {
Logger.info(TAG, `beforeInit`);
this.ctx = ctx;
let event = OptionModel.readWant(want);
if (event > 0) {
AppStorage.setOrCreate('UI_EVENT', event);
emitter.emit({
eventId: event
});
} else {
ctx.terminate... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L53-L67 | 57ab0eff09ecba7f2f9f880e27170f81c1b8c989 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets | arkts | getGreetingByTime | 根据当前时间返回问候语
@returns 问候语 | static getGreetingByTime(): string {
const hour = new Date().getHours();
if (hour >= 0 && hour < 6) {
return '凌晨好';
} else if (hour >= 6 && hour < 9) {
return '早上好';
} else if (hour >= 9 && hour < 12) {
return '上午好';
} else if (hour >= 12 && hour < 14) {
return '中午好';
... | AST#method_declaration#Left static getGreetingByTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Lef... | static getGreetingByTime(): string {
const hour = new Date().getHours();
if (hour >= 0 && hour < 6) {
return '凌晨好';
} else if (hour >= 6 && hour < 9) {
return '早上好';
} else if (hour >= 9 && hour < 12) {
return '上午好';
} else if (hour >= 12 && hour < 14) {
return '中午好';
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L126-L144 | 48943496c6067a1d6848d2e6dd718f62db01a501 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | submitForm | 提交表单 | private async submitForm() {
try {
// 设置加载状态
this.isLoading = true;
this.errorMessage = '';
// 验证表单字段
if (!this.dream.title || this.dream.title.trim() === '') {
this.errorMessage = '梦想标题不能为空';
this.isLoading = false;
return;
}
// 设置截止日期
this.... | AST#method_declaration#Left private async submitForm AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 设置加载状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#... | private async submitForm() {
try {
this.isLoading = true;
this.errorMessage = '';
if (!this.dream.title || this.dream.title.trim() === '') {
this.errorMessage = '梦想标题不能为空';
this.isLoading = false;
return;
}
this.dream.deadline = this.selec... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L470-L578 | 5a096745c3ec03d1493c35f99080000b1413da88 | github |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/StorageUtil.ets | arkts | getFavoriteCities | 获取所有收藏的城市 | static async getFavoriteCities(): Promise<string[]> {
try {
const initSuccess = await StorageUtil.init();
if (!initSuccess || !StorageUtil.prefs) {
return ['北京', '上海', '广州'];
}
const favorites = await StorageUtil.prefs.get(StorageKeys.FAVORITE_CITIES, '北京,上海,广州');
// 确保返回的是字符... | AST#method_declaration#Left static async getFavoriteCities AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#... | static async getFavoriteCities(): Promise<string[]> {
try {
const initSuccess = await StorageUtil.init();
if (!initSuccess || !StorageUtil.prefs) {
return ['北京', '上海', '广州'];
}
const favorites = await StorageUtil.prefs.get(StorageKeys.FAVORITE_CITIES, '北京,上海,广州');
cons... | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/StorageUtil.ets#L85-L101 | 2cf4112784e2ea2d969e5ff4244017710a79123f | github |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets | arkts | getLocationBol | 地理位置持久化,再次进入,确定开关是否开启 | getLocationBol(bol: boolean): void {
let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig;
cameraConfig.locationBol = bol;
GlobalContext.get().setObject('cameraConfig', cameraConfig);
} | AST#method_declaration#Left getLocationBol AST#parameter_list#Left ( AST#parameter#Left bol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | getLocationBol(bol: boolean): void {
let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig;
cameraConfig.locationBol = bol;
GlobalContext.get().setObject('cameraConfig', cameraConfig);
} | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets#L45-L49 | d8b7e83a2ee519ebbf6a42990944e07749fa05c4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/src/main/ets/common/OfflineResourceManager.ets | arkts | submitToCache | 保存数据到内存和磁盘中
@param url 资源请求url
@param data url对应的响应数据 | submitToCache(url: string, data: ResponseDataType) {
let key = transferUrlToKey(url);
this.memoryCacheManager.submitToMemory(key, data);
this.diskCacheManager.submitToDisk(key, data);
} | AST#method_declaration#Left submitToCache AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ResponseDataType AST#primary_... | submitToCache(url: string, data: ResponseDataType) {
let key = transferUrlToKey(url);
this.memoryCacheManager.submitToMemory(key, data);
this.diskCacheManager.submitToDisk(key, data);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/OfflineResourceManager.ets#L75-L79 | 134a1d618e8453b85cdc7cd12d87f3eca641936b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets | arkts | rotateImage | 顺时针旋转图片 | private rotateImage() {
if (this.pixelMap != undefined) {
// [Start pixelmap_rotate_image]
// 顺时针旋转90°
this.pixelMap.rotate(90).then(() => {
this.updateImageInfo();
})
// [End pixelmap_rotate_image]
}
} | AST#method_declaration#Left private rotateImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressi... | private rotateImage() {
if (this.pixelMap != undefined) {
this.pixelMap.rotate(90).then(() => {
this.updateImageInfo();
})
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L274-L283 | 9b95980412e477233343deddad8c6fda72a8932e | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets | arkts | isEmpty | Determine whether the lruCache cache is empty | public isEmpty(): boolean {
return this.lruCache.isEmpty();
} | AST#method_declaration#Left public isEmpty AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression... | public isEmpty(): boolean {
return this.lruCache.isEmpty();
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets#L21-L23 | f4893640721faa35ef20a3dec2c7cb20fa158cd8 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets | arkts | TabItem | 每个选项的样式
@param { TabMenusInterfaceIRequired } item - 选项的数据
@param { number } index - 下标 | @Builder
TabItem(item: TabMenusInterfaceIRequired, index: number) {
Column() {
if (item.image && this.chamfer) {
Image(getImageUrl(item as TabMenusInterfaceIRequired, index, this.selectIndex))
.size({
width: this.chamfer.circleDiameter / 2,
height: this.chamfer.circ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabMenusInterfaceIRequired AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_an... | @Builder
TabItem(item: TabMenusInterfaceIRequired, index: number) {
Column() {
if (item.image && this.chamfer) {
Image(getImageUrl(item as TabMenusInterfaceIRequired, index, this.selectIndex))
.size({
width: this.chamfer.circleDiameter / 2,
height: this.chamfer.circ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/components/tabsRaisedCircle/TabsRaisedCircle.ets#L151-L187 | 6906a841c5e4ce7930aa42af30d779ec42882330 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets | arkts | RecentPhotoComponent | Declare struct RecentPhotoComponent
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | @Component
export declare struct RecentPhotoComponent {
/**
* recentPhotoOptions
*
* @type { ?recentPhotoOptions }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
recentPhotoOptions?: RecentPhotoOptions;
/**
* Callback ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct RecentPhotoComponent AST#component_body#Left { /**
* recentPhotoOptions
*
* @type { ?recentPhotoOptions }
* @syscap SystemCapability.FileManagement.PhotoAcces... | @Component
export declare struct RecentPhotoComponent {
recentPhotoOptions?: RecentPhotoOptions;
onRecentPhotoCheckResult?: RecentPhotoCheckResultCallback;
onRecentPhotoClick: RecentPhotoClickCallback;
onRecentPhotoCheckInfo?: RecentPhotoCheckInfoCallback;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.RecentPhotoComponent.d.ets#L28-L66 | de45c23b217f6d083e0cbd763fae9cb9b767b111 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelCreate.ets | arkts | handle | 应用约束18:在class中声明字段而非构造函数中 | handle(packet: any): void { // 应用约束10:使用具体类型替代any,此处假设packet类型为any,实际应根据具体类型定义
const client = this.packetManager.client;
const data = packet.d;
client.actions.ChannelCreate.handle(data);
} | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#typ... | handle(packet: any): void {
const client = this.packetManager.client;
const data = packet.d;
client.actions.ChannelCreate.handle(data);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelCreate.ets#L6-L10 | 6019cdcd011bc21cd775b4712cc630d7561fd46b | github |
ccccjiemo/egl.git | d18849c3da975ccf9373fd09874aa5637ccbe6bd | Index.d.ets | arkts | bindTexImage | eglBindTexImage | bindTexImage(dpy: EGLDisplay, buffer: EGLConfigAttribute | number): boolean; | AST#method_declaration#Left bindTexImage AST#parameter_list#Left ( AST#parameter#Left dpy : AST#type_annotation#Left AST#primary_type#Left EGLDisplay AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left EGLC... | bindTexImage(dpy: EGLDisplay, buffer: EGLConfigAttribute | number): boolean; | https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L67-L67 | a6fe7613ee3fb8fa6f394a998c9e333023def0cb | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/wordcard/WordCardsView.ets | arkts | actionPopmenu | /显示转到测验或挑战页面的弹出选项 | private actionPopmenu(){
let options: ItemOption[] = []
///我要测验
options.push(
{text: getString($r('app.string.learn_detail_to_test_btn_test')),action: ()=>{
//我要测验
QuizManager.shared.questionMode = QuestionMode.Normal
this.openTestStart()
}})
///我要挑战
options.pus... | AST#method_declaration#Left private actionPopmenu AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ItemOption [ ] AST#array_type#R... | private actionPopmenu(){
let options: ItemOption[] = []
options.push(
{text: getString($r('app.string.learn_detail_to_test_btn_test')),action: ()=>{
QuizManager.shared.questionMode = QuestionMode.Normal
this.openTestStart()
}})
options.push(
{text: getS... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardsView.ets#L347-L376 | 1136f93389f6925088c2615466cd45b3a494b229 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/types/ConcaveCircleType.ets | arkts | canvas 底下矩形 | export interface CanvasCreateRectangleType {
// CanvasRenderingContext2D 控制器
context: CanvasRenderingContext2D,
// 整个 tabs 所占据的高度
tabsBgColor: string,
/**
* 左上和右上 是否有倒角 默认没有
* - 暂时在 canvas 绘制时没有使用
* - 如果需要可以在 [CanvasCreateRectangle](../Utils/Functions/CanvasCreateRectangle) 方法中使用,给左上角和右上角倒角
*/
... | AST#export_declaration#Left export AST#interface_declaration#Left interface CanvasCreateRectangleType AST#object_type#Left { // CanvasRenderingContext2D 控制器 AST#type_member#Left context : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#type_me... | export interface CanvasCreateRectangleType {
context: CanvasRenderingContext2D,
tabsBgColor: string,
chamfer?: number
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/types/ConcaveCircleType.ets#L19-L32 | 9c23bf3ac18a1c85fd5adc5f29692f40784460a1 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | initCamera | [Start init_camera]
Initialize Camera Functions
@param surfaceId - Surface ID
@param cameraDeviceIndex - Camera Device Index
@returns No return value | async initCamera(surfaceId: string, cameraDeviceIndex: number): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
this.photoMode = AppStorage.get('photoMode');
if (!this.photoMode) {
return;
}
try {
await this.releaseCamera();
// Get Camera Ma... | AST#method_declaration#Left async initCamera AST#parameter_list#Left ( AST#parameter#Left surfaceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cameraDeviceIndex : AST#type_annotation#Left AST#primary_type#Left number ... | async initCamera(surfaceId: string, cameraDeviceIndex: number): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
this.photoMode = AppStorage.get('photoMode');
if (!this.photoMode) {
return;
}
try {
await this.releaseCamera();
this.came... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L130-L205 | 78c79e395c4a295206b5f51c3e35b095d8c5818d | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | init | @Override | protected init(): void {
super.init();
if (this.mAnimator) {
this.mRenderer = new PieChartRenderer(this, this.mAnimator, this.mViewPortHandler);
}
this.mXAxis = null;
this.mHighlighter = new PieHighlighter(this);
} | AST#method_declaration#Left protected init AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | protected init(): void {
super.init();
if (this.mAnimator) {
this.mRenderer = new PieChartRenderer(this, this.mAnimator, this.mViewPortHandler);
}
this.mXAxis = null;
this.mHighlighter = new PieHighlighter(this);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L122-L131 | baf62e93dce434ecae24898ab8b0e77d799ee7ab | gitee |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/common/model/TabItem.ets | arkts | Tab item info. | export class TabItem {
/**
* Tab item index.
*/
index: number = 0;
/**
* Tab item title.
*/
title: string = "";
/**
* Image activated.
*/
imageActivated: Resource = $r("app.media.background");
/**
* Image original.
*/
imageOriginal: Resource = $r("app.media.background");
} | AST#export_declaration#Left export AST#class_declaration#Left class TabItem AST#class_body#Left { /**
* Tab item index.
*/ AST#property_declaration#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST... | export class TabItem {
index: number = 0;
title: string = "";
imageActivated: Resource = $r("app.media.background");
imageOriginal: Resource = $r("app.media.background");
} | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/model/TabItem.ets#L4-L21 | 7e95e8280f08b182ee44961bb00fa98fd405bc55 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/AccountStoreRepository.ets | arkts | 构造函数
@param {common.Context} context UIAbility 上下文
@param {AccountStoreDataSource} [dataSource] 可选自定义数据源 | constructor(context: common.Context, dataSource?: AccountStoreDataSource) {
this.dataSource = dataSource ?? new AccountStoreDataSourceImpl(context);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataSource ? : AS... | constructor(context: common.Context, dataSource?: AccountStoreDataSource) {
this.dataSource = dataSource ?? new AccountStoreDataSourceImpl(context);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AccountStoreRepository.ets#L19-L21 | 8df16e4b577493e7689f714941acae57c02ef33f | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets | arkts | foo | Change to pass by parameters | function foo(array: Array<number>): number {
array[0] = 1;
return array[0] + array[1];
} | AST#function_declaration#Left function foo AST#parameter_list#Left ( AST#parameter#Left array : 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments... | function foo(array: Array<number>): number {
array[0] = 1;
return array[0] + array[1];
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets#L84-L87 | 0ac946834e9083dc38cb8ac5ef873442d889b5e7 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets | arkts | getValuesByTouchPoint | Returns a recyclable MPPointD instance.
returns the x and y values in the chart at the given touch point
(encapsulated in a MPPointD). This method transforms pixel coordinates to
coordinates / values in the chart. This is the opposite method to
getPixelForValues(...).
@param x
@param y
@return | public getValuesByTouchPoint(x: number, y: number, outputPoint?: MPPointD): MPPointD {
var result: MPPointD = outputPoint != null && outputPoint != undefined ? outputPoint : MPPointD.getInstance(0, 0);
this.ptsBuffer[0] = x;
this.ptsBuffer[1] = y;
this.pixelsToValue(this.ptsBuffer);
outputPoint.x... | AST#method_declaration#Left public getValuesByTouchPoint AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | public getValuesByTouchPoint(x: number, y: number, outputPoint?: MPPointD): MPPointD {
var result: MPPointD = outputPoint != null && outputPoint != undefined ? outputPoint : MPPointD.getInstance(0, 0);
this.ptsBuffer[0] = x;
this.ptsBuffer[1] = y;
this.pixelsToValue(this.ptsBuffer);
outputPoint.x... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L377-L389 | f7e2e865204e07751cf459ef0eb4e85db84c2972 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | getGreetingStats | 获取祝福语统计 | async getGreetingStats(): Promise<GreetingStats> {
const greetingSearchParams: GreetingSearchParams = { pageSize: 10000 };
const greetings = await this.greetingService.searchGreetings(greetingSearchParams);
const totalGenerated = greetings.length;
const totalUsed = greetings.reduce((sum, g) => sum + g.... | AST#method_declaration#Left async getGreetingStats 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 GreetingStats AST#primary_type#Right AST#type_annotation#Right >... | async getGreetingStats(): Promise<GreetingStats> {
const greetingSearchParams: GreetingSearchParams = { pageSize: 10000 };
const greetings = await this.greetingService.searchGreetings(greetingSearchParams);
const totalGenerated = greetings.length;
const totalUsed = greetings.reduce((sum, g) => sum + g.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L464-L531 | 60f5308647925795f46e7d3aa6c18943ade2931e | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets | arkts | GridSection | 网格布局示例
@returns {void} 无返回值 | @Builder
private GridSection(): void {
Grid() {
ForEach(this.gridItems, (item: number) => {
GridItem() {
this.GridItemCard(item + 1);
}
}, (item: number) => `${item}`);
}
.columnsTemplate(bp({ sm: "1fr 1fr", md: "1fr 1fr 1fr", lg: "1fr 1fr 1fr 1fr" }))
.columnsGap... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private GridSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_e... | @Builder
private GridSection(): void {
Grid() {
ForEach(this.gridItems, (item: number) => {
GridItem() {
this.GridItemCard(item + 1);
}
}, (item: number) => `${item}`);
}
.columnsTemplate(bp({ sm: "1fr 1fr", md: "1fr 1fr 1fr", lg: "1fr 1fr 1fr 1fr" }))
.columnsGap... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L106-L119 | c338050980b9e4f38f0f8b9399faf600ea80fab1 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/DefinitionsPopup.ets | arkts | 倍速对象 | export interface definitions {
text: string,
value: number
}; | AST#export_declaration#Left export AST#interface_declaration#Left interface definitions AST#object_type#Left { AST#type_member#Left text : 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 value : AST#type_annotation#Left ... | export interface definitions {
text: string,
value: number
}; | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/DefinitionsPopup.ets#L2-L5 | 869a7be7cb0adea6498a0ac65b8d0a83a4a39a09 | gitee | |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | common/component/src/main/ets/default/deviceNameEntryComponent.ets | arkts | DeviceNameEntryComponent | item custom component | @Component
export default struct DeviceNameEntryComponent {
@State isShow: Boolean = true;
@State settingIcon: string = "";
@State endTextIsShow: Boolean = true;
@State settingSummary: string = "";
@Link settingValue: string;
@State settingArrow: string = "";
@State settingArrowStyle: string = "";
@Stat... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct DeviceNameEntryComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left Boolean AST#primary_type#... | @Component
export default struct DeviceNameEntryComponent {
@State isShow: Boolean = true;
@State settingIcon: string = "";
@State endTextIsShow: Boolean = true;
@State settingSummary: string = "";
@Link settingValue: string;
@State settingArrow: string = "";
@State settingArrowStyle: string = "";
@Stat... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/deviceNameEntryComponent.ets#L22-L145 | 03412e864b3ec6a6df9c56417fecd0ada5fe3f16 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | limitCornerIfLineIntersect | If line intersect, limit.
@param outerLine
@param diagonal
@param rect | static limitCornerIfLineIntersect(outerLine: LineSegment, diagonal: LineSegment, rect: RectF): void {
let origin = new Point(rect.getCenterX(), rect.getCenterY());
if (MathUtils.hasIntersection(outerLine, diagonal)) {
let intersection = MathUtils.getIntersection(outerLine, diagonal);
if (intersectio... | AST#method_declaration#Left static limitCornerIfLineIntersect AST#parameter_list#Left ( AST#parameter#Left outerLine : AST#type_annotation#Left AST#primary_type#Left LineSegment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left diagonal : AST#type_annotation#Left AST#primary_type... | static limitCornerIfLineIntersect(outerLine: LineSegment, diagonal: LineSegment, rect: RectF): void {
let origin = new Point(rect.getCenterX(), rect.getCenterY());
if (MathUtils.hasIntersection(outerLine, diagonal)) {
let intersection = MathUtils.getIntersection(outerLine, diagonal);
if (intersectio... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L274-L292 | 8ce6fb591a297a9133f287428f82e0ad168ba707 | gitee |
softfatgay/harmony-netease.git | 5f3d226b72ba8579cacfbd229e4eb0054d63abef | entry/src/main/ets/base/Api.ets | arkts | / 商品详情推荐 | export const WAPITEM_RCMD = baseUrl + '/xhr/wapitem/rcmd.json'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left WAPITEM_RCMD = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/wapitem/rcmd.json' AST#expression#Right AST#binary_expression#Right AST#expressio... | export const WAPITEM_RCMD = baseUrl + '/xhr/wapitem/rcmd.json'; | https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L43-L43 | 66d9fbe7104638b198a3ae99f7dd337505a8a858 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/complete/FormKitDemo/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onNewWant | 如果UIAbility已在后台运行,在收到Router事件后会触发onNewWant生命周期回调 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(DOMAIN_NUMBER, TAG, `Ability onNewWant: ${JSON.stringify(want?.parameters)}`);
if (want?.parameters?.params) {
let params: Record<string, Object> = JSON.parse(want.parameters.params as string);
this.selectPage = param... | AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abi... | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(DOMAIN_NUMBER, TAG, `Ability onNewWant: ${JSON.stringify(want?.parameters)}`);
if (want?.parameters?.params) {
let params: Record<string, Object> = JSON.parse(want.parameters.params as string);
this.selectPage = param... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/FormKitDemo/entry/src/main/ets/entryability/EntryAbility.ets#L22-L34 | cf210110eae78df695511efd27b3d226351a4833 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List/entry/src/main/ets/common/CommonConstants.ets | arkts | navigation title | export const STORE: string = '商城'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left STORE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '商城' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Righ... | export const STORE: string = '商城'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L42-L42 | 140b472276e81c6ed9de6cefd10d533808a36b86 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/OnChartValueSelectedListener.ets | arkts | Listener for callbacks when selecting values inside the chart by
touch-gesture. | 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-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/OnChartValueSelectedListener.ets#L25-L25 | 3cf9234a0d1fa196add08a3a72f4d526a9f9687a | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/KeyboardKeyData.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export interface keySourceListType {
title: string,
content: string,
upperContent: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface keySourceListType AST#object_type#Left { AST#type_member#Left title : 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 content : AST#type_annotat... | export interface keySourceListType {
title: string,
content: string,
upperContent: string
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInputMethod/entry/src/main/ets/model/KeyboardKeyData.ets#L16-L20 | cc2fe6296a854e298d985cda7b4e05bc0635b1ec | gitee | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Native.ets | arkts | Converts a JavaScript string to a native string. | export function toNativeStr(javaString: string): NativeStr {
return new util.TextEncoder().encode(javaString);
} | AST#export_declaration#Left export AST#function_declaration#Left function toNativeStr AST#parameter_list#Left ( AST#parameter#Left javaString : 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... | export function toNativeStr(javaString: string): NativeStr {
return new util.TextEncoder().encode(javaString);
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Native.ets#L29-L31 | 22291fcad10e9c2845f02c320a326743e8461d0f | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets | arkts | getDreamName | 获取梦想名称 | getDreamName(dreamId: number): string {
if (dreamId <= 0) {
return '选择梦想';
}
const dream = this.dreams.find((d: Dream) => d.id === dreamId);
return dream ? dream.title : '选择梦想';
} | AST#method_declaration#Left getDreamName AST#parameter_list#Left ( AST#parameter#Left dreamId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | getDreamName(dreamId: number): string {
if (dreamId <= 0) {
return '选择梦想';
}
const dream = this.dreams.find((d: Dream) => d.id === dreamId);
return dream ? dream.title : '选择梦想';
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L435-L441 | 796b7f3ba11cfdccee1d1a823bfac2ee89d7486f | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/model/RdbModel.ets | arkts | insertData | Save data to the database.
@param user Data objects of the user type to be saved. | insertData(user: User) {
try {
(this.rdbStore as dataRdb.RdbStore).insert(this.tableName, JSON.parse(JSON.stringify(user)));
} catch (err) {
Logger.error(`insert data failed due to ${JSON.stringify(err)}`);
}
} | AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#bloc... | insertData(user: User) {
try {
(this.rdbStore as dataRdb.RdbStore).insert(this.tableName, JSON.parse(JSON.stringify(user)));
} catch (err) {
Logger.error(`insert data failed due to ${JSON.stringify(err)}`);
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/model/RdbModel.ets#L52-L58 | ea1d6948b957958fc5d5e8e12eefa15625673e26 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/Theme.ets | arkts | 配置主题颜色 | export class ThemeColor {
static readonly ORANGE: ThemeColorItem = {mainColor: '#ff6600', secondColor: '#ffece0'}
static readonly RED: ThemeColorItem = {mainColor: '#ef4444', secondColor: '#fde8e8'}
static readonly YELLOW: ThemeColorItem = {mainColor: '#ff9500', secondColor: '#fff2e0'}
static readonly BLUE: The... | AST#export_declaration#Left export AST#class_declaration#Left class ThemeColor AST#class_body#Left { AST#property_declaration#Left static readonly ORANGE : AST#type_annotation#Left AST#primary_type#Left ThemeColorItem AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#p... | export class ThemeColor {
static readonly ORANGE: ThemeColorItem = {mainColor: '#ff6600', secondColor: '#ffece0'}
static readonly RED: ThemeColorItem = {mainColor: '#ef4444', secondColor: '#fde8e8'}
static readonly YELLOW: ThemeColorItem = {mainColor: '#ff9500', secondColor: '#fff2e0'}
static readonly BLUE: The... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/Theme.ets#L4-L10 | b022d640357cfd22dfa28df04178243da3c288da | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/llm/LLMService.ets | arkts | 大模型提供商枚举 | export enum LLMProvider {
ZHIPU = 'zhipu', // 智谱AI
DEEPSEEK = 'deepseek', // DeepSeek
KIMI = 'kimi', // Kimi月之暗面
CUSTOM = 'custom' // 自定义
} | AST#export_declaration#Left export AST#enum_declaration#Left enum LLMProvider AST#enum_body#Left { AST#enum_member#Left ZHIPU = AST#expression#Left 'zhipu' AST#expression#Right AST#enum_member#Right , // 智谱AI AST#enum_member#Left DEEPSEEK = AST#expression#Left 'deepseek' AST#expression#Right AST#enum_member#Right , // ... | export enum LLMProvider {
ZHIPU = 'zhipu',
DEEPSEEK = 'deepseek',
KIMI = 'kimi',
CUSTOM = 'custom'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L11-L16 | a4f6c4878f90b9023493cff4a642b715e0cf2a92 | github | |
GAOMUgenius/SounderHarbor.git | ac0efa1a290980999e38aa868259d32c2f107bb2 | features/mine/src/main/ets/pages/MainPage.ets | arkts | updateFontSizeOnSwipe | 新增:滑动时更新字体大小 | private updateFontSizeOnSwipe(currentIndex: number, targetIndex: number, offset: number) {
const swipeRatio = Math.abs(offset / this.tabsWidth)
// 重置所有字体大小
for (let i = 0; i < this.tabFontSizes.length; i++) {
this.tabFontSizes[i] = 18
}
if (this.currentIndex === currentIndex) {
this.tab... | AST#method_declaration#Left private updateFontSizeOnSwipe AST#parameter_list#Left ( AST#parameter#Left currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetIndex : AST#type_annotation#Left AST#primary_type#Le... | private updateFontSizeOnSwipe(currentIndex: number, targetIndex: number, offset: number) {
const swipeRatio = Math.abs(offset / this.tabsWidth)
for (let i = 0; i < this.tabFontSizes.length; i++) {
this.tabFontSizes[i] = 18
}
if (this.currentIndex === currentIndex) {
this.tabFontSizes[c... | https://github.com/GAOMUgenius/SounderHarbor.git/blob/ac0efa1a290980999e38aa868259d32c2f107bb2/features/mine/src/main/ets/pages/MainPage.ets#L349-L368 | d811e5298b80ba33baef28bac17bbeb5410e3de0 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | TaskPoolPractice/entry/src/main/ets/pages/sample3/Sample3.ets | arkts | correctConcurrentFunc | [Start correct_fun_1] Sample3.ets | @Concurrent
function correctConcurrentFunc() {
let promise = Promise.resolve();
promise.then(() => {
emitter.emit("1", { data: { name: "anonymous" } });
})
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function correctConcurrentFunc AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left promise = AST#expression#Left AST#c... | @Concurrent
function correctConcurrentFunc() {
let promise = Promise.resolve();
promise.then(() => {
emitter.emit("1", { data: { name: "anonymous" } });
})
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample3/Sample3.ets#L24-L30 | c01e74000d263c39eb8d85db8e2077eaa7f8d08b | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/url_tools.ets | arkts | Extracts search engine and search keyword from an link
@param link
@returns ['search.engine/q=%s', 'keyword'] | export function extract_search(url: string) {
// link = decodeURI(link);
let result: string[] = ['', ''];
let keys: string[] = ['q', 'query', 's', 'key', 'wd', 'w', 'word', 'searchKeyWord', 'search_text', 'keyword', 'val', 'value', 'text', 'tag', 'tags', 'search'];
let search_keys: string[] = [];
for (let k ... | AST#export_declaration#Left export AST#function_declaration#Left function extract_search 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#block_statement#Left { // ... | export function extract_search(url: string) {
let result: string[] = ['', ''];
let keys: string[] = ['q', 'query', 's', 'key', 'wd', 'w', 'word', 'searchKeyWord', 'search_text', 'keyword', 'val', 'value', 'text', 'tag', 'tags', 'search'];
let search_keys: string[] = [];
for (let k = 0; k < keys.length; k++)... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L310-L356 | ef45ab1b50ae09bc112de97ab036a8224022efa5 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets | arkts | closeSnapPopup | 关闭截图弹窗,恢复状态。 | closeSnapPopup() {
this.isShowSnapPopup = false; // 关闭模态窗口
this.mergedImage = undefined; // 清除合并的图片
this.snapPopupWidth = Constants.SNAP_WINDOW_WIDTH; // 恢复窗口大小
this.snapPopupHeight = Constants.SNAP_WINDOW_HEIGHT;
this.snapPopupPosition =
PopupPosition.calculatePopupCenter(this.displayWidth, t... | AST#method_declaration#Left closeSnapPopup AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowSnapPopup AST#member_expressi... | closeSnapPopup() {
this.isShowSnapPopup = false;
this.mergedImage = undefined;
this.snapPopupWidth = Constants.SNAP_WINDOW_WIDTH;
this.snapPopupHeight = Constants.SNAP_WINDOW_HEIGHT;
this.snapPopupPosition =
PopupPosition.calculatePopupCenter(this.displayWidth, this.displayHeight, this.snap... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L290-L299 | b85e2c7e84437f4d4d8bc0e579a16bf3848e223a | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | decryptECB | 解密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|ECB|PKCS7、AES192|ECB|PKCS7、AES128|ECB|PKCS7)。
@returns | static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'AES256|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> {
return AES.decrypt(data, symKey, null, transformation);
} | AST#method_declaration#Left static async decryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym... | static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'AES256|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> {
return AES.decrypt(data, symKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L188-L191 | 078a157dfd2eb897ea53be53e8dd27fc7b47bf43 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/services/MockDataService.ets | arkts | getConversations | 获取会话列表 | static getConversations(): Conversation[] {
return [
{
id: '1',
name: '张三',
avatar: 'https://via.placeholder.com/50x50?text=ZS',
lastMessage: '你好,请问商品什么时候发货?',
lastMessageTime: Date.now() - 1000 * 60 * 5,
unreadCount: 2
},
{
id: '2',
... | AST#method_declaration#Left static getConversations AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Conversation [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_st... | static getConversations(): Conversation[] {
return [
{
id: '1',
name: '张三',
avatar: 'https://via.placeholder.com/50x50?text=ZS',
lastMessage: '你好,请问商品什么时候发货?',
lastMessageTime: Date.now() - 1000 * 60 * 5,
unreadCount: 2
},
{
id: '2',
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/MockDataService.ets#L235-L262 | 1d21241c9fcb688db10b881b972af4390beecd58 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/model/DialogOptions.ets | arkts | TODO 弹窗工具类(AlertDialog)基本参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export class DialogOptions {
uiContext?: UIContext; //UIContext上下文
title?: ResourceStr; //弹框标题
subtitle?: ResourceStr; //弹框副标题
message: ResourceStr = ''; //弹框内容
alignment?: DialogAlignment; //弹窗的对齐方式。
offset?: Offset; //弹窗相对alignment所在位置的偏移量。默认值:{ dx: 0 , dy: 0 }
gridCount?: number; //弹窗容器宽度所占用栅格数。默认值:... | AST#export_declaration#Left export AST#class_declaration#Left class DialogOptions AST#class_body#Left { AST#property_declaration#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right //UIContext上下文 AST#property_decla... | export class DialogOptions {
uiContext?: UIContext;
title?: ResourceStr;
subtitle?: ResourceStr;
message: ResourceStr = '';
alignment?: DialogAlignment;
offset?: Offset;
gridCount?: number;
maskRect?: Rectangle;
showInSubWindow?: boolean;
isModal?: boolean;
backgroundColor?: ResourceC... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/model/DialogOptions.ets#L25-L63 | 0542d67dfad3b6e0c7c1588f96236ed27fe874e1 | gitee | |
dou101101/ZenFocus-HarmonyOS.git | 9364599b8b20bc6377fc55ac68b991b61ceb8496 | MyApplication/entry/src/main/ets/pages/Index.ets | arkts | formatTime | 格式化时间 | formatTime(seconds: number): string {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
} | AST#method_declaration#Left formatTime AST#parameter_list#Left ( AST#parameter#Left seconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | formatTime(seconds: number): string {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
} | https://github.com/dou101101/ZenFocus-HarmonyOS.git/blob/9364599b8b20bc6377fc55ac68b991b61ceb8496/MyApplication/entry/src/main/ets/pages/Index.ets#L367-L371 | 37d763dc372bbf56fc9a176069a52e6f9bcd6b1a | github |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/IMClientManager.ets | arkts | resetInitFlag | 重置本类的初始化标识。 | resetInitFlag(): void {
this.init = false;
} | AST#method_declaration#Left resetInitFlag 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#memb... | resetInitFlag(): void {
this.init = false;
} | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/IMClientManager.ets#L278-L280 | b96f4811260672b4809073b795ea20fca54b44f0 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeFlashSaleSection.ets | arkts | 构建限时精选卡片
@returns {void} 无返回值 | build(): void {
if (this.goodsList && this.goodsList.length > 0) {
Card() {
CardTitleCell({
leftIcon: $r("app.media.ic_time"),
title: $r("app.string.flash_sale"),
value: $r("app.string.view_all"),
onTap: (): void => this.onMoreClick()
});
List({... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression... | build(): void {
if (this.goodsList && this.goodsList.length > 0) {
Card() {
CardTitleCell({
leftIcon: $r("app.media.ic_time"),
title: $r("app.string.flash_sale"),
value: $r("app.string.view_all"),
onTap: (): void => this.onMoreClick()
});
List({... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeFlashSaleSection.ets#L34-L60 | 15315ac26b90430028a2010c7b2e200536eaf562 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets | arkts | isNotNullEmpty | 判断数组不为空和未定义
param 数组对象Array<Object>
@returns boolean | static isNotNullEmpty(list: Array<Object> | undefined): boolean {
return null !== list && undefined !== list && list.length >= 1;
} | AST#method_declaration#Left static isNotNullEmpty AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#... | static isNotNullEmpty(list: Array<Object> | undefined): boolean {
return null !== list && undefined !== list && list.length >= 1;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets#L38-L40 | 6b7548d4b746bbee69a9b2b0b01cb1bf4f7b9683 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/JSONUtil.ets | arkts | jsonToMap | JSON转Map
@param jsonStr
@returns | static jsonToMap(jsonStr: string): Map<string, Object> {
try {
let commRecord = JSON.parse(jsonStr) as Record<string, Object>;
return new Map(Object.entries(commRecord));
} catch (err) {
LogUtil.error(err);
return new Map();
}
} | AST#method_declaration#Left static jsonToMap AST#parameter_list#Left ( AST#parameter#Left jsonStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left... | static jsonToMap(jsonStr: string): Map<string, Object> {
try {
let commRecord = JSON.parse(jsonStr) as Record<string, Object>;
return new Map(Object.entries(commRecord));
} catch (err) {
LogUtil.error(err);
return new Map();
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/JSONUtil.ets#L100-L108 | 392ebab05a67465bc078d6d36df8233325ff86fc | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets | arkts | computeTaskAsync | Asynchronous processing of operation tasks | private computeTaskAsync(): void {
setTimeout(() => { // SetTimeout is used here to realize asynchronous delayed operation.
this.computeTask();
}, DELAYED_TIME);
} | AST#method_declaration#Left private computeTaskAsync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left setTimeout ( AST#expression#Left AST#ar... | private computeTaskAsync(): void {
setTimeout(() => {
this.computeTask();
}, DELAYED_TIME);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets#L52-L56 | d6864e5ac8fe835e5d2cf3a58f05fed367185287 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videoscreendirectionswitching/Index.ets | arkts | VideoScreenDirectionSwitchingComponent | 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 { VideoScreenDirectionSwitchingComponent } from './src/main/ets/view/VideoScreenDirectionSwitching'; | AST#export_declaration#Left export { VideoScreenDirectionSwitchingComponent } from './src/main/ets/view/VideoScreenDirectionSwitching' ; AST#export_declaration#Right | export { VideoScreenDirectionSwitchingComponent } from './src/main/ets/view/VideoScreenDirectionSwitching'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/Index.ets#L16-L16 | e44cabb116e5b187d7c185f2d5264a3e23f3d6e8 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets | arkts | 创建内存缓存管理
@param memoryCacheCapacity 内存缓存大小 | constructor(memoryCacheCapacity: number = 64) {
this.cache = new util.LRUCache(memoryCacheCapacity);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left memoryCacheCapacity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 64 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_st... | constructor(memoryCacheCapacity: number = 64) {
this.cache = new util.LRUCache(memoryCacheCapacity);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets#L31-L33 | f57a3f66fd41f22525c6fb4e13cc0ccd4048d557 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | addMonths | 添加月份
@param date 基准日期
@param months 要添加的月份数(可为负数)
@returns 新的日期 | static addMonths(date: Date, months: number): Date {
const result = new Date(date);
result.setMonth(result.getMonth() + months);
return result;
} | AST#method_declaration#Left static addMonths AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left months : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | static addMonths(date: Date, months: number): Date {
const result = new Date(date);
result.setMonth(result.getMonth() + months);
return result;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L193-L197 | 02861a34e45c2070f9bbddc4f61798e3542fb6d7 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/common/UIUtils.ets | arkts | 按钮配置 | export class ButtonOptions {
text: string = '';
color?: string;
constructor(text: string, color?: string) {
this.text = text;
this.color = color; // 不指定时使用系统默认色,自动适配深色模式
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ButtonOptions AST#class_body#Left { AST#property_declaration#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Rig... | export class ButtonOptions {
text: string = '';
color?: string;
constructor(text: string, color?: string) {
this.text = text;
this.color = color;
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/common/UIUtils.ets#L11-L19 | 25b5de288d3c05fc5e349b8f117c6bebe7066471 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listexchange/src/main/ets/common/commonConstants.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 commonConstants {
// 初始化列表项高度
static readonly LIST_ITEM_HEIGHT = 50;
// 初始化动画时间
static readonly ANIMATE_DURATION = 300;
// 初始化列表项名称
static readonly LIST_NAME = '标题1';
} | AST#export_declaration#Left export AST#class_declaration#Left class commonConstants AST#class_body#Left { // 初始化列表项高度 AST#property_declaration#Left static readonly LIST_ITEM_HEIGHT = AST#expression#Left 50 AST#expression#Right ; AST#property_declaration#Right // 初始化动画时间 AST#property_declaration#Left static readonly ANI... | export class commonConstants {
static readonly LIST_ITEM_HEIGHT = 50;
static readonly ANIMATE_DURATION = 300;
static readonly LIST_NAME = '标题1';
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/common/commonConstants.ets#L16-L23 | c45209999c0f6142230875ef376f4d01920ee583 | gitee | |
lentozi/DailyPlan.git | 96ce0bec8f545511c51b577c4aa8327c2c5bb0c8 | entry/src/main/ets/databaseability/tables/TodoTable.ets | arkts | queryByDate | 通过日期查找数据 | queryByDate(year: number, month: number, day: number, callback: Function) {
let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName);
// 将日期转换为特定格式
const date: string = year.toString() + ',' + month.toString() + ',' + day.toString();
predicates.equalTo('date', date);
// 查询语句
th... | AST#method_declaration#Left queryByDate AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right... | queryByDate(year: number, month: number, day: number, callback: Function) {
let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName);
const date: string = year.toString() + ',' + month.toString() + ',' + day.toString();
predicates.equalTo('date', date);
this.todoTable.query(p... | https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/tables/TodoTable.ets#L54-L101 | 9c7b61ec5b75829297ee345ffedf6b8f0c2fe62a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/AVPlayer/AVPlayerArkTSAudio/entry/src/main/ets/pages/Index.ets | arkts | setAVPlayerCallback | 注册avplayer回调函数 | async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void, vType?: number): Promise<void> {
// seek操作结果回调函数
if (this.avPlayer == null) {
console.error(`${this.tag}: avPlayer has not init!`);
return;
}
this.avPlayer.on('seekDone', (seekDoneTime) => {
console.info(`${this.ta... | AST#method_declaration#Left async setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type... | async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void, vType?: number): Promise<void> {
if (this.avPlayer == null) {
console.error(`${this.tag}: avPlayer has not init!`);
return;
}
this.avPlayer.on('seekDone', (seekDoneTime) => {
console.info(`${this.tag}: setAVPlayer... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVPlayer/AVPlayerArkTSAudio/entry/src/main/ets/pages/Index.ets#L175-L215 | e6946893221c7ae4ee05bf611787e3e92d308d91 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x2.ets | arkts | getInitials | 获取姓名首字母 | private getInitials(): string {
const name = this.widgetData.contactName || '';
if (name.length === 0) return '';
// 如果是中文名,取最后一个字
if (/[\u4e00-\u9fa5]/.test(name)) {
return name.charAt(name.length - 1);
}
// 如果是英文名,取首字母
return name.charAt(0).toUpperCase();
} | AST#method_declaration#Left private getInitials AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left nam... | private getInitials(): string {
const name = this.widgetData.contactName || '';
if (name.length === 0) return '';
if (/[\u4e00-\u9fa5]/.test(name)) {
return name.charAt(name.length - 1);
}
return name.charAt(0).toUpperCase();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x2.ets#L170-L181 | d04d6d7b4e9d1e586fe67e3bb77bf5b35e4ed9ab | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getRawFileList | 获取resources/rawfile目录下文件夹及文件列表(若文件夹中无文件,则不返回;若文件夹中有文件,则返回文件夹及文件列表)
@param path rawfile文件夹路径。
@returns | static async getRawFileList(path: string): Promise<Array<string>> {
return ResUtil.getResourceManager().getRawFileList(path);
} | AST#method_declaration#Left static async getRawFileList AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | static async getRawFileList(path: string): Promise<Array<string>> {
return ResUtil.getResourceManager().getRawFileList(path);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L476-L478 | d3807e30474b6564fd7cb61d00aea9b9a260fbdd | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | getMinWidth | 获取兼容性的半径
@returns { number } | getMinWidth(): number {
return utilGetMinWidth(this.width, this.height, this.menuLength);
} | AST#method_declaration#Left getMinWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Lef... | getMinWidth(): number {
return utilGetMinWidth(this.width, this.height, this.menuLength);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L58-L60 | b4bda87ac6b179481b6ce8526537ff4f6615dace | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets | arkts | decodeSample_2 | 开发示例方式二,通过RawFileDescriptor解码rawfile下的图片资源
@returns 位图操作对象。 | public decodeSample_2(): Promise<image.PixelMap> {
return new Promise((resolve, reject) => {
resourceMgr.getRawFd('test.jpg').then((rawFileDescriptor: resourceManager.RawFileDescriptor) => {
Logger.info('decodeSample_2: ', 'Succeeded in getting RawFd');
const imageSource: image.ImageSource = i... | AST#method_declaration#Left public decodeSample_2 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 image . PixelMap AST#qualified_type#Right... | public decodeSample_2(): Promise<image.PixelMap> {
return new Promise((resolve, reject) => {
resourceMgr.getRawFd('test.jpg').then((rawFileDescriptor: resourceManager.RawFileDescriptor) => {
Logger.info('decodeSample_2: ', 'Succeeded in getting RawFd');
const imageSource: image.ImageSource = i... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L284-L302 | 277d0329ea5d224cb68b3dc5a5df6f2f8a5e7141 | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getNavigationIndicatorHeightPx | 获取导航栏高度
@returns | public getNavigationIndicatorHeightPx(): number {
return WindowUtils.navigationIndicatorHeight_px
} | AST#method_declaration#Left public getNavigationIndicatorHeightPx AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Le... | public getNavigationIndicatorHeightPx(): number {
return WindowUtils.navigationIndicatorHeight_px
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L211-L213 | c5a0b725fb7bf4107055288fd3509c647ee57cc0 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | getBalance | 获取本日结余 | public getBalance(): string {
let dayInfo = this.selectedDayInfo?.dayInfo;
if (dayInfo) { // 如果选中的天存在,即没有选中未来的天数
let res: number = dayInfo.income - dayInfo.expense;
return res.toString();
}
return '0';
} | AST#method_declaration#Left public getBalance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dayInfo... | public getBalance(): string {
let dayInfo = this.selectedDayInfo?.dayInfo;
if (dayInfo) {
let res: number = dayInfo.income - dayInfo.expense;
return res.toString();
}
return '0';
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L325-L334 | 216d7cb42097679d89827df431826dfe42a9b75f | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/model/ColorType.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class ColorType {
value: Resource = $r('app.string.empty');
color: Resource = $r('app.string.empty');
}; | AST#export_declaration#Left export default AST#class_declaration#Left class ColorType AST#class_body#Left { AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expressio... | export default class ColorType {
value: Resource = $r('app.string.empty');
color: Resource = $r('app.string.empty');
}; | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/model/ColorType.ets#L16-L19 | 1f0cb38994015c000f4e4c4e19f3cc562e99e636 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceThree.ets | arkts | onImageArrival | [Start onImageArrival_start] | onImageArrival(receiver: image.ImageReceiver): void {
receiver.on('imageArrival', () => {
receiver.readNextImage((err: BusinessError, nextImage: image.Image) => {
if (err || nextImage === undefined) {
Logger.error(TAG, `requestPermissionsFromUser call Failed! error: ${err.code}`);
... | AST#method_declaration#Left onImageArrival AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageReceiver AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#t... | onImageArrival(receiver: image.ImageReceiver): void {
receiver.on('imageArrival', () => {
receiver.readNextImage((err: BusinessError, nextImage: image.Image) => {
if (err || nextImage === undefined) {
Logger.error(TAG, `requestPermissionsFromUser call Failed! error: ${err.code}`);
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceThree.ets#L47-L74 | b59edf9127b3fa00663ed3ccf90c329091e1d94f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBackground | 处理应用进入后台 | private handleBackground(): void {
// TODO: 保存应用状态
// TODO: 清理临时数据
// TODO: 设置后台任务
} | AST#method_declaration#Left private handleBackground 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 { // TODO: 保存应用状态 // TODO: 清理临时数据 // TODO: 设置后台任务 } AST#builder_function_body#Ri... | private handleBackground(): void {
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L221-L225 | 07a1e3e7db807efcfcf3b786c15d03f9926ebdde | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/word/WordDetail.ets | arkts | getMarkTexts | 获取需要高亮 / 标记的文本集合 | getMarkTexts(): string[] {
const markTexts: string[] = [];
// 来自词形变化
markTexts.push(...this.getWordChangeEnWords());
// 将短语拆分(空格 & "-")
if (this.titleEn) {
const wordTexts = this.titleEn.replace(/-/g, " ").split(" ");
for (const str of wordTexts) {
markTexts.push(str);
}
... | AST#method_declaration#Left getMarkTexts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left ... | getMarkTexts(): string[] {
const markTexts: string[] = [];
markTexts.push(...this.getWordChangeEnWords());
if (this.titleEn) {
const wordTexts = this.titleEn.replace(/-/g, " ").split(" ");
for (const str of wordTexts) {
markTexts.push(str);
}
markTexts.pus... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/word/WordDetail.ets#L75-L93 | f7468c145113f07d665714d92369893c582fefe8 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ScatterChartModel.ets | arkts | ScatterData() { throw new Error('Method not implemented.'); } | constructor() {
super();
this.init();
} | AST#constructor_declaration#Left constructor 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 super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST... | constructor() {
super();
this.init();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ScatterChartModel.ets#L33-L36 | 0d0647fa2752110e9a07a5904d60e78011ee72a9 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 无障碍设置接口 | export interface AccessibilitySettings {
highContrast: boolean;
largeText: boolean;
screenReader: boolean;
reducedMotion: boolean;
colorBlindSupport: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AccessibilitySettings AST#object_type#Left { AST#type_member#Left highContrast : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left largeText : AS... | export interface AccessibilitySettings {
highContrast: boolean;
largeText: boolean;
screenReader: boolean;
reducedMotion: boolean;
colorBlindSupport: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L236-L242 | 2169f40f3c627b854ad95b7b96c78ff1cb4ce6dd | github | |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/Add/KeyBoardComponent.ets | arkts | gridItemBuilder | 数字及符号 | @Builder
gridItemBuilder(item: string) {
Text(item)
.allSize()
.textAlign(TextAlign.Center)
.backgroundColor(item === '完成' ? Color.Pink : Color.White)
.fontColor(item === '完成' ? Color.White : Color.Black)
.border({
radius: Const.DEFAULT_20,
color: Color.Black,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right gridItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : 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... | @Builder
gridItemBuilder(item: string) {
Text(item)
.allSize()
.textAlign(TextAlign.Center)
.backgroundColor(item === '完成' ? Color.Pink : Color.White)
.fontColor(item === '完成' ? Color.White : Color.Black)
.border({
radius: Const.DEFAULT_20,
color: Color.Black,
... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Add/KeyBoardComponent.ets#L145-L165 | 2d7a7dcbb84b41d79893a2d978aa06952cb08809 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/PermissionUtil.ets | arkts | requestPermissionsEasy | 申请授权,拒绝后并二次向用户申请授权(申请权限,建议使用该方法)。
@param permissions
@returns | static async requestPermissionsEasy(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = getContext() as common.UIAbilityContext;
const ps: Array<Permissions> = Array.isArray(permission... | AST#method_declaration#Left static async requestPermissionsEasy AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Permissions AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotati... | static async requestPermissionsEasy(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = getContext() as common.UIAbilityContext;
const ps: Array<Permissions> = Array.isArray(permission... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/PermissionUtil.ets#L81-L93 | 82ff011d9496948e525f7c5e7df77b10e25db189 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/ComponentBase.ets | arkts | isEnabled | Returns true if this component is enabled (should be drawn), false if not.
@return | public isEnabled(): boolean {
return this.mEnabled;
} | AST#method_declaration#Left public isEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | public isEnabled(): boolean {
return this.mEnabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L179-L181 | b7ec6368f52400b667ac6292746462c8229b64e3 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets | arkts | concatTime | Hour, minute, second format modifier
@param hours
@param minutes
@param seconds | concatTime(hours: number, minutes: number, seconds: number): string {
return `${this.fill(hours)}${this.fill(minutes)}${this.fill(seconds)}`;
} | AST#method_declaration#Left concatTime AST#parameter_list#Left ( AST#parameter#Left hours : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minutes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Rig... | concatTime(hours: number, minutes: number, seconds: number): string {
return `${this.fill(hours)}${this.fill(minutes)}${this.fill(seconds)}`;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets#L72-L74 | 9da84d77fd577c6becd225b88ae81603dc157213 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/CandleStickChartModel.ets | arkts | init | @Override | protected init(): void {
super.init();
this.mRenderer = new CandleStickChartRenderer(this, this.mAnimator!, this.mViewPortHandler);
let xAxis: XAxis | null = this.getXAxis();
if (xAxis) {
xAxis.setSpaceMin(0.5);
xAxis.setSpaceMax(0.5);
}
} | AST#method_declaration#Left protected init AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left ... | protected init(): void {
super.init();
this.mRenderer = new CandleStickChartRenderer(this, this.mAnimator!, this.mViewPortHandler);
let xAxis: XAxis | null = this.getXAxis();
if (xAxis) {
xAxis.setSpaceMin(0.5);
xAxis.setSpaceMax(0.5);
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CandleStickChartModel.ets#L54-L65 | 12a876bcd3b55c012a0969fce37090a85c2356b8 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/SettingsPage.ets | arkts | getSettingsGroups | 获取设置分组 | private getSettingsGroups(): SettingsGroup[] {
if (!this.settings) return [];
return [
// 外观设置
{
title: '外观',
items: [
{
title: '深色模式',
description: this.getThemeModeDescription(this.settings.theme.mode),
icon: $r('app.media.ic_theme'),
... | AST#method_declaration#Left private getSettingsGroups AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SettingsGroup [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_sta... | private getSettingsGroups(): SettingsGroup[] {
if (!this.settings) return [];
return [
{
title: '外观',
items: [
{
title: '深色模式',
description: this.getThemeModeDescription(this.settings.theme.mode),
icon: $r('app.media.ic_theme'),
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SettingsPage.ets#L101-L292 | 5e9962eee3956a1910d0365be623e34a629e5c6b | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbility/entry/src/main/ets/common/utils/Logger.ets | arkts | info | Outputs info-level logs.
@param args Indicates the log parameters. | info(...args: string[]) {
hilog.info(this.domain, this.prefix, this.format, args);
} | AST#method_declaration#Left info AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST... | info(...args: string[]) {
hilog.info(this.domain, this.prefix, this.format, args);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/common/utils/Logger.ets#L47-L49 | 21237810b1479fb0cb6760c54375de2c6d47af55 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/GreetingsPage.ets | arkts | buildFloatingActionButton | 构建浮动操作按钮 | @Builder
buildFloatingActionButton() {
Stack() {
// AI生成按钮
Button() {
Image($r('app.media.ic_ai'))
.width(24)
.height(24)
.fillColor('#ffffff')
}
.type(ButtonType.Circle)
.width(56)
.height(56)
.backgroundColor('#ff6b6b')
.posit... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFloatingActionButton 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 Stack ( ) AST#container_content_body#Left { // A... | @Builder
buildFloatingActionButton() {
Stack() {
Button() {
Image($r('app.media.ic_ai'))
.width(24)
.height(24)
.fillColor('#ffffff')
}
.type(ButtonType.Circle)
.width(56)
.height(56)
.backgroundColor('#ff6b6b')
.position({ x: ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L580-L619 | d27679329861ad13614758e11c3f49b0fb63009c | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets | arkts | CommonItemSelect | Select in item style, provide multiple choices based on menuList | @Component
export struct CommonItemSelect {
private selects: ResourceStr[] = [];
private callback: (index: number, value?: string) => void = () => {
};
private selectOption: SelectOption[] = [];
private name: ResourceStr = '';
private testId: string = 'test_itemSelect';
private selectIndex: number = 0;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemSelect AST#component_body#Left { AST#property_declaration#Left private selects : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ResourceStr [ ] AST#array_type#Right AST#primary_type#Right... | @Component
export struct CommonItemSelect {
private selects: ResourceStr[] = [];
private callback: (index: number, value?: string) => void = () => {
};
private selectOption: SelectOption[] = [];
private name: ResourceStr = '';
private testId: string = 'test_itemSelect';
private selectIndex: number = 0;
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L115-L132 | 43918c5739a62fecbc8e3c83aeecf6d19b1012ca | gitee |
qwerguai/ArkTSComponents.git | 58ac77d9686670d79ba7421d71e68f31870aacd5 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | Binds data to components and provides interfaces. | export class MainViewModel {
/**
* Get swiper image data.
*
* @return {Array<Resource>} swiperImages.
*/
getSwiperImages(): Array<Resource> {
let swiperImages: Resource[] = [
$r('app.media.aaaaaaaa'),
$r('app.media.bbbbbb'),
$r('app.media.cccccc'),
$r('app.media.ddddddd')
... | AST#export_declaration#Left export AST#class_declaration#Left class MainViewModel AST#class_body#Left { /**
* Get swiper image data.
*
* @return {Array<Resource>} swiperImages.
*/ AST#method_declaration#Left getSwiperImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#... | export class MainViewModel {
getSwiperImages(): Array<Resource> {
let swiperImages: Resource[] = [
$r('app.media.aaaaaaaa'),
$r('app.media.bbbbbb'),
$r('app.media.cccccc'),
$r('app.media.ddddddd')
];
return swiperImages;
}
getFirstGridData(): Array<ItemData> {
let f... | https://github.com/qwerguai/ArkTSComponents.git/blob/58ac77d9686670d79ba7421d71e68f31870aacd5/entry/src/main/ets/viewmodel/MainViewModel.ets#L21-L88 | fa83ff01592343cbb9d3299d079e0d0bf545ec5f | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | get_all_titles | Gets a list of all tabs' titles of current viewing pages.
@returns A string[] array, the titles. | get_all_titles() {
let titles: string[] = [];
for (let index = 0; index < this.Tabs.length; index++) {
titles.push(this.Tabs[index].title);
}
return titles;
} | AST#method_declaration#Left get_all_titles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left titles : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#pri... | get_all_titles() {
let titles: string[] = [];
for (let index = 0; index < this.Tabs.length; index++) {
titles.push(this.Tabs[index].title);
}
return titles;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L506-L513 | 8ca3d329e30c6e3e02c81f997e5ceaa98da29ab0 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/empty/EmptyCart.ets | arkts | 构建购物车缺省页视图
@returns {void} 无返回值 | build(): void {
Empty({
description: $r("app.string.empty_cart"),
imageRes: $r("app.media.ic_empty_cart")
});
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Empty ( AST#component_parameters#Left { AST#component_parameter#Left description : AST#expression#Left AST#resource_expressi... | build(): void {
Empty({
description: $r("app.string.empty_cart"),
imageRes: $r("app.media.ic_empty_cart")
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/empty/EmptyCart.ets#L13-L18 | 194ab64a111e250668e9f32d09d377b5fdc67b7c | github | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/TextToSpeechService.ets | arkts | pause | 暂停播放 | pause(): void {
// HarmonyOS TTS可能不支持暂停,这里使用停止代替
this.stop();
} | AST#method_declaration#Left pause 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 { // HarmonyOS TTS可能不支持暂停,这里使用停止代替 AST#expression_statement#Left AST#expression#Left AST#call_expre... | pause(): void {
this.stop();
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L364-L367 | bf80e23dcb6908c41b1b6152b08b722f8e5cd585 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/InteractAwardBuilder.ets | arkts | 自定义参数类型 | export class InteractAwardParamsFromAwardList {
settingDataSource: VHInteractAwardSetting;
webinar: VHWebinarData;
interact_award_id:number = 0;
constructor(settings: VHInteractAwardSetting, webinar: VHWebinarData,interact_award_id:number) {
this.settingDataSource = settings;
this.webinar = webinar;
... | AST#export_declaration#Left export AST#class_declaration#Left class InteractAwardParamsFromAwardList AST#class_body#Left { AST#property_declaration#Left settingDataSource : AST#type_annotation#Left AST#primary_type#Left VHInteractAwardSetting AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#R... | export class InteractAwardParamsFromAwardList {
settingDataSource: VHInteractAwardSetting;
webinar: VHWebinarData;
interact_award_id:number = 0;
constructor(settings: VHInteractAwardSetting, webinar: VHWebinarData,interact_award_id:number) {
this.settingDataSource = settings;
this.webinar = webinar;
... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/InteractAwardBuilder.ets#L41-L51 | f2b6ebf2b51043beafdab7aa77263444bfde8809 | gitee | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | addChatMessage | ==================== PRIVATE HELPER METHODS ====================
Add a chat message
@param content - Message content
@param isUser - Whether message is from user | private addChatMessage(content: string, isUser: boolean): void {
const message: ChatMessage = {
id: Date.now().toString() + Math.random().toString(36).substr(2, 9),
content: content,
isUser: isUser,
timestamp: Date.now()
};
this.chatMessages.push(message);
} | AST#method_declaration#Left private addChatMessage AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isUser : AST#type_annotation#Left AST#primary_type#Left boolean AST#pr... | private addChatMessage(content: string, isUser: boolean): void {
const message: ChatMessage = {
id: Date.now().toString() + Math.random().toString(36).substr(2, 9),
content: content,
isUser: isUser,
timestamp: Date.now()
};
this.chatMessages.push(message);
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L533-L541 | da540dd0cc93c76fa710be4c11605efcc6aa8de8 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | updateSelectedAddress | 更新已选择的地址
@param {Address} address - 选择的地址
@returns {void} 无返回值 | private updateSelectedAddress(address: Address): void {
const currentData: ConfirmOrder = this.data ? new ConfirmOrder(this.data) : new ConfirmOrder();
currentData.defaultAddress = address;
this.data = currentData;
} | AST#method_declaration#Left private updateSelectedAddress AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left Address AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS... | private updateSelectedAddress(address: Address): void {
const currentData: ConfirmOrder = this.data ? new ConfirmOrder(this.data) : new ConfirmOrder();
currentData.defaultAddress = address;
this.data = currentData;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L329-L333 | b76b01645d65bb90b2fad105e48ce931eeddcb59 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/todo/TodoEditPage.ets | arkts | buildEditActions | 构建编辑模式操作按钮 | @Builder
buildEditActions() {
Column({ space: 12 }) {
// 删除按钮
Button('删除代办事项')
.type(ButtonType.Normal)
.fontSize(14)
.fontColor('#f44336')
.backgroundColor('transparent')
.width('100%')
.height('44vp')
.onClick(() => {
this.deleteTodo(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEditActions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_pa... | @Builder
buildEditActions() {
Column({ space: 12 }) {
Button('删除代办事项')
.type(ButtonType.Normal)
.fontSize(14)
.fontColor('#f44336')
.backgroundColor('transparent')
.width('100%')
.height('44vp')
.onClick(() => {
this.deleteTodo();
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/todo/TodoEditPage.ets#L518-L534 | 5cd4cf7756d02b80be2c45eb1fc4af152db14d36 | github |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | common/component/src/main/ets/default/textInputComponent.ets | arkts | textInputComponent | TextInput component | @Component
export default struct textInputComponent {
private hintText: string= '';
private contextText: string= '';
build() {
TextInput({ placeholder: this.hintText, text: this.contextText })
.placeholderColor(Color.Blue)
.placeholderFont({ size: ConfigData.font_20, weight: 2, family: "sans-seri... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct textInputComponent AST#component_body#Left { AST#property_declaration#Left private hintText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expres... | @Component
export default struct textInputComponent {
private hintText: string= '';
private contextText: string= '';
build() {
TextInput({ placeholder: this.hintText, text: this.contextText })
.placeholderColor(Color.Blue)
.placeholderFont({ size: ConfigData.font_20, weight: 2, family: "sans-seri... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/textInputComponent.ets#L21-L45 | ecc50bef2c91e04417f04e87ba02494ed8fc8062 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | toast duration | export const COMMON_NUM_DURATION: number = 5000; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMON_NUM_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5000 AST#expression#Right AST#variable_declarator#Right ; AST#variable_de... | export const COMMON_NUM_DURATION: number = 5000; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L84-L84 | e3788474de209d8b4abcd2aa27f2eebaf6d2a917 | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/FileUtil.ets | arkts | getFilesDirPath | 获取文件目录下的文件夹路径或文件路径。
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns | static getFilesDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().filesDir : getContext().getApplicationContext().filesDir; //根目录
if (StrUtil.isNotEmpty(dirPath)) {
if (StrUtil.startsWith(dirPath, filePath)) { //路径中包含根目录,是完整路径。
... | AST#method_declaration#Left static getFilesDirPath 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 getFilesDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().filesDir : getContext().getApplicationContext().filesDir;
if (StrUtil.isNotEmpty(dirPath)) {
if (StrUtil.startsWith(dirPath, filePath)) {
filePath = dirPath;
... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FileUtil.ets#L37-L53 | 15d98e8d38ca2b489756e8a54261023d826fb4a4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/barchart/src/main/ets/view/CustomMarkerView.ets | arkts | draw | 在指定位置绘制MarkerView弹窗 | draw(c: CanvasRenderingContext2D, posX: number, posY: number, e: EntryOhos, highlight: Highlight) {
let offset: MPPointF = this.getOffsetForDrawingAtPoint(posX, posY);
c.save();
// 设置MarkerView弹窗中的字体大小
c.font = "normal normal 10vp";
// 将x坐标和y坐标都保留到小数点后一位
let roundX = Number(e.getX().toFixed(1));... | AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left posX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ... | draw(c: CanvasRenderingContext2D, posX: number, posY: number, e: EntryOhos, highlight: Highlight) {
let offset: MPPointF = this.getOffsetForDrawingAtPoint(posX, posY);
c.save();
c.font = "normal normal 10vp";
let roundX = Number(e.getX().toFixed(1));
let roundY = Number(e.getY().toFixed(1)... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/CustomMarkerView.ets#L47-L99 | 30f8514aab53f4cbf89e5eb69df01eb5ff20e632 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/hashing/HashTable.ets | arkts | remove | 删除键值对 | remove(key: K): boolean {
const index = this.hash(key);
let current = this.table[index];
let prev: HashNode<K, V> | null = null;
while (current) {
if (current.key === key) {
if (prev) {
prev.next = current.next;
} else {
this.table[index] = current.next;
... | AST#method_declaration#Left remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_... | remove(key: K): boolean {
const index = this.hash(key);
let current = this.table[index];
let prev: HashNode<K, V> | null = null;
while (current) {
if (current.key === key) {
if (prev) {
prev.next = current.next;
} else {
this.table[index] = current.next;
... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L93-L112 | cfa6e653d29c96b72de0798825954baee7852226 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | toPay | 跳转到订单支付
@param {number} orderId - 订单 ID
@param {number} price - 支付价格
@param {string} [from] - 来源
@returns {void} 无返回值 | static toPay(orderId: number, price: number, from?: string): void {
if (from) {
const params: OrderPayParam = { orderId, price, from };
navigateTo(OrderRoutes.Pay, params);
return;
}
const params: OrderPayParam = { orderId, price };
navigateTo(OrderRoutes.Pay, params);
} | AST#method_declaration#Left static toPay AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left price : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | static toPay(orderId: number, price: number, from?: string): void {
if (from) {
const params: OrderPayParam = { orderId, price, from };
navigateTo(OrderRoutes.Pay, params);
return;
}
const params: OrderPayParam = { orderId, price };
navigateTo(OrderRoutes.Pay, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/order/OrderNavigator.ets#L50-L58 | 0c5775fbd954af0852e1d8aae890e397bffb1643 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | assignToObservedData | 添加、覆盖字段到弹窗内置observedData中,用于弹窗数据实时变更 | assignToObservedData(newObj: object) {
if (!newObj || !this.builderOptions.observedData) {
return
}
ObjectUtil.assign(this.builderOptions.observedData, newObj)
} | AST#method_declaration#Left assignToObservedData AST#parameter_list#Left ( AST#parameter#Left newObj : 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_function_body#Left { AST#ui_control_flow#Left AST#ui_if... | assignToObservedData(newObj: object) {
if (!newObj || !this.builderOptions.observedData) {
return
}
ObjectUtil.assign(this.builderOptions.observedData, newObj)
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L268-L273 | e47d231e32fd0503e08e12262f122371133b8079 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/control_flow/loop_stmt/for_init_001_T.ets | arkts | Introduction 循环结构-init语句 | export function for_init_001_T(taint_src : string) {
let ini = "";
let t = "";
let j = 0;
for (ini = taint_src; j < 2; j++) {
t = t + ini;
}
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function for_init_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left... | export function for_init_001_T(taint_src : string) {
let ini = "";
let t = "";
let j = 0;
for (ini = taint_src; j < 2; j++) {
t = t + ini;
}
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/for_init_001_T.ets#L6-L14 | 96ee6db66773d74cf4665350fed32a01dc352ec8 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/WaterFlowDataSource.ets | arkts | modifyAllData | 改变数组数据
@param data:新数组 | public modifyAllData(data: ProductInfo[]): void {
this.dataArray = data;
this.notifyDataReload();
} | AST#method_declaration#Left public modifyAllData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ProductInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati... | public modifyAllData(data: ProductInfo[]): void {
this.dataArray = data;
this.notifyDataReload();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/WaterFlowDataSource.ets#L179-L182 | 971c558ef67776464e5b8fc41df451a502a3734e | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api11/entry/src/main/ets/MainAbility/common/MessageManager_T.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 interface Message<T> {
name: string;
value: T;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Message AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AS... | export interface Message<T> {
name: string;
value: T;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api11/entry/src/main/ets/MainAbility/common/MessageManager_T.ets#L16-L19 | 2c9a9647a3608d41686f0f3875c08e699b086af5 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isResourceStr | 判断是否是ResourceStr类型 | static isResourceStr(value: Any) {
return TypeUtil.isString(value) || TypeUtil.isResource(value);
} | AST#method_declaration#Left static isResourceStr AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left... | static isResourceStr(value: Any) {
return TypeUtil.isString(value) || TypeUtil.isResource(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L79-L81 | 6e7224e93f58fdd81dd1a6a2eb8c72d4e3e69d05 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.